/* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */ /* From input file "dehtml.p" */ #include /* dehtml: remove html structures */ /* begin module version */ #define version 1.00 /* of dehtml.p 1998 January 3 origin 1998 jan 3 from decom */ /* end module version */ /* begin module describe.dehtml */ /* name dehtml: remove html structures synopsis dehtml(input: in; output: out) files input: a program having HTML tags output: the same program with HTML tags removed description HTML tags are indicated by < and >. All text between these and including them is removed. see also decom.p author Thomas Dana Schneider bugs technical notes */ /* end module describe.dehtml */ #define debug false /* turn on to see states changing */ /* state of the program. The program moves between three states depending on the characters it sees: 0: outside html 1: inside html 2: inside end of html */ main(argc, argv) int argc; Char *argv[]; { Char c = ' '; /* the current character just read */ Char p; /* the character previous to c */ long state = 0; PASCAL_MAIN(argc, argv); /* start outside the comments */ /* previous character is neutral */ while (!P_eof(stdin)) { while (!P_eoln(stdin)) { c = getchar(); if (c == '\n') c = ' '; switch (state) { case 0: /* outside html */ if (c == '<') state = 1; break; case 1: /* inside html comment */ if (c == '>') state = 2; break; case 2: /* ending >, delay one character */ if (c == '<') state = 1; /* start next one right away! */ else state = 0; break; } if (state == 0) putchar(c); if (debug) { if (state == 1) putchar('1'); if (state == 2) putchar('2'); } } scanf("%*[^\n]"); getchar(); putchar('\n'); } exit(EXIT_SUCCESS); } /* End. */