Qore Programming Language - C/C++ Library  0.8.13.6
QoreProgram.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreProgram.h
4 
5  Program Object Definition
6 
7  Qore Programming Language
8 
9  Copyright (C) 2003 - 2017 Qore Technologies, s.r.o.
10 
11  Permission is hereby granted, free of charge, to any person obtaining a
12  copy of this software and associated documentation files (the "Software"),
13  to deal in the Software without restriction, including without limitation
14  the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  and/or sell copies of the Software, and to permit persons to whom the
16  Software is furnished to do so, subject to the following conditions:
17 
18  The above copyright notice and this permission notice shall be included in
19  all copies or substantial portions of the Software.
20 
21  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  DEALINGS IN THE SOFTWARE.
28 
29  Note that the Qore library is released under a choice of three open-source
30  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
31  information.
32 */
33 
34 #ifndef _QORE_QOREPROGRAM_H
35 
36 #define _QORE_QOREPROGRAM_H
37 
38 #include <qore/AbstractPrivateData.h>
39 #include <qore/Restrictions.h>
40 //#include <qore/intern/qore_program_private.h>
41 
42 // warnings - must correspond with the string order in QoreProgram.cpp
43 // new warnings must also be added as constants
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
63 
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)
65 
66 #define QP_WARN_DEFAULT (QP_WARN_UNKNOWN_WARNING|QP_WARN_MODULES|QP_WARN_DEPRECATED)
67 
68 enum BreakpointPolicy : unsigned char {
69  BKP_PO_NONE = 0,
70  BKP_PO_ACCEPT = 1,
71  BKP_PO_REJECT = 2,
72 };
73 
75 DLLEXPORT extern const char** qore_warnings;
76 
78 DLLEXPORT extern unsigned qore_num_warnings;
79 
81 DLLEXPORT int get_warning_code(const char* str);
82 
83 // forward references
85 class LocalVar;
86 class ExceptionSink;
87 class QoreListNode;
88 class QoreNamespace;
89 class RootQoreNamespace;
90 class QoreStringNode;
91 class QoreHashNode;
92 class FunctionCallNode;
93 class AbstractStatement;
94 class UnresolvedProgramCallReferenceNode;
95 class Var;
96 class LVList;
97 class UserFunctionVariant;
98 class QoreParseTypeInfo;
99 class ParamList;
100 class AbstractQoreZoneInfo;
101 class qore_program_private;
103 class QoreBreakpoint;
104 class AbstractQoreFunctionVariant;
105 class QoreRWLock;
106 
107 typedef std::list<QoreBreakpoint*> QoreBreakpointList_t;
108 
110 
118  friend class qore_program_private_base;
119  friend class qore_program_private;
120  friend class qore_debug_program_private;
121  friend struct ThreadLocalProgramData;
122 private:
124  qore_program_private* priv;
125 
127  DLLLOCAL QoreProgram(const QoreProgram&);
128 
130  DLLLOCAL QoreProgram& operator=(const QoreProgram&);
131 
132 protected:
134 
136  DLLLOCAL virtual ~QoreProgram();
137 
138 public:
140  DLLEXPORT QoreProgram();
141 
143 
146  DLLEXPORT QoreProgram(int64 parse_options);
147 
149 
154  DLLEXPORT AbstractQoreNode* callFunction(const char* name, const QoreListNode* args, ExceptionSink* xsink);
155 
157 
165  DLLEXPORT AbstractQoreNode* run(ExceptionSink* xsink);
166 
168 
175  DLLEXPORT AbstractQoreNode* runTopLevel(ExceptionSink* xsink);
176 
178 
188  DLLEXPORT void parseFileAndRun(const char* filename);
189 
191 
200  DLLEXPORT void parseAndRun(FILE *fp, const char* name);
201 
203 
212  DLLEXPORT void parseAndRun(const char* str, const char* name);
213 
215 
222  DLLEXPORT void runClass(const char* classname, ExceptionSink* xsink);
223 
225 
236  DLLEXPORT void parseFileAndRunClass(const char* filename, const char* classname);
237 
239 
249  DLLEXPORT void parseAndRunClass(FILE *fp, const char* name, const char* classname);
250 
252 
262  DLLEXPORT void parseAndRunClass(const char* str, const char* name, const char* classname);
263 
265 
273  DLLEXPORT void parse(FILE *fp, const char* name, ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL);
274 
276 
284  DLLEXPORT void parse(const QoreString* str, const QoreString* lstr, ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL);
285 
287 
297  DLLEXPORT void parse(const QoreString* str, const QoreString* lstr, ExceptionSink* xsink, ExceptionSink* warn_sink, int warn_mask, const QoreString* source, int offset);
298 
300 
308  DLLEXPORT void parse(const char* str, const char* lstr, ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL);
309 
311 
321  DLLEXPORT void parse(const char* str, const char* lstr, ExceptionSink* xsink, ExceptionSink* warn_sink, int warn_mask, const char* source, int offset);
322 
324 
332  DLLEXPORT void parseFile(const char* filename, ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL, bool only_first_except = false);
333 
335 
344  DLLEXPORT void parsePending(const char* code, const char* label, ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL);
345 
347 
359  DLLEXPORT void parsePending(const char* code, const char* label, ExceptionSink* xsink, ExceptionSink* warn_sink, int warn_mask, const char* source, int offset);
360 
362 
372  DLLEXPORT void parsePending(const QoreString* str, const QoreString* lstr, ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL);
373 
375 
387  DLLEXPORT void parsePending(const QoreString* str, const QoreString* lstr, ExceptionSink* xsink, ExceptionSink* warn_sink, int warn_mask, const QoreString* source, int offset);
388 
390 
394  DLLEXPORT void parseCommit(ExceptionSink* xsink, ExceptionSink* warn_sink = 0, int warn_mask = QP_WARN_ALL);
395 
397 
403  DLLEXPORT void parseRollback();
404 
406 
411  DLLEXPORT int parseRollback(ExceptionSink* xsink);
412 
414  DLLEXPORT bool existsFunction(const char* name);
415 
417 
422  DLLEXPORT virtual void deref(ExceptionSink* xsink);
423 
425  DLLEXPORT QoreProgram* programRefSelf() const;
426 
428  DLLEXPORT void lockOptions();
429 
431 
436  DLLEXPORT void setExecClass(const char* ecn = 0);
437 
439  DLLEXPORT void parseSetParseOptions(int po);
440 
442  DLLEXPORT void parseSetParseOptions(int64 po);
443 
445  DLLEXPORT void parseDisableParseOptions(int64 po);
446 
448  DLLEXPORT void waitForTermination();
449 
451 
454  DLLEXPORT void waitForTerminationAndDeref(ExceptionSink* xsink);
455 
457  DLLEXPORT QoreNamespace* getQoreNS() const;
458 
460  DLLEXPORT RootQoreNamespace* getRootNS() const;
461 
463 
467  DLLEXPORT int setWarningMask(int wm);
468 
470 
474  DLLEXPORT int enableWarning(int code);
475 
477 
481  DLLEXPORT int disableWarning(int code);
482 
484  DLLEXPORT int getParseOptions() const;
485 
487  DLLEXPORT int64 getParseOptions64() const;
488 
490 
494  DLLEXPORT void setParseOptions(int po, ExceptionSink* xsink);
495 
497 
501  DLLEXPORT void setParseOptions(int64 po, ExceptionSink* xsink);
502 
504 
508  DLLEXPORT void disableParseOptions(int po, ExceptionSink* xsink);
509 
511 
515  DLLEXPORT void disableParseOptions(int64 po, ExceptionSink* xsink);
516 
518 
522  DLLEXPORT void replaceParseOptions(int64 po, ExceptionSink* xsink);
523 
525 
528  DLLEXPORT QoreListNode* getUserFunctionList();
529 
531  DLLEXPORT bool checkWarning(int code) const;
532 
534  DLLEXPORT int getWarningMask() const;
535 
537  DLLEXPORT bool checkFeature(const char* f) const;
538 
540  DLLEXPORT QoreListNode* getFeatureList() const;
541 
543 
545  DLLEXPORT QoreStringNode* getScriptName() const;
546 
548 
550  DLLEXPORT QoreStringNode* getScriptPath() const;
551 
553 
555  DLLEXPORT QoreStringNode* getScriptDir() const;
556 
558 
560  DLLEXPORT void setScriptPath(const char* path);
561 
563 
567  DLLEXPORT AbstractQoreNode* getGlobalVariableValue(const char* var, bool &found) const;
568 
570 
574  DLLEXPORT QoreValue getGlobalVariableVal(const char* var, bool &found) const;
575 
576  // retrieves the time zone setting for the program
577  DLLEXPORT const AbstractQoreZoneInfo *currentTZ() const;
578 
579  // sets the program's time zone
580  DLLEXPORT void setTZ(const AbstractQoreZoneInfo *n_TZ);
581 
583 
586  DLLEXPORT void addFeature(const char* name);
587 
589 
593  DLLEXPORT void parseSetTimeZone(const char* zone);
594 
596 
603  DLLEXPORT void parseDefine(const char* str, AbstractQoreNode* val);
604 
606 
613  DLLEXPORT void parseDefine(const char* str, const char* val);
614 
615  // @deprecated use parseCmdLineDefines(ExceptionSink& xs, ExceptionSink& ws, int w, const std::map<std::string, std::string>& defmap) instead
616  DLLEXPORT void parseCmdLineDefines(const std::map<std::string, std::string> defmap, ExceptionSink& xs, ExceptionSink& ws, int w);
617 
619 
624  DLLEXPORT void parseCmdLineDefines(ExceptionSink& xs, ExceptionSink& ws, int w, const std::map<std::string, std::string>& defmap);
625 
627 
632  DLLEXPORT void setExternalData(const char* owner, AbstractQoreProgramExternalData* pud);
633 
635 
641  DLLEXPORT AbstractQoreProgramExternalData* getExternalData(const char* owner) const;
642 
644 
648  DLLEXPORT QoreHashNode* getGlobalVars() const;
649 
651 
659  DLLEXPORT int setGlobalVarValue(const char* name, QoreValue val, ExceptionSink* xsink);
660 
661  // finds a function or class method variant if possible
670  DLLEXPORT const AbstractQoreFunctionVariant* runtimeFindCall(const char* name, const QoreValueList* params, ExceptionSink* xsink) const;
671 
672  // finds all variants of a function or class method and returns a list of the results
683  DLLEXPORT QoreValueList* runtimeFindCallVariants(const char* name, ExceptionSink* xsink) const;
684 
686 
690  DLLEXPORT QoreListNode* getThreadList() const;
691 
692  DLLLOCAL QoreProgram(QoreProgram* pgm, int64 po, bool ec = false, const char* ecn = 0);
693 
694  DLLLOCAL LocalVar *createLocalVar(const char* name, const QoreTypeInfo *typeInfo);
695 
696  // returns 0 if a "requires" exception has already occurred
697  DLLLOCAL ExceptionSink* getParseExceptionSink();
698 
699  DLLLOCAL QoreHashNode* getThreadData();
700  DLLLOCAL void depRef();
701  DLLLOCAL void depDeref();
702  DLLLOCAL void addFile(char* f);
703  DLLLOCAL QoreListNode* getVarList();
704  DLLLOCAL void parseSetIncludePath(const char* path);
705  DLLLOCAL const char* parseGetIncludePath() const;
706 
707  /* for run-time module loading; the parse lock must be grabbed
708  before loading new modules - note this should only be assigned
709  to an AutoLock or SafeLocker object!
710  */
711  DLLLOCAL QoreThreadLock *getParseLock();
712  DLLLOCAL const LVList* getTopLevelLVList() const;
713 
715 
717  DLLLOCAL const char* parseGetScriptDir() const;
718 
719  // can only be called while parsing from the same thread doing the parsing
720  DLLLOCAL bool parseExceptionRaised() const;
721 
722 
723  // TODO: implement !
731  DLLEXPORT QoreValue getLocalVariableVal(const char* var, bool &found) const;
732 
735  DLLEXPORT void assignBreakpoint(QoreBreakpoint *bkpt, ExceptionSink *xsink);
736 
740  DLLEXPORT void deleteAllBreakpoints();
741 
745  DLLEXPORT void getBreakpoints(QoreBreakpointList_t &bkptList);
746 
750  DLLEXPORT AbstractStatement* findStatement(const char* fileName, int line) const;
751 
755  DLLEXPORT AbstractStatement* findFunctionStatement(const char* functionName, const QoreValueList* params, ExceptionSink* xsink) const;
756 
758 
762  DLLEXPORT unsigned long getStatementId(const AbstractStatement* statement) const;
763 
765 
770  DLLEXPORT AbstractStatement* resolveStatementId(unsigned long statementId) const;
771 
773 
776  DLLEXPORT QoreHashNode* getSourceFileNames(ExceptionSink* xsink) const;
778 
781  DLLEXPORT QoreHashNode* getSourceLabels(ExceptionSink* xsink) const;
782 
784 
787  DLLEXPORT unsigned getProgramId() const;
788 
790 
795  DLLEXPORT static QoreProgram* resolveProgramId(unsigned programId);
796 
798  DLLEXPORT void registerQoreObject(QoreObject *o, ExceptionSink* xsink) const;
799 
801  DLLEXPORT void unregisterQoreObject(QoreObject *o, ExceptionSink* xsink) const;
802 
804  DLLEXPORT QoreObject* findQoreObject() const;
805 
807  DLLEXPORT static QoreObject* getQoreObject(QoreProgram* pgm);
808 
810  DLLEXPORT static QoreListNode* getAllQoreObjects(ExceptionSink* xsink);
811 
813  DLLEXPORT bool checkAllowDebugging(ExceptionSink* xsink);
814 
815 };
816 
818 
821 private:
822  QoreProgram* pgm;
823  ExceptionSink& xsink;
824 
825 public:
827  DLLEXPORT QoreProgramHelper(ExceptionSink& xs);
828 
830  DLLEXPORT QoreProgramHelper(int64 parse_options, ExceptionSink& xs);
831 
833 
835  DLLEXPORT ~QoreProgramHelper();
836 
838  DLLEXPORT QoreProgram* operator->();
839 
841  DLLEXPORT QoreProgram* operator*();
842 };
843 
845 
848 public:
851 
853  DLLEXPORT ~CurrentProgramRuntimeExternalParseContextHelper();
854 
856  DLLEXPORT operator bool() const;
857 
858 private:
859  bool valid = true;
860 
861  // not implemented
862  CurrentProgramRuntimeExternalParseContextHelper(const CurrentProgramRuntimeExternalParseContextHelper&) = delete;
863  void* operator new(size_t) = delete;
864 };
865 
867 
870 public:
872  DLLEXPORT QoreProgramContextHelper(QoreProgram* pgm);
874  DLLEXPORT ~QoreProgramContextHelper();
875 
876 private:
877  QoreProgram* old_pgm;
878 
879  // not implemented
880  QoreProgramContextHelper(const QoreProgramContextHelper&) = delete;
881  void* operator new(size_t) = delete;
882 };
883 
885 
894 public:
895  DLLEXPORT virtual ~AbstractQoreProgramExternalData();
896 
898 
903  virtual AbstractQoreProgramExternalData* copy(QoreProgram* pgm) const = 0;
904 
906  virtual void doDeref() = 0;
907 };
908 
909 typedef std::list<QoreBreakpoint*> QoreBreakpointList_t;
910 typedef std::list<AbstractStatement*> AbstractStatementList_t;
911 typedef std::list<int> TidList_t;
912 
914 
919 private:
920  qore_program_private* pgm;
921  AbstractStatementList_t statementList;
922  typedef std::map<int/*tid*/, int/*count*/> TidMap_t;
923  TidMap_t tidMap;
924  QoreObject* qo; // reference to Qore script object, it's private object but we cannot
925  typedef std::list<QoreBreakpoint*> QoreBreakpointList_t;
926  static QoreRWLock lck_breakpoint; // to protect breakpoint manipulation
927  static QoreBreakpointList_t breakpointList;
928  static volatile unsigned breakpointIdCounter; // to generate breakpointId
929  unsigned breakpointId;
930 
931  DLLLOCAL void unassignAllStatements();
932  DLLLOCAL bool isStatementAssigned(const AbstractStatement *statement) const;
933  DLLLOCAL bool checkPgm(ExceptionSink* xsink) const;
934 
935  friend class qore_program_private;
936  friend class AbstractStatement;
937 protected:
938  DLLLOCAL virtual ~QoreBreakpoint();
940  DLLLOCAL virtual bool checkBreak() const;
941 public:
942  bool enabled;
946  BreakpointPolicy policy;
947 
948  DLLEXPORT QoreBreakpoint();
952  DLLEXPORT QoreBreakpoint& operator=(const QoreBreakpoint& other);
957  DLLEXPORT void assignProgram(QoreProgram *new_pgm, ExceptionSink* xsink);
958  /* Get assigned program to breakpoint
959  *
960  */
961  DLLEXPORT QoreProgram* getProgram() const;
965  DLLEXPORT void assignStatement(AbstractStatement* statement, ExceptionSink* xsink);
969  DLLEXPORT void unassignStatement(AbstractStatement* statement, ExceptionSink* xsink);
973  DLLEXPORT void getStatements(AbstractStatementList_t &statList, ExceptionSink* xsink);
977  DLLEXPORT QoreListNode* getStatementIds(ExceptionSink* xsink);
981  DLLEXPORT AbstractStatement* resolveStatementId(unsigned long statementId, ExceptionSink* xsink) const;
985  DLLEXPORT void getThreadIds(TidList_t &tidList, ExceptionSink* xsink);
989  DLLEXPORT void setThreadIds(TidList_t tidList, ExceptionSink* xsink);
993  DLLEXPORT void addThreadId(int tid, ExceptionSink* xsink);
997  DLLEXPORT void removeThreadId(int tid, ExceptionSink* xsink);
1001  DLLEXPORT bool isThreadId(int tid, ExceptionSink* xsink);
1005  DLLEXPORT void clearThreadIds(ExceptionSink* xsink);
1006 
1008 
1011  DLLEXPORT unsigned getBreakpointId() const;
1012 
1014 
1019  DLLEXPORT static QoreBreakpoint* resolveBreakpointId(unsigned breakpointId);
1020 
1021  DLLEXPORT void setQoreObject(QoreObject* n_qo);
1022 
1023  DLLEXPORT QoreObject* getQoreObject();
1024 
1025 };
1026 
1027 #endif // _QORE_QOREPROGRAM_H
DLLEXPORT void deleteAllBreakpoints()
DLLEXPORT void waitForTermination()
this call blocks until the program&#39;s last thread terminates
DLLEXPORT QoreListNode * getThreadList() const
returns a list of threads active in this Program object
DLLEXPORT void parseDefine(const char *str, AbstractQoreNode *val)
defines a parse-time variable; call only at parse time (or before parsing)
DLLEXPORT void lockOptions()
locks parse options so they may not be changed
DLLEXPORT int getWarningMask() const
returns the warning mask
DLLEXPORT void unregisterQoreObject(QoreObject *o, ExceptionSink *xsink) const
unregister link to Qore script object
DLLEXPORT void parsePending(const char *code, const char *label, ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL)
parses code from the given string but does not commit changes to the QoreProgram
DLLEXPORT void addFeature(const char *name)
manually add the feature to the program
allows for the parse lock for the current program to be acquired by binary modules ...
Definition: QoreProgram.h:847
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
DLLEXPORT QoreStringNode * getScriptDir() const
returns the script directory, if known (0 if not)
static DLLEXPORT QoreProgram * resolveProgramId(unsigned programId)
get the program from program id
virtual DLLLOCAL ~QoreProgram()
the destructor is private in order to prohibit the object from being allocated on the stack ...
DLLEXPORT void waitForTerminationAndDeref(ExceptionSink *xsink)
this call blocks until the program&#39;s last thread terminates, and then calls QoreProgram::deref() ...
DLLEXPORT void disableParseOptions(int po, ExceptionSink *xsink)
turns off the parse options given in the passed mask and adds Qore-language exception information if ...
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
DLLEXPORT void setExecClass(const char *ecn=0)
sets the name of the application class to be executed (instantiated) instead of top-level code ...
DLLEXPORT AbstractQoreNode * runTopLevel(ExceptionSink *xsink)
tuns the top level code and returns any return value
Class implementing breakpoint for debugging.
Definition: QoreProgram.h:918
DLLEXPORT QoreValue getGlobalVariableVal(const char *var, bool &found) const
returns the value of the global variable given (do not include the "$" symbol), the caller owns the r...
DLLEXPORT QoreProgram * programRefSelf() const
references "this" and returns a non-const pointer to itself
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreValueList.h:45
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
DLLEXPORT unsigned getProgramId() const
get the program id
DLLEXPORT RootQoreNamespace * getRootNS() const
returns a pointer to the root namespace
contains constants, classes, and subnamespaces in QoreProgram objects
Definition: QoreNamespace.h:63
DLLEXPORT void parseFileAndRun(const char *filename)
parses the given filename and runs the file
allows for external modules to set the current Program context explicitly
Definition: QoreProgram.h:869
BreakpointPolicy policy
Definition: QoreProgram.h:946
base class for call references, reference-counted, dynamically allocated only
Definition: CallReferenceNode.h:39
DLLEXPORT QoreListNode * getFeatureList() const
returns a list of features in the program object
DLLEXPORT AbstractQoreNode * callFunction(const char *name, const QoreListNode *args, ExceptionSink *xsink)
calls a function from the function name and returns the return value
safely manages QoreProgram objects; note the the destructor will block until all background threads i...
Definition: QoreProgram.h:820
DLLEXPORT void parseSetTimeZone(const char *zone)
sets the time zone during parsing
Qore&#39;s string type supported by the QoreEncoding class.
Definition: QoreString.h:82
Qore&#39;s string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DLLEXPORT void parseAndRun(FILE *fp, const char *name)
parses the given file and runs the file
DLLEXPORT QoreProgram * getProgram()
returns the current QoreProgram
DLLEXPORT QoreListNode * getUserFunctionList()
returns a list of all user functions in this program
DLLEXPORT int setGlobalVarValue(const char *name, QoreValue val, ExceptionSink *xsink)
sets the value of the given global variable
the root namespace of a QoreProgram object
Definition: QoreNamespace.h:250
DLLEXPORT bool existsFunction(const char *name)
returns true if the given function exists as a user function, false if not
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT void assignBreakpoint(QoreBreakpoint *bkpt, ExceptionSink *xsink)
DLLEXPORT int getParseOptions() const
returns the parse options currently set for this program; DEPRECATED; use getParseOptions64() instead...
DLLEXPORT int enableWarning(int code)
enables a warning by its code
DLLEXPORT bool checkWarning(int code) const
returns true if the warning code is set
DLLEXPORT QoreObject * findQoreObject() const
find Qore script object related to QoreProgram instance
an abstract class for program-specific external data
Definition: QoreProgram.h:893
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:67
DLLEXPORT void parseCommit(ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL)
commits pending changes to the program
DLLEXPORT unsigned long getStatementId(const AbstractStatement *statement) const
get the statement id
DLLEXPORT QoreNamespace * getQoreNS() const
returns a pointer to the "Qore" namespace
DLLEXPORT int setWarningMask(int wm)
sets the warning mask
DLLEXPORT void setExternalData(const char *owner, AbstractQoreProgramExternalData *pud)
sets a pointer to external data in the Program
DLLEXPORT void setScriptPath(const char *path)
sets the script path
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:112
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreProgram.h:117
DLLEXPORT QoreHashNode * getSourceLabels(ExceptionSink *xsink) const
get list of labels which appears in a statement
DLLEXPORT void parseRollback()
rolls back changes to the program object that were added with QoreProgram::parsePending() ...
DLLEXPORT void parse(FILE *fp, const char *name, ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL)
parses code from the file given and commits changes to the QoreProgram
DLLEXPORT void parseAndRunClass(FILE *fp, const char *name, const char *classname)
parses the given file and runs the code by instantiating the class given
static DLLEXPORT QoreObject * getQoreObject(QoreProgram *pgm)
get QoreObject of QoreProgram
the implementation of Qore&#39;s object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:62
DLLLOCAL const char * parseGetScriptDir() const
returns the script directory, if known (0 if not), does not grab the parse lock, only to be called wh...
DLLEXPORT const AbstractQoreFunctionVariant * runtimeFindCall(const char *name, const QoreValueList *params, ExceptionSink *xsink) const
DLLEXPORT void setParseOptions(int po, ExceptionSink *xsink)
sets the parse options and adds Qore-language exception information if an error occurs ...
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:47
DLLEXPORT QoreStringNode * getScriptPath() const
returns the script path (directory and name), if known (0 if not)
DLLEXPORT AbstractStatement * findStatement(const char *fileName, int line) const
DLLEXPORT void runClass(const char *classname, ExceptionSink *xsink)
instantiates the class given and runs its constructor
DLLEXPORT QoreValue getLocalVariableVal(const char *var, bool &found) const
DLLEXPORT QoreStringNode * getScriptName() const
returns the script file name, if known (0 if not)
static DLLEXPORT QoreListNode * getAllQoreObjects(ExceptionSink *xsink)
list all programs as QoreObject list
DLLEXPORT bool checkAllowDebugging(ExceptionSink *xsink)
check if program can provide debugging stuff
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:241
DLLEXPORT QoreProgram()
creates the object
DLLEXPORT int disableWarning(int code)
disables a warning by its code
DLLEXPORT QoreHashNode * getGlobalVars() const
retrieves a hash of global variables and their values
DLLEXPORT void parseSetParseOptions(int po)
adds the parse options given to the parse option mask; DEPRECATED: use parseSetParseOptions(int64) in...
DLLEXPORT AbstractQoreProgramExternalData * getExternalData(const char *owner) const
retrieves the external data pointer
DLLEXPORT void parseDisableParseOptions(int64 po)
disables the parse options given to the parse option mask
DLLEXPORT void registerQoreObject(QoreObject *o, ExceptionSink *xsink) const
register link to Qore script object
DLLEXPORT AbstractQoreNode * run(ExceptionSink *xsink)
runs the program (instantiates the program class if a program class has been set) and returns the ret...
provides a mutually-exclusive thread lock
Definition: QoreThreadLock.h:49
provides a simple POSIX-threads-based read-write lock
Definition: QoreRWLock.h:47
DLLEXPORT void getBreakpoints(QoreBreakpointList_t &bkptList)
DLLEXPORT QoreValueList * runtimeFindCallVariants(const char *name, ExceptionSink *xsink) const
DLLEXPORT void replaceParseOptions(int64 po, ExceptionSink *xsink)
replaces the parse options in the program with those given by the argument; adds Qore-language except...
DLLEXPORT AbstractQoreNode * getGlobalVariableValue(const char *var, bool &found) const
returns the value of the global variable given (do not include the "$" symbol), the caller owns the r...
DLLEXPORT void parseFileAndRunClass(const char *filename, const char *classname)
parses the given filename and runs the program by instantiating the class given
DLLEXPORT bool checkFeature(const char *f) const
returns true if the given feature is present in the program object
DLLEXPORT QoreHashNode * getSourceFileNames(ExceptionSink *xsink) const
get list of files which appears in a statement
DLLEXPORT AbstractStatement * resolveStatementId(unsigned long statementId) const
get the statement from statement id
DLLEXPORT void parseFile(const char *filename, ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL, bool only_first_except=false)
parses code from the file given and commits changes to the QoreProgram
DLLEXPORT AbstractStatement * findFunctionStatement(const char *functionName, const QoreValueList *params, ExceptionSink *xsink) const
DLLEXPORT int64 getParseOptions64() const
returns the parse options currently set for this program
DLLEXPORT const AbstractQoreZoneInfo * currentTZ()
returns the current local time zone, note that if 0 = UTC