Qore Programming Language  0.8.3
Classes | Defines | Functions | Variables
include/qore/QoreLib.h File Reference

(4311)

#include <qore/common.h>
#include <qore/QoreThreadLock.h>
#include <qore/qore_bitopts.h>
#include <qore/safe_dslist>
#include <time.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>

Go to the source code of this file.

Classes

class  FeatureList
 STL-like list containing all presently-loaded Qore features. More...
struct  qore_option_s
 definition of the elements in the qore_option_list More...

Defines

#define _QORE_HAS_HARD_TYPING   1
 not defined because this version of Qore has moved all XML functionality to the "xml" module
#define _QORE_HAS_DBI_EXECRAW   1
 defined because this version of Qore supports the execRaw() DBI function
#define _QORE_HAS_TIME_ZONES   1
 defined because this version of Qore has time zone support
#define _QORE_HAS_THREAD_RESOURCE_IDS   1
 defined because this version of Qore has thread resource IDs
#define _QORE_HAS_PREPARED_STATMENT_API   1
 defined because this version of Qore has the prepared statement API
#define _QORE_HAS_DATASOURCE_ACTIVETRANSACTION   1
 defined because this version of Qore has the Datasource::activeTransaction() function
#define _QORE_HAS_DBI_SELECT_ROW   1
 defined because this version of Qore supports the DBI selectRow() function
#define QORE_OPT_ATOMIC_OPERATIONS   "atomic operations"
 option: atomic operations
#define QORE_OPT_STACK_GUARD   "stack guard"
 option: stack guard
#define QORE_OPT_SIGNAL_HANDLING   "signal handling"
 option: signal handling
#define QORE_OPT_RUNTIME_STACK_TRACE   "runtime stack tracing"
 option: runtime stack tracing
#define QORE_OPT_LIBRARY_DEBUGGING   "library debugging"
 option: library debugging
#define QORE_OPT_SHA224   "openssl sha224"
 option: ssh224 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_SHA256   "openssl sha256"
 option: ssh256 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_SHA384   "openssl sha384"
 option: ssh384 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_SHA512   "openssl sha512"
 option: ssh512 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_MDC2   "openssl mdc2"
 option: mdc2 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_RC5   "openssl rc5"
 option: rc5 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_MD2   "openssl md2"
 option: md2 algorithm supported (depends on openssl used to compile qore)
#define QORE_OPT_TERMIOS   "termios"
 option: TermIOS class available
#define QORE_OPT_FILE_LOCKING   "file locking"
 option: file locking
#define QORE_OPT_UNIX_USERMGT   "unix user management"
 option: unix user/group management functions available
#define QORE_OPT_UNIX_FILEMGT   "unix file management"
 option: unix file management functions available
#define QORE_OPT_FUNC_ROUND   "round()"
 option: round() function available
#define QORE_OPT_FUNC_TIMEGM   "timegm()"
 option: timegm() function available
#define QORE_OPT_FUNC_SETEUID   "seteuid()"
 option: seteuid() function available
#define QORE_OPT_FUNC_SETEGID   "setegid()"
 option: setegid() function available
#define QORE_OPT_FUNC_SYSTEM   "system()"
 option: system() function available
#define QORE_OPT_FUNC_KILL   "kill()"
 option: kill() function available
#define QORE_OPT_FUNC_FORK   "fork()"
 option: fork() function available
#define QORE_OPT_FUNC_GETPPID   "getppid()"
 option: getppid() function available
#define QORE_OPT_FUNC_STATVFS   "statvfs()"
 option: statvfs() function available
#define QORE_OPT_FUNC_SETSID   "setsid()"
 option: setsid() function available
#define QORE_OPT_FUNC_IS_EXECUTABLE   "is_executable()"
 option: is_executable() function available
#define QO_OPTION   0
 option type feature
#define QORE_MAX(a, b)   ((a) > (b) ? (a) : (b))
 macro to return the maximum of 2 numbers

Functions

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 QoreStringNodeq_sprintf (const class QoreListNode *params, int field, int offset, class ExceptionSink *xsink)
 a string formatting function that works with Qore data structures
DLLEXPORT QoreStringNodeq_vsprintf (const class QoreListNode *params, int field, int offset, class ExceptionSink *xsink)
 a string formatting function that works with Qore data structures
DLLEXPORT struct tm * q_localtime (const time_t *clock, struct tm *tms)
 thread-safe version of "localtime()"
DLLEXPORT struct tm * q_gmtime (const time_t *clock, struct tm *tms)
 thread-safe version of "gmtime()"
DLLEXPORT int64 q_epoch ()
 returns the seconds from the epoch
DLLEXPORT int64 q_epoch_us (int &us)
 returns the seconds and microseconds from the epoch
DLLEXPORT int64 q_epoch_ns (int &us)
 returns the seconds and nanoseconds from the epoch
DLLEXPORT char * q_basename (const char *path)
 thread-safe basename function (resulting pointer must be free()ed)
DLLEXPORT char * q_basenameptr (const char *path)
 returns a pointer within the same string
DLLEXPORT char * q_dirname (const char *path)
 thread-safe dirname function (resulting pointer must be free()ed)
DLLEXPORT void * q_realloc (void *ptr, size_t size)
 frees memory if there is an allocation error
DLLEXPORT QoreHashNodeq_getpwuid (uid_t uid)
 thread-safe version of getpwuid(): returns a Qore hash of the passwd information from the uid if possible, otherwise 0
DLLEXPORT QoreHashNodeq_getpwnam (const char *name)
 thread-safe version of getpwnam(): returns a Qore hash of the passwd information from the username if possible, otherwise 0
DLLEXPORT QoreHashNodeq_getgrgid (uid_t uid)
 thread-safe version of getgrgid(): returns a Qore hash of the group information from the gid if possible, otherwise 0
DLLEXPORT QoreHashNodeq_getgrnam (const char *name)
 thread-safe version of getgrnam(): returns a Qore hash of the group information from the group name if possible, otherwise 0
int q_uname2uid (const char *name, uid_t &uid)
 thread-safe way to lookup a uid from a username
int q_gname2gid (const char *name, gid_t &gid)
 thread-safe way to lookup a gid from a group name
DLLEXPORT void qore_setup_argv (int pos, int argc, char *argv[])
 sets up the Qore ARGV and QORE_ARGV values
DLLEXPORT qore_license_t qore_get_license ()
 returns the license type that the library has been initialized under
DLLEXPORT void qore_exit_process (int rc)
 instead of calling "exit()", call qore_exit_process() to exit without risking a crash if other threads are running
static char * strchrs (const char *str, const char *chars)
 find one of any characters in a string
static char * strnchr (const char *str, int len, char c)
 find a character in a string up to len
static void strtolower (char *str)
 convert a string to lower-case in place
static char * strtoupper (char *str)
 convert a string to upper-case in place
DLLEXPORT int getSecZeroInt (const AbstractQoreNode *a)
 for getting an integer number of seconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int64 getSecZeroBigInt (const AbstractQoreNode *a)
 for getting an integer number of seconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int getSecMinusOneInt (const AbstractQoreNode *a)
 for getting an integer number of seconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int64 getSecMinusOneBigInt (const AbstractQoreNode *a)
 for getting an integer number of seconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int getMsZeroInt (const AbstractQoreNode *a)
 for getting an integer number of milliseconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int64 getMsZeroBigInt (const AbstractQoreNode *a)
 for getting an integer number of milliseconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int getMsMinusOneInt (const AbstractQoreNode *a)
 for getting an integer number of milliseconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int64 getMsMinusOneBigInt (const AbstractQoreNode *a)
 for getting an integer number of milliseconds, with -1 as the default, from either a relative time value or an integer value
DLLEXPORT int getMicroSecZeroInt (const AbstractQoreNode *a)
 for getting an integer number of microseconds, with 0 as the default, from either a relative time value or an integer value
DLLEXPORT int64 getMicroSecZeroInt64 (const AbstractQoreNode *a)
 for getting an integer number of microseconds, with 0 as the default, from either a relative time value or an integer value
static bool is_nothing (const AbstractQoreNode *n)
 to check if an AbstractQoreNode object is NOTHING
static void discard (AbstractQoreNode *n, ExceptionSink *xsink)
 to deref an AbstractQoreNode (when the pointer may be 0)
