OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4AulScriptEngine Class Reference

#include <C4Aul.h>

Inheritance diagram for C4AulScriptEngine:
[legend]
Collaboration diagram for C4AulScriptEngine:
[legend]

Public Member Functions

 C4AulScriptEngine ()
 
 ~C4AulScriptEngine ()
 
void Clear ()
 
void Link (C4DefList *rDefs)
 
void ReLink (C4DefList *rDefs)
 
C4PropListStaticGetPropList ()
 
bool ReloadScript (const char *szScript, const char *szLanguage)
 
std::list< const char * > GetFunctionNames (C4PropList *)
 
void RegisterGlobalConstant (const char *szName, const C4Value &rValue)
 
bool GetGlobalConstant (const char *szName, C4Value *pTargetValue)
 
void Denumerate (C4ValueNumbers *)
 
void UnLink ()
 
void CompileFunc (StdCompiler *pComp, bool fScenarioSection, C4ValueNumbers *numbers)
 
int32_t CreateUserFile ()
 
void CloseUserFile (int32_t handle)
 
C4AulUserFileGetUserFile (int32_t handle)
 
void RegisterErrorHandler (C4AulErrorHandler *handler)
 
void UnregisterErrorHandler (C4AulErrorHandler *handler)
 
C4AulErrorHandlerGetErrorHandler () const
 
virtual bool Delete ()
 
virtual C4PropListStaticIsStatic ()
 
const class C4PropListStaticIsStatic () const
 
void RefCompileFunc (StdCompiler *pComp, C4ValueNumbers *numbers) const
 
StdStrBuf GetDataString () const
 
virtual const char * GetName () const
 
const C4PropListStaticGetParent () const
 
C4StringGetParentKeyName ()
 
virtual void SetName (const char *NewName=0)
 
virtual void SetOnFire (bool OnFire)
 
virtual C4Def const * GetDef () const
 
virtual C4DefGetDef ()
 
virtual C4ObjectGetObject ()
 
virtual C4Object const * GetObject () const
 
virtual C4EffectGetEffect ()
 
virtual C4PropListNumberedGetPropListNumbered ()
 
virtual class C4MapScriptLayerGetMapScriptLayer ()
 
virtual class C4MapScriptMapGetMapScriptMap ()
 
C4PropListGetPrototype () const
 
void RemoveCyclicPrototypes ()
 
virtual bool IsNumbered () const
 
virtual bool GetPropertyByS (const C4String *k, C4Value *pResult) const
 
virtual C4ValueArrayGetProperties () const
 
virtual void SetPropertyByS (C4String *k, const C4Value &to)
 
virtual void ResetProperty (C4String *k)
 
bool GetProperty (C4PropertyName k, C4Value *pResult) const
 
C4StringGetPropertyStr (C4PropertyName k) const
 
C4ValueArrayGetPropertyArray (C4PropertyName n) const
 
C4AulFuncGetFunc (C4PropertyName k) const
 
C4AulFuncGetFunc (C4String *k) const
 
C4AulFuncGetFunc (const char *k) const
 
C4StringEnumerateOwnFuncs (C4String *prev=0) const
 
C4Value Call (C4PropertyName k, C4AulParSet *pPars=0, bool fPassErrors=false)
 
C4Value Call (C4String *k, C4AulParSet *pPars=0, bool fPassErrors=false)
 
C4Value Call (const char *k, C4AulParSet *pPars=0, bool fPassErrors=false)
 
C4PropertyName GetPropertyP (C4PropertyName k) const
 
int32_t GetPropertyBool (C4PropertyName n, bool default_val=false) const
 
int32_t GetPropertyInt (C4PropertyName k, int32_t default_val=0) const
 
C4PropListGetPropertyPropList (C4PropertyName k) const
 
bool HasProperty (C4String *k) const
 
void SetProperty (C4PropertyName k, const C4Value &to)
 
void Freeze ()
 
void Thaw ()
 
void ThawRecursively ()
 
bool IsFrozen () const
 
C4PropListStaticFreezeAndMakeStaticRecursively (std::vector< C4Value > *prop_lists, const C4PropListStatic *parent=nullptr, C4String *key=nullptr)
 
void CompileFunc (StdCompiler *pComp, C4ValueNumbers *)
 
void AppendDataString (StdStrBuf *out, const char *delim, int depth=3, bool ignore_reference_parent=false) const
 
StdStrBuf ToJSON (int depth=10, bool ignore_reference_parent=false) const
 
std::vector< C4String * > GetSortedLocalProperties (bool add_prototype=true) const
 
std::vector< C4String * > GetSortedLocalProperties (const char *prefix, const C4PropList *ignore_overridden) const
 
std::vector< C4String * > GetUnsortedProperties (const char *prefix, C4PropList *ignore_parent=nullptr) const
 
std::vector< C4String * > GetSortedProperties (const char *prefix, C4PropList *ignore_parent=nullptr) const
 
bool operator== (const C4PropList &b) const
 
Iterator begin ()
 
Iterator end ()
 

Static Public Member Functions

static C4PropListNew (C4PropList *prototype=0)
 
static C4PropListStaticNewStatic (C4PropList *prototype, const C4PropListStatic *parent, C4String *key)
 

Public Attributes

int warnCnt
 
int errCnt
 
int lineCnt
 
C4ValueMapNames GlobalNamedNames
 
C4ValueMapData GlobalNamed
 
C4ValueMapNames GlobalConstNames
 
C4ValueMapData GlobalConsts
 
C4EffectpGlobalEffects = nullptr
 
int32_t Status
 

Protected Member Functions

C4AulFuncGetFirstFunc (const char *Name)
 
C4AulFuncGetNextSNFunc (const C4AulFunc *After)
 
void ClearRefs ()
 

Protected Attributes

C4AulFuncMap FuncLookUp
 
C4ScriptHostChild0
 
C4ScriptHostChildL
 
std::list< C4AulUserFileUserFiles
 
std::vector< C4ValueOwnedPropLists
 
C4AulErrorHandlerErrorHandler
 
const C4PropListStaticParent
 
C4RefCntPointer< C4StringParentKeyName
 

Friends

class C4AulFunc
 
class C4AulProfiler
 
class C4ScriptHost
 
class C4AulParse
 
class C4AulCompiler
 
class C4AulDebug
 

Detailed Description

Definition at line 115 of file C4Aul.h.

Constructor & Destructor Documentation

C4AulScriptEngine::C4AulScriptEngine ( )
C4AulScriptEngine::~C4AulScriptEngine ( )

Member Function Documentation

void C4PropList::AppendDataString ( StdStrBuf out,
const char *  delim,
int  depth = 3,
bool  ignore_reference_parent = false 
) const
inherited

Definition at line 519 of file C4PropList.cpp.

References StdStrBuf::Append(), C4Set< T >::GetSize(), C4Set< T >::GetSortedListOfElementPointers(), and C4PropList::IsStatic().

Referenced by C4Value::GetDataString(), and C4Object::GetDataString().

520 {
521  StdStrBuf & DataString = *out;
522  if (depth <= 0 && Properties.GetSize())
523  {
524  DataString.Append("...");
525  return;
526  }
527  std::list<const C4Property *> sorted_props = Properties.GetSortedListOfElementPointers();
528  for (std::list<const C4Property *>::const_iterator p = sorted_props.begin(); p != sorted_props.end(); ++p)
529  {
530  if (p != sorted_props.begin()) DataString.Append(delim);
531  DataString.Append((*p)->Key->GetData());
532  DataString.Append(" = ");
533  DataString.Append((*p)->Value.GetDataString(depth - 1, ignore_reference_parent ? IsStatic() : nullptr));
534  }
535 }
std::list< const T * > GetSortedListOfElementPointers() const
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
unsigned int GetSize() const
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList::Iterator C4PropList::begin ( )
inherited

Definition at line 984 of file C4PropList.cpp.

References C4PropList::begin(), C4Set< T >::First(), C4PropList::GetPrototype(), C4Set< T >::GetSize(), and C4Set< T >::Next().

Referenced by C4PropList::begin(), and C4ParticleProperties::Set().

985 {
987 
988  if (GetPrototype())
989  {
990  iter = GetPrototype()->begin();
991  }
992  else
993  {
994  iter.properties = std::make_shared<std::vector<const C4Property*> >();
995  }
996  iter.Reserve(Properties.GetSize());
997 
998  const C4Property * p = Properties.First();
999  while (p)
1000  {
1001  iter.AddProperty(p);
1002  p = Properties.Next(p);
1003  }
1004 
1005  iter.Init();
1006  return iter;
1007 }
T const * Next(T const *p) const
unsigned int GetSize() const
Iterator begin()
Definition: C4PropList.cpp:984
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

C4Value C4PropList::Call ( C4PropertyName  k,
C4AulParSet pPars = 0,
bool  fPassErrors = false 
)
inlineinherited

Definition at line 112 of file C4PropList.h.

References C4StringTable::P, and Strings.

