|
//SimpSed.h #ifndef SIMP_SED #define SIMP_SED
#include <stdio.h> //#include
#include "SedScript.h"
#define PATTERN_SPACE_SIZE 0x100000 #define HOLD_SPACE_SIZE 0x100000 #define LINE_SIZE 0x100
#define MSG_FILE_NOT_OPEN "Cannot open file %s.\n"
typedef struct TSimpSed {
FILE *_file; int _lineNumber; char _line[LINE_SIZE]; char *_holdSpace; char *_patternSpace; SedScript *scriptList;
void (*parseScript)(struct TSimpSed *self, char *script); void (*runScript)(struct TSimpSed *self); /** sed commands, such as x,d,h,g,p and so on. */ int (*next)(struct TSimpSed *self); // n, returns -1, 0, 1
int (*nextA)(struct TSimpSed *self); // N, returns -1, 0, 1
void (*exchange)(struct TSimpSed *self); // x
void (*delete)(struct TSimpSed *self); // d
void (*hold)(struct TSimpSed *self); // h
void (*holdA)(struct TSimpSed *self); // H
void (*get)(struct TSimpSed *self); // g
void (*getA)(struct TSimpSed *self); // G
void (*print)(struct TSimpSed *self); // p
void (*destroy)(struct TSimpSed *self); // public..
void (*exec)(struct TSimpSed *, char *script, char *fileName); } SimpSed;
SimpSed getSed();
#endif
|