| Qore Programming Language - C/C++ Library 1.0.8

Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QoreProgram Class Reference

supports parsing and executing Qore-language code, reference counted, dynamically-allocated only More...

`#include <QoreProgram.h>`

Inheritance diagram for QoreProgram:
[legend]
Collaboration diagram for QoreProgram:
[legend]

## Public Member Functions
DLLEXPORT | QoreProgram ()
| creates the object
DLLEXPORT | QoreProgram (int64 parse_options)
| creates the object and sets the parse options More...
DLLEXPORT void | addFeature (const char *name)
| manually add the feature to the program More...
DLLEXPORT void | assignBreakpoint (QoreBreakpoint *bkpt, ExceptionSink *xsink)
DLLEXPORT QoreValue | callFunction (const char *name, const QoreListNode *args, ExceptionSink *xsink)
| calls a function from the function name and returns the return value More...
DLLEXPORT bool | checkAllowDebugging (ExceptionSink *xsink)
| check if program can provide debugging stuff
DLLEXPORT bool | checkFeature (const char *f) const
| returns true if the given feature is present in the program object
DLLEXPORT bool | checkWarning (int code) const
| returns true if the warning code is set
DLLEXPORT void | deleteAllBreakpoints ()
DLLEXPORT void | depDeref ()
| dereferences a weak reference for the program object More...
DLLEXPORT void | depRef ()
| incremements the weak reference count for the program object More...
virtual DLLLOCAL void | deref (ExceptionSink *xsink)
| dereferences the object and deletes it if the reference count reaches zero More...
virtual DLLLOCAL void | deref ()
| dereferences the object and deletes it if the reference count reaches zero More...
virtual DLLEXPORT void | deref (ExceptionSink *xsink)
| decrements the reference count of the object More...
DLLEXPORT void | disableParseOptions (int64 po, ExceptionSink *xsink)
| turns off the parse options given in the passed mask and adds Qore-language exception information if an error occurs More...
DLLEXPORT int | disableWarning (int code)
| disables a warning by its code More...
DLLEXPORT int | enableWarning (int code)
| enables a warning by its code More...
DLLEXPORT bool | existsFunction (const char *name)
| returns true if the given function exists as a user function, false if not
DLLEXPORT class_vec_t | findAllClassesRegex (const QoreString &pattern, int re_opts, ExceptionSink *xsink) const
| returns a list of all classes that match the pattern More...
DLLEXPORT func_vec_t | findAllFunctionsRegex (const QoreString &pattern, int re_opts, ExceptionSink *xsink) const
| returns a list of all functions that match the pattern More...
DLLEXPORT gvar_vec_t | findAllGlobalVarsRegex (const QoreString &pattern, int re_opts, ExceptionSink *xsink) const
| returns a list of all global variables that match the pattern More...
DLLEXPORT hashdecl_vec_t | findAllHashDeclsRegex (const QoreString &pattern, int re_opts, ExceptionSink *xsink) const
| returns a list of all typed hashes (hashdecls) that match the pattern More...
DLLEXPORT const_vec_t | findAllNamespaceConstantsRegex (const QoreString &pattern, int re_opts, ExceptionSink *xsink) const
| returns a list of all namespace constants that match the pattern More...
DLLEXPORT ns_vec_t | findAllNamespacesRegex (const QoreString &pattern, int re_opts, ExceptionSink *xsink) const
| returns a list of all namespaces that match the pattern More...
DLLEXPORT const QoreClass * | findClass (const char *path, ExceptionSink *xsink) const
| search for the given class in the program; can be a simple class name or a namespace-prefixed path (ex: "NamespaceName::ClassName") More...
DLLEXPORT const QoreExternalFunction * | findFunction (const char *path) const
| search for the given function in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::function_name") More...
DLLEXPORT AbstractStatement * | findFunctionStatement (const char *functionName, const QoreListNode *params, ExceptionSink *xsink) const
DLLEXPORT const QoreExternalGlobalVar * | findGlobalVar (const char *path, const QoreNamespace *&pns) const
| search for the given global variable in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::global_var") More...
DLLEXPORT const TypedHashDecl * | findHashDecl (const char *path, const QoreNamespace *&pns) const
| search for the given typed hash (hashdecl) in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::TypedHashName") More...
DLLEXPORT QoreNamespace * | findNamespace (const QoreString &path)
| search for the given namespace in the program; can be a simple namespace name or a namespace-prefixed path (ex: "NamespaceName::Namespace") More...
DLLEXPORT const QoreNamespace * | findNamespace (const QoreString &path) const
| search for the given namespace in the program; can be a simple namespace name or a namespace-prefixed path (ex: "NamespaceName::Namespace") More...
DLLEXPORT const QoreExternalConstant * | findNamespaceConstant (const char *path, const QoreNamespace *&pns) const
| search for the given namespace constant in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::MyConstant") More...
DLLEXPORT QoreObject * | findQoreObject () const
| find Qore script object related to QoreProgram instance
DLLEXPORT AbstractStatement * | findStatement (const char *fileName, int line) const
DLLEXPORT void | getBreakpoints (QoreBreakpointList_t &bkptList)
DLLEXPORT AbstractQoreProgramExternalData * | getExternalData (const char *owner) const
| retrieves the external data pointer More...
DLLEXPORT QoreListNode * | getFeatureList () const
| returns a list of features in the program object
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 reference count returned More...
DLLEXPORT QoreValue | getGlobalVariableValue (const char *var, bool &found) const
| returns the value of the global variable given (do not include the "$" symbol), the caller owns the reference count returned More...
DLLEXPORT QoreHashNode * | getGlobalVars () const
| retrieves a hash of global variables and their values More...
DLLEXPORT QoreValue | getLocalVariableVal (const char *var, bool &found) const
DLLEXPORT int | getParseOptions () const
| returns the parse options currently set for this program; DEPRECATED; use getParseOptions64() instead
DLLEXPORT int64 | getParseOptions64 () const
| returns the parse options currently set for this program
DLLEXPORT unsigned | getProgramId () const
| get the program id More...
DLLEXPORT QoreNamespace * | getQoreNS () const
| returns a pointer to the "Qore" namespace
DLLEXPORT RootQoreNamespace * | getRootNS () const
| returns a pointer to the root namespace
DLLEXPORT QoreStringNode * | getScriptDir () const
| returns the script directory, if known (0 if not) More...
DLLEXPORT QoreStringNode * | getScriptName () const
| returns the script file name, if known (0 if not) More...
DLLEXPORT QoreStringNode * | getScriptPath () const
| returns the script path (directory and name), if known (0 if not) More...
DLLEXPORT QoreHashNode * | getSourceFileNames (ExceptionSink *xsink) const
| get list of files which appears in a statement More...
DLLEXPORT QoreHashNode * | getSourceLabels (ExceptionSink *xsink) const
| get list of labels which appears in a statement More...
DLLEXPORT void | getStatementBreakpoints (const AbstractStatement *statement, QoreBreakpointList_t &bkptList)
DLLEXPORT unsigned long | getStatementId (const AbstractStatement *statement) const
| get the statement id More...
DLLEXPORT QoreHashNode * | getThreadData ()
| returns the thread-local data for the current thread and the Program object More...
DLLEXPORT QoreListNode * | getThreadList () const
| returns a list of threads active in this Program object More...
DLLEXPORT QoreListNode * | getUserFunctionList ()
| returns a list of all user functions in this program More...
DLLEXPORT int | getWarningMask () const
| returns the warning mask
DLLEXPORT int | issueModuleCmd (const char *module, const char *cmd, ExceptionSink *xsink)
| issues a module command for the given module; the module is loaded into the current Program object if it is not already present More...
DLLEXPORT void | lockOptions ()
| locks parse options so they may not be changed
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 More...
DLLEXPORT void | parse (const QoreString *str, const QoreString *lstr, ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL)
| parses code from the given string and commits changes to the QoreProgram More...
DLLEXPORT void | parse (const QoreString *str, const QoreString *lstr, ExceptionSink *xsink, ExceptionSink *warn_sink, int warn_mask, const QoreString *source, int offset)
| parses code from the given string and commits changes to the QoreProgram More...
DLLEXPORT void | parse (const char *str, const char *lstr, ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL)
| parses code from the given string and commits changes to the QoreProgram More...
DLLEXPORT void | parse (const char *str, const char *lstr, ExceptionSink *xsink, ExceptionSink *warn_sink, int warn_mask, const char *source, int offset)
| parses code from the given string and commits changes to the QoreProgram More...
DLLEXPORT void | parseAndRun (FILE *fp, const char *name)
| parses the given file and runs the file More...
DLLEXPORT void | parseAndRun (const char *str, const char *name)
| parses the given string and runs the code More...
DLLEXPORT void | parseAndRunClass (FILE *fp, const char *name, const char *classname)
| parses the given file and runs the code by instantiating the class given More...
DLLEXPORT void | parseAndRunClass (const char *str, const char *name, const char *classname)
| parses the given string and runs the code by instantiating the class given More...
DLLEXPORT void | parseCmdLineDefines (ExceptionSink &xs, ExceptionSink &ws, int w, const std::map< std::string, std::string > &defmap)
| defines parse-time variables More...
DLLEXPORT void | parseCommit (ExceptionSink *xsink, ExceptionSink *warn_sink=0, int warn_mask=QP_WARN_ALL)
| commits pending changes to the program More...
DLLEXPORT void | parseDefine (const char *str, QoreValue val)
| defines a parse-time variable; call only at parse time (or before parsing) More...
DLLEXPORT void | parseDefine (const char *str, const char *val)
| defines a parse-time variable; call only at parse time (or before parsing) More...
DLLEXPORT void | parseDisableParseOptions (int64 po)
| disables the parse options given to the parse option mask
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 More...
DLLEXPORT void | parseFileAndRun (const char *filename)
| parses the given filename and runs the file More...
DLLEXPORT void | parseFileAndRunClass (const char *filename, const char *classname)
| parses the given filename and runs the program by instantiating the class given More...
DLLLOCAL const char * | parseGetScriptDir () const
| returns the script directory, if known (0 if not), does not grab the parse lock, only to be called while parsing More...
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 More...
DLLEXPORT void | parsePending (const char *code, const char *label, ExceptionSink *xsink, ExceptionSink *warn_sink, int warn_mask, const char *source, int offset)
| parses code from the given string but does not commit changes to the QoreProgram More...
DLLEXPORT void | parsePending (const QoreString *str, const QoreString *lstr, 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 More...
DLLEXPORT void | parsePending (const QoreString *str, const QoreString *lstr, ExceptionSink *xsink, ExceptionSink *warn_sink, int warn_mask, const QoreString *source, int offset)
| parses code from the given string but does not commit changes to the QoreProgram More...
DLLEXPORT int | parseRollback (ExceptionSink *xsink)
| rolls back changes to the program object that were added with QoreProgram::parsePending() More...
DLLEXPORT void | parseSetParseOptions (int64 po)
| adds the parse options given to the parse option mask
DLLEXPORT void | parseSetTimeZone (const char *zone)
| sets the time zone during parsing More...
DLLEXPORT QoreProgram * | programRefSelf () const
| references "this" and returns a non-const pointer to itself
DLLEXPORT void | registerQoreObject (QoreObject *o, ExceptionSink *xsink) const
| register link to Qore script object
DLLEXPORT AbstractQoreProgramExternalData * | removeExternalData (const char *owner)
| removes a pointer to external data in the Program; does not dereference the data More...
DLLEXPORT void | replaceParseOptions (int64 po, ExceptionSink *xsink)
| replaces the parse options in the program with those given by the argument; adds Qore-language exception information if an error occurs More...
DLLEXPORT AbstractStatement * | resolveStatementId (unsigned long statementId) const
| get the statement from statement id More...
DLLEXPORT QoreValue | run (ExceptionSink *xsink)
| runs the program (instantiates the program class if a program class has been set) and returns the return value (if any) More...
DLLEXPORT void | runClass (const char *classname, ExceptionSink *xsink)
| instantiates the class given and runs its constructor More...
DLLEXPORT const AbstractQoreFunctionVariant * | runtimeFindCall (const char *name, const QoreListNode *params, ExceptionSink *xsink) const
DLLEXPORT QoreListNode * | runtimeFindCallVariants (const char *name, ExceptionSink *xsink) const
DLLEXPORT QoreValue | runTopLevel (ExceptionSink *xsink)
| tuns the top level code and returns any return value More...
DLLEXPORT void | setExecClass (const char *ecn=0)
| sets the name of the application class to be executed (instantiated) instead of top-level code More...
DLLEXPORT void | setExternalData (const char *owner, AbstractQoreProgramExternalData *pud)
| sets a pointer to external data in the Program More...
DLLEXPORT int | setGlobalVarValue (const char *name, QoreValue val, ExceptionSink *xsink)
| sets the value of the given global variable More...
DLLEXPORT void | setParseOptions (int64 po, ExceptionSink *xsink)
| sets the parse options and adds Qore-language exception information if an error occurs More...
DLLEXPORT void | setScriptPath (const char *path)
| sets the script path More...
DLLEXPORT int | setWarningMask (int wm)
| sets the warning mask More...
DLLEXPORT void | unregisterQoreObject (QoreObject *o, ExceptionSink *xsink) const
| unregister link to Qore script object
DLLEXPORT void | waitForTermination ()
| this call blocks until the program's last thread terminates
DLLEXPORT void | waitForTerminationAndDeref (ExceptionSink *xsink)
| this call blocks until the program's last thread terminates, and then calls QoreProgram::deref() More...
Public Member Functions inherited from AbstractPrivateData
virtual DLLLOCAL void | deref ()
| decrements the reference count of the object without the possibility of throwing a Qore-language exception
DLLLOCAL void | ref () const
| increments the reference count of the object
Public Member Functions inherited from QoreReferenceCounter
DLLEXPORT | QoreReferenceCounter ()
| creates the reference counter object
DLLEXPORT | QoreReferenceCounter (const QoreReferenceCounter &old)
| creates a new object with a reference count of 1 More...
DLLEXPORT | ~QoreReferenceCounter ()
| destroys the reference counter object
DLLEXPORT bool | is_unique () const
| returns true if the reference count is 1 More...
DLLEXPORT int | reference_count () const
| gets the reference count More...
DLLEXPORT bool | ROdereference () const
| atomically decrements the reference count More...
DLLEXPORT void | ROreference () const
| atomically increments the reference count

## Static Public Member Functions
static DLLEXPORT QoreListNode * | getAllQoreObjects (ExceptionSink *xsink)
| list all programs as QoreObject list
static DLLEXPORT QoreObject * | getQoreObject (QoreProgram *pgm)
| get QoreObject of QoreProgram
static DLLEXPORT QoreProgram * | resolveProgramId (unsigned programId)
| get the program from program id More...

## Protected Member Functions
virtual DLLLOCAL | ~QoreProgram ()
| the destructor is private in order to prohibit the object from being allocated on the stack More...
Protected Member Functions inherited from AbstractPrivateData
virtual DLLLOCAL | ~AbstractPrivateData ()
| as these objects are reference counted, the destructor should be called only when the reference count = 0 and not manually

## Detailed Description

supports parsing and executing Qore-language code, reference counted, dynamically-allocated only

This class implements a transaction and thread-safe container for qore-language code This class implements two-layered reference counting to address problems with circular references. When a program has a global variable that contains an object that references the program... objects now reference the dependency counter, so when the object's counter reaches zero and the global variable list is deleted, then the variables will in turn dereference the program so it can be deleted.

## Constructor & Destructor Documentation

## ◆ ~QoreProgram()

virtual DLLLOCAL QoreProgram::~QoreProgram | ( |  | ) |
| protected virtual

the destructor is private in order to prohibit the object from being allocated on the stack

the destructor is run when the reference count reaches 0

## ◆ QoreProgram()

DLLEXPORT QoreProgram::QoreProgram | ( | int64 | parse_options | ) |

creates the object and sets the parse options

Parameters

  parse_options | the parse options mask for the QoreProgram object

## Member Function Documentation

## ◆ addFeature()

DLLEXPORT void QoreProgram::addFeature | ( | const char * | name | ) |

manually add the feature to the program

useful for use with module-cmd when manually merging in namespace changes to the program

Parameters

  name | the name of the feature to add to the QoreProgram's feature list

## ◆ assignBreakpoint()

DLLEXPORT void QoreProgram::assignBreakpoint | ( | QoreBreakpoint * | bkpt,
|  | ExceptionSink * | xsink
| ) |  |

Assign QoreBreakpoint instance to QoreProgram. If breakpoint has been assigned to an program then is unassigned in the first step.

## ◆ callFunction()

DLLEXPORT QoreValue QoreProgram::callFunction | ( | const char * | name,
|  | const QoreListNode * | args,
|  | ExceptionSink * | xsink
| ) |  |

calls a function from the function name and returns the return value

if the function does not exist, an exception is added to "xsink"

Parameters

  name | the name of the function to call
  args | the argument to the function (can be nullptr)
  xsink | if an error occurs, the Qore-language exception information will be added here

Returns
  the value returned by the function (if any)

## ◆ deleteAllBreakpoints()

DLLEXPORT void QoreProgram::deleteAllBreakpoints | ( |  | ) |

delete all breakpoints from instance

## ◆ depDeref()

DLLEXPORT void QoreProgram::depDeref | ( |  | ) |

dereferences a weak reference for the program object

Since
  Qore 0.9 public

## ◆ depRef()

DLLEXPORT void QoreProgram::depRef | ( |  | ) |

incremements the weak reference count for the program object

Since
  Qore 0.9

## ◆ deref() [1/3]

virtual DLLLOCAL void AbstractPrivateData::deref
| inline

dereferences the object and deletes it if the reference count reaches zero

do not use this function if the program may be running, use QoreProgram::waitForTerminationAndDeref() instead

Parameters

  xsink | if an error occurs, the Qore-language exception information will be added here

See also
  QoreProgram::waitForTerminationAndDeref()

## ◆ deref() [2/3]

virtual DLLLOCAL void AbstractPrivateData::deref
| inline

dereferences the object and deletes it if the reference count reaches zero

do not use this function if the program may be running, use QoreProgram::waitForTerminationAndDeref() instead

Parameters

  xsink | if an error occurs, the Qore-language exception information will be added here

See also
  QoreProgram::waitForTerminationAndDeref()

## ◆ deref() [3/3]

virtual DLLEXPORT void QoreProgram::deref | ( | ExceptionSink * | xsink | ) |
| virtual

decrements the reference count of the object

Parameters

  xsink | any Qore-language exception information is stored here

Reimplemented from AbstractPrivateData.

## ◆ disableParseOptions()

DLLEXPORT void QoreProgram::disableParseOptions | ( | int64 | po,
|  | ExceptionSink * | xsink
| ) |  |

turns off the parse options given in the passed mask and adds Qore-language exception information if an error occurs

Parameters

  po | the parse options to subtract from the parse option mask
  xsink | if an error occurs, the Qore-language exception information will be added here

## ◆ disableWarning()

DLLEXPORT int QoreProgram::disableWarning | ( | int | code | ) |

disables a warning by its code

Parameters

  code | the warning code to disable

Returns
  0 for success, -1 for error

## ◆ enableWarning()

DLLEXPORT int QoreProgram::enableWarning | ( | int | code | ) |

enables a warning by its code

Parameters

  code | the warning code to enable

Returns
  0 for success, -1 for error

## ◆ findAllClassesRegex()

DLLEXPORT class_vec_t QoreProgram::findAllClassesRegex | ( | const QoreString & | pattern,
|  | int | re_opts,
|  | ExceptionSink * | xsink
| ) |  | const

returns a list of all classes that match the pattern

Since
  Qore 0.9

## ◆ findAllFunctionsRegex()

DLLEXPORT func_vec_t QoreProgram::findAllFunctionsRegex | ( | const QoreString & | pattern,
|  | int | re_opts,
|  | ExceptionSink * | xsink
| ) |  | const

returns a list of all functions that match the pattern

Since
  Qore 0.9

## ◆ findAllGlobalVarsRegex()

DLLEXPORT gvar_vec_t QoreProgram::findAllGlobalVarsRegex | ( | const QoreString & | pattern,
|  | int | re_opts,
|  | ExceptionSink * | xsink
| ) |  | const

returns a list of all global variables that match the pattern

Since
  Qore 0.9

## ◆ findAllHashDeclsRegex()

DLLEXPORT hashdecl_vec_t QoreProgram::findAllHashDeclsRegex | ( | const QoreString & | pattern,
|  | int | re_opts,
|  | ExceptionSink * | xsink
| ) |  | const

returns a list of all typed hashes (hashdecls) that match the pattern

Since
  Qore 0.9

## ◆ findAllNamespaceConstantsRegex()

DLLEXPORT const_vec_t QoreProgram::findAllNamespaceConstantsRegex | ( | const QoreString & | pattern,
|  | int | re_opts,
|  | ExceptionSink * | xsink
| ) |  | const

returns a list of all namespace constants that match the pattern

Since
  Qore 0.9

## ◆ findAllNamespacesRegex()

DLLEXPORT ns_vec_t QoreProgram::findAllNamespacesRegex | ( | const QoreString & | pattern,
|  | int | re_opts,
|  | ExceptionSink * | xsink
| ) |  | const

returns a list of all namespaces that match the pattern

Since
  Qore 0.9

## ◆ findClass()

DLLEXPORT const QoreClass* QoreProgram::findClass | ( | const char * | path,
|  | ExceptionSink * | xsink
| ) |  | const

search for the given class in the program; can be a simple class name or a namespace-prefixed path (ex: "NamespaceName::ClassName")

Since
  Qore 0.9

## ◆ findFunction()

DLLEXPORT const QoreExternalFunction* QoreProgram::findFunction | ( | const char * | path | ) | const

search for the given function in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::function_name")

Since
  Qore 0.9

## ◆ findFunctionStatement()

DLLEXPORT AbstractStatement* QoreProgram::findFunctionStatement | ( | const char * | functionName,
|  | const QoreListNode * | params,
|  | ExceptionSink * | xsink
| ) |  | const

find statement related to particular function

## ◆ findGlobalVar()

DLLEXPORT const QoreExternalGlobalVar* QoreProgram::findGlobalVar | ( | const char * | path,
|  | const QoreNamespace *& | pns
| ) |  | const

search for the given global variable in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::global_var")

Since
  Qore 0.9

## ◆ findHashDecl()

DLLEXPORT const TypedHashDecl* QoreProgram::findHashDecl | ( | const char * | path,
|  | const QoreNamespace *& | pns
| ) |  | const

search for the given typed hash (hashdecl) in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::TypedHashName")

Since
  Qore 0.9

## ◆ findNamespace() [1/2]

DLLEXPORT QoreNamespace* QoreProgram::findNamespace | ( | const QoreString & | path | ) |

search for the given namespace in the program; can be a simple namespace name or a namespace-prefixed path (ex: "NamespaceName::Namespace")

Note
  this function is safe to call during module initialization for the current Program (as returned by getProgram())

Since
  Qore 0.9

## ◆ findNamespace() [2/2]

DLLEXPORT const QoreNamespace* QoreProgram::findNamespace | ( | const QoreString & | path | ) | const

search for the given namespace in the program; can be a simple namespace name or a namespace-prefixed path (ex: "NamespaceName::Namespace")

Since
  Qore 0.9

## ◆ findNamespaceConstant()

DLLEXPORT const QoreExternalConstant* QoreProgram::findNamespaceConstant | ( | const char * | path,
|  | const QoreNamespace *& | pns
| ) |  | const

search for the given namespace constant in the program; can be a simple function name or a namespace-prefixed path (ex: "NamespaceName::MyConstant")

Since
  Qore 0.9

## ◆ findStatement()

DLLEXPORT AbstractStatement* QoreProgram::findStatement | ( | const char * | fileName,
|  | int | line
| ) |  | const

find statement related to particular line in a source file

## ◆ getBreakpoints()

DLLEXPORT void QoreProgram::getBreakpoints | ( | QoreBreakpointList_t & | bkptList | ) |

get list of breakpoint assigned to program.

## ◆ getExternalData()

DLLEXPORT AbstractQoreProgramExternalData* QoreProgram::getExternalData | ( | const char * | owner | ) | const

retrieves the external data pointer

Parameters

  owner | a unique string identifying the owner of the data; for modules this should be the module name

Returns
  the data if set otherwise nullptr is returned

Since
  Qore 0.8.13

## ◆ getGlobalVariableVal()

DLLEXPORT QoreValue QoreProgram::getGlobalVariableVal | ( | const char * | var,
|  | bool & | found
| ) |  | const

returns the value of the global variable given (do not include the "$" symbol), the caller owns the reference count returned

Parameters

  var | the variable name to return (do not include the "$" symbol)
  found | returns true if the variable exists, false if not

Returns
  the value of the global variable given; if a non-zero pointer is returned, the caller owns the reference count returned

## ◆ getGlobalVariableValue()

DLLEXPORT QoreValue QoreProgram::getGlobalVariableValue | ( | const char * | var,
|  | bool & | found
| ) |  | const

returns the value of the global variable given (do not include the "$" symbol), the caller owns the reference count returned

Parameters

  var | the variable name to return (do not include the "$" symbol)
  found | returns true if the variable exists, false if not

Returns
  the value of the global variable given; if a non-zero pointer is returned, the caller owns the reference count returned

## ◆ getGlobalVars()

DLLEXPORT QoreHashNode* QoreProgram::getGlobalVars | ( |  | ) | const

retrieves a hash of global variables and their values

Returns
  a hash of global variable information; keys are namespace-justified global variable names, values are the values

Since
  Qore 0.8.13

## ◆ getLocalVariableVal()

DLLEXPORT QoreValue QoreProgram::getLocalVariableVal | ( | const char * | var,
|  | bool & | found
| ) |  | const

returns the value of the local variable given (do not include the "$" symbol), the caller owns the reference count returned The variable is related to current frame. This function can be executed only when program is stopped

Parameters

  var | the variable name to return (do not include the "$" symbol)
  found | returns true if the variable exists, false if not

Returns
  the value of the global variable given; if a non-zero pointer is returned, the caller owns the reference count returned

## ◆ getProgramId()

DLLEXPORT unsigned QoreProgram::getProgramId | ( |  | ) | const

get the program id

Returns
  the program id

## ◆ getScriptDir()

DLLEXPORT QoreStringNode* QoreProgram::getScriptDir | ( |  | ) | const

returns the script directory, if known (0 if not)

Returns
  the script directory, if known (0 if not)

## ◆ getScriptName()

DLLEXPORT QoreStringNode* QoreProgram::getScriptName | ( |  | ) | const

returns the script file name, if known (0 if not)

Returns
  the script file name, if known (0 if not)

## ◆ getScriptPath()

DLLEXPORT QoreStringNode* QoreProgram::getScriptPath | ( |  | ) | const

returns the script path (directory and name), if known (0 if not)

Returns
  the script path (directory and name), if known (0 if not)

## ◆ getSourceFileNames()

DLLEXPORT QoreHashNode* QoreProgram::getSourceFileNames | ( | ExceptionSink * | xsink | ) | const

get list of files which appears in a statement

Returns
  hash where the key is file name and value is hash where the key value is label and the value is label's section offset in the file

## ◆ getSourceLabels()

DLLEXPORT QoreHashNode* QoreProgram::getSourceLabels | ( | ExceptionSink * | xsink | ) | const

get list of labels which appears in a statement

Returns
  hash where the key is label name and value is hash where the key is file and the value is label's section offset in the file

## ◆ getStatementBreakpoints()

DLLEXPORT void QoreProgram::getStatementBreakpoints | ( | const AbstractStatement * | statement,
|  | QoreBreakpointList_t & | bkptList
| ) |  |

get list of breakpoint assigned to statement.

## ◆ getStatementId()

DLLEXPORT unsigned long QoreProgram::getStatementId | ( | const AbstractStatement * | statement | ) | const

get the statement id

Parameters

  statement | MUST be statement of this Program instance!

Returns
  the statement id which consist of pointer to both program and statement instances

## ◆ getThreadData()

DLLEXPORT QoreHashNode* QoreProgram::getThreadData | ( |  | ) |

returns the thread-local data for the current thread and the Program object

will always be non-nullptr if the thread is registered

Since
  Qore 0.9

## ◆ getThreadList()

DLLEXPORT QoreListNode* QoreProgram::getThreadList | ( |  | ) | const

returns a list of threads active in this Program object

Returns
  a list of threads active in this Program object

Since
  Qore 0.8.13

## ◆ getUserFunctionList()

DLLEXPORT QoreListNode* QoreProgram::getUserFunctionList | ( |  | ) |

returns a list of all user functions in this program

Returns
  a list of all user functions in this program; returns 0 only if the Program is being destroyed, otherwise returns an empty list

## ◆ issueModuleCmd()

DLLEXPORT int QoreProgram::issueModuleCmd | ( | const char * | module,
|  | const char * | cmd,
|  | ExceptionSink * | xsink
| ) |  |

issues a module command for the given module; the module is loaded into the current Program object if it is not already present

Parameters

  module | the module name; must be in the default character encoding (normally UTF-8)
  cmd | the command string to execute to be parsed by the module (normally UTF-8)
  xsink | if an error occurs, the Qore-language exception information will be added here

Returns
  -1 if an error occurred (in which case the error information is in xsink), 0 if not

Note
  command errors can result in other module- and command-specific exceptions being thrown; see documentation for the module and command in question for more details

Since
  Qore 0.9.5

## ◆ parse() [1/5]

DLLEXPORT void QoreProgram::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

Note
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  fp | the filename to parse
  name | the name of the file being parsed and run
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here
  warn_mask | the warning mask to set (-1 sets all possible warnings)

## ◆ parse() [2/5]

DLLEXPORT void QoreProgram::parse | ( | const QoreString * | str,
|  | const QoreString * | lstr,
|  | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink = `0`,
|  | int | warn_mask = `QP_WARN_ALL`
| ) |  |

parses code from the given string and commits changes to the QoreProgram

Note
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  str | the code to parse
  lstr | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here
  warn_mask | the warning mask to set (-1 sets all possible warnings)

## ◆ parse() [3/5]

DLLEXPORT void QoreProgram::parse | ( | const QoreString * | str,
|  | const QoreString * | lstr,
|  | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink,
|  | int | warn_mask,
|  | const QoreString * | source,
|  | int | offset
| ) |  |

parses code from the given string and commits changes to the QoreProgram

Note
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  str | the code to parse
  lstr | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)
  source | the source file name (if lstr is a label representing a section of a file for example)
  offset | the line offset from the label to the file

