Qore Programming Language 1.19.2
Loading...
Searching...
No Matches
QoreLib.h
Go to the documentation of this file.
1/* -*- mode: c++; indent-tabs-mode: nil -*- */
2/*
3 QoreLib.h
4
5 Qore Programming Language
6
7 Copyright (C) 2003 - 2023 Qore Technologies, s.r.o.
8
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the "Software"),
11 to deal in the Software without restriction, including without limitation
12 the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so, subject to the following conditions:
15
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26
27 Note that the Qore library is released under a choice of three open-source
28 licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
29 information.
30*/
31
32#ifndef _QORE_QORELIB_H
33
34#define _QORE_QORELIB_H
35
36#include <qore/common.h>
37#include <qore/QoreThreadLock.h>
38#include <qore/qore_bitopts.h>
39#include <qore/safe_dslist>
40
41#include <cctype>
42#include <cstdio>
43#include <cstdlib>
44#include <cstring>
45#include <ctime>
46#include <strings.h>
47#include <sys/types.h>
48#include <vector>
49
51typedef std::vector<int> sig_vec_t;
52
58#undef _QORE_HAS_QORE_XMLNODE_CLASS
59
61#undef _QORE_HAS_QORE_XMLREADER_CLASS
62
64#undef _QORE_HAS_QORE_XMLDOC_CLASS
65
67#define _QORE_HAS_HARD_TYPING 1
68
70#define _QORE_HAS_DBI_EXECRAW 1
71
73#define _QORE_HAS_TIME_ZONES 1
74
76#define _QORE_HAS_THREAD_RESOURCE_IDS 1
77
79#define _QORE_HAS_PREPARED_STATMENT_API 1
80
82#define _QORE_HAS_DATASOURCE_ACTIVETRANSACTION 1
83
85#define _QORE_HAS_DBI_SELECT_ROW 1
86
88#define _QORE_HAS_NUMBER_TYPE 1
89
91#define _QORE_HAS_PATH_IS_READABLE 1
92
94#define _QORE_HAS_DBI_OPTIONS 1
95
97#define _QORE_HAS_FIND_CREATE_TIMEZONE 1
98
100#define _QORE_HAS_NUMBER_CONS_WITH_PREC 1
101
103#define _QORE_HAS_FILE_OBJECT_HELPER 1
104
106#define _QORE_HAS_QUEUE_OBJECT_HELPER 1
107
109#define _QORE_HAS_QOREHTTPCLIENTOBJECT 1
110
112#define _QORE_HAS_DBI_DESCRIBE 1
113
115#define _QORE_HAS_DBI_EVENTS 1
116
118#define _QORE_HAS_QUEUE_OBJECT 1
119
121#define _QORE_HAS_SOCKET_PERF_API 1
122
124#define _QORE_HAS_QL_MIT 1
125
127#define _QORE_HAS_DATETIME_ADD_SECONDS_TO 1
128
130#define _QORE_HAS_ENFORCE_THREAD_SIZE_ON_PRIMARY_THREAD 1
131
132// qore code flags
133#define QCF_NO_FLAGS 0
134#define QCF_NOOP (1 << 0)
135#define QCF_USES_EXTRA_ARGS (1 << 1)
136#define QCF_CONSTANT_INTERN (1 << 2)
137#define QCF_DEPRECATED (1 << 3)
138#define QCF_RET_VALUE_ONLY (1 << 4)
139#define QCF_RUNTIME_NOOP (1 << 5)
140#define QCF_ABSTRACT_OVERRIDE_ALL (1 << 6)
141
142// composite flags
143#define QCF_CONSTANT (QCF_CONSTANT_INTERN | QCF_RET_VALUE_ONLY)
144
145class BinaryNode;
146class QoreStringNode;
147class ExceptionSink;
148
150DLLEXPORT char* make_class_name(const char* fn);
151
153DLLEXPORT QoreStringNode* q_sprintf(const QoreListNode* params, int field, int offset, ExceptionSink* xsink);
154
156DLLEXPORT QoreStringNode* q_vsprintf(const QoreListNode* params, int field, int offset, ExceptionSink* xsink);
157
159DLLEXPORT QoreStringNode* q_sprintf(const QoreListNode* params, int field, int offset, ExceptionSink* xsink);
160
162DLLEXPORT hashdecl tm* q_localtime(const time_t* clock, struct tm* tms);
163
165DLLEXPORT hashdecl tm* q_gmtime(const time_t* clock, struct tm* tms);
166
168DLLEXPORT int64 q_epoch();
169
171DLLEXPORT int64 q_epoch_us(int &us);
172
174DLLEXPORT int64 q_epoch_ns(int &us);
175
177DLLEXPORT char* q_basename(const char* path);
178
180DLLEXPORT char* q_basenameptr(const char* path);
181
183DLLEXPORT char* q_dirname(const char* path);
184
186DLLEXPORT void* q_realloc(void* ptr, size_t size);
187
188#ifndef _Q_WINDOWS
190DLLEXPORT QoreHashNode* q_getpwuid(uid_t uid);
191
193DLLEXPORT QoreHashNode* q_getpwnam(const char* name);
194
196DLLEXPORT QoreHashNode* q_getgrgid(uid_t uid);
197
199DLLEXPORT QoreHashNode* q_getgrnam(const char* name);
200
202
207int q_uname2uid(const char* name, uid_t &uid);
208
210
215int q_gname2gid(const char* name, gid_t &gid);
216#endif // ! windows
217
219DLLEXPORT void qore_setup_argv(int pos, int argc, char* argv[]);
220
223
225DLLEXPORT void qore_exit_process(int rc);
226
228
230class FeatureList : public safe_dslist<std::string> {
231private:
233 DLLLOCAL FeatureList(const FeatureList&);
234
236 DLLLOCAL FeatureList& operator=(const FeatureList&);
237
238public:
240 DLLLOCAL FeatureList();
241
243 DLLLOCAL ~FeatureList();
244};
245
247DLLEXPORT extern FeatureList qoreFeatureList;
248
250static inline char* strchrs(const char* str, const char* chars) {
251 while (*str) {
252 if (strchr(chars, *str))
253 return (char* )str;
254 str++;
255 }
256 return 0;
257}
258
260static inline char* strnchr(const char* str, int len, char c) {
261 int i = 0;
262 while (i++ != len) {
263 if (*str == c)
264 return (char* )str;
265 ++str;
266 }
267 return 0;
268}
269
271static inline void strtolower(char* str) {
272 while (*(str)) {
273 (*str) = tolower(*str);
274 str++;
275 }
276}
277
279static inline char* strtoupper(char* str) {
280 char* p = str;
281 while (*(p)) {
282 *p = toupper(*p);
283 p++;
284 }
285 return str;
286}
287
289DLLEXPORT int getSecZeroInt(QoreValue a);
290
293
296
299
301DLLEXPORT int getMsZeroInt(QoreValue a);
302
305
308
311
314
317
319static inline bool is_nothing(const AbstractQoreNode* n) {
320 if (!n || n->getType() == NT_NOTHING)
321 return true;
322
323 return false;
324}
325
327static inline void discard(AbstractQoreNode* n, ExceptionSink* xsink) {
328 if (n)
329 n->deref(xsink);
330}
331
332static inline const char* get_type_name(const AbstractQoreNode* n) {
333 return n ? n->getTypeName() : "nothing";
334}
335
337
343DLLEXPORT const char* get_full_type_name(const AbstractQoreNode* n);
344
346
354DLLEXPORT const char* get_full_type_name(const AbstractQoreNode* n, bool with_namespaces);
355
357
365DLLEXPORT const char* get_full_type_name(const AbstractQoreNode* n, bool with_namespaces, QoreString& scratch);
366
367static inline qore_type_t get_node_type(const AbstractQoreNode* n) {
368 return n ? n->getType() : NT_NOTHING;
369}
370
371typedef QoreStringNode* (*qore_uncompress_to_string_t)(const BinaryNode* b, const QoreEncoding* enc,
372 ExceptionSink* xsink);
373typedef BinaryNode* (*qore_uncompress_to_binary_t)(const BinaryNode* b, ExceptionSink* xsink);
374
376DLLEXPORT BinaryNode* qore_deflate(void* ptr, unsigned long len, int level, ExceptionSink* xsink);
382DLLEXPORT BinaryNode* qore_gzip(void* ptr, unsigned long len, int level, ExceptionSink* xsink);
388DLLEXPORT BinaryNode* qore_bzip2(void* ptr, unsigned long len, int level, ExceptionSink* xsink);
391 ExceptionSink* xsink);
394
396DLLEXPORT BinaryNode* parseBase64(const char* buf, int len, ExceptionSink* xsink);
397
399DLLEXPORT BinaryNode* parseBase64Url(const char* buf, int len, ExceptionSink* xsink);
400
402DLLEXPORT BinaryNode* parseHex(const char* buf, int len, ExceptionSink* xsink);
403
404class AbstractQoreZoneInfo;
405
407DLLEXPORT const AbstractQoreZoneInfo* findCreateOffsetZone(int seconds_east);
408
410
415DLLEXPORT const AbstractQoreZoneInfo* find_create_timezone(const char* name, ExceptionSink* xsink);
416
418DLLEXPORT int tz_get_utc_offset(const AbstractQoreZoneInfo* tz, int64 epoch_offset, bool &is_dst, const char* &zone_name);
420DLLEXPORT bool tz_has_dst(const AbstractQoreZoneInfo* tz);
422DLLEXPORT const char* tz_get_region_name(const AbstractQoreZoneInfo* tz);
423
425#define QORE_OPT_ATOMIC_OPERATIONS "atomic operations"
427#define QORE_OPT_STACK_GUARD "stack guard"
429#define QORE_OPT_SIGNAL_HANDLING "signal handling"
431#define QORE_OPT_RUNTIME_STACK_TRACE "runtime stack tracing"
433#define QORE_OPT_LIBRARY_DEBUGGING "library debugging"
435#define QORE_OPT_SHA "openssl sha"
437#define QORE_OPT_SHA224 "openssl sha224"
439#define QORE_OPT_SHA256 "openssl sha256"
441#define QORE_OPT_SHA384 "openssl sha384"
443#define QORE_OPT_SHA512 "openssl sha512"
445#define QORE_OPT_MDC2 "openssl mdc2"
447#define QORE_OPT_RC5 "openssl rc5"
449#define QORE_OPT_MD2 "openssl md2"
451#define QORE_OPT_DSS "openssl dss"
453#define QORE_OPT_TERMIOS "termios"
455#define QORE_OPT_FILE_LOCKING "file locking"
457#define QORE_OPT_UNIX_USERMGT "unix user management"
459#define QORE_OPT_UNIX_FILEMGT "unix file management"
461#define QORE_OPT_DETERMINISTIC_GC "deterministic GC"
463#define QORE_OPT_FUNC_ROUND "round()"
465#define QORE_OPT_FUNC_TIMEGM "timegm()"
467#define QORE_OPT_FUNC_SETEUID "seteuid()"
469#define QORE_OPT_FUNC_SETEGID "setegid()"
471#define QORE_OPT_FUNC_SYSTEM "system()"
473#define QORE_OPT_FUNC_KILL "kill()"
475#define QORE_OPT_FUNC_FORK "fork()"
477#define QORE_OPT_FUNC_GETPPID "getppid()"
479#define QORE_OPT_FUNC_STATVFS "statvfs()"
481#define QORE_OPT_FUNC_SETSID "setsid()"
483#define QORE_OPT_FUNC_IS_EXECUTABLE "is_executable()"
485#define QORE_OPT_FUNC_CLOSE_ALL_FD "close_all_fd()"
487#define QORE_OPT_FUNC_GET_NETIF_LIST "get_netif_list()"
488
490#define QO_OPTION 0
491#define QO_ALGORITHM 1
492#define QO_FUNCTION 2
493
496 const char* option;
497 const char* constant;
498 int type;
499 bool value;
500};
501
503DLLEXPORT QoreStringNode* q_strerror(int errnum);
505DLLEXPORT void q_strerror(QoreString &str, int errnum);
506
508DLLEXPORT extern const qore_option_s* qore_option_list;
510DLLEXPORT extern size_t qore_option_list_size;
511
513
526DLLEXPORT QoreStringNode* qore_reassign_signal(int sig, const char* name);
527
529
544DLLEXPORT QoreStringNode* qore_reassign_signal(int sig, const char* name, bool reuse_sys);
545
547
566DLLEXPORT QoreStringNode* qore_reassign_signals(const sig_vec_t& sig_vec, const char* name);
567
569
588DLLEXPORT QoreStringNode* qore_reassign_signals(const sig_vec_t& sig_vec, const char* name, bool reuse_sys);
589
591
603DLLEXPORT int qore_release_signal(int sig, const char* name);
604
606
613DLLEXPORT int qore_release_signals(const sig_vec_t& sig_vec, const char* name);
614
616#define QORE_MAX(a, b) ((a) > (b) ? (a) : (b))
617
619#define QORE_MIN(a, b) ((a) < (b) ? (a) : (b))
620
622#define QORE_PARAM_NO_ARG QoreSimpleValue().assign(nullptr)
623
624// define QORE_PATH_MAX
625#ifndef QORE_PATH_MAX
626#ifdef _XOPEN_PATH_MAX
627#define QORE_PATH_MAX _XOPEN_PATH_MAX
628#else
629#define QORE_PATH_MAX 1024
630#endif
631#endif
632
634
636DLLEXPORT void parse_set_time_zone(const char* zone);
637
639DLLEXPORT int qore_usleep(int64 usecs);
640
642DLLEXPORT void qore_disable_gc();
643
645DLLEXPORT bool qore_is_gc_enabled();
646
648DLLEXPORT bool q_path_is_readable(const char* path);
649
651DLLEXPORT bool q_parse_bool(QoreValue n);
652
654DLLEXPORT bool q_parse_bool(const char* str);
655
657DLLEXPORT bool q_get_option_value(const char* opt);
658
660DLLEXPORT bool q_get_option_constant_value(const char* opt);
661
663DLLEXPORT const char* q_mode_to_perm(mode_t mode, QoreString& perm);
664
667
669DLLEXPORT bool q_absolute_path_unix(const char* path);
670
672DLLEXPORT bool q_absolute_path_windows(const char* path);
673
675DLLEXPORT bool q_absolute_path(const char* path);
676
678DLLEXPORT void q_normalize_path(QoreString& path, const char* cwd = 0);
679
681DLLEXPORT int q_realpath(const QoreString& path, QoreString& rv, ExceptionSink* xsink = 0);
682
684DLLEXPORT void* q_memmem(const void* big, size_t big_len, const void* little, size_t little_len);
685
687
691DLLEXPORT void* q_memrmem(const void* big, size_t big_len, const void* little, size_t little_len);
692
694
698DLLEXPORT int q_env_subst(QoreString& str);
699
701
703DLLEXPORT double q_strtod(const char* str);
704
706
708DLLEXPORT bool q_libqore_initalized();
709
711
713DLLEXPORT bool q_libqore_shutdown();
714
716
718DLLEXPORT bool q_libqore_exiting();
719
721
731
733
744DLLEXPORT int q_set_thread_var_value(int frame, const char* name, const QoreValue& val, ExceptionSink* xsink);
745
747DLLEXPORT int q_get_data(const QoreValue& data, const char*& ptr, size_t& len);
748
750
753
755
758
760
762DLLEXPORT const QoreTypeInfo* get_or_nothing_type_check(const QoreTypeInfo* typeInfo);
763
765
768
770
772DLLEXPORT const QoreClass* qore_pseudo_get_class(const QoreTypeInfo* t);
773
775
778
780
786DLLEXPORT void qore_set_module_option(std::string mod, std::string opt, QoreValue val);
787
789
796DLLEXPORT QoreValue qore_get_module_option(std::string mod, std::string opt);
797
798// try to remove noise in insignificant digits from a number string
807DLLEXPORT void qore_apply_rounding_heuristic(QoreString& str, int round_threshold_1, int round_threshold_2);
808
810
812DLLEXPORT size_t q_thread_get_stack_size();
813
815
818
820
822DLLEXPORT size_t q_thread_set_stack_size(size_t size, ExceptionSink* xsink);
823
825
827DLLEXPORT size_t q_thread_stack_remaining();
828
830
832DLLEXPORT size_t q_thread_stack_used();
833
835
838
839#endif // _QORE_QORELIB_H
DLLEXPORT BinaryNode * qore_inflate_to_binary(const BinaryNode *b, ExceptionSink *xsink)
decompresses data compressed with the DEFLATE algorithm to a binary
DLLEXPORT QoreStringNode * qore_reassign_signal(int sig, const char *name)
allows a module to take over ownership of a signal
DLLEXPORT qore_license_t qore_get_license()
returns the license type that the library has been initialized under
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...
DLLEXPORT QoreStringNode * q_sprintf(const QoreListNode *params, int field, int offset, ExceptionSink *xsink)
a string formatting function that works with Qore data structures
static char * strchrs(const char *str, const char *chars)
find one of any characters in a string
Definition: QoreLib.h:250
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 int64 q_epoch()
returns the seconds from the epoch
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 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")
DLLEXPORT bool q_libqore_exiting()
returns true if the Qore library is exiting without a shutdown
DLLEXPORT int64 getMicroSecZeroInt64(QoreValue a)
for getting an integer number of microseconds, with 0 as the default, from either a relative time val...
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 bool q_absolute_path_unix(const char *path)
returns true if the given string is an absolute path on UNIX systems
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 int64 q_epoch_us(int &us)
returns the seconds and microseconds 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
DLLEXPORT void parse_set_time_zone(const char *zone)
to set the time zone from the command line
DLLEXPORT QoreStringNode * qore_gunzip_to_string(const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
gunzips compressed data to a string
int q_getcwd(QoreString &cwd)
returns the current working directory in the given string; -1 is returned if an error occurred,...
DLLEXPORT hashdecl tm * q_gmtime(const time_t *clock, hashdecl tm *tms)
thread-safe version of "gmtime()"
DLLEXPORT int q_realpath(const QoreString &path, QoreString &rv, ExceptionSink *xsink=0)
normalizes the given path and resolves any symlinks
DLLEXPORT int getMicroSecZeroInt(QoreValue a)
for getting an integer number of microseconds, with 0 as the default, from either a relative time val...
DLLEXPORT double q_strtod(const char *str)
converts a string to a double in a locale-independent way
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 size_t q_thread_get_this_stack_size()
returns the thread stack size for the current thread
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 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...
DLLEXPORT int qore_release_signal(int sig, const char *name)
releases the signal allocated to the given module
DLLEXPORT QoreValue qore_get_module_option(std::string mod, std::string opt)
get module option for the given module
DLLEXPORT int qore_usleep(int64 usecs)
use this function instead of usleep(), as usleep() is not signal-safe on some platforms (ex: Solaris ...
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 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
int q_gname2gid(const char *name, gid_t &gid)
thread-safe way to lookup a gid from a group name
DLLEXPORT int64 getMsZeroBigInt(QoreValue a)
for getting an integer number of milliseconds, with 0 as the default, from either a relative time val...
DLLEXPORT BinaryNode * parseBase64Url(const char *buf, int len, ExceptionSink *xsink)
parses a string of base64-url-encoded data and returns a BinaryNode
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
DLLEXPORT const AbstractQoreZoneInfo * findCreateOffsetZone(int seconds_east)
returns a time zone for the given time zone UTC offset
DLLEXPORT size_t q_thread_stack_used()
Returns the number of bytes used in the current thread stack.
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 int qore_release_signals(const sig_vec_t &sig_vec, const char *name)
releases multiple signals allocated to the given module atomically
DLLEXPORT int64 getMsMinusOneBigInt(QoreValue a)
for getting an integer number of milliseconds, with -1 as the default, from either a relative time va...
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 void qore_setup_argv(int pos, int argc, char *argv[])
sets up the Qore ARGV and QORE_ARGV values
DLLEXPORT const qore_option_s * qore_option_list
list of qore options
DLLEXPORT int64 q_epoch_ns(int &us)
returns the seconds and nanoseconds from the epoch
DLLEXPORT BinaryNode * qore_bzip2(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
compresses data with bzip2
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 QoreProgram * qore_get_call_program_context()
returns the caller's Program context, if any
DLLEXPORT const char * tz_get_region_name(const AbstractQoreZoneInfo *tz)
returns the reion name for the given time zone
DLLEXPORT int getMsMinusOneInt(QoreValue a)
for getting an integer number of milliseconds, with -1 as the default, from either a relative time va...
DLLEXPORT char * q_dirname(const char *path)
thread-safe dirname function (resulting pointer must be free()ed)
DLLEXPORT QoreStringNode * q_strerror(int errnum)
returns the error string as a QoreStringNode
DLLEXPORT int q_env_subst(QoreString &str)
performs environment variable substitution on the string argument
DLLEXPORT FeatureList qoreFeatureList
list of qore features
DLLEXPORT bool q_libqore_initalized()
returns true if the Qore library has been initialized
DLLEXPORT bool q_libqore_shutdown()
returns true if the Qore library has been shut down
DLLEXPORT char * q_basenameptr(const char *path)
returns a pointer within the same 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
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 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 ...
std::vector< int > sig_vec_t
signal vector
Definition: QoreLib.h:51
static char * strnchr(const char *str, int len, char c)
find a character in a string up to len
Definition: QoreLib.h:260
DLLEXPORT int getSecMinusOneInt(QoreValue a)
for getting an integer number of seconds, with -1 as the default, from either a relative time value o...
static char * strtoupper(char *str)
convert a string to upper-case in place
Definition: QoreLib.h:279
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 QoreHashNode * q_getpwnam(const char *name)
thread-safe version of getpwnam(): returns a Qore hash of the passwd information from the username if...
DLLEXPORT void qore_apply_rounding_heuristic(QoreString &str, int round_threshold_1, int round_threshold_2)
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 const QoreTypeInfo * get_or_nothing_type_check(const QoreTypeInfo *typeInfo)
returns the "or nothing" type for the given type
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 size_t qore_option_list_size
number of elements in the option list
DLLEXPORT size_t q_thread_get_stack_size()
returns the default thread stack size
DLLEXPORT size_t q_thread_stack_remaining()
Returns the number of bytes left in the current thread stack.
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 * qore_gunzip_to_binary(const BinaryNode *bin, ExceptionSink *xsink)
gunzips compressed data to a binary
static void discard(AbstractQoreNode *n, ExceptionSink *xsink)
to deref an AbstractQoreNode (when the pointer may be 0)
Definition: QoreLib.h:327
DLLEXPORT bool qore_is_gc_enabled()
returns true if garbage collection is enabled, false if not
DLLEXPORT char * q_basename(const char *path)
thread-safe basename function (resulting pointer must be free()ed)
DLLEXPORT bool q_absolute_path(const char *path)
returns true if the given string is an absolute path on the current platform
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 BinaryNode * parseBase64(const char *buf, int len, ExceptionSink *xsink)
parses a string of base64-encoded data and returns a BinaryNode
DLLEXPORT void q_enforce_thread_size_on_primary_thread()
Sets the thread stack limit on the primary thread.
DLLEXPORT BinaryNode * qore_gzip(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
gzips data
DLLEXPORT void qore_disable_gc()
this function will cause garbage collection to be disabled
DLLEXPORT BinaryNode * qore_deflate(void *ptr, unsigned long len, int level, ExceptionSink *xsink)
compresses data with the DEFLATE algorithm
int q_uname2uid(const char *name, uid_t &uid)
thread-safe way to lookup a uid from a username
DLLEXPORT int getSecZeroInt(QoreValue a)
for getting an integer number of seconds, with 0 as the default, from either a relative time value or...
DLLEXPORT int getMsZeroInt(QoreValue a)
for getting an integer number of milliseconds, with 0 as the default, from either a relative time val...
DLLEXPORT BinaryNode * qore_bunzip2_to_binary(const BinaryNode *bin, ExceptionSink *xsink)
decompresses bzip2 data to a binary
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 size_t q_thread_set_stack_size(size_t size, ExceptionSink *xsink)
sets the default thread stack size or throws an exception on error
static bool is_nothing(const AbstractQoreNode *n)
to check if an AbstractQoreNode object is NOTHING
Definition: QoreLib.h:319
DLLEXPORT QoreStringNode * qore_bunzip2_to_string(const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
decompresses bzip2 data to a string
DLLEXPORT void * q_realloc(void *ptr, size_t size)
frees memory if there is an allocation error
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
static void strtolower(char *str)
convert a string to lower-case in place
Definition: QoreLib.h:271
DLLEXPORT QoreStringNode * q_vsprintf(const QoreListNode *params, int field, int offset, ExceptionSink *xsink)
a string formatting function that works with Qore data structures
DLLEXPORT hashdecl tm * q_localtime(const time_t *clock, hashdecl tm *tms)
thread-safe version of "localtime()"
DLLEXPORT bool tz_has_dst(const AbstractQoreZoneInfo *tz)
returns true if the zone has daylight savings time ever
DLLEXPORT BinaryNode * parseHex(const char *buf, int len, ExceptionSink *xsink)
parses a string of hex characters and returns a BinaryNode
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 ...
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:57
DLLLOCAL qore_type_t getType() const
returns the data type
Definition: AbstractQoreNode.h:175
DLLEXPORT void deref(ExceptionSink *xsink)
decrements the reference count and calls derefImpl() if there_can_be_only_one is false,...
virtual DLLEXPORT const char * getTypeName() const =0
returns the type name as a c string
holds arbitrary binary data
Definition: BinaryNode.h:41
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:50
STL-like list containing all presently-loaded Qore features.
Definition: QoreLib.h:230
DLLLOCAL FeatureList()
initialized by the library, constructor not exported
DLLLOCAL ~FeatureList()
destructor not exported
defines a Qore-language class
Definition: QoreClass.h:253
defines string encoding functions in Qore
Definition: QoreEncoding.h:83
This is the hash or associative list container type in Qore, dynamically allocated only,...
Definition: QoreHashNode.h:50
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreProgram.h:128
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
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 library and module license type identifiers
Definition: common.h:85
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
const qore_type_t NT_NOTHING
type value for QoreNothingNode
Definition: node_types.h:42
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276
definition of the elements in the qore_option_list
Definition: QoreLib.h:495
const char * constant
name of the constant for this option
Definition: QoreLib.h:497
bool value
the value of the option
Definition: QoreLib.h:499
const char * option
name of the option
Definition: QoreLib.h:496
int type
the type of the option
Definition: QoreLib.h:498