Referenced by C4Command::Acquire(), C4Object::ActivateEntrance(), C4Object::ActivateMenu(), C4Object::AssignDeath(), C4Object::AssignRemoval(), C4Command::Call(), C4GameScriptHost::Call(), C4Effect::CallEffect(), C4Command::CallFailed(), C4Effect::CallStart(), C4Effect::CallStop(), C4Effect::CallTimer(), C4FindObjectFunc::Check(), C4Effect::ClearAll(), C4Object::Collect(), C4SortObjectFunc::CompareGetValue(), C4Object::Contact(), C4GameObjects::CrossCheck(), C4Landscape::P::DigMaterial2Objects(), C4Object::DirectComContents(), C4Object::DoBreath(), C4Object::DoCon(), C4Object::DoDamage(), C4Object::DoEnergy(), C4Object::DoMovement(), C4ObjectMenu::DoRefillInternal(), C4Object::DoSelect(), C4Object::Enter(), C4RoundResults::EvaluateGame(), C4RoundResults::EvaluateGoals(), C4Object::ExecAction(), C4Object::ExecLife(), C4ScriptGuiWindowAction::ExecuteCommand(), C4Object::ExecuteCommand(), C4Object::Exit(), C4Command::Fail(), C4Command::GetTryEnter(), C4Def::GetValue(), C4Object::GetValue(), GrabLost(), C4GameObjects::GRBroadcast(), C4Landscape::Incinerate(), C4Effect::Init(), C4Player::Init(), C4Game::InitGame(), C4ObjectMenu::IsCloseDenied(), C4Effect::Kill(), C4Object::Lift(), C4Player::MakeCrewMember(), C4Game::NewObject(), ObjectActionJump(), ObjectComGrab(), ObjectComPunch(), ObjectComPut(), ObjectComUnGrab(), C4ObjectMenu::OnSelectionChanged(), C4GameObjects::OnSynchronized(), C4EditCursor::PerformDuplication(), C4EditCursor::PerformDuplicationLegacy(), C4Player::PlaceReadyCrew(), C4Landscape::P::PostFreeShape(), C4Object::Promote(), C4Object::Push(), C4Game::SaveData(), C4Object::SetAction(), C4GUI::FrameDecoration::SetByDef(), C4Object::SetCommand(), C4Player::SetObjectCrewStatus(), C4Object::SetOwner(), C4Object::StatusActivate(), C4Command::Transfer(), and C4Object::UnSelect().

113  { return Call(&Strings.P[k], pPars, fPassErrors); }
C4String P[P_LAST]
C4StringTable Strings
Definition: C4Globals.cpp:42
C4Value Call(C4PropertyName k, C4AulParSet *pPars=0, bool fPassErrors=false)
Definition: C4PropList.h:112

Here is the caller graph for this function:

C4Value C4PropList::Call ( C4String k,
C4AulParSet pPars = 0,
bool  fPassErrors = false 
)
inherited

Definition at line 805 of file C4PropList.cpp.

References C4PropList::C4Value, C4AulFunc::Exec(), C4PropList::GetFunc(), and C4PropList::Status.

