mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
merge method.c to PikaObj.c ,rename platform to PikaPlatform
This commit is contained in:
parent
2782485553
commit
dbc8ded47a
@ -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);
|
||||
}
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "pikaPlatform.h"
|
||||
#include "PikaPlatform.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
@ -9,7 +9,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "pikaPlatform.h"
|
||||
#include "PikaPlatform.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t heapUsed;
|
||||
|
34
src/method.c
34
src/method.c
@ -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);
|
||||
}
|
17
src/method.h
17
src/method.h
@ -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
|
Loading…
x
Reference in New Issue
Block a user