Ejscript API API
Extensions
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. |
EjsWebSocket | WebSocket 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 | ejsAppendArray(Ejs *ejs, EjsArray *dest, EjsArray *src) |
Append an array. | |
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, wchar *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, int length, 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, cchar *home, cchar *documents) |
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, cchar *pattern, cchar *flags) |
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, MprSocket *sock, bool async) |
Create a new Socket object. | |
EjsString * | ejsCreateString(Ejs *ejs, wchar *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, int flags) |
Ejs * | ejsCreateVM(int argc, cchar **argv, int flags) |
Create an ejs virtual machine. | |
EjsWebSocket * | ejsCreateWebSocket(Ejs *ejs) |
Create a new WebSocket object. | |
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. | |
EjsArray * | ejsGetPathFiles(Ejs *ejs, EjsPath *path, int argc, EjsAny **argv) |
Get files below a path. | |
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, MprTicks 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, wchar *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. | |
EjsString * | ejsJoinArray(Ejs *ejs, EjsArray *ap, EjsString *join) |
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, wchar *str, int prefType) |
Parse a string. | |
EjsRegExp * | ejsParseRegExp(Ejs *ejs, EjsString *pattern) |
Parse a string and create a regular expression object. | |
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, int compact) |
Remove an item from the array. | |
int | ejsRemoveItemAtPos(Ejs *ejs, EjsArray *ap, int index, int compact) |
Remove an item at a given index from the array. | |
EjsArray * | ejsRemoveItems(Ejs *ejs, EjsArray *ap, EjsArray *items) |
Remove items 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. | |
cchar * | 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, MprTicks 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, wchar *space, wchar *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. |
EjsProc | 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 | |
#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_BLEND_ADD 0x80 |
Flag for ejsBlendObject for "+" property blend. | |
#define | EJS_BLEND_ASSIGN 0x200 |
Flag for ejsBlendObject for "=" property blend. | |
#define | EJS_BLEND_COMBINE 0x1 |
Flag for ejsBlendObject to combine key values. | |
#define | EJS_BLEND_COND_ASSIGN 0x400 |
Flag for ejsBlendObject for "?" property blend. | |
#define | EJS_BLEND_DEEP 0x2 |
Flag for ejsBlendObject to copy nested object recursively. | |
#define | EJS_BLEND_FUNCTIONS 0x4 |
Flag for ejsBlendObject to copy function properties. | |
#define | EJS_BLEND_OVERWRITE 0x8 |
Flag for ejsBlendObject to overwrite existing properties. | |
#define | EJS_BLEND_PRIVATE 0x20 |
Flag for ejsBlendObject to copy private properties. | |
#define | EJS_BLEND_PUBLIC 0x800 |
Flag for ejsBlendObject for blending into public properties. | |
#define | EJS_BLEND_SUB 0x100 |
Flag for ejsBlendObject for "-" property blend. | |
#define | EJS_BLEND_SUBCLASSES 0x10 |
Flag for ejsBlendObject to copy subclassed properties. | |
#define | EJS_BLEND_TRACE 0x40 |
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_COMMAS 0x1 |
ejsSerialize flag to always put commas after properties. | |
#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_NOQUOTES 0x20 |
ejsSerialize flag to omit quotes if property has no spaces. | |
#define | EJS_JSON_SHOW_NULLS 0x80 |
ejsSerialize flag to emit null properties. | |
#define | EJS_JSON_SHOW_PRETTY 0x8 |
ejsSerialize flag to render in human-readible multiline format. | |
#define | EJS_JSON_SHOW_REGEXP 0x40 |
ejsSerialize flag to emit native RegExp literals. | |
#define | EJS_JSON_SHOW_SUBCLASSES 0x10 |
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 before rehash. | |
#define | EJS_MAX_EXCEPTIONS 8192 |
Max number of exceptions. | |
#define | EJS_MAX_LOCALS (10*1024) |
Max number of locals. | |
#define | EJS_MAX_POOL (4*1024*1024) |
Size of constant pool. | |
#define | EJS_MAX_TRAITS (0x7fff) |
Max number of declared properties per block. | |
#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_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_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_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_PROCESSING 6 |
XML node is a processing instruction. | |
#define | EJS_XML_TEXT 4 |
XML node is text. | |
#define | ME_MAX_EJS_STACK (1024 * 32) |
Stack size without MMU. | |
#define | ME_NUM_TYPE double |
Configured numeric type. |
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.
- See Also:
- ejsAddImmutable, ejsClearException, ejsCloneVM, ejsCreateVM, ejsEvalFile, ejsEvalModule, ejsEvalScript, ejsExit, ejsGetImmutable, ejsGetImmutableByName, ejsGetVarByName, ejsLog, ejsLookupScope, ejsLookupVar, ejsLookupVarWithNamespaces, ejsReportError, ejsRun, ejsRunProgram, ejsSetDispatcher, ejsSetSearchPath, ejsThrowException
- API Stability:
- Internal.
- Fields:
-
uint abandoned Pooled VM is released awaiting GC
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 * hostedDocuments Documents directory for hosted HttpServer. 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.
- See Also:
- ejsAddItem, ejsAppendArray, ejsClearArray, ejsCloneArray, ejsCreateArray, ejsGetFirstItem, ejsGetItem, ejsGetLastItem, ejsGetNextItem, ejsGetPrevItem, ejsInsertItem, ejsLookupItem, ejsRemoveItem, ejsRemoveItemAtPos, ejsRemoveLastItem
- API Stability:
- Internal.
- 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.
Append 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.
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 join the array elements using the given join string separator.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify. join String to use as a delimiter between elements.
- Returns:
- The result string.
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. compact Set to true to compact following properties.
- 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. compact Set to true to compact following properties.
- Returns:
- The index where the item was found. Otherwise return MPR_ERR_CANT_FIND.
Remove items from the array.
- Description:
- This will remove items from the array. The array will be compacted.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM ap Source array to modify. items Array items to remove.
- Returns:
- The original array.
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.
- See Also:
- ejsBindFunction, ejsIsBlock
- API Stability:
- Internal.
- Fields:
-
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. uchar * restartAddress Restart instruction address. 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.
- See Also:
- ejsCreateBoolean, ejsGetBoolean, ejsToBoolean
- API Stability:
- Internal.
- Fields:
-
EjsObj obj Base object. bool value Boolean value.
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.
- See Also:
- ejsCopyToByteArray, ejsCreateByteArray, ejsGetByteArrayAvailableData, ejsGetByteArrayRoom, ejsGrowByteArray, ejsMakeRoomInByteArray, ejsResetByteArray, ejsSetByteArrayPositions, ejsWriteToByteArray
- API Stability:
- Internal.
- Fields:
-
int async Async mode. EjsObj * emitter Event emitter for listeners. int endian Endian encoding. int growInc Current read position. EjsObj obj Base object. ssize readPosition Current read position. bool resizable Aray is resizable. ssize size Size property. 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.
- API Stability:
- Internal.
- Fields:
-
int argc Length of argv. cchar ** 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. MprTicks 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.
- See Also:
- ejsCreateDate, ejsGetDate
- API Stability:
- Internal.
- 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.
- See Also:
- ejsCreateFile, ejsCreateFileFromFd
- API Stability:
- Internal.
- 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.
- See Also:
- EjsFile, ejsCreateFile
- API Stability:
- Internal.
- Fields:
-
MprFileSystem * fs MPR file system object. EjsObj obj Base object. char * path Filename path.
EjsFrame
Frame record.
- See Also:
- ejsIsFrame
- API Stability:
- Internal.
- 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.
- See Also:
- ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
- API Stability:
- Internal.
- 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 Reserved. 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:
Http objects represents a Hypertext Transfer Protocol version 1.1 client connection and are used HTTP requests and capture responses. This class supports the HTTP/1.1 standard including methods for GET, POST, PUT, DELETE, OPTIONS, and TRACE. It also supports Keep-Alive and SSL connections.
- API Stability:
- Internal.
- Fields:
-
char * caFile SSL CA certificate file. 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. MprSsl * ssl SSL configuration. 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:
HttpServer objects represents a Hypertext Transfer Protocol version 1.1 client connection and are used HTTP requests and capture responses. This class supports the HTTP/1.1 standard including methods for GET, POST, PUT, DELETE, OPTIONS, and TRACE. It also supports Keep-Alive and SSL connections.
- 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 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.
- See Also:
- ejsCreateIterator
- API Stability:
- Internal.
- Fields:
-
bool deep Iterator deep (recursively over all properties). int index Current index. EjsObj * indexVar Reference to current item. int length Collection length prior to iteration. EjsArray * namespaces Namespaces to consider in iteration. EjsProc nativeNext Native next function. EjsObj obj Base object. EjsObj * target Object to be enumerated.
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. length Length of collection prior to iteration. 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.
- API Stability:
- Internal.
- 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. 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.
- See Also:
- ejsMarkName
- API Stability:
- Internal.
- 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.
- See Also:
- ejsCreateNamespace, ejsCreateReservedNamespace, ejsDefineReservedNamespace, ejsFormatReservedNamespace
- API Stability:
- Internal.
- 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.
- 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:
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.
- See Also:
- ejsCreateNumber, ejsGetDouble, ejsGetInt, ejsGetInt64, ejsGetNumber, ejsIsInfinite, ejsIsNan, ejsToNumber
- API Stability:
- Internal.
- 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
- API Stability:
- Internal.
- 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, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Allocate a new variable.
- Description:
- This will allocate space for a bare variable. This routine should only be called by type factories when implementing the createVar helper.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM type Type object from which to create an object instance. extra Size of extra property slots to reserve. This is used for dynamic objects.
- Returns:
- A newly allocated variable of the requested type. Caller must not free as the GC will manage the lifecycle of the variable.
- See Also:
- ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Cast a variable to a new type.
- Description:
- Cast a variable and return a new variable of the required type.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to cast. type Type to cast to.
- Returns:
- A newly allocated variable of the requested type. Caller must not free as the GC will manage the lifecycle of the variable.
- See Also:
- ejsAlloc, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Clone a variable.
- Description:
- Copy a variable 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 Interpreter instance returned from ejsCreateVM obj Object to clone. deep Set to true to do a deep copy.
- Returns:
- A newly allocated variable of the requested type. Caller must not free as the GC will manage the lifecycle of the variable.
- See Also:
- ejsAlloc, ejsCastType, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Copy an object.
- Description:
- Copy an object create a new instance. This may do a shallow or deep copy depending on the value of deep. 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 Interpreter instance returned from ejsCreateVM src Source object to copy. deep Set to true to do a deep copy.
- Returns:
- A newly allocated object. Caller must not free as the GC will manage the lifecycle of the variable.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Compact an object.
- Description:
- This removes deleted properties and compacts property slot references.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to compact.
- Returns:
- The number of properties in the object.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Create an empty property object.
- Description:
- Create a simple object using Object as its base type.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM
- Returns:
- A new object instance.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Create a new variable instance.
- Description:
- Create a new variable instance and invoke any required constructors with the given arguments.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM type Type from which to create a new instance. argc Count of args in argv. argv Vector of arguments. Each arg is an EjsAny.
- Returns:
- A newly allocated variable of the requested type. Caller must not free as the GC will manage the lifecycle of the variable.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Create a variable.
- Description:
- Create a variable of the required type. This invokes the createVar helper method for the specified type.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM type Type to cast to. numSlots Size of extra property slots to reserve. This is used for dynamic objects.
- Returns:
- A newly allocated variable of the requested type. Caller must not free as the GC will manage the lifecycle of the variable.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Create an object instance of the specified type.
- Description:
- Create a new object using the specified type as a base class. Note: the constructor is not called. If you require the constructor to be invoked, use ejsCreateInstance.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM type Base type to use when creating the object instance. size Number of extra slots to allocate when creating the object.
- Returns:
- A new object instance.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Define a property.
- Description:
- Define a property in a variable and give it a name, base type, attributes and default value.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object in which to define a property. slotNum Slot number in the variable for the property. Slots are numbered sequentially from zero. Set to -1 to request the next available slot number. qname Qualified name containing a name and a namespace. type Base type of the property. Set to ejs->voidType to leave as untyped. attributes Attribute traits. value Initial value of the property.
- Returns:
- A postitive slot number or a negative MPR error code.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Delete a property.
- Description:
- Delete a variable's property and set its slot to null. The slot is not reclaimed and subsequent properties are not compacted.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable in which to delete the property. slotNum Slot number in the variable for the property to delete.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Delete a property by name.
- Description:
- Delete a variable's property by name and set its slot to null. The property is resolved by using ejsLookupProperty with the specified name. Once deleted, the slot is not reclaimed and subsequent properties are not compacted.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable in which to delete the property. qname Qualified name for the property including name and namespace.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Deserialize a JSON encoded string.
- Description:
- This is the calling signature for C Functions.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM str JSON string to deserialize.
- Returns:
- Returns an allocated object equivalent to the supplied JSON encoding.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get a count of properties in a variable.
- Description:
- Get a property from a variable at a given slot.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine.
- Returns:
- A positive integer count of the properties stored by the variable.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get a property.
- Description:
- Get a property from a variable at a given slot.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to examine. slotNum Slot number for the requested property.
- Returns:
- The variable property stored at the nominated slot.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get a property by name.
- Description:
- Get a property from a variable by name.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to examine. qname Qualified name specifying both a namespace and name.
- Returns:
- The variable property stored at the nominated slot.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get a variable property's name.
- Description:
- Get a property name for the property at a given slot in the variable.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to examine. slotNum Slot number for the requested property.
- Returns:
- The qualified property name including namespace and name. Caller must not free.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get a property's traits.
- Description:
- Get a property's trait description. The property traits define the properties base type, and access attributes.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine. slotNum Slot number for the requested property.
- Returns:
- A trait structure reference for the property.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Grow a pot object.
- Description:
- Grow the property storage for an object. Object properties are stored in slots. To store more properties, you need to grow the slots.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object reference to grow. numSlots New minimum count of properties. If size is less than the current number of properties, the call will be ignored, i.e. it will not shrink objects.
- Returns:
- Zero if successful.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Invoke an opcode on a native type.
- Description:
- Invoke an Ejscript byte code operator on the specified variable given the expression right hand side. Native types would normally implement the invokeOperator helper function to respond to this function call.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine. opCode Byte ope code to execute. rhs Expression right hand side for binary expression op codes. May be null for other op codes.
- Returns:
- The result of the op code or NULL if the opcode does not require a result.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Default implementation for operator invoke.
- Description:
- Invoke an Ejscript byte code operator on the specified variable given the expression right hand side.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine. opCode Byte ope code to execute. rhs Expression right hand side for binary expression op codes. May be null for other op codes.
- Returns:
- The result of the op code or NULL if the opcode does not require a result.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Lookup a property by name.
- Description:
- Search for a property by name in the given variable.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine. qname Qualified name of the property to search for.
- Returns:
- The slot number containing the property. Then use $ejsGetProperty to retrieve the property or alternatively use ejsGetPropertyByName to lookup and retrieve in one step.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Mark an object as currently in use.
- Description:
- Mark an object as currently active so the garbage collector will preserve it. This routine should be called by native types that extend EjsObj in their markVar helper.
- Parameters:
-
obj Object to mark as currently being used. flags manager flags.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Parse a string.
- Description:
- This parses a string and intelligently interprets the data type.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM str String to parse. prefType Preferred type. Set to the reserved type slot number. E.g. S_Number, S_String etc.
- Returns:
- Returns an allocated object. Returns undefined if the input cannot be parsed.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Remove an observer.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM emitter Emitter created via ejsAddObserver name Name of observed events. Can be an array of events. observer Observer function provided to ejsAddObserver
- Returns:
- Zero if successful.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Send an event to observers.
- Description:
- This call allows one argument to pass to the observer. If you need to pass more, use ejsSendEventv
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM emitter Emitter object. name Name of event to fire. thisObj Object to use for "this" when invoking the observer. arg Argument to pass to the observer.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Send an event to observers.
- Description:
- This call allows multiple arguments to be passed to the observer. If you only need to pass one, use ejsSendEvent
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM emitter Emitter object. name Name of event to fire. thisObj Object to use for "this" when invoking the observer. argc Argument count of argv. argv Arguments to pass to the observer.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Set a property's value.
- Description:
- Set a value for a property at a given slot in the specified variable.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to examine. slotNum Slot number for the requested property. value Reference to a value to store.
- Returns:
- The slot number of the property updated.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Set a property's value.
- Description:
- Set a value for a property. The property is located by name in the specified variable.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to examine. qname Qualified property name. value Reference to a value to store.
- Returns:
- The slot number of the property updated.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyName, ejsSetPropertyTraits
Set a property's name.
- Description:
- Set a qualified name for a property at the specified slot in the variable. The qualified name consists of a namespace and name - both of which must be persistent. A typical paradigm is for these name strings to be owned by the memory context of the variable.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine. slotNum Slot number of the property in the variable. qname Qualified property name.
- Returns:
- The slot number of the property updated.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyTraits
Set a property's traits.
- Description:
- Set the traits describing a property. These include the property's base type and access attributes.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Variable to examine. slotNum Slot number of the property in the variable. type Base type for the property. Set to NULL for an untyped property. attributes Integer mask of access attributes.
- Returns:
- The slot number of the property updated.
- See Also:
- ejsAlloc, ejsCastType, ejsClone, ejsCreateInstance, ejsCreateObj, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetLength, ejsGetProperty, ejsGetPropertyByName, ejsGetPropertyName, ejsGetPropertyTraits, ejsInvokeOperator, ejsInvokeOperatorDefault, ejsLookupProperty, ejsParse, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName
EjsPath
Path class.
- Description:
- The Path class provides file path name services.
- See Also:
- EjsFile, ejsCreatePath, ejsCreatePathFromAsc, ejsToPath
- API Stability:
- Internal.
- Fields:
-
MprList * files File list for enumeration. MprPath info Cached file info. EjsObj obj Base object. cchar * value Filename path.
Create a FileSystem object.
- Description:
- Create a file system object associated with the given pathname.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM path Path to describe the file system. Can be any path in the file system.
- Returns:
- A new file system object.
- See Also:
- EjsFile, ejsCreatePath, ejsCreatePathFromAsc, ejsToPath
Create a Path object.
- Description:
- Create a path object associated with the given pathname.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM path Path object.
- Returns:
- A new Path object.
- See Also:
- EjsFile, ejsCreatePathFromAsc, ejsToPath
Create a Path object.
- Description:
- Create a path object from the given ascii path string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM path Null terminated Ascii pathname.
- Returns:
- A new Path object.
- See Also:
- EjsFile, ejsCreatePath, ejsToPath
Load the Http service.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- See Also:
- EjsFile, ejsCreatePath, ejsCreatePathFromAsc, ejsToPath
Set the owner, group and permissions of a file.
- Description:
- Convert the object to a string and then to a Path.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM path Path name to modify. options Owner, group and permissions options. - permissions optional Posix permissions number mask. Defaults to 0664.
- owner String representing the file owner
- group String representing the file group
- Returns:
- A new Path object.
- See Also:
- EjsFile, ejsCreatePath, ejsCreatePathFromAsc, ejsToPath
Setup tracing for Http transactions.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM trace HttpTrace object. options Trace options.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsFile, ejsCreatePath, ejsCreatePathFromAsc, ejsToPath
Convert the object to a Path.
- Description:
- Convert the object to a string and then to a Path.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to convert.
- Returns:
- A new Path object.
- See Also:
- EjsFile, ejsCreatePath, ejsCreatePathFromAsc
EjsPool
Cached pooled of virtual machines.
- See Also:
- ejsAllocPoolVM, ejsCreatePool, ejsFreePoolVM
- API Stability:
- Internal.
- Fields:
-
int count Count of allocated VMs. char * hostedDocuments Documents directory for hosted HttpServer. char * hostedHome Home directory for hosted HttpServer. MprTicks lastActivity When a VM was last used. MprList * list Free list. int max Maximum number of VMs. MprMutex * mutex Multithread lock. char * startScript Template initialization literal script. char * startScriptPath Template initialization script filename. Ejs * template VM template to clone. char * templateScript Template initialization script filename. MprEvent * timer VM prune timer.
Allocate a VM from the pool.
- Parameters:
-
pool EjsPool reference. flags Reserved.
- Returns:
- Returns an Ejs VM instance.
- See Also:
- ejsCreatePool, ejsFreePoolVM
Create a pool for virutal machines.
- Description:
- Parameters:
-
poolMax Maximum number of VMs in the pool. templateScript Script to execute to initialize a template VM from which all VMs in the pool will be cloned. This is executed only once when the pool is created. This is typically used to pre-load modules. startScript Startup script literal. This script is executed each time the VM is allocated from the pool. startScriptPath As an alternative to startScript, a path to a script may be provided in startScriptPath. If startScriptPath is specified, startScript is ignored. home Default home directory for virtual machines. documents Default documents directory for virtual machines.
- Returns:
- Allocated pool object.
- See Also:
- ejsAllocPoolVM, ejsFreePoolVM
Free a VM back to the pool.
- Parameters:
-
pool EjsPool reference. ejs Ejs reference returned from ejsCreateVM
- See Also:
- ejsAllocPoolVM, ejsCreatePool
EjsPot
Object with properties Type.
- Description:
- The EjsPot type is the foundation for types, blocks, functions and scripted classes. It provides storage and hashed lookup for properties.
EjsPots may be either dynamic or sealed. Dynamic objects can grow the number of properties. Sealed objects cannot. Sealed objects will store the properties as part of the EjsPot memory chunk. Dynamic objects will perform a separate allocation for the properties that it can grow.
EjsPot stores properties in an array of slots. These slots store the property name and a reference to the property value. Dynamic objects own their own name hash. Sealed object instances of a type, will refer to the hash of names owned by the type.
- See Also:
- ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
- API Stability:
- Internal.
- Fields:
-
uint isBlock Instance is a block. uint isFrame Instance is a frame. uint isFunction Instance is a function. uint isPrototype Object is a type prototype object. uint isType Instance is a type object. int numProp Object properties. EjsObj obj Base object. uint separateHash Object has separate hash memory. uint separateSlots Object has separate slots[] memory. uint shortScope Don't follow type or base classes.
Blend objects.
- Description:
- Merge one object into another. This is useful for inheriting and optionally overwriting option hashes (among other things). The blending is done at the primitive property level. If overwrite is true, the property is replaced. If overwrite is false, the property will be added if it does not already exist index worthwhile.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM dest Destination object. src Source object. flags Select from: - EJS_BLEND_DEEP - to copy nested objects recursively
- EJS_BLEND_FUNCTIONS - to copy function properties
- EJS_BLEND_OVERWRITE - to overwrite existing properties in the destination when copying from source
- EJS_BLEND_SUBCLASSES - to copy subclasses in src
- EJS_BLEND_PRIVATE - to copy private properties
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Check the slot.
- Description:
- Check the slot refers to a valid property.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to index. slotNum Slot number to check.
- Returns:
- The slotNum if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Cast the operands as required by the operation code.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM lhs Left-hand-side of operation. opcode Operation byte code. rhs Right-hand-side of operation.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Create the Pot helpers.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Fix traits.
- Description:
- Fix the trait type references to point to mutable types in the current interpreter. This is needed after cloning the global object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to fixup.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get the preferred hash size.
- Parameters:
-
numProp Number of properties to hash.
- Returns:
- A positive hash size integer.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Get a property name.
- Description:
- Get the name of the property at the given slot.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to index. slotNum Slot number of property to examine.
- Returns:
- EjsName for the property.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Make or remake a property index.
- Description:
- Make a hash lookup of properties. This will be skipped if there are insufficient properties to make the index worthwhile.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to index.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Insert properties.
- Description:
- Insert properties at the given offset.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM pot Object to modify. numSlots Number of slots to insert at offset. offset Slot offset in pot.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Determine if a variable is a Pot.
- Description:
- This call tests if the variable is a Pot.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is based on EjsPot.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Lookup a property in a Pot.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to index. qname Property name to look for.
- Returns:
- If successful, return the slot number of the propert in obj. Otherwise return -1.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Test if two names match.
- Description:
- This tests if two names are equivalent.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM a First name to test. b Second name to test.
- Returns:
- True if the names are equivalent.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Method proc for conversion to a JSON string.
- Description:
- This method provides the default conversion to a JSON string implementation.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to convert to a JSON string. argc Ignored. argv Ignored.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Method proc for conversion to a string.
- Description:
- This method provides the default conversion to a string implementation.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to convert to a string. argc Ignored. argv Ignored.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsParse, ejsPropertyHasTrait, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Test a property's traits.
- Description:
- Make a hash lookup of properties. This will be skipped if there are insufficient properties to make the index worthwhile.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine. slotNum Property slot number in obj to examine. attributes Attribute mask to test with the selected property's traits.
- Returns:
- A mask of the selected attributes. Returns zero if none match.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsRemovePotProperty, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
Remove a property.
- Description:
- Remove a property and compact previous properties. WARNING: this should only be used by the compiler.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to index. slotNum Property slot number to remove.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsPot, ejsAlloc, ejsBlendObject, ejsCast, ejsCheckSlot, ejsClone, ejsClonePot, ejsCoerceOperands, ejsCompactPot, ejsCreateEmptyPot, ejsCreateInstance, ejsCreatePot, ejsCreatePotHelpers, ejsDefineProperty, ejsDeleteProperty, ejsDeletePropertyByName, ejsDeserialize, ejsFixTraits, ejsGetHashSize, ejsGetPotPropertyName, ejsGetProperty, ejsGrowPot, ejsIndexProperties, ejsInsertPotProperties, ejsIsPot, ejsLookupPotProperty, ejsLookupProperty, ejsManagePot, ejsMatchName, ejsObjToJSON, ejsObjToString, ejsParse, ejsPropertyHasTrait, ejsSetProperty, ejsSetPropertyByName, ejsSetPropertyName, ejsSetPropertyTraits
EjsRegExp
RegExp Class.
- Description:
- The regular expression class provides string pattern matching and substitution.
- See Also:
- ejsCreateRegExp, ejsRegExpToString
- API Stability:
- Internal.
- Fields:
-
void * compiled Compiled pattern (not alloced). int endLastMatch End of the last match (one past end). bool global Search for pattern globally (multiple times). bool ignoreCase Do case insensitive matching. EjsString * matched Last matched component. bool multiline Match patterns over multiple lines. EjsObj obj Base object. int options Pattern matching options. wchar * pattern Pattern to match. int startLastMatch Start of the last match.
Create a new regular expression object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM pattern Regular expression pattern string. The regular expression string should not contain the leading or trailing slash. Embedded slash characters should not be back-quoted. flags Regular expression flags. Support flags include "g" for global match, "i" to ignore case, "m" match over multiple lines, "y" for sticky match.
- Returns:
- A EjsRegExp object.
- See Also:
- EjsRegExp, ejsRegExpToString
Parse a string and create a regular expression object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM pattern Regular expression pattern string.
- Returns:
- A EjsRegExp object.
- See Also:
- EjsRegExp, ejsCreateRegExp, ejsRegExpToString
Get a string representation of a regular expression.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM rp Regular expression.
- Returns:
- A string representation of a regular expression. The result will be of the format: "/PATTERN/suffixes".
- See Also:
- EjsRegExp, ejsCreateRegExp
EjsRequest
Request Class.
- Description:
Request objects represent a single Http request.
- API Stability:
- Prototype.
- See Also:
- ejsCloneRequest, ejsCreateRequest
- Fields:
-
EjsObj * absHome Absolute URI to the home of the application from this request. struct EjsRequest * cloned Request that was cloned. int closed Request closed and "close" event has been issued. EjsObj * config Request config environment. HttpConn * conn Underlying Http connection object. EjsObj * cookies Cached cookies. EjsPath * dir Home directory containing the application. int dontAutoFinalize Suppress auto-finalization. Ejs * ejs Ejscript interpreter handle. EjsObj * emitter Event emitter. EjsObj * env Request.env. int error Request errored and "error" event has been issued. EjsPath * filename Physical resource filename. EjsObj * files Files object. int finalized Request has written all output data. EjsString * formData Form data as a stable, sorted string. EjsObj * headers Headers object. EjsUri * home Relative URI to the home of the application from this request. EjsString * host Host property. EjsObj * limits Limits object. EjsObj * log Log object. EjsObj * originalUri Saved original URI. EjsObj * params Form variables + routing variables. EjsString * pathInfo PathInfo property. EjsNumber * port Port property. EjsPot pot Base object storage. int probedSession Determined if a session exists. EjsString * query Query property. EjsString * reference Reference property. EjsObj * responseHeaders Headers object. EjsObj * route Matching route in route table. int running Request has started. EjsString * scheme Scheme property. EjsString * scriptName ScriptName property. EjsHttpServer * server Owning server. struct EjsSession * session Current session. EjsUri * uri Complete uri. EjsByteArray * writeBuffer Write buffer for capturing output. ssize written Count of data bytes written to the client.
Clone a request into another interpreter.
- Parameters:
-
ejs Ejs interpreter handle returned from $ejsCreate. req Original request to copy. deep Ignored.
- Returns:
- A new request object.
- See Also:
- EjsRequest, ejsCreateRequest
Create a new request.
Create a new request object associated with the given Http connection- Parameters:
-
ejs Ejs interpreter handle returned from $ejsCreate. server EjsHttpServer owning this request. conn Http connection object. dir Default directory containing web documents.
- Returns:
- A new request object.
- See Also:
- EjsRequest, ejsCloneRequest
EjsSession
Session Class.
- Description:
Session objects represent a shared session state object into which Http Requests and store and retrieve data that persists beyond a single request.
- API Stability:
- Prototype.
- See Also:
- ejsDestroySession, ejsGetSession
- Fields:
-
Destroy as session.
This destroys the session object so that subsequent requests will need to establish a new session- Parameters:
-
ejs Ejs interpreter handle returned from $ejsCreate. session Session object created via ejsGetSession()
- See Also:
- EjsSession, ejsGetSession
Get a session object for a given key.
This will create a session if the given key is NULL or has expired- Parameters:
-
ejs Ejs interpreter handle returned from $ejsCreate. key String containing the session ID. timeout Timeout to use for the session if one is created. create Create a new session if an existing session cannot be found or it has expired.
- Returns:
- A new session object.
- See Also:
- EjsSession, ejsDestroySession
Set a session timeout.
- Parameters:
-
ejs Ejs interpreter handle returned from $ejsCreate. sp Session object. lifespan Lifespan in milliseconds.
- See Also:
- EjsSession, ejsDestroySession, ejsGetSession
EjsSocket
Socket Class.
- Description:
- See Also:
- ejsCreateSocket
- API Stability:
- Internal.
- Fields:
-
char * address Remote address. int async In async mode. EjsByteArray * data Buffered write data. Ejs * ejs Interp reference. EjsObj * emitter Event emitter. int mask IO event mask. MprMutex * mutex Multithread sync. EjsObj obj Base object. int port Remote port. MprSocket * sock Underlying MPR socket object.
Create a new Socket object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sock Socket object. async True if running in async non-blocking mode.
- Returns:
- A new Socket object.
- See Also:
- EjsSocket
EjsString
String Class.
- Description:
- The String class provides the base class for all strings. Each String object represents a single immutable linear sequence of characters. Strings have operators for: comparison, concatenation, copying, searching, conversion, matching, replacement, and, subsetting.
Strings are currently sequences of Unicode characters. Depending on the configuration, they may be 8, 16 or 32 bit code point values.
- See Also:
- ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
- API Stability:
- Internal.
- Fields:
-
ssize length Length of string. struct EjsString * next Next string in hash chain link when interning. struct EjsObj obj Base object. struct EjsString * prev Prev string in hash chain. wchar value[ARRAY_FLEX] String value.
Parse a string and convert to an integer.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp String to parse. radix Radix for parsing the string.
- Returns:
- Integer representation of the string.
- See Also:
- EjsString, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Compare a string with a multibyte string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM s1 First string. s2 Null terminated Ascii string.
- Returns:
- Return zero if the strings are identical. Return -1 if s1 is less than s2. Otherwise return 1.
- See Also:
- EjsString, ejsAtoi, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Compare two strings.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM s1 First string. s2 Second string.
- Returns:
- Return zero if the strings are identical. Return -1 if s1 is less than s2. Otherwise return 1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Compare a substring.
- Description:
- This call compares the first string with a substring in the second.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM s1 First string to compare. s2 Second string. offset Offset in string to take the substring. len Length of the substring.
- Returns:
- Return zero if the strings are identical. Return -1 if s1 is less than s2. Otherwise return 1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Compare a string with a wide string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM s1 First string. s2 Wide string. len Maximum length in characters to compare.
- Returns:
- Return zero if the strings are identical. Return -1 if s1 is less than s2. Otherwise return 1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Test if a string contains an ascii substring.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp Source string. pat Ascii string pattern to search for.
- Returns:
- The index in the string where the pattern was found. Otherwise return -1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Test if a string contains a character.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp Source string. charPat Character to search for.
- Returns:
- The index in the string where the character was found. Otherwise return -1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Test if a string contains another string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp Source string. pat String pattern to search for.
- Returns:
- The index in the string where the pattern was found. Otherwise return -1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Create an empty string object.
This creates an uninitialized string object of the requrired size. Once initialized, the string must be "interned" via $ejsInternString- Parameters:
-
ejs Ejs reference returned from ejsCreateVM len Length of space to reserve for future string data.
- Returns:
- A string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Create a string object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value C string value to define for the string object. Note: this will soon be changed to unicode. len Length of string to examine in value.
- Returns:
- A string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Create a string from ascii.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value Null terminated ascii string value to intern.
- Returns:
- Allocated string. These are references into the interned string pool.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Create a string from an ascii block.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value UTF-8 multibyte string value to intern. len Length of the string in bytes.
- Returns:
- Allocated string. These are references into the interned string pool.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Create a string from a module string constant.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM mp Module object. index String constant index.
- Returns:
- Allocated string. These are references into the interned string pool.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Create a string from UTF-8 multibyte string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value Ascii string value to intern. len Length of value in bytes.
- Returns:
- Allocated string. These are references into the interned string pool.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Destroy the intern string cache.
- Parameters:
-
intern Reference to the intern object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Intern a string object from an Ascii string.
- Description:
- A string is created using the ascii string as input.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value Ascii string buffer. len Size of the input value string.
- Returns:
- The internalized string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Intern a string object from a UTF-8 string.
- Description:
- A string is created using the UTF-8 string as input.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value UTF-8 string buffer. len Size of the input value string.
- Returns:
- The internalized string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Intern a string object.
- Description:
- This stores the string in the internal string pool. This is required if the string was created via ejsCreateBareString. The ejsCreateString routine will intern the string automatcially.
- Parameters:
-
sp String object to intern.
- Returns:
- The internalized string object. NOTE: this may be different to the object passed in, if the string value was already present in the intern pool.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Intern a string object from a UTF-16 string.
- Description:
- A string is created using the UTF-16 string as input.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM value UTF-16 string buffer. len Size of the input value string.
- Returns:
- The internalized string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Join two strings.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM s1 First string to join. s2 Second string to join.
- Returns:
- A new string representing the joined strings.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Join strings.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM src First string to join. ... Other strings to join.
- Returns:
- A new string representing the joined strings.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Serialize a variable into JSON format.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Value to cast. flags Serialization options. The supported options are: - EJS_JSON_SHOW_COMMAS - Always use commas after properties
- EJS_JSON_SHOW_HIDDEN - Include hidden properties
- EJS_JSON_SHOW_NOQUOTES - Omit quotes on properties if possible
- EJS_JSON_SHOW_NAMESPACES - Include namespaces in property names
- EJS_JSON_SHOW_NULLS - Include null properties
- EJS_JSON_SHOW_REGEXP - Emit native regular expression literals
- EJS_JSON_SHOW_PRETTY - Use human-readable multiline presentation
- EJS_JSON_SHOW_SUBCLASSES - Include subclass properties
- Returns:
- A string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Serialize a variable into JSON format.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Value to cast. options Serialization options. The supported options are: - baseClasses - Include subclass properties
- hidden - Include hidden properties
- namespaces - Include namespaces in property names
- pretty - Use human-readable multiline presentation
- depth - Set a maximum depth to recurse in the object
- replacer - Function that determines how object values are stringified for objects without a toJSON method. The replace has the following signature: function replacer(key: String, value: String): String
- Returns:
- A string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Format arguments.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fmt Format specifier. ... Arguments for the format specifiers.
- Returns:
- A formatted string.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Test if a string starts with an ascii pattern.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp Source string. pat Pattern to search for.
- Returns:
- The index in the string where the pattern was found. Otherwise return -1.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Get a substring.
- Description:
- Get a substring at a given offset.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM src Source string. offset Offset in string to take the substring. len Length of the substring.
- Returns:
- The substring.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Convert a variable to a string in JSON format.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Value to cast. options Encoding options. See serialize for details.
- Returns:
- A string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToLower, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Convert a string to lower case.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp Source string.
- Returns:
- A lower case version of the input string.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToMulti, ejsToString, ejsToUpper, ejsTruncateString
Convert an object to a UTF-8 string representation.
- Description:
- The object is converted to a string and then serialized into UTF-8.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to convert.
- Returns:
- A multibyte UTF-8 representation.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToString, ejsToUpper, ejsTruncateString
Cast a variable to a string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to convert.
- Returns:
- A string object.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToUpper, ejsTruncateString
Convert a string to upper case.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM sp Source string.
- Returns:
- A upper case version of the input string.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsTruncateString
Truncate a string.
- Description:
- Truncate the string and return a new string. Note: the original is not modified.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM src Source string. len Length of the result string.
- Returns:
- The substring.
- See Also:
- EjsString, ejsAtoi, ejsCompareAsc, ejsCompareString, ejsCompareSubstring, ejsCompareWide, ejsContainsAsc, ejsContainsChar, ejsContainsString, ejsCreateBareString, ejsCreateString, ejsCreateStringFromAsc, ejsCreateStringFromBytes, ejsCreateStringFromConst, ejsCreateStringFromMulti, ejsDestroyIntern, ejsInternAsc, ejsInternMulti, ejsInternString, ejsInternWide, ejsJoinString, ejsJoinStrings, ejsSerialize, ejsSerializeWithOptions, ejsSprintf, ejsStartsWithAsc, ejsSubstring, ejsToJSON, ejsToLower, ejsToMulti, ejsToString, ejsToUpper
EjsTimer
Timer Class.
- Description:
- Timers manage the scheduling and execution of Ejscript functions. Timers run repeatedly until stopped by calling the stop method and are scheduled with a granularity of 1 millisecond.
- See Also:
- API Stability:
- Internal.
- Fields:
-
EjsArray * args Callback args. EjsFunction * callback Callback function. int drift Timer event is allowed to drift if system conditions requrie. Ejs * ejs Interp reference - needed for background timers. MprEvent * event MPR event for the timer. EjsObj obj Base object. EjsFunction * onerror onerror function. int period Time in msec between invocations. int repeat Timer repeatedly fires.
EjsType
Type class.
- Description:
- Classes in Ejscript are represented by instances of an EjsType. Types are templates for creating instances of the given type, but they are also are runtime accessible objects. Types contain the static properties and methods for objects and store these in their object slots array. They store the instance properties in the type->instance object. EjsType inherits from EjsBlock, EjsObj and EjsObj.
- See Also:
- ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
- API Stability:
- Internal.
- Fields:
-
uint __pad0__ Type is mutable (has changable state). struct EjsType * baseType Base class. uint callsSuper Constructor calls super(). uint configured Type has been configured with native methods. EjsFunction constructor Constructor function and type properties. uint dynamicInstances Object instances may add properties. int endClass Offset in mod file for end of class. uint final Type is final. uint hasBaseConstructors Base types has constructors. uint hasBaseInitializers Base types have initializers. uint hasConstructor Type has a constructor. uint hasInitializer Type has static level initialization code. uint hasInstanceVars Type has non-function instance vars (state). uint hasMeta Type has meta methods. uint hasScriptFunctions Block has non-native functions requiring namespaces. EjsHelpers helpers Type helper methods. MprList * implements List of implemented interfaces. uint initialized Static initializer has run. ushort instanceSize Size of instances in bytes. uint isInterface Interface vs class. uint isPot Instances are based on EjsPot. MprManager manager Manager callback. struct EjsModule * module Module owning the type - stores the constant pool. uint mutableInstances Instances are mutable. MprMutex * mutex Optional locking for types that require it. uint needFixup Slots need fixup. uint numericIndicies Instances support direct numeric indicies. ushort numInherited Number of inherited prototype properties. EjsPot * prototype Prototype for instances when using prototype inheritance (only). EjsName qname Qualified name of the type. Type name and namespace. short sid Slot index into service->immutable[]. void * typeData Type specific data. uint virtualSlots Properties are not stored in slots[].
Bind a native C functions to method accessors.
- Description:
- Bind a native C function to an existing javascript accessor function. Method functions are typically created by compiling a script file of native method definitions into a mod file. When loaded, this mod file will create the method properties. This routine will then bind the specified C function to the method accessor.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Type containing the function property to bind. slotNum Slot number of the method property. getter Native C getter function to bind. Set to NULL if no getter. setter Native C setter function to bind. Set to NULL if no setter.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsType, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Bind a constructor.
- Description:
- Bind a native C function to a type as a constructor function.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM type Type to modify. constructor Native C constructor function to bind.
- See Also:
- EjsType, ejsBindAccess, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Bind a native C function to a function property.
- Description:
- Bind a native C function to an existing javascript function. Functions are typically created by compiling a script file of native function definitions into a mod file. When loaded, this mod file will create the function properties. This routine will then bind the specified C function to the function property.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object containing the function property to bind. slotNum Slot number of the method property. fun Native C function to bind.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Bind a native C function to a method property.
- Description:
- Bind a native C function to an existing javascript method. Method functions are typically created by compiling a script file of native method definitions into a mod file. When loaded, this mod file will create the method properties. This routine will then bind the specified C function to the method property.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Type containing the function property to bind. slotNum Slot number of the method property. fn Native C function to bind.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Cast the object to the given type name.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine. name Textual name of the type (Not void*). For example: ejsCast(ejs, obj, String).
- Returns:
- Casted object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Configure a type.
- Description:
- Called by loader to configure a native type based on the mod file information.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM type Type to configure. up Reference to a module that will own the type. Set to null if not owned by any module. baseType Base type for this type. numTypeProp Number of type (class) properties for the type. These include static properties and methods. numInstanceProp Number of instance properties. attributes Attribute mask to modify how the type is initialized.
- Returns:
- The configured type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Create an Archetype.
- Description:
- Archetypes are used when functions are used as constructors.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM fun Function object to use as a constructor. prototype Prototype object. If set to null, a new prototype is created.
- Returns:
- A new type object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Create a core type object.
- Description:
- Create a new type object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM qname Qualified name to give the type. This name is referenced by the type and must be persistent. This name is not used to define the type as a global property. size Size in bytes to reserve for the type. slotNum Global slot number property index. numTypeProp Number of type (class) properties for the type. These include static properties and methods. manager MPR manager routine for garbage collection. attributes Attribute mask to modify how the type is initialized.
- Returns:
- The created type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Create a type prototype.
- Description:
- This creates a prototype object from which instances are crafted.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM type Type object. numProp Number of instance properties in the prototype.
- Returns:
- The prototype object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Create a new type object.
- Description:
- Create a new type object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM name Qualified name to give the type. This name is referenced by the type and must be persistent. This name is not used to define the type as a global property. up Reference to a module that will own the type. Set to null if not owned by any module. baseType Base type for this type. prototype Prototype object instance properties of this type. size Size of instances. This is the size in bytes of an instance object. slotNum Unique type ID for core types. For non-core types, set to -1. numTypeProp Number of type (class) properties for the type. These include static properties and methods. numInstanceProp Number of instance properties. manager MPR manager routine for garbage collection. attributes Attribute mask to modify how the type is initialized.
- Returns:
- The created type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Define a global function.
- Description:
- Define a global public function and bind it to the C native function. This is a simple one liner to define a public global function. The more typical paradigm to define functions is to create a script file of native method definitions and and compile it. This results in a mod file that can be loaded which will create the function/method definitions. Then use ejsBindMethod to associate a C function with a property.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM name Function name. fn C function that implements the function.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Define an instance property.
- Description:
- Define an instance property on a type. This routine should not normally be called manually. Instance properties are best created by creating a script file of native property definitions and then loading the resultant mod file.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM type Type in which to create the instance property. slotNum Instance slot number in the type that will hold the property. Set to -1 to allocate the next available free slot. name Qualified name for the property including namespace and name. propType Type of the instance property. attributes Integer mask of access attributes. value Initial value of the instance property.
- Returns:
- The slot number used for the property.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Finalize a core type.
- Description:
- This sets the configured state for the type.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM qname Qualified name of the type.
- Returns:
- The finalized type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Finalize a script type.
- Description:
- This finalizes the type and sets the configured state for the type.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM qname Qualified name of the type. size Instance size of the type. manager Manager function for garbage collection. attributes Type attributes.
- Returns:
- The configured type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Get the prototype object for an object.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM obj Object to examine.
- Returns:
- Prototype object for the given object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Get a type.
- Description:
- Get the type installed at the given slot number. All core-types are installed a specific global slots. When Ejscript is built, these slots are converted into C program defines of the form: ES_TYPE where TYPE is the name of the type concerned. For example, you can get the String type object via:.
- EjsGetType(ejs, ES_String).
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM slotNum Slot number of the type to retrieve. Use ES_TYPE defines.
- Returns:
- A type object if successful or zero if the type could not be found.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Get a type given its name.
- Description:
- Types are stored in the global object. This routine looks in the global object for the type property.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM qname Qualified name of the type.
- Returns:
- The type object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Get the type name of an object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- The string type name of the object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
TypeOf operator.
- Description:
- This finalizes the type and sets the configured state for the type.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- String type name for the "typeOf" operator.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Test the type of an object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine. name Textual name of the type (Not void*). For example: ejsIs(ejs, obj, Number).
- Returns:
- True if the object is of the tested type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Test if an variable is an instance of a given type.
- Description:
- Perform an "is a" test. This tests if a variable is a direct instance or subclass of a given base type.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM target Target object to test. type Type to compare with the target.
- Returns:
- True if target is an instance of "type" or an instance of a subclass of "type".
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Test the object is not null and not undefined.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to examine.
- Returns:
- True if the object is of a defined type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsType, ejsIsTypeSubType
Determine if a variable is a prototype object.
Types store the template for instance properties in a prototype object- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is a prototype object.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
Determine if a variable is an type.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is a type.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsTypeSubType
Test if a type is a derived type of a given base type.
- Description:
- Test if a type subclasses a base type.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM target Target type to test. baseType Base class to see if the target subclasses it.
- Returns:
- True if target is a "baseType" or a subclass of "baseType".
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType
Run a program.
- Description:
- Lookup the className and run the designated method. If methodName is null, then "main" is run. The method should be a static method of the class.
- Parameters:
-
ejs Interpreter instance returned from ejsCreateVM className Class name to search for methodName. methodName Method to run. If set to NULL, then search for "main".
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- See Also:
- EjsType, ejsBindAccess, ejsBindConstructor, ejsBindMethod, ejsCast, ejsConfigureType, ejsCreateArchetype, ejsCreateCoreType, ejsCreatePrototype, ejsCreateType, ejsDefineGlobalFunction, ejsDefineInstanceProperty, ejsFinalizeCoreType, ejsFinalizeScriptType, ejsGetPrototype, ejsGetType, ejsGetTypeByName, ejsIs, ejsIsA, ejsIsDefined, ejsIsType, ejsIsTypeSubType
EjsUri
Uri class.
- Description:
- The Uri class provides file path name services.
- See Also:
- EjsFile, ejsCreateUri, ejsCreateUriFromAsc, ejsCreateUriFromParts, ejsToUri
- API Stability:
- Internal.
- Fields:
-
EjsObj obj Base object. HttpUri * uri Decoded URI.
Create a Uri object.
- Description:
- Create a URI object associated with the given URI string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM uri Uri string to parse.
- Returns:
- A new Uri object.
- See Also:
- EjsFile, ejsCreateUriFromAsc, ejsCreateUriFromParts, ejsToUri
Create a URI from an ascii path.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM uri URI Ascii string.
- Returns:
- A new URI object.
- See Also:
- EjsFile, ejsCreateUri, ejsCreateUriFromParts, ejsToUri
- Description:
- This call constructs a URI from the given parts. Various URI parts can be omitted by setting to null. The URI path is the only mandatory parameter.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM scheme The URI scheme. This is typically "http" or "https". host The URI host name portion. This can be a textual host and domain name or it can be an IP address. port The URI port number. Set to zero to accept the default value for the selected scheme. path The URI path to the requested document. reference URI reference with an HTML document. This is the URI component after the "#" in the URI path. query URI query component. This is the URI component after the "?" in the URI. flags Set to HTTP_COMPLETE_URI to complete the URI by supplying missing URI parts with default values.
- Returns:
- A new URI.
- See Also:
- EjsFile, ejsCreateUri, ejsCreateUriFromAsc, ejsToUri
Convert an object to a URI.
- Description:
- The object is first converted to a String and then to a URI.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Any object.
- Returns:
- A new URI object.
- See Also:
- EjsFile, ejsCreateUri, ejsCreateUriFromAsc, ejsCreateUriFromParts
EjsVoid
Void class.
- Description:
- The Void class provides the base class for the singleton "undefined" instance. This instance is stored in ejs->undefinedValue.
- API Stability:
- Evolving.
- See Also:
- ejsCreateUndefined
- Fields:
-
Create the undefined object.
- Description:
- There is one undefined object in the system.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- The undefined object.
- See Also:
EjsWebSocket
WebSocket Class.
- Description:
- Client side WebSocket support.
- See Also:
- ejsCreateWebSocket
- API Stability:
- Internal.
- Fields:
-
char * certFile SSL certificate file. int closed Http is closed and "close" event has been issued. HttpConn * conn Underlying HttpConn object. Ejs * ejs Interp reference. EjsObj * emitter Event emitter. int error Http errored and "error" event has been issued. int frames Preserve frames. EjsPot pot Base pot. char * protocol Protocol selected by the server. char * protocols Set of supported protocols. MprSsl * ssl SSL configuration. char * uri Target URI.
Create a new WebSocket object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- A new WebSocket object.
- See Also:
- EjsWebSocket
EjsWorker
Worker Class.
- Description:
- The Worker class provides the ability to create new interpreters in dedicated threads.
- See Also:
- EjsObj, ejsCreateWorker, ejsRemoveWorkers
- API Stability:
- Internal.
- Fields:
-
int complete Worker has completed its work. Ejs * ejs Interpreter. EjsAny * event Current event object. int gotMessage Worker has received a message. int inside Running inside the worker. char * name Optional worker name. struct EjsWorker * pair Corresponding worker object in other thread. EjsPot pot Property storage. char * scriptFile Script or module to run. EjsString * scriptLiteral Literal script string to run. int state Worker state.
Create a worker.
- Description:
- This creates a bare worker object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- A new worker object.
- See Also:
- EjsObj, ejsRemoveWorkers
Remove workers before exiting.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- See Also:
- EjsObj, ejsCreateWorker
EjsXML
XML and XMLList class.
- Description:
- The XML class and API is based on ECMA-357
ECMAScript for XML (E4X). The XML class is a core class in the E4X specification; it provides the ability to load, parse and save XML documents.
- See Also:
- ejsAppendAttributeToXML, ejsAppendToXML, ejsCreateXML, ejsCreateXMLList, ejsGetXMLDescendants, ejsIsXML, ejsLoadXMLAsc, ejsLoadXMLString, ejsXMLToBuf
- API Stability:
- Internal.
- Fields:
-
MprList * attributes Node attributes. MprList * elements List elements or child nodes. int kind Kind of XML node. MprList * namespaces List of namespaces as Namespace objects. EjsObj obj Base object. struct EjsXML * parent Parent node reference (XML or XMLList). EjsName qname XML node name (e.g. tagName). struct EjsXML * targetObject XML/XMLList object modified when items inserted into an empty list. EjsName targetProperty XML property modified when items inserted into an empty list. EjsString * value Value of text|attribute|comment|pi.
Append an attribute.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM parent Xml node to receive the attribute. attribute Attribute node to append.
- Returns:
- A new XML object.
Append a node.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM dest Node to receive the appended node. node Node to append to dest.
- Returns:
- The dest node.
Create an XML node object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM kind XML node kind. Set to EJS_XML_LIST, EJS_XML_ELEMENT, EJS_XML_ATTRIBUTE, EJS_XML_TEXT, EJS_XML_COMMENT or EJS_XML_PROCESSING. name Node name. Only the EjsName.name field is used. parent Parent node. value Node value.
- Returns:
- A new XML object.
Create an XML list object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM targetObject Object to set as the target object for the list. targetProperty Property to set as the target property for the list.
- Returns:
- A new XML list object.
Get the descendants of an XML node that match the given name.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM xml Node to examine. qname Name to search for.
- Returns:
- An XML node with elements for the descendants.
Determine if a variable is an XML object.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to test.
- Returns:
- True if the variable is an XML or XMLList object.
Load an XML document from an Ascii string.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM xml XML node to hold the parsed XML data. xmlString String containing XML data to parse.
Load an XML document.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM xml XML node to hold the parsed XML data. xmlString String containing XML data to parse.
Set an indexed element to a value.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM xml XML node to receive the appended node. index Element index at which to set the node. node Node to insert.
- Returns:
- The xml node.
Convert an xml node to string representation in a buffer.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM buf Buffer to hold the output string. xml Node to examine. indentLevel Maximum indent level.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
Functions
Make an integer version number.
- Parameters:
-
maj Major version number. min Minor version number. patch Patch version number.
- Returns:
- An integer version number combining major, minor and patch version numbers.
Destroy an interpreter.
- Parameters:
-
ejs Interpreter to destroy.
Get files below a path.
- Description:
- Expand wild cards in a path. Function used to implement Path.files().
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM path Path to use as the base. argc Count of args (set to 1). argv Args array. (Set to an array with a single element).
- Returns:
- Array of matching paths.
Convert a string to a literal string style representation.
- Description:
- The object is converted to a string and then is wrapped with quotes. Embedded quotes and backquotes are backquoted.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM obj Object to convert.
- Returns:
- A string representation of the object.
Special type.
Get immutable special value.
- Parameters:
-
name Literal name.
- Returns:
- Special value.
Typedefs
Native Function signature.
- Description:
- This is the calling signature for C Functions.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM thisObj Reference to the "this" object. (The object containing the method). argc Number of arguments. argv Array of arguments.
- Returns:
- Returns a result variable or NULL on errors and exceptions.
- API Stability:
- Evolving.
- See Also:
- EjsFunction, ejsBindFunction, ejsCloneFunction, ejsCloneFunction, ejsCreateActivation, ejsCreateBareFunction, ejsCreateFunction, ejsCreateFunction, ejsInitFunction, ejsIsFunction, ejsIsFunction, ejsIsInitializer, ejsIsNativeFunction, ejsRemoveConstructor, ejsRunFunction, ejsRunFunction, ejsRunFunctionBySlot, ejsRunFunctionBySlot, ejsRunInitializer, ejsRunInitializer
Native module initialization callback.
- Parameters:
-
ejs Ejs reference returned from ejsCreateVM
- Returns:
- Zero if successful, otherwise a negative MPR error code.
Byte code.
- Description:
- This structure describes a sequence of byte code for a function. It also defines a set of execption handlers pertaining to this byte code.
- Fields:
-
uchar byteCode[ARRAY_FLEX] Byte code. int codeLen Byte code length. EjsDebug * debug Source code debug information. int debugOffset Offset in mod file for debug info. EjsEx ** handlers Exception handlers. int magic Debug magic id. struct EjsModule * module Module owning this function. int numHandlers Number of exception handlers. int sizeHandlers Size of handlers array.
- API Stability:
- Internal.
Constant pool for module files.
- API Stability:
- Internal.
- Fields:
-
EjsString ** index Interned string index. int indexCount Number of constants used in index. int indexSize Size of index in elements. int locked No more additions allowed. char * pool Constant pool string data. ssize poolLength Length of used bytes in constant pool. ssize poolSize Size of constant pool storage in bytes. MprHash * table Hash table for fast lookup when compiling.
Exception Handler Record.
- Description:
- Each exception handler has an exception handler record.
- Fields:
-
struct EjsType * catchType Type of error to catch. uint flags Exception flags. uint handlerEnd Ptr to one past the end. uint handlerStart Ptr to start of catch/finally block. uint numBlocks Count of blocks opened before the try block. uint numStack Count of stack slots pushed before the try block. uint tryEnd Ptr to one past the end. uint tryStart Ptr to start of try block.
- API Stability:
- Internal.
Property hash linkage.
- API Stability:
- Internal.
- Fields:
-
int * buckets Hash buckets and head of link chains. int size Size of hash.
Allocation and Type Helpers.
- Description:
- The type helpers interface defines the set of primitive operations a type must support to interact with the virtual machine.
- Fields:
-
- API Stability:
- Internal.
Interned string hash shared over all interpreters.
- API Stability:
- Internal.
- Fields:
-
uint64 accesses NUmber of accesses to string. struct EjsString * buckets Hash buckets and references to link chains of strings (unicode). int count Count of entries. uint64 reuse Reuse counter. int size Size of hash.
Symbolic debugging storage for source code in module files.
- API Stability:
- Internal.
- Fields:
-
int offset Optional PC offsets of each line in function. wchar * source Program source code. Format: path line: code.
Lookup State.
- Description:
- Location information returned when looking up properties.
- Fields:
-
int bind Whether to bind to this lookup. uint instanceProperty Property is an instance property. struct EjsName name Name and namespace used to find the property. uint nthBase Property on Nth super type count from the object. uint nthBlock Property on Nth block in the scope chain count from the end. EjsAny * obj Final object / Type containing the variable. EjsAny * originalObj Original object used for the search. uint ownerIsType Original object owning the property is a type. EjsAny * ref Actual property reference. int slotNum Final slot in obj containing the variable reference. struct EjsTrait * trait Property trait describing the property. EjsType * type Type containing property (if on a prototype obj). uint useThis Property accessible via "this.".
- API Stability:
- Internal.
Ejscript Service structure.
- Description:
- The Ejscript service manages the overall language runtime. It is the factory that creates interpreter instances via ejsCreateVM
- Fields:
-
EjsHelpers blockHelpers Default EjsBlock helpers. uint dontExit Prevent App.exit() from exiting. MprSpin * dtoaSpin[2] Dtoa thread synchronization. Http * http Http service. EjsPot * immutable Immutable types and special values. uint immutableInitialized Immutable types are initialized. EjsIntern * intern Interned Unicode string hash - shared over all interps. uint logging Using log. MprMutex * mutex Multithread locking. MprHash * nativeModules Set of loaded native modules. EjsHelpers objHelpers Default EjsObj helpers. EjsHelpers potHelpers Default EjsPot helpers. uint seqno Interp sequence numbers. MprList * vmlist List of all VM interpreters.
- API Stability:
- Internal.
Property slot structure.
- API Stability:
- Internal.
- Fields:
-
int hashChain Next property in hash chain. EjsName qname Property name. EjsAny * ref Property reference. EjsTrait trait Property descriptor traits.
VM Evaluation state.
- API Stability:
- Internal.
- Fields:
-
struct EjsBlock * bp Current block pointer. struct EjsFrame * fp Current Frame function pointer. struct EjsNamespace * internal Current internal namespace. uint paused Garbage collection paused. struct EjsState * prev Previous state. EjsObj ** stack Top of stack (points to the last element pushed). EjsObj ** stackBase Pointer to start of stack mem. ssize stackSize Stack size. EjsObj * t1 Temp one for GC.
Property traits.
- Description:
- Property traits describe the type and access attributes of a property. The Trait structure is used by EjsBlock to describe the attributes of properties defined within a block. Note: These traits apply to a property definition and not to the referenced object. ie. two property definitions may have different traits but will refer to the same object.
- Fields:
-
int attributes Modifier attributes. struct EjsType * type Property type (prototype).
- API Stability:
- Evolving.
Xml tag state.
- API Stability:
- Internal.
- Fields:
-
EjsObj * attributes List of attributes. EjsObj * comments List of comments. struct EjsXML * obj Current object.