34 #ifndef _QORE_QOREPROGRAM_H    36 #define _QORE_QOREPROGRAM_H    38 #include <qore/AbstractPrivateData.h>    44 #define QP_WARN_NONE                     0    45 #define QP_WARN_WARNING_MASK_UNCHANGED   (1 << 0)       46 #define QP_WARN_DUPLICATE_LOCAL_VARS     (1 << 1)       47 #define QP_WARN_UNKNOWN_WARNING          (1 << 2)       48 #define QP_WARN_UNDECLARED_VAR           (1 << 3)       49 #define QP_WARN_DUPLICATE_GLOBAL_VARS    (1 << 4)       50 #define QP_WARN_UNREACHABLE_CODE         (1 << 5)       51 #define QP_WARN_NONEXISTENT_METHOD_CALL  (1 << 6)       52 #define QP_WARN_INVALID_OPERATION        (1 << 7)       53 #define QP_WARN_CALL_WITH_TYPE_ERRORS    (1 << 8)       54 #define QP_WARN_RETURN_VALUE_IGNORED     (1 << 9)       55 #define QP_WARN_DEPRECATED               (1 << 10)      56 #define QP_WARN_EXCESS_ARGS              (1 << 11)      57 #define QP_WARN_DUPLICATE_HASH_KEY       (1 << 12)      58 #define QP_WARN_UNREFERENCED_VARIABLE    (1 << 13)      59 #define QP_WARN_DUPLICATE_BLOCK_VARS     (1 << 14)      60 #define QP_WARN_MODULE_ONLY              (1 << 15)      61 #define QP_WARN_BROKEN_LOGIC_PRECEDENCE  (1 << 16)      62 #define QP_WARN_ALL                      -1             64 #define QP_WARN_MODULES (QP_WARN_UNREACHABLE_CODE|QP_WARN_NONEXISTENT_METHOD_CALL|QP_WARN_INVALID_OPERATION|QP_WARN_CALL_WITH_TYPE_ERRORS|QP_WARN_RETURN_VALUE_IGNORED|QP_WARN_DUPLICATE_HASH_KEY|QP_WARN_DUPLICATE_BLOCK_VARS|QP_WARN_BROKEN_LOGIC_PRECEDENCE)    66 #define QP_WARN_DEFAULT (QP_WARN_UNKNOWN_WARNING|QP_WARN_MODULES|QP_WARN_DEPRECATED)    68 enum BreakpointPolicy : 
unsigned char {
    75 DLLEXPORT 
extern const char** qore_warnings;
    78 DLLEXPORT 
extern unsigned qore_num_warnings;
    81 DLLEXPORT 
int get_warning_code(
const char* str);
    92 class FunctionCallNode;
    93 class AbstractStatement;
    97 class UserFunctionVariant;
    98 class QoreParseTypeInfo;
   100 class AbstractQoreZoneInfo;
   101 class qore_program_private;
   104 class AbstractQoreFunctionVariant;
   106 class QoreExternalFunction;
   107 class QoreExternalGlobalVar;
   110 typedef std::list<QoreBreakpoint*> bkp_list_t;
   112 hashdecl QoreBreakpointList_t : 
public bkp_list_t {
   113     DLLEXPORT QoreBreakpointList_t();
   115     DLLEXPORT ~QoreBreakpointList_t();
   127     friend class qore_program_private_base;
   128     friend class qore_program_private;
   129     friend class qore_debug_program_private;
   130     friend hashdecl ThreadLocalProgramData;
   133     qore_program_private* priv;
   139     DLLLOCAL QoreProgram& operator=(
const QoreProgram&);
   145     DLLLOCAL 
virtual ~QoreProgram();
   149     DLLEXPORT QoreProgram();
   155     DLLEXPORT QoreProgram(
int64 parse_options);
   199     DLLEXPORT 
void parseFileAndRun(
const char* filename);
   211     DLLEXPORT 
void parseAndRun(FILE *fp, 
const char* name);
   223     DLLEXPORT 
void parseAndRun(
const char* str, 
const char* name);
   233     DLLEXPORT 
void runClass(
const char* classname, 
ExceptionSink* xsink);
   247     DLLEXPORT 
void parseFileAndRunClass(
const char* filename, 
const char* classname);
   260     DLLEXPORT 
void parseAndRunClass(FILE *fp, 
const char* name, 
const char* classname);
   273     DLLEXPORT 
void parseAndRunClass(
const char* str, 
const char* name, 
const char* classname);
   284     DLLEXPORT 
void parse(FILE *fp, 
const char* name, 
ExceptionSink* xsink, 
ExceptionSink* warn_sink = 0, 
int warn_mask = QP_WARN_ALL);
   319     DLLEXPORT 
void parse(
const char* str, 
const char* lstr, 
ExceptionSink* xsink, 
ExceptionSink* warn_sink = 0, 
int warn_mask = QP_WARN_ALL);
   332     DLLEXPORT 
void parse(
const char* str, 
const char* lstr, 
ExceptionSink* xsink, 
ExceptionSink* warn_sink, 
int warn_mask, 
const char* source, 
int offset);
   343     DLLEXPORT 
void parseFile(
const char* filename, 
ExceptionSink* xsink, 
ExceptionSink* warn_sink = 0, 
int warn_mask = QP_WARN_ALL, 
bool only_first_except = 
false);
   355     DLLEXPORT 
void parsePending(
const char* code, 
const char* label, 
ExceptionSink* xsink, 
ExceptionSink* warn_sink = 0, 
int warn_mask = QP_WARN_ALL);
   370     DLLEXPORT 
void parsePending(
const char* code, 
const char* label, 
ExceptionSink* xsink, 
ExceptionSink* warn_sink, 
int warn_mask, 
const char* source, 
int offset);
   414     DLLEXPORT 
void parseRollback();
   425     DLLEXPORT 
bool existsFunction(
const char* name);
   436     DLLEXPORT QoreProgram* programRefSelf() 
const;
   439     DLLEXPORT 
void lockOptions();
   447     DLLEXPORT 
void setExecClass(
const char* ecn = 0);
   450     DLLEXPORT 
void parseSetParseOptions(
int po);
   453     DLLEXPORT 
void parseSetParseOptions(
int64 po);
   456     DLLEXPORT 
void parseDisableParseOptions(
int64 po);
   459     DLLEXPORT 
void waitForTermination();
   465     DLLEXPORT 
void waitForTerminationAndDeref(
ExceptionSink* xsink);
   478     DLLEXPORT 
int setWarningMask(
int wm);
   485     DLLEXPORT 
int enableWarning(
int code);
   492     DLLEXPORT 
int disableWarning(
int code);
   495     DLLEXPORT 
int getParseOptions() 
const;
   498     DLLEXPORT 
int64 getParseOptions64() 
const;
   505     DLLEXPORT 
void setParseOptions(
int po, 
ExceptionSink* xsink);
   519     DLLEXPORT 
void disableParseOptions(
int po, 
ExceptionSink* xsink);
   542     DLLEXPORT 
bool checkWarning(
int code) 
const;
   545     DLLEXPORT 
int getWarningMask() 
const;
   548     DLLEXPORT 
bool checkFeature(
const char* f) 
const;
   571     DLLEXPORT 
void setScriptPath(
const char* path);
   578     DLLEXPORT 
QoreValue getGlobalVariableValue(
const char* var, 
bool &found) 
const;
   585     DLLEXPORT 
QoreValue getGlobalVariableVal(
const char* var, 
bool &found) 
const;
   588     DLLEXPORT 
const AbstractQoreZoneInfo *
currentTZ() 
const;
   591     DLLEXPORT 
void setTZ(
const AbstractQoreZoneInfo *n_TZ);
   597     DLLEXPORT 
void addFeature(
const char* name);
   604     DLLEXPORT 
void parseSetTimeZone(
const char* zone);
   614     DLLEXPORT 
void parseDefine(
const char* str, 
QoreValue val);
   624     DLLEXPORT 
void parseDefine(
const char* str, 
const char* val);
   627     DLLEXPORT 
void parseCmdLineDefines(
const std::map<std::string, std::string> defmap, 
ExceptionSink& xs, 
ExceptionSink& ws, 
int w);
   635     DLLEXPORT 
void parseCmdLineDefines(
ExceptionSink& xs, 
ExceptionSink& ws, 
int w, 
const std::map<std::string, std::string>& defmap);
   681     DLLEXPORT 
const AbstractQoreFunctionVariant* runtimeFindCall(
const char* name, 
const QoreListNode* params, 
ExceptionSink* xsink) 
const;
   717     DLLEXPORT hashdecl_vec_t findAllHashDeclsRegex(
const QoreString& pattern, 
int re_opts, 
ExceptionSink* xsink) 
const;
   722     DLLEXPORT func_vec_t findAllFunctionsRegex(
const QoreString& pattern, 
int re_opts, 
ExceptionSink* xsink) 
const;
   732     DLLEXPORT gvar_vec_t findAllGlobalVarsRegex(
const QoreString& pattern, 
int re_opts, 
ExceptionSink* xsink) 
const;
   737     DLLEXPORT const_vec_t findAllNamespaceConstantsRegex(
const QoreString& pattern, 
int re_opts, 
ExceptionSink* xsink) 
const;
   742     DLLEXPORT 
const QoreExternalFunction* findFunction(
const char* path) 
const;
   765     DLLEXPORT 
const QoreExternalGlobalVar* findGlobalVar(
const char* path, 
const QoreNamespace*& pns) 
const;
   775     DLLEXPORT 
void depRef();
   780     DLLEXPORT 
void depDeref();
   789     DLLLOCAL QoreProgram(QoreProgram* pgm, 
int64 po, 
bool ec = 
false, 
const char* ecn = 
nullptr);
   791     DLLLOCAL LocalVar *createLocalVar(
const char* name, 
const QoreTypeInfo *typeInfo);
   796     DLLLOCAL 
void addFile(
char* f);
   798     DLLLOCAL 
void parseSetIncludePath(
const char* path);
   799     DLLLOCAL 
const char* parseGetIncludePath() 
const;
   806     DLLLOCAL 
const LVList* getTopLevelLVList() 
const;
   811     DLLLOCAL 
const char* parseGetScriptDir() 
const;
   814     DLLLOCAL 
bool parseExceptionRaised() 
const;
   824     DLLEXPORT 
QoreValue getLocalVariableVal(
const char* var, 
bool &found) 
const;
   832     DLLEXPORT 
void deleteAllBreakpoints();
   836     DLLEXPORT 
void getBreakpoints(QoreBreakpointList_t &bkptList);
   840     DLLEXPORT 
void getStatementBreakpoints(
const AbstractStatement* statement, QoreBreakpointList_t &bkptList);
   844     DLLEXPORT AbstractStatement* findStatement(
const char* fileName, 
int line) 
const;
   848     DLLEXPORT AbstractStatement* findFunctionStatement(
const char* functionName, 
const QoreListNode* params, 
ExceptionSink* xsink) 
const;
   855     DLLEXPORT 
unsigned long getStatementId(
const AbstractStatement* statement) 
const;
   863     DLLEXPORT AbstractStatement* resolveStatementId(
unsigned long statementId) 
const;
   880     DLLEXPORT 
unsigned getProgramId() 
const;
   888     DLLEXPORT 
static QoreProgram* resolveProgramId(
unsigned programId);
   900     DLLEXPORT 
static QoreObject* getQoreObject(QoreProgram* pgm);
   927    DLLEXPORT ~QoreProgramHelper();
   945    DLLEXPORT ~CurrentProgramRuntimeExternalParseContextHelper();
   948    DLLEXPORT 
operator bool() 
const;
   954    CurrentProgramRuntimeExternalParseContextHelper(
const CurrentProgramRuntimeExternalParseContextHelper&) = 
delete;
   955    void* 
operator new(size_t) = 
delete;
   966    DLLEXPORT ~QoreProgramContextHelper();
   972    QoreProgramContextHelper(
const QoreProgramContextHelper&) = 
delete;
   973    void* 
operator new(size_t) = 
delete;
   998    virtual void doDeref() = 0;
  1001 typedef std::list<AbstractStatement*> AbstractStatementList_t;
  1002 typedef std::list<int> TidList_t;
  1011    qore_program_private* pgm;
  1012    AbstractStatementList_t statementList;
  1013    typedef std::map<
int, 
int> TidMap_t;
  1017    static QoreBreakpointList_t breakpointList;
  1018    static volatile unsigned breakpointIdCounter;   
  1019    unsigned breakpointId;
  1021    DLLLOCAL 
void unassignAllStatements();
  1022    DLLLOCAL 
bool isStatementAssigned(
const AbstractStatement *statement) 
const;
  1025    friend class qore_program_private;
  1026    friend class AbstractStatement;
  1030    DLLLOCAL 
virtual bool checkBreak() 
const;
  1056    DLLEXPORT 
void assignStatement(AbstractStatement* statement, 
ExceptionSink* xsink);
  1060    DLLEXPORT 
void unassignStatement(AbstractStatement* statement, 
ExceptionSink* xsink);
  1064    DLLEXPORT 
void getStatements(AbstractStatementList_t &statList, 
ExceptionSink* xsink);
  1072    DLLEXPORT AbstractStatement* resolveStatementId(
unsigned long statementId, 
ExceptionSink* xsink) 
const;
  1076    DLLEXPORT 
void getThreadIds(TidList_t &tidList, 
ExceptionSink* xsink);
  1080    DLLEXPORT 
void setThreadIds(TidList_t tidList, 
ExceptionSink* xsink);
  1088    DLLEXPORT 
void removeThreadId(
int tid, 
ExceptionSink* xsink);
  1102    DLLEXPORT 
unsigned getBreakpointId() 
const;
  1110    DLLEXPORT 
static QoreBreakpoint* resolveBreakpointId(
unsigned breakpointId);
  1112    DLLEXPORT 
void setQoreObject(
QoreObject* n_qo);
  1126     DLLEXPORT ~QoreExternalProgramContextHelper();
  1129     class ProgramThreadCountContextHelper* priv;
  1141     DLLEXPORT ~QoreExternalProgramCallContextHelper();
  1144     class QoreExternalProgramCallContextHelperPriv* priv;
  1147 #endif  // _QORE_QOREPROGRAM_H allows for the parse lock for the current program to be acquired by binary modules ...
Definition: QoreProgram.h:939
 
external wrapper class for constants 
Definition: QoreReflection.h:200
 
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
 
allows the program call context to be set by external modules 
Definition: QoreProgram.h:1135
 
allows a program to be used and guarantees that it will stay valid until the destructor is run if suc...
Definition: QoreProgram.h:1120
 
the base class for all data to be used as private data of Qore objects 
Definition: AbstractPrivateData.h:44
 
Class implementing breakpoint for debugging. 
Definition: QoreProgram.h:1009
 
contains constants, classes, and subnamespaces in QoreProgram objects 
Definition: QoreNamespace.h:64
 
allows for external modules to set the current Program context explicitly 
Definition: QoreProgram.h:961
 
BreakpointPolicy policy
Definition: QoreProgram.h:1036
 
base class for call references, reference-counted, dynamically allocated only 
Definition: CallReferenceNode.h:39
 
safely manages QoreProgram objects; note the the destructor will block until all background threads i...
Definition: QoreProgram.h:912
 
Qore's string type supported by the QoreEncoding class. 
Definition: QoreString.h:81
 
Qore's string value type, reference counted, dynamically-allocated only. 
Definition: QoreStringNode.h:50
 
DLLEXPORT QoreProgram * getProgram()
returns the current QoreProgram 
 
the root namespace of a QoreProgram object 
Definition: QoreNamespace.h:286
 
This is the list container type in Qore, dynamically allocated only, reference counted. 
Definition: QoreListNode.h:52
 
defines a Qore-language class 
Definition: QoreClass.h:239
 
an abstract class for program-specific external data 
Definition: QoreProgram.h:985
 
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:67
 
The main value class in Qore, designed to be passed by value. 
Definition: QoreValue.h:262
 
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreProgram.h:126
 
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:61
 
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
 
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
 
an unresolved call reference, only present temporarily in the parse tree 
Definition: CallReferenceNode.h:68
 
typed hash declaration 
Definition: TypedHashDecl.h:44
 
provides a mutually-exclusive thread lock 
Definition: QoreThreadLock.h:47
 
provides a simple POSIX-threads-based read-write lock 
Definition: QoreRWLock.h:47
 
DLLEXPORT const AbstractQoreZoneInfo * currentTZ()
returns the current local time zone, note that if 0 = UTC