## ◆ parse() [4/5]

DLLEXPORT void QoreProgram::parse | ( | const char * | str,
|  | const char * | lstr,
|  | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink = `0`,
|  | int | warn_mask = `QP_WARN_ALL`
| ) |  |

parses code from the given string and commits changes to the QoreProgram

Note
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  str | the code to parse; the encoding of the string is assumed to be QCS_DEFAULT
  lstr | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)

## ◆ parse() [5/5]

DLLEXPORT void QoreProgram::parse | ( | const char * | str,
|  | const char * | lstr,
|  | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink,
|  | int | warn_mask,
|  | const char * | source,
|  | int | offset
| ) |  |

parses code from the given string and commits changes to the QoreProgram

Note
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  str | the code to parse; the encoding of the string is assumed to be QCS_DEFAULT
  lstr | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)
  source | the source file name (if lstr is a label representing a section of a file for example)
  offset | the line offset from the label to the file

## ◆ parseAndRun() [1/2]

DLLEXPORT void QoreProgram::parseAndRun | ( | FILE * | fp,
|  | const char * | name
| ) |  |

parses the given file and runs the file

the default exception handler is run on any Qore-language exceptions raised while parsing and executing the file.

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  fp | the filename to run
  name | the name of the file being parsed and run

## ◆ parseAndRun() [2/2]

