PageRenderTime 57ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/bindings/php/generator/arg_types.php

https://code.google.com/p/oscats/
PHP | 1174 lines | 824 code | 112 blank | 238 comment | 147 complexity | 57bb5f2ec169278b91c824bfaa2996bf MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, LGPL-2.1
  1. <?php
  2. /*
  3. * PHP-GTK - The PHP language bindings for GTK+
  4. *
  5. * Copyright (C) 2001-2008 Andrei Zmievski <andrei@php.net>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. /* $Id: arg_types.php,v 1.88 2008/02/29 19:05:53 andrei Exp $ */
  22. /*======================================================================*\
  23. Function: convert_typename
  24. Purpose: Converts a typename to the uppercased and underscored
  25. version used for type conversion macros and enum/flag
  26. names.
  27. \*======================================================================*/
  28. function convert_typename($typename)
  29. {
  30. preg_match_all('![A-Z]+[^A-Z]*!', $typename, $match);
  31. return '_' . strtoupper(implode('_', $match[0]));
  32. }
  33. /*======================================================================*\
  34. Function: enum_name
  35. Purpose: Creates a GTK_TYPE_* name from the given typename
  36. \*======================================================================*/
  37. function enum_name($typename)
  38. {
  39. $proper = convert_typename($typename);
  40. if (strlen($proper) > 4 && substr($proper, 0, 4) == '_GTK')
  41. return 'GTK_TYPE' . substr($proper, 4);
  42. else
  43. return 'GTK_TYPE' . $proper;
  44. }
  45. /*======================================================================*\
  46. Class: Var_List
  47. Purpose: Format C variable list
  48. \*======================================================================*/
  49. class Var_List {
  50. var $vars = array();
  51. function add($c_type, $name)
  52. {
  53. $this->vars[$c_type][] = $name;
  54. }
  55. function __tostring()
  56. {
  57. $result = array();
  58. foreach (array_keys($this->vars) as $c_type)
  59. $result[] = "\t$c_type " . implode(', ', $this->vars[$c_type]) . ";\n";
  60. if (count($result)) {
  61. return implode('', $result);
  62. } else
  63. return '';
  64. }
  65. }
  66. class Wrapper_Info {
  67. var $var_list = array();
  68. var $arg_list = array();
  69. var $parse_list = array('');
  70. var $specifiers = '';
  71. var $pre_code = array();
  72. var $post_code = array();
  73. var $error_action = 'return';
  74. function __construct()
  75. {
  76. $this->var_list = new Var_List;
  77. }
  78. function add_parse_list($specifiers, $parse_args = array())
  79. {
  80. $this->specifiers .= $specifiers;
  81. $this->parse_list = array_merge($this->parse_list, (array)$parse_args);
  82. }
  83. function get_var_list()
  84. {
  85. return $this->var_list->__tostring();
  86. }
  87. function get_arg_list()
  88. {
  89. return implode(', ', $this->arg_list);
  90. }
  91. function get_parse_list()
  92. {
  93. return implode(', ', $this->parse_list);
  94. }
  95. function get_pre_code()
  96. {
  97. return implode('', $this->pre_code);
  98. }
  99. function get_post_code()
  100. {
  101. return implode('', $this->post_code);
  102. }
  103. }
  104. /*======================================================================*\
  105. Class: Arg_Type
  106. Purpose: Base class for argument type handlers
  107. \*======================================================================*/
  108. class Arg_Type {
  109. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  110. {
  111. throw new Exception("write_param() not implemented for " . get_class($this));
  112. }
  113. function write_return($type, $owns_return, $info)
  114. {
  115. throw new Exception("write_return() not implemented for " . get_class($this));
  116. }
  117. /*
  118. function write_to_prop($obj, $name, $source)
  119. {
  120. trigger_error("This is an abstract class", E_USER_ERROR);
  121. }
  122. function write_from_prop($name, $type)
  123. {
  124. trigger_error("This is an abstract class", E_USER_ERROR);
  125. }
  126. */
  127. }
  128. /* {{{ None_Arg */
  129. class None_Arg extends Arg_Type {
  130. function write_return($type, $owns_return, $info)
  131. {
  132. $this->post_code[] = "\tRETVAL_NULL();";
  133. }
  134. }
  135. /* }}} */
  136. /* {{{ String_Arg */
  137. class String_Arg extends Arg_Type {
  138. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  139. {
  140. if (isset($default)) {
  141. if ($default != 'NULL')
  142. $default = '"' . $default . '"';
  143. $info->var_list->add('char', '*' . $name . ' = ' . $default);
  144. } else
  145. $info->var_list->add('char', '*' . $name);
  146. $info->var_list->add('zend_bool', 'free_' . $name . ' = FALSE');
  147. $info->add_parse_list('u', array("&$name", "&free_$name"));
  148. $info->arg_list[] = $name;
  149. $info->post_code[] = "\tif (free_$name) g_free($name);\n";
  150. }
  151. function write_return($type, $owns_return, $info)
  152. {
  153. if ($owns_return) {
  154. $info->var_list->add('gchar', '*php_retval');
  155. $info->var_list->add('gchar', '*cp_ret');
  156. $info->var_list->add('gsize', 'cp_len');
  157. $info->var_list->add('zend_bool', 'free_result');
  158. $info->post_code[] =
  159. " if (php_retval) {\n" .
  160. " cp_ret = phpg_from_utf8(php_retval, strlen(php_retval), &cp_len, &free_result TSRMLS_CC);\n" .
  161. " if (cp_ret) {\n" .
  162. " RETVAL_STRINGL((char *)cp_ret, cp_len, 1);\n" .
  163. " } else {\n" .
  164. " php_error(E_WARNING, \"%s::%s(): could not convert return value from UTF-8\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));\n" .
  165. " }\n" .
  166. " g_free(php_retval);\n" .
  167. " if (free_result)\n" .
  168. " g_free(cp_ret);\n" .
  169. " } else\n" .
  170. " RETVAL_NULL();";
  171. } else {
  172. $info->var_list->add('const gchar', '*php_retval');
  173. $info->var_list->add('gchar', '*cp_ret');
  174. $info->var_list->add('gsize', 'cp_len');
  175. $info->var_list->add('zend_bool', 'free_result');
  176. $info->post_code[] =
  177. " if (php_retval) {\n" .
  178. " cp_ret = phpg_from_utf8(php_retval, strlen(php_retval), &cp_len, &free_result TSRMLS_CC);\n" .
  179. " if (cp_ret) {\n" .
  180. " RETVAL_STRINGL((char *)cp_ret, cp_len, 1);\n" .
  181. " } else {\n" .
  182. " php_error(E_WARNING, \"%s::%s(): could not convert return value from UTF-8\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));\n" .
  183. " }\n" .
  184. " if (free_result)\n" .
  185. " g_free(cp_ret);\n" .
  186. " } else {\n" .
  187. " RETVAL_NULL();\n" .
  188. " }";
  189. }
  190. }
  191. }
  192. /* }}} */
  193. /* {{{ Char_Arg */
  194. class Char_Arg extends Arg_Type {
  195. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  196. {
  197. if (isset($default))
  198. $info->var_list->add('char', $name . ' = \'' . $default . '\'');
  199. else
  200. $info->var_list->add('char', $name);
  201. $info->arg_list[] = $name;
  202. $info->add_parse_list('c', '&' . $name);
  203. }
  204. function write_return($type, $owns_return, $info)
  205. {
  206. $info->var_list->add('gchar', 'php_retval');
  207. $info->post_code[] = "\tRETVAL_STRINGL((char*)&ret, 1, 1);";
  208. }
  209. }
  210. /* }}} */
  211. /* {{{ Int_Arg */
  212. class Int_Arg extends Arg_Type {
  213. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  214. {
  215. if (isset($default))
  216. $info->var_list->add('long', $name . ' = ' . $default);
  217. else
  218. $info->var_list->add('long', $name);
  219. $info->arg_list[] = "($type)$name";
  220. $info->add_parse_list('i', '&' . $name);
  221. }
  222. function write_return($type, $owns_return, $info)
  223. {
  224. $info->var_list->add('long', 'php_retval');
  225. $info->post_code[] = "\tRETVAL_LONG(php_retval);";
  226. }
  227. function write_to_prop($obj, $name, $source)
  228. {
  229. return " add_property_long($obj, \"$name\", $source);\n";
  230. }
  231. function write_from_prop($name, $type)
  232. {
  233. return " if (zend_hash_find(Z_OBJPROP_P(wrapper), \"$name\", sizeof(\"$name\"), (void **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_LONG)\n" .
  234. " obj->$name = ($type)Z_LVAL_PP(item);\n" .
  235. " else\n" .
  236. " return 0;\n\n";
  237. }
  238. }
  239. /* }}} */
  240. /* {{{ Bool_Arg */
  241. class Bool_Arg extends Arg_Type {
  242. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  243. {
  244. if (isset($default))
  245. $info->var_list->add('zend_bool', $name . ' = ' . $default);
  246. else
  247. $info->var_list->add('zend_bool', $name);
  248. $info->arg_list[] = "($type)$name";
  249. $info->add_parse_list('b', '&' . $name);
  250. }
  251. function write_return($type, $owns_return, $info)
  252. {
  253. $info->var_list->add('gboolean', 'php_retval');
  254. $info->post_code[] = "\tRETVAL_BOOL(php_retval);";
  255. }
  256. function write_to_prop($obj, $name, $source)
  257. {
  258. return " add_property_bool($obj, \"$name\", $source);\n";
  259. }
  260. function write_from_prop($name, $type)
  261. {
  262. return " if (zend_hash_find(Z_OBJPROP_P(wrapper), \"$name\", sizeof(\"$name\"), (void **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_BOOL)\n" .
  263. " obj->$name = ($type)Z_BVAL_PP(item);\n" .
  264. " else\n" .
  265. " return 0;\n\n";
  266. }
  267. }
  268. /* }}} */
  269. /* {{{ Double_Arg */
  270. class Double_Arg extends Arg_Type {
  271. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  272. {
  273. if (isset($default))
  274. $info->var_list->add('double', $name . ' = ' . $default);
  275. else
  276. $info->var_list->add('double', $name);
  277. $info->add_parse_list('d', '&' . $name);
  278. if($type == 'gfloat')
  279. $info->arg_list[] = "(float)$name";
  280. else
  281. $info->arg_list[] = $name;
  282. }
  283. function write_return($type, $owns_return, $info)
  284. {
  285. $info->var_list->add('double', 'php_retval');
  286. $info->post_code[] = "\tRETVAL_DOUBLE(php_retval);";
  287. }
  288. function write_to_prop($obj, $name, $source)
  289. {
  290. return " add_property_double($obj, \"$name\", $source);\n";
  291. }
  292. function write_from_prop($name, $type)
  293. {
  294. return " if (zend_hash_find(Z_OBJPROP_P(wrapper), \"$name\", sizeof(\"$name\"), (void **)&item) == SUCCESS && Z_TYPE_PP(item) == IS_DOUBLE)\n" .
  295. " obj->$name = ($type)Z_DVAL_PP(item);\n" .
  296. " else\n" .
  297. " return 0;\n\n";
  298. }
  299. }
  300. /* }}} */
  301. /* {{{ Enum_Arg */
  302. class Enum_Arg extends Arg_Type {
  303. static $enum_tpl = "\n\tif (php_%(name) && phpg_gvalue_get_enum(%(typecode), php_%(name), (gint *)&%(name)) == FAILURE) {\n\t\t%(on_error);\n\t}\n";
  304. var $enum_name = null;
  305. var $typecode = null;
  306. function __construct($enum_name, $typecode)
  307. {
  308. $this->enum_name = $enum_name;
  309. $this->typecode = $typecode;
  310. }
  311. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  312. {
  313. if (isset($default))
  314. $info->var_list->add($this->enum_name, $name . ' = ' . $default);
  315. else
  316. $info->var_list->add($this->enum_name, $name);
  317. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  318. $info->arg_list[] = $name;
  319. $info->add_parse_list('V', '&php_' . $name);
  320. $info->pre_code[] = aprintf(self::$enum_tpl,
  321. array('typecode' => $this->typecode,
  322. 'name' => $name,
  323. 'on_error' => $info->error_action));
  324. }
  325. function write_return($type, $owns_return, $info)
  326. {
  327. $info->var_list->add('long', 'php_retval');
  328. $info->post_code[] = "\tRETVAL_LONG(php_retval);";
  329. }
  330. }
  331. /* }}} */
  332. /* {{{ Flags_Arg */
  333. class Flags_Arg extends Arg_Type {
  334. static $flag_tpl = "\n\tif (php_%(name) && phpg_gvalue_get_flags(%(typecode), php_%(name), (gint *)&%(name)) == FAILURE) {\n\t\t%(on_error);\n\t}\n";
  335. var $flag_name = null;
  336. var $typecode = null;
  337. function __construct($flag_name, $typecode)
  338. {
  339. $this->flag_name = $flag_name;
  340. $this->typecode = $typecode;
  341. }
  342. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  343. {
  344. if (isset($default))
  345. $info->var_list->add($this->flag_name, $name . ' = ' . $default);
  346. else
  347. $info->var_list->add($this->flag_name, $name);
  348. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  349. $info->arg_list[] = $name;
  350. $info->add_parse_list('V', '&php_' . $name);
  351. $info->pre_code[] = aprintf(self::$flag_tpl, array('typecode' => $this->typecode,
  352. 'name' => $name,
  353. 'on_error' => $info->error_action));
  354. }
  355. function write_return($type, $owns_return, $info)
  356. {
  357. $info->var_list->add('long', 'php_retval');
  358. $info->post_code[] = "\tRETVAL_LONG(php_retval);";
  359. }
  360. }
  361. /* }}} */
  362. /* {{{ Struct_Arg */
  363. class Struct_Arg extends Arg_Type {
  364. var $struct_name = null;
  365. function __construct($struct_name)
  366. {
  367. $this->struct_name = $struct_name;
  368. $this->struct_tpl = " if (!php_%s_get(php_%s, &%s)) {\n" .
  369. " %sreturn;\n" .
  370. " }\n\n";
  371. $this->struct_def_tpl = " if (php_%s && !php_%s_get(php_%s, &%s)) {\n" .
  372. " %sreturn;\n" .
  373. " }\n\n";
  374. }
  375. /*
  376. function write_param($type, $name, $default, $null_ok, &$var_list,
  377. &$parse_list, &$arg_list, &$extra_pre_code, &$extra_post_code, $in_constructor)
  378. {
  379. $typename = strtolower(substr(convert_typename($this->struct_name), 1));
  380. $var_list->add($this->struct_name, $name);
  381. $parse_list[] = '&php_' . $name . ', ' . $typename . '_ce';
  382. if (isset($default) && $default == 'NULL') {
  383. $var_list->add('zval', '*php_' . $name . ' = NULL');
  384. $arg_list[] = '(php_' . $name . ' ? &'. $name . ' : NULL)';
  385. $extra_pre_code[] = sprintf($this->struct_def_tpl, $name, $typename, $name, $name,
  386. $in_constructor ? "php_gtk_invalidate(this_ptr);\n\t\t" : "");
  387. } else {
  388. $var_list->add('zval', '*php_' . $name);
  389. $arg_list[] = '&' . $name;
  390. $extra_pre_code[] = sprintf($this->struct_tpl, $typename, $name, $name,
  391. $in_constructor ? "php_gtk_invalidate(this_ptr);\n\t\t" : "");
  392. }
  393. return 'O';
  394. }
  395. function write_return($type, &$var_list, $separate)
  396. {
  397. $typename = strtolower(substr(convert_typename($this->struct_name), 1));
  398. return " *return_value = *php_{$typename}_new(" . ((substr($type, -1) != '*') ? '&' : '') . "%s);\n" .
  399. " return;";
  400. }
  401. */
  402. }
  403. /* }}} */
  404. /* {{{ Pointer_Arg */
  405. class Pointer_Arg extends Arg_Type {
  406. const check_tpl = "
  407. if (phpg_gpointer_check(php_%(name), %(typecode), FALSE TSRMLS_CC)) {
  408. %(name) = (%(type) *) PHPG_GPOINTER(php_%(name));
  409. } else {
  410. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid %(type) object\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  411. %(on_error);
  412. }\n";
  413. const check_null_tpl = "
  414. if (Z_TYPE_P(php_%(name)) != IS_NULL) {
  415. if (phpg_gpointer_check(php_%(name), %(typecode), FALSE TSRMLS_CC)) {
  416. %(name) = (%(type) *) PHPG_GPOINTER(php_%(name));
  417. } else {
  418. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid %(type) object or null\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  419. %(on_error);
  420. }
  421. }\n";
  422. var $type = null;
  423. var $typecode = null;
  424. function __construct($type, $typecode)
  425. {
  426. $this->type = $type;
  427. $this->typecode = $typecode;
  428. }
  429. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  430. {
  431. if ($null_ok) {
  432. $info->var_list->add($this->type, '*' . $name . ' = NULL');
  433. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  434. $info->pre_code[] = aprintf(self::check_null_tpl, array('typecode' => $this->typecode,
  435. 'type' => $this->type,
  436. 'on_error' => $info->error_action,
  437. 'name' => $name));
  438. } else {
  439. $info->var_list->add($this->type, '*' . $name . ' = NULL');
  440. $info->var_list->add('zval', '*php_' . $name);
  441. $info->pre_code[] = aprintf(self::check_tpl, array('typecode' => $this->typecode,
  442. 'type' => $this->type,
  443. 'on_error' => $info->error_action,
  444. 'name' => $name));
  445. }
  446. $info->add_parse_list('O', array('&php_' . $name, 'gpointer_ce'));
  447. $info->arg_list[] = $name;
  448. }
  449. function write_return($type, $owns_return, $info)
  450. {
  451. if (substr($type, -1) == '*') {
  452. $info->var_list->add($this->type, '*php_retval');
  453. $ret = 'php_retval';
  454. } else {
  455. $info->var_list->add($this->type, 'php_retval');
  456. $ret = '&php_retval';
  457. }
  458. $info->post_code[] = sprintf("\tphpg_gpointer_new(&return_value, %s, %s TSRMLS_CC);\n",
  459. $this->typecode, $ret);
  460. }
  461. }
  462. /* }}} */
  463. /* {{{ Object_Arg */
  464. class Object_Arg extends Arg_Type {
  465. var $obj_name = null;
  466. var $cast = null;
  467. var $obj_ce = null;
  468. //var $getter = null;
  469. //var $gtk_object_descendant;
  470. function __construct($obj_name, $typecode)
  471. {
  472. $this->obj_name = $obj_name;
  473. $this->obj_ce = strtolower($obj_name) . '_ce';
  474. $this->cast = preg_replace('!_TYPE_!', '_', $typecode, 1);
  475. /*
  476. if ($gtk_object_descendant) {
  477. $this->getter = $this->typename . "(PHP_GTK_GET(%s))";
  478. } else {
  479. $this->getter = "PHP_" . $this->typename . "_GET(%s)";
  480. }
  481. */
  482. //$this->gtk_object_descendant = $gtk_object_descendant;
  483. }
  484. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  485. {
  486. if ($null_ok) {
  487. if (isset($default)) {
  488. $info->var_list->add($this->obj_name, '*' . $name . ' = ' . $default);
  489. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  490. $info->pre_code[] = " if (php_$name) {\n" .
  491. " if (Z_TYPE_P(php_$name) == IS_NULL)\n" .
  492. " $name = NULL;\n" .
  493. " else\n" .
  494. " $name = $this->cast(PHPG_GOBJECT(php_$name));\n" .
  495. " }\n";
  496. } else {
  497. $info->var_list->add($this->obj_name, '*' . $name . ' = NULL');
  498. $info->var_list->add('zval', '*php_' . $name);
  499. $info->pre_code[] = " if (Z_TYPE_P(php_$name) != IS_NULL)\n" .
  500. " $name = $this->cast(PHPG_GOBJECT(php_$name));\n";
  501. }
  502. $info->add_parse_list('N', array('&php_' . $name, $this->obj_ce));
  503. $info->arg_list[] = $name;
  504. } else {
  505. if (isset($default)) {
  506. $info->var_list->add($this->obj_name, '*' . $name . ' = ' . $default);
  507. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  508. $info->add_parse_list('O', array('&php_' . $name, $this->obj_ce));
  509. $info->arg_list[] = $name;
  510. $info->pre_code[] = " if (php_$name)\n" .
  511. " $name = $this->cast(PHPG_GOBJECT(php_$name));\n";
  512. } else {
  513. $info->var_list->add('zval', '*' . $name);
  514. $info->add_parse_list('O', array('&' . $name, $this->obj_ce));
  515. $info->arg_list[] = "$this->cast(PHPG_GOBJECT($name))";
  516. }
  517. }
  518. }
  519. function write_return($type, $owns_return, $info)
  520. {
  521. $info->var_list->add(str_replace('const-', 'const ', $type), 'php_retval');
  522. if ($owns_return) {
  523. $info->post_code[] = " phpg_gobject_new(&return_value, (GObject *)php_retval TSRMLS_CC);\n" .
  524. " if (php_retval != NULL) {\n" .
  525. " g_object_unref(php_retval);\n" .
  526. " }";
  527. } else {
  528. $info->post_code[] = " phpg_gobject_new(&return_value, (GObject *)php_retval TSRMLS_CC);";
  529. }
  530. }
  531. }
  532. /* }}} */
  533. /* {{{ Boxed_Arg */
  534. class Boxed_Arg extends Arg_Type {
  535. const check_tpl = "
  536. if (phpg_gboxed_check(php_%(name), %(typecode), FALSE TSRMLS_CC)) {
  537. %(name) = (%(typename) *) PHPG_GBOXED(php_%(name));
  538. } else {
  539. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid %(typename) object\",
  540. get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  541. %(on_error);
  542. }\n";
  543. const check_default_tpl = "
  544. if (php_%(name)) {
  545. if (phpg_gboxed_check(php_%(name), %(typecode), FALSE TSRMLS_CC)) {
  546. %(name) = (%(typename) *) PHPG_GBOXED(php_%(name));
  547. } else {
  548. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid %(typename) object\",
  549. get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  550. %(on_error);
  551. }
  552. }\n";
  553. const check_null_tpl = "
  554. if (Z_TYPE_P(php_%(name)) != IS_NULL) {
  555. if (phpg_gboxed_check(php_%(name), %(typecode), FALSE TSRMLS_CC)) {
  556. %(name) = (%(typename) *) PHPG_GBOXED(php_%(name));
  557. } else {
  558. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid %(typename) object or null\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  559. %(on_error);
  560. }
  561. }\n";
  562. const check_null_default_tpl = "
  563. if (php_%(name)) {
  564. if (Z_TYPE_P(php_%(name)) == IS_NULL) {
  565. %(name) = NULL;
  566. } else {
  567. if (phpg_gboxed_check(php_%(name), %(typecode), FALSE TSRMLS_CC)) {
  568. %(name) = (%(typename) *) PHPG_GBOXED(php_%(name));
  569. } else {
  570. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid %(typename) object or null\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  571. %(on_error);
  572. }
  573. }
  574. }\n";
  575. var $boxed_type = null;
  576. var $typecode = null;
  577. function Boxed_Arg($boxed_type, $typecode)
  578. {
  579. $this->boxed_type = $boxed_type;
  580. $this->typecode = $typecode;
  581. }
  582. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  583. {
  584. if ($null_ok) {
  585. if (isset($default)) {
  586. $info->var_list->add($this->boxed_type, '*' . $name . ' = ' . $default);
  587. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  588. $info->pre_code[] = aprintf(self::check_null_default_tpl, array('typecode' => $this->typecode,
  589. 'typename' => $this->boxed_type,
  590. 'on_error' => $info->error_action,
  591. 'name' => $name));
  592. } else {
  593. $info->var_list->add($this->boxed_type, '*' . $name . ' = NULL');
  594. $info->var_list->add('zval', '*php_' . $name);
  595. $info->pre_code[] = aprintf(self::check_null_tpl, array('typecode' => $this->typecode,
  596. 'typename' => $this->boxed_type,
  597. 'on_error' => $info->error_action,
  598. 'name' => $name));
  599. }
  600. $info->add_parse_list('N', array('&php_' . $name, 'gboxed_ce'));
  601. } else {
  602. if (isset($default)) {
  603. $info->var_list->add($this->boxed_type, '*' . $name . ' = ' . $default);
  604. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  605. $info->pre_code[] = aprintf(self::check_default_tpl, array('typecode' => $this->typecode,
  606. 'typename' => $this->boxed_type,
  607. 'on_error' => $info->error_action,
  608. 'name' => $name));
  609. } else {
  610. $info->var_list->add($this->boxed_type, '*' . $name . ' = NULL');
  611. $info->var_list->add('zval', '*php_' . $name);
  612. $info->pre_code[] = aprintf(self::check_tpl, array('typecode' => $this->typecode,
  613. 'typename' => $this->boxed_type,
  614. 'on_error' => $info->error_action,
  615. 'name' => $name));
  616. }
  617. $info->add_parse_list('O', array('&php_' . $name, 'gboxed_ce'));
  618. }
  619. $typename = preg_replace('!^(const-)?([^*]+)(\*)?$!', '$2', $type);
  620. if ($typename != $this->boxed_type) {
  621. $info->arg_list[] = '(' . substr($type, 0, -1) . ' *)' . $name;
  622. } else {
  623. $info->arg_list[] = $name;
  624. }
  625. }
  626. function write_return($type, $owns_return, $info)
  627. {
  628. if (substr($type, -1) == '*') {
  629. $info->var_list->add($this->boxed_type, '*php_retval');
  630. $ret = 'php_retval';
  631. } else {
  632. $info->var_list->add($this->boxed_type, 'php_retval');
  633. $ret = '&php_retval';
  634. /* can't own reference to a local var */
  635. $owns_return = false;
  636. }
  637. $info->post_code[] = sprintf("\tphpg_gboxed_new(&return_value, %s, %s, %s, TRUE TSRMLS_CC);\n",
  638. $this->typecode, $ret, $owns_return ? 'FALSE' : 'TRUE');
  639. }
  640. }
  641. /* }}} */
  642. /* {{{ Atom_Arg */
  643. class Atom_Arg extends Int_Arg {
  644. const atom_tpl = "
  645. %(name) = phpg_gdkatom_from_zval(php_%(name) TSRMLS_CC);
  646. if (%(name) == NULL) {
  647. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid GdkAtom object\",
  648. get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  649. %(on_error);
  650. }\n";
  651. const atom_default_tpl = "
  652. if (php_%(name)) {
  653. %(name) = phpg_gdkatom_from_zval(php_%(name) TSRMLS_CC);
  654. if (%(name) == NULL) {
  655. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a valid GdkAtom object\",
  656. get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  657. %(on_error);
  658. }
  659. }\n";
  660. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  661. {
  662. if (isset($default)) {
  663. $info->var_list->add('GdkAtom', $name . ' = ' . $default);
  664. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  665. $info->pre_code[] = aprintf(self::atom_default_tpl, array('name' => $name,
  666. 'on_error' => $info->error_action));
  667. } else {
  668. $info->var_list->add('GdkAtom', $name);
  669. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  670. $info->pre_code[] = aprintf(self::atom_tpl, array('name' => $name,
  671. 'on_error' => $info->error_action));
  672. }
  673. $info->arg_list[] = $name;
  674. $info->add_parse_list('V', '&php_' . $name);
  675. }
  676. function write_return($type, $owns_return, $info)
  677. {
  678. $info->var_list->add('GdkAtom', 'php_retval');
  679. $info->post_code[] = "\tphpg_gdkatom_new(&return_value, php_retval TSRMLS_CC);";
  680. }
  681. }
  682. /* }}} */
  683. /* {{{ Drawable_Arg */
  684. /* This is a hack -- the $default handling doesn't work, neither does
  685. write_return(). */
  686. class Drawable_Arg extends Arg_Type {
  687. var $type = 'GdkDrawable';
  688. /*
  689. function write_param($type, $name, $default, $null_ok, &$var_list,
  690. &$parse_list, &$arg_list, &$extra_code, $in_constructor)
  691. {
  692. if ($null_ok) {
  693. if (isset($default)) {
  694. $var_list->add($this->type, '*' . $name . ' = ' . $default);
  695. $var_list->add('zval', '*php_' . $name . ' = NULL');
  696. $extra_code[] = " if (php_$name) {\n" .
  697. " if (Z_TYPE_P(php_$name) == IS_NULL)\n" .
  698. " $name = NULL;\n" .
  699. " else if (php_gtk_check_class(php_$name, gdk_window_ce))\n" .
  700. " $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name);\n" .
  701. " else if(php_gtk_check_class(php_$name, gdk_pixmap_ce))\n" .
  702. " $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name);\n" .
  703. " else if(php_gtk_check_class(php_$name, gdk_bitmap_ce))\n" .
  704. " $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name);\n" .
  705. " }\n";
  706. } else {
  707. $var_list->add($this->type, '*' . $name);
  708. $var_list->add('zval', '*php_' . $name);
  709. $extra_code[] =
  710. " if (Z_TYPE_P(php_$name) == IS_NULL)
  711. $name = NULL;
  712. if (php_gtk_check_class(php_$name, gdk_window_ce))
  713. $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name);
  714. else if(php_gtk_check_class(php_$name, gdk_pixmap_ce))
  715. $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name);
  716. else if(php_gtk_check_class(php_$name, gdk_bitmap_ce))
  717. $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name);
  718. else {
  719. php_error(E_WARNING, \"%s() expects the drawable to be GdkWindow, GdkPixmap, GdkBitmap, or null\", get_active_function_name(TSRMLS_C));
  720. return;
  721. }
  722. ";
  723. }
  724. $parse_list[] = '&php_' . $name;
  725. $arg_list[] = $name;
  726. return 'V';
  727. } else {
  728. if (isset($default)) {
  729. $var_list->add($this->type, '*' . $name . ' = ' . $default);
  730. $var_list->add('zval', '*php_' . $name . ' = NULL');
  731. $parse_list[] = '&php_' . $name;
  732. $parse_list[] = $this->php_type . '_ce';
  733. $arg_list[] = $name;
  734. $extra_code[] = " if (php_$name)\n" .
  735. " $name = PHP_" . strtoupper($this->php_type) . "_GET(" . $name . ");\n";
  736. } else {
  737. $var_list->add($this->type, '*' . $name);
  738. $var_list->add('zval', '*php_' . $name);
  739. $parse_list[] = '&php_' . $name;
  740. $arg_list[] = $name;
  741. $extra_code[] =
  742. " if (php_gtk_check_class(php_$name, gdk_window_ce))
  743. $name = (GdkDrawable *)PHP_GDK_WINDOW_GET(php_$name);
  744. else if(php_gtk_check_class(php_$name, gdk_pixmap_ce))
  745. $name = (GdkDrawable *)PHP_GDK_PIXMAP_GET(php_$name);
  746. else if(php_gtk_check_class(php_$name, gdk_bitmap_ce))
  747. $name = (GdkDrawable *)PHP_GDK_BITMAP_GET(php_$name);
  748. else {
  749. php_error(E_WARNING, \"%s() expects the drawable to be GdkWindow, GdkPixmap, or GdkBitmap\", get_active_function_name(TSRMLS_C));
  750. return;
  751. }
  752. ";
  753. }
  754. return 'V';
  755. }
  756. }
  757. function write_return($type, &$var_list, $separate)
  758. {
  759. $var_list->add('zval', '*ret');
  760. return " ret = php_" . $this->php_type . "_new(%s);\n" .
  761. ($separate ? " SEPARATE_ZVAL(&ret);\n" : "") .
  762. " *return_value = *ret;\n" .
  763. " return;";
  764. }
  765. */
  766. }
  767. /* }}} */
  768. /* {{{ GdkRectangle_Arg */
  769. class GdkRectangle_Arg extends Arg_Type {
  770. function write_return($type, $owns_return, $info)
  771. {
  772. $info->var_list->add('GdkRectangle', 'php_retval');
  773. $info->post_code[] = "\tphpg_gboxed_new(&return_value, GDK_TYPE_RECTANGLE, &php_retval, TRUE, TRUE TSRMLS_CC);\n";
  774. }
  775. }
  776. /* }}} */
  777. /* {{{ GdkRectanglePtr_Arg */
  778. class GdkRectanglePtr_Arg extends Arg_Type {
  779. const check_tpl = "
  780. if (phpg_rectangle_from_zval(php_%(name), (GdkRectangle*)&%(name) TSRMLS_CC) == FAILURE) {
  781. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be either a 4-element array or a GdkRectangle object\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  782. %(on_error);
  783. }";
  784. const check_null_tpl = "
  785. if (Z_TYPE_P(php_%(name)) == IS_NULL) {
  786. %(name) = NULL;
  787. } else if (phpg_rectangle_from_zval(php_%(name), (GdkRectangle*)&%(name)_arg TSRMLS_CC) == SUCCESS) {
  788. %(name) = &%(name)_arg;
  789. } else {
  790. php_error(E_WARNING, \"%s::%s() expects %(name) argument to be a 4-element array, a GdkRectangle object, or null\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  791. %(on_error);
  792. }";
  793. function __construct($type = 'GdkRectangle') {
  794. $this->classtype = $type;
  795. }
  796. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  797. {
  798. if ($null_ok) {
  799. $info->var_list->add($this->classtype, $name . '_arg = { 0, 0, 0, 0 }');
  800. $info->var_list->add($this->classtype, '*' . $name);
  801. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  802. $info->add_parse_list('V', '&php_' . $name);
  803. $info->arg_list[] = $name;
  804. $info->pre_code[] = aprintf(self::check_null_tpl, array('name' => $name,
  805. 'on_error' => $info->error_action));
  806. } else {
  807. $info->var_list->add($this->classtype, $name . ' = { 0, 0, 0, 0 }');
  808. $info->var_list->add('zval', '*php_' . $name);
  809. $info->add_parse_list('V', '&php_' . $name);
  810. $info->arg_list[] = '&' . $name;
  811. $info->pre_code[] = aprintf(self::check_tpl, array('name' => $name,
  812. 'on_error' => $info->error_action));
  813. }
  814. }
  815. }
  816. /* }}} */
  817. /* {{{ GType_Arg */
  818. class GType_Arg extends Arg_Type {
  819. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  820. {
  821. $info->var_list->add('GType', $name);
  822. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  823. $info->arg_list[] = $name;
  824. $info->add_parse_list('V', '&php_' . $name);
  825. $info->pre_code[] = " if (($name = phpg_gtype_from_zval(php_$name)) == 0) {\n" .
  826. " $info->error_action;\n" .
  827. " }\n";
  828. }
  829. function write_return($type, $owns_return, $info)
  830. {
  831. $info->var_list->add('GType', 'php_retval');
  832. $info->post_code[] = " phpg_gtype_new(return_value, php_retval TSRMLS_CC);\n";
  833. }
  834. }
  835. /* }}} */
  836. /* {{{ GError_Arg */
  837. class GError_Arg extends Arg_Type {
  838. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  839. {
  840. $info->var_list->add('GError', '*' . $name . ' = NULL');
  841. $info->arg_list[] = '&' . $name;
  842. $info->post_code[] = " if (phpg_handle_gerror(&$name TSRMLS_CC)) {\n" .
  843. " return;\n" .
  844. " }\n";
  845. }
  846. }
  847. /* }}} */
  848. /* {{{ GtkTreePath_Arg */
  849. class GtkTreePath_Arg extends Arg_Type {
  850. const normal_tpl = "
  851. if (phpg_tree_path_from_zval(php_%(name), &%(name) TSRMLS_CC) == FAILURE) {
  852. php_error(E_WARNING, \"%s::%s() expects %(name) to be a valid tree path specification\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  853. %(on_error);
  854. }\n";
  855. const null_tpl = "
  856. if (php_%(name) && Z_TYPE_P(php_%(name)) != IS_NULL) {
  857. if (phpg_tree_path_from_zval(php_%(name), &%(name) TSRMLS_CC) == FAILURE) {
  858. php_error(E_WARNING, \"%s::%s() expects %(name) to be a valid tree path specification\", get_active_class_name(NULL TSRMLS_CC), get_active_function_name(TSRMLS_C));
  859. %(on_error);
  860. }
  861. }\n";
  862. const free_path_tpl = "
  863. if (%(name))
  864. gtk_tree_path_free(%(name));\n";
  865. function write_param($type, $name, $default, $null_ok, $info, $in_constructor=null)
  866. {
  867. if ($null_ok) {
  868. $info->var_list->add('GtkTreePath', '*' . $name . ' = NULL');
  869. $info->var_list->add('zval', '*php_' . $name . ' = NULL');
  870. $info->arg_list[] = $name;
  871. $info->add_parse_list('V', '&php_' . $name);
  872. $info->pre_code[] = aprintf(self::null_tpl, array('name' => $name,
  873. 'on_error' => $info->error_action));
  874. $info->post_code[] = aprintf(self::free_path_tpl, array('name' => $name));
  875. } else {
  876. $info->var_list->add('GtkTreePath', '*' . $name);
  877. $info->var_list->add('zval', '*php_' . $name);
  878. $info->arg_list[] = $name;
  879. $info->add_parse_list('V', '&php_' . $name);
  880. $info->pre_code[] = aprintf(self::normal_tpl, array('name' => $name,
  881. 'on_error' => $info->error_action));
  882. $info->post_code[] = aprintf(self::free_path_tpl, array('name' => $name));
  883. }
  884. }
  885. function write_return($type, $owns_return, $info)
  886. {
  887. $info->var_list->add('GtkTreePath', '*php_retval');
  888. if ($owns_return) {
  889. $info->post_code[] = "
  890. if (php_retval) {
  891. phpg_tree_path_to_zval(php_retval, &return_value TSRMLS_CC);
  892. gtk_tree_path_free(php_retval);
  893. }\n";
  894. } else {
  895. $info->post_code[] = "
  896. if (php_retval) {
  897. phpg_tree_path_to_zval(php_retval, &return_value TSRMLS_CC);
  898. }\n";
  899. }
  900. }
  901. }
  902. /* }}} */
  903. /* {{{ Arg_Matcher */
  904. class Arg_Matcher {
  905. var $arg_types = array();
  906. function register($type, $handler)
  907. {
  908. $this->arg_types[$type] = $handler;
  909. }
  910. function register_enum($type, $typecode = null)
  911. {
  912. if ($typecode === null) {
  913. $typecode = 'G_TYPE_NONE';
  914. }
  915. $this->register($type, new Enum_Arg($type, $typecode));
  916. }
  917. function register_flag($type, $typecode = null)
  918. {
  919. if ($typecode === null) {
  920. $typecode = 'G_TYPE_NONE';
  921. }
  922. $this->register($type, new Flags_Arg($type, $typecode));
  923. }
  924. function register_struct($type)
  925. {
  926. $struct_arg = new Struct_Arg($type);
  927. $this->register($type, $struct_arg);
  928. $this->register($type . '*', $struct_arg);
  929. $this->register('const-' . $type . '*', $struct_arg);
  930. }
  931. function register_object($type, $typecode)
  932. {
  933. $obj_arg = new Object_Arg($type, $typecode);
  934. $this->register($type, $obj_arg);
  935. $this->register($type . '*', $obj_arg);
  936. $this->register('const-' . $type . '*', $obj_arg);
  937. if ($type == 'GdkPixmap') {
  938. $this->register('GdkBitmap', $obj_arg);
  939. $this->register('GdkBitmap*', $obj_arg);
  940. }
  941. }
  942. function register_boxed($type, $typecode)
  943. {
  944. if (isset($this->arg_types[$type])) return;
  945. $boxed_arg = new Boxed_Arg($type, $typecode);
  946. $this->register($type, $boxed_arg);
  947. $this->register($type . '*', $boxed_arg);
  948. $this->register('const-' . $type . '*', $boxed_arg);
  949. }
  950. function register_pointer($type, $typecode)
  951. {
  952. if (isset($this->arg_types[$type])) return;
  953. $pointer_arg = new Pointer_Arg($type, $typecode);
  954. $this->register($type, $pointer_arg);
  955. $this->register($type.'*', $pointer_arg);
  956. $this->register('const-'.$type.'*', $pointer_arg);
  957. }
  958. function get($type)
  959. {
  960. if (isset($this->arg_types[$type])) {
  961. return $this->arg_types[$type];
  962. } else {
  963. if (substr($type, 0, 8) == 'GdkEvent' && substr($type, -1) == '*') {
  964. return $this->arg_types['GdkEvent*'];
  965. }
  966. throw new Exception("unknown type '$type'");
  967. }
  968. }
  969. }
  970. /* }}} */
  971. /* {{{ type registration */
  972. $matcher = new Arg_Matcher();
  973. $arg = new None_Arg();
  974. $matcher->register(null, $arg);
  975. $matcher->register('none', $arg);
  976. $arg = new String_Arg();
  977. $matcher->register('char*', $arg);
  978. $matcher->register('gchar*', $arg);
  979. $matcher->register('const-char*', $arg);
  980. $matcher->register('const-gchar*', $arg);
  981. $matcher->register('string', $arg);
  982. $matcher->register('static_string', $arg);
  983. $matcher->register('unsigned-char*', $arg);
  984. $matcher->register('guchar*', $arg);
  985. $matcher->register('const-guchar*', $arg);
  986. $arg = new Char_Arg();
  987. $matcher->register('char', $arg);
  988. $matcher->register('gchar', $arg);
  989. $matcher->register('guchar', $arg);
  990. $arg = new Int_Arg();
  991. $matcher->register('int', $arg);
  992. $matcher->register('gint', $arg);
  993. $matcher->register('guint', $arg);
  994. $matcher->register('short', $arg);
  995. $matcher->register('gshort', $arg);
  996. $matcher->register('gushort', $arg);
  997. $matcher->register('long', $arg);
  998. $matcher->register('glong', $arg);
  999. $matcher->register('gulong', $arg);
  1000. $matcher->register('GdkNativeWindow', $arg);
  1001. $matcher->register('time_t', $arg);
  1002. $matcher->register('guint8', $arg);
  1003. $matcher->register('gint8', $arg);
  1004. $matcher->register('guint16', $arg);
  1005. $matcher->register('gint16', $arg);
  1006. $matcher->register('guint32', $arg);
  1007. $matcher->register('gint32', $arg);
  1008. $matcher->register('GtkType', $arg);
  1009. $matcher->register('GQuark', $arg);
  1010. $matcher->register('OscatsDim', $arg);
  1011. $matcher->register('OscatsNatural', $arg);
  1012. $matcher->register('OscatsResponse', $arg);
  1013. $arg = new Bool_Arg();
  1014. $matcher->register('gboolean', $arg);
  1015. $arg = new Double_Arg();
  1016. $matcher->register('double', $arg);
  1017. $matcher->register('gdouble', $arg);
  1018. $matcher->register('float', $arg);
  1019. $matcher->register('gfloat', $arg);
  1020. $arg = new GdkRectanglePtr_Arg('GdkRectangle');
  1021. $matcher->register('GdkRectangle*', $arg);
  1022. $matcher->register('GtkAllocation*', $arg);
  1023. $arg = new GdkRectanglePtr_Arg('PangoRectangle');
  1024. $matcher->register('PangoRectangle*', $arg);
  1025. $matcher->register('GdkRectangle', new GdkRectangle_Arg);
  1026. /* TODO
  1027. * GdkRectangle(Ptr) args and others
  1028. */
  1029. $matcher->register('GdkAtom', new Atom_Arg());
  1030. #$arg = new Drawable_Arg();
  1031. #$matcher->register('GdkDrawable*', $arg);
  1032. #
  1033. #$matcher->register_boxed('GdkWindow', 'gdk_window');
  1034. #$matcher->register_boxed('GdkPixmap', 'gdk_pixmap');
  1035. #$matcher->register_boxed('GdkBitmap', 'gdk_bitmap');
  1036. #$matcher->register_boxed('GdkColor', 'gdk_color');
  1037. #$matcher->register_boxed('GdkColormap', 'gdk_colormap');
  1038. #$matcher->register_boxed('GdkCursor', 'gdk_cursor');
  1039. #$matcher->register_boxed('GdkVisual', 'gdk_visual');
  1040. #$matcher->register_boxed('GdkFont', 'gdk_font');
  1041. #$matcher->register_boxed('GdkGC', 'gdk_gc');
  1042. #$matcher->register_boxed('GdkDragContext', 'gdk_drag_context');
  1043. #$matcher->register_boxed('GtkSelectionData', 'gtk_selection_data');
  1044. #$matcher->register_boxed('GtkCTreeNode', 'gtk_ctree_node');
  1045. #$matcher->register_boxed('GtkAccelGroup', 'gtk_accel_group');
  1046. #$matcher->register_boxed('GtkStyle', 'gtk_style');
  1047. $matcher->register_object('GObject', 'G_TYPE_OBJECT');
  1048. $matcher->register('GType', new GType_Arg);
  1049. $matcher->register('GError**', new GError_Arg);
  1050. $matcher->register('GtkTreePath*', new GtkTreePath_Arg);
  1051. /* }}} */
  1052. /* vim: set et sts=4 fdm=marker: */
  1053. ?>