1
0

scriptmgr.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _SCRIPT_H
  2. #define _SCRIPT_H
  3. #include <api/script/objects/systemobj.h>
  4. #ifdef WASABI_COMPILE_CONFIG
  5. #include <api/script/objects/wacobj.h>
  6. #endif
  7. #define SOM ScriptObjectManager
  8. // This class should ONLY contain generic functions which don't have to be duplicated for each script layer !
  9. // This is why this is (mostly) a static class. Please DO NOT add anything which relates to function pointers,
  10. // variable tables, etc.
  11. class ScriptObjectManager {
  12. public:
  13. ScriptObjectManager();
  14. ~ScriptObjectManager();
  15. static scriptVar makeVar(int type);
  16. static scriptVar makeVar(int type, ScriptObject *o);
  17. static void assign(scriptVar *v, const wchar_t *str);
  18. static void assign(scriptVar *v, int i);
  19. static void assign(scriptVar *v, float f);
  20. static void assign(scriptVar *v, double d);
  21. static void assign(scriptVar *v, ScriptObject *o);
  22. static void assign(scriptVar *v1, scriptVar *v2);
  23. static void assignPersistent(scriptVar *v1, scriptVar *v2);
  24. static void strflatassign(scriptVar *v, const wchar_t *str);
  25. static void persistentstrassign(scriptVar *v, const wchar_t *str);
  26. static int compEq(scriptVar *v1, scriptVar *v2);
  27. static int compNeq(scriptVar *v1, scriptVar *v2);
  28. static int compA(scriptVar *v1, scriptVar *v2);
  29. static int compAe(scriptVar *v1, scriptVar *v2);
  30. static int compB(scriptVar *v1, scriptVar *v2);
  31. static int compBe(scriptVar *v1, scriptVar *v2);
  32. static void mid(wchar_t *dest, const wchar_t *str, int s, int l);
  33. static int makeInt(scriptVar *v);
  34. static float makeFloat(scriptVar *v);
  35. static double makeDouble(scriptVar *v);
  36. static bool makeBoolean(scriptVar *v);
  37. static int isNumeric(scriptVar *s);
  38. static int isString(scriptVar *s);
  39. static int isVoid(scriptVar *s);
  40. static int isObject(scriptVar *s);
  41. static int isNumericType(int t);
  42. #ifdef WASABI_COMPILE_COMPONENTS
  43. static WACObject *getWACObject(const wchar_t *guid);
  44. static WACObject *getWACObject(GUID cg);
  45. #endif
  46. static SystemObject *getSystemObject(int n);
  47. static SystemObject *getSystemObjectByScriptId(int id);
  48. static void registerSystemObject(SystemObject *o);
  49. static void unregisterSystemObject(SystemObject *o);
  50. static int getNumSystemObjects();
  51. static SystemObject *enumSystemObject(int n);
  52. static int typeCheck(VCPUscriptVar *v, int fail = 1);
  53. static WindowHolder *getSuitableWindowHolderFromScript(GUID g);
  54. static int checkAbortShowHideWindow(GUID g, int visible);
  55. #ifdef WASABI_COMPILE_WND
  56. static ScriptObject *findObject(const wchar_t *name);
  57. #endif
  58. private:
  59. static SystemObject * system;
  60. static PtrList < SystemObject > syslist;
  61. static int inited;
  62. };
  63. #ifdef WASABI_COMPILE_COMPONENTS
  64. extern PtrList<WACObject> comps;
  65. #endif
  66. #endif