DLLEXPORT void QoreProgram::parseAndRun | ( | const char * | str,
|  | const char * | name
| ) |  |

parses the given string and runs the code

The default exception handler is run on any Qore-language exceptions raised while parsing and executing the code.

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  str | the Qore-language code to parse and run
  name | the label of the code being parsed and run (used as the file name)

## ◆ parseAndRunClass() [1/2]

DLLEXPORT void QoreProgram::parseAndRunClass | ( | FILE * | fp,
|  | const char * | name,
|  | const char * | classname
| ) |  |

parses the given file and runs the code by instantiating the class given

The default exception handler is run on any Qore-language exceptions raised while parsing and executing the file.

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  fp | the filename to run
  name | the name of the file being parsed and run
  classname | the name of the class to instantiate

## ◆ parseAndRunClass() [2/2]

DLLEXPORT void QoreProgram::parseAndRunClass | ( | const char * | str,
|  | const char * | name,
|  | const char * | classname
| ) |  |

parses the given string and runs the code by instantiating the class given

The default exception handler is run on any Qore-language exceptions raised while parsing and executing the code.

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  str | the Qore-language code to parse and run
  name | the label of the code being parsed and run (used as the file name)
  classname | the name of the class to instantiate

## ◆ parseCmdLineDefines()

DLLEXPORT void QoreProgram::parseCmdLineDefines | ( | ExceptionSink & | xs,
|  | ExceptionSink & | ws,
|  | int | w,
|  | const std::map< std::string, std::string > & | defmap
| ) |  |

defines parse-time variables

Parameters

  xs | exception sink for errors
  ws | exception sink for warnings
  w | warning mask
  defmap | a map of variable names to values

## ◆ parseCommit()

DLLEXPORT void QoreProgram::parseCommit | ( | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink = `0`,
|  | int | warn_mask = `QP_WARN_ALL`
| ) |  |

commits pending changes to the program

See also
  QoreProgram::parsePending()
  QoreProgram::parseRollback()

## ◆ parseDefine() [1/2]

DLLEXPORT void QoreProgram::parseDefine | ( | const char * | str,
|  | QoreValue | val
| ) |  |

defines a parse-time variable; call only at parse time (or before parsing)

Parameters

  str | the name of the variable
  val | the value of the variable; may be 0; if non-0, then the QoreProgram object assumes ownership of the reference

Note
  if this function is called at runtime it could cause a crash

See also
  runtimeDefine()

## ◆ parseDefine() [2/2]

DLLEXPORT void QoreProgram::parseDefine | ( | const char * | str,
|  | const char * | val
| ) |  |

defines a parse-time variable; call only at parse time (or before parsing)

Parameters

  str | the name of the variable
  val | a string value that will be parsed and converted to a qore value

Note
  if this function is called at runtime it could cause a crash

See also
  runtimeDefine()

