Loading...
Searching...
No Matches
QoreLib.h
Go to the documentation of this file.
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreLib.h
Qore Programming Language
Copyright (C) 2003 - 2022 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the Qore library is released under a choice of three open-source
licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
information.
*/
#ifndef _QORE_QORELIB_H
#define _QORE_QORELIB_H
#include <qore/common.h>
#include <qore/QoreThreadLock.h>
#include <qore/qore_bitopts.h>
#include <qore/safe_dslist>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <strings.h>
#include <sys/types.h>
#include <vector>
typedef std::vector<int> sig_vec_t;
#undef _QORE_HAS_QORE_XMLNODE_CLASS
#undef _QORE_HAS_QORE_XMLREADER_CLASS
#undef _QORE_HAS_QORE_XMLDOC_CLASS
#define _QORE_HAS_HARD_TYPING 1
#define _QORE_HAS_DBI_EXECRAW 1
#define _QORE_HAS_TIME_ZONES 1
#define _QORE_HAS_THREAD_RESOURCE_IDS 1
#define _QORE_HAS_PREPARED_STATMENT_API 1
#define _QORE_HAS_DATASOURCE_ACTIVETRANSACTION 1
#define _QORE_HAS_DBI_SELECT_ROW 1
#define _QORE_HAS_NUMBER_TYPE 1
#define _QORE_HAS_PATH_IS_READABLE 1
#define _QORE_HAS_DBI_OPTIONS 1
#define _QORE_HAS_FIND_CREATE_TIMEZONE 1
#define _QORE_HAS_NUMBER_CONS_WITH_PREC 1
#define _QORE_HAS_FILE_OBJECT_HELPER 1
#define _QORE_HAS_QUEUE_OBJECT_HELPER 1
#define _QORE_HAS_QOREHTTPCLIENTOBJECT 1
#define _QORE_HAS_DBI_DESCRIBE 1
#define _QORE_HAS_DBI_EVENTS 1
#define _QORE_HAS_QUEUE_OBJECT 1
#define _QORE_HAS_SOCKET_PERF_API 1
#define _QORE_HAS_QL_MIT 1
#define _QORE_HAS_DATETIME_ADD_SECONDS_TO 1
// qore code flags
#define QCF_NO_FLAGS 0
#define QCF_NOOP (1 << 0)
#define QCF_USES_EXTRA_ARGS (1 << 1)
#define QCF_CONSTANT_INTERN (1 << 2)
#define QCF_DEPRECATED (1 << 3)
#define QCF_RET_VALUE_ONLY (1 << 4)
#define QCF_RUNTIME_NOOP (1 << 5)
#define QCF_ABSTRACT_OVERRIDE_ALL (1 << 6)
// composite flags
#define QCF_CONSTANT (QCF_CONSTANT_INTERN | QCF_RET_VALUE_ONLY)
class BinaryNode;
class QoreStringNode;
class ExceptionSink;
DLLEXPORT char* make_class_name(const char* fn);
DLLEXPORT QoreStringNode* q_sprintf(const QoreListNode* params, int field, int offset, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* q_vsprintf(const QoreListNode* params, int field, int offset, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* q_sprintf(const QoreListNode* params, int field, int offset, ExceptionSink* xsink);
DLLEXPORT struct tm* q_localtime(const time_t* clock, struct tm* tms);
DLLEXPORT struct tm* q_gmtime(const time_t* clock, struct tm* tms);
DLLEXPORT int64 q_epoch();
DLLEXPORT int64 q_epoch_us(int &us);
DLLEXPORT int64 q_epoch_ns(int &us);
DLLEXPORT char* q_basename(const char* path);
DLLEXPORT char* q_basenameptr(const char* path);
DLLEXPORT char* q_dirname(const char* path);
DLLEXPORT void* q_realloc(void* ptr, size_t size);
#ifndef _Q_WINDOWS
DLLEXPORT QoreHashNode* q_getpwuid(uid_t uid);
DLLEXPORT QoreHashNode* q_getpwnam(const char* name);
DLLEXPORT QoreHashNode* q_getgrgid(uid_t uid);
DLLEXPORT QoreHashNode* q_getgrnam(const char* name);
int q_uname2uid(const char* name, uid_t &uid);
int q_gname2gid(const char* name, gid_t &gid);
#endif // ! windows
DLLEXPORT void qore_setup_argv(int pos, int argc, char* argv[]);
DLLEXPORT qore_license_t qore_get_license();
DLLEXPORT void qore_exit_process(int rc);
class FeatureList : public safe_dslist<std::string> {
private:
DLLLOCAL FeatureList(const FeatureList&);
DLLLOCAL FeatureList& operator=(const FeatureList&);
public:
DLLLOCAL FeatureList();
DLLLOCAL ~FeatureList();
};
DLLEXPORT extern FeatureList qoreFeatureList;
static inline char* strchrs(const char* str, const char* chars) {
while (*str) {
if (strchr(chars, *str))
return (char* )str;
str++;
}
return 0;
}
static inline char* strnchr(const char* str, int len, char c) {
int i = 0;
while (i++ != len) {
if (*str == c)
return (char* )str;
++str;
}
return 0;
}
static inline void strtolower(char* str) {
while (*(str)) {
(*str) = tolower(*str);
str++;
}
}
static inline char* strtoupper(char* str) {
char* p = str;
while (*(p)) {
*p = toupper(*p);
p++;
}
return str;
}
DLLEXPORT int getSecZeroInt(QoreValue a);
DLLEXPORT int64 getSecZeroBigInt(QoreValue a);
DLLEXPORT int getSecMinusOneInt(QoreValue a);
DLLEXPORT int64 getSecMinusOneBigInt(QoreValue a);
DLLEXPORT int getMsZeroInt(QoreValue a);
DLLEXPORT int64 getMsZeroBigInt(QoreValue a);
DLLEXPORT int getMsMinusOneInt(QoreValue a);
DLLEXPORT int64 getMsMinusOneBigInt(QoreValue a);
DLLEXPORT int getMicroSecZeroInt(QoreValue a);
DLLEXPORT int64 getMicroSecZeroInt64(QoreValue a);
static inline bool is_nothing(const AbstractQoreNode* n) {
if (!n || n->getType() == NT_NOTHING)
return true;
return false;
}
static inline void discard(AbstractQoreNode* n, ExceptionSink* xsink) {
if (n)
n->deref(xsink);
}
static inline const char* get_type_name(const AbstractQoreNode* n) {
return n ? n->getTypeName() : "nothing";
}
DLLEXPORT const char* get_full_type_name(const AbstractQoreNode* n);
DLLEXPORT const char* get_full_type_name(const AbstractQoreNode* n, bool with_namespaces);
static inline qore_type_t get_node_type(const AbstractQoreNode* n) {
return n ? n->getType() : NT_NOTHING;
}
typedef QoreStringNode* (*qore_uncompress_to_string_t)(const BinaryNode* b, const QoreEncoding* enc,
ExceptionSink* xsink);
typedef BinaryNode* (*qore_uncompress_to_binary_t)(const BinaryNode* b, ExceptionSink* xsink);
DLLEXPORT BinaryNode* qore_deflate(void* ptr, unsigned long len, int level, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* qore_inflate_to_string(const BinaryNode* b, const QoreEncoding* enc, ExceptionSink* xsink);
DLLEXPORT BinaryNode* qore_inflate_to_binary(const BinaryNode* b, ExceptionSink* xsink);
DLLEXPORT BinaryNode* qore_gzip(void* ptr, unsigned long len, int level, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* qore_gunzip_to_string(const BinaryNode* bin, const QoreEncoding* enc, ExceptionSink* xsink);
DLLEXPORT BinaryNode* qore_gunzip_to_binary(const BinaryNode* bin, ExceptionSink* xsink);
DLLEXPORT BinaryNode* qore_bzip2(void* ptr, unsigned long len, int level, ExceptionSink* xsink);
DLLEXPORT QoreStringNode* qore_bunzip2_to_string(const BinaryNode* bin, const QoreEncoding* enc,
ExceptionSink* xsink);
DLLEXPORT BinaryNode* qore_bunzip2_to_binary(const BinaryNode* bin, ExceptionSink* xsink);
DLLEXPORT BinaryNode* parseBase64(const char* buf, int len, ExceptionSink* xsink);
DLLEXPORT BinaryNode* parseHex(const char* buf, int len, ExceptionSink* xsink);
class AbstractQoreZoneInfo;
DLLEXPORT const AbstractQoreZoneInfo* findCreateOffsetZone(int seconds_east);
DLLEXPORT const AbstractQoreZoneInfo* find_create_timezone(const char* name, ExceptionSink* xsink);
DLLEXPORT int tz_get_utc_offset(const AbstractQoreZoneInfo* tz, int64 epoch_offset, bool &is_dst, const char* &zone_name);
DLLEXPORT bool tz_has_dst(const AbstractQoreZoneInfo* tz);
DLLEXPORT const char* tz_get_region_name(const AbstractQoreZoneInfo* tz);
#define QORE_OPT_ATOMIC_OPERATIONS "atomic operations"
#define QORE_OPT_STACK_GUARD "stack guard"
#define QORE_OPT_SIGNAL_HANDLING "signal handling"
#define QORE_OPT_RUNTIME_STACK_TRACE "runtime stack tracing"
#define QORE_OPT_LIBRARY_DEBUGGING "library debugging"
#define QORE_OPT_SHA "openssl sha"
#define QORE_OPT_SHA224 "openssl sha224"
#define QORE_OPT_SHA256 "openssl sha256"
#define QORE_OPT_SHA384 "openssl sha384"
#define QORE_OPT_SHA512 "openssl sha512"
#define QORE_OPT_MDC2 "openssl mdc2"
#define QORE_OPT_RC5 "openssl rc5"
#define QORE_OPT_MD2 "openssl md2"
#define QORE_OPT_DSS "openssl dss"
#define QORE_OPT_TERMIOS "termios"
#define QORE_OPT_FILE_LOCKING "file locking"
#define QORE_OPT_UNIX_USERMGT "unix user management"
#define QORE_OPT_UNIX_FILEMGT "unix file management"
#define QORE_OPT_DETERMINISTIC_GC "deterministic GC"
#define QORE_OPT_FUNC_ROUND "round()"
#define QORE_OPT_FUNC_TIMEGM "timegm()"
#define QORE_OPT_FUNC_SETEUID "seteuid()"
#define QORE_OPT_FUNC_SETEGID "setegid()"
#define QORE_OPT_FUNC_SYSTEM "system()"
#define QORE_OPT_FUNC_KILL "kill()"
#define QORE_OPT_FUNC_FORK "fork()"
#define QORE_OPT_FUNC_GETPPID "getppid()"
#define QORE_OPT_FUNC_STATVFS "statvfs()"
#define QORE_OPT_FUNC_SETSID "setsid()"
#define QORE_OPT_FUNC_IS_EXECUTABLE "is_executable()"
#define QORE_OPT_FUNC_CLOSE_ALL_FD "close_all_fd()"
#define QORE_OPT_FUNC_GET_NETIF_LIST "get_netif_list()"
#define QO_OPTION 0
#define QO_ALGORITHM 1
#define QO_FUNCTION 2
struct qore_option_s {
const char* option;
const char* constant;
int type;
bool value;
};
DLLEXPORT QoreStringNode* q_strerror(int errnum);
DLLEXPORT void q_strerror(QoreString &str, int errnum);
DLLEXPORT extern const qore_option_s* qore_option_list;
DLLEXPORT extern size_t qore_option_list_size;
DLLEXPORT QoreStringNode* qore_reassign_signal(int sig, const char* name);
DLLEXPORT QoreStringNode* qore_reassign_signals(const sig_vec_t& sig_vec, const char* name);
DLLEXPORT int qore_release_signal(int sig, const char* name);
DLLEXPORT int qore_release_signals(const sig_vec_t& sig_vec, const char* name);
#define QORE_MAX(a, b) ((a) > (b) ? (a) : (b))
#define QORE_MIN(a, b) ((a) < (b) ? (a) : (b))
#define QORE_PARAM_NO_ARG QoreSimpleValue().assign(nullptr)
// define QORE_PATH_MAX
#ifndef QORE_PATH_MAX
#ifdef _XOPEN_PATH_MAX
#define QORE_PATH_MAX _XOPEN_PATH_MAX
#else
#define QORE_PATH_MAX 1024
#endif
#endif
DLLEXPORT void parse_set_time_zone(const char* zone);
DLLEXPORT int qore_usleep(int64 usecs);
DLLEXPORT void qore_disable_gc();
DLLEXPORT bool qore_is_gc_enabled();
DLLEXPORT bool q_path_is_readable(const char* path);
DLLEXPORT bool q_parse_bool(QoreValue n);
DLLEXPORT bool q_parse_bool(const char* str);
DLLEXPORT bool q_get_option_value(const char* opt);
DLLEXPORT bool q_get_option_constant_value(const char* opt);
DLLEXPORT const char* q_mode_to_perm(mode_t mode, QoreString& perm);
int q_getcwd(QoreString& cwd);
DLLEXPORT bool q_absolute_path_unix(const char* path);
DLLEXPORT bool q_absolute_path_windows(const char* path);
DLLEXPORT bool q_absolute_path(const char* path);
DLLEXPORT void q_normalize_path(QoreString& path, const char* cwd = 0);
DLLEXPORT int q_realpath(const QoreString& path, QoreString& rv, ExceptionSink* xsink = 0);
DLLEXPORT void* q_memmem(const void* big, size_t big_len, const void* little, size_t little_len);
DLLEXPORT void* q_memrmem(const void* big, size_t big_len, const void* little, size_t little_len);
DLLEXPORT int q_env_subst(QoreString& str);
DLLEXPORT double q_strtod(const char* str);
DLLEXPORT bool q_libqore_initalized();
DLLEXPORT bool q_libqore_shutdown();
DLLEXPORT bool q_libqore_exiting();
DLLEXPORT QoreHashNode* q_get_thread_local_vars(int frame, ExceptionSink* xsink);
DLLEXPORT int q_set_thread_var_value(int frame, const char* name, const QoreValue& val, ExceptionSink* xsink);
DLLEXPORT int q_get_data(const QoreValue& data, const char*& ptr, size_t& len);
DLLEXPORT QoreListNode* parse_option_bitfield_to_string_list(int64 i, ExceptionSink* xsink);
DLLEXPORT QoreListNode* domain_bitfield_to_string_list(int64 i, ExceptionSink* xsink);
DLLEXPORT const QoreTypeInfo* get_or_nothing_type_check(const QoreTypeInfo* typeInfo);
DLLEXPORT const QoreClass* qore_pseudo_get_class(qore_type_t t);
DLLEXPORT const QoreClass* qore_pseudo_get_class(const QoreTypeInfo* t);
DLLEXPORT QoreProgram* qore_get_call_program_context();
DLLEXPORT void qore_set_module_option(std::string mod, std::string opt, QoreValue val);
DLLEXPORT QoreValue qore_get_module_option(std::string mod, std::string opt);
// try to remove noise in insignificant digits from a number string
DLLEXPORT void qore_apply_rounding_heuristic(QoreString& str, int round_threshold_1, int round_threshold_2);
DLLEXPORT size_t q_thread_get_stack_size();
DLLEXPORT size_t q_thread_get_this_stack_size();
DLLEXPORT size_t q_thread_set_stack_size(size_t size, ExceptionSink* xsink);
DLLEXPORT size_t q_thread_stack_remaining();
DLLEXPORT size_t q_thread_stack_used();
#endif // _QORE_QORELIB_H
qore_inflate_to_binary
DLLEXPORT BinaryNode * qore_inflate_to_binary(const BinaryNode *b, ExceptionSink *xsink)
decompresses data compressed with the DEFLATE algorithm to a binary
qore_reassign_signal
DLLEXPORT QoreStringNode * qore_reassign_signal(int sig, const char *name)
allows a module to take over ownership of a signal
qore_get_license
DLLEXPORT qore_license_t qore_get_license()
returns the license type that the library has been initialized under
parse_option_bitfield_to_string_list
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...
q_sprintf
DLLEXPORT QoreStringNode * q_sprintf(const QoreListNode *params, int field, int offset, ExceptionSink *xsink)
a string formatting function that works with Qore data structures
strchrs
static char * strchrs(const char *str, const char *chars)
find one of any characters in a string
Definition: QoreLib.h:247
q_get_option_value
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
q_epoch
DLLEXPORT int64 q_epoch()
returns the seconds from the epoch
q_get_thread_local_vars
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...
find_create_timezone
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")
q_libqore_exiting
DLLEXPORT bool q_libqore_exiting()
returns true if the Qore library is exiting without a shutdown
getMicroSecZeroInt64
DLLEXPORT int64 getMicroSecZeroInt64(QoreValue a)
for getting an integer number of microseconds, with 0 as the default, from either a relative time val...
q_path_is_readable
DLLEXPORT bool q_path_is_readable(const char *path)
platform-independent API that tells if the given path is readable by the current user
q_absolute_path_unix
DLLEXPORT bool q_absolute_path_unix(const char *path)
returns true if the given string is an absolute path on UNIX systems
getSecZeroBigInt
DLLEXPORT int64 getSecZeroBigInt(QoreValue a)
for getting an integer number of seconds, with 0 as the default, from either a relative time value or...
q_epoch_us
DLLEXPORT int64 q_epoch_us(int &us)
returns the seconds and microseconds from the epoch
q_absolute_path_windows
DLLEXPORT bool q_absolute_path_windows(const char *path)
returns true if the given string is an absolute path on Windows systems
parse_set_time_zone
DLLEXPORT void parse_set_time_zone(const char *zone)
to set the time zone from the command line
qore_gunzip_to_string
DLLEXPORT QoreStringNode * qore_gunzip_to_string(const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
gunzips compressed data to a string
q_getcwd
int q_getcwd(QoreString &cwd)
returns the current working directory in the given string; -1 is returned if an error occurred,...
q_gmtime
DLLEXPORT struct tm * q_gmtime(const time_t *clock, struct tm *tms)
thread-safe version of "gmtime()"
q_realpath
DLLEXPORT int q_realpath(const QoreString &path, QoreString &rv, ExceptionSink *xsink=0)
normalizes the given path and resolves any symlinks
getMicroSecZeroInt
DLLEXPORT int getMicroSecZeroInt(QoreValue a)
for getting an integer number of microseconds, with 0 as the default, from either a relative time val...
q_strtod
DLLEXPORT double q_strtod(const char *str)
converts a string to a double in a locale-independent way
tz_get_utc_offset
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...
q_thread_get_this_stack_size
DLLEXPORT size_t q_thread_get_this_stack_size()
returns the thread stack size for the current thread
q_memrmem
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
get_full_type_name
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...
qore_release_signal
DLLEXPORT int qore_release_signal(int sig, const char *name)
releases the signal allocated to the given module
qore_get_module_option
DLLEXPORT QoreValue qore_get_module_option(std::string mod, std::string opt)
get module option for the given module
qore_usleep
DLLEXPORT int qore_usleep(int64 usecs)
use this function instead of usleep(), as usleep() is not signal-safe on some platforms (ex: Solaris ...
qore_exit_process
DLLEXPORT void qore_exit_process(int rc)
instead of calling "exit()", call qore_exit_process() to exit without risking a crash if other thread...
q_memmem
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
q_gname2gid
int q_gname2gid(const char *name, gid_t &gid)
thread-safe way to lookup a gid from a group name
getMsZeroBigInt
DLLEXPORT int64 getMsZeroBigInt(QoreValue a)
for getting an integer number of milliseconds, with 0 as the default, from either a relative time val...
qore_pseudo_get_class
DLLEXPORT const QoreClass * qore_pseudo_get_class(qore_type_t t)
returns the pseudo-class for the given type
qore_set_module_option
DLLEXPORT void qore_set_module_option(std::string mod, std::string opt, QoreValue val)
sets a module option for the given module
findCreateOffsetZone
DLLEXPORT const AbstractQoreZoneInfo * findCreateOffsetZone(int seconds_east)
returns a time zone for the given time zone UTC offset
q_thread_stack_used
DLLEXPORT size_t q_thread_stack_used()
Returns the number of bytes used in the current thread stack.
q_mode_to_perm
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
qore_release_signals
DLLEXPORT int qore_release_signals(const sig_vec_t &sig_vec, const char *name)
releases multiple signals allocated to the given module atomically
getMsMinusOneBigInt
DLLEXPORT int64 getMsMinusOneBigInt(QoreValue a)
for getting an integer number of milliseconds, with -1 as the default, from either a relative time va...
q_get_data
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 -...
qore_setup_argv
DLLEXPORT void qore_setup_argv(int pos, int argc, char *argv[])
sets up the Qore ARGV and QORE_ARGV values
qore_option_list
DLLEXPORT const qore_option_s * qore_option_list
list of qore options
q_epoch_ns
DLLEXPORT int64 q_epoch_ns(int &us)
returns the seconds and nanoseconds from the epoch
qore_bzip2
DLLEXPORT BinaryNode * qore_bzip2(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
compresses data with bzip2
q_getgrnam
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...
qore_get_call_program_context
DLLEXPORT QoreProgram * qore_get_call_program_context()
returns the caller's Program context, if any
tz_get_region_name
DLLEXPORT const char * tz_get_region_name(const AbstractQoreZoneInfo *tz)
returns the reion name for the given time zone
getMsMinusOneInt
DLLEXPORT int getMsMinusOneInt(QoreValue a)
for getting an integer number of milliseconds, with -1 as the default, from either a relative time va...
q_dirname
DLLEXPORT char * q_dirname(const char *path)
thread-safe dirname function (resulting pointer must be free()ed)
q_strerror
DLLEXPORT QoreStringNode * q_strerror(int errnum)
returns the error string as a QoreStringNode
q_env_subst
DLLEXPORT int q_env_subst(QoreString &str)
performs environment variable substitution on the string argument
qoreFeatureList
DLLEXPORT FeatureList qoreFeatureList
list of qore features
q_libqore_initalized
DLLEXPORT bool q_libqore_initalized()
returns true if the Qore library has been initialized
q_libqore_shutdown
DLLEXPORT bool q_libqore_shutdown()
returns true if the Qore library has been shut down
q_basenameptr
DLLEXPORT char * q_basenameptr(const char *path)
returns a pointer within the same string
qore_inflate_to_string
DLLEXPORT QoreStringNode * qore_inflate_to_string(const BinaryNode *b, const QoreEncoding *enc, ExceptionSink *xsink)
decompresses data compressed with the DEFLATE algorithm to a string
getSecMinusOneBigInt
DLLEXPORT int64 getSecMinusOneBigInt(QoreValue a)
for getting an integer number of seconds, with -1 as the default, from either a relative time value o...
domain_bitfield_to_string_list
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 ...
sig_vec_t
std::vector< int > sig_vec_t
signal vector
Definition: QoreLib.h:51
strnchr
static char * strnchr(const char *str, int len, char c)
find a character in a string up to len
Definition: QoreLib.h:257
getSecMinusOneInt
DLLEXPORT int getSecMinusOneInt(QoreValue a)
for getting an integer number of seconds, with -1 as the default, from either a relative time value o...
strtoupper
static char * strtoupper(char *str)
convert a string to upper-case in place
Definition: QoreLib.h:276
q_getgrgid
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...
q_getpwnam
DLLEXPORT QoreHashNode * q_getpwnam(const char *name)
thread-safe version of getpwnam(): returns a Qore hash of the passwd information from the username if...
qore_apply_rounding_heuristic
DLLEXPORT void qore_apply_rounding_heuristic(QoreString &str, int round_threshold_1, int round_threshold_2)
q_parse_bool
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...
get_or_nothing_type_check
DLLEXPORT const QoreTypeInfo * get_or_nothing_type_check(const QoreTypeInfo *typeInfo)
returns the "or nothing" type for the given type
q_getpwuid
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...
qore_option_list_size
DLLEXPORT size_t qore_option_list_size
number of elements in the option list
q_thread_get_stack_size
DLLEXPORT size_t q_thread_get_stack_size()
returns the default thread stack size
q_thread_stack_remaining
DLLEXPORT size_t q_thread_stack_remaining()
Returns the number of bytes left in the current thread stack.
q_get_option_constant_value
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...
qore_gunzip_to_binary
DLLEXPORT BinaryNode * qore_gunzip_to_binary(const BinaryNode *bin, ExceptionSink *xsink)
gunzips compressed data to a binary
discard
static void discard(AbstractQoreNode *n, ExceptionSink *xsink)
to deref an AbstractQoreNode (when the pointer may be 0)
Definition: QoreLib.h:324
qore_is_gc_enabled
DLLEXPORT bool qore_is_gc_enabled()
returns true if garbage collection is enabled, false if not
q_basename
DLLEXPORT char * q_basename(const char *path)
thread-safe basename function (resulting pointer must be free()ed)
q_absolute_path
DLLEXPORT bool q_absolute_path(const char *path)
returns true if the given string is an absolute path on the current platform
qore_reassign_signals
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
parseBase64
DLLEXPORT BinaryNode * parseBase64(const char *buf, int len, ExceptionSink *xsink)
parses a string of base64-encoded data and returns a BinaryNode
qore_gzip
DLLEXPORT BinaryNode * qore_gzip(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
gzips data
qore_disable_gc
DLLEXPORT void qore_disable_gc()
this function will cause garbage collection to be disabled
qore_deflate
DLLEXPORT BinaryNode * qore_deflate(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
compresses data with the DEFLATE algorithm
q_uname2uid
int q_uname2uid(const char *name, uid_t &uid)
thread-safe way to lookup a uid from a username
getSecZeroInt
DLLEXPORT int getSecZeroInt(QoreValue a)
for getting an integer number of seconds, with 0 as the default, from either a relative time value or...
getMsZeroInt
DLLEXPORT int getMsZeroInt(QoreValue a)
for getting an integer number of milliseconds, with 0 as the default, from either a relative time val...
qore_bunzip2_to_binary
DLLEXPORT BinaryNode * qore_bunzip2_to_binary(const BinaryNode *bin, ExceptionSink *xsink)
decompresses bzip2 data to a binary
q_normalize_path
DLLEXPORT void q_normalize_path(QoreString &path, const char *cwd=0)
normalizes the given path for the current platform in place (makes absolute, removes "....
q_thread_set_stack_size
DLLEXPORT size_t q_thread_set_stack_size(size_t size, ExceptionSink *xsink)
sets the default thread stack size or throws an exception on error
is_nothing
static bool is_nothing(const AbstractQoreNode *n)
to check if an AbstractQoreNode object is NOTHING
Definition: QoreLib.h:316
qore_bunzip2_to_string
DLLEXPORT QoreStringNode * qore_bunzip2_to_string(const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
decompresses bzip2 data to a string
q_realloc
DLLEXPORT void * q_realloc(void *ptr, size_t size)
frees memory if there is an allocation error
make_class_name
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
strtolower
static void strtolower(char *str)
convert a string to lower-case in place
Definition: QoreLib.h:268
q_vsprintf
DLLEXPORT QoreStringNode * q_vsprintf(const QoreListNode *params, int field, int offset, ExceptionSink *xsink)
a string formatting function that works with Qore data structures
q_localtime
DLLEXPORT struct tm * q_localtime(const time_t *clock, struct tm *tms)
thread-safe version of "localtime()"
tz_has_dst
DLLEXPORT bool tz_has_dst(const AbstractQoreZoneInfo *tz)
returns true if the zone has daylight savings time ever
parseHex
DLLEXPORT BinaryNode * parseHex(const char *buf, int len, ExceptionSink *xsink)
parses a string of hex characters and returns a BinaryNode
q_set_thread_var_value
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 ...
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
AbstractQoreNode::getType
DLLLOCAL qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:175
AbstractQoreNode::deref
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false,...
AbstractQoreNode::getTypeName
virtual DLLEXPORT const char * getTypeName() const =0
returns the type name as a c string
BinaryNode
holds arbitrary binary data
Definition: BinaryNode.h:41
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
FeatureList
STL-like list containing all presently-loaded Qore features.
Definition: QoreLib.h:227
FeatureList::FeatureList
DLLLOCAL FeatureList()
initialized by the library, constructor not exported
FeatureList::~FeatureList
DLLLOCAL ~FeatureList()
destructor not exported
QoreClass
defines a Qore-language class
Definition: QoreClass.h:249
QoreEncoding
defines string encoding functions in Qore
Definition: QoreEncoding.h:83
QoreHashNode
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
QoreListNode
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
QoreProgram
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreProgram.h:127
QoreString
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
QoreStringNode
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
common.h
qore_type_t
int16_t qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode)
Definition: common.h:70
qore_license_t
qore_license_t
qore library and module license type identifiers
Definition: common.h:85
int64
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
NT_NOTHING
const qore_type_t NT_NOTHING
type value for QoreNothingNode
Definition: node_types.h:42
QoreValue
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276
qore_option_s
definition of the elements in the qore_option_list
Definition: QoreLib.h:474
qore_option_s::constant
const char * constant
name of the constant for this option
Definition: QoreLib.h:476
qore_option_s::value
bool value
the value of the option
Definition: QoreLib.h:478
qore_option_s::option
const char * option
name of the option
Definition: QoreLib.h:475
qore_option_s::type
int type
the type of the option
Definition: QoreLib.h:477