DLLEXPORT BinaryNodeqore_deflate (void *ptr, unsigned long len, int level, ExceptionSink *xsink)
 compresses data with the DEFLATE algorithm
DLLEXPORT QoreStringNodeqore_inflate_to_string (const BinaryNode *b, const QoreEncoding *enc, ExceptionSink *xsink)
 decompresses data compressed with the DEFLATE algorithm to a string
DLLEXPORT BinaryNodeqore_inflate_to_binary (const BinaryNode *b, ExceptionSink *xsink)
 decompresses data compressed with the DEFLATE algorithm to a binary
DLLEXPORT BinaryNodeqore_gzip (void *ptr, unsigned long len, int level, ExceptionSink *xsink)
 gzips data
DLLEXPORT QoreStringNodeqore_gunzip_to_string (const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
 gunzips compressed data to a string
DLLEXPORT BinaryNodeqore_gunzip_to_binary (const BinaryNode *bin, ExceptionSink *xsink)
 gunzips compressed data to a binary
DLLEXPORT BinaryNodeqore_bzip2 (void *ptr, unsigned long len, int level, ExceptionSink *xsink)
 compresses data with bzip2
DLLEXPORT QoreStringNodeqore_bunzip2_to_string (const BinaryNode *bin, const QoreEncoding *enc, ExceptionSink *xsink)
 decompresses bzip2 data to a string
DLLEXPORT BinaryNodeqore_bunzip2_to_binary (const BinaryNode *bin, ExceptionSink *xsink)
 decompresses bzip2 data to a binary
DLLEXPORT BinaryNodeparseBase64 (const char *buf, int len, ExceptionSink *xsink)
 parses a string of base64-encoded data and returns a BinaryNode
DLLEXPORT BinaryNodeparseHex (const char *buf, int len, ExceptionSink *xsink)
 parses a string of hex characters and returns a BinaryNode
DLLEXPORT const
AbstractQoreZoneInfo * 
findCreateOffsetZone (int seconds_east)
 returns a time zone for the given time zone UTC offset
DLLEXPORT QoreStringNodeq_strerror (int errnum)
 returns the error string as a QoreStringNode
DLLEXPORT void q_strerror (QoreString &str, int errnum)
 concatenates the error string to the given string
DLLEXPORT QoreStringNodeqore_reassign_signal (int sig, const char *name)
 allows a module to take over ownership of a signal
DLLEXPORT void parse_set_time_zone (const char *zone)
 to set the time zone from the command line
DLLEXPORT int qore_usleep (int64 usecs)
 use this function instead of usleep(), as usleep() is not signal-safe on some platforms (ex: Solaris 8, 9)

Variables

DLLEXPORT FeatureList qoreFeatureList
 list of qore features
DLLEXPORT const qore_option_sqore_option_list
 list of qore options
DLLEXPORT size_t qore_option_list_size
 number of elements in the option list

Detailed Description

contains prototypes for various helper functions in the Qore library


Define Documentation

#define _QORE_HAS_HARD_TYPING   1

not defined because this version of Qore has moved all XML functionality to the "xml" module

not defined because this version of Qore has moved all XML functionality to the "xml" module not defined because this version of Qore has moved all XML functionality to the "xml" module defined because this version of Qore supports hard typing, overloading, default arguments, etc


Function Documentation

DLLEXPORT void parse_set_time_zone ( const char *  zone)

to set the time zone from the command line

Note:
this function can only be called when a program exists
int q_gname2gid ( const char *  name,
gid_t &  gid 
)

thread-safe way to lookup a gid from a group name

Parameters:
namethe group to look up
gidthe gid returned
Returns:
0 for no error, non-zero is an error code like errno
int q_uname2uid ( const char *  name,
uid_t &  uid 
)

thread-safe way to lookup a uid from a username

Parameters:
namethe username to look up
uidthe uid returned
Returns:
0 for no error, non-zero is an error code like errno
DLLEXPORT QoreStringNode* qore_reassign_signal ( int  sig,
const char *  name 
)

allows a module to take over ownership of a signal

Parameters:
sigsignal number
namemodule name taking ownership of managing the signal
Returns:
0 for OK, non-zero for failed (error message)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines