32 #ifndef _QORE_QORELIB_H    34 #define _QORE_QORELIB_H    37 #include <qore/QoreThreadLock.h>    38 #include <qore/qore_bitopts.h>    39 #include <qore/safe_dslist>    47 #include <sys/types.h>    57 #undef _QORE_HAS_QORE_XMLNODE_CLASS    61 #undef _QORE_HAS_QORE_XMLREADER_CLASS    64 #undef _QORE_HAS_QORE_XMLDOC_CLASS    67 #define _QORE_HAS_HARD_TYPING 1    70 #define _QORE_HAS_DBI_EXECRAW 1    73 #define _QORE_HAS_TIME_ZONES 1    76 #define _QORE_HAS_THREAD_RESOURCE_IDS 1    79 #define _QORE_HAS_PREPARED_STATMENT_API 1    82 #define _QORE_HAS_DATASOURCE_ACTIVETRANSACTION 1    85 #define _QORE_HAS_DBI_SELECT_ROW 1    88 #define _QORE_HAS_NUMBER_TYPE 1    91 #define _QORE_HAS_PATH_IS_READABLE 1    94 #define _QORE_HAS_DBI_OPTIONS 1    97 #define _QORE_HAS_FIND_CREATE_TIMEZONE 1   100 #define _QORE_HAS_NUMBER_CONS_WITH_PREC 1   103 #define _QORE_HAS_FILE_OBJECT_HELPER 1   106 #define _QORE_HAS_QUEUE_OBJECT_HELPER 1   109 #define _QORE_HAS_QOREHTTPCLIENTOBJECT 1   112 #define _QORE_HAS_DBI_DESCRIBE 1   115 #define _QORE_HAS_DBI_EVENTS 1   118 #define _QORE_HAS_QUEUE_OBJECT 1   121 #define _QORE_HAS_SOCKET_PERF_API 1   124 #define _QORE_HAS_QL_MIT 1   127 #define _QORE_HAS_DATETIME_ADD_SECONDS_TO 1   130 #define QCF_NO_FLAGS                 0      131 #define QCF_NOOP               (1 << 0)     132 #define QCF_USES_EXTRA_ARGS    (1 << 1)     133 #define QCF_CONSTANT_INTERN    (1 << 2)     134 #define QCF_DEPRECATED         (1 << 3)     135 #define QCF_RET_VALUE_ONLY     (1 << 4)     136 #define QCF_RUNTIME_NOOP       (1 << 5)     139 #define QCF_CONSTANT (QCF_CONSTANT_INTERN | QCF_RET_VALUE_ONLY)    161 DLLEXPORT 
hashdecl tm* 
q_localtime(
const time_t* clock, 
struct tm* tms);
   164 DLLEXPORT 
hashdecl tm* 
q_gmtime(
const time_t* clock, 
struct tm* tms);
   182 DLLEXPORT 
char* 
q_dirname(
const char* path);
   185 DLLEXPORT 
void* 
q_realloc(
void* ptr, 
size_t size);
   235    DLLLOCAL FeatureList& operator=(
const FeatureList&);
   249 static inline char* 