## ◆ parseFile()

DLLEXPORT void QoreProgram::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

Also sets the script path.

Note
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  filename | the filename to open and parse
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)
  only_first_except | is flag to stop parsing exceptions printing after 1st exception

## ◆ parseFileAndRun()

DLLEXPORT void QoreProgram::parseFileAndRun | ( | const char * | filename | ) |

parses the given filename and runs the file

any errors opening the file are added as Qore-language exceptions the default exception handler is run on any Qore-language exceptions raised during opening, parsing, and executing the file.

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref(). Also sets the script path.
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  filename | the filename to run

## ◆ parseFileAndRunClass()

DLLEXPORT void QoreProgram::parseFileAndRunClass | ( | const char * | filename,
|  | const char * | classname
| ) |  |

parses the given filename and runs the program by instantiating the class given

Any errors opening the file are added as Qore-language exceptions. The default exception handler is run on any Qore-language exceptions raised during opening, parsing, and executing the file.

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref(). Also sets the script path.
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  filename | the filename to run
  classname | the name of the class to instantiate

## ◆ parseGetScriptDir()

DLLLOCAL const char* QoreProgram::parseGetScriptDir | ( |  | ) | const

returns the script directory, if known (0 if not), does not grab the parse lock, only to be called while parsing

Returns
  the script directory, if known (0 if not)

## ◆ parsePending() [1/4]

DLLEXPORT void QoreProgram::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

Parameters

  code | the code to parse; the encoding of the string is assumed to be QCS_DEFAULT
  label | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)

See also
  QoreProgram::parseCommit()
  QoreProgram::parseRollback()

## ◆ parsePending() [2/4]

DLLEXPORT void QoreProgram::parsePending | ( | const char * | code,
|  | const char * | label,
|  | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink,
|  | int | warn_mask,
|  | const char * | source,
|  | int | offset
| ) |  |

parses code from the given string but does not commit changes to the QoreProgram

Parameters

  code | the code to parse; the encoding of the string is assumed to be QCS_DEFAULT
  label | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)
  source | the source file name (if lstr is a label representing a section of a file for example)
  offset | the line offset from the label to the file

See also
  QoreProgram::parseCommit()
  QoreProgram::parseRollback()

## ◆ parsePending() [3/4]

DLLEXPORT void QoreProgram::parsePending | ( | const QoreString * | str,
|  | const QoreString * | lstr,
|  | 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

Parameters

  str | the code to parse
  lstr | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)

See also
  QoreProgram::parseCommit()
  QoreProgram::parseRollback()

## ◆ parsePending() [4/4]

DLLEXPORT void QoreProgram::parsePending | ( | const QoreString * | str,
|  | const QoreString * | lstr,
|  | ExceptionSink * | xsink,
|  | ExceptionSink * | warn_sink,
|  | int | warn_mask,
|  | const QoreString * | source,
|  | int | offset
| ) |  |

