OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4AulScriptContext Struct Reference

#include <C4AulExec.h>

Collaboration diagram for C4AulScriptContext:
[legend]

Public Member Functions

void dump (StdStrBuf Dump=StdStrBuf(""))
 
StdStrBuf ReturnDump (StdStrBuf Dump=StdStrBuf(""))
 

Public Attributes

C4PropListObj
 
C4ValueReturn
 
C4ValuePars
 
C4AulScriptFuncFunc
 
C4AulBCCCPos
 
C4TimeMilliseconds tTime
 

Detailed Description

Definition at line 41 of file C4AulExec.h.

Member Function Documentation

void C4AulScriptContext::dump ( StdStrBuf  Dump = StdStrBuf(""))

Definition at line 88 of file C4AulExec.cpp.

References DebugLog(), and ReturnDump().

89 {
90  // Log it
91  DebugLog(ReturnDump(Dump).getData());
92 }
StdStrBuf ReturnDump(StdStrBuf Dump=StdStrBuf(""))
Definition: C4AulExec.cpp:38
bool DebugLog(const char *strMessage)
Definition: C4Log.cpp:270

Here is the call graph for this function:

StdStrBuf C4AulScriptContext::ReturnDump ( StdStrBuf  Dump = StdStrBuf(""))

Definition at line 38 of file C4AulExec.cpp.

References StdStrBuf::Append(), StdStrBuf::AppendChar(), StdStrBuf::AppendFormat(), CPos, Func, StdStrBuf::getData(), C4Value::GetDataString(), C4PropListStatic::GetDataString(), C4AulScriptFunc::GetLineOfCode(), C4AulFunc::GetName(), C4AulScriptFunc::GetParCount(), C4ScriptHost::GetScript(), Obj, C4AulFunc::Parent, Pars, C4AulScriptFunc::pOrgScript, C4AulScriptFunc::Script, C4ScriptHost::ScriptName, SGetLine(), and C4PropList::Status.

Referenced by dump().

39 {
40  if (!Func)
41  return StdStrBuf("");
42  // Context
43  if (Obj && Obj->Status)
44  {
45  C4Value ObjVal(Obj);
46  Dump.Append(ObjVal.GetDataString(0));
47  Dump.Append("->");
48  }
49  bool fDirectExec = !Func->GetName();
50  if (!fDirectExec)
51  {
52  // Function name
53  Dump.Append(Func->GetName());
54  // Parameters
55  Dump.AppendChar('(');
56  int iNullPars = 0;
57  for (int i = 0; i < Func->GetParCount(); i++)
58  {
59  if (!Pars[i])
60  iNullPars++;
61  else
62  {
63  if (i > iNullPars)
64  Dump.AppendChar(',');
65  // Insert missing null parameters
66  while (iNullPars > 0)
67  {
68  Dump.Append("0,");
69  iNullPars--;
70  }
71  // Insert parameter
72  Dump.Append(Pars[i].GetDataString());
73  }
74  }
75  Dump.AppendChar(')');
76  }
77  else
78  Dump.Append(Func->Parent->GetDataString());
79  // Script
80  if (!fDirectExec && Func->pOrgScript)
81  Dump.AppendFormat(" (%s:%d)",
84  // Return it
85  return Dump;
86 }
C4Value * Pars
Definition: C4AulExec.h:45
const char * getData() const
Definition: StdBuf.h:442
int SGetLine(const char *szText, const char *cpPosition)
Definition: Standard.cpp:451
const char * GetName() const
Definition: C4AulFunc.h:57
C4ScriptHost * pOrgScript
C4AulScriptFunc * Func
Definition: C4AulExec.h:46
void AppendFormat(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:190
int GetParCount() const override
void AppendChar(char cChar)
Definition: StdBuf.h:588
int GetLineOfCode(C4AulBCC *bcc)
C4AulBCC * CPos
Definition: C4AulExec.h:47
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:519
int32_t Status
Definition: C4PropList.h:168
C4PropList * Obj
Definition: C4AulExec.h:43
C4PropListStatic * Parent
Definition: C4AulFunc.h:56
const char * Script
const char * GetScript() const
Definition: C4ScriptHost.h:52
StdCopyStrBuf ScriptName
Definition: C4ScriptHost.h:57
StdStrBuf GetDataString() const
Definition: C4PropList.cpp:253

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

C4AulBCC* C4AulScriptContext::CPos

Definition at line 47 of file C4AulExec.h.

Referenced by ReturnDump().

C4AulScriptFunc* C4AulScriptContext::Func

Definition at line 46 of file C4AulExec.h.

Referenced by C4AulExec::FnTranslate(), and ReturnDump().

C4PropList* C4AulScriptContext::Obj

Definition at line 43 of file C4AulExec.h.

Referenced by ReturnDump().

C4Value* C4AulScriptContext::Pars

Definition at line 45 of file C4AulExec.h.

Referenced by ReturnDump().

C4Value* C4AulScriptContext::Return

Definition at line 44 of file C4AulExec.h.

C4TimeMilliseconds C4AulScriptContext::tTime

Definition at line 48 of file C4AulExec.h.


The documentation for this struct was generated from the following files: