Use 'MRB_METHOD' macro
This commit is contained in:
parent
8674cb8e06
commit
121df799ab
|
@ -156,9 +156,10 @@ findLastDot(char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File class methods */
|
/* File class methods */
|
||||||
static mrb_value
|
MRB_METHOD(fileBasename)
|
||||||
fileBasename(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value filename;
|
mrb_value filename;
|
||||||
const char *suffix = 0;
|
const char *suffix = 0;
|
||||||
|
|
||||||
|
@ -185,9 +186,10 @@ fileBasename(mrb_state *mrb, mrb_value)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileDelete)
|
||||||
fileDelete(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_int argc;
|
mrb_int argc;
|
||||||
mrb_value *argv;
|
mrb_value *argv;
|
||||||
|
|
||||||
|
@ -207,9 +209,10 @@ fileDelete(mrb_state *mrb, mrb_value)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileDirname)
|
||||||
fileDirname(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value filename;
|
mrb_value filename;
|
||||||
mrb_get_args(mrb, "S", &filename);
|
mrb_get_args(mrb, "S", &filename);
|
||||||
|
|
||||||
|
@ -219,9 +222,10 @@ fileDirname(mrb_state *mrb, mrb_value)
|
||||||
return mrb_str_new_cstr(mrb, dir);
|
return mrb_str_new_cstr(mrb, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileExpandPath)
|
||||||
fileExpandPath(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *defDir = 0;
|
const char *defDir = 0;
|
||||||
|
|
||||||
|
@ -238,9 +242,10 @@ fileExpandPath(mrb_state *mrb, mrb_value)
|
||||||
return mrb_str_new_cstr(mrb, buffer);
|
return mrb_str_new_cstr(mrb, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileExtname)
|
||||||
fileExtname(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value filename;
|
mrb_value filename;
|
||||||
mrb_get_args(mrb, "S", &filename);
|
mrb_get_args(mrb, "S", &filename);
|
||||||
|
|
||||||
|
@ -249,9 +254,10 @@ fileExtname(mrb_state *mrb, mrb_value)
|
||||||
return mrb_str_new_cstr(mrb, ext);
|
return mrb_str_new_cstr(mrb, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileOpen)
|
||||||
fileOpen(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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();
|
||||||
|
@ -288,9 +294,10 @@ fileOpen(mrb_state *mrb, mrb_value)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileRename)
|
||||||
fileRename(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
|
|
||||||
|
@ -300,15 +307,15 @@ fileRename(mrb_state *mrb, mrb_value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(mrbNoop)
|
||||||
mrbNoop(mrb_state *, mrb_value self)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File instance methods */
|
/* File instance methods */
|
||||||
static mrb_value
|
MRB_METHOD(fileClose)
|
||||||
fileClose(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p);
|
checkValid(mrb, p);
|
||||||
|
@ -337,8 +344,7 @@ readLine(FILE *f, QVector<char> &buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileEachLine)
|
||||||
fileEachLine(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p, FileImpl::Read);
|
checkValid(mrb, p, FileImpl::Read);
|
||||||
|
@ -368,8 +374,7 @@ fileEachLine(mrb_state *mrb, mrb_value self)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileEachByte)
|
||||||
fileEachByte(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p, FileImpl::Read);
|
checkValid(mrb, p, FileImpl::Read);
|
||||||
|
@ -391,8 +396,7 @@ fileEachByte(mrb_state *mrb, mrb_value self)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileIsEof)
|
||||||
fileIsEof(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p);
|
checkValid(mrb, p);
|
||||||
|
@ -404,8 +408,7 @@ fileIsEof(mrb_state *mrb, mrb_value self)
|
||||||
return mrb_bool_value(isEof);
|
return mrb_bool_value(isEof);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileSetPos)
|
||||||
fileSetPos(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p);
|
checkValid(mrb, p);
|
||||||
|
@ -419,8 +422,7 @@ fileSetPos(mrb_state *mrb, mrb_value self)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileGetPos)
|
||||||
fileGetPos(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p);
|
checkValid(mrb, p);
|
||||||
|
@ -432,8 +434,7 @@ fileGetPos(mrb_state *mrb, mrb_value self)
|
||||||
return mrb_fixnum_value(pos);
|
return mrb_fixnum_value(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileRead)
|
||||||
fileRead(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p, FileImpl::Read);
|
checkValid(mrb, p, FileImpl::Read);
|
||||||
|
@ -458,8 +459,7 @@ fileRead(mrb_state *mrb, mrb_value self)
|
||||||
|
|
||||||
// FIXME this function always splits on newline right now,
|
// FIXME this function always splits on newline right now,
|
||||||
// to make rs fully work, I'll have to use some strrstr magic I guess
|
// to make rs fully work, I'll have to use some strrstr magic I guess
|
||||||
static mrb_value
|
MRB_METHOD(fileReadLines)
|
||||||
fileReadLines(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p, FileImpl::Read);
|
checkValid(mrb, p, FileImpl::Read);
|
||||||
|
@ -497,8 +497,7 @@ fileReadLines(mrb_state *mrb, mrb_value self)
|
||||||
return ary;
|
return ary;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileWrite)
|
||||||
fileWrite(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p, FileImpl::Write);
|
checkValid(mrb, p, FileImpl::Write);
|
||||||
|
@ -513,8 +512,7 @@ fileWrite(mrb_state *mrb, mrb_value self)
|
||||||
return mrb_fixnum_value(count);
|
return mrb_fixnum_value(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileGetPath)
|
||||||
fileGetPath(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
FileImpl *p = getPrivateData<FileImpl>(mrb, self);
|
||||||
checkValid(mrb, p);
|
checkValid(mrb, p);
|
||||||
|
@ -531,8 +529,7 @@ getFileStat(mrb_state *mrb, struct stat &fileStat)
|
||||||
stat(filename, &fileStat);
|
stat(filename, &fileStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileGetMtime)
|
||||||
fileGetMtime(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
mrb_value path = getProperty(mrb, self, CSpath);
|
mrb_value path = getProperty(mrb, self, CSpath);
|
||||||
|
|
||||||
|
@ -543,9 +540,10 @@ fileGetMtime(mrb_state *mrb, mrb_value self)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FileTest module functions */
|
/* FileTest module functions */
|
||||||
static mrb_value
|
MRB_METHOD(fileTestDoesExist)
|
||||||
fileTestDoesExist(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
mrb_get_args(mrb, "z", &filename);
|
mrb_get_args(mrb, "z", &filename);
|
||||||
|
|
||||||
|
@ -554,27 +552,30 @@ fileTestDoesExist(mrb_state *mrb, mrb_value)
|
||||||
return mrb_bool_value(result == 0);
|
return mrb_bool_value(result == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileTestIsFile)
|
||||||
fileTestIsFile(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileTestIsDirectory)
|
||||||
fileTestIsDirectory(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(fileTestSize)
|
||||||
fileTestSize(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
getFileStat(mrb, fileStat);
|
getFileStat(mrb, fileStat);
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,10 @@
|
||||||
|
|
||||||
void mrbBindingTerminate();
|
void mrbBindingTerminate();
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelEval)
|
||||||
kernelEval(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
|
@ -73,17 +74,19 @@ static void printP(mrb_state *mrb,
|
||||||
gState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
|
gState->eThread().showMessageBox(RSTRING_PTR(buffer), SDL_MESSAGEBOX_INFORMATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelP)
|
||||||
kernelP(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
printP(mrb, "inspect", "\n");
|
printP(mrb, "inspect", "\n");
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelPrint)
|
||||||
kernelPrint(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
printP(mrb, "to_s", "");
|
printP(mrb, "to_s", "");
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
|
@ -105,9 +108,10 @@ srandCurrentTime(int *currentSeed)
|
||||||
srand(*currentSeed);
|
srand(*currentSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelRand)
|
||||||
kernelRand(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
if (!srandCalled)
|
if (!srandCalled)
|
||||||
{
|
{
|
||||||
srandCurrentTime(¤tSeed);
|
srandCurrentTime(¤tSeed);
|
||||||
|
@ -138,9 +142,10 @@ kernelRand(mrb_state *mrb, mrb_value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelSrand)
|
||||||
kernelSrand(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
srandCalled = true;
|
srandCalled = true;
|
||||||
|
|
||||||
if (mrb->c->ci->argc == 1)
|
if (mrb->c->ci->argc == 1)
|
||||||
|
@ -163,17 +168,19 @@ kernelSrand(mrb_state *mrb, mrb_value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelExit)
|
||||||
kernelExit(mrb_state *, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrbBindingTerminate();
|
mrbBindingTerminate();
|
||||||
|
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelLoadData)
|
||||||
kernelLoadData(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
const char *filename;
|
const char *filename;
|
||||||
mrb_get_args(mrb, "z", &filename);
|
mrb_get_args(mrb, "z", &filename);
|
||||||
|
|
||||||
|
@ -193,9 +200,10 @@ kernelLoadData(mrb_state *mrb, mrb_value)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelSaveData)
|
||||||
kernelSaveData(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value obj;
|
mrb_value obj;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
|
|
||||||
|
@ -217,9 +225,10 @@ kernelSaveData(mrb_state *mrb, mrb_value)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(kernelInteger)
|
||||||
kernelInteger(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value obj;
|
mrb_value obj;
|
||||||
mrb_get_args(mrb, "o", &obj);
|
mrb_get_args(mrb, "o", &obj);
|
||||||
|
|
||||||
|
|
|
@ -882,9 +882,10 @@ 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)");
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(marshalDump)
|
||||||
marshalDump(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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;
|
||||||
|
@ -944,9 +945,10 @@ marshalDump(mrb_state *mrb, mrb_value)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(marshalLoad)
|
||||||
marshalLoad(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
mrb_value port;
|
mrb_value port;
|
||||||
|
|
||||||
mrb_get_args(mrb, "o", &port);
|
mrb_get_args(mrb, "o", &port);
|
||||||
|
|
|
@ -53,18 +53,20 @@ timeFromSecondsInt(mrb_state *mrb, time_t seconds)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(timeAt)
|
||||||
timeAt(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(timeNow)
|
||||||
timeNow(mrb_state *mrb, mrb_value)
|
|
||||||
{
|
{
|
||||||
|
MRB_UNUSED_PARAM;
|
||||||
|
|
||||||
TimeImpl *p = new TimeImpl;
|
TimeImpl *p = new TimeImpl;
|
||||||
|
|
||||||
gettimeofday(&p->_tv, 0);
|
gettimeofday(&p->_tv, 0);
|
||||||
|
@ -87,8 +89,7 @@ secondsAdded(mrb_state *mrb, TimeImpl *p, mrb_int seconds)
|
||||||
return wrapObject(mrb, newP, TimeType);
|
return wrapObject(mrb, newP, TimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(timePlus)
|
||||||
timePlus(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
mrb_int seconds;
|
mrb_int seconds;
|
||||||
mrb_get_args(mrb, "i", &seconds);
|
mrb_get_args(mrb, "i", &seconds);
|
||||||
|
@ -104,8 +105,7 @@ timePlus(mrb_state *mrb, mrb_value self)
|
||||||
return wrapObject(mrb, newP, TimeType);
|
return wrapObject(mrb, newP, TimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(timeMinus)
|
||||||
timeMinus(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
mrb_value minuent;
|
mrb_value minuent;
|
||||||
mrb_get_args(mrb, "o", &minuent);
|
mrb_get_args(mrb, "o", &minuent);
|
||||||
|
@ -133,8 +133,7 @@ timeMinus(mrb_state *mrb, mrb_value self)
|
||||||
return mrb_nil_value();
|
return mrb_nil_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(timeCompare)
|
||||||
timeCompare(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
mrb_value cmpTo;
|
mrb_value cmpTo;
|
||||||
mrb_get_args(mrb, "o", &cmpTo);
|
mrb_get_args(mrb, "o", &cmpTo);
|
||||||
|
@ -167,8 +166,7 @@ timeCompare(mrb_state *mrb, mrb_value self)
|
||||||
return mrb_fixnum_value(1);
|
return mrb_fixnum_value(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static mrb_value
|
MRB_METHOD(timeStrftime)
|
||||||
timeStrftime(mrb_state *mrb, mrb_value self)
|
|
||||||
{
|
{
|
||||||
const char *format;
|
const char *format;
|
||||||
mrb_get_args(mrb, "z", &format);
|
mrb_get_args(mrb, "z", &format);
|
||||||
|
@ -182,8 +180,7 @@ timeStrftime(mrb_state *mrb, mrb_value self)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIME_ATTR(attr) \
|
#define TIME_ATTR(attr) \
|
||||||
static mrb_value \
|
MRB_METHOD(timeGet_##attr) \
|
||||||
timeGet_##attr(mrb_state *mrb, mrb_value self) \
|
|
||||||
{ \
|
{ \
|
||||||
TimeImpl *p = getPrivateData<TimeImpl>(mrb, self); \
|
TimeImpl *p = getPrivateData<TimeImpl>(mrb, self); \
|
||||||
return mrb_fixnum_value(p->_tm.tm_##attr); \
|
return mrb_fixnum_value(p->_tm.tm_##attr); \
|
||||||
|
|
Loading…
Reference in New Issue