⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sgml2.c

📁 harvest是一个下载html网页得机器人
💻 C
📖 第 1 页 / 共 2 页
字号:
/* FILEOPEN: Call IOOPEN to open an external entity (file).*/VOID fileopen()           /* Open an external entity's file. */{     iorc = ioopen(ECB.etx.x, &SCBFCB);}/* FILEREAD: Call IOREAD to read an open external entity (file).*/VOID fileread()           /* Read the current external entity's file. */{     int newfile;     iorc = ioread(SCBFCB, rbufs, &newfile);     FPOS = (FBUF = rbufs) - 1;            /* Actual read buffer. */     if (newfile) RCNT = 0;}/* FILEPEND: Call IOPEND to close an open external entity (file) temporarily.*/VOID filepend(es)            /* Close the current external entity's file. */int es;                      /* Local index to scbs. */{     while (--es>=0) {             /* Find last external file on stack. */          int off;          if (!FILESW) continue;   /* Not an external file. */	  if (!FBUF) continue;     /* Already suspended. */	  off = CCO;	  assert(off >= -1);	  if (off < 0) off = 0;	  else CCO = 0;	  FPOS -= CCO;	  SCB.pushback = FPOS[-1];          FBUF = 0;                /* Indicate pending file. */          RSCC += off;             /* Update characters-in-record counter. */	  if (es == tages)	       tagctr += off;      /* Update tag length counter. */	  iopend(SCBFCB, off, rbufs);          return;     }}/* FILECONT: Call IOCONT to reopen an external entity (file).*/VOID filecont()           /* Open an external entity's file. */{     iorc = iocont(SCBFCB);}/* FILECLOS: Call IOCLOSE to close an open external entity (file).*/VOID fileclos()           /* Close the current external entity's file. */{     if (!SCBFCB)       return;     ioclose(SCBFCB);     /* The fcb will have been freed by sgmlio.	Make sure we don't access it again. */     SCBFCB = NULL;}/* ERROR: Interface to text processor SGML I/O services for error handling.*/VOID error(e)struct error *e;{     scbset();                /* Update location in source control block. */     msgprint(e);}/* PTRSRCH: Find a pointer in a list and return its index.            Search key must be on list as there is no limit test.            This routine is internal only -- not for user data.*/UNIV mdnmtab[] = {     (UNIV)key[KATTLIST],     (UNIV)key[KDOCTYPE],     (UNIV)key[KELEMENT],     (UNIV)key[KENTITY],     (UNIV)key[KLINKTYPE],     (UNIV)key[KLINK],     (UNIV)key[KNOTATION],     (UNIV)sgmlkey,     (UNIV)key[KSHORTREF],     (UNIV)key[KUSELINK],     (UNIV)key[KUSEMAP]};UNIV pcbtab[] = {     (UNIV)&pcbconc,     (UNIV)&pcbcone,     (UNIV)&pcbconm,     (UNIV)&pcbconr,     (UNIV)&pcbetag,     (UNIV)&pcbgrcm,     (UNIV)&pcbgrcs,     (UNIV)&pcbgrnm,     (UNIV)&pcbgrnt,     (UNIV)&pcblitc,     (UNIV)&pcblitp,     (UNIV)&pcblitr,     (UNIV)&pcblitt,     (UNIV)&pcblitv,     (UNIV)&pcbmd,     (UNIV)&pcbmdc,     (UNIV)&pcbmdi,     (UNIV)&pcbmds,     (UNIV)&pcbmsc,     (UNIV)&pcbmsi,     (UNIV)&pcbmsrc,     (UNIV)&pcbpro,     (UNIV)&pcbref,     (UNIV)&pcbstag,     (UNIV)&pcbval,     (UNIV)&pcbeal,     (UNIV)&pcbsd,};UNS ptrsrch(ptrtab, ptr)UNIV ptrtab[];UNIV ptr;{     UNS i;     for (i = 0; ; ++i)          if (ptrtab[i] == ptr)	       break;     return i;}/* MDERR: Process errors for markup declarations.          Prepare the special parameters that only exist for          markup declaration errors.*/VOID mderr(number, parm1, parm2)UNS number;                   /* Error number. */UNCH *parm1;                  /* Additional parameters (or NULL). */UNCH *parm2;                  /* Additional parameters (or NULL). */{     struct error err;     errorinit(&err, subdcl ? MDERR : MDERR2, number);     err.parmno = parmno;      err.subdcl = subdcl;     err.eparm[0] = (UNIV)parm1;     err.eparm[1] = (UNIV)parm2;     err.errsp = (sizeof(pcbtab)/sizeof(pcbtab[0])) + ptrsrch(mdnmtab,							      (UNIV)mdname);     error(&err);}/* SGMLERR: Process errors for SGML parser.*/VOID sgmlerr(number, pcb, parm1, parm2)UNS number;                   /* Error number. */struct parse *pcb;            /* Current parse control block. */UNCH *parm1;                  /* Error message parameters. */UNCH *parm2;                  /* Error message parameters. */{     struct error err;     errorinit(&err, DOCERR, number);     if (!pcb) pcb = prologsw ? propcb : conpcb;     err.errsp = ptrsrch(pcbtab, (UNIV)pcb);     err.eparm[0] = (UNIV)parm1;     err.eparm[1] = (UNIV)parm2;     error(&err);}/* SAVERR: Save an error for possible later use.*/UNIV saverr(number, pcb, parm1, parm2)UNS number;                   /* Error number. */struct parse *pcb;            /* Current parse control block. */UNCH *parm1;                  /* Error message parameters. */UNCH *parm2;                  /* Error message parameters. */{     struct error err;     errorinit(&err, DOCERR, number);     if (!pcb) pcb = prologsw ? propcb : conpcb;     err.errsp = ptrsrch(pcbtab, (UNIV)pcb);     err.eparm[0] = (UNIV)parm1;     err.eparm[1] = (UNIV)parm2;     scbset();     return msgsave(&err);}/* SAVMDERR: Save an md error for possible later use.*/UNIV savmderr(number, parm1, parm2)UNS number;                   /* Error number. */UNCH *parm1;                  /* Additional parameters (or NULL). */UNCH *parm2;                  /* Additional parameters (or NULL). */{     struct error err;     errorinit(&err, subdcl ? MDERR : MDERR2, number);     err.parmno = parmno;      err.subdcl = subdcl;     err.eparm[0] = (UNIV)parm1;     err.eparm[1] = (UNIV)parm2;     err.errsp = (sizeof(pcbtab)/sizeof(pcbtab[0])) + ptrsrch(mdnmtab,							      (UNIV)mdname);     scbset();     return msgsave(&err);}/* SVDERR: Print a saved error.*/VOID svderr(p)UNIV p;{     msgsprint(p);}/* EXITERR: Process terminal errors for SGML parser.*/VOID exiterr(number, pcb)UNS number;                   /* Error number. */struct parse *pcb;            /* Current parse control block. */{     struct error err;     errorinit(&err, EXITERR, number);     if (!pcb) pcb = prologsw ? propcb : conpcb;     err.errsp = ptrsrch(pcbtab, (UNIV)pcb);     error(&err);     /* The error handler should have exited. */     abort();}/* SYNERR: Process syntax errors for SGML parser.*/VOID synerr(number, pcb)UNS number;                   /* Error number. */struct parse *pcb;            /* Current parse control block. */{     struct error err;     errorinit(&err, DOCERR, number);     err.errsp = ptrsrch(pcbtab, (UNIV)pcb);     error(&err);}/* FILERR: Process a file access error.*/VOID filerr(number, parm)UNS number;UNCH *parm;{     struct error err;     errorinit(&err, FILERR, number);     err.eparm[0] = (UNIV)parm;     err.sverrno = errno;     error(&err);}/* ERRORINIT: Constructor for struct error.*/VOID errorinit(e, type, number)struct error *e;UNS type;UNS number;{     int i;     e->errtype = type;     e->errnum = number;     e->errsp = 0;     for (i = 0; i < MAXARGS; i++)          e->eparm[i] = 0;     e->parmno = 0;     e->subdcl = 0;}/*Local Variables:c-indent-level: 5c-continued-statement-offset: 5c-brace-offset: -5c-argdecl-indent: 0c-label-offset: -5comment-column: 30End:*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -