Qore Programming Language Reference Manual  0.8.12.2
 All Classes Namespaces Functions Variables Groups Pages
QC_Program.dox.h
1 namespace Qore {
4 
29 class Program {
30 
31 public:
33 
51 any callFunction(string name, ...);
52 
53 public:
55 
73 any callFunctionArgs(string name, *softlist vargs);
74 
75 public:
77 
98  constructor(softint po = PO_DEFAULT);
99 
100 public:
102 
104  copy();
105 
106 public:
108 
116 nothing define(string def, any val);
117 
118 public:
120 /***/
121  destructor();
122 
123 public:
125 
140 nothing disableParseOptions(softint opt);
141 
142 public:
144 
159 bool existsFunction(string name);
160 
161 public:
163 
172 any getDefine(string def);
173 
174 public:
176 
187 any getGlobalVariable(string varname, *reference rexists);
188 
189 public:
191 
198 int getParseOptions();
199 
200 public:
202 
211 *string getScriptDir();
212 
213 public:
215 
224 *string getScriptName();
225 
226 public:
228 
237 *string getScriptPath();
238 
239 public:
241 
249 
250 public:
252 
259 softlist getUserFunctionList();
260 
261 public:
263 
281 nothing importClass(string cls, *string new_name, *softbool inject);
282 
283 public:
285 
300 nothing importFunction(string func);
301 
302 public:
304 
323 nothing importFunction(string func, string new_name, *softbool inject);
324 
325 public:
327 
340 nothing importGlobalVariable(string varname, bool readonly = False);
341 
342 public:
344 
355  importSystemApi();
356 
357 public:
359 
371 
372 public:
374 
386 
387 public:
389 
401 
402 public:
404 
413 bool isDefined(string def);
414 
415 public:
417 
437  loadApplyToPrivateUserModule(string name);
438 
439 public:
441 
462  loadApplyToUserModule(string name, *softbool reinject);
463 
464 public:
466 
491  loadModule(string name);
492 
493 public:
495 
522  loadUserModuleWithProgram(string name, Qore::Program pgm);
523 
524 public:
526 
531 nothing lockOptions();
532 
533 public:
535 
572 *hash parse(string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label = True);
573 
574 public:
576 
593 nothing parseCommit();
594 
595 public:
597 
618 *hash parseCommit(int warning_mask);
619 
620 public:
622 
662 *hash parsePending(string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label = True);
663 
664 public:
666 
679 nothing parseRollback();
680 
681 public:
683 
697 nothing replaceParseOptions(softint opt);
698 
699 public:
701 
708 any run();
709 
710 public:
712 
727 nothing setParseOptions(softint opt = PO_DEFAULT);
728 
729 public:
731 
738 nothing setScriptPath(*string path);
739 
740 public:
742 
750 nothing setTimeZone(TimeZone zone);
751 
752 public:
754 
765 nothing setTimeZoneRegion(string region);
766 
767 public:
769 
787 nothing setTimeZoneUTCOffset(softint seconds_east);
788 
789 public:
791 
798 nothing undefine(string def);
799 };
804 
806 
812 
820 
826 
832 
838 
844 
852 
856 
860 
866 
871 
877 
890 
895 
900 
905 
912 
918 
923 
928 
933 
938 
945 
951 
957 
963 
969 
977 
983 
988 
993 
998 
1003 
1012 
1017 
1022 
1031 
1036 
1041 
1046 
1052 
1057 
1062 
1067 
1072 
1082 
1087 
1093 
1098 
1106 
1113 
1119 
1125 
1129  const ParseOptionCodeMap = qore(pomaps.getCodeToStringMap());
1131 
1135  const ParseOptionStringMap = qore(pomaps.getStringToCodeMap());
1137 
1141 
1143  const WARN_ALL = QP_WARN_ALL;
1145 
1147  const WARN_CALL_WITH_TYPE_ERRORS = QP_WARN_CALL_WITH_TYPE_ERRORS;
1149 
1160  const WARN_DEFAULT = QP_WARN_DEFAULT;
1162 
1164  const WARN_DEPRECATED = QP_WARN_DEPRECATED;
1166 
1168  const WARN_DUPLICATE_BLOCK_VARS = QP_WARN_DUPLICATE_BLOCK_VARS;
1170 
1172  const WARN_DUPLICATE_GLOBAL_VARS = QP_WARN_DUPLICATE_GLOBAL_VARS;
1174 
1176  const WARN_DUPLICATE_HASH_KEY = QP_WARN_DUPLICATE_HASH_KEY;
1178 
1180  const WARN_DUPLICATE_LOCAL_VARS = QP_WARN_DUPLICATE_LOCAL_VARS;
1182 
1184  const WARN_EXCESS_ARGS = QP_WARN_EXCESS_ARGS;
1186 
1188  const WARN_INVALID_OPERATION = QP_WARN_INVALID_OPERATION;
1190 
1199  const WARN_MODULES = QP_WARN_MODULES;
1201  const WARN_NONE = QP_WARN_NONE;
1203 
1207  const WARN_NONEXISTENT_METHOD_CALL = QP_WARN_NONEXISTENT_METHOD_CALL;
1209 
1211  const WARN_RETURN_VALUE_IGNORED = QP_WARN_RETURN_VALUE_IGNORED;
1213 
1215  const WARN_UNDECLARED_VAR = QP_WARN_UNDECLARED_VAR;
1217 
1219  const WARN_UNKNOWN_WARNING = QP_WARN_UNKNOWN_WARNING;
1221 
1223  const WARN_UNREACHABLE_CODE = QP_WARN_UNREACHABLE_CODE;
1225 
1227  const WARN_UNREFERENCED_VARIABLE = QP_WARN_UNREFERENCED_VARIABLE;
1229 
1231  const WARN_WARNING_MASK_UNCHANGED = QP_WARN_WARNING_MASK_UNCHANGED;
1233 };
const PO_NEW_STYLE
Set a more C++ or Java type programming style; prohibits usage of the "$" character and also assumes ...
Definition: QC_Program.dox.h:875
nothing importGlobalVariable(string varname, bool readonly=False)
Imports a global variable into the program object's space.
const PO_NO_USER_CLASSES
Prohibits user classes from being imported into the new Program object.
Definition: QC_Program.dox.h:1085
const WARN_UNREACHABLE_CODE
Indicates that code cannot be reached (for example; code in the same local block after an uncondition...
Definition: QC_Program.dox.h:1223
*string getScriptPath()
Returns the current script directory and filename if known, otherwise returns NOTHING.
const PO_LOCK_WARNINGS
Disallows changes to the warning mask.
Definition: QC_Program.dox.h:869
const WARN_DUPLICATE_BLOCK_VARS
Enables a warning when a program declares a local variable more than once in the same block; note tha...
Definition: QC_Program.dox.h:1168
importSystemClasses()
imports system classes into a Program container at runtime; will throw an exception if the Program wa...
TimeZone getTimeZone()
Returns the default local time zone for the object.
const PO_NO_THREAD_CLASSES
Disallows access to any thread classes.
Definition: QC_Program.dox.h:1055
const PO_NO_SUBROUTINE_DEFS
Disallows subroutine (function) definitions.
Definition: QC_Program.dox.h:1020
const PO_FREE_OPTIONS
mask of options that have no effect on code access or code safety but just affect programming style ...
Definition: QC_Program.dox.h:854
nothing setParseOptions(softint opt=PO_DEFAULT)
Sets parse options in the parse option mask for the Program object.
const PO_NO_EXTERNAL_ACCESS
Prohibits any external access.
Definition: QC_Program.dox.h:916
any getGlobalVariable(string varname, *reference rexists)
Returns a the value of the global variable identified by the first string argument.
Program objects allow Qore programs to support subprograms with the option to restrict capabilities...
Definition: QC_Program.dox.h:29
const WARN_NONEXISTENT_METHOD_CALL
Indicates that the embedded code is calling an unknown method in a class.
Definition: QC_Program.dox.h:1207
const PO_NO_NEW
Disallows use of the new operator.
Definition: QC_Program.dox.h:1010
const PO_REQUIRE_PROTOTYPES
Requires all function and method parameters and return types to have type declarations.
Definition: QC_Program.dox.h:1104
const PO_NO_SYSTEM_API
Prohibits any code from being inherited into the Program object, including the system API...
Definition: QC_Program.dox.h:1029
nothing replaceParseOptions(softint opt)
Replaces the parse options for the Program object.
const PO_ASSUME_LOCAL
Assume local variable scope when variables are first referenced if no my or our is present...
Definition: QC_Program.dox.h:824
const WARN_RETURN_VALUE_IGNORED
Enables a warning when a function or method call is made with no side effects and the return value is...
Definition: QC_Program.dox.h:1211
any callFunctionArgs(string name, *softlist vargs)
Calls a function in the program object giving the arguments to the function as a list and returns the...
const True
logical True
Definition: qc_qore.dox.h:94
const PO_NO_USER_API
Prohibits any user code from being inherited into the Program object.
Definition: QC_Program.dox.h:1080
const PO_NO_GUI
Disallows access to functionality that draws graphics to the display.
Definition: QC_Program.dox.h:941
nothing setTimeZone(TimeZone zone)
Sets the default local time zone for the object.
const PO_NO_DATABASE
Disallows access to database functionality.
Definition: QC_Program.dox.h:908
nothing setTimeZoneUTCOffset(softint seconds_east)
Sets the default time zone for the Program object based on the number of seconds east of UTC; for zon...
loadApplyToPrivateUserModule(string name)
Loads a Qore user module privately into the given Program container at run-time; after this call the ...
const PO_NO_CHILD_PO_RESTRICTIONS
Allows child program objects to have fewer parse restrictions (i.e. more capabilies) than the parent ...
Definition: QC_Program.dox.h:893
const PO_BROKEN_OPERATORS
allows for old pre-Qore 0.8.12 broken runtime parsing of multi-character operators with spaces ...
Definition: QC_Program.dox.h:848
copy()
Throws an exception to prevent objects of this class from being copied.
const False
logical False
Definition: qc_qore.dox.h:92
const WARN_INVALID_OPERATION
Indicates that the embedded code performs some operation that is guaranteed to produce no result (for...
Definition: QC_Program.dox.h:1188
const WARN_CALL_WITH_TYPE_ERRORS
Enables warnings when the parser determines that the argument types of a function or method call are ...
Definition: QC_Program.dox.h:1147
const PO_REQUIRE_OUR
Requires global variables to be declared with our before use.
Definition: QC_Program.dox.h:1096
const WARN_ALL
Enables all warnings.
Definition: QC_Program.dox.h:1143
const PO_BROKEN_LIST_PARSING
allows for old pre-Qore 0.8.12 broken list rewriting in the parser
Definition: QC_Program.dox.h:836
const PO_NO_INHERIT_USER_CLASSES
Prohibits user classes from being imported into the new Program object.
Definition: QC_Program.dox.h:967
const WARN_DEPRECATED
Enables a warning when deprecated code is used.
Definition: QC_Program.dox.h:1164
const PO_NO_INHERIT_GLOBAL_VARS
Precludes global variables from being inherited into the new Program object.
Definition: QC_Program.dox.h:943
bool existsFunction(string name)
Checks if a user function exists in the program object.
any callFunction(string name,...)
Calls a function in the program object and returns the return value.
const PO_NO_CLASS_DEFS
Disallows class definitions.
Definition: QC_Program.dox.h:898
const PO_POSITIVE_OPTIONS
mask of all parse options allowing for more freedom (instead of less)
Definition: QC_Program.dox.h:1091
nothing disableParseOptions(softint opt)
Removes the given parse options to the current parse option mask.
const PO_REQUIRE_TYPES
Requires all function and method parameters, return types, variables, and object members to have type...
Definition: QC_Program.dox.h:1111
nothing lockOptions()
Locks parse options so that they cannot be changed.
const WARN_DUPLICATE_HASH_KEY
Enables a warning when an immediate hash is declared and at least one of the keys is repeated...
Definition: QC_Program.dox.h:1176
const PO_NO_INHERIT_SYSTEM_CLASSES
Prohibits system classes from being imported into the new Program object.
Definition: QC_Program.dox.h:949
nothing importFunction(string func)
Imports a function into the program object's space; any calls to the imported function will run with ...
The TimeZone class provides access to time zone functionality.
Definition: QC_TimeZone.dox.h:6
const PO_ALLOW_BARE_REFS
Prohibits the use of the '$' character in variable names, method calls, and object member references...
Definition: QC_Program.dox.h:810
const PO_NO_GLOBAL_VARS
Disallows the use of global variables.
Definition: QC_Program.dox.h:936
const PO_NO_THREADS
Prohibits access to all threading information.
Definition: QC_Program.dox.h:1050
*string getScriptName()
Returns the current script name as a string or NOTHING if not set.
bool isDefined(string def)
Returns True if the given parse define is defined in the current Program (does not have to have a val...
const PO_NO_LOCALE_CONTROL
Disallows access to functionality that can change locale parameters.
Definition: QC_Program.dox.h:986
const PO_NO_FILESYSTEM
Disallows access to the filesystem.
Definition: QC_Program.dox.h:931
const WARN_NONE
Represents no warning.
Definition: QC_Program.dox.h:1201
*hash parsePending(string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label=True)
Parses the text passed to pending lists in the Program object; does not resolve all references or com...
const PO_NO_API
Prohibits any code from being inherited into the Program object, including the system API...
Definition: QC_Program.dox.h:888
const WARN_DUPLICATE_LOCAL_VARS
Enables a warning when a local variable with the same name is declared in a subblock (ie another loca...
Definition: QC_Program.dox.h:1180
const PO_NO_NAMESPACE_DEFS
Disallows new namespace definitions.
Definition: QC_Program.dox.h:996
const PO_NO_INHERIT_USER_FUNC_VARIANTS
Precludes public user function variants from being inherited into the new Program object...
Definition: QC_Program.dox.h:975
nothing setScriptPath(*string path)
Sets (or clears) the script path (directory and filename) for the object.
const PO_STRICT_BOOLEAN_EVAL
Sets strict mathematical boolean evaluation runtime mode (the qore default prior to v0...
Definition: QC_Program.dox.h:1123
const PO_NO_SYSTEM_FUNC_VARIANTS
Prohibits builtin/system function variants from being imported into the new Program object...
Definition: QC_Program.dox.h:1039
const PO_DEFAULT
This option is the empty option, meaning no options are set.
Definition: QC_Program.dox.h:850
any run()
Runs the program and optionally returns a value if the top-level code exits with a return statement...
const PO_BROKEN_LOGIC_PRECEDENCE
allows for old pre-Qore 0.8.12 precedence of logical and bitwise operators
Definition: QC_Program.dox.h:842
const PO_NO_PROCESS_CONTROL
Disallows access to functions that would affect the current process (exit(), exec(), fork(), etc)
Definition: QC_Program.dox.h:1015
loadApplyToUserModule(string name, *softbool reinject)
Loads a Qore user module into the given Program container at run-time; after this call the Program ob...
nothing setTimeZoneRegion(string region)
Sets the default local time zone for the object from a path to a zoneinfo time zone region file...
const PO_NO_IO
Prohibits all terminal and file I/O and GUI operations.
Definition: QC_Program.dox.h:981
const PO_NO_CONSTANT_DEFS
Disallows constant definitions.
Definition: QC_Program.dox.h:903
nothing parseCommit()
Commits and pending code processed with Program::parsePending() to the Program object after resolving...
nothing importClass(string cls, *string new_name, *softbool inject)
Imports a class into the program object's space; any calls to the imported class's code will run with...
const PO_NO_SYSTEM_CLASSES
Prohibits system classes from being imported into the new Program object.
Definition: QC_Program.dox.h:1034
const PO_STRICT_ARGS
Prohibits access to builtin functions and methods flagged with RT_NOOP and also causes errors to be r...
Definition: QC_Program.dox.h:1117
const WARN_UNDECLARED_VAR
Indicates that the embedded code referenced an undeclared variable that will be assumed to be a globa...
Definition: QC_Program.dox.h:1215
nothing parseRollback()
Rolls back any pending code processed with Program::parsePending() that has not yet been committed to...
const WARN_UNKNOWN_WARNING
Indicates that the embedded code tried to enable or disable an unknown warning.
Definition: QC_Program.dox.h:1219
softlist getUserFunctionList()
Returns a list of strings of all user functions defined in the program object.
nothing undefine(string def)
Unsets a parse define for the current Program.
importSystemApi()
imports system classes and functions into a Program container at runtime; will throw an exception if ...
const PO_LOCKDOWN
Sets very restrictive access; this restriction is designed to allow code to only execute logic...
Definition: QC_Program.dox.h:864
int getParseOptions()
Returns the current binary-or'ed parse option mask for the Program object.
const WARN_UNREFERENCED_VARIABLE
This warning is raised when a variable is declared in a block but never referenced.
Definition: QC_Program.dox.h:1227
const PO_NO_INHERIT_SYSTEM_CONSTANTS
Prohibits system constants from being imported into the new Program object.
Definition: QC_Program.dox.h:955
destructor()
Waits for all threads to finish executing, then deletes all global variables, dereferences the intern...
const PO_NO_EXTERNAL_PROCESS
Disallows any access to external processes (with system(), backquote(), exec(), etc) ...
Definition: QC_Program.dox.h:926
*string getScriptDir()
Returns the current script directory as a string or NOTHING if not set.
const PO_NO_NETWORK
Disallows access to network functionality.
Definition: QC_Program.dox.h:1001
const PO_NO_INHERIT_USER_CONSTANTS
Prohibits user constants from being imported into the new Program object.
Definition: QC_Program.dox.h:973
const PO_NO_TOP_LEVEL_STATEMENTS
Disallows top level code.
Definition: QC_Program.dox.h:1070
const PO_NO_MODULES
Disallows loading modules with the %requires directive or at runtime with load_module() ...
Definition: QC_Program.dox.h:991
loadUserModuleWithProgram(string name, Qore::Program pgm)
Loads a Qore user module into the Program object at run-time using the given Program object as the co...
importSystemConstants()
imports system constants into a Program container at runtime; will throw an exception if the Program ...
const ParseOptionStringMap
Maps from parse option strings to parse option integer codes.
Definition: QC_Program.dox.h:1135
const ParseOptionCodeMap
Maps from parse option code values (as string keys) to parse option names.
Definition: QC_Program.dox.h:1129
hash hash(object obj)
Returns a hash of an object's members.
const WARN_EXCESS_ARGS
Enables a warning when a function or method call is made with more arguments than are used by the fun...
Definition: QC_Program.dox.h:1184
const PO_IN_MODULE
Only set by the system when in a user module Program.
Definition: QC_Program.dox.h:858
const WARN_MODULES
The default warning mask for user modules.
Definition: QC_Program.dox.h:1199
const PO_NO_TERMINAL_IO
Disallows access to reading from and/or writing to the terminal.
Definition: QC_Program.dox.h:1044
const WARN_WARNING_MASK_UNCHANGED
This warning means that the embedded code tried to change the warning mask, but it was locked...
Definition: QC_Program.dox.h:1231
const PO_NO_EMBEDDED_LOGIC
Prohibits embedded logic from being used.
Definition: QC_Program.dox.h:910
importSystemFunctions()
imports system functions into a Program container at runtime; will throw an exception if the Program ...
const WARN_DEFAULT
The default warning mask.
Definition: QC_Program.dox.h:1160
const PO_ALLOW_INJECTION
Allows code/dependency injections in the contained Program object.
Definition: QC_Program.dox.h:818
const PO_NO_EXTERNAL_INFO
Disallows access to functionality that provides information about the computing environment.
Definition: QC_Program.dox.h:921
constructor(softint po=PO_DEFAULT)
Creates the program object and optionally sets program capabilities (parse options) ...
nothing define(string def, any val)
Sets a parse define for the current Program.
const PO_NO_INHERIT_SYSTEM_FUNC_VARIANTS
Prohibits builtin/system function variants from being imported into the new Program object...
Definition: QC_Program.dox.h:961
*hash parse(string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label=True)
Parses the string argument and adds the code to the Program object.
const PO_NO_THREAD_CONTROL
Disallows access to any thread-control functions and thread-relevant statements and operators (for ex...
Definition: QC_Program.dox.h:1060
any getDefine(string def)
Retrieves the value of the given parse define in the current Program.
const PO_BROKEN_INT_ASSIGNMENTS
allows for old pre-Qore 0.8.12 broken runtime int assignments where runtime type errors were ignored ...
Definition: QC_Program.dox.h:830
const WARN_DUPLICATE_GLOBAL_VARS
Indicates that the embedded code has declared the same global variable more than once.
Definition: QC_Program.dox.h:1172
const PO_NO_THREAD_INFO
Disallows access to functionality that provides information about threading.
Definition: QC_Program.dox.h:1065
loadModule(string name)
Loads a Qore module into the Program object at run-time.