mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 19:51:37 +00:00
ran everything though mark's newline stomper.
This was SVN commit r322.
This commit is contained in:
@@ -1,48 +1,48 @@
|
||||
|
||||
#include "ScriptGlue.h"
|
||||
|
||||
// Parameters for the table are:
|
||||
|
||||
// 1: The name the function will be called as from script
|
||||
// 2: The number of aguments this function expects
|
||||
// 3: Depreciated, always zero
|
||||
// 4: Reserved for future use, always zero
|
||||
|
||||
JSFunctionSpec ScriptFunctionTable[] =
|
||||
{
|
||||
{"WriteLog", WriteLog, 1, 0, 0},
|
||||
|
||||
{0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
// Allow scripts to output to the global log file
|
||||
JSBool WriteLog(JSContext * context, JSObject * globalObject, unsigned int argc, jsval * argv, jsval * rval)
|
||||
{
|
||||
if (argc < 1)
|
||||
return JS_FALSE;
|
||||
|
||||
for (int i = 0; i < (int)argc; i++)
|
||||
{
|
||||
if (JSVAL_IS_INT(argv[i]))
|
||||
{
|
||||
printf("%d", JSVAL_TO_INT(argv[i]));
|
||||
}
|
||||
|
||||
if (JSVAL_IS_DOUBLE(argv[i]))
|
||||
{
|
||||
double d = g_ScriptingHost.ValueToDouble(argv[i]);
|
||||
printf("%e", d);
|
||||
}
|
||||
|
||||
if (JSVAL_IS_STRING(argv[i]))
|
||||
{
|
||||
JSString * str = JS_ValueToString(context, argv[i]);
|
||||
char * chars = JS_GetStringBytes(str);
|
||||
printf(chars);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
#include "ScriptGlue.h"
|
||||
|
||||
// Parameters for the table are:
|
||||
|
||||
// 1: The name the function will be called as from script
|
||||
// 2: The number of aguments this function expects
|
||||
// 3: Depreciated, always zero
|
||||
// 4: Reserved for future use, always zero
|
||||
|
||||
JSFunctionSpec ScriptFunctionTable[] =
|
||||
{
|
||||
{"WriteLog", WriteLog, 1, 0, 0},
|
||||
|
||||
{0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
// Allow scripts to output to the global log file
|
||||
JSBool WriteLog(JSContext * context, JSObject * globalObject, unsigned int argc, jsval * argv, jsval * rval)
|
||||
{
|
||||
if (argc < 1)
|
||||
return JS_FALSE;
|
||||
|
||||
for (int i = 0; i < (int)argc; i++)
|
||||
{
|
||||
if (JSVAL_IS_INT(argv[i]))
|
||||
{
|
||||
printf("%d", JSVAL_TO_INT(argv[i]));
|
||||
}
|
||||
|
||||
if (JSVAL_IS_DOUBLE(argv[i]))
|
||||
{
|
||||
double d = g_ScriptingHost.ValueToDouble(argv[i]);
|
||||
printf("%e", d);
|
||||
}
|
||||
|
||||
if (JSVAL_IS_STRING(argv[i]))
|
||||
{
|
||||
JSString * str = JS_ValueToString(context, argv[i]);
|
||||
char * chars = JS_GetStringBytes(str);
|
||||
printf(chars);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user