update porting to new machine
[wikipedia-parser-hphp.git] / parser / Implementation.cxx
blobfb303169fc2e60b922f0d63147abde3afeddab0f
1 #include "StandardHeader.h"
3 namespace RCH
5 template <class C> class MethodCall
7 public:
8 C theObject; // we store the object
13 /***
14 get this is called in the beginning of the function
15 we want to pass the object context in from outside.
17 zvalP getThis(){
19 static zval ObjectContext;
20 return &ObjectContext;
24 STDRET ZEND_NUM_ARGS(){};
25 STDRET::operator int(){};
26 template <> STDRET zend_get_parameters_array<int, int, zval**>(int, int, zval**){};
27 zvalC2 & zvalC2::operator++(int){};
28 template <> STDRET zval_ptr_dtor<zval*>(zval**){};
29 template <> SmartRet<NULLT2> EG<NULLT2>(NULLT2&){};
30 template <> SmartRet<NULLT2>::operator zval*(){};
31 template <> SmartRet<symbol_tableT> EG<symbol_tableT>(symbol_tableT&){};
32 //template <> SmartRet<symbol_tableT>::operator&(){};
33 template <> STDRET get_st_entry<symbol_tableT*, char const*, int, unsigned int>(symbol_tableT*, char const*, int, unsigned int){};
34 template <> STDRET::operator zval**(){};
35 void sep_copy_on_write(zval**){};
36 void copy_into_ref(zval**, zval**){};
37 STDRET phc_check_invariants(){};
38 zvalR2::operator bool(){};
39 template <> STDRET zval_dtor<zval>(zval*){};
40 template <> STDRET ALLOC_INIT_ZVAL<zval>(zval*){};
41 template <> STDRET ZVAL_STRINGL<zval*, char const*, int, int>(zval*, char const*, int, int){};
42 template <> STDRET get_constant<char const*, int, zval**>(char const*, int, zval**){};
43 void overwrite_lhs_no_copy(zval*, zval*){};
44 template <> STDRET safe_free_zval_ptr<zval>(zval*){};
45 template <> STDRET initialize_function_call<zend_fcall_info*, _zend_fcall_info_cache*, char const*, char const*, int>(zend_fcall_info*, _zend_fcall_info_cache*, char const*, char const*, int){};
48 template <> zend_functionCArg::operator zend_arg_info*(){};
49 zend_arg_infoR::operator int(){};
50 zend_functionCPass::operator int(){};
52 void fetch_var_arg_by_ref(){};
53 int in_copy_on_write(zval*){};
54 assert::assert(int){};
55 zval* fetch_var_arg(zval*, int*){};
56 template <> STDRET phc_setup_error<int, char const*, int, NULLT>(int, char const*, int, NULLT){};
57 zend_functionPC::operator int(){};
58 template <> zend_functionPS::operator zval***(){};
59 template <> zend_functionR::operator zval**(){};
60 template <> zend_functionPS::zend_functionPS(zval** ){};
61 zend_functionPC::zend_functionPC(int){};
62 template <> zend_functionR::zend_functionR(zval** const){};
65 template <> STDRETT<int> zend_call_function(zend_fcall_info *,_zend_fcall_info_cache *)
69 template <> STDRETT<int>::operator int()
75 // NULLT::operator int() const{};
76 template <> zend_functionPS::zend_functionPS(zval***){};
78 template <> STDRET phc_setup_error<int, NULLT, int, NULLT>(int, NULLT, int, NULLT){};
79 assert::assert(){};
80 zend_functionCReturn::operator int(){};
81 template <> bool zvalT2::operator!=<NULLT>(NULLT){};
82 zvalR2 & zvalR2::operator=(int)
84 return *this;
86 template <> zvalC2& zvalC2::operator=<int>(int&){};
87 void write_var(zval**, zval*){};
89 zval::zval(zval const&){};
90 template <> STDRET concat_function<zval*, zval*, zval*>(zval*, zval*, zval*){};
91 zval::~zval(){};
92 zend_bool::zend_bool(int){};
93 template <> STDRET initialize_method_call<zend_fcall_info*, _zend_fcall_info_cache*, zval**, char const*, char const*, int>(zend_fcall_info*, _zend_fcall_info_cache*, zval**, char const*, char const*, int){};
94 template <> STDRET ZVAL_LONG<zval*, int>(zval*, int){};
95 template <> STDRET Z_TYPE_P<zval>(zval*){};
96 zval* read_string_index(zval*, zval*){};
97 int check_array_index_type(zval*){};
98 void read_array(zval**, zval*, zval*){};
99 void overwrite_lhs(zval*, zval*){};
100 zval * zvp_clone_ex(zval*){};
101 template <> zend_arg_infoR::zend_arg_infoR(zend_arg_infoR&){};
102 template <> STDRET ZVAL_BOOL/*<zval*, zend_arg_infoR>*/(zval*, zend_arg_infoR){};
103 template <> zend_functionCPass::zend_functionCPass/*<zend_functionCPass>*/(zend_functionCPass&){};
104 template <> STDRET ZVAL_BOOL/*<zval*, zend_functionCPass>*/(zval*, zend_functionCPass){};
105 template <> STDRET zend_is_true/*<zval>*/(zval*){};
106 template <> STDRET::operator zend_bool/*<zend_bool>*/(){};
107 zend_bool::operator int(){};
108 void check_array_type(zval**){};
109 zval** get_ht_entry(zval**, zval*){};
110 template <> STDRET ZVAL_BOOL/*<zval*, int>*/(zval*, int){};
111 template <> STDRET is_not_identical_function/*<zval*, zval*, zval*>*/(zval*, zval*, zval*){};
112 template <> bool zvalT2::operator!=/*<int>*/(int){};
113 template <> STDRET convert_to_array/*<zval>*/(zval*){};
114 zval** push_and_index_ht(zval**){};
115 template <> zend_functionPS::zend_functionPS/*<zval** [3]>*/(zval** (&) [3]){};
116 template <> STDRET Z_TYPE_PP/*<zval*>*/(zval**){};
117 template <> STDRET Z_STRLEN_PP/*<zval*>*/(zval**){};
118 bool STDRET::operator>(int){};
119 void write_string_index(zval**, zval*, zval*){};
120 template <> STDRET is_not_equal_function/*<zval*, zval*, zval*>*/(zval*, zval*, zval*){};
121 template <> zend_functionPS::zend_functionPS/*<zval** [0]>*/(zval** (&) [0]){};
122 int isset_array(zval**, zval*){};
123 template <> STDRET is_equal_function<zval*, zval*, zval*>(zval*, zval*, zval*){};
124 template <> STDRET convert_to_boolean<zval>(zval*){};
125 //template <> zend_functionPS::zend_functionPS/*<zval** [4]>*/(zval** ){};
126 template <> return_valueV& return_valueV::operator=<zvalV2>(zvalV2&){};
127 template <> return_valueV& return_valueT::operator=<zvalT2>(zvalT2&){};
128 template <> STDRET zval_copy_ctor<return_valueT2>(return_valueT2*){};
129 //NULLT::NULLT(){};
130 NULLT2::NULLT2(){};
131 symbol_tableT::symbol_tableT(){};
132 class_table_t::class_table_t(){};
133 function_table_t::function_table_t(){};
134 zend_fcall_infoB::zend_fcall_infoB(){};
135 zend_functionPC::zend_functionPC(){};
136 zend_functionPS::zend_functionPS(){};
137 zend_functionR::zend_functionR(){};
139 //void __ZNK5NULLTcvPT_I4zvalEEv{};
140 template <> symbol_tableT * SmartRet<symbol_tableT>::operator&(){};
141 zval** fetch_var_arg_by_ref(zval**){};
142 //void __ZNK5NULLTcvPT_I13zend_functionEEv{};
143 //void __ZNK5NULLTcvPT_I16zend_class_entryEEv{};
144 //void __ZNK5NULLTcvPT_IP4zvalEEv{};
145 zval::zval(){};
146 //void _WinMain@16{};
149 void MyThrowImp(zval* vakz)
151 // TODO
153 void * MyTypeOf(void * Variable)
157 void * MyInstanceof(void * Instance,void * Class)
161 void * MyVariable(void * Variable)
164 void * MyArray_next(void * Variable)
167 void * MyMIRClassName(void * Name=0)
171 void * MyStringImp(void * Name)
175 void MyStaticImp(zval* vakz)
177 // TODO
180 NULLT2 uninitialized_zval_ptr;
181 symbol_tableT symbol_table;
182 int saved_refcount;
183 return_valueT2 * return_value;
187 * Formats wiki links and media links in text; all other wiki formatting
188 * is ignored
190 * @fixme doesn't handle sub-links as in image thumb texts like the main parser
191 * @param string $comment Text to format links in
192 * @return string
194 public function formatLinksInComment( $comment ) {
195 return preg_replace_callback(
196 '/\[\[:?(.*?)(\|(.*?))*\]\]([^[]*)/',
197 array( $this, 'formatLinksInCommentCallback' ),
198 $comment );
202 void Linkerformatlinksincommentcallback ();
204 int main(int argc, char ** argv)
207 Linkerformatlinksincommentcallback();
213 function specific code...
217 template <>
218 STDRET initialize_function_call
220 <zend_fcall_infoT
221 <mwnamespace_getcanonicalname>
222 *, _zend_fcall_info_cache*, char cons
223 t*, char const*, int>
226 zend_fcall_infoT<mwnamespace_getcanonicalname>*,
227 _zend_fcall_info_cache*,
228 char const*,
229 char const*
230 , int){
235 for assigning the parameters that were saved.
236 template <>
237 zend_functionPST<mwnamespace_getcanonicalname> &
238 zend_functionPST<mwnamespace_getcanonicalname>::operator=(zval***)
244 set the return type
245 move back into header
246 template <>
247 zend_functionRT<mwnamespace_getcanonicalname> &
248 zend_functionRT<mwnamespace_getcanonicalname>::operator=(const zvalPP & rVale)
254 template <>
255 STDRETT<int> zend_call_function
256 //<zend_fcall_infoT<mwnamespace_getcanonicalname>, _zend_fcall_info_cache>
257 (zend_fcall_infoT<mwnamespace_getcanonicalname>*,
258 _zend_fcall_info_cache*)
264 /////
266 zvalP::operator zval*(){};
267 zvalPP::zvalPP(zval**){};
268 void sep_copy_on_write(zvalPP){};
269 void copy_into_ref(zvalPP, zvalPP){};
270 zvalP::zvalP(zval*){};
271 void overwrite_lhs_no_copy(zvalP, zvalP){};
272 zvalPP fetch_var_arg_by_ref(zvalPP){};
273 zvalPP::operator zval**(){};
274 int in_copy_on_write(zvalP){};
275 zvalP fetch_var_arg(zvalP, int*){};
276 void write_var(zvalPP, zvalP){};
277 zvalP read_string_index(zvalP, zvalP){};
278 int check_array_index_type(zvalP){};
279 void read_array(zvalPP, zvalP, zvalP){};
280 void overwrite_lhs(zvalP, zvalP){};
281 zvalP zvp_clone_ex(zvalP){};
282 void check_array_type(zvalPP){};
283 zvalPP get_ht_entry(zvalPP, zvalP){};
284 zvalPP push_and_index_ht(zvalPP){};
285 void write_string_index(zvalPP, zvalP, zvalP){};
286 int isset_array(zvalPP, zvalP){};
288 template <> bool zvalP::operator!=(SmartRet<NULLT2>)
293 zval* zvalP::operator->(){};
295 template <class T> STDRET zval_ptr_dtor /*<zvalPReturn<mwnamespace_getcanonicalname> >*/
296 (zvalPReturn<mwnamespace_getcanonicalname>*){
299 zvalP::zvalP(){};
301 template <>
302 STDRET zval_ptr_dtor
303 /*<zvalPReturn<mwnamespace_getcanonicalname> >*/
304 (zvalPReturn<mwnamespace_getcanonicalname>*){};
307 template <>
308 void zvalPReturn<mwnamespace_getcanonicalname>::setReturnTypeDynamic
309 (zend_functionRT<mwnamespace_getcanonicalname>*) const{};
313 <zend_functionRT<mwnamespace_getcanonicalname>*
317 template<>
318 STDRET initialize_function_call
319 //<zend_fcall_infoT<mwnamespace_getcanonicalname>*, zend_fcall_info_cacheT<mwnamespace_getcanonicalname>*, char const*, char const*, int>
320 (zend_fcall_infoT<mwnamespace_getcanonicalname>*, zend_fcall_info_cacheT<mwnamespace_getcanonicalname>*, char const*, char const*, int){};
322 template<>
323 STDRETT<int> zend_call_function
324 //<zend_fcall_infoT<mwnamespace_getcanonicalname>, zend_fcall_info_cacheT<mwnamespace_getcanonicalname> >
325 (zend_fcall_infoT<mwnamespace_getcanonicalname>*, zend_fcall_info_cacheT<mwnamespace_getcanonicalname>*){};
327 zend_bool::zend_bool(){};
331 /// new functions
332 template <>
333 zend_functionPS::operator
334 //zvalParamsT<mwnamespace_getcanonicalname><
335 zvalParamsT<mwnamespace_getcanonicalname>
337 (){}
342 template <> zend_functionPST<mwnamespace_getcanonicalname>&
343 zend_functionPST<mwnamespace_getcanonicalname>::operator=
345 (zval***){};
347 //<Zvalx***>
349 // the new template parameter
351 template <> zend_functionPST<mwnamespace_getcanonicalname>&
352 zend_functionPST<mwnamespace_getcanonicalname>::operator=
353 //<zvalParamsT<mwnamespace_getcanonicalname> >
354 (zvalParamsT<mwnamespace_getcanonicalname>){};
359 /*<zend_functionRT
360 <mwnamespace_getcanonicalname>*>
364 template <>
365 void zvalPReturn<mwnamespace_getcanonicalname>
366 ::setReturnTypeDynamic(zend_functionRT<mwnamespace_getcanonicalname>*) const
367 {}*/
368 //template <> zval* MakeNullPtr(){};
370 //template <>zval* MakeNullPtr<zval>(){}
373 //zend_functionPST<mwnamespace_getcanonicalname>& zend_functionPST<mwnamespace_getcanonicalname>::operator=<zval***>(zval***)'
375 /*template <>
376 zend_functionPST<mwnamespace_getcanonicalname>&
377 zend_functionPST<mwnamespace_getcanonicalname>::operator=
378 //<zvalParamsT<mwnamespace_getcanonicalname> >
379 (zvalParamsT<mwnamespace_getcanonicalname>)
384 //operator=<zvalParamsT<mwnamespace_getcanonicalname> >
386 zend_functionPST<mwnamespace_getcanonicalname>&
387 zend_functionPST<mwnamespace_getcanonicalname>::operator=(
388 zvalParamsT<mwnamespace_getcanonicalname>
395 //zend_function* MakeNullPtr<zend_function>()
396 //zend_class_entry* MakeNullPtr<zend_class_entry>()'
397 //zval** MakeNullPtrPtr<zval>()
398 //zval* MakeNullPtr<zval>()'
401 //template <> zend_function* MakeNullPtr<zend_function>(){}
402 ///template <> zend_function* MakeNullPtr<zend_function>()'
404 //template <> zend_function* MakeNullPtr(){};
405 //template <> zend_class_entry* MakeNullPtr(){};
406 //template <> zval** MakeNullPtrPtr(){};
409 template <>
410 void DoAssign
411 //<zend_functionPST<mwnamespace_getcanonicalname>, zval***>
412 (zend_functionPST<mwnamespace_getcanonicalname>, zval***)
417 //zend_function* MakeNullPtr<zend_function*>()
419 //template <> zend_function* MakeNullPtr(){}
421 void DoAssign
422 //<zend_functionPST<mwnamespace_getcanonicalname>,
423 //zvalParamsT<mwnamespace_getcanonicalname> >
425 zend_functionPST<mwnamespace_getcanonicalname>,
426 zvalParamsT<mwnamespace_getcanonicalname>
432 template <>
433 void DoAssign
434 //<zend_functionPST<mwnamespace_getcanonicalname>,
435 //zvalParamsT<mwnamespace_getcanonicalname> >
437 zend_functionPST<mwnamespace_getcanonicalname>,
438 zvalParamsT<mwnamespace_getcanonicalname>