void ring_vm_refmeta_methods ( void *pPointer ) { List *pList, *pList2 ; int x ; if ( RING_API_PARACOUNT != 1 ) { RING_API_ERROR(RING_API_BADPARACOUNT); return ; } if ( RING_API_ISLIST(1) ) { pList = RING_API_GETLIST(1) ; if ( ring_vm_oop_isobject(pList) ) { pList = (List *) ring_list_getpointer(pList,RING_OBJECT_CLASSPOINTER); pList = ring_list_getlist(pList,RING_CLASSMAP_METHODSLIST); pList2 = RING_API_NEWLIST ; for ( x = 1 ; x <= ring_list_getsize(pList) ; x++ ) { ring_list_addstring(pList2,ring_list_getstring(ring_list_getlist(pList,x),RING_FUNCMAP_NAME)); } RING_API_RETLIST(pList2); } else { RING_API_ERROR(RING_API_BADPARATYPE); } } else { RING_API_ERROR(RING_API_BADPARATYPE); } }
void ring_vm_sqlite_execute ( void *pPointer ) { ring_sqlite *psqlite ; int rc ; List *pList ; char *ErrMsg ; ErrMsg = NULL ; if ( RING_API_PARACOUNT != 2 ) { RING_API_ERROR(RING_API_MISS2PARA); return ; } if ( RING_API_ISPOINTER(1) && RING_API_ISSTRING(2) ) { psqlite = (ring_sqlite *) RING_API_GETCPOINTER(1,RING_VM_POINTER_SQLITE) ; if ( psqlite == NULL ) { return ; } if ( psqlite->db ) { pList = RING_API_NEWLIST ; rc = sqlite3_exec(psqlite->db,RING_API_GETSTRING(2),ring_vm_sqlite_callback,(void *) pList,&ErrMsg); RING_API_RETLIST(pList); } } else { RING_API_ERROR(RING_API_BADPARATYPE); } }
void ring_vm_refmeta_packageclasses ( void *pPointer ) { VM *pVM ; int x ; List *pList, *pList2, *pList3 ; char *cStr ; if ( RING_API_PARACOUNT != 1 ) { RING_API_ERROR(RING_API_BADPARACOUNT); return ; } if ( RING_API_GETSTRING(1) ) { pVM = (VM *) pPointer ; cStr = RING_API_GETSTRING(1) ; ring_string_lower(cStr); pList = pVM->pPackagesMap ; for ( x = 1 ; x <= ring_list_getsize(pList) ; x++ ) { pList2 = ring_list_getlist(pList,x); if ( strcmp(ring_list_getstring(pList2,RING_PACKAGENAME),cStr) == 0 ) { pList3 = RING_API_NEWLIST ; pList2 = ring_list_getlist(pList2,RING_CLASSESLIST) ; /* We can use the variable x for the loop again because we have return */ for ( x = 1 ; x <= ring_list_getsize(pList2) ; x++ ) { ring_list_addstring(pList3,ring_list_getstring(ring_list_getlist(pList2,x),RING_CLASSMAP_CLASSNAME)); } RING_API_RETLIST(pList3); return ; } } RING_API_RETNUMBER(0); } else { RING_API_ERROR(RING_API_BADPARATYPE); } }
void ring_vm_odbc_datasources ( void *pPointer ) { ring_odbc *pODBC ; SQLCHAR dsn[256] ; SQLCHAR desc[256] ; SQLSMALLINT dsn_ret ; SQLSMALLINT desc_ret ; SQLUSMALLINT direction ; List *pList ; String *pString ; if ( RING_API_PARACOUNT != 1 ) { RING_API_ERROR(RING_API_MISS1PARA); return ; } if ( RING_API_ISPOINTER(1) ) { pODBC = (ring_odbc *) RING_API_GETCPOINTER(1,RING_VM_POINTER_ODBC) ; if ( pODBC == NULL ) { return ; } pList = RING_API_NEWLIST ; direction = SQL_FETCH_FIRST ; while ( SQL_SUCCEEDED(SQLDataSources(pODBC->env, direction, dsn, sizeof(dsn), &dsn_ret,desc, sizeof(desc), &desc_ret)) ) { direction = SQL_FETCH_NEXT ; pString = ring_string_new((char *) dsn); ring_string_add(pString," - "); ring_string_add(pString, (char *) desc); ring_list_addstring(pList,ring_string_get(pString)); ring_string_delete(pString); } RING_API_RETLIST(pList); } else { RING_API_ERROR(RING_API_BADPARATYPE); } }
void ring_murmurhash3_x64_128(void *pPointer) { char *key = NULL; int keylen; int seed = 0; uint64_t out[2]; int ret_type = 0; List *tmp_list, *ret_val; if (RING_API_PARACOUNT < 2 || RING_API_PARACOUNT > 3) { RING_API_ERROR(RING_API_MISS2PARA); return ; } if (!RING_API_ISSTRING(1)) { RING_API_ERROR("murmurhash3_x64_128 expects the first parameter to be a string"); return; } if (!RING_API_ISNUMBER(2)) { RING_API_ERROR("murmurhash3_x64_128 expects the first parameter to be an integer"); return; } key = RING_API_GETSTRING(1); keylen = strlen(key); seed = RING_API_GETNUMBER(2); if (RING_API_PARACOUNT == 3) { if (RING_API_ISNUMBER(3)) { ret_type = RING_API_GETNUMBER(3); if (!is_bool(ret_type)) { RING_API_ERROR("Third parameter should be boolean value\n"); } } else { RING_API_ERROR("murmurhash3_x64_128 expects the third parameter to be an integer\n"); } } MurmurHash3_x64_128(key, keylen, seed, out); ret_val = RING_API_NEWLIST; tmp_list = ring_list_newlist_gc(((VM *)pPointer)->pRingState, ret_val); for (int i = 0; i < 2; i++) { if (ret_type) { char tmp[50]; LONG2HEX(tmp, out[i]); ring_list_addstring2(tmp_list, (char*) tmp, strlen((char *) tmp)); } else { ring_list_addint(tmp_list, out[i]); } } RING_API_RETLIST(ret_val); }
void ring_vm_refmeta_ringvmmemorylist ( void *pPointer ) { VM *pVM ; List *pList, *pList2 ; pVM = (VM *) pPointer ; pList = ring_list_new(0) ; ring_list_copy(pList,pVM->pMem); pList2 = RING_API_NEWLIST ; ring_list_copy(pList2,pList); ring_list_delete(pList); RING_API_RETLIST(pList2); }
void ring_vm_refmeta_classes ( void *pPointer ) { VM *pVM ; int x ; List *pList, *pList2 ; pVM = (VM *) pPointer ; pList = RING_API_NEWLIST ; for ( x = 1 ; x <= ring_list_getsize(pVM->pClassesMap) ; x++ ) { pList2 = ring_list_getlist(pVM->pClassesMap,x); ring_list_addstring(pList,ring_list_getstring(pList2,RING_CLASSMAP_CLASSNAME)); } RING_API_RETLIST(pList); }
void ring_vm_refmeta_cfunctions ( void *pPointer ) { VM *pVM ; int x ; List *pList, *pList2 ; pVM = (VM *) pPointer ; pList = RING_API_NEWLIST ; for ( x = 1 ; x <= ring_list_getsize(pVM->pCFunctionsList) ; x++ ) { pList2 = ring_list_getlist(pVM->pCFunctionsList,x); ring_list_addstring(pList,ring_list_getstring(pList2,RING_FUNCMAP_NAME)); } RING_API_RETLIST(pList); }
void ring_vm_refmeta_locals ( void *pPointer ) { VM *pVM ; int x ; List *pList, *pList2, *pList3 ; pVM = (VM *) pPointer ; /* We use -1 to skip the current scope of the locals() function */ pList = ring_list_getlist(pVM->pMem,ring_list_getsize(pVM->pMem)-1) ; pList2 = RING_API_NEWLIST ; for ( x = 1 ; x <= ring_list_getsize(pList) ; x++ ) { pList3 = ring_list_getlist(pList,x); ring_list_addstring(pList2,ring_list_getstring(pList3,RING_VAR_NAME)); } RING_API_RETLIST(pList2); }
void ring_vm_refmeta_globals ( void *pPointer ) { VM *pVM ; int x ; List *pList, *pList2, *pList3 ; pVM = (VM *) pPointer ; pList = ring_list_getlist(pVM->pMem,1) ; pList2 = RING_API_NEWLIST ; /* We avoid internal global variables like true, false */ for ( x = RING_VM_INTERNALGLOBALSCOUNT + 1 ; x <= ring_list_getsize(pList) ; x++ ) { pList3 = ring_list_getlist(pList,x); ring_list_addstring(pList2,ring_list_getstring(pList3,RING_VAR_NAME)); } RING_API_RETLIST(pList2); }
void ring_vm_refmeta_getattribute ( void *pPointer ) { List *pList ; char *cStr ; int x ; if ( RING_API_PARACOUNT != 2 ) { RING_API_ERROR(RING_API_BADPARACOUNT); return ; } if ( RING_API_ISLIST(1) && RING_API_ISSTRING(2) ) { pList = RING_API_GETLIST(1) ; if ( ring_vm_oop_isobject(pList) ) { pList = ring_list_getlist(pList,RING_OBJECT_OBJECTDATA); cStr = RING_API_GETSTRING(2) ; ring_string_lower(cStr); for ( x = 1 ; x <= ring_list_getsize(pList) ; x++ ) { if ( strcmp(ring_list_getstring(ring_list_getlist(pList,x),RING_VAR_NAME),cStr) == 0 ) { pList = ring_list_getlist(pList,x) ; if ( ring_list_isnumber(pList,RING_VAR_VALUE) ) { RING_API_RETNUMBER(ring_list_getdouble(pList,RING_VAR_VALUE)); } else if ( ring_list_isstring(pList,RING_VAR_VALUE) ) { RING_API_RETSTRING2(ring_list_getstring(pList,RING_VAR_VALUE),ring_list_getstringsize(pList,RING_VAR_VALUE)); } else if ( ring_list_islist(pList,RING_VAR_VALUE) ) { RING_API_RETLIST(ring_list_getlist(pList,RING_VAR_VALUE)); } return ; } } RING_API_ERROR("Error : Property is not found!"); } else { RING_API_ERROR(RING_API_BADPARATYPE); } } else { RING_API_ERROR(RING_API_BADPARATYPE); } }
void ring_vm_refmeta_attributes ( void *pPointer ) { List *pList, *pList2 ; int x ; if ( RING_API_PARACOUNT != 1 ) { RING_API_ERROR(RING_API_BADPARACOUNT); return ; } if ( RING_API_ISLIST(1) ) { pList = RING_API_GETLIST(1) ; if ( ring_vm_oop_isobject(pList) ) { pList = ring_list_getlist(pList,RING_OBJECT_OBJECTDATA); pList2 = RING_API_NEWLIST ; for ( x = 3 ; x <= ring_list_getsize(pList) ; x++ ) { ring_list_addstring(pList2,ring_list_getstring(ring_list_getlist(pList,x),RING_VAR_NAME)); } RING_API_RETLIST(pList2); } else { RING_API_ERROR(RING_API_BADPARATYPE); } } else { RING_API_ERROR(RING_API_BADPARATYPE); } }
void ring_vm_refmeta_ringvmcfunctionslist ( void *pPointer ) { VM *pVM ; pVM = (VM *) pPointer ; RING_API_RETLIST(pVM->pCFunctionsList); }
void ring_vm_refmeta_ringvmpackageslist ( void *pPointer ) { VM *pVM ; pVM = (VM *) pPointer ; RING_API_RETLIST(pVM->pPackagesMap); }
void GVideoWidget::geteventparameters(void) { void *pPointer; pPointer = this->pVM; RING_API_RETLIST(this->pParaList); }
void ring_vm_refmeta_ringvmcalllist ( void *pPointer ) { VM *pVM ; pVM = (VM *) pPointer ; RING_API_RETLIST(pVM->pFuncCallList); }
void ring_vm_refmeta_ringvmfileslist ( void *pPointer ) { VM *pVM ; pVM = (VM *) pPointer ; RING_API_RETLIST(pVM->pRingState->pRingFilesList); }
void GNetworkAccessManager::geteventparameters(void) { void *pPointer; pPointer = this->pVM; RING_API_RETLIST(this->pParaList); }
void GBluetoothServer::geteventparameters(void) { void *pPointer; pPointer = this->pVM; RING_API_RETLIST(this->pParaList); }
void GTreeView::geteventparameters(void) { void *pPointer; pPointer = this->pVM; RING_API_RETLIST(this->pParaList); }
void GPlainTextEdit::geteventparameters(void) { void *pPointer; pPointer = this->pVM; RING_API_RETLIST(this->pParaList); }