See Also
Quick Nav
Ejscript - Native API
Components
| Ejs | Ejsript VM Structure. |
| EjsArray | Array class. |
| EjsBlock | Block class. |
| EjsBoolean | Boolean class. |
| EjsByteArray | ByteArray class. |
| EjsCache | EjsCache. |
| EjsCmd | Cmd class. |
| EjsDate | Date class. |
| EjsError | Error classes. |
| EjsFile | File class. |
| EjsFileSystem | FileSystem class. |
| EjsFrame | Frame record. |
| EjsFunction | Function class. |
| EjsHttp | Http Class. |
| EjsHttpServer | HttpServer Class. |
| EjsIterator | Iterator Class. |
| EjsModule | Module control structure. |
| EjsName | Qualified name structure. |
| EjsNamespace | Namespace Class. |
| EjsNull | Null Class. |
| EjsNumber | Number class. |
| EjsObj | Base object from which all objects inherit. |
| EjsPath | Path class. |
| EjsPool | Cached pooled of virtual machines. |
| EjsPot | Object with properties Type. |
| EjsRegExp | RegExp Class. |
| EjsRequest | Request Class. |
| EjsSession | Session Class. |
| EjsSocket | Socket Class. |
| EjsString | String Class. |
| EjsTimer | Timer Class. |
| EjsType | Type class. |
| EjsUri | Uri class. |
| EjsVoid | Void class. |
| EjsWorker | Worker Class. |
| EjsXML | XML and XMLList class. |
Functions
| int | EJS_MAKE_VERSION(int maj, int min, int patch) |
| Make an integer version number. | |
| EjsType* | EST(void *name) |
| Special type. | |
| EjsAny* | ESV(void *name) |
| Get immutable special value. | |
| EjsEx* | ejsAddException(Ejs *ejs, EjsFunction *fun, uint tryStart, uint tryEnd, struct EjsType *catchType, uint handlerStart, uint handlerEnd, int numBlocks, int numStack, int flags, int preferredIndex) |
| Add an exception record. | |
| int | ejsAddImmutable(struct Ejs *ejs, int slotNum, EjsName qname, EjsAny *obj) |
| Add an immutable reference. | |
| int | ejsAddItem(Ejs *ejs, EjsArray *ap, EjsAny *item) |
| Add an item to the array. | |
| int | ejsAddObserver(Ejs *ejs, EjsObj **emitterPtr, EjsObj *name, struct EjsFunction *observer) |
| Add an observer. | |
| EjsAny* | ejsAlloc(Ejs *ejs, struct EjsType *type, ssize extra) |
| Allocate a new variable. | |
| Ejs* | ejsAllocPoolVM(EjsPool *pool, int flags) |
| Allocate a VM from the pool. | |
| int | ejsAppendAttributeToXML(Ejs *ejs, EjsXML *parent, EjsXML *attribute) |
| Append an attribute. | |
| EjsXML* | ejsAppendToXML(Ejs *ejs, EjsXML *dest, EjsXML *node) |
| Append a node. | |
| int | ejsAtoi(Ejs *ejs, EjsString *sp, int radix) |
| Parse a string and convert to an integer. | |
| int | ejsBindAccess(Ejs *ejs, EjsAny *obj, int slotNum, void *getter, void *setter) |
| Bind a native C functions to method accessors. | |
| void | ejsBindConstructor(Ejs *ejs, EjsType *type, void *constructor) |
| Bind a constructor. | |
| int | ejsBindFunction(Ejs *ejs, EjsAny *obj, int slotNum, void *fun) |
| Bind a native C function to a function property. | |
| int | ejsBindMethod(Ejs *ejs, EjsAny *obj, int slotNum, void *fn) |
| Bind a native C function to a method property. | |
| int | ejsBlendObject(Ejs *ejs, EjsObj *dest, EjsObj *src, int flags) |
| Blend objects. | |
| int | ejsBlockGC(Ejs *ejs) |
| Block garbage collection. | |
| EjsAny* | ejsCacheExpire(Ejs *ejs, EjsObj *cache, struct EjsString *key, struct EjsDate *when) |
| Expire a cache item. | |
| EjsAny* | ejsCacheRead(Ejs *ejs, EjsObj *cache, struct EjsString *key, EjsObj *options) |
| Read an item from the cache. | |
| EjsAny* | ejsCacheReadObj(Ejs *ejs, EjsObj *cache, struct EjsString *key, EjsObj *options) |
| Read an object from the cache. | |
| EjsBoolean* | ejsCacheRemove(Ejs *ejs, EjsObj *cache, struct EjsString *key) |
| Read an item from the cache. | |
| EjsAny* | ejsCacheSetLimits(Ejs *ejs, EjsObj *cache, EjsObj *limits) |
| Set the cache limits. | |
| struct EjsNumber* | ejsCacheWrite(Ejs *ejs, EjsObj *cache, struct EjsString *key, struct EjsString *value, EjsObj *options) |
| Write an item to the cache. | |
| struct EjsNumber* | ejsCacheWriteObj(Ejs *ejs, EjsObj *cache, struct EjsString *key, EjsAny *value, EjsObj *options) |
| Write an object to the cache. | |
| EjsArray* | ejsCaptureStack(Ejs *ejs, int skip) |
| Capture the execution stack. | |
| EjsAny* | ejsCast(Ejs *ejs, EjsAny *obj, void *name) |
| Cast the object to the given type name. | |
| EjsAny* | ejsCastType(Ejs *ejs, EjsAny *obj, struct EjsType *type) |
| Cast a variable to a new type. | |
| int | ejsCheckSlot(Ejs *ejs, EjsPot *obj, int slotNum) |
| Check the slot. | |
| void | ejsClearArray(Ejs *ejs, EjsArray *ap) |
| Clear an array and remove all items. | |
| void | ejsClearException(Ejs *ejs) |
| Clear an exception. | |
| EjsAny* | ejsClone(Ejs *ejs, EjsAny *obj, bool deep) |
| Clone a variable. | |
| EjsArray* | ejsCloneArray(Ejs *ejs, EjsArray *ap, bool deep) |
| Clone an array. | |
| EjsFunction* | ejsCloneFunction(Ejs *ejs, EjsFunction *fun, int deep) |
| Clone a function. | |
| EjsHttpServer* | ejsCloneHttpServer(Ejs *ejs, EjsHttpServer *server, bool deep) |
| Clone a http server. | |
| EjsAny* | ejsClonePot(Ejs *ejs, EjsAny *src, bool deep) |
| Copy an object. | |
| EjsRequest* | ejsCloneRequest(Ejs *ejs, EjsRequest *req, bool deep) |
| Clone a request into another interpreter. | |
| Ejs* | ejsCloneVM(Ejs *ejs) |
| Clone an ejs virtual machine. | |
| EjsAny* | ejsCoerceOperands(Ejs *ejs, EjsObj *lhs, int opcode, EjsObj *rhs) |
| Cast the operands as required by the operation code. | |
| int | ejsCompactPot(Ejs *ejs, EjsPot *obj) |
| Compact an object. | |
| int | ejsCompareAsc(Ejs *ejs, EjsString *s1, cchar *s2) |
| Compare a string with a multibyte string. | |
| int | ejsCompareString(Ejs *ejs, EjsString *s1, EjsString *s2) |
| Compare two strings. | |
| int | ejsCompareSubstring(Ejs *ejs, EjsString *s1, EjsString *s2, ssize offset, ssize len) |
| Compare a substring. | |
| int | ejsCompareWide(Ejs *ejs, EjsString *s1, MprChar *s2, ssize len) |
| Compare a string with a wide string. | |
| EjsType* | ejsConfigureType(Ejs *ejs, EjsType *type, struct EjsModule *up, EjsType *baseType, int numTypeProp, int numInstanceProp, int64 attributes) |
| Configure a type. | |
| int | ejsContainsAsc(Ejs *ejs, EjsString *sp, cchar *pat) |
| Test if a string contains an ascii substring. | |
| int | ejsContainsChar(Ejs *ejs, EjsString *sp, int charPat) |
| Test if a string contains a character. | |
| int | ejsContainsString(Ejs *ejs, EjsString *sp, EjsString *pat) |
| Test if a string contains another string. | |
| ssize | ejsCopyToByteArray(Ejs *ejs, EjsByteArray *ba, ssize offset, cchar *data, ssize length) |
| Copy data into a byte array. | |
| EjsPot* | ejsCreateActivation(Ejs *ejs, EjsFunction *fun, int numSlots) |
| Create an activation record for a function. | |
| EjsType* | ejsCreateArchetype(Ejs *ejs, struct EjsFunction *fun, EjsPot *prototype) |
| Create an Archetype. | |
| EjsArray* | ejsCreateArray(Ejs *ejs, int size) |
| Create an array. | |
| EjsFunction* | ejsCreateBareFunction(Ejs *ejs, EjsString *name, int attributes) |
| Create a bare function. | |
| EjsString* | ejsCreateBareString(Ejs *ejs, ssize len) |
| Create an empty string object. | |
| EjsBoolean* | ejsCreateBoolean(Ejs *ejs, int value) |
| Create a boolean. | |
| EjsByteArray* | ejsCreateByteArray(Ejs *ejs, ssize size) |
| Create a byte array. | |
| EjsCode* | ejsCreateCode(Ejs *ejs, EjsFunction *fun, struct EjsModule *module, cuchar *byteCode, ssize len, EjsDebug *debug) |
| Create a code block. | |
| EjsType* | ejsCreateCoreType(Ejs *ejs, EjsName qname, int size, int slotNum, int numTypeProp, void *manager, int64 attributes) |
| Create a core type object. | |
| EjsDate* | ejsCreateDate(Ejs *ejs, MprTime value) |
| Create a new date instance. | |
| EjsAny* | ejsCreateEmptyPot(Ejs *ejs) |
| Create an empty property object. | |
| EjsError* | ejsCreateError(Ejs *ejs, struct EjsType *type, EjsObj *message) |
| Create an error object. | |
| EjsFile* | ejsCreateFile(Ejs *ejs, cchar *filename) |
| Create a File object. | |
| EjsFile* | ejsCreateFileFromFd(Ejs *ejs, int fd, cchar *name, int mode) |
| Create a file object from an O/S file descriptor. | |
| EjsFileSystem* | ejsCreateFileSystem(Ejs *ejs, cchar *path) |
| Create a FileSystem object. | |
| EjsFunction* | ejsCreateFunction(Ejs *ejs, EjsString *name, cuchar *code, int codeLen, int numArgs, int numDefault, int numExceptions, struct EjsType *returnType, int attributes, struct EjsModule *module, EjsBlock *scope, int strict) |
| Create a function object. | |
| EjsHttp* | ejsCreateHttp(Ejs *ejs) |
| Create a new Http object. | |
| EjsAny* | ejsCreateInstance(Ejs *ejs, struct EjsType *type, int argc, void *argv) |
| Create a new variable instance. | |
| EjsIterator* | ejsCreateIterator(Ejs *ejs, EjsAny *target, void *next, bool deep, EjsArray *namespaces) |
| Create an iterator object. | |
| EjsNamespace* | ejsCreateNamespace(Ejs *ejs, EjsString *name) |
| Create a namespace object. | |
| EjsNull* | ejsCreateNull(Ejs *ejs) |
| Create the null object. | |
| EjsNumber* | ejsCreateNumber(Ejs *ejs, MprNumber value) |
| Create a number object. | |
| EjsAny* | ejsCreateObj(Ejs *ejs, struct EjsType *type, int numSlots) |
| Create a variable. | |
| EjsPath* | ejsCreatePath(Ejs *ejs, EjsString *path) |
| Create a Path object. | |
| EjsPath* | ejsCreatePathFromAsc(Ejs *ejs, cchar *path) |
| Create a Path object. | |
| EjsPool* | ejsCreatePool(int poolMax, cchar *templateScript, cchar *startScript, cchar *startScriptPath, char *home) |
| Create a pool for virutal machines. | |
| EjsAny* | ejsCreatePot(Ejs *ejs, struct EjsType *type, int size) |
| Create an object instance of the specified type. | |
| void | ejsCreatePotHelpers(Ejs *ejs) |
| Create the Pot helpers. | |
| EjsObj* | ejsCreatePrototype(Ejs *ejs, EjsType *type, int numProp) |
| Create a type prototype. | |
| EjsRegExp* | ejsCreateRegExp(Ejs *ejs, EjsString *pattern) |
| Create a new regular expression object. | |
| EjsRequest* | ejsCreateRequest(Ejs *ejs, EjsHttpServer *server, HttpConn *conn, cchar *dir) |
| Create a new request. | |
| EjsNamespace* | ejsCreateReservedNamespace(Ejs *ejs, EjsName *typeName, EjsString *name) |
| Create a reserved namespace. | |
| struct EjsArray* | ejsCreateSearchPath(Ejs *ejs, cchar *searchPath) |
| Create a search path array. | |
| EjsSocket* | ejsCreateSocket(Ejs *ejs) |
| Create a new Socket object. | |
| EjsString* | ejsCreateString(Ejs *ejs, MprChar *value, ssize len) |
| Create a string object. | |
| EjsString* | ejsCreateStringFromAsc(Ejs *ejs, cchar *value) |
| Create a string from ascii. | |
| EjsString* | ejsCreateStringFromBytes(Ejs *ejs, cchar *value, ssize len) |
| Create a string from an ascii block. | |
| EjsString* | ejsCreateStringFromConst(Ejs *ejs, struct EjsModule *mp, int index) |
| Create a string from a module string constant. | |
| EjsString* | ejsCreateStringFromMulti(Ejs *ejs, cchar *value, ssize len) |
| Create a string from UTF-8 multibyte string. | |
| EjsType* | ejsCreateType(Ejs *ejs, EjsName name, struct EjsModule *up, EjsType *baseType, EjsPot *prototype, int slotNum, int numTypeProp, int numInstanceProp, int size, void *manager, int64 attributes) |
| Create a new type object. | |
| EjsVoid* | ejsCreateUndefined(Ejs *ejs) |
| Create the undefined object. | |
| EjsUri* | ejsCreateUri(Ejs *ejs, EjsString *uri) |
| Create a Uri object. | |
| EjsUri* | ejsCreateUriFromAsc(Ejs *ejs, cchar *uri) |
| Create a URI from an ascii path. | |
| EjsUri* | ejsCreateUriFromParts(Ejs *ejs, cchar *scheme, cchar *host, int port, cchar *path, cchar *query, cchar *reference, bool complete) |
| Ejs* | ejsCreateVM(int argc, cchar **argv, int flags) |
| Create an ejs virtual machine. | |
| EjsWorker* | ejsCreateWorker(Ejs *ejs) |
| Create a worker. | |
| EjsXML* | ejsCreateXML(Ejs *ejs, int kind, EjsName name, EjsXML *parent, EjsString *value) |
| Create an XML node object. | |
| EjsXML* | ejsCreateXMLList(Ejs *ejs, EjsXML *targetObject, EjsName targetProperty) |
| Create an XML list object. | |
| int | ejsDefineGlobalFunction(Ejs *ejs, EjsString *name, EjsProc fn) |
| Define a global function. | |
| int | ejsDefineInstanceProperty(Ejs *ejs, EjsType *type, int slotNum, EjsName name, EjsType *propType, int attributes, EjsAny *value) |
| Define an instance property. | |
| int | ejsDefineProperty(Ejs *ejs, EjsAny *obj, int slotNum, EjsName qname, struct EjsType *type, int64 attributes, EjsAny *value) |
| Define a property. | |
| EjsNamespace* | ejsDefineReservedNamespace(Ejs *ejs, EjsBlock *block, EjsName *typeName, cchar *name) |
| Define a reserved namespace on a block. | |
| int | ejsDeleteProperty(Ejs *ejs, EjsAny *obj, int slotNum) |
| Delete a property. | |
| int | ejsDeletePropertyByName(Ejs *ejs, EjsAny *obj, EjsName qname) |
| Delete a property by name. | |
| EjsAny* | ejsDeserialize(Ejs *ejs, struct EjsString *str) |
| Deserialize a JSON encoded string. | |
| void | ejsDestroyIntern(struct EjsIntern *intern) |
| Destroy the intern string cache. | |
| int | ejsDestroySession(Ejs *ejs, EjsSession *session) |
| Destroy as session. | |
| void | ejsDestroyVM(Ejs *ejs) |
| Destroy an interpreter. | |
| int | ejsEvalFile(cchar *path) |
| Evaluate a file. | |
| int | ejsEvalModule(cchar *path) |
| Evaluate a module. | |
| int | ejsEvalScript(cchar *script) |
| Evaluate a script. | |
| void | ejsExit(Ejs *ejs, int status) |
| Instruct the interpreter to exit. | |
| EjsType* | ejsFinalizeCoreType(Ejs *ejs, EjsName qname) |
| Finalize a core type. | |
| EjsType* | ejsFinalizeScriptType(Ejs *ejs, EjsName qname, int size, void *manager, int64 attributes) |
| Finalize a script type. | |
| void | ejsFixTraits(Ejs *ejs, EjsPot *obj) |
| Fix traits. | |
| EjsString* | ejsFormatReservedNamespace(Ejs *ejs, EjsName *typeName, EjsString *spaceName) |
| Format a reserved namespace name to create a unique namespace. | |
| void | ejsFreePoolVM(EjsPool *pool, Ejs *ejs) |
| Free a VM back to the pool. | |
| bool | ejsGetBoolean(Ejs *ejs, EjsAny *obj) |
| Get the C boolean value from a boolean object. | |
| ssize | ejsGetByteArrayAvailableData(EjsByteArray *ba) |
| Get the number of available bytes. | |
| ssize | ejsGetByteArrayRoom(EjsByteArray *ba) |
| Determine the spare room in the byte array for more data. | |
| MprTime | ejsGetDate(Ejs *ejs, EjsDate *date) |
| Get the numeric value stored in a EjsDate object. | |
| double | ejsGetDouble(Ejs *ejs, EjsAny *obj) |
| Get the numeric value stored in a EjsNumber object. | |
| cchar* | ejsGetErrorMsg(Ejs *ejs, int withStack) |
| Get the interpreter error message. | |
| EjsObj* | ejsGetException(Ejs *ejs) |
| Get the Ejs exception object for this interpreter. | |
| EjsAny* | ejsGetFirstItem(Ejs *ejs, EjsArray *ap) |
| Get the first item from an array. | |
| void* | ejsGetHandle(Ejs *ejs) |
| Get the hosting handle. | |
| int | ejsGetHashSize(int numProp) |
| Get the preferred hash size. | |
| void | ejsGetHttpLimits(Ejs *ejs, EjsObj *obj, HttpLimits *limits, bool server) |
| Get a Http limits. | |
| EjsAny* | ejsGetImmutable(struct Ejs *ejs, int slotNum) |
| Get an immutable object. | |
| EjsAny* | ejsGetImmutableByName(struct Ejs *ejs, EjsName qname) |
| Get an immutable object by name. | |
| int | ejsGetInt(Ejs *ejs, EjsAny *obj) |
| Get the numeric value stored in a EjsNumber object. | |
| int64 | ejsGetInt64(Ejs *ejs, EjsAny *obj) |
| Get an 64 bit integer value equivalent to that stored in an EjsNumber object. | |
| EjsAny* | ejsGetItem(Ejs *ejs, EjsArray *ap, int index) |
| Get an item from an array. | |
| EjsAny* | ejsGetLastItem(Ejs *ejs, EjsArray *ap) |
| Get the last item from an array. | |
| int | ejsGetLength(Ejs *ejs, EjsAny *obj) |
| Get a count of properties in a variable. | |
| EjsAny* | ejsGetNextItem(Ejs *ejs, EjsArray *ap, int *next) |
| Get the next item from an array. | |
| MprNumber | ejsGetNumber(Ejs *ejs, EjsAny *obj) |
| Get the numeric value stored in a EjsNumber object. | |
| EjsName | ejsGetPotPropertyName(Ejs *ejs, EjsPot *obj, int slotNum) |
| Get a property name. | |
| EjsAny* | ejsGetPrevItem(Ejs *ejs, EjsArray *ap, int *prev) |
| Get the previous item from an array. | |
| EjsAny* | ejsGetProperty(Ejs *ejs, EjsAny *obj, int slotNum) |
| Get a property. | |
| EjsAny* | ejsGetPropertyByName(Ejs *ejs, EjsAny *obj, EjsName qname) |
| Get a property by name. | |
| EjsName | ejsGetPropertyName(Ejs *ejs, EjsAny *obj, int slotNum) |
| Get a variable property's name. | |
| struct EjsTrait* | ejsGetPropertyTraits(Ejs *ejs, EjsAny *obj, int slotNum) |
| Get a property's traits. | |
| EjsPot* | ejsGetPrototype(Ejs *ejs, EjsAny *obj) |
| Get the prototype object for an object. | |
| EjsSession* | ejsGetSession(Ejs *ejs, EjsString *key, MprTime timeout, int create) |
| Get a session object for a given key. | |
| EjsType* | ejsGetType(Ejs *ejs, int slotNum) |
| Get a type. | |
| EjsType* | ejsGetTypeByName(Ejs *ejs, EjsName qname) |
| Get a type given its name. | |
| EjsString* | ejsGetTypeName(struct Ejs *ejs, EjsAny *obj) |
| Get the type name of an object. | |
| EjsString* | ejsGetTypeOf(struct Ejs *ejs, EjsAny *obj) |
| TypeOf operator. | |
| EjsAny* | ejsGetVarByName(Ejs *ejs, EjsAny *obj, EjsName name, EjsLookup *lookup) |
| Get a variable by name. | |
| EjsXML* | ejsGetXMLDescendants(Ejs *ejs, EjsXML *xml, EjsName qname) |
| Get the descendants of an XML node that match the given name. | |
| ssize | ejsGrowByteArray(Ejs *ejs, EjsByteArray *ba, ssize size) |
| Grow the byte array. | |
| int | ejsGrowPot(Ejs *ejs, EjsPot *obj, int numSlots) |
| Grow a pot object. | |
| bool | ejsHasException(Ejs *ejs) |
| Determine if an exception has been thrown. | |
| int | ejsIndexProperties(Ejs *ejs, EjsPot *obj) |
| Make or remake a property index. | |
| int | ejsInitFunction(Ejs *ejs, EjsFunction *fun, EjsString *name, cuchar *code, int codeLen, int numArgs, int numDefault, int numExceptions, struct EjsType *returnType, int attributes, struct EjsModule *module, EjsBlock *scope, int strict) |
| Initialize a function object. | |
| int | ejsInsertItem(Ejs *ejs, EjsArray *ap, int index, EjsAny *item) |
| Insert an item. | |
| int | ejsInsertPotProperties(Ejs *ejs, EjsPot *pot, int numSlots, int offset) |
| Insert properties. | |
| EjsString* | ejsInternAsc(struct Ejs *ejs, cchar *value, ssize len) |
| Intern a string object from an Ascii string. | |
| EjsString* | ejsInternMulti(struct Ejs *ejs, cchar *value, ssize len) |
| Intern a string object from a UTF-8 string. | |
| EjsString* | ejsInternString(EjsString *sp) |
| Intern a string object. | |
| EjsString* | ejsInternWide(struct Ejs *ejs, MprChar *value, ssize len) |
| Intern a string object from a UTF-16 string. | |
| EjsAny* | ejsInvokeOperator(Ejs *ejs, EjsAny *obj, int opCode, EjsAny *rhs) |
| Invoke an opcode on a native type. | |
| EjsAny* | ejsInvokeOperatorDefault(Ejs *ejs, EjsAny *obj, int opCode, EjsAny *rhs) |
| Default implementation for operator invoke. | |
| bool | ejsIs(Ejs *ejs, EjsAny *obj, void *name) |
| Test the type of an object. | |
| bool | ejsIsA(Ejs *ejs, EjsAny *target, EjsType *type) |
| Test if an variable is an instance of a given type. | |
| bool | ejsIsBlock(Ejs *ejs, EjsObj *obj) |
| Determine if a variable is a block. | |
| bool | ejsIsDefined(Ejs *ejs, EjsAny *obj) |
| Test the object is not null and not undefined. | |
| bool | ejsIsError(Ejs *ejs, EjsAny *obj) |
| Test if the given object is an error instance. | |
| bool | ejsIsFrame(Ejs *ejs, EjsAny *obj) |
| Determine if a variable is a frame. | |
| bool | ejsIsFunction(Ejs *ejs, EjsAny *obj) |
| Determine if a variable is a function. | |
| bool | ejsIsInfinite(MprNumber n) |
| Test if a number is infinite. | |
| bool | ejsIsInitializer(Ejs *ejs, EjsAny *obj) |
| Determine if the function is an initializer. | |
| bool | ejsIsNan(MprNumber n) |
| Test if a value is not-a-number. | |
| bool | ejsIsNativeFunction(Ejs *ejs, EjsAny *obj) |
| Determine if the function is a native function. | |
| bool | ejsIsPot(Ejs *ejs, EjsAny *obj) |
| Determine if a variable is a Pot. | |
| bool | ejsIsPrototype(Ejs *ejs, EjsAny *obj) |
| Determine if a variable is a prototype object. | |
| bool | ejsIsType(Ejs *ejs, EjsAny *obj) |
| Determine if a variable is an type. | |
| bool | ejsIsTypeSubType(Ejs *ejs, EjsType *target, EjsType *baseType) |
| Test if a type is a derived type of a given base type. | |
| bool | ejsIsXML(Ejs *ejs, EjsAny *obj) |
| Determine if a variable is an XML object. | |
| int | ejsJoinArray(Ejs *ejs, EjsArray *dest, EjsArray *src) |
| Join an array. | |
| EjsString* | ejsJoinString(Ejs *ejs, EjsString *s1, EjsString *s2) |
| Join two strings. | |
| EjsString* | ejsJoinStrings(Ejs *ejs, EjsString *src, ...) |
| Join strings. | |
| void | ejsLoadHttpService(Ejs *ejs) |
| Load the Http service. | |
| int | ejsLoadModule(Ejs *ejs, EjsString *name, int minVer, int maxVer, int flags) |
| Load a module. | |
| int | ejsLoadModules(Ejs *ejs, cchar *search, MprList *require) |
| Load modules into an interpreter. | |
| int | ejsLoadScriptFile(Ejs *ejs, cchar *script, cchar *cache, int flags) |
| Load a script from a file. | |
| int | ejsLoadScriptLiteral(Ejs *ejs, EjsString *script, cchar *cache, int flags) |
| Load a script from a string. | |
| void | ejsLoadXMLAsc(Ejs *ejs, EjsXML *xml, cchar *xmlString) |
| Load an XML document from an Ascii string. | |
| void | ejsLoadXMLString(Ejs *ejs, EjsXML *xml, EjsString *xmlString) |
| Load an XML document. | |
| void | ejsLog(Ejs *ejs, cchar *fmt, ...) |
| Enter a message into the log file. | |
| int | ejsLookupItem(Ejs *ejs, EjsArray *ap, EjsAny *item) |
| Lookup an item in the array. | |
| int | ejsLookupPotProperty(Ejs *ejs, EjsPot *obj, EjsName qname) |
| Lookup a property in a Pot. | |
| int | ejsLookupProperty(Ejs *ejs, EjsAny *obj, EjsName qname) |
| Lookup a property by name. | |
| int | ejsLookupScope(Ejs *ejs, EjsName name, EjsLookup *lookup) |
| Lookup a variable using the current scope. | |
| int | ejsLookupVar(Ejs *ejs, EjsAny *obj, EjsName name, EjsLookup *lookup) |
| Lookup a variable. | |
| int | ejsLookupVarWithNamespaces(Ejs *ejs, EjsAny *obj, EjsName name, EjsLookup *lookup) |
| Lookup a variable in an object (only). | |
| bool | ejsMakeRoomInByteArray(Ejs *ejs, EjsByteArray *ba, ssize require) |
| Make room in the byte array for data. | |
| void | ejsManagePot(void *obj, int flags) |
| Mark an object as currently in use. | |
| void | ejsMarkName(EjsName *qname) |
| Mark a name for GC. | |
| bool | ejsMatchName(Ejs *ejs, EjsName *a, EjsName *b) |
| Test if two names match. | |
| EjsName | ejsName(struct Ejs *ejs, cchar *space, cchar *name) |
| Initialize a Qualified Name structure. | |
| struct EjsString* | ejsObjToJSON(Ejs *ejs, EjsObj *obj, int argc, EjsObj **argv) |
| Method proc for conversion to a JSON string. | |
| struct EjsString* | ejsObjToString(Ejs *ejs, EjsObj *obj, int argc, EjsObj **argv) |
| Method proc for conversion to a string. | |
| EjsAny* | ejsParse(Ejs *ejs, MprChar *str, int prefType) |
| Parse a string. | |
| int | ejsPropertyHasTrait(Ejs *ejs, EjsAny *obj, int slotNum, int attributes) |
| Test a property's traits. | |
| EjsString* | ejsRegExpToString(Ejs *ejs, EjsRegExp *rp) |
| Get a string representation of a regular expression. | |
| void | ejsRemoveConstructor(Ejs *ejs, struct EjsType *type) |
| Remove a constructor function from a type. | |
| int | ejsRemoveItem(Ejs *ejs, EjsArray *ap, EjsAny *item) |
| Remove an item from the array. | |
| int | ejsRemoveItemAtPos(Ejs *ejs, EjsArray *ap, int index) |
| Remove an item at a given index from the array. | |
| int | ejsRemoveLastItem(Ejs *ejs, EjsArray *ap) |
| Remove the last item from the array. | |
| int | ejsRemoveObserver(Ejs *ejs, EjsObj *emitter, EjsObj *name, struct EjsFunction *observer) |
| Remove an observer. | |
| int | ejsRemovePotProperty(Ejs *ejs, EjsAny *obj, int slotNum) |
| Remove a property. | |
| void | ejsRemoveWorkers(Ejs *ejs) |
| Remove workers before exiting. | |
| void | ejsReportError(Ejs *ejs, char *fmt, ...) |
| Report an error message using the MprLog error channel. | |
| void | ejsResetByteArray(Ejs *ejs, EjsByteArray *ba) |
| Reset the byte. | |
| int | ejsRun(Ejs *ejs) |
| Run a script. | |
| EjsAny* | ejsRunFunction(Ejs *ejs, EjsFunction *fn, EjsAny *thisObj, int argc, void *argv) |
| Run a function. | |
| EjsAny* | ejsRunFunctionByName(Ejs *ejs, EjsAny *container, EjsName qname, EjsAny *thisObj, int argc, void *argv) |
| Run a function by name. | |
| EjsAny* | ejsRunFunctionBySlot(Ejs *ejs, EjsAny *obj, int slotNum, int argc, void *argv) |
| Run a function by slot number. | |
| EjsObj* | ejsRunInitializer(Ejs *ejs, struct EjsModule *module) |
| Run the initializer for a module. | |
| int | ejsRunProgram(Ejs *ejs, cchar *className, cchar *methodName) |
| Run a program. | |
| char* | ejsSearchForModule(Ejs *ejs, cchar *name, int minVer, int maxVer) |
| Search for a module in the module search path. | |
| int | ejsSendEvent(Ejs *ejs, EjsObj *emitter, cchar *name, EjsAny *thisObj, EjsAny *arg) |
| Send an event to observers. | |
| int | ejsSendEventv(Ejs *ejs, EjsObj *emitter, cchar *name, EjsAny *thisObj, int argc, void *argv) |
| Send an event to observers. | |
| EjsString* | ejsSerialize(Ejs *ejs, EjsAny *obj, int flags) |
| Serialize a variable into JSON format. | |
| EjsString* | ejsSerializeWithOptions(Ejs *ejs, EjsAny *obj, EjsObj *options) |
| Serialize a variable into JSON format. | |
| void | ejsSetByteArrayPositions(Ejs *ejs, EjsByteArray *ba, ssize readPosition, ssize writePosition) |
| Set the I/O byte array positions. | |
| void | ejsSetDispatcher(Ejs *ejs, MprDispatcher *dispatcher) |
| Set the MPR dispatcher to use for an interpreter. | |
| int | ejsSetFunctionCode(Ejs *ejs, EjsFunction *fun, struct EjsModule *module, cuchar *byteCode, ssize len, EjsDebug *debug) |
| Set the byte code for a function. | |
| void | ejsSetHttpLimits(Ejs *ejs, HttpLimits *limits, EjsObj *obj, bool server) |
| Set a Http limits. | |
| int | ejsSetPathAttributes(Ejs *ejs, cchar *path, EjsObj *options) |
| Set the owner, group and permissions of a file. | |
| int | ejsSetProperty(Ejs *ejs, void *obj, int slotNum, void *value) |
| Set a property's value. | |
| int | ejsSetPropertyByName(Ejs *ejs, void *obj, EjsName qname, void *value) |
| Set a property's value. | |
| int | ejsSetPropertyName(Ejs *ejs, EjsAny *obj, int slotNum, EjsName qname) |
| Set a property's name. | |
| int | ejsSetPropertyTraits(Ejs *ejs, EjsAny *obj, int slotNum, struct EjsType *type, int attributes) |
| Set a property's traits. | |
| void | ejsSetSearchPath(Ejs *ejs, struct EjsArray *search) |
| Set the module search path. | |
| void | ejsSetSessionTimeout(Ejs *ejs, EjsSession *sp, MprTime lifespan) |
| Set a session timeout. | |
| EjsXML* | ejsSetXMLElement(Ejs *ejs, EjsXML *xml, int index, EjsXML *node) |
| Set an indexed element to a value. | |
| int | ejsSetupHttpTrace(Ejs *ejs, HttpTrace *trace, EjsObj *options) |
| Setup tracing for Http transactions. | |
| EjsString* | ejsSprintf(Ejs *ejs, cchar *fmt, ...) |
| Format arguments. | |
| int | ejsStartsWithAsc(Ejs *ejs, EjsString *sp, cchar *pat) |
| Test if a string starts with an ascii pattern. | |
| EjsString* | ejsSubstring(Ejs *ejs, EjsString *src, ssize offset, ssize len) |
| Get a substring. | |
| EjsError* | ejsThrowArgError(Ejs *ejs, cchar *fmt, ...) |
| Throw an argument exception. | |
| EjsError* | ejsThrowArithmeticError(Ejs *ejs, cchar *fmt, ...) |
| Throw an math exception. | |
| EjsError* | ejsThrowAssertError(Ejs *ejs, cchar *fmt, ...) |
| Throw an assertion exception. | |
| EjsError* | ejsThrowError(Ejs *ejs, cchar *fmt, ...) |
| Throw an general error exception. | |
| EjsAny* | ejsThrowException(Ejs *ejs, EjsAny *error) |
| Throw an exception. | |
| EjsError* | ejsThrowIOError(Ejs *ejs, cchar *fmt, ...) |
| Throw an IO exception. | |
| EjsError* | ejsThrowInstructionError(Ejs *ejs, cchar *fmt, ...) |
| Throw an instruction code exception. | |
| EjsError* | ejsThrowInternalError(Ejs *ejs, cchar *fmt, ...) |
| Throw an internal error exception. | |
| EjsError* | ejsThrowMemoryError(Ejs *ejs) |
| Throw an Memory depletion exception. | |
| EjsError* | ejsThrowOutOfBoundsError(Ejs *ejs, cchar *fmt, ...) |
| Throw an out of bounds exception. | |
| EjsError* | ejsThrowReferenceError(Ejs *ejs, cchar *fmt, ...) |
| Throw an reference exception. | |
| EjsError* | ejsThrowResourceError(Ejs *ejs, cchar *fmt, ...) |
| Throw an resource exception. | |
| EjsError* | ejsThrowStateError(Ejs *ejs, cchar *fmt, ...) |
| Throw an state exception. | |
| EjsObj* | ejsThrowStopIteration(Ejs *ejs) |
| Throw an stop iteration exception. | |
| EjsString* | ejsThrowString(Ejs *ejs, cchar *fmt, ...) |
| Throw a string message. | |
| EjsError* | ejsThrowSyntaxError(Ejs *ejs, cchar *fmt, ...) |
| Throw an syntax error exception. | |
| EjsError* | ejsThrowTypeError(Ejs *ejs, cchar *fmt, ...) |
| Throw an type error exception. | |
| EjsBoolean* | ejsToBoolean(Ejs *ejs, EjsAny *obj) |
| Cast a variable to a boolean. | |
| EjsString* | ejsToJSON(Ejs *ejs, EjsAny *obj, EjsObj *options) |
| Convert a variable to a string in JSON format. | |
| EjsString* | ejsToLiteralString(Ejs *ejs, EjsObj *obj) |
| Convert a string to a literal string style representation. | |
| EjsString* | ejsToLower(Ejs *ejs, EjsString *sp) |
| Convert a string to lower case. | |
| char* | ejsToMulti(Ejs *ejs, void *obj) |
| Convert an object to a UTF-8 string representation. | |
| struct EjsNumber* | ejsToNumber(Ejs *ejs, EjsAny *obj) |
| Cast a variable to a number. | |
| EjsPath* | ejsToPath(Ejs *ejs, EjsAny *obj) |
| Convert the object to a Path. | |
| EjsString* | ejsToString(Ejs *ejs, EjsAny *obj) |
| Cast a variable to a string. | |
| EjsString* | ejsToUpper(Ejs *ejs, EjsString *sp) |
| Convert a string to upper case. | |
| EjsUri* | ejsToUri(Ejs *ejs, EjsAny *obj) |
| Convert an object to a URI. | |
| EjsString* | ejsTruncateString(Ejs *ejs, EjsString *src, ssize len) |
| Truncate a string. | |
| void | ejsUnblockGC(Ejs *ejs, int blocked) |
| Unblock garbage collection. | |
| EjsName | ejsWideName(struct Ejs *ejs, MprChar *space, MprChar *name) |
| Initialize a Qualified Name structure using a wide namespace and name. | |
| struct EjsNumber* | ejsWriteToByteArray(Ejs *ejs, EjsByteArray *ba, int argc, EjsObj **argv) |
| Write data to the byte array This implements the ByteArray.write function. | |
| int | ejsXMLToBuf(Ejs *ejs, MprBuf *buf, EjsXML *xml, int indentLevel) |
| Convert an xml node to string representation in a buffer. |
Typedefs
| EjsCode | Byte code. |
| EjsConstants | Constant pool for module files. |
| EjsDebug | Debug record for module files. |
| EjsEx | Exception Handler Record. |
| EjsHash | Property hash linkage. |
| EjsHelpers | Allocation and Type Helpers. |
| EjsIntern | Interned string hash shared over all interpreters. |
| EjsLine | Symbolic debugging storage for source code in module files. |
| EjsLookup | Lookup State. |
| EjsNativeCallback | Native module initialization callback. |
| EjsObj | Native Function signature. |
| EjsProperties | Object properties. |
| EjsService | Ejscript Service structure. |
| EjsSlot | Property slot structure. |
| EjsState | VM Evaluation state. |
| EjsTrait | Property traits. |
| EjsXmlTagState | Xml tag state. |
Defines
| #define | _h_EJS_WEB_h 1 |
| ejsWeb.h — Header for the Ejscript Web Framework Copyright (c) All Rights Reserved. | |
| #define | BLD_FEATURE_NUM_TYPE double |
| Configured numeric type. | |
| #define | EBC_POPN 101 |
| ejsByteCodeTable.h - Master Byte Code Table. | |
| #define | EC_BUFSIZE 4096 |
| General buffer size. | |
| #define | EC_CODE_BUFSIZE 4096 |
| Initial size of code gen buffer. | |
| #define | EC_FLAGS_BIND 0x1 |
| ejsLoad flags to bind global references and type/object properties. | |
| #define | EC_FLAGS_DEBUG 0x2 |
| ejsLoad flags to generate symbolic debugging information. | |
| #define | EC_FLAGS_DOC 0x100 |
| ejsLoad flags to parse inline doc. | |
| #define | EC_FLAGS_MERGE 0x8 |
| ejsLoad flags to merge all output onto one output file. | |
| #define | EC_FLAGS_NO_OUT 0x10 |
| ejsLoad flags discard all output. | |
| #define | EC_FLAGS_PARSE_ONLY 0x20 |
| ejsLoad flags to only parse source. | |
| #define | EC_FLAGS_THROW 0x40 |
| ejsLoad flags to throw errors when compiling. | |
| #define | EC_FLAGS_VISIBLE 0x80 |
| ejsLoad flags to make global vars visible to all. | |
| #define | EC_LINE_INCR 1024 |
| Growth increment for input lines. | |
| #define | EC_MAX_ERRORS 25 |
| Max compilation errors before giving up. | |
| #define | EC_MAX_INCLUDE 32 |
| Max number of nested includes. | |
| #define | EC_NUM_PAK_PROP 32 |
| Initial number of properties. | |
| #define | EC_TOKEN_INCR 64 |
| Growth increment for tokens. | |
| #define | EJS_ARENA_SIZE ((1 * 1024 * 1024) - MPR_HEAP_OVERHEAD) |
| Initial virt memory for objects. | |
| #define | EJS_BLEND_DEEP 0x1 |
| Flag for ejsBlendObject to copy nested object recursively. | |
| #define | EJS_BLEND_FUNCTIONS 0x2 |
| Flag for ejsBlendObject to copy function properties. | |
| #define | EJS_BLEND_OVERWRITE 0x4 |
| Flag for ejsBlendObject to overwrite existing properties. | |
| #define | EJS_BLEND_PRIVATE 0x10 |
| Flag for ejsBlendObject to copy private properties. | |
| #define | EJS_BLEND_SUBCLASSES 0x8 |
| Flag for ejsBlendObject to copy subclassed properties. | |
| #define | EJS_BLEND_TRACE 0x20 |
| Flag for ejsBlendObject to trace blend operations to the log. | |
| #define | EJS_CODE_MAGIC 0x91917128 |
| Code record integrity check. | |
| #define | EJS_DEBUG_INCR 16 |
| Growth increment for EjsDebug | |
| #define | EJS_DEBUG_MAGIC 0x78654423 |
| Debug record integrity check. | |
| #define | EJS_DIR_PERMS 0775 |
| Default dir perms. | |
| #define | EJS_DOC_HASH_SIZE 1007 |
| Hash for doc descriptions. | |
| #define | EJS_EX_CATCH 0x1 |
| EjsEx flag for a catch block. | |
| #define | EJS_EX_FINALLY 0x2 |
| EjsEx flag for a finally block. | |
| #define | EJS_EX_INC 4 |
| Growth increment for exception handlers. | |
| #define | EJS_EX_ITERATION 0x4 |
| EjsEx flag for an iteration catch block. | |
| #define | EJS_FILE_PERMS 0664 |
| Default file perms. | |
| #define | EJS_FLAG_DOC 0x40 |
| Load documentation from modules. | |
| #define | EJS_FLAG_EVENT 0x1 |
| Event pending. | |
| #define | EJS_FLAG_HOSTED 0x400 |
| Interp is hosted in a web server. | |
| #define | EJS_FLAG_NO_INIT 0x8 |
| Don't initialize any modules. | |
| #define | EJS_FLAG_NOEXIT 0x200 |
| App should service events and not exit. | |
| #define | EJS_FLAGS_ENUM_ALL 0x2 |
| Enumerate non-enumerable and fixture properties. | |
| #define | EJS_FLAGS_ENUM_INHERITED 0x1 |
| Enumerate inherited base classes. | |
| #define | EJS_FUN_CONSTRUCTOR 0x2000 |
| Method is a constructor. | |
| #define | EJS_FUN_FULL_SCOPE 0x4000 |
| Function needs closure when defined. | |
| #define | EJS_FUN_HAS_RETURN 0x8000 |
| Function has a return statement. | |
| #define | EJS_FUN_INITIALIZER 0x10000 |
| Type initializer code. | |
| #define | EJS_FUN_MODULE_INITIALIZER 0x40000 |
| Module initializer. | |
| #define | EJS_FUN_OVERRIDE 0x20000 |
| Override base type. | |
| #define | EJS_FUN_REST_ARGS 0x80000 |
| Parameter is a "..." rest. | |
| #define | EJS_HASH_MIN_PROP 8 |
| Min props to hash. | |
| #define | EJS_INC_ARGS 8 |
| Frame stack increment. | |
| #define | EJS_INDEX_INCR 256 |
| Constant pool growth increment. | |
| #define | EJS_JSON_SHOW_HIDDEN 0x2 |
| ejsSerialize flag to include hidden properties. | |
| #define | EJS_JSON_SHOW_NAMESPACES 0x4 |
| ejsSerialize flag to include namespaces in names. | |
| #define | EJS_JSON_SHOW_PRETTY 0x8 |
| ejsSerialize flag to render in human-readible multiline format. | |
| #define | EJS_JSON_SHOW_SUBCLASSES 0x1 |
| ejsSerialize flag to include subclass properties. | |
| #define | EJS_LOADER_BUILTIN 0x8 |
| Loading builtins. | |
| #define | EJS_LOADER_DEP 0x10 |
| Loading a dependency. | |
| #define | EJS_LOADER_ETERNAL 0x4 |
| Make all loaded types eternal. | |
| #define | EJS_LOADER_NO_INIT 0x2 |
| Load module code in strict mode. | |
| #define | EJS_LOADER_RELOAD 0x20 |
| Force a reload if already loaded. | |
| #define | EJS_LOADER_STRICT 0x1 |
| Load module code in strict mode. | |
| #define | EJS_LOTSA_PROP 256 |
| Object with lots of properties. | |
| #define | EJS_MAX_ARGS 8192 |
| Max number of args. | |
| #define | EJS_MAX_BASE_CLASSES 256 |
| Max inheritance chain. | |
| #define | EJS_MAX_COLLISIONS 4 |
| Max intern string collion chain. | |
| #define | EJS_MAX_EXCEPTIONS 8192 |
| Max number of exceptions. | |
| #define | EJS_MAX_LOCALS (10*1024) |
| Max number of locals. | |
| #define | EJS_MAX_OBJ_POOL 512 |
| Maximum number of objects per type to cache. | |
| #define | EJS_MAX_POOL (4*1024*1024) |
| Size of constant pool. | |
| #define | EJS_MAX_RECURSION 10000 |
| Maximum recursion. | |
| #define | EJS_MAX_REGEX_MATCHES 32 |
| Maximum regular sub-expressions. | |
| #define | EJS_MAX_SQLITE_MEM (2*1024*1024) |
| Maximum buffering for Sqlite. | |
| #define | EJS_MAX_TRAITS (0x7fff) |
| Max number of declared properties per block. | |
| #define | EJS_MAX_TYPE 256 |
| Maximum number of types. | |
| #define | EJS_MIN_FRAME_SLOTS 16 |
| Miniumum number of slots for function frames. | |
| #define | EJS_NUM_GLOBAL 256 |
| Number of globals slots to pre-create. | |
| #define | EJS_POOL_INACTIVITY_TIMEOUT (60 * 1000) |
| Prune inactive pooled VMs older than this. | |
| #define | EJS_PROP_ENUMERABLE 0x1000 |
| Property will be enumerable (compiler use only). | |
| #define | EJS_PROP_HAS_VALUE 0x200 |
| Property has a value record. | |
| #define | EJS_PROP_NATIVE 0x400 |
| Property is backed by native code. | |
| #define | EJS_PROP_STATIC 0x800 |
| Class static property. | |
| #define | EJS_ROUND_PROP 16 |
| Rounding for growing properties. | |
| #define | EJS_SESSION "-ejs-session-" |
| Default session cookie string. | |
| #define | EJS_SESSION_TIMER_PERIOD (60 * 1000) |
| Timer checks ever minute. | |
| #define | EJS_SQLITE_TIMEOUT 30000 |
| Database busy timeout. | |
| #define | EJS_STACK_MAX (1024 * 32) |
| Stack size without MMU. | |
| #define | EJS_STREAM_BOTH 0x3 |
| Http constant Stream.Both. | |
| #define | EJS_STREAM_READ 0x1 |
| Http constant Stream.Read. | |
| #define | EJS_STREAM_WRITE 0x2 |
| Http constant Stream.Write. | |
| #define | EJS_TRAIT_CAST_NULLS 0x1 |
| Property casts nulls. | |
| #define | EJS_TRAIT_DELETED 0x2 |
| Property has been deleted. | |
| #define | EJS_TRAIT_FIXED 0x8 |
| Property is not configurable. | |
| #define | EJS_TRAIT_GETTER 0x4 |
| Property is a getter. | |
| #define | EJS_TRAIT_HIDDEN 0x10 |
| !Enumerable. | |
| #define | EJS_TRAIT_INITIALIZED 0x20 |
| Readonly property has been initialized. | |
| #define | EJS_TRAIT_MASK 0xFFFFF |
| Mask of trait attributes. | |
| #define | EJS_TRAIT_READONLY 0x40 |
| !Writable (used for const). | |
| #define | EJS_TRAIT_SETTER 0x80 |
| Property is a settter. | |
| #define | EJS_TRAIT_THROW_NULLS 0x100 |
| Property rejects null. | |
| #define | EJS_TYPE_BLOCK 0x40000000 |
| Type is using block helpers. | |
| #define | EJS_TYPE_CALLS_SUPER 0x100000 |
| Constructor calls super(). | |
| #define | EJS_TYPE_DYNAMIC_INSTANCES 0x400000 |
| Instances are not sealed and can add properties. | |
| #define | EJS_TYPE_FINAL 0x800000 |
| Type can't be subclassed. | |
| #define | EJS_TYPE_FIXUP 0x1000000 |
| Type needs to inherit base types properties. | |
| #define | EJS_TYPE_HAS_CONSTRUCTOR 0x2000000 |
| Type has a constructor. | |
| #define | EJS_TYPE_HAS_INSTANCE_VARS 0x200000 |
| Type has non-method instance vars (state). | |
| #define | EJS_TYPE_HAS_TYPE_INITIALIZER 0x4000000 |
| Type has an initializer. | |
| #define | EJS_TYPE_IMMUTABLE_INSTANCES UINT64(0x200000000) |
| Type has immutable instances. | |
| #define | EJS_TYPE_INTERFACE 0x8000000 |
| Type is an interface. | |
| #define | EJS_TYPE_MUTABLE 0x80000000 |
| Type is mutable. | |
| #define | EJS_TYPE_MUTABLE_INSTANCES UINT64(0x100000000) |
| Type has mutable instances. | |
| #define | EJS_TYPE_NUMERIC_INDICIES UINT64(0x800000000) |
| Type is using numeric indicies for properties. | |
| #define | EJS_TYPE_OBJ 0x10000000 |
| Type is using object helpers. | |
| #define | EJS_TYPE_POT 0x20000000 |
| Type is using pot helpers. | |
| #define | EJS_TYPE_VIRTUAL_SLOTS UINT64(0x400000000) |
| Type is unsing virtual slots. | |
| #define | EJS_WORK_QUOTA 1024 |
| Allocations required before garbage colllection. | |
| #define | EJS_WORKER_BEGIN 1 |
| Worker state before starting. | |
| #define | EJS_WORKER_CLOSED 3 |
| Worker state when finished. | |
| #define | EJS_WORKER_COMPLETE 4 |
| Worker state when completed all messages. | |
| #define | EJS_WORKER_STARTED 2 |
| Worker state once started a script. | |
| #define | EJS_XML_ATTRIBUTE 3 |
| XML node is an attribute. | |
| #define | EJS_XML_BUF_MAX (256 * 1024) |
| Max XML document size. | |
| #define | EJS_XML_COMMENT 5 |
| XML node is a comment. | |
| #define | EJS_XML_ELEMENT 2 |
| XML node is an element. | |
| #define | EJS_XML_LIST 1 |
| XML node is a list. | |
| #define | EJS_XML_MAX_NODE_DEPTH 64 |
| Max nesting of tags. | |
| #define | EJS_XML_PROCESSING 6 |
| XML node is a processing instruction. | |
| #define | EJS_XML_TEXT 4 |
| XML node is text. |
Ejs
Ejsript VM Structure.
- Description:
- The Ejs structure contains the state for a single interpreter. The ejsCreateVM routine may be used to create multiple interpreters and returns a reference to be used in subsequent Ejscript API calls.
- API Stability:
- Evolving.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
- Fields:
-
int argc Count of command line args. cchar ** argv Command line args (not alloced). cchar * bootSearch Module search when bootstrapping the VM (not alloced). cchar * className Name of a specific class to run for a program. uint compiling Currently executing the compiler. uint configSet Config properties defined. uint destroying Interpreter is being destroyed. MprDispatcher * dispatcher Event dispatcher. MprHash * doc Documentation. uint dontExit Prevent App.exit() from exiting. uint empty Interpreter will be created empty. char * errorMsg Error message. EjsAny * exception Pointer to exception object. EjsAny * exceptionArg Exception object for catch block. uint exiting VM should exit. int exitStatus Status to exit(). int firstGlobal First global to examine for GC. int flags Execution flags. int gc GC required (don't make bit field). EjsAny * global The "global" object. uint hasError Interpreter has an initialization error. uint hosted Interp is hosted (webserver). char * hostedHome Home directory for hosted HttpServer. Http * http Http service object (copy of EjsService.http). void * httpServer HttpServer instance when VM is embedded. MprList * httpServers Configured HttpServers. uint initialized Interpreter fully initialized and not empty. int joining In Worker.join. void * loadData Arg to load callbacks. cchar * methodName Name of a specific method to run for a program. MprList * modules Loaded modules. MprMutex * mutex Multithread locking. char * name Unique interpreter name. EjsAny * result Last expression result. struct EjsArray * search Module load search path. int serializeDepth Serialization depth. struct EjsService * service Back pointer to the service. int spreadArgs Count of spread args. void * sqlite Sqlite context information. struct EjsState * state Current evaluation state and stack. MprList * workers Worker interpreters.
Add an immutable reference.
- Description:
- Ejscript keeps a set of immutable objects that are shared across virtual machines. This call adds an object to that set. If the object already exists in the immutable set, its slot number if returned.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM slotNum Unique slot number for the object. qname Qualified name for the object. obj Object to store.
- Returns:
- The actual slot number allocated for the object.
- See Also:
- ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Block garbage collection.
- Description:
- Garbage collection requires cooperation from threads. However, the VM will normally permit garbage collection at various points in the execution of byte code. This call block garbage collection while allowing program execution to continue. This is useful for short periods when transient objects are not reachable by the GC marker.
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM
- Returns:
- The previous GC blocked state.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Clear an exception.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM
- See Also:
- ejsAddImmutable, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Clone an ejs virtual machine.
- Description:
- Create a virtual machine interpreter boy cloning an existing interpreter. Cloning is a fast way to create a new interpreter. This saves memory and speeds initialization.
- Parameters:
-
ejs Base VM upon which to base the new VM.
- Returns:
- A new interpreter.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Create an ejs virtual machine.
- Description:
- Create a virtual machine interpreter object to evalute Ejscript programs. Ejscript supports multiple interpreters.
- Parameters:
-
argc Count of command line argumements in argv. argv Command line arguments. flags Optional flags to modify the interpreter behavior. Valid flags are: - EJS_FLAG_COMPILER - Interpreter will compile code from source
- EJS_FLAG_NO_EXE - Don't execute any code. Just compile.
- EJS_FLAG_DOC - Load documentation from modules
- EJS_FLAG_NOEXIT - App should service events and not exit unless explicitly instructed
- Returns:
- A new interpreter.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Evaluate a file.
- Description:
- Evaluate a file containing an Ejscript. This requires linking with the Ejscript compiler library (libec).
- Parameters:
-
path Filename of the script to evaluate.
- Returns:
- Return zero on success. Otherwise return a negative Mpr error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Evaluate a module.
- Description:
- Evaluate a module containing compiled Ejscript.
- Parameters:
-
path Filename of the module to evaluate.
- Returns:
- Return zero on success. Otherwise return a negative Mpr error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Evaluate a script.
- Description:
- Evaluate a script. This requires linking with the Ejscript compiler library (libec).
- Parameters:
-
script Script to evaluate.
- Returns:
- Return zero on success. Otherwise return a negative Mpr error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Instruct the interpreter to exit.
- Description:
- This will instruct the interpreter to cease interpreting any further script code.
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM status Reserved and ignored.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Get the hosting handle.
- Description:
- The interpreter can store a hosting handle. This is typically a web server object if hosted inside a web server.
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM
- Returns:
- Hosting handle.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Get an immutable object.
- Description:
- Ejscript keeps a set of immutable objects that are shared across virtual machines. This call retrieves an immutable object from that set.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM slotNum Unique slot number for the object.
- Returns:
- Obj Immutable object found at the given slotNum.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Get an immutable object by name.
- Description:
- Ejscript keeps a set of immutable objects that are shared across virtual machines. This call retrieves an immutable object from that set.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM qname Qualified name for the object.
- Returns:
- Obj Immutable object found at the given slotNum.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Get a variable by name.
- Description:
- This looks for a property name in an object, its prototype or base classes.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to search. name Property name to search for. lookup Lookup residuals.
- Returns:
- The variable.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Load a script from a file.
- Description:
- This will read a script from a file, compile it and run. If the cache path argument is provided, the compiled module will be saved to this path.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM script Script pathname. cache Cache pathname to save compiled module. flags Compilation control flags. Select from: - EC_FLAGS_BIND - Bind global references and type/object properties
- EC_FLAGS_DEBUG - Generate symbolic debugging information
- EC_FLAGS_MERGE - Merge all output onto one output file
- EC_FLAGS_NO_OUT - Discard all output
- EC_FLAGS_PARSE_ONLY - Only parse source. Don't generate code
- EC_FLAGS_THROW - Throw errors when compiling. Used for eval()
- EC_FLAGS_VISIBLE - Make global vars visible to all
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Load a script from a string.
- Description:
- This will compile the script string and then run it. If the cache path argument is provided, the compiled module will be saved to this path.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM script Script string. cache Cache pathname to save compiled module. flags Compilation control flags. Select from: - EC_FLAGS_BIND - Bind global references and type/object properties
- EC_FLAGS_DEBUG - Generate symbolic debugging information
- EC_FLAGS_MERGE - Merge all output onto one output file
- EC_FLAGS_NO_OUT - Discard all output
- EC_FLAGS_PARSE_ONLY - Only parse source. Don't generate code
- EC_FLAGS_THROW - Throw errors when compiling. Used for eval()
- EC_FLAGS_VISIBLE - Make global vars visible to all
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Enter a message into the log file.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM fmt Message format string.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Lookup a variable using the current scope.
- Description:
- This looks for a property name in the current lexical scope.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM name Property name to search for. lookup Lookup residuals.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Lookup a variable.
- Description:
- This looks for a property name in an object, its prototype or base classes. If name.space is null, the variable is searched using the set of currently open namespaces.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to search. name Property name to search for. lookup Lookup residuals.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Lookup a variable in an object (only).
- Description:
- This looks for a property name in an object, its prototype or base classes. If name.space is null, the variable is searched using the set of currently open namespaces.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to search. name Property name to search for. lookup Lookup residuals.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Report an error message using the MprLog error channel.
- Description:
- This will emit an error message of the format:
- program:line:errorCode:SEVERITY: message
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM fmt Is an alternate printf style format to emit if the interpreter has no valid error message. ... Arguments for fmt.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Run a script.
- Description:
- Run a script that has previously ben compiled by ecCompile.
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM
- Returns:
- Zero if successful, otherwise a non-zero Mpr error code.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
Set the MPR dispatcher to use for an interpreter.
- Description:
- Interpreters serialize event activity within a dispatcher.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetSearchPath, ejsThrowException
Throw an exception.
- Description:
- Throw an exception object.
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM error Exception argument object.
- Returns:
- The exception argument for chaining.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath
Unblock garbage collection.
- Description:
- Unblock garbage collection that was blocked via ejsBlockGC
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM blocked Blocked state to re-establish.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
EjsArray
Array class.
- Description:
- Arrays provide a resizable, integer indexed, in-memory store for objects. An array can be treated as a stack (FIFO or LIFO) or a list (ordered). Insertions can be done at the beginning or end of the stack or at an indexed location within a list. The Array class can store objects with numerical indicies and can also store any named properties. The named properties are stored in the obj field, whereas the numeric indexed values are stored in the data field. Array extends EjsObj and has all the capabilities of EjsObj
- API Stability:
- Evolving.
- See Also:
- ejsAddItem, ejsClearArray, ejsCloneArray, ejsCreateArray, ejsGetFirstItem, ejsGetItem, ejsGetLastItem, ejsGetNextItem, ejsGetPrevItem, ejsInsertItem, ejsJoinArray, ejsLookupItem, ejsRemoveItem, ejsRemoveItemAtPos, ejsRemoveLastItem
- Fields:
-
EjsObj ** data Array elements. int length Array length property. EjsPot pot Property storage.
Add an item to the array.
- Description:
- This will add a new item to the end of the array and grow the array if required.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Array to modify. item Object item to add.
- Returns:
- The item index in the array.
Clear an array and remove all items.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify.
Clone an array.
- Description:
- This will create a new array and copy the contents from the source array. Both array elements and object properties are copied. If deep is true, the call creates a distinct clone with no shared elements. If deep is false, object references will be copied and shared between the source and cloned array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Array source. deep Set to true to clone each element of the array. Otherwise object references will have their references copied and not the reference targets.
- Returns:
- A new array.
Create an array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM size Initial size of the array.
- Returns:
- A new array object.
Get the first item from an array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to examine.
- Returns:
- The item.
Get an item from an array.
- Description:
- This will retrieve the item at the index location.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to examine. index Location to retrieve.
- Returns:
- The item.
Get the last item from an array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to examine.
- Returns:
- The item.
Get the next item from an array.
- Description:
- This will retrieve the item at *next and increment *next.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to examine. next Pointer to an integer index. The *next location is updated to prepare to advance to the next element. The *next location should be initialized to zero for the first call to an ejsGetNextItem sequence.
- Returns:
- The item.
Get the previous item from an array.
- Description:
- This will retrieve the item at *prev and increment *prev.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to examine. prev Pointer to an integer index. The *prev location is updated to prepare to advance to the previous element. The *prev location should be initialized to zero for the first call to an ejsGetPrevItem sequence.
- Returns:
- The item.
Insert an item.
- Description:
- This will insert an item at the given index. Items at the index and above will be moved upward to make room for the inserted item.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify. index Index at which to insert the item. The item will be inserted at the "index" position. item Item to insert.
- Returns:
- The index.
Join an array.
- Description:
- This will append the contents of the source array to the destination array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM dest Destination array to modify. src Source array from which to copy elements.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
Lookup an item in the array.
- Description:
- This search for the given item (reference) in the array. NOTE: currently numbers are implemented as object references and so using this routine to search for a number reference will not work.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to examine. item Item to search for.
- Returns:
- A positive array element index. Otherwise return MPR_ERR_CANT_FIND.
Remove an item from the array.
- Description:
- This will remove an item from the array. The array will not be compacted.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify. item Item to remove.
- Returns:
- The index where the item was found. Otherwise return MPR_ERR_CANT_FIND.
Remove an item at a given index from the array.
- Description:
- This will remove an item from the array. The array will not be compacted.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify. index Array index from which to remove the item.
- Returns:
- The index where the item was found. Otherwise return MPR_ERR_CANT_FIND.
Remove the last item from the array.
- Description:
- This will remove the last item from the array. The array will not be compacted.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify.
- Returns:
- The index where the item was found. Otherwise return MPR_ERR_CANT_FIND.
EjsBlock
Block class.
- Description:
- The block class is the base class for all program code block scope objects. This is an internal class and not exposed to the script programmer. Blocks (including types) may describe their properties via traits. The traits store the property type and access attributes and are stored in EjsBlock which is a sub class of EjsObj. See ejsBlock.c for details.
- API Stability:
- Evolving.
- See Also:
- ejsBindFunction, ejsIsBlock
- Fields:
-
uint breakCatch Return, break or continue in a catch block. MprList namespaces Current list of namespaces open in this block of properties. uint nobind Don't bind to properties in this block. EjsPot pot Property storage. struct EjsBlock * prev Previous block in activation chain. EjsObj * prevException Previous exception if nested exceptions. struct EjsBlock * scope Lexical scope chain for this block. EjsObj ** stackBase Start of stack in this block.
Determine if a variable is a block.
- Description:
- This call tests if the variable is a block.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is based on EjsBlock.
- See Also:
- EjsBlock, ejsBindFunction
EjsBoolean
Boolean class.
- Description:
- The Boolean class provides the base class for the boolean values "true" and "false". EjsBoolean is a primitive native type and extends EjsObj. It is still logically an Object, but implements Object properties and methods itself. Only two instances of the boolean class are ever created created these are referenced as ejs->trueValue and ejs->falseValue.
- API Stability:
- Evolving.
- See Also:
- ejsCreateBoolean, ejsGetBoolean, ejsToBoolean
Create a boolean.
- Description:
- Create a boolean value. This will not actually create a new boolean instance as there can only ever be two boolean instances (true and false). Boolean properties are immutable in Ejscript and so this routine will simply return the appropriate pre-created true or false boolean value.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value Desired boolean value. Set to 1 for true and zero for false.
- See Also:
- EjsBoolean, ejsGetBoolean, ejsToBoolean
Get the C boolean value from a boolean object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Boolean variable to access.
- Returns:
- True or false.
- See Also:
- EjsBoolean, ejsCreateBoolean, ejsToBoolean
Cast a variable to a boolean.
- Description:
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to cast.
- Returns:
- A new boolean object.
- See Also:
- EjsBoolean, ejsCreateBoolean, ejsGetBoolean
EjsByteArray
ByteArray class.
- Description:
- ByteArrays provide a resizable, integer indexed, in-memory store for bytes. ByteArrays can be used as a simple array type to store and encode data as bytes or they can be used as buffered Streams implementing the Stream interface.
When used as a simple byte array, the ByteArray class offers a low level set of methods to insert and extract bytes. The index operator [] can be used to access individual bytes and the copyIn and copyOut methods can be used to get and put blocks of data. In this mode, the read and write position properties are ignored. Access to the byte array is from index zero up to the size defined by the length property. When constructed, the ByteArray can be designated as resizable, in which case the initial size will grow as required to accomodate data and the length property will be updated accordingly.
When used as a Stream, the byte array additional write methods to store data at the location specified by the $writePosition property and read methods to read from the $readPosition property. The $available method indicates how much data is available between the read and write position pointers. The $reset method can reset the pointers to the start of the array. When used with for/in, ByteArrays will iterate or enumerate over the available data between the read and write pointers.
If numeric values are read or written, they will be encoded according to the value of the endian property which can be set to either LittleEndian or BigEndian.
In Stream mode ByteArrays can be configured to run in sync or async mode. Adding observers via the $addObserver method will put a stream into async mode. Events will then be issued for close, EOF, read and write events.
- API Stability:
- Evolving.
- See Also:
- ejsCopyToByteArray, ejsCreateByteArray, ejsGetByteArrayAvailableData, ejsGetByteArrayRoom, ejsGrowByteArray, ejsMakeRoomInByteArray, ejsResetByteArray, ejsSetByteArrayPositions, ejsWriteToByteArray
- Fields:
-
int async Async mode. EjsObj * emitter Event emitter for listeners. int endian Endian encoding. int growInc Current read position. ssize length Length property. EjsObj obj Base object. ssize readPosition Current read position. bool resizable Aray is resizable. int swap I/O must swap bytes due to endian byte ordering. uchar * value Data bytes in the array. ssize writePosition Current write position.
Copy data into a byte array.
- Description:
- Copy data into a byte array at a specified offset.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ba Byte array object. offset Offset in the byte array to which to copy the data. data Pointer to the source data. length Length of the data to copy.
- Returns:
- Count of bytes written or negative MPR error code.
Create a byte array.
- Description:
- Create a new byte array instance.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM size Initial size of the byte array.
- Returns:
- A new byte array instance.
Get the number of available bytes.
- Parameters:
-
ba Byte array to examine.
- Returns:
- The number of bytes of data available to read.
Determine the spare room in the byte array for more data.
- Parameters:
-
ba Byte array to examine.
- Returns:
- The number of bytes the byte array can fit without growing.
Grow the byte array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ba Byte array to grow. size The requested new size of the byte array.
- Returns:
- The new size of the byte array. Otherwise EJS_ERROR if the memory cannot be allocated.
Make room in the byte array for data.
- Description:
- This will ensure there is sufficient room in the byte array. If the required number of bytes of spare room is not available, the byte array will grow.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ba Byte array to examine. require Number of bytes needed.
- Returns:
- The number of bytes of data available to read.
Reset the byte.
- Description:
- This will reset the byte array read/write positions if the array is empty.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ba Byte array to modify.
Set the I/O byte array positions.
- Description:
- Set the read and/or write positions into the byte array. ByteArrays implement the Stream interface and support sequential and random access reading and writing of data in the array. The byte array maintains read and write positions that are automatically updated as data is read or written from or to the array.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ba Byte array object. readPosition New read position to set. writePosition New write position to set.
Write data to the byte array This implements the ByteArray.write function.
It is most useful for other types to implement a write to byte array capability- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ba Byte array to examine. argc Count of args in argv. argv Arguments to write.
- Returns:
- The number of bytes of data written (EjsNumber).
EjsCache
EjsCache.
- See Also:
- ejsCacheExpire, ejsCacheRead, ejsCacheReadObj, ejsCacheRemove, ejsCacheWrite, ejsCacheWriteObj
- Fields:
-
Expire a cache item.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. key Cache item key. when When to expire the cache item.
- Returns:
- Returns Null.
- See Also:
- ejsCacheRead, ejsCacheReadObj, ejsCacheRemove, ejsCacheWrite, ejsCacheWriteObj
Read an item from the cache.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. key Cache item key. options Cache read options.
- Returns:
- String cache item.
- See Also:
- ejsCacheExpire, ejsCacheReadObj, ejsCacheRemove, ejsCacheWrite, ejsCacheWriteObj
Read an object from the cache.
- Description:
- This call reads a cache item and then deserializes using JSON encoding into an object.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. key Cache item key. options Cache read options.
- Returns:
- Cache item object.
- See Also:
- ejsCacheExpire, ejsCacheRead, ejsCacheRemove, ejsCacheWrite, ejsCacheWriteObj
Read an item from the cache.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. key Cache item key.
- Returns:
- String cache item.
- See Also:
- ejsCacheExpire, ejsCacheRead, ejsCacheReadObj, ejsCacheWrite, ejsCacheWriteObj
Set the cache limits.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. limits Limits is an object hash. Depending on the cache backend in-use, the limits object may have some of the following properties. Consult the documentation for the actual cache backend for which properties are supported by the backend. - keys Maximum number of keys in the cache. Set to zero for no limit.
- lifespan Default time in seconds to preserve key data. Set to zero for no timeout.
- memory Total memory to allocate for cache keys and data. Set to zero for no limit.
- retries Maximum number of times to retry I/O operations with cache backends.
- timeout Maximum time to transact I/O operations with cache backends. Set to zero for no timeout.
- Returns:
- String cache item.
Write an item to the cache.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. key Cache item key. value Value to write. options Cache write options - lifespan Preservation time for the key in seconds.
- expire When to expire the key. Takes precedence over lifetime.
- mode Mode of writing: "set" is the default and means set a new value and create if required. "add" means set the value only if the key does not already exist. "append" means append to any existing value and create if required. "prepend" means prepend to any existing value and create if required.
- version Unique version identifier to be used for a conditional write. The write will only be performed if the version id for the key has not changed. This implements an atomic compare and swap.
- throw Throw an exception rather than returning null if the version id has been updated for the key.
- Returns:
- String cache item.
- See Also:
- ejsCacheExpire, ejsCacheRead, ejsCacheReadObj, ejsCacheRemove, ejsCacheWriteObj
Write an object to the cache.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM cache Cache object. key Cache item key. value Value to write. options Cache write options - lifespan Preservation time for the key in seconds.
- expire When to expire the key. Takes precedence over lifetime.
- mode Mode of writing: "set" is the default and means set a new value and create if required. "add" means set the value only if the key does not already exist. "append" means append to any existing value and create if required. "prepend" means prepend to any existing value and create if required.
- version Unique version identifier to be used for a conditional write. The write will only be performed if the version id for the key has not changed. This implements an atomic compare and swap.
- throw Throw an exception rather than returning null if the version id has been updated for the key.
- Returns:
- String cache item.
- See Also:
- ejsCacheExpire, ejsCacheRead, ejsCacheReadObj, ejsCacheRemove, ejsCacheWrite
EjsCmd
Cmd class.
- Fields:
-
int argc Length of argv. char ** argv Actual argv when invoking the command. int async Async mode. EjsAny * command Command to run. Ejs * ejs Interpreter back link. EjsObj * emitter Event emitter for listeners. EjsAny * env Optional environment. struct EjsByteArray * error Error stream. MprCmd * mc MprCmd object. EjsAny * options Command options object. EjsPot pot Property storage. MprBuf * stderrBuf Stderr from the command. MprBuf * stdoutBuf Stdout from the command. int throw Set to true if the command should throw exceptions for failures. MprTime timeout Command timeout in milliseconds.
EjsDate
Date class.
- Description:
- The Date class is a general purpose class for working with dates and times. is a a primitive native type and extends EjsObj. It is still logically an Object, but implements Object properties and methods itself.
- API Stability:
- Evolving.
- See Also:
- ejsCreateDate, ejsGetDate
- Fields:
-
EjsObj obj Object base. MprTime value Time in milliseconds since "1970/01/01 GMT".
Create a new date instance.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value Date/time value to set the new date instance to.
- Returns:
- An initialized date instance.
- See Also:
- EjsDate, ejsGetDate
Get the numeric value stored in a EjsDate object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM date Date object to examine.
- Returns:
- An MprTime value.
- See Also:
- EjsDate, ejsCreateDate
EjsError
Error classes.
- Description:
- Base class for error exception objects. Exception objects are created by programs and by the system as part of changing the normal flow of execution when some error condition occurs. When an exception is created and acted upon ("thrown"), the system transfers the flow of control to a pre-defined instruction stream (the handler or "catch" code). The handler may return processing to the point at which the exception was thrown or not. It may re-throw the exception or pass control up the call stack.
- API Stability:
- Evolving.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
- Fields:
-
Capture the execution stack.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM skip How many levels of stack to skip before capturing (counts from the top down).
- Returns:
- Array of stack records.
- See Also:
- ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Create an error object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM type Error base type. message Error message to use when constructing the error object.
- Returns:
- Error object.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Get the interpreter error message.
- Description:
- Return a string containing the current interpreter error message.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM withStack Set to 1 to include a stack backtrace in the error message.
- Returns:
- A string containing the error message. The caller must not free.
- See Also:
- ejsCaptureStack, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Get the Ejs exception object for this interpreter.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- The exception object if one exists, otherwise NULL.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Determine if an exception has been thrown.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- True if an exception has been thrown.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Test if the given object is an error instance.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- True if the object is an error.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an argument exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an math exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an assertion exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an general error exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an instruction code exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an internal error exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an IO exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an Memory depletion exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an out of bounds exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an reference exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an resource exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an state exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw an stop iteration exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowString, ejsThrowSyntaxError, ejsThrowTypeError
Throw a string message.
This will not capture the stack as part of the exception message- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowSyntaxError, ejsThrowTypeError
Throw an syntax error exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowTypeError
Throw an type error exception.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Printf style format string to use for the error message. ... Message arguments.
- See Also:
- ejsCaptureStack, ejsGetErrorMsg, ejsGetException, ejsHasException, ejsIsError, ejsThrowArgError, ejsThrowArithmeticError, ejsThrowAssertError, ejsThrowError, ejsThrowIOError, ejsThrowInstructionError, ejsThrowInternalError, ejsThrowMemoryError, ejsThrowOutOfBoundsError, ejsThrowReferenceError, ejsThrowResourceError, ejsThrowStateError, ejsThrowStopIteration, ejsThrowString, ejsThrowSyntaxError
EjsFile
File class.
- Description:
- The File class provides a foundation of I/O services to interact with physical files and directories. Each File object represents a single file or directory and provides methods for creating, opening, reading, writing and deleting files, and for accessing and modifying information about the file.
- API Stability:
- Evolving.
- See Also:
- ejsCreateFile, ejsCreateFileFromFd
- Fields:
-
int attached Attached to existing descriptor. Ejs * ejs Interp reference. MprFile * file Open file handle. MprPath info Cached file info. int mode Current open mode. char * modeString User supplied mode string. EjsObj obj Base object. char * path Filename path. int perms Posix permissions mask.
Create a File object.
- Description:
- Create a file object associated with the given filename. The filename is not opened, just stored.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM filename Filename to associate with the file object.
- Returns:
- A new file object.
- See Also:
- EjsFile, ejsCreateFileFromFd
Create a file object from an O/S file descriptor.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fd O/S file descriptor handle. name Filename to associate with the file object. mode O/S file access mode (see man 2 open).
- Returns:
- A new file object.
- See Also:
- EjsFile, ejsCreateFile
EjsFileSystem
FileSystem class.
- Description:
- The FileSystem class provides file system services.
- API Stability:
- Evolving.
- See Also:
- EjsFile, ejsCreateFile
- Fields:
-
MprFileSystem * fs MPR file system object. EjsObj obj Base object. char * path Filename path.
EjsFrame
Frame record.
- See Also:
- ejsIsFrame
- Fields:
-
uint argc Actual parameter count. uchar * attentionPc Restoration PC value after attention. struct EjsFrame * caller Previous invoking frame. EjsFunction function Activation frame for function calls. Stores local variables. uint getter Frame is a getter. EjsLine * line Debug source line. EjsFunction * orig Original function frame is based on. uchar * pc Program counter. int slotNum Slot in owner. EjsObj ** stackBase Start of stack in this function. EjsObj ** stackReturn Top of stack to return to.
Determine if a variable is a frame.
Only used internally in the VM- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is a frame.
- See Also:
EjsFunction
Function class.
- Description:
- The Function type is used to represent closures, function expressions and class methods. It contains a reference to the code to execute, the execution scope and possibly a bound "this" reference.
- API Stability:
- Evolving.
- See Also:
- ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
- Fields:
-
EjsPot * activation Function properties. uint allowMissingArgs Allow unsufficient args for native functions. struct EjsType * archetype Type to use to create instances. struct EjsArray * boundArgs Bound "args". EjsAny * boundThis Bound "this" object value. uint castNulls Cast return values of null. EjsCode * code Byte code. int endFunction Offset in mod file for end of function. uint fullScope Closures must capture full scope. uint hasReturn Has a return stmt. uint inCatch Executing catch block. uint inException Executing catch/finally exception processing. uint isConstructor Is a constructor. uint isInitializer Is a type initializer. uint isNativeProc Is native procedure. uint moduleInitializer Is a module initializer. EjsString * name Parameter and local properties. uint numArgs Count of formal parameters. uint numDefault Count of formal parameters with default initializers. EjsProc proc Native function pointer. uint rest Has a "..." rest of args parameter. struct EjsType * resultType Return type of method. struct EjsFunction * setter Function name. Setter function for this property. uint staticMethod Is a static method. uint strict Language strict mode (vs standard). uint throwNulls Return type cannot be null.
Add an exception record.
- Description:
- This creates an exception record to define a catch or finally block.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function to modify. tryStart Pointer to the bytecode start of try block. tryEnd Pointer to one past the end of the try block. catchType Type of error to catch. Set to null for all. handlerStart Pointer to the start of the catch / finally block. handlerEnd Pointer ot one past the end of the catch / finally block. numBlocks Count of blocks opened before the try block. numStack Count of stack slots pushed before the try block. flags MOB. preferredIndex Preferred index in the function exceptions list. Set to -1 for the next available slot.
- Returns:
- The allocated exception object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Clone a function.
- Description:
- Copy a function and create a new copy. This may do a shallow or deep copy. A shallow copy will not copy the property instances, rather it will only duplicate the property reference. A deep copy will recursively clone all the properties of the variable.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function to clone. deep Set to true to clone each property of the function. Otherwise object references will have their references copied and not the reference targets.
- Returns:
- The allocated activation object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Create an activation record for a function.
- Description:
- This creates an activation object that stores the local variables for a function This is a onetime operation and is not done for each function invocation.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function to examine. numSlots Number of local variables to reserve room for.
- Returns:
- The allocated activation object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Create a bare function.
- Description:
- This creates a function without code, exceptions or module linkage.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM name Function name. attributes Function attributes.
- Returns:
- The allocated function.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Create a code block.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function to examine. module Module owning the function. byteCode ByteCode buffer. len Size of the byteCode buffer. debug Debug record with symbolic debug information.
- Returns:
- An allocated code block.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Create a function object.
- Description:
- This creates a function object and optionally associates byte code with the function.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM name Function name used in stack backtraces. code Pointer to the byte code. The byte code is not copied so this must be a persistent pointer. codeLen Length of the code. numArgs Number of formal arguments to the function. numDefault Number of default args to the function. numExceptions Number of exception handlers. returnType Return type of the function. Set to NULL for no defined type. attributes Integer mask of access attributes. module Reference to the module owning the function. scope Reference to the chain of blocks that that comprises the lexical scope chain for this function. strict Run code in strict mode (vs standard).
- Returns:
- An initialized function object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Initialize a function object.
- Description:
- This initializes a pre-existing function object and optionally associates byte code with the function. This is useful to create constructors which are stored inside type objects.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function object. name Function name used in stack backtraces. code Pointer to the byte code. The byte code is not copied so this must be a persistent pointer. codeLen Length of the code. numArgs Number of formal arguments to the function. numDefault Number of default args to the function. numExceptions Number of exception handlers. returnType Return type of the function. Set to NULL for no defined type. attributes Integer mask of access attributes. module Reference to the module owning the function. scope Reference to the chain of blocks that that comprises the lexical scope chain for this function. strict Run code in strict mode (vs standard).
- Returns:
- An initialized function object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Determine if a variable is a function.
This will return true if the variable is a function of any kind, including methods, native and script functions or initializers- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to test.
- Returns:
- True if the variable is a function.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Determine if the function is an initializer.
Initializers are special functions created by the compiler to do static and instance initialization of classes during construction- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is an initializer.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Determine if the function is a native function.
Functions can be either native - meaning the implementation is via a C function, or can be scripted- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is a native function.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Remove a constructor function from a type.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM type Type reference.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Run a function.
- Description:
- Run a function with the given actual parameters.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fn Function object to run. thisObj Object to use as the "this" object when running the function. argc Count of actual parameters. argv Vector of actual parameters.
- Returns:
- The return value from the function. If an exception is thrown, NULL will be returned and ejs->exception will be set to the exception object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Run a function by name.
- Description:
- Run a function identified by name in the given container with the given actual parameters.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM container Object that holds the function at its "name". qname Qualified name for the function in container. thisObj Object to use as "this" when invoking the function. argc Count of actual parameters. argv Vector of actual parameters.
- Returns:
- The return value from the function. If an exception is thrown, NULL will be returned and ejs->exception will be set to the exception object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Run a function by slot number.
- Description:
- Run a function identified by slot number with the given actual parameters. This will run the function stored at slotNum in the obj variable.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object that holds the function at its "slotNum" slot. Also use this object as the "this" object when running the function. slotNum Slot number in obj that contains the function to run. argc Count of actual parameters. argv Vector of actual parameters.
- Returns:
- The return value from the function. If an exception is thrown, NULL will be returned and ejs->exception will be set to the exception object.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunInitializer, ejsRunInitializer
Run the initializer for a module.
- Description:
- A module's initializer runs global code defined in the module.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM module Module object reference.
- Returns:
- The last expression result of global code executed.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot
Set the byte code for a function.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function to examine. module Module owning the function. byteCode ByteCode buffer. len Size of the byteCode buffer. debug Debug record with symbolic debug information.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
EjsHttp
Http Class.
- Description:
- API Stability:
- Evolving.
- Fields:
-
char * certFile SSL certificate file. int closed Http is closed and "close" event has been issued. HttpConn * conn Http connection object. EjsByteArray * data Buffered write data. Ejs * ejs Interp reference. EjsObj * emitter Event emitter. int error Http errored and "error" event has been issued. char * keyFile SSL key file. EjsObj * limits Limits object. char * method HTTP method. EjsObj obj Base object. ssize readCount Count of body bytes read. MprBuf * requestContent Request body data supplied. ssize requestContentCount Count of bytes written from requestContent. EjsString * responseCache Cached response (only used if response() is used). MprBuf * responseContent Response data. char * uri Target uri. ssize writeCount Count of bytes written via write().
Create a new Http object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- A new Http object.
Get a Http limits.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to contain the limits properties. limits The HttpLimits object. server Set to true if defining server side limits.
- See Also:
- EjsHttp, ejsCreateHttp, ejsLoadHttpService, ejsSetHttpLimits, ejsSetupHttpTrace
Set a Http limits.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM limits The HttpLimits object receiving the limit settings. obj Object containing the limits values. server Set to true if defining server side limits.
- See Also:
- EjsHttp, ejsCreateHttp, ejsGetHttpLimits, ejsLoadHttpService, ejsSetupHttpTrace
EjsHttpServer
HttpServer Class.
- Description:
- API Stability:
- Prototype.
- See Also:
- ejsCloneHttpServer
- Fields:
-
int async Async mode. char * certFile SSL certificate file. char * ciphers SSL ciphers. struct EjsHttpServer * cloned Server that was cloned. cchar * connector Pipeline connector. Ejs * ejs Ejscript interpreter handle. EjsObj * emitter Event emitter. HttpEndpoint * endpoint Http endpoint object. int hosted Server being hosted inside a web server. EjsArray * incomingStages Incoming Http pipeline stages. char * ip Listening address. char * keyFile SSL key file. EjsObj * limits Limits object. char * name Server name. EjsArray * outgoingStages Outgoing Http pipeline stages. int port Listening port. EjsPot pot Extends Object. char * protocols SSL protocols. struct MprSsl * ssl SSL configuration. HttpTrace trace[2] Default tracing for requests.
Clone a http server.
- Parameters:
-
ejs Ejs interpreter handle returned from $ejsCreate. server HttpServer object. deep Ignored.
- Returns:
- A new server object.
- See Also:
- EjsHttpServer
EjsIterator
Iterator Class.
- Description:
- Iterator is a helper class to implement iterators in other native classes.
- API Stability:
- Evolving.
- See Also:
- ejsCreateIterator
Create an iterator object.
- Description:
- The EjsIterator object is a helper class for native types to implement iteration and enumeration.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM target Target variable to iterate or enumerate. next Function to invoke to step to the next element. deep Set to true to do a deep iteration/enumeration. namespaces Reserved and not used. Supply NULL.
- Returns:
- A new EjsIterator object.
- See Also:
- EjsIterator
EjsModule
Module control structure.
- Fields:
-
int checksum Checksum of slots and names. struct EcCodeGen * code Code generation buffer. uint compiling Module currently being compiled from source. uint configured Module types have been configured with native code. EjsConstants * constants Constant pool. MprList * current Current stack of open objects. EjsFunction * currentMethod Current method being loaded. MprList * dependencies Module file dependencies. List of EjsModules. EjsString * doc Current doc string. MprFile * file File handle for loading and code generation. int firstGlobal First global property. int flags Loading flags. MprList * globalProperties List of global properties. uint hasError Module has a loader error. uint hasInitializer Has initializer function. uint hasNative Has native property definitions. uint initialized Initializer has run. EjsFunction * initializer Initializer method. int lastGlobal Last global property + 1. uint loaded Module has been loaded from an external file. EjsLoadState * loadState State while loading. int maxVersion Maximum version when used as a dependency. int minVersion Minimum version when used as a dependency. MprMutex * mutex Multithread locking. EjsString * name Name of this module - basename of the filename without .mod extension. uint nativeLoaded Backing shared library loaded. char * path Module file path name. EjsBlock * scope Lexical scope chain. int version Made with EJS_MAKE_VERSION. uint visited Module has been traversed. MprList * vms List of VMs referencing the module. EjsString * vname Versioned name - name with optional version suffix.
Create a search path array.
This can be used in ejsCreate- Description:
- Create and array of search paths.
- Parameters:
-
ejs Ejs interpreter. searchPath Search path string. This is a colon (or semicolon on Windows) separated string of directories.
- Returns:
- An array of search paths.
- See Also:
- ejsLoadModule, ejsLoadModules, ejsSearchForModule, ejsSetSearchPath
Load a module.
- Description:
- This will emit an error message of the format:
- program:line:errorCode:SEVERITY: message
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM name Module path name. maxVer Maximum acceptable version to load. Use EJS_MAKE_VERSION to create a version number or set to -1 if any version is acceptable. minVer Minimum acceptable version to load. Use EJS_MAKE_VERSION to create a version number or set to -1 if any version is acceptable. flags Module loading flags. Select from: EJS_LOADER_STRICT, EJS_LOADER_NO_INIT, EJS_LOADER_ETERNAL, EJS_LOADER_BUILTIN, EJS_LOADER_DEP, EJS_LOADER_RELOAD.
- Returns:
- A postitive slot number or a negative MPR error code.
Load modules into an interpreter.
- Description:
- Initialize an interpreter by loading modules. A list of modules to load can be provided via the "require" argument. If the "require" argument is set to null, then the default modules will be loaded. If "require" is set to a list of module names, these will be loaded. If set to an empty list, then no modules will be loaded and the interpreter will be marked as an "empty" interpreter.
- Parameters:
-
ejs Interpreter to modify. search Module search path to use. Set to NULL for the default search path. require Optional list of required modules to load. If NULL, the following modules will be loaded: ejs, ejs.io, ejs.events, ejs.xml, ejs.sys and ejs.unix.
- Returns:
- Zero if successful, otherwise return a negative MPR error code.
Search for a module in the module search path.
- Parameters:
-
ejs Interpeter object returned from ejsCreateVM name Module name. minVer Minimum acceptable version to load. Use EJS_MAKE_VERSION to create a version number or set to -1 if any version is acceptable. maxVer Maximum acceptable version to load. Use EJS_MAKE_VERSION to create a version number or set to -1 if any version is acceptable.
- Returns:
- Path name to the module.
- See Also:
- ejsCreateSearchPath, ejsLoadModule, ejsLoadModules, ejsSetSearchPath
Set the module search path.
- Description:
- Set the ejs module search path. The search path is by default set to the value of the EJSPATH environment directory. Ejsript will search for modules by name. The search strategy is: Given a name "a.b.c", scan for:
- File named a.b.c
- File named a/b/c
- File named a.b.c in EJSPATH
- File named a/b/c in EJSPATH
- File named c in EJSPATH
- Parameters:
-
ejs Ejs interpreter. search Array of search paths.
- See Also:
- ejsCreateSearchPath, ejsLoadModule, ejsLoadModules, ejsSearchForModule
EjsName
Qualified name structure.
- Description:
- All names in Ejscript consist of a property name and a name space. Namespaces provide discrete spaces to manage and minimize name conflicts. These names will soon be converted to unicode.
- API Stability:
- Evolving.
- See Also:
- ejsMarkName
- Fields:
-
struct EjsString * name Property name. struct EjsString * space Property namespace.
Initialize a Qualified Name structure.
- Description:
- Initialize the statically allocated qualified name structure using a name and namespace.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM space Namespace string. name Name string.
- Returns:
- A reference to the qname structure.
- See Also:
- EjsName, ejsMarkName
Initialize a Qualified Name structure using a wide namespace and name.
- Description:
- Initialize the statically allocated qualified name structure using a name and namespace.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM space Namespace string. name Name string.
- Returns:
- A reference to the qname structure.
- See Also:
- EjsName, ejsMarkName
EjsNamespace
Namespace Class.
- Description:
- Namespaces are used to qualify names into discrete spaces.
- API Stability:
- Evolving.
- See Also:
- ejsCreateNamespace, ejsCreateReservedNamespace, ejsDefineReservedNamespace, ejsFormatReservedNamespace
- Fields:
-
EjsObj obj Base object. EjsString * value Textual name of the namespace.
Create a namespace object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM name Space name to use for the namespace.
- Returns:
- A new namespace object.
Create a reserved namespace.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM typeName Type on which to base the formatted namespace name. name Formatted base name for the namespace.
- Returns:
- A new namespace object.
Define a reserved namespace on a block.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM block Block to modify. typeName Type on which to base the formatted namespace name. name Formatted base name for the namespace. block Block to modify.
- Returns:
- A new namespace object.
Format a reserved namespace name to create a unique namespace.
- Description:
- This is used to extend the "internal", "public", "private", and "protected" namespaces to be unique for their owning class.
Namespaces are formatted as strings using the following format, where type is optional. Types may be qualified. [type,space]
Example: [debug::Shape,public] where Shape was declared as "debug class Shape".
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM typeName Type on which to base the formatted namespace name. spaceName Namespace name.
- Returns:
- A string containing the formatted name.
EjsNull
Null Class.
- Description:
- The Null class provides the base class for the singleton null instance. This instance is stored in ejs->nullValue.
- API Stability:
- Evolving.
- See Also:
- ejsCreateNull
- Fields:
-
Create the null object.
- Description:
- There is one null object in the system.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- The null object.
- See Also:
- EjsNull
EjsNumber
Number class.
- Description:
- The Number class provide the base class for all numeric values. The primitive number storage data type may be set via the configure program to be either double, float, int or int64.
- API Stability:
- Evolving.
- See Also:
- ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsIsNan, ejsToNumber
- Fields:
-
EjsObj obj Base object. MprNumber value Numeric value.
Create a number object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value Numeric value to initialize the number object.
- Returns:
- A number object.
- See Also:
- EjsNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsIsNan, ejsToNumber
Get the numeric value stored in a EjsNumber object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- A double value.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsIsNan, ejsToNumber
Get the numeric value stored in a EjsNumber object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- An integer value.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetDouble, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsIsNan, ejsToNumber
Get an 64 bit integer value equivalent to that stored in an EjsNumber object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- A 64 bit integer value.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetNumber, ejsIsInfinite, ejsIsNan, ejsToNumber
Get the numeric value stored in a EjsNumber object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- A numeric value.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsIsInfinite, ejsIsNan, ejsToNumber
Test if a number is infinite.
- Parameters:
-
n Number to test.
- Returns:
- True if the number is infinite.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsNan, ejsToNumber
Test if a value is not-a-number.
- Parameters:
-
n Number to test.
- Returns:
- True if the number is not-a-number.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsToNumber
Cast a variable to a number.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to cast.
- Returns:
- A number object.
- See Also:
- EjsNumber, ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsIsNan
EjsObj
Base object from which all objects inherit.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
- Fields:
-
ssize xtype xtype: typeBits | dynamic << 1 | visited.
Add an observer.
- Description:
- Add an observer for events when implementing the createVar helper.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM emitterPtr Reference to an emitter. If the reference location is NULL, a new emitter will be created and passed back via *emitterPtr. name Name of events to observe. Can be an array of events. observer Function to run when selected events are triggered.
- Returns:
- Zero if successful.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreat