token.h: (Matching .c file)


/* token.h - Routines for basic token scanning..
 * © Copyright 1999 by John Halleck
 * All rights reserved.
 */
/* Version of September 2nd, 1999 */

#ifndef TOKEN
#define TOKEN 1

#include "errors.h"
 /* We return package standard error codes. */
 /* All of the routines can return at least:
  * ERRnotfound  - We didn't find an appropriate token.
  * ERRendoffile - We incountered end of file before a token.
  * ERRsize      - Buffer must have non-negative size.
  * ERRnil       - Nil passed instead of required pointer.
  * ERRoverflow  - Buffer was shorter than token.
  *                (Remainder of token was scanned)
  */

/* Usually these routines take a buffer for the result,
 * and an integer size for the buffer.
 * They also give a starting location.
 * They fill the buffer, and return the number of characters 
 * used.
 */

/* Initialize package */
extern error tokinitialize(error (*getroutine)(int *place));
/* Close and cleanup package */
extern error tokfinalize ();

/* What character are we looking at? */
extern int thischaracter;
/* What character follows it? */
extern int nextcharacter;
/* Have we loaded the next character? */
extern int validnextcharacter;

extern error nextchar();          /* consume next char */
extern error prefetch();          /* Load up "nextcharacter" */

extern error skipwhite();         /* Skip over white space */
extern error skipnonwhite();      /* Skip over non-white space */
extern error skipnoneolwhite();   /* Skip over non-end of line white space */
extern error skipeol();           /* Skip everything through next new line */
extern error skiptoeol();         /* Skip everything UP TO the next new line */
extern error skipto(char *list);  /* Skip up to any character in the list. */

/* Grab non-white space */
extern error nonwhitetok (int bufsize, char *buffer, int *size);

/* Grab Integer  (digits) */
extern error inttok      (int bufsize, char *buffer, int *size);
/* Grab Signed integer token */
extern error sinttok     (int bufsize, char *buffer, int *size);

/* Grab Floating point (digits[.digits])*/
extern error flttok      (int bufsize, char *buffer, int *size);
/* Grab signed floating point */
extern error sflttok     (int bufsize, char *buffer, int *size);

/* Alphabetic */
extern error alphatok    (int bufsize, char *buffer, int *size);

/* Alphabetic or numbers */
extern error alphanumtok (int bufsize, char *buffer, int *size);

/* Alphabetic, followed by alphabetic or numbers */
extern error varnamtok   (int bufsize, char *buffer, int *size);

/* printable non-space nonalphanumeric */
extern error puncttok    (int bufsize, char *buffer, int *size);

/* Token from a specific set of characters. */
extern error tokfrom     (int bufsize, char *buffer, int *size, char *list);

#endif

Go to ...


This page is http://www.cc.utah.edu/~nahaj/cave/survey/code/c/token.h.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 23rd, 2000
And the underlying file was last modified on May 11th, 2000