[BACK]Return to oxweave.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / util

Diff for /OpenXM/src/util/oxweave.c between version 1.1 and 1.4

version 1.1, 2002/04/05 01:12:09 version 1.4, 2013/08/31 08:16:02
Line 15 
Line 15 
 \section{$BA0=q$-(B}  \section{$BA0=q$-(B}
 */  */
 /* OpenXM: OpenXM/src/kxx/oxweave.c,v 1.7 2001/05/06 07:53:01 takayama Exp  /* OpenXM: OpenXM/src/kxx/oxweave.c,v 1.7 2001/05/06 07:53:01 takayama Exp
    $OpenXM$     $OpenXM: OpenXM/src/util/oxweave.c,v 1.3 2005/07/03 08:27:38 ohara Exp $
  */   */
 #include <stdio.h>  #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
   
   void usage();
   void findEndTag(int tagc,char *tagv[],int rule);
   int findNextTag(int tagc, char *tagv[],int tagc2,char *tagv2[]);
   void skipToEndTag(int tagc,char *tagv[],int rule);
   int notEOF();
   void irregularExit();
   int wcmp(char *s);
   
 /* Modify here to change the begin tag and EndComment. Less than 9 characters.  /* Modify here to change the begin tag and EndComment. Less than 9 characters.
 */  */
 char *BeginTag0="/*\x026";  /* 0x26 = & */  char *BeginTag0="/*\x026";  /* 0x26 = & */
Line 59  int OutputNoTaggedSegment = 0;
Line 69  int OutputNoTaggedSegment = 0;
 int OutputtingTaggedSegment = 0;  int OutputtingTaggedSegment = 0;
 int BeginVerbatim = 0;  int BeginVerbatim = 0;
   
   
 /*&jp \section{$B%W%m%0%i%`K\BN(B} */  /*&jp \section{$B%W%m%0%i%`K\BN(B} */
   int
 main(int argc,char *argv[]) {  main(int argc,char *argv[]) {
   extern char *BeginTag;  
   extern char *EndComment0;    extern char *EndComment0;
   extern char *EndComment1;    extern char *EndComment1;
   extern int Plain;    extern int Plain;
   int c;  
   int tagc,i;    int tagc,i;
   char *tagv[VSIZE];    char *tagv[VSIZE];
   int tagc2;    int tagc2;
Line 80  main(int argc,char *argv[]) {
Line 88  main(int argc,char *argv[]) {
   tagc = tagc2 = 0;    tagc = tagc2 = 0;
   if (argc <= 1 || argc >= VSIZE) {    if (argc <= 1 || argc >= VSIZE) {
     usage();      usage();
     exit();      exit(0);
   }else{    }else{
     for (i=1; i< argc ; i++) {      for (i=1; i< argc ; i++) {
       if (strcmp(argv[i],"--source") == 0) {        if (strcmp(argv[i],"--source") == 0) {
Line 145  main(int argc,char *argv[]) {
Line 153  main(int argc,char *argv[]) {
 }  }
   
 /*&jp \noindent $B<!$N4X?t$OMxMQK!$rI=<($9$k(B. */  /*&jp \noindent $B<!$N4X?t$OMxMQK!$rI=<($9$k(B. */
 usage() {  void usage() {
 #include "oxweaveUsage.h"  #include "oxweaveUsage.h"
 }  }
   
 #define inc(a) ((a+1) % BSIZE)  #define inc(a) ((a+1) % BSIZE)
 /*&jp \noindent {\tt wread()} $B$O(B $BI8=`F~NO$h$j$N%G!<%?$rFI$a$k$@$1(B  /*&jp \noindent {\tt wread()} $B$O(B $BI8=`F~NO$h$j$N%G!<%?$rFI$a$k$@$1(B
 $B%j%s%0%P%C%U%!(B {\tt Buf} $B$XFI$_9~$`(B.*/  $B%j%s%0%P%C%U%!(B {\tt Buf} $B$XFI$_9~$`(B.*/
   int
 wread() {  wread() {
   int c,i;    int c,i;
   static int eof = 0;    static int eof = 0;
Line 195  int wgetc(int p) {
Line 204  int wgetc(int p) {
   $BL5;k$9$Y$-%?%0$N$H$-$O(B, $B%?%0FbIt$r%9%-%C%W$7$?$N$A(B    $BL5;k$9$Y$-%?%0$N$H$-$O(B, $B%?%0FbIt$r%9%-%C%W$7$?$N$A(B
   {\tt findNextTag} $B$r:F5"E*$K8F$V(B.    {\tt findNextTag} $B$r:F5"E*$K8F$V(B.
   */    */
   int
 findNextTag(int tagc, char *tagv[],int tagc2,char *tagv2[]) {  findNextTag(int tagc, char *tagv[],int tagc2,char *tagv2[]) {
   int i;    int i;
   int c,d;    int c,d;
Line 249  findNextTag(int tagc, char *tagv[],int tagc2,char *tag
Line 259  findNextTag(int tagc, char *tagv[],int tagc2,char *tag
        ( $B$3$l$O(B, EndComment0 $B$NCM$rJQ$($k$HJQ992DG=(B. )         ( $B$3$l$O(B, EndComment0 $B$NCM$rJQ$($k$HJQ992DG=(B. )
       {\tt / /} $B$G;O$^$k>l9g$O(B, 0xa $B$,$*$o$j(B.        {\tt / /} $B$G;O$^$k>l9g$O(B, 0xa $B$,$*$o$j(B.
 */  */
 findEndTag(int tagc,char *tagv[],int rule) {  void findEndTag(int tagc,char *tagv[],int rule) {
   int i;    int i;
   int c;    int c;
   /* We are in the state 1. */    /* We are in the state 1. */
Line 261  findEndTag(int tagc,char *tagv[],int rule) {
Line 271  findEndTag(int tagc,char *tagv[],int rule) {
       if (LevelState1 > 0 && Recursive) {        if (LevelState1 > 0 && Recursive) {
         wgetc(strlen(tagv[i]));          wgetc(strlen(tagv[i]));
         printf("%s",tagv[i]);          printf("%s",tagv[i]);
         return(findEndTag(tagc,tagv,rule));                  findEndTag(tagc,tagv,rule);
           return;
       }else{        }else{
         wgetc(strlen(tagv[i]));          wgetc(strlen(tagv[i]));
         if (strcmp(tagv[i],"\n")==0) putchar('\n');          if (strcmp(tagv[i],"\n")==0) putchar('\n');
Line 285  findEndTag(int tagc,char *tagv[],int rule) {
Line 296  findEndTag(int tagc,char *tagv[],int rule) {
   irregularExit();    irregularExit();
 }  }
   
 skipToEndTag(int tagc,char *tagv[],int rule) {  void skipToEndTag(int tagc,char *tagv[],int rule) {
   int i;    int i;
   int c;    int c;
   extern char *EndComment0;    extern char *EndComment0;
Line 297  skipToEndTag(int tagc,char *tagv[],int rule) {
Line 308  skipToEndTag(int tagc,char *tagv[],int rule) {
         LevelState2--;          LevelState2--;
         if (LevelState2 > 0 && Recursive) {          if (LevelState2 > 0 && Recursive) {
           wgetc(strlen(EndComment0));            wgetc(strlen(EndComment0));
           return(skipToEndTag(tagc,tagv,rule));            skipToEndTag(tagc,tagv,rule);
             return;
         }else{          }else{
           wgetc(strlen(EndComment0));            wgetc(strlen(EndComment0));
           return;  /* our state is 0. */            return;  /* our state is 0. */
Line 308  skipToEndTag(int tagc,char *tagv[],int rule) {
Line 320  skipToEndTag(int tagc,char *tagv[],int rule) {
         LevelState2--;          LevelState2--;
         if (LevelState2 > 0 && Recursive) {          if (LevelState2 > 0 && Recursive) {
           wgetc(strlen(EndComment0));            wgetc(strlen(EndComment0));
           return(skipToEndTag(tagc,tagv,rule));            skipToEndTag(tagc,tagv,rule);
             return;
         }else{          }else{
           wgetc(strlen(EndComment1));            wgetc(strlen(EndComment1));
           return;  /* our state is 0. */            return;  /* our state is 0. */
Line 320  skipToEndTag(int tagc,char *tagv[],int rule) {
Line 333  skipToEndTag(int tagc,char *tagv[],int rule) {
           LevelState2--;            LevelState2--;
           if (LevelState2 > 0 && Recursive) {            if (LevelState2 > 0 && Recursive) {
             wgetc(strlen(EndComment0));              wgetc(strlen(EndComment0));
             return(skipToEndTag(tagc,tagv,rule));              skipToEndTag(tagc,tagv,rule);
               return;
           }else{            }else{
             wgetc(strlen(tagv[i]));              wgetc(strlen(tagv[i]));
             return;  /* our state is 0. */              return;  /* our state is 0. */
Line 347  skipToEndTag(int tagc,char *tagv[],int rule) {
Line 361  skipToEndTag(int tagc,char *tagv[],int rule) {
 {\tt s} $B$,(B 0xa,0 $B$N$H$-$O(B, Buf[Head] $B$,(B 0xa $B$J$i(B, 0 $B$rLa$9(B.  {\tt s} $B$,(B 0xa,0 $B$N$H$-$O(B, Buf[Head] $B$,(B 0xa $B$J$i(B, 0 $B$rLa$9(B.
 $B$=$&$G$J$$$J$i(B, -1 $B$rLa$9(B.  $B$=$&$G$J$$$J$i(B, -1 $B$rLa$9(B.
 */  */
   int
 wcmp(char *s) {  wcmp(char *s) {
   int n;    int n;
   int i,j;    int i,j;
Line 368  wcmp(char *s) {
Line 383  wcmp(char *s) {
   } else return(1);    } else return(1);
 }  }
   
   int
 notEOF() {  notEOF() {
   wread();    wread();
   if (Buf[Head] != -1) return(1);    if (Buf[Head] != -1) return(1);
   else return(0);    else return(0);
 }  }
   
   void
 irregularExit() {  irregularExit() {
   if (BeginVerbatim == 1) {    if (BeginVerbatim == 1) {
     if (!Plain) printf("\\end{verbatim\x07d}\n");      if (!Plain) printf("\\end{verbatim\x07d}\n");

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>