Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008 #pragma once
00009
00010 #include "..\ScripterExport.h"
00011 #include "..\kernel\value.h"
00012
00013 class HashTable;
00014
00015
00016
00017
00018
00019
00020
00021 class SourcePositionWrapper : public Value
00022 {
00023 public:
00024 Value* code;
00025 unsigned int pos;
00026 unsigned int line;
00027
00028 SourcePositionWrapper(Value* icode, unsigned int pos = 0, unsigned int lineNumber = 0);
00029
00030 void gc_trace();
00031 void collect();
00032 ScripterExport void sprin1(CharStream* s);
00033
00034 Value* classOf_vf(Value** arg_list, int count) { DbgAssert(false); return code->classOf_vf(arg_list, count); }
00035 Value* superClassOf_vf(Value** arg_list, int count) { DbgAssert(false); return code->superClassOf_vf(arg_list, count); }
00036 Value* isKindOf_vf(Value** arg_list, int count) { DbgAssert(false); return code->isKindOf_vf(arg_list, count); }
00037 BOOL is_kind_of(ValueMetaClass* c) { DbgAssert(false); return code->is_kind_of(c); }
00038
00039
00040 BOOL _is_collection() { DbgAssert(false); return FALSE; }
00041 BOOL _is_charstream() { DbgAssert(false); return FALSE; }
00042 BOOL _is_rolloutcontrol() { DbgAssert(false); return FALSE; }
00043 BOOL _is_rolloutthunk() { DbgAssert(false); return FALSE; }
00044 BOOL _is_function() { DbgAssert(false); return code->_is_function(); }
00045 BOOL _is_selection() { DbgAssert(false); return FALSE; }
00046 BOOL _is_thunk() { DbgAssert(false); return code->_is_thunk(); }
00047 BOOL _is_indirect_thunk() { DbgAssert(false); return FALSE; }
00048
00049 Thunk* to_thunk() { DbgAssert(false); return code->to_thunk(); }
00050
00051 ScripterExport Value* eval();
00052 ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
00053 ScripterExport Value* apply_no_alloc_frame(Value** arglist, int count, CallContext* cc=NULL);
00054 ScripterExport Value* apply(value_vf vfn_ptr, Value** arglist, int count);
00055 };
00056
00057
00058
00059
00060
00061 class SourceFileWrapper : public Value
00062 {
00063 public:
00064 Value* file_name;
00065 Value* code;
00066 MSZipPackage* module;
00067 unsigned int pos;
00068 unsigned int line;
00069 DWORD flags;
00070
00071
00072 SourceFileWrapper(Value* file_name, Value* code, unsigned int ipos, unsigned int lineNumber, DWORD flags = 0);
00073 #define is_sourcefilewrapper(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == INTERNAL_SOURCEFILEWRAPPER_TAG)
00074
00075 void gc_trace();
00076 void collect();
00077 ScripterExport void sprin1(CharStream* s) { code->sprin1(s); }
00078 BOOL _is_function() { DbgAssert(!is_sourcepositionwrapper(this)); return code->_is_function(); }
00079
00080 Value* classOf_vf(Value** arg_list, int count) { return code->classOf_vf(arg_list, count); }
00081 Value* superClassOf_vf(Value** arg_list, int count) { return code->superClassOf_vf(arg_list, count); }
00082 Value* isKindOf_vf(Value** arg_list, int count) { return code->isKindOf_vf(arg_list, count); }
00083 BOOL is_kind_of(ValueMetaClass* c) { return code->is_kind_of(c); }
00084 ScripterExport Value* eval();
00085 ScripterExport Value* eval_no_wrapper();
00086 ScripterExport Value* apply(Value** arglist, int count, CallContext* cc=NULL);
00087 };
00088
00089 class CodeTree : public Value
00090 {
00091 public:
00092 Value* fn;
00093 short count;
00094 Value** arg_list;
00095 unsigned int pos;
00096 unsigned int line;
00097 CodeTree(CharStream* source, Value* codeFn, ...);
00098 ~CodeTree();
00099
00100 #define is_codetree(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == INTERNAL_CODE_TAG)
00101 void gc_trace();
00102 void collect();
00103 ScripterExport void sprin1(CharStream* s);
00104
00105 ScripterExport Value* eval();
00106
00107 Value* add(Value* arg1, ...);
00108 Value* append(Value* arg);
00109 Value* put(int index, Value* arg);
00110 };
00111
00112
00113
00114
00115
00116
00117
00118 class Maker : public Value
00119 {
00120 value_cf maker;
00121 short count;
00122 Value** arg_list;
00123
00124 public:
00125 Maker(value_cf maker_fn, ...);
00126 Maker(Value** arg_list, int count, value_cf maker_fn);
00127 ~Maker();
00128
00129 #define is_maker(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == INTERNAL_MAKER_TAG)
00130 void gc_trace();
00131 void collect();
00132 ScripterExport void sprin1(CharStream* s);
00133
00134 ScripterExport Value* eval();
00135
00136 Value* add(Value* arg1, ...);
00137 Value* append(Value* arg);
00138 };
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153 class CodeBlock : public Value
00154 {
00155 public:
00156 Value* code;
00157 Value** locals;
00158 int local_count;
00159 HashTable* local_scope;
00160 HashTable* handlers;
00161 BOOL initialized;
00162 Name* name;
00163
00164 CodeBlock();
00165 ~CodeBlock();
00166 #define is_codeblock(v) ((DbgVerify(!is_sourcepositionwrapper(v)), (v))->tag == INTERNAL_CODEBLOCK_TAG)
00167
00168 void init(Value* code, HashTable* local_scope);
00169 void init_locals();
00170
00171 void collect();
00172 void gc_trace();
00173 void sprin1(CharStream* s);
00174
00175 void add_local();
00176 Value* call_handler(Value* handler_or_name, Value** arg_list, int count);
00177 Value* get_handler(Value* name);
00178
00179 Value* eval();
00180 Value* get_property(Value** arg_list, int count);
00181 Value* set_property(Value** arg_list, int count);
00182
00183
00184 void dump_local_vars_and_externals(int indentLevel);
00185 };
00186