OpenClonk
C4Aul.h File Reference
#include "object/C4Id.h"
#include "script/C4StringTable.h"
#include "script/C4Value.h"
#include "script/C4ValueMap.h"
#include "C4AulWarnings.h"
Include dependency graph for C4Aul.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  C4AulError
 
class  C4AulParseError
 
class  C4AulExecError
 
class  C4AulFuncMap
 
class  C4AulUserFile
 
class  C4AulErrorHandler
 
class  C4AulScriptEngine
 

Macros

#define C4AUL_MAX_Identifier   100
 
#define DIAG(id, text, enabled)   id,
 

Enumerations

enum  C4AulWarningId { C4AulWarningId::DIAG, C4AulWarningId::WarningCount }
 

Functions

void InitCoreFunctionMap (C4AulScriptEngine *pEngine)
 

Variables

const char * C4AulWarningIDs []
 
const char * C4AulWarningMessages []
 
C4AulScriptEngine ScriptEngine
 

Macro Definition Documentation

◆ C4AUL_MAX_Identifier

#define C4AUL_MAX_Identifier   100

Definition at line 26 of file C4Aul.h.

Referenced by C4Effect::AssignCallbackFunctions().

◆ DIAG

#define DIAG (   id,
  text,
  enabled 
)    id,

Definition at line 31 of file C4Aul.h.

Enumeration Type Documentation

◆ C4AulWarningId

enum C4AulWarningId
strong
Enumerator
DIAG 
WarningCount 

Definition at line 29 of file C4Aul.h.

30 {
31 #define DIAG(id, text, enabled) id,
32 #include "C4AulWarnings.h"
33 #undef DIAG
35 };

Function Documentation

◆ InitCoreFunctionMap()

void InitCoreFunctionMap ( C4AulScriptEngine pEngine)

Definition at line 1116 of file C4Script.cpp.

References Abs(), AddFunc(), Angle(), C4AulDefFunc::C4AulDefFunc(), C4V_Int, C4VInt(), Cos(), Distance(), F, C4AulExec::FnLogCallStack(), C4AulExec::FnTranslate(), C4AulFunc::GetName(), C4AulScriptEngine::GetPropList(), C4ScriptConstDef::Identifier, Inside(), C4ScriptLibrary::InstantiateAllLibraries(), Random(), C4AulScriptEngine::RegisterGlobalConstant(), Sin(), and WildcardMatch().

Referenced by c4_mapgen_handle_init_script_engine(), and C4Game::InitScriptEngine().

1117 {
1119  // add all def constants (all Int)
1120  for (C4ScriptConstDef *pCDef = &C4ScriptConstMap[0]; pCDef->Identifier; pCDef++)
1121  {
1122  assert(pCDef->ValType == C4V_Int); // only int supported currently
1123  pEngine->RegisterGlobalConstant(pCDef->Identifier, C4VInt(pCDef->Data));
1124  }
1125 
1126  C4PropListStatic * p = pEngine->GetPropList();
1127  // add all def script funcs
1128  for (C4ScriptFnDef *pDef = &C4ScriptFnMap[0]; pDef->Identifier; pDef++)
1129  new C4AulDefFunc(p, pDef);
1130 #define F(f) ::AddFunc(p, #f, Fn##f)
1131  F(ParseInt);
1132  F(Abs);
1133  F(Min);
1134  F(Max);
1135  F(Sin);
1136  F(Cos);
1137  F(Sqrt);
1138  F(ArcSin);
1139  F(ArcCos);
1140  F(BoundBy);
1141  F(Inside);
1142  F(Random);
1143 
1144  F(CreateArray);
1145  F(CreatePropList);
1146  F(GetProperties);
1147  F(GetProperty);
1148  F(SetProperty);
1149  F(GetPrototype);
1150  F(SetPrototype);
1151  F(ResetProperty);
1152  F(GetName);
1153  F(AddEffect);
1154  F(CreateEffect);
1155  F(CheckEffect);
1156  F(RemoveEffect);
1157  F(GetEffect);
1158  F(GetEffectCount);
1159  F(RegexReplace);
1160  F(RegexSearch);
1161  F(RegexMatch);
1162  F(RegexSplit);
1163  F(Distance);
1164  F(Angle);
1165  F(GetChar);
1166  F(GetType);
1167  F(ModulateColor);
1168  F(WildcardMatch);
1169  F(GetLength);
1170  F(SetLength);
1171  F(GetIndexOf);
1172  F(DeepEqual);
1173  F(StartCallTrace);
1174  F(StartScriptProfiler);
1175  F(StopScriptProfiler);
1176  F(SortArray);
1177  F(SortArrayByProperty);
1178  F(SortArrayByArrayElement);
1179  F(Trans_Identity);
1180  F(Trans_Translate);
1181  F(Trans_Scale);
1182  F(Trans_Rotate);
1183  F(LocateFunc);
1184  F(FileWrite);
1185  F(eval);
1186  F(StringToIdentifier);
1187  F(GetConstantNameByValue);
1188  F(ReplaceString);
1189 
1190  ::AddFunc(p, "Translate", C4AulExec::FnTranslate);
1191  ::AddFunc(p, "LogCallStack", C4AulExec::FnLogCallStack);
1192 #undef F
1193 }
void RegisterGlobalConstant(const char *szName, const C4Value &rValue)
Definition: C4Aul.cpp:123
static bool FnLogCallStack(C4PropList *_this)
Definition: C4AulExec.cpp:130
static void InstantiateAllLibraries(C4AulScriptEngine *engine)
C4ScriptFnDef C4ScriptFnMap[]
Definition: C4Script.cpp:1103
uint32_t Random()
Definition: C4Random.cpp:43
C4PropListStatic * GetPropList()
Definition: C4Aul.h:151
C4Value C4VInt(int32_t i)
Definition: C4Value.h:242
int32_t Angle(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iPrec)
Definition: Standard.cpp:37
int32_t Distance(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2)
Definition: Standard.cpp:25
C4ScriptConstDef C4ScriptConstMap[]
Definition: C4Script.cpp:1054
const char * Identifier
Definition: C4AulDefFunc.h:276
#define F(f)
static C4String * FnTranslate(C4PropList *_this, C4String *text)
Definition: C4AulExec.cpp:100
const char * Identifier
Definition: C4AulDefFunc.h:268
bool WildcardMatch(const char *szWildcard, const char *szString)
Definition: StdFile.cpp:374
T Abs(T val)
Definition: Standard.h:42
C4Real Sin(const C4Real &fAngle)
Definition: C4Real.h:265
void AddFunc(C4PropListStatic *Parent, const char *Name, RType(*pFunc)(ThisType *, ParTypes...), bool Public=true)
Definition: C4AulDefFunc.h:260
bool Inside(T ival, U lbound, V rbound)
Definition: Standard.h:43
C4Real Cos(const C4Real &fAngle)
Definition: C4Real.h:266
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ C4AulWarningIDs

