kbool_t LoadJsonModule(KonohaFactory *factory, ModuleType type) { static KModuleInfo ModuleInfo = { "Json", "0.1", 0, "json", }; factory->JsonDataInfo = &ModuleInfo; factory->IsJsonType = IsJsonType; factory->CreateJson = CreateJson; factory->ParseJson = ParseJson; factory->FreeJson = FreeJson; factory->JsonToNewText = JsonToNewText; factory->DoJsonEach = DoJsonEach; factory->RetrieveJsonKeyValue = RetrieveJsonKeyValue; factory->SetJsonKeyValue = SetJsonKeyValue; factory->SetJsonValue = SetJsonValue; factory->GetJsonBoolean = GetJsonBoolean; factory->GetJsonInt = GetJsonInt; factory->GetJsonFloat = GetJsonFloat; factory->GetJsonText = GetJsonText; factory->GetJsonSize = GetJsonSize; factory->RetrieveJsonArrayAt = RetrieveJsonArrayAt; factory->SetJsonArrayAt = SetJsonArrayAt; factory->AppendJsonArray = AppendJsonArray; factory->JsonHandler = (JSONMemoryPool *) malloc(sizeof(JSONMemoryPool)); JSONMemoryPool_Init((JSONMemoryPool *)factory->JsonHandler); return true; }
// ------------------------------------------------------------------------- static void InitJsonContext(KonohaContext *kctx) { KonohaFactory *factory = (KonohaFactory *) kctx->platApi; JSONMemoryPool *mp = (JSONMemoryPool *) malloc(sizeof(JSONMemoryPool)); JSONMemoryPool_Init(mp); factory->JsonModule.JsonHandler = (void *) mp; }