PUBLIC void ejsConfigureGCType(Ejs *ejs) { EjsType *type; if ((type = ejsFinalizeScriptType(ejs, N("ejs", "GC"), sizeof(EjsPot), ejsManagePot, EJS_TYPE_POT)) == 0) { return; } ejsBindAccess(ejs, type, ES_GC_enabled, gc_enabled, gc_set_enabled); ejsBindAccess(ejs, type, ES_GC_newQuota, gc_newQuota, gc_set_newQuota); ejsBindMethod(ejs, type, ES_GC_run, gc_run); ejsBindMethod(ejs, type, ES_GC_verify, gc_verify); }
PUBLIC void ejsConfigureMprLogType(Ejs *ejs) { EjsType *type; EjsPot *prototype; if ((type = ejsFinalizeScriptType(ejs, N("ejs", "MprLog"), sizeof(EjsPot), ejsManagePot, EJS_TYPE_POT)) == 0) { return; } prototype = type->prototype; ejsBindMethod(ejs, prototype, ES_MprLog_emit, lf_emit); ejsBindAccess(ejs, prototype, ES_MprLog_fixed, lf_fixed, lf_set_fixed); ejsBindAccess(ejs, prototype, ES_MprLog_level, lf_level, lf_set_level); ejsBindMethod(ejs, prototype, ES_MprLog_redirect, lf_redirect); }
PUBLIC void ejsConfigureUriType(Ejs *ejs) { EjsType *type; EjsPot *prototype; if ((type = ejsFinalizeScriptType(ejs, N("ejs", "Uri"), sizeof(EjsUri), manageUri, EJS_TYPE_OBJ | EJS_TYPE_MUTABLE_INSTANCES)) != 0) { type->helpers.clone = (EjsCloneHelper) cloneUri; // MOB - Add cast helper to cast from Strings, Paths etc. type->helpers.invokeOperator = (EjsInvokeOperatorHelper) invokeUriOperator; ejsBindMethod(ejs, type, ES_Uri_decode, uri_decode); ejsBindMethod(ejs, type, ES_Uri_decodeComponent, uri_decodeComponent); ejsBindMethod(ejs, type, ES_Uri_encode, uri_encode); ejsBindMethod(ejs, type, ES_Uri_encodeComponent, uri_encodeComponent); ejsBindMethod(ejs, type, ES_Uri_template, uri_template); prototype = type->prototype; ejsBindConstructor(ejs, type, uri_constructor); ejsBindMethod(ejs, prototype, ES_Uri_absolute, uri_absolute); ejsBindMethod(ejs, prototype, ES_Uri_basename, uri_basename); ejsBindMethod(ejs, prototype, ES_Uri_complete, uri_complete); ejsBindMethod(ejs, prototype, ES_Uri_components, uri_components); ejsBindMethod(ejs, prototype, ES_Uri_dirname, uri_dirname); ejsBindAccess(ejs, prototype, ES_Uri_extension, uri_extension, uri_set_extension); ejsBindMethod(ejs, prototype, ES_Uri_hasExtension, uri_hasExtension); ejsBindMethod(ejs, prototype, ES_Uri_hasHost, uri_hasHost); ejsBindMethod(ejs, prototype, ES_Uri_hasPort, uri_hasPort); ejsBindMethod(ejs, prototype, ES_Uri_hasQuery, uri_hasQuery); ejsBindMethod(ejs, prototype, ES_Uri_hasReference, uri_hasReference); ejsBindMethod(ejs, prototype, ES_Uri_hasScheme, uri_hasScheme); ejsBindAccess(ejs, prototype, ES_Uri_host, uri_host, uri_set_host); ejsBindMethod(ejs, prototype, ES_Uri_isAbsolute, uri_isAbsolute); ejsBindMethod(ejs, prototype, ES_Uri_isDir, uri_isDir); ejsBindMethod(ejs, prototype, ES_Uri_join, uri_join); ejsBindMethod(ejs, prototype, ES_Uri_joinExt, uri_joinExt); ejsBindMethod(ejs, prototype, ES_Uri_local, uri_local); ejsBindMethod(ejs, prototype, ES_Uri_mimeType, uri_mimeType); ejsBindMethod(ejs, prototype, ES_Uri_normalize, uri_normalize); ejsBindAccess(ejs, prototype, ES_Uri_path, uri_path, uri_set_path); ejsBindAccess(ejs, prototype, ES_Uri_port, uri_port, uri_set_port); ejsBindAccess(ejs, prototype, ES_Uri_scheme, uri_scheme, uri_set_scheme); ejsBindAccess(ejs, prototype, ES_Uri_query, uri_query, uri_set_query); ejsBindAccess(ejs, prototype, ES_Uri_reference, uri_reference, uri_set_reference); ejsBindMethod(ejs, prototype, ES_Uri_replaceExt, uri_replaceExtension); ejsBindMethod(ejs, prototype, ES_Uri_relative, uri_relative); ejsBindMethod(ejs, prototype, ES_Uri_resolve, uri_resolve); ejsBindMethod(ejs, prototype, ES_Uri_same, uri_same); ejsBindMethod(ejs, prototype, ES_Uri_toString, uri_toString); ejsBindMethod(ejs, prototype, ES_Uri_toLocalString, uri_toLocalString); ejsBindMethod(ejs, prototype, ES_Uri_trimExt, uri_trimExt); ejsBindAccess(ejs, prototype, ES_Uri_uri, uri_toString, uri_set_uri); } ejsBindMethod(ejs, ejs->global, ES_decodeURI, decodeURI); ejsBindMethod(ejs, ejs->global, ES_decodeURIComponent, decodeURIComponent); ejsBindMethod(ejs, ejs->global, ES_encodeURI, encodeURI); ejsBindMethod(ejs, ejs->global, ES_encodeURIComponent, encodeURIComponent); }
PUBLIC void ejsConfigureAppType(Ejs *ejs) { EjsType *type; if ((type = ejsFinalizeScriptType(ejs, N("ejs", "App"), 0, 0, 0)) == 0) { return; } ejsSetProperty(ejs, type, ES_App__inputStream, ejsCreateFileFromFd(ejs, 0, "stdin", O_RDONLY)); ejsSetProperty(ejs, type, ES_App__outputStream, ejsCreateFileFromFd(ejs, 1, "stdout", O_WRONLY)); ejsSetProperty(ejs, type, ES_App__errorStream, ejsCreateFileFromFd(ejs, 2, "stderr", O_WRONLY)); ejsBindMethod(ejs, type, ES_App_args, app_args); ejsBindMethod(ejs, type, ES_App_createSearch, app_createSearch); ejsBindMethod(ejs, type, ES_App_dir, app_dir); ejsBindMethod(ejs, type, ES_App_chdir, app_chdir); ejsBindMethod(ejs, type, ES_App_exeDir, app_exeDir); ejsBindMethod(ejs, type, ES_App_exePath, app_exePath); ejsBindMethod(ejs, type, ES_App_env, app_env); ejsBindMethod(ejs, type, ES_App_exit, app_exit); ejsBindMethod(ejs, type, ES_App_getenv, app_getenv); ejsBindMethod(ejs, type, ES_App_gid, app_gid); ejsBindMethod(ejs, type, ES_App_putenv, app_putenv); ejsBindMethod(ejs, type, ES_App_pid, app_pid); ejsBindMethod(ejs, type, ES_App_run, app_run); ejsBindAccess(ejs, type, ES_App_search, app_search, app_set_search); ejsBindMethod(ejs, type, ES_App_sleep, app_sleep); ejsBindMethod(ejs, type, ES_App_uid, app_uid); ejsBindMethod(ejs, type, ES_App_getpass, app_getpass); }
PUBLIC void ejsConfigureFileType(Ejs *ejs) { EjsType *type; EjsPot *prototype; if ((type = ejsFinalizeScriptType(ejs, N("ejs", "File"), sizeof(EjsFile), manageFile, EJS_TYPE_OBJ | EJS_TYPE_NUMERIC_INDICIES | EJS_TYPE_VIRTUAL_SLOTS | EJS_TYPE_MUTABLE_INSTANCES)) == 0) { return; } type->helpers.getProperty = (EjsGetPropertyHelper) getFileProperty; type->helpers.lookupProperty = (EjsLookupPropertyHelper) lookupFileProperty; type->helpers.setProperty = (EjsSetPropertyHelper) setFileProperty; prototype = type->prototype; ejsBindConstructor(ejs, type, fileConstructor); ejsBindMethod(ejs, prototype, ES_File_canRead, canReadFile); ejsBindMethod(ejs, prototype, ES_File_canWrite, canWriteFile); ejsBindMethod(ejs, prototype, ES_File_close, closeFile); ejsBindMethod(ejs, prototype, ES_File_iterator_get, getFileIterator); ejsBindMethod(ejs, prototype, ES_File_iterator_getValues, getFileValues); ejsBindMethod(ejs, prototype, ES_File_isOpen, isFileOpen); ejsBindMethod(ejs, prototype, ES_File_open, openFile); ejsBindMethod(ejs, prototype, ES_File_options, getFileOptions); ejsBindMethod(ejs, prototype, ES_File_path, getFilePath); ejsBindAccess(ejs, prototype, ES_File_position, getFilePosition, setFilePosition); ejsBindMethod(ejs, prototype, ES_File_readBytes, readFileBytes); ejsBindMethod(ejs, prototype, ES_File_readString, readFileString); ejsBindMethod(ejs, prototype, ES_File_read, readFile); ejsBindMethod(ejs, prototype, ES_File_size, getFileSize); ejsBindMethod(ejs, prototype, ES_File_truncate, truncateFile); ejsBindMethod(ejs, prototype, ES_File_write, writeFile); }
PUBLIC void ejsConfigureArrayType(Ejs *ejs) { EjsType *type; EjsPot *prototype; if ((type = ejsFinalizeCoreType(ejs, N("ejs", "Array"))) == 0) { return; } prototype = type->prototype; ejsBindConstructor(ejs, type, arrayConstructor); ejsBindMethod(ejs, prototype, ES_Array_iterator_get, getArrayIterator); ejsBindMethod(ejs, prototype, ES_Array_iterator_getValues, getArrayValues); ejsBindMethod(ejs, prototype, ES_Array_clone, cloneArrayMethod); ejsBindMethod(ejs, prototype, ES_Array_toString, arrayToString); ejsBindMethod(ejs, prototype, ES_Array_append, appendArray); ejsBindMethod(ejs, prototype, ES_Array_clear, clearArray); ejsBindMethod(ejs, prototype, ES_Array_compact, compactArray); ejsBindMethod(ejs, prototype, ES_Array_concat, concatArray); ejsBindMethod(ejs, prototype, ES_Array_indexOf, indexOfArray); ejsBindMethod(ejs, prototype, ES_Array_insert, insertArray); ejsBindMethod(ejs, prototype, ES_Array_join, joinArray); ejsBindMethod(ejs, prototype, ES_Array_lastIndexOf, lastArrayIndexOf); ejsBindAccess(ejs, prototype, ES_Array_length, getArrayLength, setArrayLength); ejsBindMethod(ejs, prototype, ES_Array_pop, popArray); ejsBindMethod(ejs, prototype, ES_Array_push, pushArray); ejsBindMethod(ejs, prototype, ES_Array_removeElements, removeElements); ejsBindMethod(ejs, prototype, ES_Array_reverse, reverseArray); ejsBindMethod(ejs, prototype, ES_Array_shift, shiftArray); ejsBindMethod(ejs, prototype, ES_Array_slice, sliceArray); ejsBindMethod(ejs, prototype, ES_Array_sort, ejsSortArray); ejsBindMethod(ejs, prototype, ES_Array_splice, spliceArray); ejsBindMethod(ejs, prototype, ES_Array_unique, uniqueArray); ejsBindMethod(ejs, prototype, ES_Array_unshift, unshiftArray); #if FUTURE ejsBindMethod(ejs, prototype, ES_Array_toLocaleString, toLocaleString); ejsBindMethod(ejs, prototype, ES_Array_toJSONString, toJSONString); ejsBindMethod(ejs, prototype, ES_Array_LBRACKET, operLBRACKET); ejsBindMethod(ejs, prototype, ES_Array_AND, operAND); ejsBindMethod(ejs, prototype, ES_Array_EQ, operEQ); ejsBindMethod(ejs, prototype, ES_Array_GT, operGT); ejsBindMethod(ejs, prototype, ES_Array_LT, operLT); ejsBindMethod(ejs, prototype, ES_Array_LSH, operLSH); ejsBindMethod(ejs, prototype, ES_Array_MINUS, operMINUS); ejsBindMethod(ejs, prototype, ES_Array_OR, operOR); ejsBindMethod(ejs, prototype, ES_Array_AND, operAND); #endif }
PUBLIC void ejsConfigureRegExpType(Ejs *ejs) { EjsType *type; EjsPot *prototype; if ((type = ejsFinalizeCoreType(ejs, N("ejs", "RegExp"))) == 0) { return; } prototype = type->prototype; ejsBindConstructor(ejs, type, regex_Constructor); ejsBindMethod(ejs, prototype, ES_RegExp_exec, regex_exec); ejsBindAccess(ejs, prototype, ES_RegExp_lastIndex, regex_getLastIndex, regex_setLastIndex); ejsBindMethod(ejs, prototype, ES_RegExp_global, regex_getGlobalFlag); ejsBindMethod(ejs, prototype, ES_RegExp_ignoreCase, regex_getIgnoreCase); ejsBindMethod(ejs, prototype, ES_RegExp_multiline, regex_getMultiline); ejsBindMethod(ejs, prototype, ES_RegExp_source, regex_getSource); ejsBindMethod(ejs, prototype, ES_RegExp_matched, regex_matched); ejsBindMethod(ejs, prototype, ES_RegExp_start, regex_start); ejsBindMethod(ejs, prototype, ES_RegExp_sticky, regex_sticky); ejsBindMethod(ejs, prototype, ES_RegExp_test, regex_test); ejsBindMethod(ejs, prototype, ES_RegExp_toString, ejsRegExpToString); }