OS
examples-os
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
proj.win32
add_user_module
os
osbind
profile_benchmark
scripts
test_fannkuch.os
run_os_prog
stack_usage
source
bin
os.exe
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
Makefile
test_fannkuch.os
unitpoint-objectscript-86f30d7
.gitignore
bin
.gitignore
examples-os
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
proj.win32
.gitignore
add_user_module
.gitignore
os
.gitignore
test_fannkuch.osc
test_fannkuch.osd
osbind
.gitignore
profile_benchmark
.gitignore
scripts
test_fannkuch.os
run_os_prog
.gitignore
stack_usage
.gitignore
source
.gitignore
.gitignore
.gitignore
os.exe
add_user_module.os
bind.os
core.os
run_os_prog.os
test.os
.gitignore
.gitignore
.gitignore
test_fannkuch.osc
test_fannkuch.osd
.gitignore
.gitignore
test_fannkuch.os
.gitignore
.gitignore
.gitignore
|
template <class R OS_BIND_FUNC_PARMS_COMMA OS_BIND_FUNC_TEMPLATE_PARMS>
struct OS_BIND_FUNC_RUN_CLASS_NAME
{
typedef R(OS_BIND_FUNC_CC *F)(OS_BIND_FUNC_PARMS) OS_BIND_FUNC_CC_GNUC;
static int run(OS * os, int params, int, int, void * user_param)
{
OS_BIND_FUNC_GET_ARGS;
typedef typename RemoveConst<R>::type type;
F& f = *(F*)user_param;
CtypeValue<type>::push(os, (*f)(OS_BIND_FUNC_ARGS));
return 1;
}
};
template <OS_BIND_FUNC_TEMPLATE_PARMS>
struct OS_BIND_FUNC_RUN_CLASS_NAME<void OS_BIND_FUNC_PARMS_COMMA OS_BIND_FUNC_PARMS>
{
typedef void(OS_BIND_FUNC_CC *F)(OS_BIND_FUNC_PARMS) OS_BIND_FUNC_CC_GNUC;
static int run(OS * os, int params, int, int, void * user_param)
{
OS_BIND_FUNC_GET_ARGS;
F& f = *(F*)user_param;
(*f)(OS_BIND_FUNC_ARGS);
return 0;
}
};
template <class R OS_BIND_FUNC_PARMS_COMMA OS_BIND_FUNC_TEMPLATE_PARMS>
struct OS_BIND_FUNC_CLASS_NAME
{
typedef R(OS_BIND_FUNC_CC *F)(OS_BIND_FUNC_PARMS) OS_BIND_FUNC_CC_GNUC;
const char * name;
F f;
OS_BIND_FUNC_CLASS_NAME(const char * _name, F _f): name(_name), f(_f){}
operator OS::FuncDef() const
{
OS::FuncDef def = {name,
OS_BIND_FUNC_RUN_CLASS_NAME<R OS_BIND_FUNC_PARMS_COMMA OS_BIND_FUNC_PARMS>::run,
&(new FunctionData<F>(f))->f};
return def;
}
};
// namespace ObjectScript {
template <class R OS_BIND_FUNC_PARMS_COMMA OS_BIND_FUNC_TEMPLATE_PARMS>
OS::FuncDef def(const char * name, R(OS_BIND_FUNC_CC *f)(OS_BIND_FUNC_PARMS) OS_BIND_FUNC_CC_GNUC)
{
typedef OS_BIND_FUNC_CLASS_NAME<R OS_BIND_FUNC_PARMS_COMMA OS_BIND_FUNC_PARMS> Func;
return Func(name, f);
}
// } // namespace ObjectScript
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.