const char* C4AulWarningIDs[]

Definition at line 34 of file C4Aul.cpp.

Referenced by C4ScriptHost::Warn().

◆ C4AulWarningMessages

const char* C4AulWarningMessages[]

Definition at line 28 of file C4Aul.cpp.

Referenced by C4ScriptHost::Warn().

◆ ScriptEngine

C4AulScriptEngine ScriptEngine

Definition at line 43 of file C4Globals.cpp.

Referenced by c4_mapgen_handle_deinit_script_engine(), c4_mapgen_handle_init_script_engine(), c4_mapgen_handle_new(), c4_mapgen_handle_new_script(), C4AulFunc::C4AulFunc(), C4Def::C4Def(), C4PropertyPath::C4PropertyPath(), C4PropListScen::C4PropListScen(), C4PropList::Call(), C4Object::ChangeDef(), C4AulFunc::CheckParTypes(), C4Game::Clear(), C4Def::Clear(), C4AulExec::ClearPointers(), C4Game::ClearPointers(), C4PropertyCollection::CollectPropLists(), C4Control::CompileFunc(), C4Effect::CompileFunc(), C4Def::CompileFunc(), C4Value::CompileFunc(), C4Game::CompileFunc(), C4AulExec::DirectExec(), C4ControlPlayerMouse::DragDrop(), C4RoundResults::EvaluateGame(), C4Game::Execute(), C4PlayerControl::ExecuteControlPacket(), C4PlayerControlDefs::FinalInit(), FnGetEffectsFor(), C4Value::GetDataString(), C4AulScriptEngine::GetFunctionNames(), C4Console::GetScriptSuggestions(), C4Landscape::Incinerate(), C4MapScriptHost::InitFunctionMap(), C4ControlPlayerAction::InitPlayerControl(), C4Game::InitScriptEngine(), C4AulScriptEngine::Link(), C4Game::LinkScriptEngine(), C4GameScriptHost::Load(), C4Def::Load(), C4Game::LoadAdditionalSystemGroup(), C4GameScriptHost::LoadData(), C4Game::LoadScenarioSection(), C4AulDebug::OnLog(), C4EditCursor::PerformDuplication(), C4ScenarioParameterDefs::RegisterScriptConstants(), C4Game::ReLinkScriptEngine(), C4Game::ReloadFile(), C4PropertyPath::ResolveRoot(), C4MaterialReaction::ResolveScriptFuncs(), C4PropertyPath::ResolveValue(), C4Game::SaveData(), C4ScenarioSection::ScenarioLoad(), C4PropList::ThawRecursively(), C4ScriptHost::UnlinkOwnedFunctions(), C4AulCompiler::CodegenAstVisitor::visit(), C4AulErrorHandler::~C4AulErrorHandler(), and C4AulFunc::~C4AulFunc().