Qore Programming Language Reference Manual  0.8.9
 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 
260 
261 public:
263 
277 nothing importClass(string cls);
278 
279 public:
281 
296 nothing importFunction(string func);
297 
298 public:
300 
316 nothing importFunction(string func, string new_name);
317 
318 public:
320 
333 nothing importGlobalVariable(string varname, bool readonly = False);
334 
335 public:
337 
346 bool isDefined(string def);
347 
348 public:
350 
370  loadModule(string name);
371 
372 public:
374 
379 nothing lockOptions();
380 
381 public:
383 
418 *hash parse(string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label = True);
419 
420 public:
422 
437 nothing parseCommit();
438 
439 public:
441 
460 *hash parseCommit(int warning_mask);
461 
462 public:
464 
502 *hash parsePending(string code, string label, *softint warning_mask, *string source, *softint offset, softbool format_label = True);
503 
504 public:
506 
517 nothing parseRollback();
518 
519 public:
521 
535 nothing replaceParseOptions(softint opt);
536 
537 public:
539 
546 any run();
547 
548 public:
550 
565 nothing setParseOptions(softint opt = PO_DEFAULT);
566 
567 public:
569 
576 nothing setScriptPath(*string path);
577 
578 public:
580 
588 nothing setTimeZone(TimeZone zone);
589 
590 public:
592 
603 nothing setTimeZoneRegion(string region);
604 
605 public:
607 
625 nothing setTimeZoneUTCOffset(softint seconds_east);
626 
627 public:
629 
636 nothing undefine(string def);
637 };
642 
644 
650 
658 
662 
666 
672 
677 
683 
688 
693 
698 
705 
711 
716 
721 
726 
731 
740 
746 
751 
756 
761 
766 
775 
780 
789 
794 
800 
805 
810 
815 
822 
826 
831 
839 
846 
852 
858 
862 
864  const WARN_ALL = QP_WARN_ALL;
866 
868  const WARN_CALL_WITH_TYPE_ERRORS = QP_WARN_CALL_WITH_TYPE_ERRORS;
870 
881  const WARN_DEFAULT = QP_WARN_DEFAULT;
883 
885  const WARN_DEPRECATED = QP_WARN_DEPRECATED;
887 
889  const WARN_DUPLICATE_BLOCK_VARS = QP_WARN_DUPLICATE_BLOCK_VARS;
891 
893  const WARN_DUPLICATE_GLOBAL_VARS = QP_WARN_DUPLICATE_GLOBAL_VARS;
895 
897  const WARN_DUPLICATE_HASH_KEY = QP_WARN_DUPLICATE_HASH_KEY;
899 
901  const WARN_DUPLICATE_LOCAL_VARS = QP_WARN_DUPLICATE_LOCAL_VARS;
903 
905  const WARN_EXCESS_ARGS = QP_WARN_EXCESS_ARGS;
907 
909  const WARN_INVALID_OPERATION = QP_WARN_INVALID_OPERATION;
911 
920  const WARN_MODULES = QP_WARN_MODULES;
922  const WARN_NONE = QP_WARN_NONE;
924 
928  const WARN_NONEXISTENT_METHOD_CALL = QP_WARN_NONEXISTENT_METHOD_CALL;
930 
932  const WARN_RETURN_VALUE_IGNORED = QP_WARN_RETURN_VALUE_IGNORED;
934 
936  const WARN_UNDECLARED_VAR = QP_WARN_UNDECLARED_VAR;
938 
940  const WARN_UNKNOWN_WARNING = QP_WARN_UNKNOWN_WARNING;
942 
944  const WARN_UNREACHABLE_CODE = QP_WARN_UNREACHABLE_CODE;
946 
948  const WARN_UNREFERENCED_VARIABLE = QP_WARN_UNREFERENCED_VARIABLE;
950 
952  const WARN_WARNING_MASK_UNCHANGED = QP_WARN_WARNING_MASK_UNCHANGED;
954 };
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:681
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:820
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:944
*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:675
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:889
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:803
const PO_NO_SUBROUTINE_DEFS
Disallows subroutine (function) definitions.
Definition: QC_Program.dox.h:783
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:660
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:709
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:928
list getUserFunctionList()
Returns a list of strings of all user functions defined in the program object.
const PO_NO_NEW
Disallows use of the new operator.
Definition: QC_Program.dox.h:773
const PO_REQUIRE_PROTOTYPES
Requires all function and method parameters and return types to have type declarations.
Definition: QC_Program.dox.h:837
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:654
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:932
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_GUI
Disallows access to functionality that draws graphics to the display.
Definition: QC_Program.dox.h:734
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:701
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...
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:686
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:909
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:868
const PO_REQUIRE_OUR
Requires global variables to be declared with our before use.
Definition: QC_Program.dox.h:829
list list(...)
Returns a list of the arguments passed at the top level.
const WARN_ALL
Enables all warnings.
Definition: QC_Program.dox.h:864
const WARN_DEPRECATED
Enables a warning when deprecated code is used.
Definition: QC_Program.dox.h:885
const PO_NO_INHERIT_GLOBAL_VARS
Precludes global variables from being inherited into the new Program object.
Definition: QC_Program.dox.h:736
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:691
const PO_POSITIVE_OPTIONS
mask of all parse options allowing for more freedom (instead of less)
Definition: QC_Program.dox.h:824
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:844
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:897
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:648
const PO_NO_GLOBAL_VARS
Disallows the use of global variables.
Definition: QC_Program.dox.h:729
const PO_NO_THREADS
Prohibits access to all threading information.
Definition: QC_Program.dox.h:798
*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:749
const PO_NO_FILESYSTEM
Disallows access to the filesystem.
Definition: QC_Program.dox.h:724
const WARN_NONE
Represents no warning.
Definition: QC_Program.dox.h:922
*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 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:901
const PO_NO_NAMESPACE_DEFS
Disallows new namespace definitions.
Definition: QC_Program.dox.h:759
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:738
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:856
const PO_NO_SYSTEM_FUNC_VARIANTS
Prohibits builtin/system function variants from being imported into the new Program object...
Definition: QC_Program.dox.h:787
const PO_DEFAULT
This option is the empty option, meaning no options are set.
Definition: QC_Program.dox.h:656
any run()
Runs the program and optionally returns a value if the top-level code exits with a return statement...
const PO_NO_PROCESS_CONTROL
Disallows access to functions that would affect the current process (exit(), exec(), fork(), etc)
Definition: QC_Program.dox.h:778
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:744
const PO_NO_CONSTANT_DEFS
Disallows constant definitions.
Definition: QC_Program.dox.h:696
nothing parseCommit()
Commits and pending code processed with Program::parsePending() to the Program object after resolving...
const PO_NO_SYSTEM_CLASSES
Prohibits system classes from being imported into the new Program object.
Definition: QC_Program.dox.h:785
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:850
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:936
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:940
nothing undefine(string def)
Unsets a parse define for the current Program.
const PO_LOCKDOWN
Sets very restrictive access; this restriction is designed to allow code to only execute logic...
Definition: QC_Program.dox.h:670
nothing importClass(string cls)
Imports a class into the program object's space; any calls to the imported class's code will run with...
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:948
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:719
*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:764
const PO_NO_TOP_LEVEL_STATEMENTS
Disallows top level code.
Definition: QC_Program.dox.h:818
const PO_NO_MODULES
Disallows loading modules with the %requires directive or at runtime with load_module() ...
Definition: QC_Program.dox.h:754
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:905
const PO_IN_MODULE
Only set by the system when in a user module Program.
Definition: QC_Program.dox.h:664
const WARN_MODULES
The default warning mask for user modules.
Definition: QC_Program.dox.h:920
const PO_NO_TERMINAL_IO
Disallows access to reading from and/or writing to the terminal.
Definition: QC_Program.dox.h:792
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:952
const PO_NO_EMBEDDED_LOGIC
Prohibits embedded logic from being used.
Definition: QC_Program.dox.h:703
const WARN_DEFAULT
The default warning mask.
Definition: QC_Program.dox.h:881
const PO_NO_EXTERNAL_INFO
Disallows access to functionality that provides information about the computing environment.
Definition: QC_Program.dox.h:714
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.
*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:808
any getDefine(string def)
Retrieves the value of the given parse define in the current Program.
const WARN_DUPLICATE_GLOBAL_VARS
Indicates that the embedded code has declared the same global variable more than once.
Definition: QC_Program.dox.h:893
const PO_NO_THREAD_INFO
Disallows access to functionality that provides information about threading.
Definition: QC_Program.dox.h:813
loadModule(string name)
Loads a Qore module into the Program object at run-time.