Use 'MRB_FUNCTION' instead of 'MRB_METHOD' for modules
This commit is contained in:
parent
121df799ab
commit
d151986c72
|
@ -25,9 +25,8 @@
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
|
||||||
#define DEF_PLAY_STOP(entity) \
|
#define DEF_PLAY_STOP(entity) \
|
||||||
MRB_METHOD(audio_##entity##Play) \
|
MRB_FUNCTION(audio_##entity##Play) \
|
||||||
{ \
|
{ \
|
||||||
MRB_UNUSED_PARAM; \
|
|
||||||
char *filename; \
|
char *filename; \
|
||||||
mrb_int volume = 100; \
|
mrb_int volume = 100; \
|
||||||
mrb_int pitch = 100; \
|
mrb_int pitch = 100; \
|
||||||
|
@ -35,17 +34,16 @@
|
||||||
GUARD_EXC( gState->audio().entity##Play(filename, volume, pitch); ) \
|
GUARD_EXC( gState->audio().entity##Play(filename, volume, pitch); ) \
|
||||||
return mrb_nil_value(); \
|
return mrb_nil_value(); \
|
||||||
} \
|
} \
|
||||||
MRB_METHOD(audio_##entity##Stop) \
|
MRB_FUNCTION(audio_##entity##Stop) \
|
||||||
{ \
|
{ \
|
||||||
MRB_UNUSED_PARAM; \
|
MRB_FUN_UNUSED_PARAM; \
|
||||||
gState->audio().entity##Stop(); \
|
gState->audio().entity##Stop(); \
|
||||||
return mrb_nil_value(); \
|
return mrb_nil_value(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_FADE(entity) \
|
#define DEF_FADE(entity) \
|
||||||
MRB_METHOD(audio_##entity##Fade) \
|
MRB_FUNCTION(audio_##entity##Fade) \
|
||||||
{ \
|
{ \
|
||||||
MRB_UNUSED_PARAM; \
|
|
||||||
mrb_int time; \
|
mrb_int time; \
|
||||||
mrb_get_args(mrb, "i", &time); \
|
mrb_get_args(mrb, "i", &time); \
|
||||||
gState->audio().entity##Fade(time); \
|
gState->audio().entity##Fade(time); \
|
||||||
|
|
|
@ -129,9 +129,14 @@ getMrbData(mrb_state *mrb)
|
||||||
|
|
||||||
#define MRB_METHOD(name) static MRB_METHOD_PUB(name)
|
#define MRB_METHOD(name) static MRB_METHOD_PUB(name)
|
||||||
|
|
||||||
|
#define MRB_FUNCTION(name) \
|
||||||
|
static mrb_value name(mrb_state *mrb, mrb_value)
|
||||||
|
|
||||||
#define MRB_UNUSED_PARAM \
|
#define MRB_UNUSED_PARAM \
|
||||||
{ (void) mrb; (void) self; }
|
{ (void) mrb; (void) self; }
|
||||||
|
|
||||||
|
#define MRB_FUN_UNUSED_PARAM { (void) mrb; }
|
||||||
|
|
||||||
/* If we're not binding a disposable class,
|
/* If we're not binding a disposable class,
|
||||||
* we want to #undef DEF_PROP_CHK_DISP */
|
* we want to #undef DEF_PROP_CHK_DISP */
|
||||||
#define DEF_PROP_CHK_DISP \
|
#define DEF_PROP_CHK_DISP \
|
||||||
|
|
|
@ -28,10 +28,8 @@
|
||||||
|
|
||||||
DEF_TYPE(Font);
|
DEF_TYPE(Font);
|
||||||
|
|
||||||
MRB_METHOD(fontDoesExist)
|
MRB_FUNCTION(fontDoesExist)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *name;
|
const char *name;
|
||||||
mrb_get_args(mrb, "z", &name);
|
mrb_get_args(mrb, "z", &name);
|
||||||
|
|
||||||
|
@ -102,17 +100,13 @@ DEF_KLASS_PROP(Font, mrb_int, DefaultSize, "i", fixnum)
|
||||||
DEF_KLASS_PROP(Font, mrb_bool, DefaultBold, "b", bool)
|
DEF_KLASS_PROP(Font, mrb_bool, DefaultBold, "b", bool)
|
||||||
DEF_KLASS_PROP(Font, mrb_bool, DefaultItalic, "b", bool)
|
DEF_KLASS_PROP(Font, mrb_bool, DefaultItalic, "b", bool)
|
||||||
|
|
||||||
MRB_METHOD(FontGetDefaultName)
|
MRB_FUNCTION(FontGetDefaultName)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
return mrb_str_new_cstr(mrb, Font::getDefaultName());
|
return mrb_str_new_cstr(mrb, Font::getDefaultName());
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(FontSetDefaultName)
|
MRB_FUNCTION(FontSetDefaultName)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value nameObj;
|
mrb_value nameObj;
|
||||||
mrb_get_args(mrb, "S", &nameObj);
|
mrb_get_args(mrb, "S", &nameObj);
|
||||||
|
|
||||||
|
|
|
@ -25,28 +25,26 @@
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
|
|
||||||
MRB_METHOD(graphicsUpdate)
|
MRB_FUNCTION(graphicsUpdate)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
MRB_FUN_UNUSED_PARAM;
|
||||||
|
|
||||||
gState->graphics().update();
|
gState->graphics().update();
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(graphicsFreeze)
|
MRB_FUNCTION(graphicsFreeze)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
MRB_FUN_UNUSED_PARAM;
|
||||||
|
|
||||||
gState->graphics().freeze();
|
gState->graphics().freeze();
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(graphicsTransition)
|
MRB_FUNCTION(graphicsTransition)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_int duration = 8;
|
mrb_int duration = 8;
|
||||||
const char *filename = 0;
|
const char *filename = 0;
|
||||||
mrb_int vague = 40;
|
mrb_int vague = 40;
|
||||||
|
@ -58,9 +56,9 @@ MRB_METHOD(graphicsTransition)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(graphicsFrameReset)
|
MRB_FUNCTION(graphicsFrameReset)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
MRB_FUN_UNUSED_PARAM;
|
||||||
|
|
||||||
gState->graphics().frameReset();
|
gState->graphics().frameReset();
|
||||||
|
|
||||||
|
@ -68,14 +66,13 @@ MRB_METHOD(graphicsFrameReset)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEF_GRA_PROP_I(PropName) \
|
#define DEF_GRA_PROP_I(PropName) \
|
||||||
MRB_METHOD(graphics##Get##PropName) \
|
MRB_FUNCTION(graphics##Get##PropName) \
|
||||||
{ \
|
{ \
|
||||||
MRB_UNUSED_PARAM; \
|
MRB_FUN_UNUSED_PARAM; \
|
||||||
return mrb_fixnum_value(gState->graphics().get##PropName()); \
|
return mrb_fixnum_value(gState->graphics().get##PropName()); \
|
||||||
} \
|
} \
|
||||||
MRB_METHOD(graphics##Set##PropName) \
|
MRB_FUNCTION(graphics##Set##PropName) \
|
||||||
{ \
|
{ \
|
||||||
MRB_UNUSED_PARAM; \
|
|
||||||
mrb_int value; \
|
mrb_int value; \
|
||||||
mrb_get_args(mrb, "i", &value); \
|
mrb_get_args(mrb, "i", &value); \
|
||||||
gState->graphics().set##PropName(value); \
|
gState->graphics().set##PropName(value); \
|
||||||
|
@ -85,17 +82,15 @@ MRB_METHOD(graphicsFrameReset)
|
||||||
DEF_GRA_PROP_I(FrameRate)
|
DEF_GRA_PROP_I(FrameRate)
|
||||||
DEF_GRA_PROP_I(FrameCount)
|
DEF_GRA_PROP_I(FrameCount)
|
||||||
|
|
||||||
MRB_METHOD(graphicsGetFullscreen)
|
MRB_FUNCTION(graphicsGetFullscreen)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
MRB_FUN_UNUSED_PARAM;
|
||||||
|
|
||||||
return mrb_bool_value(gState->graphics().getFullscreen());
|
return mrb_bool_value(gState->graphics().getFullscreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(graphicsSetFullscreen)
|
MRB_FUNCTION(graphicsSetFullscreen)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_bool mode;
|
mrb_bool mode;
|
||||||
mrb_get_args(mrb, "b", &mode);
|
mrb_get_args(mrb, "b", &mode);
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,15 @@
|
||||||
#include "exception.h"
|
#include "exception.h"
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
|
|
||||||
MRB_METHOD(inputUpdate)
|
MRB_FUNCTION(inputUpdate)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
gState->input().update();
|
gState->input().update();
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(inputPress)
|
MRB_FUNCTION(inputPress)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_int num;
|
mrb_int num;
|
||||||
mrb_get_args(mrb, "i", &num);
|
mrb_get_args(mrb, "i", &num);
|
||||||
|
|
||||||
|
@ -45,10 +41,8 @@ MRB_METHOD(inputPress)
|
||||||
return mrb_bool_value(gState->input().isPressed(bc));
|
return mrb_bool_value(gState->input().isPressed(bc));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(inputTrigger)
|
MRB_FUNCTION(inputTrigger)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_int num;
|
mrb_int num;
|
||||||
mrb_get_args(mrb, "i", &num);
|
mrb_get_args(mrb, "i", &num);
|
||||||
|
|
||||||
|
@ -57,10 +51,8 @@ MRB_METHOD(inputTrigger)
|
||||||
return mrb_bool_value(gState->input().isTriggered(bc));
|
return mrb_bool_value(gState->input().isTriggered(bc));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(inputRepeat)
|
MRB_FUNCTION(inputRepeat)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_int num;
|
mrb_int num;
|
||||||
mrb_get_args(mrb, "i", &num);
|
mrb_get_args(mrb, "i", &num);
|
||||||
|
|
||||||
|
@ -69,32 +61,24 @@ MRB_METHOD(inputRepeat)
|
||||||
return mrb_bool_value(gState->input().isRepeated(bc));
|
return mrb_bool_value(gState->input().isRepeated(bc));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(inputDir4)
|
MRB_FUNCTION(inputDir4)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
return mrb_fixnum_value(gState->input().dir4Value());
|
return mrb_fixnum_value(gState->input().dir4Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(inputDir8)
|
MRB_FUNCTION(inputDir8)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
return mrb_fixnum_value(gState->input().dir8Value());
|
return mrb_fixnum_value(gState->input().dir8Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Non-standard extensions */
|
/* Non-standard extensions */
|
||||||
MRB_METHOD(inputMouseX)
|
MRB_FUNCTION(inputMouseX)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
return mrb_fixnum_value(gState->input().mouseX());
|
return mrb_fixnum_value(gState->input().mouseX());
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(inputMouseY)
|
MRB_FUNCTION(inputMouseY)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
return mrb_fixnum_value(gState->input().mouseY());
|
return mrb_fixnum_value(gState->input().mouseY());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -156,10 +156,8 @@ findLastDot(char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File class methods */
|
/* File class methods */
|
||||||
MRB_METHOD(fileBasename)
|
MRB_FUNCTION(fileBasename)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value filename;
|
mrb_value filename;
|
||||||
const char *suffix = 0;
|
const char *suffix = 0;
|
||||||
|
|
||||||
|
@ -186,10 +184,8 @@ MRB_METHOD(fileBasename)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileDelete)
|
MRB_FUNCTION(fileDelete)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_int argc;
|
mrb_int argc;
|
||||||
mrb_value *argv;
|
mrb_value *argv;
|
||||||
|
|
||||||
|
@ -209,10 +205,8 @@ MRB_METHOD(fileDelete)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileDirname)
|
MRB_FUNCTION(fileDirname)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value filename;
|
mrb_value filename;
|
||||||
mrb_get_args(mrb, "S", &filename);
|
mrb_get_args(mrb, "S", &filename);
|
||||||
|
|
||||||
|
@ -222,10 +216,8 @@ MRB_METHOD(fileDirname)
|
||||||
return mrb_str_new_cstr(mrb, dir);
|
return mrb_str_new_cstr(mrb, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileExpandPath)
|
MRB_FUNCTION(fileExpandPath)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *defDir = 0;
|
const char *defDir = 0;
|
||||||
|
|
||||||
|
@ -242,10 +234,8 @@ MRB_METHOD(fileExpandPath)
|
||||||
return mrb_str_new_cstr(mrb, buffer);
|
return mrb_str_new_cstr(mrb, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileExtname)
|
MRB_FUNCTION(fileExtname)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value filename;
|
mrb_value filename;
|
||||||
mrb_get_args(mrb, "S", &filename);
|
mrb_get_args(mrb, "S", &filename);
|
||||||
|
|
||||||
|
@ -254,10 +244,8 @@ MRB_METHOD(fileExtname)
|
||||||
return mrb_str_new_cstr(mrb, ext);
|
return mrb_str_new_cstr(mrb, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileOpen)
|
MRB_FUNCTION(fileOpen)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value path;
|
mrb_value path;
|
||||||
const char *mode = "r";
|
const char *mode = "r";
|
||||||
mrb_value block = mrb_nil_value();
|
mrb_value block = mrb_nil_value();
|
||||||
|
@ -294,10 +282,8 @@ MRB_METHOD(fileOpen)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileRename)
|
MRB_FUNCTION(fileRename)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *from, *to;
|
const char *from, *to;
|
||||||
mrb_get_args(mrb, "zz", &from, &to);
|
mrb_get_args(mrb, "zz", &from, &to);
|
||||||
|
|
||||||
|
@ -307,11 +293,11 @@ MRB_METHOD(fileRename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MRB_METHOD(mrbNoop)
|
MRB_FUNCTION(mrbNoop)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
MRB_FUN_UNUSED_PARAM;
|
||||||
|
|
||||||
return self;
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File instance methods */
|
/* File instance methods */
|
||||||
|
@ -540,10 +526,8 @@ MRB_METHOD(fileGetMtime)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FileTest module functions */
|
/* FileTest module functions */
|
||||||
MRB_METHOD(fileTestDoesExist)
|
MRB_FUNCTION(fileTestDoesExist)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
mrb_get_args(mrb, "z", &filename);
|
mrb_get_args(mrb, "z", &filename);
|
||||||
|
|
||||||
|
@ -552,30 +536,24 @@ MRB_METHOD(fileTestDoesExist)
|
||||||
return mrb_bool_value(result == 0);
|
return mrb_bool_value(result == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileTestIsFile)
|
MRB_FUNCTION(fileTestIsFile)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
getFileStat(mrb, fileStat);
|
getFileStat(mrb, fileStat);
|
||||||
|
|
||||||
return mrb_bool_value(S_ISREG(fileStat.st_mode));
|
return mrb_bool_value(S_ISREG(fileStat.st_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileTestIsDirectory)
|
MRB_FUNCTION(fileTestIsDirectory)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
getFileStat(mrb, fileStat);
|
getFileStat(mrb, fileStat);
|
||||||
|
|
||||||
return mrb_bool_value(S_ISDIR(fileStat.st_mode));
|
return mrb_bool_value(S_ISDIR(fileStat.st_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(fileTestSize)
|
MRB_FUNCTION(fileTestSize)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
getFileStat(mrb, fileStat);
|
getFileStat(mrb, fileStat);
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,8 @@
|
||||||
|
|
||||||
void mrbBindingTerminate();
|
void mrbBindingTerminate();
|
||||||
|
|
||||||
MRB_METHOD(kernelEval)
|
MRB_FUNCTION(kernelEval)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *exp;
|
const char *exp;
|
||||||
mrb_int expLen;
|
mrb_int expLen;
|
||||||
mrb_get_args(mrb, "s", &exp, &expLen);
|
mrb_get_args(mrb, "s", &exp, &expLen);
|
||||||
|
@ -74,19 +72,15 @@ static void printP(mrb_state *mrb,
|
||||||
gState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
|
gState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelP)
|
MRB_FUNCTION(kernelP)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
printP(mrb, "inspect", "\n");
|
printP(mrb, "inspect", "\n");
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelPrint)
|
MRB_FUNCTION(kernelPrint)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
printP(mrb, "to_s", "");
|
printP(mrb, "to_s", "");
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
|
@ -108,10 +102,8 @@ srandCurrentTime(int *currentSeed)
|
||||||
srand(*currentSeed);
|
srand(*currentSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelRand)
|
MRB_FUNCTION(kernelRand)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
if (!srandCalled)
|
if (!srandCalled)
|
||||||
{
|
{
|
||||||
srandCurrentTime(¤tSeed);
|
srandCurrentTime(¤tSeed);
|
||||||
|
@ -142,10 +134,8 @@ MRB_METHOD(kernelRand)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelSrand)
|
MRB_FUNCTION(kernelSrand)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
srandCalled = true;
|
srandCalled = true;
|
||||||
|
|
||||||
if (mrb->c->ci->argc == 1)
|
if (mrb->c->ci->argc == 1)
|
||||||
|
@ -168,19 +158,17 @@ MRB_METHOD(kernelSrand)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelExit)
|
MRB_FUNCTION(kernelExit)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
MRB_FUN_UNUSED_PARAM;
|
||||||
|
|
||||||
mrbBindingTerminate();
|
mrbBindingTerminate();
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelLoadData)
|
MRB_FUNCTION(kernelLoadData)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
mrb_get_args(mrb, "z", &filename);
|
mrb_get_args(mrb, "z", &filename);
|
||||||
|
|
||||||
|
@ -200,10 +188,8 @@ MRB_METHOD(kernelLoadData)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelSaveData)
|
MRB_FUNCTION(kernelSaveData)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value obj;
|
mrb_value obj;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
|
|
||||||
|
@ -225,10 +211,8 @@ MRB_METHOD(kernelSaveData)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(kernelInteger)
|
MRB_FUNCTION(kernelInteger)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value obj;
|
mrb_value obj;
|
||||||
mrb_get_args(mrb, "o", &obj);
|
mrb_get_args(mrb, "o", &obj);
|
||||||
|
|
||||||
|
|
|
@ -882,10 +882,8 @@ verifyMarshalHeader(MarshalContext *ctx)
|
||||||
throw Exception(Exception::TypeError, "incompatible marshal file format (can't be read)");
|
throw Exception(Exception::TypeError, "incompatible marshal file format (can't be read)");
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(marshalDump)
|
MRB_FUNCTION(marshalDump)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value val;
|
mrb_value val;
|
||||||
mrb_value port = mrb_nil_value();
|
mrb_value port = mrb_nil_value();
|
||||||
mrb_int limit = 100;
|
mrb_int limit = 100;
|
||||||
|
@ -945,10 +943,8 @@ MRB_METHOD(marshalDump)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(marshalLoad)
|
MRB_FUNCTION(marshalLoad)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_value port;
|
mrb_value port;
|
||||||
|
|
||||||
mrb_get_args(mrb, "o", &port);
|
mrb_get_args(mrb, "o", &port);
|
||||||
|
|
|
@ -53,20 +53,16 @@ timeFromSecondsInt(mrb_state *mrb, time_t seconds)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(timeAt)
|
MRB_FUNCTION(timeAt)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
mrb_int seconds;
|
mrb_int seconds;
|
||||||
mrb_get_args(mrb, "i", &seconds);
|
mrb_get_args(mrb, "i", &seconds);
|
||||||
|
|
||||||
return timeFromSecondsInt(mrb, seconds);
|
return timeFromSecondsInt(mrb, seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
MRB_METHOD(timeNow)
|
MRB_FUNCTION(timeNow)
|
||||||
{
|
{
|
||||||
MRB_UNUSED_PARAM;
|
|
||||||
|
|
||||||
TimeImpl *p = new TimeImpl;
|
TimeImpl *p = new TimeImpl;
|
||||||
|
|
||||||
gettimeofday(&p->_tv, 0);
|
gettimeofday(&p->_tv, 0);
|
||||||
|
|
Loading…
Reference in New Issue