806 {
807  if (!Status) return C4Value();
808  C4AulFunc *pFn = GetFunc(k);
809  if (!pFn) return C4Value();
810  return pFn->Exec(this, Pars, fPassErrors);
811 }
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
friend class C4Value
Definition: C4PropList.h:167
C4Value Exec(C4PropList *p=nullptr, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4AulFunc.h:73
int32_t Status
Definition: C4PropList.h:170

Here is the call graph for this function:

C4Value C4PropList::Call ( const char *  k,
C4AulParSet pPars = 0,
bool  fPassErrors = false 
)
inherited

Definition at line 813 of file C4PropList.cpp.

References C4PropList::C4Value, C4AulFunc::Exec(), FormatString(), GetErrorHandler(), C4PropList::GetFunc(), C4AulErrorHandler::OnError(), ScriptEngine, C4PropList::Status, and C4AulError::what().

814 {
815  if (!Status) return C4Value();
816  assert(s && s[0]);
817  C4AulFunc *pFn = GetFunc(s);
818  if (!pFn)
819  {
820  if (s[0] != '~')
821  {
822  C4AulExecError err(FormatString("Undefined function: %s", s).getData());
823  if (fPassErrors)
824  throw err;
825  ::ScriptEngine.GetErrorHandler()->OnError(err.what());
826  }
827  return C4Value();
828  }
829  return pFn->Exec(this, Pars, fPassErrors);
830 }
C4AulErrorHandler * GetErrorHandler() const
Definition: C4Aul.h:175
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
friend class C4Value
Definition: C4PropList.h:167
C4Value Exec(C4PropList *p=nullptr, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4AulFunc.h:73
int32_t Status
Definition: C4PropList.h:170
virtual void OnError(const char *msg)=0
#define s
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:277

Here is the call graph for this function:

void C4AulScriptEngine::Clear ( )

Referenced by c4_mapgen_handle_deinit_script_engine(), and C4Game::Clear().

Here is the caller graph for this function:

void C4PropList::ClearRefs ( )
inlineprotectedinherited

Definition at line 158 of file C4PropList.h.

References C4Value::Set0().

Referenced by C4Object::AssignRemoval().

158 { while (FirstRef) FirstRef->Set0(); }
void Set0()
Definition: C4Value.h:336

Here is the call graph for this function:

Here is the caller graph for this function:

void C4AulScriptEngine::CloseUserFile ( int32_t  handle)

Referenced by C4EditCursor::PerformDuplication(), and C4Game::SaveData().

Here is the caller graph for this function:

void C4PropList::CompileFunc ( StdCompiler pComp,
C4ValueNumbers numbers 
)
inherited

Definition at line 398 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Set< T >::Has(), StdCompiler::hasNaming(), StdCompiler::isDeserializer(), mkParAdapt(), C4StringTable::P, P_Prototype, C4Set< T >::Remove(), StdCompiler::SEP_SEP2, StdCompiler::Separator(), Strings, C4Property::Value, and StdCompiler::Value().

Referenced by C4PropListNumbered::CompileFunc().

399 {
400  bool oldFormat = false;
401  // constant proplists are not serialized to savegames, but recreated from the game data instead
402  assert(!constant);
403  if (pComp->isDeserializer() && pComp->hasNaming())
404  {
405  // backwards compat to savegames and scenarios before 5.5
406  try
407  {
408  pComp->Value(constant);
409  oldFormat = true;
410  }
411  catch (StdCompiler::NotFoundException *pEx)
412  {
413  delete pEx;
414  pComp->Value(mkParAdapt(prototype, numbers));
415  }
416  }
417  else
418  pComp->Value(mkParAdapt(prototype, numbers));
420  pComp->Value(mkParAdapt(Properties, numbers));
421  if (oldFormat)
422  {
423  if (Properties.Has(&::Strings.P[P_Prototype]))
424  {
425  prototype = Properties.Get(&::Strings.P[P_Prototype]).Value;
426  Properties.Remove(&::Strings.P[P_Prototype]);
427  }
428  }
429 }
C4String P[P_LAST]
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
C4Value Value
Definition: C4PropList.h:57
virtual bool hasNaming()
Definition: StdCompiler.h:68
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
void Value(const T &rStruct)
Definition: StdCompiler.h:171
void Remove(H e)
virtual bool isDeserializer()
Definition: StdCompiler.h:63
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456

Here is the call graph for this function:

Here is the caller graph for this function:

void C4AulScriptEngine::CompileFunc ( StdCompiler pComp,
bool  fScenarioSection,
C4ValueNumbers numbers 
)
int32_t C4AulScriptEngine::CreateUserFile ( )

Referenced by C4EditCursor::PerformDuplication(), and C4Game::SaveData().

Here is the caller graph for this function:

virtual bool C4PropListStaticMember::Delete ( )
inlinevirtualinherited

Reimplemented from C4PropListStatic.

Definition at line 285 of file C4PropList.h.

285 { return false; }
void C4AulScriptEngine::Denumerate ( C4ValueNumbers )
virtual

Reimplemented from C4PropList.

Referenced by C4Game::InitGame().

Here is the caller graph for this function:

Iterator C4PropList::end ( )
inlineinherited

Definition at line 208 of file C4PropList.h.

Referenced by C4ParticleProperties::Set().

208 { return Iterator(); }

Here is the caller graph for this function:

C4String * C4PropList::EnumerateOwnFuncs ( C4String prev = 0) const
inherited

Definition at line 917 of file C4PropList.cpp.

References C4Set< T >::First(), C4Set< T >::Get(), C4Value::getFunction(), C4Property::Key, C4Set< T >::Next(), and C4Property::Value.

918 {
919  const C4Property * p = prev ? Properties.Next(&Properties.Get(prev)) : Properties.First();
920  while (p)
921  {
922  if (p->Value.getFunction())
923  return p->Key;
924  p = Properties.Next(p);
925  }
926  return 0;
927 }
C4Value Value
Definition: C4PropList.h:57
T & Get(H e) const
T const * Next(T const *p) const
C4String * Key
Definition: C4PropList.h:56
T const * First() const
C4AulFunc * getFunction() const
Definition: C4Value.h:119

Here is the call graph for this function:

void C4PropList::Freeze ( )
inlineinherited

Definition at line 130 of file C4PropList.h.

Referenced by C4PropList::FreezeAndMakeStaticRecursively().

130 { constant = true; }

Here is the caller graph for this function:

C4PropListStatic * C4PropList::FreezeAndMakeStaticRecursively ( std::vector< C4Value > *  prop_lists,
const C4PropListStatic parent = nullptr,
C4String key = nullptr 
)
inherited

Definition at line 304 of file C4PropList.cpp.

References C4VPropList(), C4PropList::Freeze(), C4PropList::FreezeAndMakeStaticRecursively(), C4PropListStatic::GetParent(), C4PropListStatic::GetParentKeyName(), C4PropList::GetPropertyByS(), C4Value::getPropList(), C4PropList::GetPrototype(), C4PropList::GetSortedLocalProperties(), C4PropList::IsStatic(), C4PropList::NewStatic(), C4Value::SetPropList(), and C4PropList::Status.

Referenced by C4PropList::FreezeAndMakeStaticRecursively(), and Link().

305 {
306  Freeze();
307  // Already static?
308  C4PropListStatic *this_static = IsStatic();
309  if (!this_static)
310  {
311  // Make self static by creating a copy and replacing all references
312  this_static = NewStatic(GetPrototype(), parent, key);
313  this_static->Properties.Swap(&Properties); // grab properties
314  this_static->Status = Status;
315  C4Value holder = C4VPropList(this);
316  while (FirstRef && FirstRef->NextRef)
317  {
318  C4Value *ref = FirstRef;
319  if (ref == &holder) ref = ref->NextRef;
320  ref->SetPropList(this_static);
321  }
322  // store reference
323  if (prop_lists)
324  {
325  prop_lists->push_back(C4VPropList(this_static));
326  }
327  // "this" should be deleted as holder goes out of scope
328  }
329  // Iterate over sorted list of elements to make static
330  // Must iterate over sorted list because the order must be defined, just in case it's a network game
331  // and a non-static child proplist is available through different paths it should still get the same name
332  auto prop_names = this_static->GetSortedLocalProperties(false);
333  for (auto prop_name : prop_names)
334  {
335  C4Value child_val;
336  this_static->GetPropertyByS(prop_name, &child_val);
337  C4PropList *child_proplist = child_val.getPropList();
338  if (child_proplist)
339  {
340  // Avoid infinite recursion: Only freeze into unfrozen children and "true" static children
341  C4PropListStatic *child_static = child_proplist->IsStatic();
342  if (!child_static || (child_static->GetParent() == this_static && child_static->GetParentKeyName() == prop_name))
343  {
344  child_proplist->FreezeAndMakeStaticRecursively(prop_lists, this_static, prop_name);
345  }
346  }
347  }
348  return this_static;
349 }
C4PropListStatic * FreezeAndMakeStaticRecursively(std::vector< C4Value > *prop_lists, const C4PropListStatic *parent=nullptr, C4String *key=nullptr)
Definition: C4PropList.cpp:304
void Freeze()
Definition: C4PropList.h:130
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
C4String * GetParentKeyName()
Definition: C4PropList.h:273
std::vector< C4String * > GetSortedLocalProperties(bool add_prototype=true) const
Definition: C4PropList.cpp:557
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:734
C4Value C4VPropList(C4PropList *p)
Definition: C4Value.h:245
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
int32_t Status
Definition: C4PropList.h:170
static C4PropListStatic * NewStatic(C4PropList *prototype, const C4PropListStatic *parent, C4String *key)
Definition: C4PropList.cpp:70
void SetPropList(C4PropList *PropList)
Definition: C4Value.h:141
const C4PropListStatic * GetParent() const
Definition: C4PropList.h:272
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

StdStrBuf C4PropListStatic::GetDataString ( ) const
inherited

Definition at line 253 of file C4PropList.cpp.

References StdStrBuf::Append(), StdStrBuf::AppendChar(), C4String::GetData(), C4PropListStatic::GetDataString(), C4PropListStatic::Parent, C4PropListStatic::ParentKeyName, and StdStrBuf::Take().

Referenced by C4Value::GetDataString(), C4PropListStatic::GetDataString(), C4AulFunc::GetFullName(), C4DefScriptHost::Parse(), and C4AulScriptContext::ReturnDump().

254 {
255  StdStrBuf r;
256  if (Parent)
257  {
258  r.Take(Parent->GetDataString());
259  r.AppendChar('.');
260  }
261  assert(ParentKeyName);
262  if (ParentKeyName)
264  return r;
265 }
StdStrBuf GetData() const
Definition: C4StringTable.h:50
void AppendChar(char cChar)
Definition: StdBuf.h:596
void Take(char *pnData)
Definition: StdBuf.h:465
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527
const C4PropListStatic * Parent
Definition: C4PropList.h:275
C4RefCntPointer< C4String > ParentKeyName
Definition: C4PropList.h:276
StdStrBuf GetDataString() const
Definition: C4PropList.cpp:253

Here is the call graph for this function:

Here is the caller graph for this function:

C4Def const * C4PropList::GetDef ( ) const
virtualinherited

Reimplemented in C4Def.

Definition at line 662 of file C4PropList.cpp.

References C4PropList::GetDef(), and C4PropList::GetPrototype().

Referenced by C4Value::_getDef(), ConstructionCheck(), C4Game::CreateObject(), C4Game::CreateObjectConstruction(), C4AulExec::DirectExec(), C4GameMessage::Draw(), C4Game::DrawPropListSpecImage(), C4AulExec::FnTranslate(), C4PropList::GetDef(), C4Value::getDef(), C4GameMessage::Init(), C4Object::Init(), C4FindObjectDef::IsImpossible(), C4PropList::operator==(), C4ScriptHost::Parse(), C4AulParse::Parse_Script(), C4Game::PlaceAnimal(), C4Game::PlaceVegetation(), and C4ScriptGuiWindowProperty::Set().

663 {
664  if (GetPrototype()) return GetPrototype()->GetDef();
665  return 0;
666 }
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:662
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

C4Def * C4PropList::GetDef ( )
virtualinherited

Reimplemented in C4Def.

Definition at line 656 of file C4PropList.cpp.

References C4PropList::GetDef(), and C4PropList::GetPrototype().

657 {
658  if (GetPrototype()) return GetPrototype()->GetDef();
659  return 0;
660 }
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:662
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

C4Effect * C4PropList::GetEffect ( )
virtualinherited

Reimplemented in C4Effect.

Definition at line 686 of file C4PropList.cpp.

References C4PropList::GetEffect(), and C4PropList::GetPrototype().

Referenced by C4ValueConv< C4Effect * >::_FromC4V(), C4Value::GetDataString(), and C4PropList::GetEffect().

687 {
688  if (GetPrototype()) return GetPrototype()->GetEffect();
689  return 0;
690 }
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
virtual C4Effect * GetEffect()
Definition: C4PropList.cpp:686

Here is the call graph for this function:

Here is the caller graph for this function:

C4AulErrorHandler* C4AulScriptEngine::GetErrorHandler ( ) const
inline

Definition at line 175 of file C4Aul.h.

Referenced by C4PropList::Call(), C4AulFunc::CheckParTypes(), C4AulExec::DirectExec(), C4ScriptHost::ResolveIncludes(), C4AulCompiler::PreparseAstVisitor::visit(), C4AulCompiler::ConstantResolver::visit(), and C4ScriptHost::Warn().

176  {
177  return ErrorHandler;
178  }
C4AulErrorHandler * ErrorHandler
Definition: C4Aul.h:130

Here is the caller graph for this function:

C4AulFunc* C4AulScriptEngine::GetFirstFunc ( const char *  Name)
inlineprotected

Definition at line 119 of file C4Aul.h.

References C4AulFuncMap::GetFirstFunc().

Referenced by C4AulCompiler::CodegenAstVisitor::visit().

120  { return FuncLookUp.GetFirstFunc(Name); }
C4AulFunc * GetFirstFunc(const char *Name)
C4AulFuncMap FuncLookUp
Definition: C4Aul.h:118

Here is the call graph for this function:

Here is the caller graph for this function:

C4AulFunc* C4PropList::GetFunc ( C4PropertyName  k) const
inlineinherited

Definition at line 107 of file C4PropList.h.

References C4StringTable::P, and Strings.

Referenced by C4Effect::AssignCallbackFunctions(), C4PropList::Call(), C4Effect::CallDamage(), C4Value::CompileFunc(), C4ScriptHost::CopyPropList(), C4Effect::DoCall(), C4PropList::GetFunc(), C4Effect::Init(), C4MapScriptHost::InitializeMap(), C4Object::PutAwayUnusedObject(), C4MaterialReaction::ResolveScriptFuncs(), C4MCOverlay::SetField(), C4AulCompiler::PreparseAstVisitor::visit(), and C4AulCompiler::CodegenAstVisitor::visit().

108  { return GetFunc(&Strings.P[k]); }
C4String P[P_LAST]
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
C4StringTable Strings
Definition: C4Globals.cpp:42

Here is the caller graph for this function:

C4AulFunc * C4PropList::GetFunc ( C4String k) const
inherited

Definition at line 780 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetFunc(), C4Value::getFunction(), C4PropList::GetPrototype(), C4Set< T >::Has(), and C4Property::Value.

781 {
782  assert(k);
783  if (Properties.Has(k))
784  {
785  return Properties.Get(k).Value.getFunction();
786  }
787  if (GetPrototype())
788  {
789  return GetPrototype()->GetFunc(k);
790  }
791  return 0;
792 }
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
T & Get(H e) const
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4AulFunc * getFunction() const
Definition: C4Value.h:119

Here is the call graph for this function:

C4AulFunc * C4PropList::GetFunc ( const char *  k) const
inherited

Definition at line 794 of file C4PropList.cpp.

References C4StringTable::FindString(), C4PropList::GetFunc(), s, and Strings.

795 {
796  assert(s);
797  if (s[0] == '~') ++s;
798  C4String * k = Strings.FindString(s);
799  // this string is entirely unused
800  if (!k)
801  return 0;
802  return GetFunc(k);
803 }
C4String * FindString(const char *strString) const
C4AulFunc * GetFunc(C4PropertyName k) const
Definition: C4PropList.h:107
C4StringTable Strings
Definition: C4Globals.cpp:42
#define s

Here is the call graph for this function:

std::list<const char*> C4AulScriptEngine::GetFunctionNames ( C4PropList )

Referenced by C4Console::GetScriptSuggestions().

Here is the caller graph for this function:

bool C4AulScriptEngine::GetGlobalConstant ( const char *  szName,
C4Value pTargetValue 
)

Referenced by C4Effect::CompileFunc(), C4Value::CompileFunc(), C4AulCompiler::CodegenAstVisitor::visit(), and C4AulCompiler::ConstexprEvaluator::visit().

Here is the caller graph for this function:

class C4MapScriptLayer * C4PropList::GetMapScriptLayer ( )
virtualinherited

Reimplemented in C4MapScriptLayer.

Definition at line 668 of file C4PropList.cpp.

References C4PropList::GetMapScriptLayer(), and C4PropList::GetPrototype().

Referenced by C4MapScriptAlgoLayer::C4MapScriptAlgoLayer(), FnParAlgo(), and C4PropList::GetMapScriptLayer().

669 {
670  if (GetPrototype()) return GetPrototype()->GetMapScriptLayer();
671  return nullptr;
672 }
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
virtual class C4MapScriptLayer * GetMapScriptLayer()
Definition: C4PropList.cpp:668

Here is the call graph for this function:

Here is the caller graph for this function:

class C4MapScriptMap * C4PropList::GetMapScriptMap ( )
virtualinherited

Reimplemented in C4MapScriptMap.

Definition at line 674 of file C4PropList.cpp.

References C4PropList::GetMapScriptMap(), and C4PropList::GetPrototype().

Referenced by C4PropList::GetMapScriptMap().

675 {
676  if (GetPrototype()) return GetPrototype()->GetMapScriptMap();
677  return nullptr;
678 }
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
virtual class C4MapScriptMap * GetMapScriptMap()
Definition: C4PropList.cpp:674

Here is the call graph for this function:

Here is the caller graph for this function:

const char * C4PropListStatic::GetName ( ) const
virtualinherited

Reimplemented from C4PropList.

Definition at line 267 of file C4PropList.cpp.

References C4String::GetCStr(), C4PropList::GetPropertyStr(), P_Name, C4PropListStatic::ParentKeyName, and s.

Referenced by C4MainMenu::ActivateGoals(), C4MainMenu::ActivateRules(), C4Object::AssignRemoval(), C4DefGraphicsAdapt::CompileFunc(), ConstructionCheck(), C4ObjectInfoCore::Default(), C4Command::Fail(), C4GameParameters::GetGameGoalString(), C4ObjectList::GetNameList(), C4Def::LoadDefCore(), C4DefScriptHost::Parse(), and C4EditCursor::UpdateStatusBar().

268 {
269  const C4String * s = GetPropertyStr(P_Name);
270  if (!s) s = ParentKeyName;
271  if (!s) return "";
272  return s->GetCStr();
273 }
const char * GetCStr() const
Definition: C4StringTable.h:49
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:752
#define s
C4RefCntPointer< C4String > ParentKeyName
Definition: C4PropList.h:276

Here is the call graph for this function:

Here is the caller graph for this function:

C4AulFunc* C4AulScriptEngine::GetNextSNFunc ( const C4AulFunc After)
inlineprotected

Definition at line 121 of file C4Aul.h.

References C4AulFuncMap::GetNextSNFunc().

Referenced by C4AulCompiler::CodegenAstVisitor::visit().

122  { return FuncLookUp.GetNextSNFunc(After); }
C4AulFuncMap FuncLookUp
Definition: C4Aul.h:118
C4AulFunc * GetNextSNFunc(const C4AulFunc *After)

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object * C4PropList::GetObject ( )
virtualinherited

Reimplemented in C4Object.

Definition at line 644 of file C4PropList.cpp.

References C4PropList::GetObject(), and C4PropList::GetPrototype().

Referenced by C4Value::_getObj(), C4EditCursor::AddToSelection(), C4ScriptGuiWindowAction::ClearPointers(), ThisImpl< C4Object >::Conv(), C4GameMessage::Draw(), C4ScriptGuiWindowAction::ExecuteCommand(), FnGetEffectsFor(), C4Value::GetDataString(), C4Value::getObj(), C4PropList::GetObject(), C4GameMessage::Init(), Object(), C4GameObjects::ObjectPointer(), C4EditCursor::RemoveFromSelection(), and C4ScriptGuiWindowProperty::Set().

645 {
646  if (GetPrototype()) return GetPrototype()->GetObject();
647  return 0;
648 }
virtual C4Object * GetObject()
Definition: C4PropList.cpp:644
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

C4Object const * C4PropList::GetObject ( ) const
virtualinherited

Reimplemented in C4Object.

Definition at line 650 of file C4PropList.cpp.

References C4PropList::GetObject(), and C4PropList::GetPrototype().

651 {
652  if (GetPrototype()) return GetPrototype()->GetObject();
653  return 0;
654 }
virtual C4Object * GetObject()
Definition: C4PropList.cpp:644
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

const C4PropListStatic* C4PropListStatic::GetParent ( ) const
inlineinherited

Definition at line 272 of file C4PropList.h.

References C4PropListStatic::Parent.

Referenced by C4ScriptHost::CopyPropList(), C4PropList::FreezeAndMakeStaticRecursively(), C4Value::GetDataString(), and C4Value::ToJSON().

272 { return Parent; }
const C4PropListStatic * Parent
Definition: C4PropList.h:275

Here is the caller graph for this function:

C4String* C4PropListStatic::GetParentKeyName ( )
inlineinherited

Definition at line 273 of file C4PropList.h.

References C4PropListStatic::ParentKeyName.

Referenced by C4PropList::FreezeAndMakeStaticRecursively().

273 { return ParentKeyName; }
C4RefCntPointer< C4String > ParentKeyName
Definition: C4PropList.h:276

Here is the caller graph for this function:

C4ValueArray * C4PropList::GetProperties ( ) const
virtualinherited

Reimplemented in C4Object, and C4Effect.

Definition at line 891 of file C4PropList.cpp.

References a, C4V_String, C4VString(), C4Set< T >::First(), C4PropList::GetProperties(), C4PropList::GetPrototype(), C4ValueArray::GetSize(), C4Set< T >::GetSize(), C4Property::Key, C4Set< T >::Next(), and C4ValueArray::SetSize().

Referenced by C4ScriptGuiWindow::CreateFromPropList(), C4PropList::GetProperties(), C4Effect::GetProperties(), C4Object::GetProperties(), and C4ScriptGuiWindowProperty::Set().

892 {
893  C4ValueArray * a;
894  int i;
895  if (GetPrototype())
896  {
897  a = GetPrototype()->GetProperties();
898  i = a->GetSize();
899  a->SetSize(i + Properties.GetSize());
900  }
901  else
902  {
903  a = new C4ValueArray(Properties.GetSize());
904  i = 0;
905  }
906  const C4Property * p = Properties.First();
907  while (p)
908  {
909  assert(p->Key != nullptr && "Proplist key is nullpointer");
910  (*a)[i++] = C4VString(p->Key);
911  assert(((*a)[i - 1].GetType() == C4V_String) && "Proplist key is non-string");
912  p = Properties.Next(p);
913  }
914  return a;
915 }
#define a
T const * Next(T const *p) const
unsigned int GetSize() const
virtual C4ValueArray * GetProperties() const
Definition: C4PropList.cpp:891
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
void SetSize(int32_t inSize)
int32_t GetSize() const
Definition: C4ValueArray.h:36
C4String * Key
Definition: C4PropList.h:56
C4Value C4VString(C4String *pStr)
Definition: C4Value.h:246
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PropList::GetProperty ( C4PropertyName  k,
C4Value pResult 
) const
inlineinherited

Definition at line 103 of file C4PropList.h.

References C4PropList::GetPropertyByS(), C4StringTable::P, and Strings.

Referenced by C4MapScriptAlgoFilter::C4MapScriptAlgoFilter(), C4MapScriptAlgoModifier::C4MapScriptAlgoModifier(), C4MapScriptAlgoPolygon::C4MapScriptAlgoPolygon(), C4MapScriptAlgoRndChecker::C4MapScriptAlgoRndChecker(), C4FindObjectProcedure::Check(), C4DefGraphics::Draw(), C4GraphicsOverlay::Draw(), C4Object::DrawFaceImpl(), C4Object::DrawLine(), C4Object::ExecAction(), C4Object::GetAction(), C4Def::GetActionByName(), C4Object::GetDragImage(), C4Object::GetParallaxity(), C4MapScriptAlgo::GetXYProps(), C4GameMessage::Init(), C4Object::IsVisible(), C4ScriptUniform::Push(), C4Object::SetAction(), C4Object::SetActionByName(), and C4GraphicsOverlay::UpdateFacet().

104  { return GetPropertyByS(&Strings.P[k], pResult); }
C4String P[P_LAST]
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:734

Here is the call graph for this function:

Here is the caller graph for this function:

C4ValueArray * C4PropList::GetPropertyArray ( C4PropertyName  n) const
inherited

Definition at line 766 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Value::getArray(), C4PropList::GetPropertyArray(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4EditCursor::DoContextMenu(), C4PropList::GetPropertyArray(), and C4FoWLight::Update().

767 {
768  C4String * k = &Strings.P[n];
769  if (Properties.Has(k))
770  {
771  return Properties.Get(k).Value.getArray();
772  }
773  if (GetPrototype())
774  {
775  return GetPrototype()->GetPropertyArray(n);
776  }
777  return 0;
778 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4ValueArray * getArray() const
Definition: C4Value.h:118
C4ValueArray * GetPropertyArray(C4PropertyName n) const
Definition: C4PropList.cpp:766

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4PropList::GetPropertyBool ( C4PropertyName  n,
bool  default_val = false 
) const
inherited

Definition at line 849 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Value::getBool(), C4PropList::GetPropertyBool(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4PropList::GetPropertyBool().

850 {
851  C4String * k = &Strings.P[n];
852  if (Properties.Has(k))
853  {
854  return Properties.Get(k).Value.getBool();
855  }
856  if (GetPrototype())
857  {
858  return GetPrototype()->GetPropertyBool(n, default_val);
859  }
860  return default_val;
861 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
bool getBool() const
Definition: C4Value.h:113
int32_t GetPropertyBool(C4PropertyName n, bool default_val=false) const
Definition: C4PropList.cpp:849
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PropList::GetPropertyByS ( const C4String k,
C4Value pResult 
) const
virtualinherited

Reimplemented in C4Object, and C4Effect.

Definition at line 734 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyByS(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, P_Prototype, Strings, and C4Property::Value.

Referenced by C4Value::CompileFunc(), C4ScriptGuiWindow::CreateFromPropList(), C4PropList::FreezeAndMakeStaticRecursively(), C4Def::GetActionByName(), C4DefList::GetAllDefs(), C4PropList::GetProperty(), C4PropList::GetPropertyByS(), C4Effect::GetPropertyByS(), C4Object::GetPropertyByS(), C4ValueArraySortPropertycomp::operator()(), C4ScriptGuiWindowProperty::Set(), C4Object::SetActionByName(), C4PropList::ThawRecursively(), C4ScriptHost::UnlinkOwnedFunctions(), C4GraphicsOverlay::UpdateFacet(), and C4AulCompiler::ConstexprEvaluator::visit().

735 {
736  if (Properties.Has(k))
737  {
738  *pResult = Properties.Get(k).Value;
739  return true;
740  }
741  else if (k == &Strings.P[P_Prototype])
742  {
743  *pResult = prototype;
744  return true;
745  }
746  else if(GetPrototype())
747  return GetPrototype()->GetPropertyByS(k, pResult);
748  else
749  return false;
750 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:734
C4PropList * GetPrototype() const
Definition: C4PropList.h:83

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t C4PropList::GetPropertyInt ( C4PropertyName  k,
int32_t  default_val = 0 
) const
inherited

Definition at line 863 of file C4PropList.cpp.

References C4Set< T >::Get(), C4Value::getInt(), C4PropList::GetPropertyInt(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4MouseControl::ButtonUpDragScript(), C4MapScriptAlgoEllipsis::C4MapScriptAlgoEllipsis(), C4MapScriptAlgoLines::C4MapScriptAlgoLines(), C4MapScriptAlgoOffset::C4MapScriptAlgoOffset(), C4MapScriptAlgoPolygon::C4MapScriptAlgoPolygon(), C4MapScriptAlgoRect::C4MapScriptAlgoRect(), C4MapScriptAlgoRndChecker::C4MapScriptAlgoRndChecker(), C4MapScriptAlgoRotate::C4MapScriptAlgoRotate(), C4MapScriptAlgoScale::C4MapScriptAlgoScale(), C4MapScriptAlgoTurbulence::C4MapScriptAlgoTurbulence(), C4Object::Contact(), C4Object::ContactAction(), C4Object::DoBreath(), C4Object::DoEnergy(), C4Object::DoMovement(), C4MouseControl::DragNone(), C4Object::Draw(), C4Object::DrawActionFace(), C4Game::DrawPropListSpecImage(), C4Object::DrawTopFace(), C4Command::Enter(), C4Object::ExecAction(), C4Object::ExecLife(), C4Object::ExecMovement(), C4ValueProviderAction::Execute(), C4Command::Exit(), C4Command::FlightControl(), FnParAlgo(), C4SoundModifierList::Get(), C4SoundModifier::GetBoolProp(), C4SoundModifier::GetFloatProp(), C4Def::GetPlane(), C4PropList::GetPropertyInt(), C4Object::GetSolidMaskPlane(), C4Object::Init(), C4Object::IsVisible(), C4Command::MoveTo(), ObjectActionThrow(), ObjectComDrop(), ObjectComJump(), C4Game::PlaceAnimal(), C4Game::PlaceVegetation(), C4Object::Push(), C4Command::Put(), C4Object::ResetProperty(), C4Object::SetAction(), C4Object::SetDir(), C4Object::SetOCF(), C4Object::SetPhase(), C4Object::SideBounds(), C4Command::Throw(), C4Object::UpdateActionFace(), C4MouseControl::UpdateCursorTarget(), C4GraphicsOverlay::UpdateFacet(), C4Object::UpdateFlipDir(), C4Object::UpdateOCF(), and C4Object::VerticalBounds().

864 {
865  C4String * k = &Strings.P[n];
866  if (Properties.Has(k))
867  {
868  return Properties.Get(k).Value.getInt();
869  }
870  if (GetPrototype())
871  {
872  return GetPrototype()->GetPropertyInt(n, default_val);
873  }
874  return default_val;
875 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
int32_t getInt() const
Definition: C4Value.h:112
int32_t GetPropertyInt(C4PropertyName k, int32_t default_val=0) const
Definition: C4PropList.cpp:863

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropertyName C4PropList::GetPropertyP ( C4PropertyName  k) const
inherited

Definition at line 832 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyP(), C4PropList::GetPrototype(), C4Value::getStr(), C4Set< T >::Has(), C4StringTable::P, P_LAST, Strings, and C4Property::Value.

Referenced by C4Object::ContactAction(), C4Object::ExecAction(), C4Object::ExecMovement(), C4Object::GetProcedure(), C4PropList::GetPropertyP(), ObjectComDrop(), C4Object::SetAction(), C4Object::SideBounds(), and C4Object::VerticalBounds().

833 {
834  C4String * k = &Strings.P[n];
835  if (Properties.Has(k))
836  {
837  C4String * v = Properties.Get(k).Value.getStr();
838  if (v >= &Strings.P[0] && v < &Strings.P[P_LAST])
839  return C4PropertyName(v - &Strings.P[0]);
840  return P_LAST;
841  }
842  if (GetPrototype())
843  {
844  return GetPrototype()->GetPropertyP(n);
845  }
846  return P_LAST;
847 }
C4PropertyName GetPropertyP(C4PropertyName k) const
Definition: C4PropList.cpp:832
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
C4String * getStr() const
Definition: C4Value.h:117
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4PropertyName

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList * C4PropList::GetPropertyPropList ( C4PropertyName  k) const
inherited

Definition at line 877 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyPropList(), C4Value::getPropList(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4MapScriptAlgoLayer::C4MapScriptAlgoLayer(), C4Game::DrawPropListSpecImage(), C4PropList::GetPropertyPropList(), and C4GameMessage::Init().

878 {
879  C4String * k = &Strings.P[n];
880  if (Properties.Has(k))
881  {
882  return Properties.Get(k).Value.getPropList();
883  }
884  if (GetPrototype())
885  {
886  return GetPrototype()->GetPropertyPropList(n);
887  }
888  return nullptr;
889 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4PropList * GetPropertyPropList(C4PropertyName k) const
Definition: C4PropList.cpp:877
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

C4String * C4PropList::GetPropertyStr ( C4PropertyName  k) const
inherited

Definition at line 752 of file C4PropList.cpp.

References C4Set< T >::Get(), C4PropList::GetPropertyStr(), C4PropList::GetPrototype(), C4Value::getStr(), C4Set< T >::Has(), C4StringTable::P, Strings, and C4Property::Value.

Referenced by C4Game::DrawPropListSpecImage(), C4Object::ExecAction(), C4PropList::GetName(), C4PropListStatic::GetName(), C4PropList::GetPropertyStr(), C4Object::SetAction(), C4Object::SetDir(), C4MouseControl::UpdateCursorTarget(), and C4GraphicsOverlay::UpdateFacet().

753 {
754  C4String * k = &Strings.P[n];
755  if (Properties.Has(k))
756  {
757  return Properties.Get(k).Value.getStr();
758  }
759  if (GetPrototype())
760  {
761  return GetPrototype()->GetPropertyStr(n);
762  }
763  return 0;
764 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
C4String * getStr() const
Definition: C4Value.h:117
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
C4String * GetPropertyStr(C4PropertyName k) const
Definition: C4PropList.cpp:752

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropListNumbered * C4PropList::GetPropListNumbered ( )
virtualinherited

Reimplemented in C4PropListNumbered.

Definition at line 680 of file C4PropList.cpp.

References C4PropList::GetPropListNumbered(), and C4PropList::GetPrototype().

Referenced by C4Effect::CompileFunc(), C4Value::CompileFunc(), C4AulExec::DirectExec(), and C4PropList::GetPropListNumbered().

681 {
682  if (GetPrototype()) return GetPrototype()->GetPropListNumbered();
683  return 0;
684 }
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
virtual C4PropListNumbered * GetPropListNumbered()
Definition: C4PropList.cpp:680

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList* C4PropList::GetPrototype ( ) const
inlineinherited
std::vector< C4String * > C4PropList::GetSortedLocalProperties ( bool  add_prototype = true) const
inherited

Definition at line 557 of file C4PropList.cpp.

References C4Set< T >::GetSortedListOfElementPointers(), C4StringTable::P, P_Prototype, and Strings.

Referenced by C4PropList::FreezeAndMakeStaticRecursively().

558 {
559  // return property list without descending into prototype
560  std::list<const C4Property *> sorted_props = Properties.GetSortedListOfElementPointers();
561  std::vector< C4String * > result;
562  result.reserve(sorted_props.size() + add_prototype);
563  if (add_prototype) result.push_back(&::Strings.P[P_Prototype]); // implicit prototype for every prop list
564  for (auto p : sorted_props) result.push_back(p->Key);
565  return result;
566 }
C4String P[P_LAST]
std::list< const T * > GetSortedListOfElementPointers() const
C4StringTable Strings
Definition: C4Globals.cpp:42

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< C4String * > C4PropList::GetSortedLocalProperties ( const char *  prefix,
const C4PropList ignore_overridden 
) const
inherited

Definition at line 568 of file C4PropList.cpp.

References a, b, C4Set< T >::First(), C4String::GetCStr(), C4PropList::GetPrototype(), C4PropList::HasProperty(), C4Set< T >::Next(), C4StringTable::P, P_Prototype, and Strings.

569 {
570  // return property list without descending into prototype
571  // ignore properties that have been overridden by proplist given in ignore_overridden or any of its prototypes up to and excluding this
572  std::vector< C4String * > result;
573  for (const C4Property *pp = Properties.First(); pp; pp = Properties.Next(pp))
574  if (pp->Key != &::Strings.P[P_Prototype])
575  if (!prefix || pp->Key->GetData().BeginsWith(prefix))
576  {
577  // Override check
578  const C4PropList *check = ignore_overridden;
579  bool overridden = false;
580  if (check && check != this)
581  {
582  if (check->HasProperty(pp->Key)) { overridden = true; break; }
583  check = check->GetPrototype();
584  }
585  result.push_back(pp->Key);
586  }
587  // Sort
588  std::sort(result.begin(), result.end(), [](const C4String *a, const C4String *b) -> bool
589  {
590  return strcmp(a->GetCStr(), b->GetCStr()) < 0;
591  });
592  return result;
593 }
C4String P[P_LAST]
#define b
const char * GetCStr() const
Definition: C4StringTable.h:49
#define a
T const * Next(T const *p) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
bool HasProperty(C4String *k) const
Definition: C4PropList.h:120
T const * First() const

Here is the call graph for this function:

std::vector< C4String * > C4PropList::GetSortedProperties ( const char *  prefix,
C4PropList ignore_parent = nullptr 
) const
inherited

Definition at line 613 of file C4PropList.cpp.

References a, b, C4String::GetCStr(), and C4PropList::GetUnsortedProperties().

614 {
615  // Return property list with descending into prototype
616  // But do not include Prototype property
617  std::vector< C4String * > result = GetUnsortedProperties(prefix, ignore_parent);
618  // Sort
619  std::sort(result.begin(), result.end(), [](const C4String *a, const C4String *b) -> bool
620  {
621  return strcmp(a->GetCStr(), b->GetCStr()) < 0;
622  });
623  return result;
624 }
#define b
const char * GetCStr() const
Definition: C4StringTable.h:49
#define a
std::vector< C4String * > GetUnsortedProperties(const char *prefix, C4PropList *ignore_parent=nullptr) const
Definition: C4PropList.cpp:595

Here is the call graph for this function:

std::vector< C4String * > C4PropList::GetUnsortedProperties ( const char *  prefix,
C4PropList ignore_parent = nullptr 
) const
inherited

Definition at line 595 of file C4PropList.cpp.

References C4Set< T >::First(), C4PropList::GetPrototype(), C4Set< T >::Next(), C4StringTable::P, P_Prototype, and Strings.

Referenced by C4PropList::GetSortedProperties(), and C4PropList::ThawRecursively().

596 {
597  // Return property list with descending into prototype
598  // But do not include Prototype property
599  std::vector< C4String * > result;
600  const C4PropList *p = this;
601  do
602  {
603  for (const C4Property *pp = p->Properties.First(); pp; pp = p->Properties.Next(pp))
604  if (pp->Key != &::Strings.P[P_Prototype])
605  if (!prefix || pp->Key->GetData().BeginsWith(prefix))
606  result.push_back(pp->Key);
607  p = p->GetPrototype();
608  if (p == ignore_parent) break;
609  } while (p);
610  return result;
611 }
C4String P[P_LAST]
T const * Next(T const *p) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
T const * First() const

Here is the call graph for this function:

Here is the caller graph for this function:

C4AulUserFile* C4AulScriptEngine::GetUserFile ( int32_t  handle)

Referenced by C4EditCursor::PerformDuplication(), and C4Game::SaveData().

Here is the caller graph for this function:

bool C4PropList::HasProperty ( C4String k) const
inlineinherited

Definition at line 120 of file C4PropList.h.

References C4Set< T >::Has().

Referenced by C4PropList::GetSortedLocalProperties(), C4MapScriptAlgo::GetXYProps(), C4AulCompiler::PreparseAstVisitor::visit(), and C4AulCompiler::ConstantResolver::visit().

120 { return Properties.Has(k); }
bool Has(H e) const

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4PropList::IsFrozen ( ) const
inlineinherited

Definition at line 133 of file C4PropList.h.

Referenced by C4PropList::ThawRecursively().

133 { return constant; }

Here is the caller graph for this function:

virtual bool C4PropList::IsNumbered ( ) const
inlinevirtualinherited

Reimplemented in C4PropListNumbered.

Definition at line 90 of file C4PropList.h.

Referenced by C4Value::Denumerate(), and C4PropList::operator==().

90 { return false; }

Here is the caller graph for this function:

const class C4PropListStatic* C4PropList::IsStatic ( ) const
inlineinherited

Definition at line 88 of file C4PropList.h.

References C4PropList::IsStatic().

Referenced by C4PropList::IsStatic().

88 { return const_cast<C4PropList*>(this)->IsStatic(); }
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87

Here is the call graph for this function:

Here is the caller graph for this function:

virtual C4PropListStatic* C4PropListStatic::IsStatic ( )
inlinevirtualinherited

Reimplemented from C4PropList.

Definition at line 268 of file C4PropList.h.

Referenced by C4AulCompiler::ConstantResolver::visit().

268 { return this; }

Here is the caller graph for this function:

void C4AulScriptEngine::Link ( C4DefList rDefs)

Definition at line 165 of file C4AulLink.cpp.

References C4DefList::CallEveryDefinition(), Child0, ErrorHandler, C4PropList::FreezeAndMakeStaticRecursively(), GetPropList(), GlobalNamed, GlobalNamedNames, C4AulErrorHandler::OnError(), OwnedPropLists, s, ScriptEngine, C4ValueMapData::SetNameList(), C4DefList::SortByPriority(), and C4AulError::what().

Referenced by c4_mapgen_handle_new(), c4_mapgen_handle_new_script(), C4Game::LinkScriptEngine(), and ReLink().

166 {
167  try
168  {
169  // resolve appends
170  for (C4ScriptHost *s = Child0; s; s = s->Next)
171  s->ResolveAppends(rDefs);
172 
173  // resolve includes
174  for (C4ScriptHost *s = Child0; s; s = s->Next)
175  s->ResolveIncludes(rDefs);
176 
177  // parse the scripts to byte code
178  for (C4ScriptHost *s = Child0; s; s = s->Next)
179  s->Parse();
180 
181  if (rDefs)
182  {
183  rDefs->SortByPriority();
184  rDefs->CallEveryDefinition();
185  }
186 
187  // Done modifying the proplists now
188  for (C4ScriptHost *s = Child0; s; s = s->Next)
189  s->GetPropList()->FreezeAndMakeStaticRecursively(&s->ownedPropLists);
190 
192  }
193  catch (C4AulError &err)
194  {
195  // error??! show it!
196  ErrorHandler->OnError(err.what());
197  }
198 
199  // Set name list for globals (FIXME: is this necessary?)
201 }
C4ValueMapNames GlobalNamedNames
Definition: C4Aul.h:136
C4PropListStatic * FreezeAndMakeStaticRecursively(std::vector< C4Value > *prop_lists, const C4PropListStatic *parent=nullptr, C4String *key=nullptr)
Definition: C4PropList.cpp:304
C4PropListStatic * GetPropList()
Definition: C4Aul.h:153
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
C4ValueMapData GlobalNamed
Definition: C4Aul.h:137
virtual const char * what() const noexcept
void SetNameList(C4ValueMapNames *pnNames)
Definition: C4ValueMap.cpp:83
void CallEveryDefinition()
Definition: stub-handle.cpp:77
virtual void OnError(const char *msg)=0
void SortByPriority()
Definition: stub-handle.cpp:76
std::vector< C4Value > OwnedPropLists
Definition: C4Aul.h:128
C4AulErrorHandler * ErrorHandler
Definition: C4Aul.h:130
#define s
C4ScriptHost * Child0
Definition: C4Aul.h:123

Here is the call graph for this function:

Here is the caller graph for this function:

C4PropList * C4PropList::New ( C4PropList prototype = 0)
staticinherited

Definition at line 64 of file C4PropList.cpp.

Referenced by CompileNewFunc(), FnPlaceVegetation(), C4ScriptGuiWindowProperty::ToC4Value(), C4ScriptGuiWindow::ToC4Value(), and C4AulCompiler::ConstexprEvaluator::visit().

65 {
66  C4PropList * r = new C4PropListScript(prototype);
67  return r;
68 }

Here is the caller graph for this function:

C4PropListStatic * C4PropList::NewStatic ( C4PropList prototype,
const C4PropListStatic parent,
C4String key 
)
staticinherited

Definition at line 70 of file C4PropList.cpp.

Referenced by C4PropListScen::C4PropListScen(), C4ScriptHost::CopyPropList(), C4PropList::FreezeAndMakeStaticRecursively(), C4ScenarioParameterDefs::RegisterScriptConstants(), and C4AulCompiler::ConstexprEvaluator::visit().

71 {
72  return new C4PropListStatic(prototype, parent, key);
73 }

Here is the caller graph for this function:

bool C4PropList::operator== ( const C4PropList b) const
inherited

Definition at line 380 of file C4PropList.cpp.

References C4Set< T >::First(), C4Set< T >::Get(), C4PropList::GetDef(), C4Set< T >::GetSize(), C4PropList::IsNumbered(), C4Property::Key, C4Set< T >::Next(), and C4Property::Value.

381 {
382  // every numbered proplist has a unique number and is only identical to itself
383  if (this == &b) return true;
384  if (IsNumbered() || b.IsNumbered()) return false;
385  if (Properties.GetSize() != b.Properties.GetSize()) return false;
386  if (GetDef() != b.GetDef()) return false;
387  const C4Property * p = Properties.First();
388  while (p)
389  {
390  const C4Property & bp = b.Properties.Get(p->Key);
391  if (!bp) return false;
392  if (p->Value != bp.Value) return false;
393  p = Properties.Next(p);
394  }
395  return true;
396 }
C4Value Value
Definition: C4PropList.h:57
virtual C4Def const * GetDef() const
Definition: C4PropList.cpp:662
T & Get(H e) const
T const * Next(T const *p) const
unsigned int GetSize() const
C4String * Key
Definition: C4PropList.h:56
virtual bool IsNumbered() const
Definition: C4PropList.h:90
T const * First() const

Here is the call graph for this function:

void C4PropListStatic::RefCompileFunc ( StdCompiler pComp,
C4ValueNumbers numbers 
) const
inherited

Definition at line 240 of file C4PropList.cpp.

References StdCompiler::excCorrupt(), C4String::GetData(), StdCompiler::isDeserializer(), mkParAdapt(), C4PropListStatic::Parent, C4PropListStatic::ParentKeyName, StdCompiler::RCT_ID, C4PropListStatic::RefCompileFunc(), StdCompiler::SEP_PART, StdCompiler::Separator(), and StdCompiler::Value().

Referenced by C4Effect::CompileFunc(), C4Value::CompileFunc(), and C4PropListStatic::RefCompileFunc().

241 {
242  assert(!pComp->isDeserializer());
243  if (Parent)
244  {
245  Parent->RefCompileFunc(pComp, numbers);
247  }
248  if (!ParentKeyName)
249  pComp->excCorrupt("C4PropListStatic::RefCompileFunc without ParentKeyName");
251 }
virtual bool Separator(Sep eSep=SEP_SEP)
Definition: StdCompiler.h:129
StdStrBuf GetData() const
Definition: C4StringTable.h:50
void excCorrupt(const char *szMessage,...)
Definition: StdCompiler.h:259
void RefCompileFunc(StdCompiler *pComp, C4ValueNumbers *numbers) const
Definition: C4PropList.cpp:240
const C4PropListStatic * Parent
Definition: C4PropList.h:275
void Value(const T &rStruct)
Definition: StdCompiler.h:171
virtual bool isDeserializer()
Definition: StdCompiler.h:63
StdParameterAdapt< T, P > mkParAdapt(T &&rObj, P &&rPar)
Definition: StdAdaptors.h:456
C4RefCntPointer< C4String > ParentKeyName
Definition: C4PropList.h:276

Here is the call graph for this function:

Here is the caller graph for this function:

void C4AulScriptEngine::RegisterErrorHandler ( C4AulErrorHandler handler)
void C4AulScriptEngine::RegisterGlobalConstant ( const char *  szName,
const C4Value rValue 
)

Referenced by C4PlayerControlDefs::FinalInit(), InitCoreFunctionMap(), C4MapScriptHost::InitFunctionMap(), InitGameFunctionMap(), InitObjectFunctionMap(), C4Game::InitScriptEngine(), C4GameScriptHost::Load(), C4Def::Load(), C4GameScriptHost::LoadData(), and C4ScenarioParameterDefs::RegisterScriptConstants().

Here is the caller graph for this function:

void C4AulScriptEngine::ReLink ( C4DefList rDefs)

Definition at line 204 of file C4AulLink.cpp.

References errCnt, GameScript, lineCnt, Link(), LogF(), pGlobalEffects, C4GameScriptHost::pScenarioEffects, C4Effect::ReAssignAllCallbackFunctions(), C4DefList::ResetIncludeDependencies(), UnLink(), and warnCnt.

Referenced by C4Game::ReLinkScriptEngine().

205 {
206  // unlink scripts
207  UnLink();
208 
209  // unlink defs
210  if (rDefs) rDefs->ResetIncludeDependencies();
211 
212  // re-link
213  Link(rDefs);
214 
215  // display state
216  LogF("C4AulScriptEngine linked - %d line%s, %d warning%s, %d error%s",
217  lineCnt, (lineCnt != 1 ? "s" : ""), warnCnt, (warnCnt != 1 ? "s" : ""), errCnt, (errCnt != 1 ? "s" : ""));
218 
219  // adjust global effects
222 }
void ReAssignAllCallbackFunctions()
Definition: C4Effect.h:129
C4GameScriptHost GameScript
void Link(C4DefList *rDefs)
Definition: C4AulLink.cpp:165
void ResetIncludeDependencies()
Definition: stub-handle.cpp:78
C4Effect * pScenarioEffects
Definition: C4ScriptHost.h:165
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:253
C4Effect * pGlobalEffects
Definition: C4Aul.h:146

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4AulScriptEngine::ReloadScript ( const char *  szScript,
const char *  szLanguage 
)

Definition at line 224 of file C4AulLink.cpp.

References Child0, C4ScriptHost::Next, C4ScriptHost::ReloadScript(), and s.

Referenced by C4Game::ReloadFile().

225 {
226  C4ScriptHost * s;
227  for (s = Child0; s; s = s->Next)
228  if (s->ReloadScript(szScript, szLanguage))
229  break;
230  return !!s;
231 }
virtual bool ReloadScript(const char *szPath, const char *szLanguage)
#define s
C4ScriptHost * Next
Definition: C4ScriptHost.h:77
C4ScriptHost * Child0
Definition: C4Aul.h:123

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::RemoveCyclicPrototypes ( )
inherited

Definition at line 431 of file C4PropList.cpp.

References C4Value::getPropList(), and C4Value::Set0().

Referenced by C4PropList::Denumerate().

432 {
433  // clear any cyclic prototype chains
434  // Use prototype.getPropList() instead of GetPrototype() because denumeration might not be completed yet
435  for(C4PropList * it = prototype.getPropList(); it; it = it->prototype.getPropList())
436  if(it == this)
437  {
438  prototype.Set0();
439  }
440 }
void Set0()
Definition: C4Value.h:336
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::ResetProperty ( C4String k)
virtualinherited

Reimplemented in C4Object, and C4Effect.

Definition at line 950 of file C4PropList.cpp.

References C4StringTable::P, P_Prototype, C4Set< T >::Remove(), C4Value::Set0(), and Strings.

Referenced by C4Effect::ResetProperty(), C4Object::ResetProperty(), C4PropList::SetName(), and C4ScriptHost::UnlinkOwnedFunctions().

951 {
952  if (k == &Strings.P[P_Prototype])
953  prototype.Set0();
954  else
955  Properties.Remove(k);
956 }
C4String P[P_LAST]
void Set0()
Definition: C4Value.h:336
C4StringTable Strings
Definition: C4Globals.cpp:42
void Remove(H e)

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::SetName ( const char *  NewName = 0)
virtualinherited

Reimplemented in C4Object.

Definition at line 633 of file C4PropList.cpp.

References C4VString(), C4StringTable::P, P_Name, C4PropList::ResetProperty(), C4PropList::SetProperty(), and Strings.

Referenced by c4_mapgen_handle_set_map_library(), C4MapScriptHost::InitFunctionMap(), and C4Object::SetName().

634 {
635  if (!NewName)
637  else
638  {
639  SetProperty(P_Name, C4VString(NewName));
640  }
641 }
virtual void ResetProperty(C4String *k)
Definition: C4PropList.cpp:950
C4String P[P_LAST]
void SetProperty(C4PropertyName k, const C4Value &to)
Definition: C4PropList.h:122
C4StringTable Strings
Definition: C4Globals.cpp:42
C4Value C4VString(C4String *pStr)
Definition: C4Value.h:246

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4PropList::SetOnFire ( bool  OnFire)
inlinevirtualinherited

Reimplemented in C4Object.

Definition at line 71 of file C4PropList.h.

Referenced by C4Effect::ClearAll(), C4Effect::Init(), C4Effect::Kill(), C4Effect::TempReaddUpperEffects(), and C4Effect::TempRemoveUpperEffects().

71 { }

Here is the caller graph for this function:

void C4PropList::SetProperty ( C4PropertyName  k,
const C4Value to 
)
inlineinherited

Definition at line 122 of file C4PropList.h.

References C4StringTable::P, C4PropList::SetPropertyByS(), and Strings.

Referenced by C4Effect::C4Effect(), C4Object::ChangeDef(), C4Object::Init(), C4DefScriptHost::Parse(), C4ScriptHost::Preparse(), C4Object::SetAction(), C4PropList::SetName(), C4ScriptGuiWindow::ToC4Value(), C4ScriptHost::UnLink(), and C4MapScriptLayer::UpdateSurfaceSize().

123  { SetPropertyByS(&Strings.P[k], to); }
C4String P[P_LAST]
C4StringTable Strings
Definition: C4Globals.cpp:42
virtual void SetPropertyByS(C4String *k, const C4Value &to)
Definition: C4PropList.cpp:929

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::SetPropertyByS ( C4String k,
const C4Value to 
)
virtualinherited

Reimplemented in C4Object, C4PropListScen, and C4Effect.

Definition at line 929 of file C4PropList.cpp.

References C4Set< T >::Add(), C4Set< T >::Get(), C4Value::getPropList(), C4PropList::GetPrototype(), C4Set< T >::Has(), C4StringTable::P, P_Prototype, C4Value::SetPropList(), Strings, and C4Property::Value.

Referenced by C4AulDefFunc::C4AulDefFunc(), C4PropListScen::C4PropListScen(), C4ScriptHost::CopyPropList(), C4PropList::SetProperty(), C4Effect::SetPropertyByS(), C4PropListScen::SetPropertyByS(), C4Object::SetPropertyByS(), C4ScriptGuiWindowProperty::ToC4Value(), C4ScriptGuiWindow::ToC4Value(), C4ScriptHost::UnlinkOwnedFunctions(), C4AulCompiler::PreparseAstVisitor::visit(), C4AulCompiler::ConstexprEvaluator::visit(), and C4AulCompiler::ConstantResolver::visit().

930 {
931  assert(!constant);
932  if (k == &Strings.P[P_Prototype])
933  {
934  C4PropList * newpt = to.getPropList();
935  for(C4PropList * it = newpt; it; it = it->GetPrototype())
936  if(it == this)
937  throw C4AulExecError("Trying to create cyclic prototype structure");
938  prototype.SetPropList(newpt);
939  }
940  else if (Properties.Has(k))
941  {
942  Properties.Get(k).Value = to;
943  }
944  else
945  {
946  Properties.Add(C4Property(k, to));
947  }
948 }
C4String P[P_LAST]
C4Value Value
Definition: C4PropList.h:57
T * Add(T const &e)
bool Has(H e) const
T & Get(H e) const
C4StringTable Strings
Definition: C4Globals.cpp:42
C4PropList * GetPrototype() const
Definition: C4PropList.h:83
void SetPropList(C4PropList *PropList)
Definition: C4Value.h:141
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

void C4PropList::Thaw ( )
inlineinherited

Definition at line 131 of file C4PropList.h.

Referenced by C4PropList::ThawRecursively(), and C4ScriptHost::UnlinkOwnedFunctions().

131 { constant = false; }

Here is the caller graph for this function:

void C4PropList::ThawRecursively ( )
inherited

Definition at line 284 of file C4PropList.cpp.

References C4PropList::GetPropertyByS(), C4Value::getPropList(), GetPropList(), C4PropList::GetUnsortedProperties(), C4PropList::IsFrozen(), C4PropList::IsStatic(), s, ScriptEngine, C4PropList::Thaw(), and C4PropList::ThawRecursively().

Referenced by C4PropList::ThawRecursively(), and UnLink().

285 {
286  //thaw self and all owned properties
287  Thaw();
289  //if (s) LogF("Thaw: %s", s->GetDataString().getData());
290  auto prop_names = GetUnsortedProperties(nullptr, ::ScriptEngine.GetPropList());
291  for (auto prop_name : prop_names)
292  {
293  C4Value child_val;
294  GetPropertyByS(prop_name, &child_val);
295  //LogF(" %s=%s", prop_name->GetCStr(), child_val.GetDataString(1).getData());
296  C4PropList *child_proplist = child_val.getPropList();
297  if (child_proplist && child_proplist->IsFrozen())
298  {
299  child_proplist->ThawRecursively();
300  }
301  }
302 }
void Thaw()
Definition: C4PropList.h:131
C4PropListStatic * GetPropList()
Definition: C4Aul.h:153
C4AulScriptEngine ScriptEngine
Definition: C4Globals.cpp:43
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
virtual bool GetPropertyByS(const C4String *k, C4Value *pResult) const
Definition: C4PropList.cpp:734
void ThawRecursively()
Definition: C4PropList.cpp:284
bool IsFrozen() const
Definition: C4PropList.h:133
std::vector< C4String * > GetUnsortedProperties(const char *prefix, C4PropList *ignore_parent=nullptr) const
Definition: C4PropList.cpp:595
#define s
C4PropList * getPropList() const
Definition: C4Value.h:116

Here is the call graph for this function:

Here is the caller graph for this function:

StdStrBuf C4PropList::ToJSON ( int  depth = 10,
bool  ignore_reference_parent = false 
) const
inherited

Definition at line 537 of file C4PropList.cpp.

References StdStrBuf::Append(), C4PropList::C4Value, C4Set< T >::GetSize(), C4Set< T >::GetSortedListOfElementPointers(), and C4PropList::IsStatic().

Referenced by C4Value::ToJSON().

538 {
539  if (depth <= 0 && Properties.GetSize())
540  {
541  throw new C4JSONSerializationError("maximum depth reached");
542  }
543  StdStrBuf DataString;
544  DataString = "{";
545  std::list<const C4Property *> sorted_props = Properties.GetSortedListOfElementPointers();
546  for (std::list<const C4Property *>::const_iterator p = sorted_props.begin(); p != sorted_props.end(); ++p)
547  {
548  if (p != sorted_props.begin()) DataString.Append(",");
549  DataString.Append(C4Value((*p)->Key).ToJSON());
550  DataString.Append(":");
551  DataString.Append((*p)->Value.ToJSON(depth - 1, ignore_reference_parent ? IsStatic() : nullptr));
552  }
553  DataString.Append("}");
554  return DataString;
555 }
std::list< const T * > GetSortedListOfElementPointers() const
friend class C4Value
Definition: C4PropList.h:167
virtual class C4PropListStatic * IsStatic()
Definition: C4PropList.h:87
unsigned int GetSize() const
void Append(const char *pnData, size_t iChars)
Definition: StdBuf.h:527

Here is the call graph for this function:

Here is the caller graph for this function:

void C4AulScriptEngine::UnLink ( )

Definition at line 148 of file C4AulLink.cpp.

References Child0, errCnt, GetPropList(), lineCnt, s, C4PropList::ThawRecursively(), and warnCnt.

Referenced by ReLink().

149 {
150  warnCnt = errCnt = lineCnt = 0;
151 
152  // Make everything writeable
154  for (C4ScriptHost *s = Child0; s; s = s->Next)
155  s->GetPropList()->ThawRecursively();
156 
157  // unlink scripts
158  for (C4ScriptHost *s = Child0; s; s = s->Next)
159  s->UnLink();
160  // Do not clear global variables and constants, because they are registered by the
161  // preparser or other parts. Note that keeping those fields means that you cannot delete a global
162  // variable or constant at runtime by removing it from the script.
163 }
C4PropListStatic * GetPropList()
Definition: C4Aul.h:153
void ThawRecursively()
Definition: C4PropList.cpp:284
#define s
C4ScriptHost * Child0
Definition: C4Aul.h:123

Here is the call graph for this function:

Here is the caller graph for this function:

void C4AulScriptEngine::UnregisterErrorHandler ( C4AulErrorHandler handler)

Friends And Related Function Documentation

friend class C4AulCompiler
friend

Definition at line 184 of file C4Aul.h.

friend class C4AulDebug
friend

Definition at line 185 of file C4Aul.h.

friend class C4AulFunc
friend

Definition at line 180 of file C4Aul.h.

friend class C4AulParse
friend

Definition at line 183 of file C4Aul.h.

friend class C4AulProfiler
friend

Definition at line 181 of file C4Aul.h.

friend class C4ScriptHost
friend

Definition at line 182 of file C4Aul.h.

Member Data Documentation

C4ScriptHost* C4AulScriptEngine::Child0
protected

Definition at line 123 of file C4Aul.h.

Referenced by Link(), C4ScriptHost::Reg2List(), ReloadScript(), UnLink(), and C4ScriptHost::Unreg().

C4ScriptHost * C4AulScriptEngine::ChildL
protected

Definition at line 123 of file C4Aul.h.

Referenced by C4ScriptHost::Reg2List(), and C4ScriptHost::Unreg().

int C4AulScriptEngine::errCnt

Definition at line 133 of file C4Aul.h.

Referenced by C4Game::LinkScriptEngine(), C4AulParse::Parse_Script(), ReLink(), and UnLink().

C4AulFuncMap C4AulScriptEngine::FuncLookUp
protected

Definition at line 118 of file C4Aul.h.

Referenced by C4AulFunc::C4AulFunc(), and C4AulFunc::~C4AulFunc().

C4ValueMapNames C4AulScriptEngine::GlobalConstNames
C4ValueMapData C4AulScriptEngine::GlobalConsts

Definition at line 144 of file C4Aul.h.

Referenced by C4AulCompiler::ConstantResolver::visit().

C4ValueMapData C4AulScriptEngine::GlobalNamed

Definition at line 137 of file C4Aul.h.

Referenced by Link().

C4ValueMapNames C4AulScriptEngine::GlobalNamedNames
int C4AulScriptEngine::lineCnt

Definition at line 134 of file C4Aul.h.

Referenced by C4Game::LinkScriptEngine(), C4ScriptHost::Parse(), ReLink(), and UnLink().

std::vector<C4Value> C4AulScriptEngine::OwnedPropLists
protected

Definition at line 128 of file C4Aul.h.

Referenced by Link().

const C4PropListStatic* C4PropListStatic::Parent
protectedinherited
C4Effect* C4AulScriptEngine::pGlobalEffects = nullptr
int32_t C4PropList::Status
inherited

Definition at line 170 of file C4PropList.h.

Referenced by C4Command::Acquire(), C4Command::Activate(), C4GameObjects::Add(), C4ObjectList::Add(), C4FoW::Add(), C4EditCursor::AddToSelection(), C4Object::AssignDeath(), C4ObjectList::AssignInfo(), C4Object::AssignRemoval(), C4Object::At(), C4PropList::Call(), C4Game::CastObjects(), C4ObjectList::CheckCategorySort(), C4ObjectList::CheckSort(), C4Effect::ClearAll(), C4ObjectList::ClearInfo(), C4Object::Collect(), C4Object::CompileFunc(), C4GameObjects::CrossCheck(), C4ObjectList::DeleteObjects(), C4ObjectList::Denumerate(), C4Landscape::P::DigMaterial2Objects(), C4Object::DirectComContents(), C4Effect::DoDamage(), C4Object::Draw(), C4Game::DrawCrewOverheadText(), C4Object::DrawSelectMark(), C4Object::DrawTopFace(), C4EditCursor::EMMoveObject(), C4Object::Enter(), C4Object::ExecAction(), C4SoundInstance::Execute(), C4Effect::Execute(), C4Object::Execute(), C4ScriptGuiWindowAction::ExecuteCommand(), C4Command::Fail(), C4FindObject::Find(), C4ObjectList::Find(), C4ObjectList::FindOther(), C4GameObjects::FixObjectOrder(), C4PropList::FreezeAndMakeStaticRecursively(), C4Object::GetArea(), C4EditCursor::GetCurrentSelectionPosition(), C4Object::GetEntranceArea(), C4Object::GetInfoString(), C4ObjectList::GetListID(), C4Object::GetMomentum(), C4ObjectList::GetObject(), C4Object::GrabInfo(), GrabLost(), C4GameObjects::GRBroadcast(), C4GameMessage::Init(), C4Effect::Init(), C4Object::IsMoveableBySolidMask(), C4GraphicsOverlay::IsValid(), C4Object::Lift(), C4ObjectList::ListIDCount(), C4Player::MakeCrewMember(), C4ObjectList::MassCount(), C4Object::MenuCommand(), C4GameMessageList::New(), C4Game::NewObject(), ObjectComGrab(), ObjectComUnGrab(), C4ObjectList::ObjectCount(), C4EditCursor::PerformDuplicationLegacy(), C4Landscape::P::PostFreeShape(), C4GameObjects::PostLoad(), C4Object::Push(), C4GameObjects::Remove(), C4EditCursor::RemoveFromSelection(), C4AulScriptContext::ReturnDump(), C4GameObjects::SafeObjectPointer(), C4Object::SetAction(), C4Object::SetGraphics(), C4GameObjects::SetOCF(), C4Object::SetOCF(), C4Object::StatusActivate(), C4Object::StatusDeactivate(), C4Effect::TempReaddUpperEffects(), C4Effect::TempRemoveUpperEffects(), C4ObjectList::UpdateFaces(), C4ObjectList::UpdateGraphics(), C4Object::UpdateOCF(), C4Object::UpdatePos(), C4Object::UpdateSolidMask(), C4GameObjects::UpdateSolidMasks(), C4ObjectList::ValidateOwners(), and C4ObjectList::Write().

std::list<C4AulUserFile> C4AulScriptEngine::UserFiles
protected

Definition at line 127 of file C4Aul.h.

int C4AulScriptEngine::warnCnt

Definition at line 133 of file C4Aul.h.

Referenced by C4Game::LinkScriptEngine(), ReLink(), and UnLink().


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