strchrs(
const char* str, 
const char* chars) {
   251       if (strchr(chars, *str))
   259 static inline char* 
strnchr(
const char* str, 
int len, 
char c) {
   272       (*str) = tolower(*str);
   371 class AbstractQoreZoneInfo;
   385 DLLEXPORT 
int tz_get_utc_offset(
const AbstractQoreZoneInfo* tz, 
int64 epoch_offset, 
bool &is_dst, 
const char* &zone_name);
   387 DLLEXPORT 
bool tz_has_dst(
const AbstractQoreZoneInfo* tz);
   392 #define QORE_OPT_ATOMIC_OPERATIONS       "atomic operations"   393 #define QORE_OPT_STACK_GUARD             "stack guard"   395 #define QORE_OPT_SIGNAL_HANDLING         "signal handling"   397 #define QORE_OPT_RUNTIME_STACK_TRACE     "runtime stack tracing"   399 #define QORE_OPT_LIBRARY_DEBUGGING       "library debugging"   401 #define QORE_OPT_SHA                     "openssl sha"   403 #define QORE_OPT_SHA224                  "openssl sha224"   405 #define QORE_OPT_SHA256                  "openssl sha256"   407 #define QORE_OPT_SHA384                  "openssl sha384"   409 #define QORE_OPT_SHA512                  "openssl sha512"   411 #define QORE_OPT_MDC2                    "openssl mdc2"   413 #define QORE_OPT_RC5                     "openssl rc5"   415 #define QORE_OPT_MD2                     "openssl md2"   417 #define QORE_OPT_DSS                     "openssl dss"   419 #define QORE_OPT_TERMIOS                 "termios"   421 #define QORE_OPT_FILE_LOCKING            "file locking"   423 #define QORE_OPT_UNIX_USERMGT            "unix user management"   425 #define QORE_OPT_UNIX_FILEMGT            "unix file management"   427 #define QORE_OPT_DETERMINISTIC_GC        "deterministic GC"   429 #define QORE_OPT_FUNC_ROUND              "round()"   431 #define QORE_OPT_FUNC_TIMEGM             "timegm()"   433 #define QORE_OPT_FUNC_SETEUID            "seteuid()"   435 #define QORE_OPT_FUNC_SETEGID            "setegid()"   437 #define QORE_OPT_FUNC_SYSTEM             "system()"   439 #define QORE_OPT_FUNC_KILL               "kill()"   441 #define QORE_OPT_FUNC_FORK               "fork()"   443 #define QORE_OPT_FUNC_GETPPID            "getppid()"   445 #define QORE_OPT_FUNC_STATVFS            "statvfs()"   447 #define QORE_OPT_FUNC_SETSID             "setsid()"   449 #define QORE_OPT_FUNC_IS_EXECUTABLE      "is_executable()"   451 #define QORE_OPT_FUNC_CLOSE_ALL_FD       "close_all_fd()"   453 #define QORE_OPT_FUNC_GET_NETIF_LIST     "get_netif_list()"   458 #define QO_ALGORITHM  1   459 #define QO_FUNCTION   2   535 #define QORE_MAX(a, b) ((a) > (b) ? (a) : (b))   538 #define QORE_MIN(a, b) ((a) < (b) ? (a) : (b))   541 #define QORE_PARAM_NO_ARG QoreSimpleValue().assign(nullptr)   544 #ifndef QORE_PATH_MAX   545 #ifdef _XOPEN_PATH_MAX   546 #define QORE_PATH_MAX _XOPEN_PATH_MAX   548 #define QORE_PATH_MAX 1024   603 DLLEXPORT 
void* 
q_memmem(
const void* big, 
size_t big_len, 
const void* little, 
size_t little_len);
   610 DLLEXPORT 
void* 
q_memrmem(
const void* big, 
size_t big_len, 
const void* little, 
size_t little_len);
   622 DLLEXPORT 
double q_strtod(
const char* str);
   707 #endif // _QORE_QORELIB_H DLLEXPORT const qore_option_s * qore_option_list
list of qore options 
 
DLLEXPORT int qore_release_signal(int sig, const char *name)
releases the signal allocated to the given module 
 
DLLEXPORT int64 q_epoch_us(int &us)
returns the seconds and microseconds from the epoch 
 
DLLEXPORT const AbstractQoreZoneInfo * find_create_timezone(const char *name, ExceptionSink *xsink)
returns a time zone for the given region name or UTC offset given as a string ("+01:00") ...
 
STL-like list containing all presently-loaded Qore features. 
Definition: QoreLib.h:229
 
int q_getcwd(QoreString &cwd)
returns the current working directory in the given string; -1 is returned if an error occurred...
 
defines string encoding functions in Qore 
Definition: QoreEncoding.h:83
 
DLLLOCAL qore_type_t getType() const
returns the data type 
Definition: AbstractQoreNode.h:172
 
DLLEXPORT BinaryNode * qore_deflate(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
compresses data with the DEFLATE algorithm 
 
DLLEXPORT int q_env_subst(QoreString &str)
performs environment variable substitution on the string argument 
 
This is the hash or associative list container type in Qore, dynamically allocated only...
Definition: QoreHashNode.h:50
 
DLLEXPORT bool q_absolute_path_unix(const char *path)
returns true if the given string is an absolute path on UNIX systems 
 
DLLEXPORT void qore_setup_argv(int pos, int argc, char *argv[])
sets up the Qore ARGV and QORE_ARGV values 
 
DLLEXPORT int q_get_data(const QoreValue &data, const char *&ptr, size_t &len)
returns the pointer and size for string or binary data (return 0); no change for other data (return -...
 
DLLEXPORT QoreValue qore_get_module_option(std::string mod, std::string opt)
get module option for the given module 
 
DLLEXPORT bool tz_has_dst(const AbstractQoreZoneInfo *tz)
returns true if the zone has daylight savings time ever 
 
DLLEXPORT void qore_exit_process(int rc)
instead of calling "exit()", call qore_exit_process() to exit without risking a crash if other thread...
 
DLLEXPORT char * make_class_name(const char *fn)
function to try and make a class name out of a file path, returns a new string that must be free()ed ...
 
DLLEXPORT int64 getSecZeroBigInt(QoreValue a)
for getting an integer number of seconds, with 0 as the default, from either a relative time value or...
 
DLLEXPORT const QoreClass * qore_pseudo_get_class(qore_type_t t)
returns the pseudo-class for the given type 
 
DLLEXPORT void qore_set_module_option(std::string mod, std::string opt, QoreValue val)
sets a module option for the given module 
 
The base class for all value and parse types in Qore expression trees. 
Definition: AbstractQoreNode.h:54
 
const qore_type_t NT_NOTHING
type value for QoreNothingNode 
Definition: node_types.h:42
 
DLLEXPORT QoreStringNode * qore_gunzip_to_string(const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
gunzips compressed data to a string 
 
DLLEXPORT QoreHashNode * q_getgrnam(const char *name)
thread-safe version of getgrnam(): returns a Qore hash of the group information from the group name i...
 
DLLEXPORT BinaryNode * qore_bunzip2_to_binary(const BinaryNode *bin, ExceptionSink *xsink)
decompresses bzip2 data to a binary 
 
static void discard(AbstractQoreNode *n, ExceptionSink *xsink)
to deref an AbstractQoreNode (when the pointer may be 0) 
Definition: QoreLib.h:326
 
bool value
the value of the option 
Definition: QoreLib.h:466
 
DLLEXPORT BinaryNode * parseBase64(const char *buf, int len, ExceptionSink *xsink)
parses a string of base64-encoded data and returns a BinaryNode 
 
DLLEXPORT const char * tz_get_region_name(const AbstractQoreZoneInfo *tz)
returns the reion name for the given time zone 
 
DLLEXPORT QoreStringNode * qore_bunzip2_to_string(const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
decompresses bzip2 data to a string 
 
DLLEXPORT int64 q_epoch_ns(int &us)
returns the seconds and nanoseconds from the epoch 
 
DLLEXPORT bool q_libqore_shutdown()
returns true if the Qore library has been shut down 
 
DLLEXPORT BinaryNode * qore_gzip(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
gzips data 
 
DLLLOCAL FeatureList()
initialized by the library, constructor not exported 
 
DLLEXPORT int q_realpath(const QoreString &path, QoreString &rv, ExceptionSink *xsink=0)
normalizes the given path and resolves any symlinks 
 
DLLEXPORT int q_set_thread_var_value(int frame, const char *name, const QoreValue &val, ExceptionSink *xsink)
sets the value of the given thread-local variable (which may be a closure-bound variable as well) in ...
 
DLLEXPORT int qore_release_signals(const sig_vec_t &sig_vec, const char *name)
releases multiple signals allocated to the given module atomically 
 
DLLEXPORT hashdecl tm * q_localtime(const time_t *clock, hashdecl tm *tms)
thread-safe version of "localtime()" 
 
DLLEXPORT void qore_disable_gc()
this function will cause garbage collection to be disabled 
 
DLLEXPORT const char * get_full_type_name(const AbstractQoreNode *n)
returns a string type description of the full type of the value contained (ex: "nothing" for a null A...
 
virtual DLLEXPORT const char * getTypeName() const =0
returns the type name as a c string 
 
Qore's string type supported by the QoreEncoding class. 
Definition: QoreString.h:81
 
Qore's string value type, reference counted, dynamically-allocated only. 
Definition: QoreStringNode.h:50
 
DLLEXPORT int64 getMsZeroBigInt(QoreValue a)
for getting an integer number of milliseconds, with 0 as the default, from either a relative time val...
 
const char * option
name of the option 
Definition: QoreLib.h:463
 
DLLEXPORT QoreStringNode * q_sprintf(const QoreListNode *params, int field, int offset, ExceptionSink *xsink)
a string formatting function that works with Qore data structures 
 
DLLEXPORT int qore_usleep(int64 usecs)
use this function instead of usleep(), as usleep() is not signal-safe on some platforms (ex: Solaris ...
 
std::vector< int > sig_vec_t
signal vector 
Definition: QoreLib.h:51
 
definition of the elements in the qore_option_list 
Definition: QoreLib.h:462
 
static bool is_nothing(const AbstractQoreNode *n)
to check if an AbstractQoreNode object is NOTHING 
Definition: QoreLib.h:318
 
DLLEXPORT hashdecl tm * q_gmtime(const time_t *clock, hashdecl tm *tms)
thread-safe version of "gmtime()" 
 
DLLEXPORT void * q_memrmem(const void *big, size_t big_len, const void *little, size_t little_len)
finds a memory sequence in a larger memory sequence searching from the end of the sequence ...
 
DLLEXPORT int64 getMicroSecZeroInt64(QoreValue a)
for getting an integer number of microseconds, with 0 as the default, from either a relative time val...
 
This is the list container type in Qore, dynamically allocated only, reference counted. 
Definition: QoreListNode.h:52
 
DLLEXPORT char * q_basename(const char *path)
thread-safe basename function (resulting pointer must be free()ed) 
 
DLLEXPORT QoreStringNode * qore_reassign_signals(const sig_vec_t &sig_vec, const char *name)
allows a module to take over ownership of multiple signals atomically 
 
DLLEXPORT QoreHashNode * q_get_thread_local_vars(int frame, ExceptionSink *xsink)
retrieves a hash of all thread local variables and their values for the given stack frame in the curr...
 
DLLEXPORT int getSecMinusOneInt(QoreValue a)
for getting an integer number of seconds, with -1 as the default, from either a relative time value o...
 
defines a Qore-language class 
Definition: QoreClass.h:237
 
DLLEXPORT QoreHashNode * q_getpwuid(uid_t uid)
thread-safe version of getpwuid(): returns a Qore hash of the passwd information from the uid if poss...
 
DLLEXPORT QoreStringNode * qore_reassign_signal(int sig, const char *name)
allows a module to take over ownership of a signal 
 
DLLEXPORT QoreHashNode * q_getgrgid(uid_t uid)
thread-safe version of getgrgid(): returns a Qore hash of the group information from the gid if possi...
 
DLLEXPORT char * q_dirname(const char *path)
thread-safe dirname function (resulting pointer must be free()ed) 
 
static char * strtoupper(char *str)
convert a string to upper-case in place 
Definition: QoreLib.h:278
 
The main value class in Qore, designed to be passed by value. 
Definition: QoreValue.h:262
 
DLLEXPORT QoreListNode * parse_option_bitfield_to_string_list(int64 i, ExceptionSink *xsink)
returns a list<string> of parse option strings for the given bitfield; a Qore-language exception is r...
 
qore_license_t
qore library and module license type identifiers 
Definition: common.h:85
 
DLLEXPORT QoreStringNode * q_vsprintf(const QoreListNode *params, int field, int offset, ExceptionSink *xsink)
a string formatting function that works with Qore data structures 
 
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreProgram.h:126
 
const char * constant
name of the constant for this option 
Definition: QoreLib.h:464
 
DLLEXPORT bool q_get_option_value(const char *opt)
returns the boolean value of qore library the given option name; false if the option is unknown ...
 
DLLEXPORT BinaryNode * qore_bzip2(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
compresses data with bzip2 
 
DLLEXPORT int getMsMinusOneInt(QoreValue a)
for getting an integer number of milliseconds, with -1 as the default, from either a relative time va...
 
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46
 
DLLEXPORT bool q_path_is_readable(const char *path)
platform-independent API that tells if the given path is readable by the current user ...
 
DLLEXPORT QoreStringNode * q_strerror(int errnum)
returns the error string as a QoreStringNode 
 
DLLEXPORT const char * q_mode_to_perm(mode_t mode, QoreString &perm)
concatenates UNIX-style permissions to perm and from mode and returns a string giving the file type ...
 
DLLEXPORT BinaryNode * qore_gunzip_to_binary(const BinaryNode *bin, ExceptionSink *xsink)
gunzips compressed data to a binary 
 
DLLEXPORT int64 getMsMinusOneBigInt(QoreValue a)
for getting an integer number of milliseconds, with -1 as the default, from either a relative time va...
 
static void strtolower(char *str)
convert a string to lower-case in place 
Definition: QoreLib.h:270
 
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false, otherwise does nothing 
 
long long int64
64bit integer type, cannot use int64_t here since it breaks the API on some 64-bit systems due to equ...
Definition: common.h:260
 
DLLEXPORT QoreProgram * qore_get_call_program_context()
returns the caller's Program context, if any 
 
DLLEXPORT qore_license_t qore_get_license()
returns the license type that the library has been initialized under 
 
DLLEXPORT int getMicroSecZeroInt(QoreValue a)
for getting an integer number of microseconds, with 0 as the default, from either a relative time val...
 
int q_uname2uid(const char *name, uid_t &uid)
thread-safe way to lookup a uid from a username 
 
DLLEXPORT void parse_set_time_zone(const char *zone)
to set the time zone from the command line 
 
int type
the type of the option 
Definition: QoreLib.h:465
 
DLLEXPORT QoreStringNode * qore_inflate_to_string(const BinaryNode *b, const QoreEncoding *enc, ExceptionSink *xsink)
decompresses data compressed with the DEFLATE algorithm to a string 
 
DLLEXPORT void * q_memmem(const void *big, size_t big_len, const void *little, size_t little_len)
finds a memory sequence in a larger memory sequence 
 
DLLEXPORT int64 getSecMinusOneBigInt(QoreValue a)
for getting an integer number of seconds, with -1 as the default, from either a relative time value o...
 
DLLEXPORT int getMsZeroInt(QoreValue a)
for getting an integer number of milliseconds, with 0 as the default, from either a relative time val...
 
static char * strnchr(const char *str, int len, char c)
find a character in a string up to len 
Definition: QoreLib.h:259
 
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:70
 
DLLEXPORT int64 q_epoch()
returns the seconds from the epoch 
 
DLLEXPORT bool q_absolute_path_windows(const char *path)
returns true if the given string is an absolute path on Windows systems 
 
int q_gname2gid(const char *name, gid_t &gid)
thread-safe way to lookup a gid from a group name 
 
DLLLOCAL ~FeatureList()
destructor not exported 
 
DLLEXPORT bool q_absolute_path(const char *path)
returns true if the given string is an absolute path on the current platform 
 
DLLEXPORT const AbstractQoreZoneInfo * findCreateOffsetZone(int seconds_east)
returns a time zone for the given time zone UTC offset 
 
DLLEXPORT double q_strtod(const char *str)
converts a string to a double in a locale-independent way 
 
DLLEXPORT void q_normalize_path(QoreString &path, const char *cwd=0)
normalizes the given path for the current platform in place (makes absolute, removes "...
 
DLLEXPORT bool qore_is_gc_enabled()
returns true if garbage collection is enabled, false if not 
 
DLLEXPORT char * q_basenameptr(const char *path)
returns a pointer within the same string 
 
DLLEXPORT bool q_get_option_constant_value(const char *opt)
returns the boolean value of qore library the given name of the constant for the option; false if the...
 
DLLEXPORT BinaryNode * parseHex(const char *buf, int len, ExceptionSink *xsink)
parses a string of hex characters and returns a BinaryNode 
 
DLLEXPORT QoreListNode * domain_bitfield_to_string_list(int64 i, ExceptionSink *xsink)
returns a list<string> of domain strings for the given bitfield; a Qore-language exception is raised ...
 
DLLEXPORT const QoreTypeInfo * get_or_nothing_type_check(const QoreTypeInfo *typeInfo)
returns the "or nothing" type for the given type 
 
DLLEXPORT void * q_realloc(void *ptr, size_t size)
frees memory if there is an allocation error 
 
DLLEXPORT QoreHashNode * q_getpwnam(const char *name)
thread-safe version of getpwnam(): returns a Qore hash of the passwd information from the username if...
 
static char * strchrs(const char *str, const char *chars)
find one of any characters in a string 
Definition: QoreLib.h:249
 
DLLEXPORT BinaryNode * qore_inflate_to_binary(const BinaryNode *b, ExceptionSink *xsink)
decompresses data compressed with the DEFLATE algorithm to a binary 
 
DLLEXPORT size_t qore_option_list_size
number of elements in the option list 
 
DLLEXPORT bool q_parse_bool(QoreValue n)
tries to parse a boolean value - standard conversion or uses q_parse_bool(const char*) if it's a stri...
 
DLLEXPORT FeatureList qoreFeatureList
list of qore features 
 
holds arbitrary binary data 
Definition: BinaryNode.h:41
 
DLLEXPORT int tz_get_utc_offset(const AbstractQoreZoneInfo *tz, int64 epoch_offset, bool &is_dst, const char *&zone_name)
returns the UTC offset and local time zone name for the given time given as seconds from the epoch (1...
 
DLLEXPORT int getSecZeroInt(QoreValue a)
for getting an integer number of seconds, with 0 as the default, from either a relative time value or...