merge method.c to PikaObj.c ,rename platform to PikaPlatform

This commit is contained in:
lyon1998 2021-10-19 14:58:41 +08:00
parent 2782485553
commit dbc8ded47a
7 changed files with 38 additions and 54 deletions

View File

@ -505,3 +505,30 @@ void obj_sysPrintf(PikaObj* self, char* fmt, ...) {
obj_setSysOut(self, sysOut);
va_end(args);
}
void method_returnStr(Args* args, char* val) {
args_setStr(args, "return", val);
}
void method_returnInt(Args* args, int32_t val) {
args_setInt(args, "return", val);
}
void method_returnFloat(Args* args, float val) {
args_setFloat(args, "return", val);
}
void method_returnPtr(Args* args, void* val) {
args_setPtr(args, "return", val);
}
void method_returnArg(Args* args, Arg* arg) {
arg = arg_setName(arg, "return");
args_setArg(args, arg);
}
int32_t method_getInt(Args* args, char* argName) {
return args_getInt(args, argName);
}
float method_getFloat(Args* args, char* argName) {
return args_getFloat(args, argName);
}
char* method_getStr(Args* args, char* argName) {
return args_getStr(args, argName);
}

View File

@ -8,7 +8,6 @@
#include "dataArgs.h"
#include "dataLink.h"
#include "dataMemory.h"
#include "method.h"
typedef struct PikaObj_t PikaObj;
typedef PikaObj* (*NewFun)(Args* args);
typedef PikaObj* (*InitFun)(PikaObj* self, Args* args);
@ -96,4 +95,13 @@ uint8_t obj_getAnyArg(PikaObj* self,
char* sourceArgPath,
Args* targetArgs);
void method_returnStr(Args* args, char* val);
void method_returnInt(Args* args, int32_t val);
void method_returnFloat(Args* args, float val);
void method_returnPtr(Args* args, void* val);
int32_t method_getInt(Args* args, char* argName);
float method_getFloat(Args* args, char* argName);
char* method_getStr(Args* args, char* argName);
void method_returnArg(Args* args, Arg* arg);
#endif

View File

@ -1,4 +1,4 @@
#include "pikaPlatform.h"
#include "PikaPlatform.h"
#include <stdint.h>
#include <stdlib.h>
#include <stdarg.h>

View File

@ -9,7 +9,7 @@
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "pikaPlatform.h"
#include "PikaPlatform.h"
typedef struct {
uint32_t heapUsed;

View File

@ -1,34 +0,0 @@
/*
Author: lyon
Tencent QQ: 645275593
*/
#include "PikaObj.h"
#include "dataArgs.h"
void method_returnStr(Args* args, char* val) {
args_setStr(args, "return", val);
}
void method_returnInt(Args* args, int32_t val) {
args_setInt(args, "return", val);
}
void method_returnFloat(Args* args, float val) {
args_setFloat(args, "return", val);
}
void method_returnPtr(Args* args, void* val) {
args_setPtr(args, "return", val);
}
void method_returnArg(Args* args, Arg* arg) {
arg = arg_setName(arg, "return");
args_setArg(args, arg);
}
int32_t method_getInt(Args* args, char* argName) {
return args_getInt(args, argName);
}
float method_getFloat(Args* args, char* argName) {
return args_getFloat(args, argName);
}
char* method_getStr(Args* args, char* argName) {
return args_getStr(args, argName);
}

View File

@ -1,17 +0,0 @@
/*
Author: lyon
Tencent QQ: 645275593
*/
#ifndef METHOD__H
#define METHOD__H
#include "dataArgs.h"
void method_returnStr(Args* args, char* val);
void method_returnInt(Args* args, int32_t val);
void method_returnFloat(Args* args, float val);
void method_returnPtr(Args* args, void* val);
int32_t method_getInt(Args* args, char* argName);
float method_getFloat(Args* args, char* argName);
char* method_getStr(Args* args, char* argName);
void method_returnArg(Args* args, Arg* arg);
#endif