mirror of https://github.com/mgba-emu/mgba.git
Scripting: Add "internal" marker to classes, exported to docgen
This commit is contained in:
parent
7719dd5ec4
commit
91fb63c484
|
@ -233,6 +233,10 @@ CXX_GUARD_START
|
|||
} \
|
||||
},
|
||||
|
||||
#define mSCRIPT_DEFINE_INTERNAL { \
|
||||
.type = mSCRIPT_CLASS_INIT_INTERNAL \
|
||||
},
|
||||
|
||||
#define _mSCRIPT_STRUCT_METHOD_POP(TYPE, S, NPARAMS, ...) \
|
||||
_mCALL(_mCAT(mSCRIPT_POP_, _mSUCC_ ## NPARAMS), &frame->arguments, _mCOMMA_ ## NPARAMS(S(TYPE), __VA_ARGS__)); \
|
||||
if (mScriptListSize(&frame->arguments)) { \
|
||||
|
|
|
@ -154,6 +154,7 @@ enum mScriptClassInitType {
|
|||
mSCRIPT_CLASS_INIT_DEINIT,
|
||||
mSCRIPT_CLASS_INIT_GET,
|
||||
mSCRIPT_CLASS_INIT_SET,
|
||||
mSCRIPT_CLASS_INIT_INTERNAL,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -245,6 +246,7 @@ struct mScriptTypeClass {
|
|||
const struct mScriptClassInitDetails* details;
|
||||
const struct mScriptType* parent;
|
||||
const char* docstring;
|
||||
bool internal;
|
||||
struct Table instanceMembers;
|
||||
struct Table castToMembers;
|
||||
struct mScriptClassMember* alloc; // TODO
|
||||
|
|
|
@ -208,6 +208,9 @@ void explainClass(struct mScriptTypeClass* cls, int level) {
|
|||
if (cls->parent) {
|
||||
fprintf(out, "%sparent: %s\n", indent, cls->parent->name);
|
||||
}
|
||||
if (cls->internal) {
|
||||
fprintf(out, "%sinternal: true\n", indent);
|
||||
}
|
||||
if (cls->docstring) {
|
||||
if (strchr(cls->docstring, '\n')) {
|
||||
fprintf(out, "%scomment: |-\n", indent);
|
||||
|
|
|
@ -204,6 +204,7 @@ mSCRIPT_DECLARE_STRUCT_METHOD(mScriptSocket, WSTR, recv, _mScriptSocketRecv, 1,
|
|||
mSCRIPT_DECLARE_STRUCT_METHOD(mScriptSocket, S32, select, _mScriptSocketSelectOne, 1, S64, timeoutMillis);
|
||||
|
||||
mSCRIPT_DEFINE_STRUCT(mScriptSocket)
|
||||
mSCRIPT_DEFINE_INTERNAL
|
||||
mSCRIPT_DEFINE_CLASS_DOCSTRING("An internal implementation of a TCP network socket.")
|
||||
mSCRIPT_DEFINE_STRUCT_DEINIT_NAMED(mScriptSocket, close)
|
||||
mSCRIPT_DEFINE_DOCSTRING("Closes the socket. If the socket is already closed, this function does nothing.")
|
||||
|
|
|
@ -1088,6 +1088,9 @@ static void _mScriptClassInit(struct mScriptTypeClass* cls, const struct mScript
|
|||
docstring = NULL;
|
||||
}
|
||||
break;
|
||||
case mSCRIPT_CLASS_INIT_INTERNAL:
|
||||
cls->internal = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue