Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

bayonnescript.h

Go to the documentation of this file.
00001 // Copyright (C) 1999-2001 Open Source Telecom Corporation.
00002 //  
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 // 
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software 
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016 // 
00017 // As a special exception to the GNU General Public License, permission is 
00018 // granted for additional uses of the text contained in its release 
00019 // of ccscript.
00020 // 
00021 // The exception is that, if you link the ccscript library with other
00022 // files to produce an executable, this does not by itself cause the
00023 // resulting executable to be covered by the GNU General Public License.
00024 // Your use of that executable is in no way restricted on account of
00025 // linking the ccscript library code into it.
00026 // 
00027 // This exception does not however invalidate any other reasons why
00028 // the executable file might be covered by the GNU General Public License.
00029 // 
00030 // This exception applies only to the code released under the
00031 // name ccscript.  If you copy code from other releases into a copy of
00032 // ccscript, as the General Public License permits, the exception does
00033 // not apply to the code that you add in this way.  To avoid misleading
00034 // anyone as to the status of such modified files, you must delete
00035 // this exception notice from them.
00036 // 
00037 // If you write modifications of your own for ccscript, it is your choice
00038 // whether to permit this exception to apply to your modifications.
00039 // If you do not wish that, delete this exception notice.  
00040 
00041 #ifndef CCXX_BAYONNESCRIPT_H_
00042 #define CCXX_BAYONNESCRIPT_H_
00043 
00044 #ifndef CCXX_MISC_H_
00045 #include <cc++/misc.h>
00046 #endif
00047 
00048 #ifndef CCXX_FILE_H_
00049 #include <cc++/file.h>
00050 #endif
00051 
00052 #ifndef CCXX_BUFFER_H_
00053 #include <cc++/buffer.h>
00054 #endif
00055 
00056 #include <iostream>
00057 #include <fstream>
00058 
00059 #ifdef  CCXX_NAMESPACES
00060 namespace ost {
00061 #endif
00062 
00063 class __EXPORT ScriptCommand;
00064 class __EXPORT ScriptImage;
00065 class __EXPORT ScriptInterp;
00066 class __EXPORT ScriptData;
00067 
00068 #define MAX_LOCKS 8
00069 #define TRAP_BITS (sizeof(unsigned long) * 8)
00070 #define SCRIPT_STACK_SIZE 31
00071 #define SCRIPT_TEMP_SPACE 16
00072 #define KEYWORD_INDEX_SIZE 37
00073 #define SYMBOL_INDEX_SIZE 187
00074 #define SCRIPT_INDEX_SIZE KEYWORD_INDEX_SIZE
00075 #define SCRIPT_MAX_ARGS 256
00076 #define SCRIPT_RELEASE  3
00077 
00078 class __EXPORT Script
00079 {
00080 protected:
00081         class __EXPORT Line;
00082 
00083 public:
00084         typedef bool (ScriptInterp::*Method)(void);
00085         typedef char *(ScriptCommand::*Check)(Line *line, ScriptImage *img);
00086         typedef bool (*Cond)(ScriptInterp *interp, const char *v);
00087         typedef long (*Function)(long *args, unsigned prec);
00088         typedef char *(*Meta)(ScriptInterp *interp, const char *token);
00089         typedef const char * (*Parse)(ScriptImage *img, const char *token);
00090         typedef void (*Init)(void);
00091 
00092         enum    SymType
00093         {
00094                 NORMAL = 0,
00095                 ALIAS,
00096                 FIFO,
00097                 SEQUENCE,
00098                 STACK,
00099                 COUNTER,
00100                 POINTER,
00101                 REF,
00102                 CACHE,
00103                 ARRAY,
00104                 RECORD
00105         };
00106         typedef enum SymType SymType;
00107 
00108 #pragma pack(1)
00109         typedef struct _symbol
00110         {
00111                 struct _symbol *next;
00112                 const char *id;
00113                 struct
00114                 {
00115                         unsigned size : 16;
00116                         bool initial : 1;
00117                         bool system : 1;
00118                         bool readonly : 1;
00119                         bool commit : 1;
00120                         bool large : 1;
00121                         SymType type : 6;
00122                 } flags;
00123                 char data[1];
00124         }       Symbol;
00125 
00126         class __EXPORT Test
00127         {
00128         public:
00129                 const char *id;
00130                 Cond handler;
00131                 Test *next;
00132         };
00133 
00134         class __EXPORT Attr
00135         {
00136         public:
00137                 const char *id;
00138                 Meta meta;
00139                 Attr *next;
00140         };
00141 
00142         class __EXPORT Fun
00143         {
00144         public:
00145                 const char *id;
00146                 unsigned args;
00147                 Function fn;
00148                 Fun *next;
00149         };
00150 
00151         class __EXPORT PreParse
00152         {
00153         public:
00154                 const char *id;
00155                 Parse parse;
00156                 PreParse *next;
00157         };
00158 
00159         class __EXPORT InitScript
00160         {
00161         public:
00162                 Init handler;
00163                 InitScript *next;
00164         };
00165 
00166 protected:
00167         class __EXPORT Line
00168         {
00169         public:
00170                 Line *next;
00171                 unsigned long cmask;
00172                 unsigned long mask;
00173                 bool hold : 1;
00174                 bool sync : 1;
00175                 unsigned loop : 14;
00176                 unsigned argc : 8;
00177                 unsigned line : 10;
00178                 unsigned lnum : 14;
00179                 Method method;
00180                 char *cmd;
00181                 char **args;
00182         };
00183 
00184 public:
00185         class __EXPORT Name
00186         {
00187         public:
00188                 class __EXPORT Event
00189                 {
00190                 public:
00191                         Event *next;
00192                         Line *line;
00193                         char type;
00194                         const char *name;
00195                 }       *events;
00196 
00197                 Name *next;
00198                 Line *first;
00199                 Line *trap[TRAP_BITS];
00200                 unsigned long mask;
00201                 char *name;
00202                 char *filename;
00203                 enum Mode
00204                 {
00205                         mORIGINAL,
00206                         mCOPIED,
00207                         mCOPY,
00208                         mDATA
00209                 } mode : 4;
00210                 enum Access
00211                 {
00212                         aPUBLIC,
00213                         aPROTECTED,
00214                         aPRIVATE,
00215                         aFUNCTION
00216                 } access : 4;
00217                 typedef enum Mode Mode;
00218                 typedef enum Access Access;
00219         };
00220 
00221         class __EXPORT Initial
00222         {
00223         public:
00224                 const char *name;
00225                 unsigned size;
00226                 const char *value;
00227         };
00228 
00229         class __EXPORT Define
00230         {
00231         public:
00232                 const char *keyword;
00233                 Method method;
00234                 Check check;
00235         };
00236 
00237 public:
00238 
00239 #pragma pack()
00240 
00248         class __EXPORT Locks : private ThreadLock, private MemPager
00249         {
00250         private:
00251                 typedef struct _lock
00252                 {
00253                         struct _lock *next;
00254                         unsigned count;
00255                         ScriptInterp *owner;
00256                         char id[1];
00257                 }       lck;
00258 
00259                 unsigned count;
00260                 unsigned getIndex(const char *id);
00261                 lck *hash[KEYWORD_INDEX_SIZE];
00262 
00263         public:
00264                 void release(ScriptInterp *interp);
00265                 bool lock(ScriptInterp *interp, const char *id);
00266                 bool unlock(ScriptInterp *interp, const char *id);
00267 
00268                 Locks();
00269         };
00270 
00280         class __EXPORT Package : public DSO
00281         {
00282         public:
00283                 static Package *first;
00284                 Package *next;
00285                 char *filename;
00286 
00287                 Package(const char *name);
00288         };
00289 
00290         static bool use(const char *name);
00291 
00299         class __EXPORT Property
00300         {
00301         private:
00302                 friend class __EXPORT ScriptInterp;
00303 
00304                 static Property *first;
00305                 Property *next;
00306                 const char *id;
00307 
00308         protected:
00317                 virtual void setProperty(char *data, char *temp, unsigned size) = 0;
00318 
00325                 virtual long getValue(const char *data)
00326                         {return atol(data);};
00327 
00335                 virtual void setValue(char *data, unsigned len, long value)
00336                         {snprintf(data, len + 1, "%ld", value);};
00337 
00344                 virtual bool isProperty(const char *data)
00345                         {return false;};
00346 
00354                 virtual void getProperty(char *data, char *temp, unsigned size) = 0;
00355 
00363 //              virtual void adjProperty(char *data, size_t size, int adjust)
00364 //                      {return;};
00365 
00372                 virtual long adjustValue(long value)
00373                         {return value;};
00374 
00380                 virtual unsigned getPropertySize(void)
00381                         {return 0;};
00382 
00383                 Property(const char *name);
00384 
00385         public:
00386                 static Property* find(const char *name);        
00387         };
00388 };
00389 
00390 
00391 
00399 class __EXPORT ScriptModule : public Script
00400 {
00401 private:
00402         friend class __EXPORT ScriptInterp;
00403         friend class __EXPORT ScriptCommand;
00404         friend class __EXPORT ScriptImage;
00405         static ScriptModule *first;
00406         static PreParse *preparse;
00407         static InitScript *inits;
00408         ScriptModule *next;
00409         const char *cmd;
00410         Method handler;         // posted handler to invoke
00411 
00412 protected:
00418         virtual void moduleAttach(ScriptInterp *interp)
00419                 {return;};
00420 
00426         virtual void moduleDetach(ScriptInterp *interp, const char *id)
00427                 {return;};
00428 
00429 public:
00436         virtual char *parseScript(ScriptInterp *interp, Line *line)
00437                 {return NULL;};
00438 
00439 protected:
00447         virtual char *checkScript(Line *line, ScriptImage *img)
00448                 {return NULL;};
00449 
00455         ScriptModule(const char *name, Script::Method method = NULL);
00456 
00457 public:
00464         static ScriptModule *find(const char *name);
00465 
00472         static void addPreparse(const char *id, Parse p);
00473 
00479         static void addInit(Init p);
00480 
00484         static void init(void);
00485 
00486 
00487 };
00488 
00500 class __EXPORT ScriptCommand : public Keydata, public Mutex, public Script
00501 {
00502 private:
00503         friend class __EXPORT ScriptImage;
00504         friend class __EXPORT ScriptInterp;
00505         friend class __EXPORT ScriptModule;
00506 
00507 #pragma pack(1)
00508         typedef struct _keyword
00509         {
00510                 struct _keyword *next;
00511                 Method method;
00512                 Check check;
00513                 char keyword[1];
00514         }       Keyword;
00515 #pragma pack()
00516 
00517 
00518         ThreadQueue *tq;
00519         Keyword *keywords[KEYWORD_INDEX_SIZE];
00520         char *traps[TRAP_BITS];
00521         ScriptImage *active;
00522         int keyword_count;
00523         int trap_count;
00524         unsigned long imask;
00525         bool copied;
00526         unsigned dbcount;
00527         void *dbc;
00528 
00529 protected:
00530         unsigned activity;      // activity counter
00531 
00539         Method getHandler(const char *keyword);
00540 
00548         char *check(char *command, Line *line, ScriptImage *img);
00549 
00556         virtual unsigned getTrapId(const char *trap);
00557 
00563         virtual unsigned long getTrapDefault(void)
00564                 {return 0x00000003;};
00565 
00571         virtual unsigned long getTrapHandler(Name *scr)
00572                 {return getTrapDefault();}
00573 
00581         virtual unsigned long getTrapMask(unsigned id);
00582 
00591         virtual unsigned long getTrapModifier(const char *trapname)
00592                 {return getTrapMask(trapname);};
00593 
00602         virtual unsigned long getTrapMask(const char *trapname);
00603 
00604 public:
00608         char *chkIgnore(Line *line, ScriptImage *img);
00609 
00613         char *chkModule(Line *line, ScriptImage *img);
00614 
00618         char *chkUse(Line *line, ScriptImage *img);
00619 
00626         char *chkHasModify(Line *line, ScriptImage *img);
00627 
00633         char *chkHasVars(Line *line, ScriptImage *img);
00634 
00642         char *chkHasList(Line *line, ScriptImage *img);
00643 
00651         char *chkNoArgs(Line *line, ScriptImage *img);
00652 
00660         char *chkHasArgs(Line *line, ScriptImage *img);
00661 
00662 protected:
00670         void load(Script::Define *keywords);
00671 
00680         int trap(const char *name, bool inherited = true);
00681 
00687         inline int getCount(void)
00688                 {return trap_count;};
00689 
00693         bool isInherited(unsigned id);
00694 
00701         virtual char *check(Check chk, Line *line, ScriptImage *img)
00702                 {return (this->*(chk))(line, img);};
00703 
00707         ScriptCommand();
00708 
00712         ScriptCommand(ScriptCommand *ini);
00713 
00714 public:
00715         Mutex dblock;   // database lock object.
00716 
00722         inline unsigned getActivity(void)
00723                 {return activity;};
00724 
00730         inline bool isCopied(void)
00731                 {return copied;};
00732 
00738         void *getDatabase(void);
00739 
00745         void setDatabase(void *dbc);
00746 
00753         void *endDatabase(void);
00754 
00761         bool setThreadQueue(ThreadQueue *tq);
00762 
00768         inline ThreadQueue *getThreadQueue(void)
00769                 {return tq;};
00770 };
00771 
00781 class __EXPORT ScriptSymbol : public SharedMemPager, public Script
00782 {
00783 private:
00784         friend class __EXPORT ScriptInterp;
00785 
00786         unsigned symsize, symlimit;
00787         Symbol *index[SYMBOL_INDEX_SIZE + 1];
00788         char _idname[33];
00789         const char *setName(const char *id);
00790 
00791         unsigned getIndex(const char *symbol);
00792 
00793 protected:
00794         Symbol **record;
00795 
00796 public:
00811         virtual Symbol *getEntry(const char *symbol, unsigned size = 0);
00812 
00816         void setExclusive(bool enable);
00817 
00818 public:
00828         virtual void commit(Symbol *sym);
00829 
00835         inline unsigned getSymbolSize(void)
00836                 {return symsize;};
00837 
00838         ScriptSymbol(unsigned size, size_t pgsize = 1024, const char *name = NULL);
00839         ~ScriptSymbol();
00840 
00847         void *getPointer(const char *symbol);
00848 
00856         bool setPointer(const char *symbol, void *data);
00857 
00864         bool setStruct(const char *symbol);
00865 
00872         char *getSymbol(const char *symbol);
00873 
00881         char *setSymbol(const char *symbol, const char *value = "");
00882 
00890         char *setConst(const char *symbol, const char *value = "");
00891 
00900         bool makeArray(const char *id, unsigned char count, unsigned short recsize);
00901 
00910         bool makeSequence(const char *id, unsigned char count, unsigned char recsize);
00911 
00912         /*
00913          * Creating a cache object (looping lifo)
00914          *
00915          * @return false if fail.
00916          * @param name of cache.
00917          * @param max. number of sequences.
00918          * @param size of cache data record.
00919          */
00920         bool makeCache(const char *id, unsigned char count, unsigned char recsize);
00921 
00930         bool makeStack(const char *id, unsigned char count, unsigned char recsize);
00931 
00940         bool makeFifo(const char *id, unsigned char count, unsigned char recsize);
00941 
00948         bool makeCounter(const char *id);
00949 
00957         bool postSymbol(Symbol *sym, const char *value);
00958 
00959 
00967         bool removeSymbol(Symbol *sym, const char *value);
00968 
00975         char *readSymbol(Symbol *sym);
00976 
00984         bool setAlias(const char *symbol, const char *source);
00985 
00993         bool swapSymbol(const char *oldname, const char *newname);
00994 
01001         Symbol *getAlias(const char *symbol);
01002 
01010         char *setSymbol(const char *symbol, int size = 0);
01011 
01019         void clrSymbol(const char *id);
01020 
01024         void purge(void);
01025 
01029         unsigned gather(Symbol **index, unsigned max, const char *prefrix, const char *suffix = "");
01030 };
01031 
01041 class __EXPORT ScriptImage : public Keydata, public Script
01042 {
01043 protected:
01044         std::ifstream scrSource;
01045         std::istream *scrStream;
01046         ScriptCommand *cmds;
01047         int refcount;
01048         Name *index[SCRIPT_INDEX_SIZE + 1];
01049         char *buffer;
01050         unsigned bufsize;
01051         char *bp;
01052         bool quote;
01053         unsigned paren;
01054         Mutex duplock;
01055         unsigned inccount;
01056         const char *incfiles[256];
01057         
01058         class   InitialList : public Script::Initial
01059         {
01060         public:
01061                 InitialList *next;
01062         }       *ilist;
01063 
01064         friend class __EXPORT ScriptInterp;
01065         friend class __EXPORT ScriptModule;
01066 
01067 public:
01068         char *getToken(char **pre = NULL);
01069 
01070 protected:
01077         Method getHandler(const char *keyword)
01078                 {return cmds->getHandler(keyword);};
01079 
01087         ScriptImage(ScriptCommand *cmdset, const char *symset);
01088 
01092         void purge(void);
01093 
01101         Name *include(const char *scrfile);
01102 
01111         int compile(const char *scrfile);
01112 
01122         int compile(const char *scrfile, char *name);
01123 
01131         int compile(std::istream *str, char *name, const char *scrname = NULL);
01132 
01138         void commit(void);
01139 
01146         virtual const char *getDefined(const char *token)
01147                 {return getLast(token);};
01148 
01154         void load(Initial *ilist);
01155 
01163         void initial(const char *keyword, const char *value, unsigned size = 0);
01164 
01171         const char *preproc(const char *token);
01172 
01173 public:
01180         virtual Name *getScript(const char *name);
01181 
01189         virtual Name *dupScript(const char *name, const char *target);
01190 
01199         unsigned gather(const char *suffix, Name **array, unsigned size);
01200 
01207         inline std::istream *getSource(void)
01208                 {return (std::istream *)&scrSource;};
01209 };
01210 
01218 class __EXPORT ScriptInterp : public ScriptSymbol
01219 {
01220 private:
01221         friend class __EXPORT ScriptImage;
01222         friend class __EXPORT Script::Locks;
01223         friend class __EXPORT ScriptModule;
01224         friend class __EXPORT ScriptData;
01225 
01226 #pragma pack(1)
01227         class __EXPORT Context
01228         {
01229         public:
01230                 Name *script;
01231                 Line *line, *read, *first;
01232                 unsigned short index;
01233                 ScriptSymbol *local;
01234                 bool caseflag : 1;
01235                 bool tranflag : 1;
01236                 bool advance : 1;
01237                 unsigned decimal : 3;
01238                 unsigned base : 6;
01239                 unsigned long mask;
01240         };
01241 #pragma pack()
01242 
01243         static Attr *attr;
01244         static Test *test;
01245         static Fun *ifun;
01246         static Locks locks;
01247 
01248 protected:
01249         ScriptCommand *cmd;
01250         ScriptImage *image;
01251         Context script[SCRIPT_STACK_SIZE + 1];
01252         char *temps[SCRIPT_TEMP_SPACE];
01253         int tempidx;
01254         unsigned stack;
01255         unsigned symsize;
01256         size_t pgsize;
01257         unsigned long signalmask;
01258         bool once, warn, trace, initialized;
01259         unsigned steps;
01260         ScriptSymbol *recmode;
01261 
01262         bool scrRestart(void);
01263         bool scrEnable(void);
01264         bool scrDisable(void);
01265         bool scrUse(void);
01266         bool scrLoadable(void);
01267         bool scrPack(void);
01268         bool scrUnpack(void);
01269         bool scrOn(void);
01270         bool scrSlog(void);
01271         bool scrBasename(void);
01272         bool scrDirname(void);
01273         bool scrFullpath(void);
01274         bool scrGather(void);
01275         bool scrDump(void);
01276         bool scrInc(void);
01277         bool scrDec(void);
01278         bool scrFifo(void);
01279         bool scrMin(void);
01280         bool scrMax(void);
01281         bool scrCounter(void);
01282         bool scrReset(void);
01283         bool scrRemove(void);
01284         bool scrPost(void);
01285         bool scrPostList(void);
01286         bool scrStack(void);
01287         bool scrCache(void);
01288         bool scrArray(void);
01289         bool scrIndex(void);
01290         bool scrSequence(void);
01291         bool scrDup(void);
01292         bool scrArm(void);
01293         bool scrDisarm(void);
01294         bool scrNumber(void);
01295         bool scrDecimal(void);
01296         bool scrLocal(void);
01297         bool scrSet(void);
01298         bool scrAlias(void);
01299         bool scrRef(void);
01300         bool scrConst(void);
01301         bool scrVar(void);
01302         bool scrSize(void);
01303         bool scrInit(void);
01304         bool scrClear(void);
01305         bool scrCall(void);
01306         bool scrHas(void);
01307         bool scrMissing(void);
01308         bool scrLabel(void);
01309         bool scrCase(void);
01310         bool scrEndcase(void);
01311         bool scrError(void);
01312         bool scrStruct(void);
01313         bool scrIfThen(void);
01314         bool scrThen(void);
01315         bool scrElse(void);
01316         bool scrEndif(void);
01317         bool scrBegin(void);
01318         bool scrEnd(void);
01319         bool scrFor(void);
01320         bool scrRead(void);
01321         bool scrMap(void);
01322         bool scrRepeat(void);
01323         bool scrForeach(void);
01324         bool scrFordata(void);
01325         bool scrFordatasource(void);
01326         bool scrForarray(void);
01327         bool scrTryeach(void);
01328         bool scrSwap(void);
01329         bool scrDo(void);
01330         bool scrLoop(void);
01331         bool scrBreak(void);
01332         bool scrContinue(void);
01333         bool scrReturn(void);
01334         bool scrPop(void);
01335         bool scrSelect(void);
01336         bool scrOnce(void);
01337         bool scrLock(void);
01338         bool scrTry(void);
01339         bool scrSkip(void);
01340         bool expConditional(void);
01341 
01342 public:
01343         virtual const char *getPrefixPath(void)
01344                 {return getKeyword("prefix");};
01345                 
01346         static long getRealValue(double val, unsigned prec);
01347         long getIntValue(const char *text, unsigned prec, Property *property = NULL);
01348         int getExpression(long *list, int max, unsigned prec, Property *property = NULL);
01349         static double getDouble(long value, unsigned prec);
01350         static long getInteger(long value, unsigned prec);
01351         static long getTens(unsigned prec);
01352 
01353         static void addFunction(const char *name, unsigned count, Function i);
01354         static void addConditional(const char *name, Cond test);
01355         static void addAttribute(const char *name, Meta meta);
01356         friend class __EXPORT ScriptCommand;
01357 
01358 protected:
01359         inline void setCommand(ScriptCommand *sc)
01360                 {cmd = sc;};
01361 
01362         char _idname[33];
01363         unsigned char lckcount;
01364         ScriptData *datasource;
01365 
01372         ScriptInterp(ScriptCommand *cmd, unsigned symsize, size_t pgsize = 1024, const char *name = NULL);
01373 
01374         ~ScriptInterp();
01375 
01376 public:
01381         void setLocal(void);
01382 
01388         void clrLocal(void);
01389 
01393         ScriptSymbol *getSymbols(void)
01394                 {return script[stack].local;};
01395 
01405         bool setVariable(const char *id, unsigned size, const char *value = NULL);
01406                                                                                 
01413         const char *getVariable(const char *id);
01414 
01415 protected:
01421         bool getOnce(void);
01422 
01428         inline void Notify(unsigned long mask)
01429                 {signalmask |= mask;};
01430 
01436         inline void Notify(const char *str)
01437                 {signalmask |= cmd->getTrapMask(str);};
01438 
01444         unsigned long getMask(void);
01445 
01451         void setLine(Line *line);
01452 
01458         inline unsigned long getScriptMask(const char *id)
01459                 {return cmd->getTrapMask(id);};
01460 
01461 public:
01467         inline ScriptCommand *getCommand(void)
01468                 {return cmd;};
01469 
01470 protected:
01478         bool conditional(void);
01479 
01485         bool scrExit(void);
01486 
01490         bool scrGoto(void);
01491 
01495         bool scrRaise(void);
01496 
01503         bool intGoto(bool event = false);
01504 
01508         virtual void evtGoto(void)
01509                 {return;};
01510 
01511 public:
01517         virtual void cleardigits(bool all)
01518                 {return;};
01519 
01524         virtual char getdigit(void)
01525                 {return 0;};
01526 
01527 protected:
01531         bool scrIf(void);
01532 
01536         bool ifGoto(void);
01537 
01541         bool scrData(void);
01542 
01548         virtual unsigned getId(void)
01549                 {return 0;};
01550 
01551 
01558         virtual bool getGlobalTrap(unsigned id)
01559                 {return false;};
01560 
01561 public:
01568         bool setData(const char *scrname);
01569 
01573         char getPackToken(void);
01574 
01578         void clrTransactions(void)
01579                 {script[stack].tranflag = false;};
01580 
01588         Symbol *initVariable(unsigned size = 0);
01589 
01593         void rewindTemp(void);
01594 
01600         void setTemp(const char *value);
01601 
01602 public:
01606         void advance(void);
01607 
01614         void error(const char *error);
01615 
01616 protected:
01624         void trap(unsigned id);
01625 
01632         void trap(const char *trapname);
01633 
01639         bool push(void);
01640 
01646         bool pull(void);
01647 
01651         void clearStack(void);
01652 
01658         unsigned long getScriptMask(void);
01659 
01669         bool signal(const char *trapname);
01670 
01681         virtual bool event(const char *evtname, bool inheret = true);
01682 
01690         bool signal(unsigned trapid);
01691 
01699         virtual bool execute(Method method)
01700                 {return (this->*(method))();};
01701 
01710         virtual void stop(unsigned long mask)
01711                 {return;};
01712 
01717         virtual void exit(void) = 0;
01718 
01725         Name *getScriptImage(const char *label);
01726 
01733         Name *getScriptCopy(const char *src);
01734 
01740         virtual void sleepScheduler(timeout_t timeout)
01741                 {return;};
01742 
01748         virtual void stepScheduler(const char *trapname)
01749                 {trap(trapname);};
01750 
01756         virtual void setExclusive(bool enable)
01757                 {return;};
01758 
01762         void initRuntime(Name *name);
01763 
01768         virtual void initialize(void)
01769                 {return;};
01770 
01771 public:
01781         Symbol *getLocal(const char *name, unsigned size = 0);
01782 
01790         bool attach(const char *scrname);
01791 
01796         void detach(void);
01797 
01804         bool redirect(const char *scrname);
01805 
01813         bool step(void);
01814 
01820         inline bool isActive(void)
01821                 {return (script[stack].line != NULL);};
01822 
01830         char *getOption(const char *def = NULL);
01831 
01839         char *getKeyword(const char *keyword);
01840 
01844         unsigned initKeywords(unsigned size);
01845 
01853         char *getValue(const char *def = NULL);
01854 
01861         char *getString(void);
01862 
01868         char *getTempBuffer(void);
01869 
01875         void missing(const char *sym);
01876 
01883         char *getContent(char *sym);
01884 
01890         inline Line *getScript(void)
01891                 {return script[stack].line;};
01892 
01898         inline bool hasEvents(void)
01899                 {return (script[stack].script->events != NULL);};
01900 
01906         const char *getMember(void);
01907 
01913         inline Name *getObject(void)
01914                 {return script[stack].script;};
01915 
01922         inline ScriptImage *getImage(void)
01923                 {return image;};
01924 
01930         inline void warning(bool enable)
01931                 {warn = enable;};
01932 
01938         inline unsigned getDecimal(void)
01939                 {return script[stack].decimal;};
01940 };
01941 
01951 class __EXPORT ScriptData : public Script
01952 {
01953 protected:
01954         friend class __EXPORT ScriptInterp;
01955         
01962         virtual bool isId(const char *id) = 0;
01963 
01971         virtual bool fetch(ScriptInterp *interp, unsigned row) = 0;
01972 
01976         inline void setSource(ScriptInterp *interp)
01977                 {interp->datasource = this;};
01978 };
01979 
01980 #ifdef  CCXX_NAMESPACES
01981 }
01982 #endif
01983 
01984 #endif
01985 

Generated on Tue Sep 13 02:19:08 2005 for Bayonne by  doxygen 1.4.4