parses code from the given string but does not commit changes to the QoreProgram

Parameters

  str | the code to parse
  lstr | the label of the code being parsed to be used as a file name
  xsink | if an error occurs, the Qore-language exception information will be added here
  warn_sink | if a warning is raised, the warning information will be added here (0 = no warnings)
  warn_mask | the warning mask to set (-1 sets all possible warnings)
  source | the source file name (if lstr is a label representing a section of a file for example)
  offset | the line offset from the label to the file

See also
  QoreProgram::parseCommit()
  QoreProgram::parseRollback()

## ◆ parseRollback()

DLLEXPORT int QoreProgram::parseRollback | ( | ExceptionSink * | xsink | ) |

rolls back changes to the program object that were added with QoreProgram::parsePending()

a Qore-language exception could be raised if the parse lock could not be acquired (Program has running threads)

See also
  QoreProgram::parsePending()
  QoreProgram::parseCommit()

## ◆ parseSetTimeZone()

DLLEXPORT void QoreProgram::parseSetTimeZone | ( | const char * | zone | ) |

sets the time zone during parsing

Parameters

  zone | can be either a region name (ex: 'Europe/Prague') or a UTC offset in the format SDD[:DD[:DD]] where S is + or - and D is an integer 0 - 9; the ':' characters are optional

Note
  do not call this function if there are any running threads; a crash could result

## ◆ removeExternalData()

DLLEXPORT AbstractQoreProgramExternalData* QoreProgram::removeExternalData | ( | const char * | owner | ) |

removes a pointer to external data in the Program; does not dereference the data

Parameters

  owner | a unique string identifying the owner of the data; for modules this should be the module name

Since
  Qore 0.9.5

## ◆ replaceParseOptions()

DLLEXPORT void QoreProgram::replaceParseOptions | ( | int64 | po,
|  | ExceptionSink * | xsink
| ) |  |

replaces the parse options in the program with those given by the argument; adds Qore-language exception information if an error occurs

An exception will be raised if the calling program does not have PO_NO_CHILD_PO_RESTRICTIONS set

Parameters

  po | the parse options to add to the parse option mask
  xsink | if an error occurs, the Qore-language exception information will be added here

## ◆ resolveProgramId()

static DLLEXPORT QoreProgram* QoreProgram::resolveProgramId | ( | unsigned | programId | ) |
| static

get the program from program id

Parameters

  programId | provided by QoreProgram::getProgramId

Returns
  the original program or null if program cannot be resolved

## ◆ resolveStatementId()

DLLEXPORT AbstractStatement* QoreProgram::resolveStatementId | ( | unsigned long | statementId | ) | const

get the statement from statement id

Parameters

  statementId | created by QoreProgram::getStatementId

Returns
  the original statement or null if statement cannot be resolved

## ◆ run()

DLLEXPORT QoreValue QoreProgram::run | ( | ExceptionSink * | xsink | ) |

runs the program (instantiates the program class if a program class has been set) and returns the return value (if any)

Note
  if the program is run as a class it's not possible to return a value
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()

See also
  QoreProgram::setExecClass()

Parameters

  xsink | if an error occurs, the Qore-language exception information will be added here

Returns
  the value returned by the final return statement (if any)

## ◆ runClass()

DLLEXPORT void QoreProgram::runClass | ( | const char * | classname,
|  | ExceptionSink * | xsink
| ) |  |

instantiates the class given and runs its constructor

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()
  will also commit any pending changes added with QoreProgram::parsePending()

Parameters

  classname | the name of the class to instantiate
  xsink | if an error occurs, the Qore-language exception information will be added here

## ◆ runtimeFindCall()

DLLEXPORT const AbstractQoreFunctionVariant* QoreProgram::runtimeFindCall | ( | const char * | name,
|  | const QoreListNode * | params,
|  | ExceptionSink * | xsink
| ) |  | const

Parameters

  name | the function or class method name; may also be namespace-justified
  params | a list of string parameters giving the types to match
  xsink | any errors finding the code are stored as Qore-language exceptions here; possible errors are as follows: `FIND-CALL-ERROR`: name cannot be resolved, invalid parameter (member of params has a non-string value, string cannot be resolved to a valid type) `INVALID-FUNCTION-ACCESS`: the resolved code is not accessible in the current QoreProgram's context

Since
  Qore 0.8.13

## ◆ runtimeFindCallVariants()

DLLEXPORT QoreListNode* QoreProgram::runtimeFindCallVariants | ( | const char * | name,
|  | ExceptionSink * | xsink
| ) |  | const

Parameters

  name | the function or class method name; may also be namespace-justified
  xsink | if an error occurs, the Qore-language exception information will be added here

Returns
  a list of hashes or nullptr if the name cannot be resolved; when matched, each hash element has the following keys:
  - `desc:` a string description of the call which includes the name and the full text call signature
  - `params:` a QoreListNode object that gives the params in a format that can be used by runtimeFindCall()

Note
  the caller owns the reference count returned for non-nullptr values

Since
  Qore 0.8.13

## ◆ runTopLevel()

DLLEXPORT QoreValue QoreProgram::runTopLevel | ( | ExceptionSink * | xsink | ) |

tuns the top level code and returns any return value

Note
  any threads started by this call will continue running in the background, to wait for them to terminate, call QoreProgram::waitForTermination() or QoreProgram::waitForTerminationAndDeref()

Parameters

  xsink | if an error occurs, the Qore-language exception information will be added here

Returns
  the value returned by the final return statement (if any)

## ◆ setExecClass()

DLLEXPORT void QoreProgram::setExecClass | ( | const char * | ecn = `0` | ) |

sets the name of the application class to be executed (instantiated) instead of top-level code

normally parse option PO_NO_TOP_LEVEL_STATEMENTS should be set as well

Note
  the string passed here will copied

Parameters

  ecn | the name of the class to be executed as the program class

See also
  QoreProgram::parseSetParseOptions()

## ◆ setExternalData()

DLLEXPORT void QoreProgram::setExternalData | ( | const char * | owner,
|  | AbstractQoreProgramExternalData * | pud
| ) |  |

sets a pointer to external data in the Program

Parameters

  owner | a unique string identifying the owner of the data; for modules this should be the module name
  pud | the external data

Since
  Qore 0.8.13

## ◆ setGlobalVarValue()

DLLEXPORT int QoreProgram::setGlobalVarValue | ( | const char * | name,
|  | QoreValue | val,
|  | ExceptionSink * | xsink
| ) |  |

sets the value of the given global variable

Parameters

  name | the name of the variable
  val | the value to assign; the value must be already referenced for the assignment and will be dereferenced if the assignment fails
  xsink | for Qore-language exceptions

Returns
  0 for OK, -1 if an exception was raised

Since
  Qore 0.8.13

## ◆ setParseOptions()

DLLEXPORT void QoreProgram::setParseOptions | ( | int64 | po,
|  | ExceptionSink * | xsink
| ) |  |

sets the parse options and adds Qore-language exception information if an error occurs

Parameters

  po | the parse options to add to the parse option mask
  xsink | if an error occurs, the Qore-language exception information will be added here

## ◆ setScriptPath()

DLLEXPORT void QoreProgram::setScriptPath | ( | const char * | path | ) |

sets the script path

Parameters

  path | the directory and filename of the script (set to 0 to clear)

## ◆ setWarningMask()

DLLEXPORT int QoreProgram::setWarningMask | ( | int | wm | ) |

sets the warning mask

Parameters

  wm | the new warning mask

Returns
  0 for success, -1 for error

## ◆ waitForTerminationAndDeref()

DLLEXPORT void QoreProgram::waitForTerminationAndDeref | ( | ExceptionSink * | xsink | ) |

this call blocks until the program's last thread terminates, and then calls QoreProgram::deref()

Parameters

  xsink | if an error occurs, the Qore-language exception information will be added here

The documentation for this class was generated from the following file:

- include/qore/QoreProgram.h