You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5015 lines
123 KiB

  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP version 4.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.02 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available at through the world-wide-web at |
  10. | http://www.php.net/license/2_02.txt. |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Uwe Steinmann |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #include <stdlib.h>
  20. #include <errno.h>
  21. extern "C"
  22. {
  23. #include "php.h"
  24. #include "php_globals.h"
  25. #include "ext/standard/head.h"
  26. #include "ext/standard/info.h"
  27. #if 0
  28. #include "ext/standard/php_standard.h"
  29. #include "fopen-wrappers.h"
  30. #endif
  31. #include "SAPI.h"
  32. }
  33. #ifdef PHP_WIN32
  34. #include <winsock.h>
  35. #endif
  36. #ifdef HAVE_MMAP
  37. #include <sys/mman.h>
  38. #endif
  39. #if HAVE_HWAPI
  40. static int le_hwapip;
  41. static int le_hwapi_objectp;
  42. static int le_hwapi_attributep;
  43. static int le_hwapi_errorp;
  44. static int le_hwapi_contentp;
  45. static int le_hwapi_reasonp;
  46. static zend_class_entry *hw_api_class_entry_ptr;
  47. static zend_class_entry *hw_api_object_class_entry_ptr;
  48. static zend_class_entry *hw_api_attribute_class_entry_ptr;
  49. static zend_class_entry *hw_api_error_class_entry_ptr;
  50. static zend_class_entry *hw_api_content_class_entry_ptr;
  51. static zend_class_entry *hw_api_reason_class_entry_ptr;
  52. #include "php_ini.h"
  53. #include "php_hwapi.h"
  54. //#ifdef __cplusplus
  55. //extern "C" {
  56. #include <sdk/api/api.h>
  57. #include <sdk/hgcsp/apihgcsp.h>
  58. //}
  59. //#endif
  60. function_entry hwapi_functions[] = {
  61. PHP_FE(hwapi_dummy, NULL)
  62. PHP_FE(hwapi_init, NULL)
  63. PHP_FE(hwapi_hgcsp, NULL)
  64. PHP_FE(hwapi_object, NULL)
  65. PHP_FE(hwapi_children, NULL)
  66. PHP_FE(hwapi_parents, NULL)
  67. PHP_FE(hwapi_find, NULL)
  68. PHP_FE(hwapi_identify, NULL)
  69. PHP_FE(hwapi_remove, NULL)
  70. PHP_FE(hwapi_content, NULL)
  71. PHP_FE(hwapi_copy, NULL)
  72. PHP_FE(hwapi_link, NULL)
  73. PHP_FE(hwapi_move, NULL)
  74. PHP_FE(hwapi_lock, NULL)
  75. PHP_FE(hwapi_unlock, NULL)
  76. PHP_FE(hwapi_replace, NULL)
  77. PHP_FE(hwapi_object_new, NULL)
  78. PHP_FE(hwapi_object_count, NULL)
  79. PHP_FE(hwapi_object_title, NULL)
  80. PHP_FE(hwapi_object_attreditable, NULL)
  81. PHP_FE(hwapi_object_assign, NULL)
  82. PHP_FE(hwapi_object_attribute, NULL)
  83. PHP_FE(hwapi_object_insert, NULL)
  84. PHP_FE(hwapi_object_remove, NULL)
  85. PHP_FE(hwapi_object_value, NULL)
  86. PHP_FE(hwapi_attribute_new, NULL)
  87. PHP_FE(hwapi_attribute_key, NULL)
  88. PHP_FE(hwapi_attribute_value, NULL)
  89. PHP_FE(hwapi_attribute_values, NULL)
  90. PHP_FE(hwapi_attribute_langdepvalue, NULL)
  91. PHP_FE(hwapi_content_new, NULL)
  92. {NULL, NULL, NULL}
  93. };
  94. static function_entry php_hw_api_functions[] = {
  95. {"hgcsp", PHP_FN(hwapi_hgcsp), NULL},
  96. {"object", PHP_FN(hwapi_object), NULL},
  97. {"children", PHP_FN(hwapi_children), NULL},
  98. {"mychildren", PHP_FN(hwapi_mychildren), NULL},
  99. {"parents", PHP_FN(hwapi_parents), NULL},
  100. {"find", PHP_FN(hwapi_find), NULL},
  101. {"identify", PHP_FN(hwapi_identify), NULL},
  102. {"remove", PHP_FN(hwapi_remove), NULL},
  103. {"content", PHP_FN(hwapi_content), NULL},
  104. {"copy", PHP_FN(hwapi_copy), NULL},
  105. {"link", PHP_FN(hwapi_link), NULL},
  106. {"move", PHP_FN(hwapi_move), NULL},
  107. {"lock", PHP_FN(hwapi_lock), NULL},
  108. {"unlock", PHP_FN(hwapi_unlock), NULL},
  109. {"replace", PHP_FN(hwapi_replace), NULL},
  110. {"insert", PHP_FN(hwapi_insert), NULL},
  111. {"insertdocument", PHP_FN(hwapi_insertdocument), NULL},
  112. {"insertcollection", PHP_FN(hwapi_insertcollection), NULL},
  113. {"srcanchors", PHP_FN(hwapi_srcanchors), NULL},
  114. {"dstanchors", PHP_FN(hwapi_dstanchors), NULL},
  115. {"objectbyanchor", PHP_FN(hwapi_objectbyanchor), NULL},
  116. {"dstofsrcanchor", PHP_FN(hwapi_dstofsrcanchor), NULL},
  117. {"srcsofdst", PHP_FN(hwapi_srcsofdst), NULL},
  118. {"checkin", PHP_FN(hwapi_checkin), NULL},
  119. {"checkout", PHP_FN(hwapi_checkout), NULL},
  120. {"setcommittedversion", PHP_FN(hwapi_setcommittedversion), NULL},
  121. {"revert", PHP_FN(hwapi_revert), NULL},
  122. {"history", PHP_FN(hwapi_history), NULL},
  123. {"removeversion", PHP_FN(hwapi_removeversion), NULL},
  124. {"freeversion", PHP_FN(hwapi_freeversion), NULL},
  125. {"configurationhistory", PHP_FN(hwapi_configurationhistory), NULL},
  126. {"saveconfiguration", PHP_FN(hwapi_saveconfiguration), NULL},
  127. {"restoreconfiguration", PHP_FN(hwapi_restoreconfiguration), NULL},
  128. {"removeconfiguration", PHP_FN(hwapi_removeconfiguration), NULL},
  129. {"mergeconfiguration", PHP_FN(hwapi_mergeconfiguration), NULL},
  130. {"user", PHP_FN(hwapi_user), NULL},
  131. {"userlist", PHP_FN(hwapi_userlist), NULL},
  132. {"hwstat", PHP_FN(hwapi_hwstat), NULL},
  133. {"dcstat", PHP_FN(hwapi_dcstat), NULL},
  134. {"dbstat", PHP_FN(hwapi_dbstat), NULL},
  135. {"ftstat", PHP_FN(hwapi_ftstat), NULL},
  136. {"info", PHP_FN(hwapi_info), NULL},
  137. {NULL, NULL, NULL}
  138. };
  139. static function_entry php_hw_api_object_functions[] = {
  140. {"hw_api_object", PHP_FN(hwapi_object_new), NULL},
  141. {"count", PHP_FN(hwapi_object_count), NULL},
  142. {"title", PHP_FN(hwapi_object_title), NULL},
  143. {"attributeeditable", PHP_FN(hwapi_object_attreditable), NULL},
  144. {"assign", PHP_FN(hwapi_object_assign), NULL},
  145. {"attribute", PHP_FN(hwapi_object_attribute), NULL},
  146. {"insert", PHP_FN(hwapi_object_insert), NULL},
  147. {"remove", PHP_FN(hwapi_object_remove), NULL},
  148. {"value", PHP_FN(hwapi_object_value), NULL},
  149. {NULL, NULL, NULL}
  150. };
  151. static function_entry php_hw_api_attribute_functions[] = {
  152. {"hw_api_attribute", PHP_FN(hwapi_attribute_new), NULL},
  153. {"key", PHP_FN(hwapi_attribute_key), NULL},
  154. {"value", PHP_FN(hwapi_attribute_value), NULL},
  155. {"values", PHP_FN(hwapi_attribute_values), NULL},
  156. {"langdepvalue", PHP_FN(hwapi_attribute_langdepvalue), NULL},
  157. {NULL, NULL, NULL}
  158. };
  159. static function_entry php_hw_api_error_functions[] = {
  160. {"count", PHP_FN(hwapi_error_count), NULL},
  161. {"reason", PHP_FN(hwapi_error_reason), NULL},
  162. {NULL, NULL, NULL}
  163. };
  164. static function_entry php_hw_api_content_functions[] = {
  165. {"hw_api_content", PHP_FN(hwapi_content_new), NULL},
  166. {"read", PHP_FN(hwapi_content_read), NULL},
  167. {"mimetype", PHP_FN(hwapi_content_mimetype), NULL},
  168. {NULL, NULL, NULL}
  169. };
  170. static function_entry php_hw_api_reason_functions[] = {
  171. {"type", PHP_FN(hwapi_reason_type), NULL},
  172. {"description", PHP_FN(hwapi_reason_description), NULL},
  173. {NULL, NULL, NULL}
  174. };
  175. void hw_api_class_startup();
  176. void hw_api_object_class_startup();
  177. void hw_api_attribute_class_startup();
  178. void hw_api_error_class_startup();
  179. void hw_api_content_class_startup();
  180. void hw_api_reason_class_startup();
  181. static zval *php_hwapi_object_new(void *obj, int rsrc_type);
  182. zend_module_entry hwapi_module_entry = {
  183. STANDARD_MODULE_HEADER,
  184. "hwapi",
  185. hwapi_functions,
  186. PHP_MINIT(hwapi),
  187. PHP_MSHUTDOWN(hwapi),
  188. PHP_RINIT(hwapi),
  189. NULL,
  190. PHP_MINFO(hwapi),
  191. NO_VERSION_YET,
  192. STANDARD_MODULE_PROPERTIES
  193. };
  194. #ifdef ZTS
  195. int hwapi_globals_id;
  196. #else
  197. PHP_HWAPI_API zend_hwapi_globals hwapi_globals;
  198. #endif
  199. #ifdef COMPILE_DL_HWAPI
  200. ZEND_GET_MODULE(hwapi)
  201. #endif
  202. static void print_reason(const HW_API_Reason& reason) {
  203. HW_API_String str_type;
  204. switch(reason.type()) {
  205. case HW_API_Reason::HW_API_ERROR:
  206. str_type = "Error";
  207. break;
  208. case HW_API_Reason::HW_API_WARNING:
  209. str_type = "Warning";
  210. break;
  211. case HW_API_Reason::HW_API_MESSAGE:
  212. str_type = "Message";
  213. break;
  214. }
  215. fprintf(stderr, "%s: %s\n", str_type.string(), reason.description("en").string());
  216. }
  217. static void print_error(const HW_API_Error& error) {
  218. for (int i=0; i < error.count(); i++) {
  219. HW_API_Reason reason;
  220. error.reason(i, reason);
  221. print_reason(reason);
  222. }
  223. }
  224. static void print_object(const HW_API_Object& object) {
  225. fprintf(stderr, "%s\n", object.title("en").string());
  226. for (int i=0; i < object.count(); i++) {
  227. HW_API_Attribute attrib;
  228. object.attribute(i, attrib);
  229. fprintf(stderr, "%s=%s\n", attrib.key().string(), attrib.value().string());
  230. }
  231. }
  232. static void php_hwapi_init_globals(zend_hwapi_globals *hwapi_globals) {
  233. }
  234. static void php_free_hwapi(zend_rsrc_list_entry *rsrc) {
  235. HW_API *obj;
  236. obj = (HW_API *) (rsrc->ptr);
  237. delete obj;
  238. }
  239. static void php_free_hwapi_object(zend_rsrc_list_entry *rsrc) {
  240. HW_API_Object *obj;
  241. obj = (HW_API_Object *) (rsrc->ptr);
  242. delete obj;
  243. }
  244. static void php_free_hwapi_attribute(zend_rsrc_list_entry *rsrc) {
  245. HW_API_Attribute *obj;
  246. obj = (HW_API_Attribute *) (rsrc->ptr);
  247. if(obj)
  248. delete obj;
  249. }
  250. static void php_free_hwapi_error(zend_rsrc_list_entry *rsrc) {
  251. HW_API_Error *obj;
  252. obj = (HW_API_Error *) (rsrc->ptr);
  253. if(obj)
  254. delete obj;
  255. }
  256. static void php_free_hwapi_content(zend_rsrc_list_entry *rsrc) {
  257. HW_API_Content *obj;
  258. obj = (HW_API_Content *) (rsrc->ptr);
  259. if(obj)
  260. delete obj;
  261. }
  262. static void php_free_hwapi_reason(zend_rsrc_list_entry *rsrc) {
  263. HW_API_Reason *obj;
  264. obj = (HW_API_Reason *) (rsrc->ptr);
  265. if(obj)
  266. delete obj;
  267. }
  268. static void print_hwapi_stringarray(const HW_API_StringArray& strings) {
  269. for(int i=0; i<strings.count(); i++) {
  270. HW_API_String str;
  271. strings.string(i, str);
  272. fprintf(stderr, "%s\n", str.string());
  273. }
  274. }
  275. static int stringArray2indexArray(pval **return_value, HW_API_StringArray *values) {
  276. array_init(*return_value);
  277. for (int i=0; i<values->count(); i++) {
  278. HW_API_String str;
  279. values->string(i, str);
  280. str.string();
  281. add_next_index_string(*return_value, (char *) str.string(), 1);
  282. }
  283. return 1;
  284. }
  285. static int objectArray2indexArray(pval **return_value, HW_API_ObjectArray *objarr) {
  286. array_init(*return_value);
  287. for(int i=0; i<objarr->count(); i++) {
  288. zval *child;
  289. HW_API_Object obj, *objp;
  290. objarr->object(i, obj);
  291. objp = new HW_API_Object(obj);
  292. child = php_hwapi_object_new(objp, le_hwapi_objectp);
  293. add_next_index_zval(*return_value, child);
  294. }
  295. return 1;
  296. }
  297. static void *php_hwapi_get_object(zval *wrapper, int rsrc_type1) {
  298. void *obj;
  299. zval **handle;
  300. int type;
  301. if (Z_TYPE_P(wrapper) != IS_OBJECT) {
  302. php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrapper is not an object");
  303. }
  304. if (zend_hash_find(Z_OBJPROP_P(wrapper), "this", sizeof("this"), (void **)&handle) == FAILURE) {
  305. php_error_docref(NULL TSRMLS_CC, E_ERROR, "Underlying object missing");
  306. }
  307. obj = zend_list_find(Z_LVAL_PP(handle), &type);
  308. if (!obj || (type != rsrc_type1)) {
  309. php_error_docref(NULL TSRMLS_CC, E_ERROR, "Underlying object missing or of invalid type");
  310. }
  311. return obj;
  312. }
  313. static zval *php_hwapi_object_new(void *obj, int rsrc_type) {
  314. zval *wrapper, *handle;
  315. int ret;
  316. MAKE_STD_ZVAL(wrapper);
  317. if (!obj) {
  318. ZVAL_NULL(wrapper);
  319. return wrapper;
  320. }
  321. /* construct an object with some methods */
  322. if(rsrc_type == le_hwapi_attributep)
  323. object_init_ex(wrapper, hw_api_attribute_class_entry_ptr);
  324. else if(rsrc_type == le_hwapi_objectp)
  325. object_init_ex(wrapper, hw_api_object_class_entry_ptr);
  326. else if(rsrc_type == le_hwapip)
  327. object_init_ex(wrapper, hw_api_class_entry_ptr);
  328. else if(rsrc_type == le_hwapi_errorp)
  329. object_init_ex(wrapper, hw_api_error_class_entry_ptr);
  330. else if(rsrc_type == le_hwapi_contentp)
  331. object_init_ex(wrapper, hw_api_content_class_entry_ptr);
  332. else if(rsrc_type == le_hwapi_reasonp)
  333. object_init_ex(wrapper, hw_api_reason_class_entry_ptr);
  334. MAKE_STD_ZVAL(handle);
  335. ZEND_REGISTER_RESOURCE(handle, obj, rsrc_type);
  336. zend_hash_update(Z_OBJPROP_P(wrapper), "this", sizeof("this"), &handle, sizeof(zval *), NULL);
  337. return(wrapper);
  338. }
  339. static HW_API_StringArray *make_HW_API_StringArray(HashTable *lht) {
  340. int count, j;
  341. HW_API_StringArray *sarr;
  342. sarr = new HW_API_StringArray();
  343. count = zend_hash_num_elements(lht);
  344. zend_hash_internal_pointer_reset(lht);
  345. for(j=0; j<count; j++) {
  346. zval **keydata;
  347. zend_hash_get_current_data(lht, (void **) &keydata);
  348. switch((*keydata)->type) {
  349. case IS_STRING:
  350. sarr->insert((HW_API_String) (*keydata)->value.str.val);
  351. break;
  352. }
  353. zend_hash_move_forward(lht);
  354. }
  355. return sarr;
  356. }
  357. static HW_API_object_In *make_HW_API_object_In(zval *arg1) {
  358. int count, i;
  359. HashTable *lht;
  360. HW_API_object_In *in;
  361. lht = arg1->value.ht;
  362. if(0 == (count = zend_hash_num_elements(lht))) {
  363. return NULL;
  364. }
  365. in = new HW_API_object_In();
  366. zend_hash_internal_pointer_reset(lht);
  367. for(i=0; i<count; i++) {
  368. ulong ind;
  369. char *key;
  370. zval **keydata;
  371. zend_hash_get_current_data(lht, (void **) &keydata);
  372. zend_hash_get_current_key(lht, &key, &ind, 0);
  373. switch((*keydata)->type) {
  374. case IS_STRING:
  375. if(!strcmp(key, "objectIdentifier"))
  376. in->setObjectIdentifier((*keydata)->value.str.val);
  377. else if(!strcmp(key, "version"))
  378. in->setVersion((*keydata)->value.str.val);
  379. break;
  380. case IS_ARRAY: {
  381. HW_API_StringArray *sarr;
  382. if(!strcmp(key, "attributeSelector")) {
  383. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  384. in->setAttributeSelector(*sarr);
  385. /* FIXME: sarr can be propperly by freed now */
  386. }
  387. break;
  388. }
  389. }
  390. zend_hash_move_forward(lht);
  391. }
  392. return(in);
  393. }
  394. static HW_API_children_In *make_HW_API_children_In(zval *arg1) {
  395. int count, i;
  396. HashTable *lht;
  397. HW_API_children_In *in;
  398. lht = arg1->value.ht;
  399. if(0 == (count = zend_hash_num_elements(lht))) {
  400. return NULL;
  401. }
  402. in = new HW_API_children_In();
  403. zend_hash_internal_pointer_reset(lht);
  404. for(i=0; i<count; i++) {
  405. ulong ind;
  406. char *key;
  407. zval **keydata;
  408. zend_hash_get_current_data(lht, (void **) &keydata);
  409. zend_hash_get_current_key(lht, &key, &ind, 0);
  410. switch((*keydata)->type) {
  411. case IS_STRING:
  412. if(!strcmp(key, "objectIdentifier"))
  413. in->setObjectIdentifier((*keydata)->value.str.val);
  414. else if(!strcmp(key, "objectQuery"))
  415. in->setObjectQuery((*keydata)->value.str.val);
  416. break;
  417. case IS_ARRAY: {
  418. HW_API_StringArray *sarr;
  419. if(!strcmp(key, "attributeSelector")) {
  420. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  421. in->setAttributeSelector(*sarr);
  422. /* FIXME: sarr can be propperly by freed now */
  423. }
  424. break;
  425. }
  426. }
  427. zend_hash_move_forward(lht);
  428. }
  429. return(in);
  430. }
  431. static HW_API_parents_In *make_HW_API_parents_In(zval *arg1) {
  432. int count, i;
  433. HashTable *lht;
  434. HW_API_parents_In *in;
  435. lht = arg1->value.ht;
  436. if(0 == (count = zend_hash_num_elements(lht))) {
  437. return NULL;
  438. }
  439. in = new HW_API_parents_In();
  440. zend_hash_internal_pointer_reset(lht);
  441. for(i=0; i<count; i++) {
  442. ulong ind;
  443. char *key;
  444. zval **keydata;
  445. zend_hash_get_current_data(lht, (void **) &keydata);
  446. zend_hash_get_current_key(lht, &key, &ind, 0);
  447. switch((*keydata)->type) {
  448. case IS_STRING:
  449. if(!strcmp(key, "objectIdentifier"))
  450. in->setObjectIdentifier((*keydata)->value.str.val);
  451. else if(!strcmp(key, "objectQuery"))
  452. in->setObjectQuery((*keydata)->value.str.val);
  453. break;
  454. case IS_ARRAY: {
  455. HW_API_StringArray *sarr;
  456. if(!strcmp(key, "attributeSelector")) {
  457. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  458. in->setAttributeSelector(*sarr);
  459. /* FIXME: sarr can be propperly by freed now */
  460. }
  461. break;
  462. }
  463. }
  464. zend_hash_move_forward(lht);
  465. }
  466. return(in);
  467. }
  468. static HW_API_find_In *make_HW_API_find_In(zval *arg1) {
  469. int count, i;
  470. HashTable *lht;
  471. HW_API_find_In *in;
  472. lht = arg1->value.ht;
  473. if(0 == (count = zend_hash_num_elements(lht))) {
  474. return NULL;
  475. }
  476. in = new HW_API_find_In();
  477. zend_hash_internal_pointer_reset(lht);
  478. for(i=0; i<count; i++) {
  479. ulong ind;
  480. char *key;
  481. zval **keydata;
  482. zend_hash_get_current_data(lht, (void **) &keydata);
  483. zend_hash_get_current_key(lht, &key, &ind, 0);
  484. switch((*keydata)->type) {
  485. case IS_STRING:
  486. if(!strcmp(key, "keyQuery"))
  487. in->setKeyQuery((*keydata)->value.str.val);
  488. else if(!strcmp(key, "objectQuery"))
  489. in->setObjectQuery((*keydata)->value.str.val);
  490. else if(!strcmp(key, "fullTextQuery"))
  491. in->setFullTextQuery((*keydata)->value.str.val);
  492. break;
  493. case IS_LONG:
  494. if(!strcmp(key, "startIndex"))
  495. in->setStartIndex((*keydata)->value.lval);
  496. else if(!strcmp(key, "numberOfObjectsToGet"))
  497. in->setNumberOfObjectsToGet((*keydata)->value.lval);
  498. else if(!strcmp(key, "exactMatchLimit"))
  499. in->setExactMatchLimit((*keydata)->value.lval);
  500. break;
  501. case IS_ARRAY: {
  502. HW_API_StringArray *sarr;
  503. if(!strcmp(key, "attributeSelector")) {
  504. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  505. in->setAttributeSelector(*sarr);
  506. /* FIXME: sarr can be propperly by freed now */
  507. } else if(!strcmp(key, "languages")) {
  508. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  509. in->setLanguages(*sarr);
  510. /* FIXME: sarr can be propperly by freed now */
  511. } else if(!strcmp(key, "scope")) {
  512. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  513. in->setScope(*sarr);
  514. /* FIXME: sarr can be propperly by freed now */
  515. }
  516. break;
  517. }
  518. }
  519. zend_hash_move_forward(lht);
  520. }
  521. return(in);
  522. }
  523. static HW_API_identify_In *make_HW_API_identify_In(zval *arg1) {
  524. int count, i;
  525. HashTable *lht;
  526. HW_API_identify_In *in;
  527. lht = arg1->value.ht;
  528. if(0 == (count = zend_hash_num_elements(lht))) {
  529. return NULL;
  530. }
  531. in = new HW_API_identify_In();
  532. zend_hash_internal_pointer_reset(lht);
  533. for(i=0; i<count; i++) {
  534. ulong ind;
  535. char *key;
  536. zval **keydata;
  537. zend_hash_get_current_data(lht, (void **) &keydata);
  538. zend_hash_get_current_key(lht, &key, &ind, 0);
  539. switch((*keydata)->type) {
  540. case IS_STRING:
  541. if(!strcmp(key, "username"))
  542. in->setUsername((*keydata)->value.str.val);
  543. else if(!strcmp(key, "password"))
  544. in->setPassword((*keydata)->value.str.val);
  545. break;
  546. }
  547. zend_hash_move_forward(lht);
  548. }
  549. return(in);
  550. }
  551. static HW_API_remove_In *make_HW_API_remove_In(zval *arg1) {
  552. int count, i;
  553. HashTable *lht;
  554. HW_API_remove_In *in;
  555. lht = arg1->value.ht;
  556. if(0 == (count = zend_hash_num_elements(lht))) {
  557. return NULL;
  558. }
  559. in = new HW_API_remove_In();
  560. zend_hash_internal_pointer_reset(lht);
  561. for(i=0; i<count; i++) {
  562. ulong ind;
  563. char *key;
  564. zval **keydata;
  565. zend_hash_get_current_data(lht, (void **) &keydata);
  566. zend_hash_get_current_key(lht, &key, &ind, 0);
  567. switch((*keydata)->type) {
  568. case IS_STRING:
  569. if(!strcmp(key, "parentIdentifier"))
  570. in->setParentIdentifier((*keydata)->value.str.val);
  571. else if(!strcmp(key, "objectIdentifier"))
  572. in->setObjectIdentifier((*keydata)->value.str.val);
  573. else if(!strcmp(key, "objectQuery"))
  574. in->setObjectQuery((*keydata)->value.str.val);
  575. break;
  576. case IS_LONG:
  577. if(!strcmp(key, "mode"))
  578. in->setMode((*keydata)->value.lval);
  579. break;
  580. }
  581. zend_hash_move_forward(lht);
  582. }
  583. return(in);
  584. }
  585. static HW_API_content_In *make_HW_API_content_In(zval *arg1) {
  586. int count, i;
  587. HashTable *lht;
  588. HW_API_content_In *in;
  589. lht = arg1->value.ht;
  590. if(0 == (count = zend_hash_num_elements(lht))) {
  591. return NULL;
  592. }
  593. in = new HW_API_content_In();
  594. zend_hash_internal_pointer_reset(lht);
  595. for(i=0; i<count; i++) {
  596. ulong ind;
  597. char *key;
  598. zval **keydata;
  599. zend_hash_get_current_data(lht, (void **) &keydata);
  600. zend_hash_get_current_key(lht, &key, &ind, 0);
  601. switch((*keydata)->type) {
  602. case IS_STRING:
  603. if(!strcmp(key, "objectIdentifier"))
  604. in->setObjectIdentifier((*keydata)->value.str.val);
  605. break;
  606. case IS_LONG:
  607. if(!strcmp(key, "mode"))
  608. in->setMode((*keydata)->value.lval);
  609. break;
  610. }
  611. zend_hash_move_forward(lht);
  612. }
  613. return(in);
  614. }
  615. static HW_API_copy_In *make_HW_API_copy_In(zval *arg1) {
  616. int count, i;
  617. HashTable *lht;
  618. HW_API_copy_In *in;
  619. lht = arg1->value.ht;
  620. if(0 == (count = zend_hash_num_elements(lht))) {
  621. return NULL;
  622. }
  623. in = new HW_API_copy_In();
  624. zend_hash_internal_pointer_reset(lht);
  625. for(i=0; i<count; i++) {
  626. ulong ind;
  627. char *key;
  628. zval **keydata;
  629. zend_hash_get_current_data(lht, (void **) &keydata);
  630. zend_hash_get_current_key(lht, &key, &ind, 0);
  631. switch((*keydata)->type) {
  632. case IS_STRING:
  633. if(!strcmp(key, "destinationParentIdentifier"))
  634. in->setDestinationParentIdentifier((*keydata)->value.str.val);
  635. else if(!strcmp(key, "objectIdentifier"))
  636. in->setObjectIdentifier((*keydata)->value.str.val);
  637. break;
  638. case IS_ARRAY: {
  639. HW_API_StringArray *sarr;
  640. if(!strcmp(key, "attributeSelector")) {
  641. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  642. in->setAttributeSelector(*sarr);
  643. /* FIXME: sarr can be propperly by freed now */
  644. }
  645. break;
  646. }
  647. }
  648. zend_hash_move_forward(lht);
  649. }
  650. return(in);
  651. }
  652. static HW_API_link_In *make_HW_API_link_In(zval *arg1) {
  653. int count, i;
  654. HashTable *lht;
  655. HW_API_link_In *in;
  656. lht = arg1->value.ht;
  657. if(0 == (count = zend_hash_num_elements(lht))) {
  658. return NULL;
  659. }
  660. in = new HW_API_link_In();
  661. zend_hash_internal_pointer_reset(lht);
  662. for(i=0; i<count; i++) {
  663. ulong ind;
  664. char *key;
  665. zval **keydata;
  666. zend_hash_get_current_data(lht, (void **) &keydata);
  667. zend_hash_get_current_key(lht, &key, &ind, 0);
  668. switch((*keydata)->type) {
  669. case IS_STRING:
  670. if(!strcmp(key, "destinationParentIdentifier"))
  671. in->setDestinationParentIdentifier((*keydata)->value.str.val);
  672. else if(!strcmp(key, "objectIdentifier"))
  673. in->setObjectIdentifier((*keydata)->value.str.val);
  674. break;
  675. }
  676. zend_hash_move_forward(lht);
  677. }
  678. return(in);
  679. }
  680. static HW_API_move_In *make_HW_API_move_In(zval *arg1) {
  681. int count, i;
  682. HashTable *lht;
  683. HW_API_move_In *in;
  684. lht = arg1->value.ht;
  685. if(0 == (count = zend_hash_num_elements(lht))) {
  686. return NULL;
  687. }
  688. in = new HW_API_move_In();
  689. zend_hash_internal_pointer_reset(lht);
  690. for(i=0; i<count; i++) {
  691. ulong ind;
  692. char *key;
  693. zval **keydata;
  694. zend_hash_get_current_data(lht, (void **) &keydata);
  695. zend_hash_get_current_key(lht, &key, &ind, 0);
  696. switch((*keydata)->type) {
  697. case IS_STRING:
  698. if(!strcmp(key, "destinationParentIdentifier"))
  699. in->setDestinationParentIdentifier((*keydata)->value.str.val);
  700. else if(!strcmp(key, "sourceParentIdentifier"))
  701. in->setSourceParentIdentifier((*keydata)->value.str.val);
  702. else if(!strcmp(key, "objectIdentifier"))
  703. in->setObjectIdentifier((*keydata)->value.str.val);
  704. break;
  705. }
  706. zend_hash_move_forward(lht);
  707. }
  708. return(in);
  709. }
  710. static HW_API_lock_In *make_HW_API_lock_In(zval *arg1) {
  711. int count, i;
  712. HashTable *lht;
  713. HW_API_lock_In *in;
  714. lht = arg1->value.ht;
  715. if(0 == (count = zend_hash_num_elements(lht))) {
  716. return NULL;
  717. }
  718. in = new HW_API_lock_In();
  719. zend_hash_internal_pointer_reset(lht);
  720. for(i=0; i<count; i++) {
  721. ulong ind;
  722. char *key;
  723. zval **keydata;
  724. zend_hash_get_current_data(lht, (void **) &keydata);
  725. zend_hash_get_current_key(lht, &key, &ind, 0);
  726. switch((*keydata)->type) {
  727. case IS_STRING:
  728. if(!strcmp(key, "objectQuery"))
  729. in->setObjectQuery((*keydata)->value.str.val);
  730. else if(!strcmp(key, "objectIdentifier"))
  731. in->setObjectIdentifier((*keydata)->value.str.val);
  732. break;
  733. case IS_LONG:
  734. if(!strcmp(key, "mode"))
  735. in->setMode((*keydata)->value.lval);
  736. break;
  737. }
  738. zend_hash_move_forward(lht);
  739. }
  740. return(in);
  741. }
  742. static HW_API_unlock_In *make_HW_API_unlock_In(zval *arg1) {
  743. int count, i;
  744. HashTable *lht;
  745. HW_API_unlock_In *in;
  746. lht = arg1->value.ht;
  747. if(0 == (count = zend_hash_num_elements(lht))) {
  748. return NULL;
  749. }
  750. in = new HW_API_unlock_In();
  751. zend_hash_internal_pointer_reset(lht);
  752. for(i=0; i<count; i++) {
  753. ulong ind;
  754. char *key;
  755. zval **keydata;
  756. zend_hash_get_current_data(lht, (void **) &keydata);
  757. zend_hash_get_current_key(lht, &key, &ind, 0);
  758. switch((*keydata)->type) {
  759. case IS_STRING:
  760. if(!strcmp(key, "objectQuery"))
  761. in->setObjectQuery((*keydata)->value.str.val);
  762. else if(!strcmp(key, "objectIdentifier"))
  763. in->setObjectIdentifier((*keydata)->value.str.val);
  764. break;
  765. case IS_LONG:
  766. if(!strcmp(key, "mode"))
  767. in->setMode((*keydata)->value.lval);
  768. break;
  769. }
  770. zend_hash_move_forward(lht);
  771. }
  772. return(in);
  773. }
  774. static HW_API_replace_In *make_HW_API_replace_In(zval *arg1) {
  775. int count, i;
  776. HashTable *lht;
  777. HW_API_replace_In *in;
  778. lht = arg1->value.ht;
  779. if(0 == (count = zend_hash_num_elements(lht))) {
  780. return NULL;
  781. }
  782. in = new HW_API_replace_In();
  783. zend_hash_internal_pointer_reset(lht);
  784. for(i=0; i<count; i++) {
  785. ulong ind;
  786. char *key;
  787. zval **keydata;
  788. zend_hash_get_current_data(lht, (void **) &keydata);
  789. zend_hash_get_current_key(lht, &key, &ind, 0);
  790. switch((*keydata)->type) {
  791. case IS_STRING:
  792. if(!strcmp(key, "objectIdentifier"))
  793. in->setObjectIdentifier((*keydata)->value.str.val);
  794. break;
  795. case IS_OBJECT:
  796. if(!strcmp(key, "object")) {
  797. if(!((*keydata)->value.obj.ce->name, "hw_api_object")) {
  798. HW_API_Object *obj;
  799. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  800. in->setObject(*obj);
  801. }
  802. } else if(!strcmp(key, "parameters")) {
  803. if(!((*keydata)->value.obj.ce->name, "hw_api_object")) {
  804. HW_API_Object *obj;
  805. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  806. in->setParameters(*obj);
  807. }
  808. } else if(!strcmp(key, "content")) {
  809. if(!((*keydata)->value.obj.ce->name, "hw_api_content")) {
  810. HW_API_Content *obj;
  811. obj = (HW_API_Content *) php_hwapi_get_object(*keydata, le_hwapi_contentp);
  812. in->setContent(*obj);
  813. }
  814. }
  815. /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
  816. break;
  817. case IS_ARRAY: {
  818. HW_API_StringArray *sarr;
  819. if(!strcmp(key, "attributeSelector")) {
  820. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  821. in->setAttributeSelector(*sarr);
  822. /* FIXME: sarr can be propperly by freed now */
  823. }
  824. break;
  825. }
  826. case IS_LONG:
  827. if(!strcmp(key, "mode"))
  828. in->setMode((*keydata)->value.lval);
  829. break;
  830. }
  831. zend_hash_move_forward(lht);
  832. }
  833. return(in);
  834. }
  835. static HW_API_insert_In *make_HW_API_insert_In(zval *arg1) {
  836. int count, i;
  837. HashTable *lht;
  838. HW_API_insert_In *in;
  839. lht = arg1->value.ht;
  840. if(0 == (count = zend_hash_num_elements(lht))) {
  841. return NULL;
  842. }
  843. in = new HW_API_insert_In();
  844. zend_hash_internal_pointer_reset(lht);
  845. for(i=0; i<count; i++) {
  846. ulong ind;
  847. char *key;
  848. zval **keydata;
  849. zend_hash_get_current_data(lht, (void **) &keydata);
  850. zend_hash_get_current_key(lht, &key, &ind, 0);
  851. switch((*keydata)->type) {
  852. case IS_OBJECT:
  853. if(!strcmp(key, "object")) {
  854. if(!strcmp((*keydata)->value.obj.ce->name, "hw_api_object")) {
  855. HW_API_Object *obj;
  856. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  857. in->setObject(*obj);
  858. }
  859. } else if(!strcmp(key, "parameters")) {
  860. if(!strcmp((*keydata)->value.obj.ce->name, "hw_api_object")) {
  861. HW_API_Object *obj;
  862. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  863. in->setParameters(*obj);
  864. }
  865. } else if(!strcmp(key, "content")) {
  866. if(!strcmp((*keydata)->value.obj.ce->name, "hw_api_content")) {
  867. HW_API_Content *obj;
  868. obj = (HW_API_Content *) php_hwapi_get_object(*keydata, le_hwapi_contentp);
  869. in->setContent(*obj);
  870. }
  871. }
  872. /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
  873. break;
  874. case IS_ARRAY: {
  875. HW_API_StringArray *sarr;
  876. if(!strcmp(key, "attributeSelector")) {
  877. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  878. in->setAttributeSelector(*sarr);
  879. /* FIXME: sarr can be propperly by freed now */
  880. }
  881. break;
  882. }
  883. case IS_LONG:
  884. if(!strcmp(key, "mode"))
  885. in->setMode((*keydata)->value.lval);
  886. break;
  887. }
  888. zend_hash_move_forward(lht);
  889. }
  890. return(in);
  891. }
  892. static HW_API_insertDocument_In *make_HW_API_insertDocument_In(zval *arg1) {
  893. int count, i;
  894. HashTable *lht;
  895. HW_API_insertDocument_In *in;
  896. lht = arg1->value.ht;
  897. if(0 == (count = zend_hash_num_elements(lht))) {
  898. return NULL;
  899. }
  900. in = new HW_API_insertDocument_In();
  901. zend_hash_internal_pointer_reset(lht);
  902. for(i=0; i<count; i++) {
  903. ulong ind;
  904. char *key;
  905. zval **keydata;
  906. zend_hash_get_current_data(lht, (void **) &keydata);
  907. zend_hash_get_current_key(lht, &key, &ind, 0);
  908. switch((*keydata)->type) {
  909. case IS_OBJECT:
  910. if(!strcmp(key, "object")) {
  911. if(!((*keydata)->value.obj.ce->name, "HW_API_Object")) {
  912. HW_API_Object *obj;
  913. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  914. in->setObject(*obj);
  915. }
  916. } else if(!strcmp(key, "parameters")) {
  917. if(!((*keydata)->value.obj.ce->name, "HW_API_Object")) {
  918. HW_API_Object *obj;
  919. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  920. in->setParameters(*obj);
  921. }
  922. } else if(!strcmp(key, "content")) {
  923. if(!((*keydata)->value.obj.ce->name, "HW_API_Content")) {
  924. HW_API_Content *obj;
  925. obj = (HW_API_Content *) php_hwapi_get_object(*keydata, le_hwapi_contentp);
  926. in->setContent(*obj);
  927. }
  928. }
  929. /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
  930. break;
  931. case IS_ARRAY: {
  932. HW_API_StringArray *sarr;
  933. if(!strcmp(key, "attributeSelector")) {
  934. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  935. in->setAttributeSelector(*sarr);
  936. /* FIXME: sarr can be propperly by freed now */
  937. }
  938. break;
  939. }
  940. case IS_LONG:
  941. if(!strcmp(key, "mode"))
  942. in->setMode((*keydata)->value.lval);
  943. break;
  944. case IS_STRING:
  945. if(!strcmp(key, "parentIdentifier"))
  946. in->setParentIdentifier((*keydata)->value.str.val);
  947. break;
  948. }
  949. zend_hash_move_forward(lht);
  950. }
  951. return(in);
  952. }
  953. static HW_API_insertCollection_In *make_HW_API_insertCollection_In(zval *arg1) {
  954. int count, i;
  955. HashTable *lht;
  956. HW_API_insertCollection_In *in;
  957. lht = arg1->value.ht;
  958. if(0 == (count = zend_hash_num_elements(lht))) {
  959. return NULL;
  960. }
  961. in = new HW_API_insertCollection_In();
  962. zend_hash_internal_pointer_reset(lht);
  963. for(i=0; i<count; i++) {
  964. ulong ind;
  965. char *key;
  966. zval **keydata;
  967. zend_hash_get_current_data(lht, (void **) &keydata);
  968. zend_hash_get_current_key(lht, &key, &ind, 0);
  969. switch((*keydata)->type) {
  970. case IS_STRING:
  971. if(!strcmp(key, "parentIdentifier"))
  972. in->setParentIdentifier((*keydata)->value.str.val);
  973. break;
  974. case IS_OBJECT:
  975. if(!strcmp(key, "object")) {
  976. if(!((*keydata)->value.obj.ce->name, "HW_API_Object")) {
  977. HW_API_Object *obj;
  978. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  979. in->setObject(*obj);
  980. }
  981. } else if(!strcmp(key, "parameters")) {
  982. if(!((*keydata)->value.obj.ce->name, "HW_API_Object")) {
  983. HW_API_Object *obj;
  984. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  985. in->setParameters(*obj);
  986. }
  987. }
  988. /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
  989. break;
  990. case IS_ARRAY: {
  991. HW_API_StringArray *sarr;
  992. if(!strcmp(key, "attributeSelector")) {
  993. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  994. in->setAttributeSelector(*sarr);
  995. /* FIXME: sarr can be propperly by freed now */
  996. }
  997. break;
  998. }
  999. }
  1000. zend_hash_move_forward(lht);
  1001. }
  1002. return(in);
  1003. }
  1004. static HW_API_insertAnchor_In *make_HW_API_insertAnchor_In(zval *arg1) {
  1005. int count, i;
  1006. HashTable *lht;
  1007. HW_API_insertAnchor_In *in;
  1008. lht = arg1->value.ht;
  1009. if(0 == (count = zend_hash_num_elements(lht))) {
  1010. return NULL;
  1011. }
  1012. in = new HW_API_insertAnchor_In();
  1013. zend_hash_internal_pointer_reset(lht);
  1014. for(i=0; i<count; i++) {
  1015. ulong ind;
  1016. char *key;
  1017. zval **keydata;
  1018. zend_hash_get_current_data(lht, (void **) &keydata);
  1019. zend_hash_get_current_key(lht, &key, &ind, 0);
  1020. switch((*keydata)->type) {
  1021. case IS_STRING:
  1022. if(!strcmp(key, "documentIdentifier"))
  1023. in->setDocumentIdentifier((*keydata)->value.str.val);
  1024. else if(!strcmp(key, "destinationIdentifier"))
  1025. in->setDestinationIdentifier((*keydata)->value.str.val);
  1026. else if(!strcmp(key, "hint"))
  1027. in->setHint((*keydata)->value.str.val);
  1028. break;
  1029. case IS_OBJECT:
  1030. if(!strcmp(key, "object")) {
  1031. if(!((*keydata)->value.obj.ce->name, "HW_API_Object")) {
  1032. HW_API_Object *obj;
  1033. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  1034. in->setObject(*obj);
  1035. }
  1036. } else if(!strcmp(key, "parameters")) {
  1037. if(!((*keydata)->value.obj.ce->name, "HW_API_Object")) {
  1038. HW_API_Object *obj;
  1039. obj = (HW_API_Object *) php_hwapi_get_object(*keydata, le_hwapi_objectp);
  1040. in->setParameters(*obj);
  1041. }
  1042. }
  1043. /* FIXME: HW_API_Object and HW_API_Content needs to be handelt */
  1044. break;
  1045. case IS_ARRAY: {
  1046. HW_API_StringArray *sarr;
  1047. if(!strcmp(key, "attributeSelector")) {
  1048. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1049. in->setAttributeSelector(*sarr);
  1050. /* FIXME: sarr can be propperly by freed now */
  1051. }
  1052. break;
  1053. }
  1054. }
  1055. zend_hash_move_forward(lht);
  1056. }
  1057. return(in);
  1058. }
  1059. static HW_API_srcAnchors_In *make_HW_API_srcAnchors_In(zval *arg1) {
  1060. int count, i;
  1061. HashTable *lht;
  1062. HW_API_srcAnchors_In *in;
  1063. lht = arg1->value.ht;
  1064. if(0 == (count = zend_hash_num_elements(lht))) {
  1065. return NULL;
  1066. }
  1067. in = new HW_API_srcAnchors_In();
  1068. zend_hash_internal_pointer_reset(lht);
  1069. for(i=0; i<count; i++) {
  1070. ulong ind;
  1071. char *key;
  1072. zval **keydata;
  1073. zend_hash_get_current_data(lht, (void **) &keydata);
  1074. zend_hash_get_current_key(lht, &key, &ind, 0);
  1075. switch((*keydata)->type) {
  1076. case IS_STRING:
  1077. if(!strcmp(key, "objectIdentifier"))
  1078. in->setObjectIdentifier((*keydata)->value.str.val);
  1079. else if(!strcmp(key, "objectQuery"))
  1080. in->setObjectQuery((*keydata)->value.str.val);
  1081. break;
  1082. case IS_ARRAY: {
  1083. HW_API_StringArray *sarr;
  1084. if(!strcmp(key, "attributeSelector")) {
  1085. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1086. in->setAttributeSelector(*sarr);
  1087. /* FIXME: sarr can be propperly by freed now */
  1088. }
  1089. break;
  1090. }
  1091. }
  1092. zend_hash_move_forward(lht);
  1093. }
  1094. return(in);
  1095. }
  1096. static HW_API_dstAnchors_In *make_HW_API_dstAnchors_In(zval *arg1) {
  1097. int count, i;
  1098. HashTable *lht;
  1099. HW_API_dstAnchors_In *in;
  1100. lht = arg1->value.ht;
  1101. if(0 == (count = zend_hash_num_elements(lht))) {
  1102. return NULL;
  1103. }
  1104. in = new HW_API_dstAnchors_In();
  1105. zend_hash_internal_pointer_reset(lht);
  1106. for(i=0; i<count; i++) {
  1107. ulong ind;
  1108. char *key;
  1109. zval **keydata;
  1110. zend_hash_get_current_data(lht, (void **) &keydata);
  1111. zend_hash_get_current_key(lht, &key, &ind, 0);
  1112. switch((*keydata)->type) {
  1113. case IS_STRING:
  1114. if(!strcmp(key, "objectIdentifier"))
  1115. in->setObjectIdentifier((*keydata)->value.str.val);
  1116. else if(!strcmp(key, "objectQuery"))
  1117. in->setObjectQuery((*keydata)->value.str.val);
  1118. break;
  1119. case IS_ARRAY: {
  1120. HW_API_StringArray *sarr;
  1121. if(!strcmp(key, "attributeSelector")) {
  1122. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1123. in->setAttributeSelector(*sarr);
  1124. /* FIXME: sarr can be propperly by freed now */
  1125. }
  1126. break;
  1127. }
  1128. }
  1129. zend_hash_move_forward(lht);
  1130. }
  1131. return(in);
  1132. }
  1133. static HW_API_dstOfSrcAnchor_In *make_HW_API_dstOfSrcAnchor_In(zval *arg1) {
  1134. int count, i;
  1135. HashTable *lht;
  1136. HW_API_dstOfSrcAnchor_In *in;
  1137. lht = arg1->value.ht;
  1138. if(0 == (count = zend_hash_num_elements(lht))) {
  1139. return NULL;
  1140. }
  1141. in = new HW_API_dstOfSrcAnchor_In();
  1142. zend_hash_internal_pointer_reset(lht);
  1143. for(i=0; i<count; i++) {
  1144. ulong ind;
  1145. char *key;
  1146. zval **keydata;
  1147. zend_hash_get_current_data(lht, (void **) &keydata);
  1148. zend_hash_get_current_key(lht, &key, &ind, 0);
  1149. switch((*keydata)->type) {
  1150. case IS_STRING:
  1151. if(!strcmp(key, "objectIdentifier"))
  1152. in->setObjectIdentifier((*keydata)->value.str.val);
  1153. break;
  1154. case IS_ARRAY: {
  1155. HW_API_StringArray *sarr;
  1156. if(!strcmp(key, "attributeSelector")) {
  1157. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1158. in->setAttributeSelector(*sarr);
  1159. /* FIXME: sarr can be propperly by freed now */
  1160. }
  1161. break;
  1162. }
  1163. }
  1164. zend_hash_move_forward(lht);
  1165. }
  1166. return(in);
  1167. }
  1168. static HW_API_objectByAnchor_In *make_HW_API_objectByAnchor_In(zval *arg1) {
  1169. int count, i;
  1170. HashTable *lht;
  1171. HW_API_objectByAnchor_In *in;
  1172. lht = arg1->value.ht;
  1173. if(0 == (count = zend_hash_num_elements(lht))) {
  1174. return NULL;
  1175. }
  1176. in = new HW_API_objectByAnchor_In();
  1177. zend_hash_internal_pointer_reset(lht);
  1178. for(i=0; i<count; i++) {
  1179. ulong ind;
  1180. char *key;
  1181. zval **keydata;
  1182. zend_hash_get_current_data(lht, (void **) &keydata);
  1183. zend_hash_get_current_key(lht, &key, &ind, 0);
  1184. switch((*keydata)->type) {
  1185. case IS_STRING:
  1186. if(!strcmp(key, "objectIdentifier"))
  1187. in->setObjectIdentifier((*keydata)->value.str.val);
  1188. break;
  1189. case IS_ARRAY: {
  1190. HW_API_StringArray *sarr;
  1191. if(!strcmp(key, "attributeSelector")) {
  1192. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1193. in->setAttributeSelector(*sarr);
  1194. /* FIXME: sarr can be propperly by freed now */
  1195. }
  1196. break;
  1197. }
  1198. }
  1199. zend_hash_move_forward(lht);
  1200. }
  1201. return(in);
  1202. }
  1203. static HW_API_srcsOfDst_In *make_HW_API_srcsOfDst_In(zval *arg1) {
  1204. int count, i;
  1205. HashTable *lht;
  1206. HW_API_srcsOfDst_In *in;
  1207. lht = arg1->value.ht;
  1208. if(0 == (count = zend_hash_num_elements(lht))) {
  1209. return NULL;
  1210. }
  1211. in = new HW_API_srcsOfDst_In();
  1212. zend_hash_internal_pointer_reset(lht);
  1213. for(i=0; i<count; i++) {
  1214. ulong ind;
  1215. char *key;
  1216. zval **keydata;
  1217. zend_hash_get_current_data(lht, (void **) &keydata);
  1218. zend_hash_get_current_key(lht, &key, &ind, 0);
  1219. switch((*keydata)->type) {
  1220. case IS_STRING:
  1221. if(!strcmp(key, "objectIdentifier"))
  1222. in->setObjectIdentifier((*keydata)->value.str.val);
  1223. else if(!strcmp(key, "objectQuery"))
  1224. in->setObjectQuery((*keydata)->value.str.val);
  1225. break;
  1226. case IS_ARRAY: {
  1227. HW_API_StringArray *sarr;
  1228. if(!strcmp(key, "attributeSelector")) {
  1229. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1230. in->setAttributeSelector(*sarr);
  1231. /* FIXME: sarr can be propperly by freed now */
  1232. }
  1233. break;
  1234. }
  1235. }
  1236. zend_hash_move_forward(lht);
  1237. }
  1238. return(in);
  1239. }
  1240. static HW_API_checkIn_In *make_HW_API_checkIn_In(zval *arg1) {
  1241. int count, i;
  1242. HashTable *lht;
  1243. HW_API_checkIn_In *in;
  1244. lht = arg1->value.ht;
  1245. if(0 == (count = zend_hash_num_elements(lht))) {
  1246. return NULL;
  1247. }
  1248. in = new HW_API_checkIn_In();
  1249. zend_hash_internal_pointer_reset(lht);
  1250. for(i=0; i<count; i++) {
  1251. ulong ind;
  1252. char *key;
  1253. zval **keydata;
  1254. zend_hash_get_current_data(lht, (void **) &keydata);
  1255. zend_hash_get_current_key(lht, &key, &ind, 0);
  1256. switch((*keydata)->type) {
  1257. case IS_STRING:
  1258. if(!strcmp(key, "objectIdentifier"))
  1259. in->setObjectIdentifier((*keydata)->value.str.val);
  1260. else if(!strcmp(key, "objectQuery"))
  1261. in->setObjectQuery((*keydata)->value.str.val);
  1262. else if(!strcmp(key, "version"))
  1263. in->setVersion((*keydata)->value.str.val);
  1264. else if(!strcmp(key, "comment"))
  1265. in->setComment((*keydata)->value.str.val);
  1266. break;
  1267. case IS_LONG:
  1268. if(!strcmp(key, "mode"))
  1269. in->setMode((*keydata)->value.lval);
  1270. break;
  1271. }
  1272. zend_hash_move_forward(lht);
  1273. }
  1274. return(in);
  1275. }
  1276. static HW_API_checkOut_In *make_HW_API_checkOut_In(zval *arg1) {
  1277. int count, i;
  1278. HashTable *lht;
  1279. HW_API_checkOut_In *in;
  1280. lht = arg1->value.ht;
  1281. if(0 == (count = zend_hash_num_elements(lht))) {
  1282. return NULL;
  1283. }
  1284. in = new HW_API_checkOut_In();
  1285. zend_hash_internal_pointer_reset(lht);
  1286. for(i=0; i<count; i++) {
  1287. ulong ind;
  1288. char *key;
  1289. zval **keydata;
  1290. zend_hash_get_current_data(lht, (void **) &keydata);
  1291. zend_hash_get_current_key(lht, &key, &ind, 0);
  1292. switch((*keydata)->type) {
  1293. case IS_STRING:
  1294. if(!strcmp(key, "objectIdentifier"))
  1295. in->setObjectIdentifier((*keydata)->value.str.val);
  1296. else if(!strcmp(key, "objectQuery"))
  1297. in->setObjectQuery((*keydata)->value.str.val);
  1298. else if(!strcmp(key, "version"))
  1299. in->setVersion((*keydata)->value.str.val);
  1300. break;
  1301. case IS_LONG:
  1302. if(!strcmp(key, "mode"))
  1303. in->setMode((*keydata)->value.lval);
  1304. break;
  1305. }
  1306. zend_hash_move_forward(lht);
  1307. }
  1308. return(in);
  1309. }
  1310. static HW_API_setCommittedVersion_In *make_HW_API_setCommittedVersion_In(zval *arg1) {
  1311. int count, i;
  1312. HashTable *lht;
  1313. HW_API_setCommittedVersion_In *in;
  1314. lht = arg1->value.ht;
  1315. if(0 == (count = zend_hash_num_elements(lht))) {
  1316. return NULL;
  1317. }
  1318. in = new HW_API_setCommittedVersion_In();
  1319. zend_hash_internal_pointer_reset(lht);
  1320. for(i=0; i<count; i++) {
  1321. ulong ind;
  1322. char *key;
  1323. zval **keydata;
  1324. zend_hash_get_current_data(lht, (void **) &keydata);
  1325. zend_hash_get_current_key(lht, &key, &ind, 0);
  1326. switch((*keydata)->type) {
  1327. case IS_STRING:
  1328. if(!strcmp(key, "objectIdentifier"))
  1329. in->setObjectIdentifier((*keydata)->value.str.val);
  1330. else if(!strcmp(key, "version"))
  1331. in->setVersion((*keydata)->value.str.val);
  1332. break;
  1333. case IS_ARRAY: {
  1334. HW_API_StringArray *sarr;
  1335. if(!strcmp(key, "attributeSelector")) {
  1336. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1337. in->setAttributeSelector(*sarr);
  1338. /* FIXME: sarr can be propperly be freed now */
  1339. }
  1340. break;
  1341. }
  1342. }
  1343. zend_hash_move_forward(lht);
  1344. }
  1345. return(in);
  1346. }
  1347. static HW_API_revert_In *make_HW_API_revert_In(zval *arg1) {
  1348. int count, i;
  1349. HashTable *lht;
  1350. HW_API_revert_In *in;
  1351. lht = arg1->value.ht;
  1352. if(0 == (count = zend_hash_num_elements(lht))) {
  1353. return NULL;
  1354. }
  1355. in = new HW_API_revert_In();
  1356. zend_hash_internal_pointer_reset(lht);
  1357. for(i=0; i<count; i++) {
  1358. ulong ind;
  1359. char *key;
  1360. zval **keydata;
  1361. zend_hash_get_current_data(lht, (void **) &keydata);
  1362. zend_hash_get_current_key(lht, &key, &ind, 0);
  1363. switch((*keydata)->type) {
  1364. case IS_STRING:
  1365. if(!strcmp(key, "objectIdentifier"))
  1366. in->setObjectIdentifier((*keydata)->value.str.val);
  1367. else if(!strcmp(key, "objectQuery"))
  1368. in->setObjectQuery((*keydata)->value.str.val);
  1369. else if(!strcmp(key, "version"))
  1370. in->setVersion((*keydata)->value.str.val);
  1371. break;
  1372. case IS_LONG:
  1373. if(!strcmp(key, "mode"))
  1374. in->setMode((*keydata)->value.lval);
  1375. break;
  1376. }
  1377. zend_hash_move_forward(lht);
  1378. }
  1379. return(in);
  1380. }
  1381. static HW_API_history_In *make_HW_API_history(zval *arg1) {
  1382. int count, i;
  1383. HashTable *lht;
  1384. HW_API_history_In *in;
  1385. lht = arg1->value.ht;
  1386. if(0 == (count = zend_hash_num_elements(lht))) {
  1387. return NULL;
  1388. }
  1389. in = new HW_API_history_In();
  1390. zend_hash_internal_pointer_reset(lht);
  1391. for(i=0; i<count; i++) {
  1392. ulong ind;
  1393. char *key;
  1394. zval **keydata;
  1395. zend_hash_get_current_data(lht, (void **) &keydata);
  1396. zend_hash_get_current_key(lht, &key, &ind, 0);
  1397. switch((*keydata)->type) {
  1398. case IS_STRING:
  1399. if(!strcmp(key, "objectIdentifier"))
  1400. in->setObjectIdentifier((*keydata)->value.str.val);
  1401. /* else if(!strcmp(key, "objectQuery"))
  1402. in->objectQuery((*keydata)->value.str.val);*/
  1403. break;
  1404. case IS_ARRAY: {
  1405. HW_API_StringArray *sarr;
  1406. if(!strcmp(key, "attributeSelector")) {
  1407. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1408. in->setAttributeSelector(*sarr);
  1409. /* FIXME: sarr can be propperly be freed now */
  1410. }
  1411. break;
  1412. }
  1413. }
  1414. zend_hash_move_forward(lht);
  1415. }
  1416. return(in);
  1417. }
  1418. static HW_API_removeVersion_In *make_HW_API_removeVersion_In(zval *arg1) {
  1419. int count, i;
  1420. HashTable *lht;
  1421. HW_API_removeVersion_In *in;
  1422. lht = arg1->value.ht;
  1423. if(0 == (count = zend_hash_num_elements(lht))) {
  1424. return NULL;
  1425. }
  1426. in = new HW_API_removeVersion_In();
  1427. zend_hash_internal_pointer_reset(lht);
  1428. for(i=0; i<count; i++) {
  1429. ulong ind;
  1430. char *key;
  1431. zval **keydata;
  1432. zend_hash_get_current_data(lht, (void **) &keydata);
  1433. zend_hash_get_current_key(lht, &key, &ind, 0);
  1434. switch((*keydata)->type) {
  1435. case IS_STRING:
  1436. if(!strcmp(key, "objectIdentifier"))
  1437. in->setObjectIdentifier((*keydata)->value.str.val);
  1438. else if(!strcmp(key, "version"))
  1439. in->setVersion((*keydata)->value.str.val);
  1440. break;
  1441. case IS_LONG:
  1442. if(!strcmp(key, "mode"))
  1443. in->setMode((*keydata)->value.lval);
  1444. break;
  1445. }
  1446. zend_hash_move_forward(lht);
  1447. }
  1448. return(in);
  1449. }
  1450. static HW_API_freeVersion_In *make_HW_API_freeVersion_In(zval *arg1) {
  1451. int count, i;
  1452. HashTable *lht;
  1453. HW_API_freeVersion_In *in;
  1454. lht = arg1->value.ht;
  1455. if(0 == (count = zend_hash_num_elements(lht))) {
  1456. return NULL;
  1457. }
  1458. in = new HW_API_freeVersion_In();
  1459. zend_hash_internal_pointer_reset(lht);
  1460. for(i=0; i<count; i++) {
  1461. ulong ind;
  1462. char *key;
  1463. zval **keydata;
  1464. zend_hash_get_current_data(lht, (void **) &keydata);
  1465. zend_hash_get_current_key(lht, &key, &ind, 0);
  1466. switch((*keydata)->type) {
  1467. case IS_STRING:
  1468. if(!strcmp(key, "objectIdentifier"))
  1469. in->setObjectIdentifier((*keydata)->value.str.val);
  1470. else if(!strcmp(key, "version"))
  1471. in->setVersion((*keydata)->value.str.val);
  1472. break;
  1473. case IS_ARRAY: {
  1474. HW_API_StringArray *sarr;
  1475. if(!strcmp(key, "attributeSelector")) {
  1476. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1477. in->setAttributeSelector(*sarr);
  1478. /* FIXME: sarr can be propperly be freed now */
  1479. }
  1480. break;
  1481. }
  1482. }
  1483. zend_hash_move_forward(lht);
  1484. }
  1485. return(in);
  1486. }
  1487. static HW_API_configurationHistory_In *make_HW_API_configurationHistory_In(zval *arg1) {
  1488. int count, i;
  1489. HashTable *lht;
  1490. HW_API_configurationHistory_In *in;
  1491. lht = arg1->value.ht;
  1492. if(0 == (count = zend_hash_num_elements(lht))) {
  1493. return NULL;
  1494. }
  1495. in = new HW_API_configurationHistory_In();
  1496. zend_hash_internal_pointer_reset(lht);
  1497. for(i=0; i<count; i++) {
  1498. ulong ind;
  1499. char *key;
  1500. zval **keydata;
  1501. zend_hash_get_current_data(lht, (void **) &keydata);
  1502. zend_hash_get_current_key(lht, &key, &ind, 0);
  1503. switch((*keydata)->type) {
  1504. case IS_STRING:
  1505. if(!strcmp(key, "objectIdentifier"))
  1506. in->setObjectIdentifier((*keydata)->value.str.val);
  1507. break;
  1508. }
  1509. zend_hash_move_forward(lht);
  1510. }
  1511. return(in);
  1512. }
  1513. static HW_API_saveConfiguration_In *make_HW_API_saveConfiguration_In(zval *arg1) {
  1514. int count, i;
  1515. HashTable *lht;
  1516. HW_API_saveConfiguration_In *in;
  1517. lht = arg1->value.ht;
  1518. if(0 == (count = zend_hash_num_elements(lht))) {
  1519. return NULL;
  1520. }
  1521. in = new HW_API_saveConfiguration_In();
  1522. zend_hash_internal_pointer_reset(lht);
  1523. for(i=0; i<count; i++) {
  1524. ulong ind;
  1525. char *key;
  1526. zval **keydata;
  1527. zend_hash_get_current_data(lht, (void **) &keydata);
  1528. zend_hash_get_current_key(lht, &key, &ind, 0);
  1529. switch((*keydata)->type) {
  1530. case IS_STRING:
  1531. if(!strcmp(key, "objectIdentifier"))
  1532. in->setObjectIdentifier((*keydata)->value.str.val);
  1533. else if(!strcmp(key, "version"))
  1534. in->setVersion((*keydata)->value.str.val);
  1535. else if(!strcmp(key, "comment"))
  1536. in->setComment((*keydata)->value.str.val);
  1537. break;
  1538. case IS_LONG:
  1539. if(!strcmp(key, "mode"))
  1540. in->setMode((*keydata)->value.lval);
  1541. break;
  1542. case IS_ARRAY: {
  1543. HW_API_StringArray *sarr;
  1544. if(!strcmp(key, "attributeSelector")) {
  1545. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1546. in->setAttributeSelector(*sarr);
  1547. /* FIXME: sarr can be propperly be freed now */
  1548. }
  1549. break;
  1550. }
  1551. }
  1552. zend_hash_move_forward(lht);
  1553. }
  1554. return(in);
  1555. }
  1556. static HW_API_restoreConfiguration_In *make_HW_API_restoreConfiguration_In(zval *arg1) {
  1557. int count, i;
  1558. HashTable *lht;
  1559. HW_API_restoreConfiguration_In *in;
  1560. lht = arg1->value.ht;
  1561. if(0 == (count = zend_hash_num_elements(lht))) {
  1562. return NULL;
  1563. }
  1564. in = new HW_API_restoreConfiguration_In();
  1565. zend_hash_internal_pointer_reset(lht);
  1566. for(i=0; i<count; i++) {
  1567. ulong ind;
  1568. char *key;
  1569. zval **keydata;
  1570. zend_hash_get_current_data(lht, (void **) &keydata);
  1571. zend_hash_get_current_key(lht, &key, &ind, 0);
  1572. switch((*keydata)->type) {
  1573. case IS_STRING:
  1574. if(!strcmp(key, "objectIdentifier"))
  1575. in->setObjectIdentifier((*keydata)->value.str.val);
  1576. else if(!strcmp(key, "version"))
  1577. in->setVersion((*keydata)->value.str.val);
  1578. break;
  1579. case IS_LONG:
  1580. if(!strcmp(key, "mode"))
  1581. in->setMode((*keydata)->value.lval);
  1582. break;
  1583. }
  1584. zend_hash_move_forward(lht);
  1585. }
  1586. return(in);
  1587. }
  1588. static HW_API_removeConfiguration_In *make_HW_API_removeConfiguration_In(zval *arg1) {
  1589. int count, i;
  1590. HashTable *lht;
  1591. HW_API_removeConfiguration_In *in;
  1592. lht = arg1->value.ht;
  1593. if(0 == (count = zend_hash_num_elements(lht))) {
  1594. return NULL;
  1595. }
  1596. in = new HW_API_removeConfiguration_In();
  1597. zend_hash_internal_pointer_reset(lht);
  1598. for(i=0; i<count; i++) {
  1599. ulong ind;
  1600. char *key;
  1601. zval **keydata;
  1602. zend_hash_get_current_data(lht, (void **) &keydata);
  1603. zend_hash_get_current_key(lht, &key, &ind, 0);
  1604. switch((*keydata)->type) {
  1605. case IS_STRING:
  1606. if(!strcmp(key, "objectIdentifier"))
  1607. in->setObjectIdentifier((*keydata)->value.str.val);
  1608. else if(!strcmp(key, "version"))
  1609. in->setVersion((*keydata)->value.str.val);
  1610. break;
  1611. }
  1612. zend_hash_move_forward(lht);
  1613. }
  1614. return(in);
  1615. }
  1616. static HW_API_mergeConfiguration_In *make_HW_API_mergeConfiguration_In(zval *arg1) {
  1617. int count, i;
  1618. HashTable *lht;
  1619. HW_API_mergeConfiguration_In *in;
  1620. lht = arg1->value.ht;
  1621. if(0 == (count = zend_hash_num_elements(lht))) {
  1622. return NULL;
  1623. }
  1624. in = new HW_API_mergeConfiguration_In();
  1625. zend_hash_internal_pointer_reset(lht);
  1626. for(i=0; i<count; i++) {
  1627. ulong ind;
  1628. char *key;
  1629. zval **keydata;
  1630. zend_hash_get_current_data(lht, (void **) &keydata);
  1631. zend_hash_get_current_key(lht, &key, &ind, 0);
  1632. switch((*keydata)->type) {
  1633. case IS_STRING:
  1634. if(!strcmp(key, "objectIdentifier"))
  1635. in->setObjectIdentifier((*keydata)->value.str.val);
  1636. else if(!strcmp(key, "version"))
  1637. in->setVersion((*keydata)->value.str.val);
  1638. break;
  1639. case IS_LONG:
  1640. if(!strcmp(key, "mode"))
  1641. in->setMode((*keydata)->value.lval);
  1642. break;
  1643. }
  1644. zend_hash_move_forward(lht);
  1645. }
  1646. return(in);
  1647. }
  1648. static HW_API_user_In *make_HW_API_user_In(zval *arg1) {
  1649. int count, i;
  1650. HashTable *lht;
  1651. HW_API_user_In *in;
  1652. lht = arg1->value.ht;
  1653. if(0 == (count = zend_hash_num_elements(lht))) {
  1654. return NULL;
  1655. }
  1656. in = new HW_API_user_In();
  1657. zend_hash_internal_pointer_reset(lht);
  1658. for(i=0; i<count; i++) {
  1659. ulong ind;
  1660. char *key;
  1661. zval **keydata;
  1662. zend_hash_get_current_data(lht, (void **) &keydata);
  1663. zend_hash_get_current_key(lht, &key, &ind, 0);
  1664. switch((*keydata)->type) {
  1665. case IS_ARRAY: {
  1666. HW_API_StringArray *sarr;
  1667. if(!strcmp(key, "attributeSelector")) {
  1668. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1669. in->setAttributeSelector(*sarr);
  1670. /* FIXME: sarr can be propperly be freed now */
  1671. }
  1672. break;
  1673. }
  1674. }
  1675. zend_hash_move_forward(lht);
  1676. }
  1677. return(in);
  1678. }
  1679. static HW_API_userlist_In *make_HW_API_userlist_In(zval *arg1) {
  1680. int count, i;
  1681. HashTable *lht;
  1682. HW_API_userlist_In *in;
  1683. lht = arg1->value.ht;
  1684. if(0 == (count = zend_hash_num_elements(lht))) {
  1685. return NULL;
  1686. }
  1687. in = new HW_API_userlist_In();
  1688. zend_hash_internal_pointer_reset(lht);
  1689. for(i=0; i<count; i++) {
  1690. ulong ind;
  1691. char *key;
  1692. zval **keydata;
  1693. zend_hash_get_current_data(lht, (void **) &keydata);
  1694. zend_hash_get_current_key(lht, &key, &ind, 0);
  1695. switch((*keydata)->type) {
  1696. case IS_ARRAY: {
  1697. HW_API_StringArray *sarr;
  1698. if(!strcmp(key, "attributeSelector")) {
  1699. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1700. in->setAttributeSelector(*sarr);
  1701. /* FIXME: sarr can be propperly be freed now */
  1702. }
  1703. break;
  1704. }
  1705. }
  1706. zend_hash_move_forward(lht);
  1707. }
  1708. return(in);
  1709. }
  1710. static HW_API_hwStat_In *make_HW_API_hwStat_In(zval *arg1) {
  1711. int count, i;
  1712. HashTable *lht;
  1713. HW_API_hwStat_In *in;
  1714. lht = arg1->value.ht;
  1715. if(0 == (count = zend_hash_num_elements(lht))) {
  1716. return NULL;
  1717. }
  1718. in = new HW_API_hwStat_In();
  1719. zend_hash_internal_pointer_reset(lht);
  1720. for(i=0; i<count; i++) {
  1721. ulong ind;
  1722. char *key;
  1723. zval **keydata;
  1724. zend_hash_get_current_data(lht, (void **) &keydata);
  1725. zend_hash_get_current_key(lht, &key, &ind, 0);
  1726. switch((*keydata)->type) {
  1727. case IS_ARRAY: {
  1728. HW_API_StringArray *sarr;
  1729. if(!strcmp(key, "attributeSelector")) {
  1730. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1731. in->setAttributeSelector(*sarr);
  1732. /* FIXME: sarr can be propperly be freed now */
  1733. }
  1734. break;
  1735. }
  1736. }
  1737. zend_hash_move_forward(lht);
  1738. }
  1739. return(in);
  1740. }
  1741. static HW_API_dcStat_In *make_HW_API_dcStat_In(zval *arg1) {
  1742. int count, i;
  1743. HashTable *lht;
  1744. HW_API_dcStat_In *in;
  1745. lht = arg1->value.ht;
  1746. if(0 == (count = zend_hash_num_elements(lht))) {
  1747. return NULL;
  1748. }
  1749. in = new HW_API_dcStat_In();
  1750. zend_hash_internal_pointer_reset(lht);
  1751. for(i=0; i<count; i++) {
  1752. ulong ind;
  1753. char *key;
  1754. zval **keydata;
  1755. zend_hash_get_current_data(lht, (void **) &keydata);
  1756. zend_hash_get_current_key(lht, &key, &ind, 0);
  1757. switch((*keydata)->type) {
  1758. case IS_ARRAY: {
  1759. HW_API_StringArray *sarr;
  1760. if(!strcmp(key, "attributeSelector")) {
  1761. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1762. in->setAttributeSelector(*sarr);
  1763. /* FIXME: sarr can be propperly be freed now */
  1764. }
  1765. break;
  1766. }
  1767. }
  1768. zend_hash_move_forward(lht);
  1769. }
  1770. return(in);
  1771. }
  1772. static HW_API_dbStat_In *make_HW_API_dbStat_In(zval *arg1) {
  1773. int count, i;
  1774. HashTable *lht;
  1775. HW_API_dbStat_In *in;
  1776. lht = arg1->value.ht;
  1777. if(0 == (count = zend_hash_num_elements(lht))) {
  1778. return NULL;
  1779. }
  1780. in = new HW_API_dbStat_In();
  1781. zend_hash_internal_pointer_reset(lht);
  1782. for(i=0; i<count; i++) {
  1783. ulong ind;
  1784. char *key;
  1785. zval **keydata;
  1786. zend_hash_get_current_data(lht, (void **) &keydata);
  1787. zend_hash_get_current_key(lht, &key, &ind, 0);
  1788. switch((*keydata)->type) {
  1789. case IS_ARRAY: {
  1790. HW_API_StringArray *sarr;
  1791. if(!strcmp(key, "attributeSelector")) {
  1792. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1793. in->setAttributeSelector(*sarr);
  1794. /* FIXME: sarr can be propperly be freed now */
  1795. }
  1796. break;
  1797. }
  1798. }
  1799. zend_hash_move_forward(lht);
  1800. }
  1801. return(in);
  1802. }
  1803. static HW_API_ftStat_In *make_HW_API_ftStat_In(zval *arg1) {
  1804. int count, i;
  1805. HashTable *lht;
  1806. HW_API_ftStat_In *in;
  1807. lht = arg1->value.ht;
  1808. if(0 == (count = zend_hash_num_elements(lht))) {
  1809. return NULL;
  1810. }
  1811. in = new HW_API_ftStat_In();
  1812. zend_hash_internal_pointer_reset(lht);
  1813. for(i=0; i<count; i++) {
  1814. ulong ind;
  1815. char *key;
  1816. zval **keydata;
  1817. zend_hash_get_current_data(lht, (void **) &keydata);
  1818. zend_hash_get_current_key(lht, &key, &ind, 0);
  1819. switch((*keydata)->type) {
  1820. case IS_ARRAY: {
  1821. HW_API_StringArray *sarr;
  1822. if(!strcmp(key, "attributeSelector")) {
  1823. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1824. in->setAttributeSelector(*sarr);
  1825. /* FIXME: sarr can be propperly be freed now */
  1826. }
  1827. break;
  1828. }
  1829. }
  1830. zend_hash_move_forward(lht);
  1831. }
  1832. return(in);
  1833. }
  1834. static HW_API_info_In *make_HW_API_info_In(zval *arg1) {
  1835. int count, i;
  1836. HashTable *lht;
  1837. HW_API_info_In *in;
  1838. lht = arg1->value.ht;
  1839. if(0 == (count = zend_hash_num_elements(lht))) {
  1840. return NULL;
  1841. }
  1842. in = new HW_API_info_In();
  1843. zend_hash_internal_pointer_reset(lht);
  1844. for(i=0; i<count; i++) {
  1845. ulong ind;
  1846. char *key;
  1847. zval **keydata;
  1848. zend_hash_get_current_data(lht, (void **) &keydata);
  1849. zend_hash_get_current_key(lht, &key, &ind, 0);
  1850. switch((*keydata)->type) {
  1851. case IS_ARRAY: {
  1852. HW_API_StringArray *sarr;
  1853. if(!strcmp(key, "attributeSelector")) {
  1854. sarr = make_HW_API_StringArray((*keydata)->value.ht);
  1855. in->setAttributeSelector(*sarr);
  1856. /* FIXME: sarr can be propperly be freed now */
  1857. }
  1858. break;
  1859. }
  1860. }
  1861. zend_hash_move_forward(lht);
  1862. }
  1863. return(in);
  1864. }
  1865. PHP_INI_BEGIN()
  1866. // STD_PHP_INI_ENTRY("hwapi.allow_persistent", "0", PHP_INI_SYSTEM, OnUpdateInt, allow_persistent, zend_hwapi_globals, hwapi_globals)
  1867. PHP_INI_END()
  1868. PHP_MINIT_FUNCTION(hwapi) {
  1869. ZEND_INIT_MODULE_GLOBALS(hwapi, php_hwapi_init_globals, NULL);
  1870. le_hwapip = zend_register_list_destructors_ex(php_free_hwapi, NULL, "hw_api", module_number);
  1871. le_hwapi_attributep = zend_register_list_destructors_ex(php_free_hwapi_attribute, NULL, "hw_api_attribute", module_number);
  1872. le_hwapi_objectp = zend_register_list_destructors_ex(php_free_hwapi_object, NULL, "hw_api_object", module_number);
  1873. le_hwapi_errorp = zend_register_list_destructors_ex(php_free_hwapi_error, NULL, "hw_api_error", module_number);
  1874. le_hwapi_contentp = zend_register_list_destructors_ex(php_free_hwapi_content, NULL, "hw_api_content", module_number);
  1875. le_hwapi_reasonp = zend_register_list_destructors_ex(php_free_hwapi_reason, NULL, "hw_api_reason", module_number);
  1876. hw_api_class_startup();
  1877. hw_api_object_class_startup();
  1878. hw_api_attribute_class_startup();
  1879. hw_api_error_class_startup();
  1880. hw_api_content_class_startup();
  1881. hw_api_reason_class_startup();
  1882. REGISTER_LONG_CONSTANT("HW_API_REMOVE_NORMAL", HW_API_remove_In::NORMAL, CONST_CS | CONST_PERSISTENT);
  1883. REGISTER_LONG_CONSTANT("HW_API_REMOVE_PHYSICAL", HW_API_remove_In::PHYSICAL, CONST_CS | CONST_PERSISTENT);
  1884. REGISTER_LONG_CONSTANT("HW_API_REMOVE_REMOVELINKS", HW_API_remove_In::REMOVELINKS, CONST_CS | CONST_PERSISTENT);
  1885. REGISTER_LONG_CONSTANT("HW_API_REMOVE_NONRECURSIVE", HW_API_remove_In::NONRECURSIVE, CONST_CS | CONST_PERSISTENT);
  1886. REGISTER_LONG_CONSTANT("HW_API_REPLACE_NORMAL", HW_API_replace_In::NORMAL, CONST_CS | CONST_PERSISTENT);
  1887. REGISTER_LONG_CONSTANT("HW_API_REPLACE_FORCE_VERSION_CONTROL", HW_API_replace_In::FORCE_VERSION_CONTROL, CONST_CS | CONST_PERSISTENT);
  1888. REGISTER_LONG_CONSTANT("HW_API_REPLACE_AUTOMATIC_CHECKOUT", HW_API_replace_In::AUTOMATIC_CHECKOUT, CONST_CS | CONST_PERSISTENT);
  1889. REGISTER_LONG_CONSTANT("HW_API_REPLACE_AUTOMATIC_CHECKIN", HW_API_replace_In::AUTOMATIC_CHECKIN, CONST_CS | CONST_PERSISTENT);
  1890. REGISTER_LONG_CONSTANT("HW_API_REPLACE_PLAIN", HW_API_replace_In::PLAIN, CONST_CS | CONST_PERSISTENT);
  1891. REGISTER_LONG_CONSTANT("HW_API_REPLACE_REVERT_IF_NOT_CHANGED", HW_API_replace_In::REVERT_IF_NOT_CHANGED, CONST_CS | CONST_PERSISTENT);
  1892. REGISTER_LONG_CONSTANT("HW_API_REPLACE_KEEP_TIME_MODIFIED", HW_API_replace_In::KEEP_TIME_MODIFIED, CONST_CS | CONST_PERSISTENT);
  1893. REGISTER_LONG_CONSTANT("HW_API_INSERT_NORMAL", HW_API_insert_In::NORMAL, CONST_CS | CONST_PERSISTENT);
  1894. REGISTER_LONG_CONSTANT("HW_API_INSERT_FORCE_VERSION_CONTROL", HW_API_insert_In::FORCE_VERSION_CONTROL, CONST_CS | CONST_PERSISTENT);
  1895. REGISTER_LONG_CONSTANT("HW_API_INSERT_AUTOMATIC_CHECKOUT", HW_API_insert_In::AUTOMATIC_CHECKOUT, CONST_CS | CONST_PERSISTENT);
  1896. REGISTER_LONG_CONSTANT("HW_API_INSERT_PLAIN", HW_API_insert_In::PLAIN, CONST_CS | CONST_PERSISTENT);
  1897. REGISTER_LONG_CONSTANT("HW_API_INSERT_KEEP_TIME_MODIFIED", HW_API_insert_In::KEEP_TIME_MODIFIED, CONST_CS | CONST_PERSISTENT);
  1898. REGISTER_LONG_CONSTANT("HW_API_INSERT_DELAY_INDEXING", HW_API_insert_In::DELAY_INDEXING, CONST_CS | CONST_PERSISTENT);
  1899. REGISTER_LONG_CONSTANT("HW_API_LOCK_NORMAL", HW_API_lock_In::NORMAL, CONST_CS | CONST_PERSISTENT);
  1900. REGISTER_LONG_CONSTANT("HW_API_LOCK_RECURSIVE", HW_API_lock_In::RECURSIVE, CONST_CS | CONST_PERSISTENT);
  1901. REGISTER_LONG_CONSTANT("HW_API_LOCK_SESSION", HW_API_lock_In::SESSION, CONST_CS | CONST_PERSISTENT);
  1902. REGISTER_LONG_CONSTANT("HW_API_CONTENT_ALLLINKS", HW_API_content_In::ALLLINKS, CONST_CS | CONST_PERSISTENT);
  1903. REGISTER_LONG_CONSTANT("HW_API_CONTENT_REACHABLELINKS", HW_API_content_In::REACHABLELINKS, CONST_CS | CONST_PERSISTENT);
  1904. REGISTER_LONG_CONSTANT("HW_API_CONTENT_PLAIN", HW_API_content_In::PLAIN, CONST_CS | CONST_PERSISTENT);
  1905. REGISTER_LONG_CONSTANT("HW_API_REASON_ERROR", HW_API_Reason::HW_API_ERROR, CONST_CS | CONST_PERSISTENT);
  1906. REGISTER_LONG_CONSTANT("HW_API_REASON_WARNING", HW_API_Reason::HW_API_WARNING, CONST_CS | CONST_PERSISTENT);
  1907. REGISTER_LONG_CONSTANT("HW_API_REASON_MESSAGE", HW_API_Reason::HW_API_MESSAGE, CONST_CS | CONST_PERSISTENT);
  1908. /* Make sure there are at least default values, though the MessageFilePath
  1909. * is bogus. If it isn't set at all the web server dies.
  1910. */
  1911. HW_API_init_In initargs;
  1912. initargs.setArgv0("PHP HWAPI");
  1913. initargs.setMessageFilePath("");
  1914. HW_API::init(initargs);
  1915. return SUCCESS;
  1916. }
  1917. PHP_MSHUTDOWN_FUNCTION(hwapi) {
  1918. return SUCCESS;
  1919. }
  1920. PHP_RINIT_FUNCTION(hwapi) {
  1921. return SUCCESS;
  1922. }
  1923. PHP_MINFO_FUNCTION(hwapi) {
  1924. php_info_print_table_start();
  1925. php_info_print_table_row(2, "Hyperwave API Support", "enabled");
  1926. php_info_print_table_end();
  1927. }
  1928. /* {{{ proto string hwapi_dummy(int link, int id, int msgid)
  1929. Hyperwave dummy function */
  1930. PHP_FUNCTION(hwapi_dummy) {
  1931. pval **arg1, **arg2, **arg3;
  1932. int link, id, type, msgid;
  1933. RETURN_TRUE;
  1934. }
  1935. /* }}} */
  1936. /* {{{ proto void hwapi_init(string hostname, int port)
  1937. Hyperwave initialisation */
  1938. PHP_FUNCTION(hwapi_init) {
  1939. zval **argv[2], *id;
  1940. HW_API_init_In initargs;
  1941. HW_API_init_Out out;
  1942. int ret;
  1943. HW_API_HGCSP *db;
  1944. zval *rv;
  1945. int argc = ZEND_NUM_ARGS();
  1946. if (((argc < 1) || (argc > 2)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
  1947. WRONG_PARAM_COUNT;
  1948. }
  1949. id = getThis();
  1950. convert_to_string_ex(argv[0]);
  1951. initargs.setArgv0("PHP HWAPI");
  1952. initargs.setMessageFilePath(Z_STRVAL_PP(argv[0]));
  1953. if(argc == 2) {
  1954. convert_to_string_ex(argv[1]);
  1955. initargs.setWhatString(Z_STRVAL_PP(argv[1])) ;
  1956. }
  1957. if(id) {
  1958. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  1959. if(!db) {
  1960. RETURN_FALSE;
  1961. }
  1962. out = db->init(initargs);
  1963. } else {
  1964. out = HW_API::init(initargs);
  1965. }
  1966. if (out.error().error()) {
  1967. HW_API_Error *err = new HW_API_Error(out.error());
  1968. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  1969. SEPARATE_ZVAL(&rv);
  1970. *return_value = *rv;
  1971. FREE_ZVAL(rv);
  1972. return;
  1973. }
  1974. RETURN_TRUE;
  1975. }
  1976. /* }}} */
  1977. /* {{{ proto string hwapi_hgcsp(string hostname, int port)
  1978. Hyperwave dummy function */
  1979. PHP_FUNCTION(hwapi_hgcsp) {
  1980. zval **argv[2];
  1981. HW_API_HGCSP *db;
  1982. zval *rv;
  1983. int argc = ZEND_NUM_ARGS();
  1984. if (((argc < 1) || (argc > 2)) || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
  1985. WRONG_PARAM_COUNT;
  1986. }
  1987. convert_to_string_ex(argv[0]);
  1988. if(argc == 2) {
  1989. convert_to_long_ex(argv[1]);
  1990. db = new HW_API_HGCSP(Z_STRVAL_PP(argv[0]), Z_LVAL_PP(argv[1]));
  1991. } else {
  1992. db = new HW_API_HGCSP(Z_STRVAL_PP(argv[0]));
  1993. }
  1994. rv = php_hwapi_object_new((HW_API_HGCSP *) db, le_hwapip);
  1995. SEPARATE_ZVAL(&rv);
  1996. *return_value = *rv;
  1997. FREE_ZVAL(rv);
  1998. // ret = zend_list_insert(db, le_hwapip);
  1999. /* construct an object with some methods */
  2000. // object_init_ex(return_value, hw_api_class_entry_ptr);
  2001. // add_property_resource(return_value, "this", ret);
  2002. }
  2003. /* }}} */
  2004. /* {{{ proto object hwapi_object(array object_in)
  2005. Hyperwave dummy function */
  2006. PHP_FUNCTION(hwapi_object) {
  2007. pval **arg1, *rv, *id;
  2008. HW_API_Object *newobj;
  2009. HW_API_object_In *in;
  2010. HW_API_object_Out out;
  2011. HW_API_HGCSP *db;
  2012. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2013. WRONG_PARAM_COUNT;
  2014. }
  2015. convert_to_array_ex(arg1);
  2016. id = getThis();
  2017. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2018. if(!db) {
  2019. RETURN_FALSE;
  2020. }
  2021. in = make_HW_API_object_In(*arg1);
  2022. out = db->object(*in);
  2023. delete in;
  2024. if (out.error().error()) {
  2025. HW_API_Error *err = new HW_API_Error(out.error());
  2026. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2027. SEPARATE_ZVAL(&rv);
  2028. *return_value = *rv;
  2029. FREE_ZVAL(rv);
  2030. return;
  2031. }
  2032. //Frage: Diese Zeile erzeugt erst mit dem Konstruktor von HW_API_Object
  2033. //eine Kopie und danach durch das assign. Wie kann man das verhindern.
  2034. newobj = new HW_API_Object();
  2035. *newobj = out.object();
  2036. // newobj = new HW_API_Object(out.object());
  2037. rv = php_hwapi_object_new(newobj, le_hwapi_objectp);
  2038. SEPARATE_ZVAL(&rv);
  2039. *return_value = *rv;
  2040. FREE_ZVAL(rv);
  2041. }
  2042. /* }}} */
  2043. /* {{{ proto string hwapi_mychildren(array parameters)
  2044. Hyperwave dummy function */
  2045. PHP_FUNCTION(hwapi_mychildren) {
  2046. zval **arg1, *id, *rv;
  2047. HW_API_ObjectArray objarr;
  2048. HW_API_children_In *in;
  2049. HW_API_children_Out out;
  2050. HW_API_HGCSP *db;
  2051. int i;
  2052. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2053. WRONG_PARAM_COUNT;
  2054. }
  2055. convert_to_string_ex(arg1);
  2056. id = getThis();
  2057. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2058. if(!db) {
  2059. RETURN_FALSE;
  2060. }
  2061. in = new HW_API_children_In();
  2062. in->setObjectIdentifier(Z_STRVAL_PP(arg1));
  2063. out = db->children(*in);
  2064. delete in;
  2065. if (out.error().error()) {
  2066. HW_API_Error *err = new HW_API_Error(out.error());
  2067. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2068. SEPARATE_ZVAL(&rv);
  2069. *return_value = *rv;
  2070. FREE_ZVAL(rv);
  2071. return;
  2072. } else {
  2073. objarr = (HW_API_ObjectArray) out.objects();
  2074. }
  2075. array_init(return_value);
  2076. for(i=0; i<objarr.count(); i++) {
  2077. zval *child;
  2078. HW_API_Object obj, *objp;
  2079. objarr.object(i, obj);
  2080. objp = new HW_API_Object(obj);
  2081. child = php_hwapi_object_new(objp, le_hwapi_objectp);
  2082. add_next_index_zval(return_value, child);
  2083. }
  2084. return;
  2085. for(i=0; i<objarr.count(); i++) {
  2086. HW_API_Object obj;
  2087. HW_API_Attribute attr;
  2088. objarr.object(i, obj);
  2089. obj.attribute("GOid", attr);
  2090. add_next_index_string(return_value, (char *) attr.value().string(), 1);
  2091. }
  2092. }
  2093. /* }}} */
  2094. /* {{{ proto string hwapi_children(array parameters)
  2095. Hyperwave dummy function */
  2096. PHP_FUNCTION(hwapi_children) {
  2097. zval **arg1, *id, *rv;
  2098. HW_API_ObjectArray objarr;
  2099. HW_API_children_In *in;
  2100. HW_API_children_Out out;
  2101. HW_API_HGCSP *db;
  2102. int i;
  2103. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2104. WRONG_PARAM_COUNT;
  2105. }
  2106. convert_to_array_ex(arg1);
  2107. id = getThis();
  2108. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2109. if(!db) {
  2110. RETURN_FALSE;
  2111. }
  2112. in = make_HW_API_children_In(*arg1);
  2113. out = db->children(*in);
  2114. delete in;
  2115. if (out.error().error()) {
  2116. HW_API_Error *err = new HW_API_Error(out.error());
  2117. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2118. SEPARATE_ZVAL(&rv);
  2119. *return_value = *rv;
  2120. FREE_ZVAL(rv);
  2121. return;
  2122. } else {
  2123. objarr = (HW_API_ObjectArray) out.objects();
  2124. }
  2125. objectArray2indexArray(&return_value, &objarr);
  2126. }
  2127. /* }}} */
  2128. /* {{{ proto string hwapi_parents(string hostname, int port)
  2129. Hyperwave dummy function */
  2130. PHP_FUNCTION(hwapi_parents) {
  2131. zval **arg1, *id, *rv;
  2132. HW_API_ObjectArray objarr;
  2133. HW_API_parents_In *in;
  2134. HW_API_parents_Out out;
  2135. HW_API_HGCSP *db;
  2136. int i;
  2137. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2138. WRONG_PARAM_COUNT;
  2139. }
  2140. convert_to_array_ex(arg1);
  2141. id = getThis();
  2142. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2143. if(!db) {
  2144. RETURN_FALSE;
  2145. }
  2146. in = make_HW_API_parents_In(*arg1);
  2147. out = db->parents(*in);
  2148. delete in;
  2149. if (out.error().error()) {
  2150. HW_API_Error *err = new HW_API_Error(out.error());
  2151. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2152. SEPARATE_ZVAL(&rv);
  2153. *return_value = *rv;
  2154. FREE_ZVAL(rv);
  2155. return;
  2156. } else {
  2157. objarr = (HW_API_ObjectArray) out.objects();
  2158. }
  2159. objectArray2indexArray(&return_value, &objarr);
  2160. }
  2161. /* }}} */
  2162. /* {{{ proto string hwapi_find(array parameters)
  2163. Finds objects */
  2164. PHP_FUNCTION(hwapi_find) {
  2165. zval **arg1, *id, *rv;
  2166. HW_API_ObjectArray objarr;
  2167. HW_API_find_In *in;
  2168. HW_API_find_Out out;
  2169. HW_API_HGCSP *db;
  2170. int i;
  2171. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2172. WRONG_PARAM_COUNT;
  2173. }
  2174. convert_to_array_ex(arg1);
  2175. id = getThis();
  2176. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2177. if(!db) {
  2178. RETURN_FALSE;
  2179. }
  2180. in = make_HW_API_find_In(*arg1);
  2181. out = db->find(*in);
  2182. delete in;
  2183. if (out.error().error()) {
  2184. HW_API_Error *err = new HW_API_Error(out.error());
  2185. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2186. SEPARATE_ZVAL(&rv);
  2187. *return_value = *rv;
  2188. FREE_ZVAL(rv);
  2189. return;
  2190. }
  2191. objarr = (HW_API_ObjectArray) out.objects();
  2192. /* FIXME: No a good idea to return just the objects. There is actually
  2193. * more to return. Changing this to an object of type hw_api_find_out would
  2194. * mean to change hw_api_parents() and hw_api_children() as well. */
  2195. array_init(return_value);
  2196. /* FIXME: More than just the list of objects is returned by find() */
  2197. if(0 == objectArray2indexArray(&rv, &objarr)) {
  2198. RETURN_FALSE;
  2199. }
  2200. zend_hash_add(return_value->value.ht, "objects", 8, &rv, sizeof(zval *), NULL);
  2201. add_assoc_long(return_value, "endIndex", out.endIndex());
  2202. add_assoc_bool(return_value, "haveMore", out.haveMore() ? true : false);
  2203. add_assoc_long(return_value, "numberOfThingsFound", out.numberOfThingsFound());
  2204. }
  2205. /* }}} */
  2206. /* {{{ proto string hwapi_identify(string hostname, int port)
  2207. Hyperwave dummy function */
  2208. PHP_FUNCTION(hwapi_identify) {
  2209. pval **arg1, *id, *rv;
  2210. HW_API_identify_In *in;
  2211. HW_API_identify_Out out;
  2212. HW_API_HGCSP *db;
  2213. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2214. WRONG_PARAM_COUNT;
  2215. }
  2216. convert_to_array_ex(arg1);
  2217. id = getThis();
  2218. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2219. if(!db) {
  2220. RETURN_FALSE;
  2221. }
  2222. in = make_HW_API_identify_In(*arg1);
  2223. out = db->identify(*in);
  2224. delete in;
  2225. if (out.error().error()) {
  2226. HW_API_Error *err = new HW_API_Error(out.error());
  2227. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2228. SEPARATE_ZVAL(&rv);
  2229. *return_value = *rv;
  2230. FREE_ZVAL(rv);
  2231. return;
  2232. }
  2233. printf("hwapi_identify\n");
  2234. RETURN_TRUE;
  2235. }
  2236. /* }}} */
  2237. /* {{{ proto string hwapi_remove(array parameters)
  2238. Remove an object */
  2239. PHP_FUNCTION(hwapi_remove) {
  2240. pval **arg1, *id, *rv;
  2241. HW_API_remove_In *in;
  2242. HW_API_remove_Out out;
  2243. HW_API_HGCSP *db;
  2244. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2245. WRONG_PARAM_COUNT;
  2246. }
  2247. convert_to_array_ex(arg1);
  2248. id = getThis();
  2249. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2250. if(!db) {
  2251. RETURN_FALSE;
  2252. }
  2253. in = make_HW_API_remove_In(*arg1);
  2254. out = db->remove(*in);
  2255. delete in;
  2256. if (out.error().error()) {
  2257. HW_API_Error *err = new HW_API_Error(out.error());
  2258. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2259. SEPARATE_ZVAL(&rv);
  2260. *return_value = *rv;
  2261. FREE_ZVAL(rv);
  2262. return;
  2263. }
  2264. printf("hwapi_remove\n");
  2265. RETURN_TRUE;
  2266. }
  2267. /* }}} */
  2268. /* {{{ proto string hwapi_content(string hostname, int port)
  2269. Retrieve content of object */
  2270. PHP_FUNCTION(hwapi_content) {
  2271. pval **arg1, *id, *rv;
  2272. HW_API_content_In *in;
  2273. HW_API_content_Out out;
  2274. HW_API_HGCSP *db;
  2275. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2276. WRONG_PARAM_COUNT;
  2277. }
  2278. convert_to_array_ex(arg1);
  2279. id = getThis();
  2280. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2281. if(!db) {
  2282. RETURN_FALSE;
  2283. }
  2284. in = make_HW_API_content_In(*arg1);
  2285. out = db->content(*in);
  2286. delete in;
  2287. if (!out.error().error()) {
  2288. HW_API_Content *content = new HW_API_Content(out.content());
  2289. rv = php_hwapi_object_new(content, le_hwapi_contentp);
  2290. } else {
  2291. HW_API_Error *err = new HW_API_Error(out.error());
  2292. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2293. }
  2294. SEPARATE_ZVAL(&rv);
  2295. *return_value = *rv;
  2296. FREE_ZVAL(rv);
  2297. }
  2298. /* }}} */
  2299. /* {{{ proto string hwapi_copy(array parameters)
  2300. Hyperwave dummy function */
  2301. PHP_FUNCTION(hwapi_copy) {
  2302. pval **arg1, *id, *rv;
  2303. HW_API_copy_In *in;
  2304. HW_API_copy_Out out;
  2305. HW_API_HGCSP *db;
  2306. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2307. WRONG_PARAM_COUNT;
  2308. }
  2309. convert_to_array_ex(arg1);
  2310. id = getThis();
  2311. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2312. if(!db) {
  2313. RETURN_FALSE;
  2314. }
  2315. in = make_HW_API_copy_In(*arg1);
  2316. out = db->copy(*in);
  2317. delete in;
  2318. if (!out.error().error()) {
  2319. HW_API_Object *object = new HW_API_Object(out.object());
  2320. rv = php_hwapi_object_new((HW_API_Object*) object, le_hwapi_objectp);
  2321. } else {
  2322. HW_API_Error *err = new HW_API_Error(out.error());
  2323. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2324. }
  2325. SEPARATE_ZVAL(&rv);
  2326. *return_value = *rv;
  2327. FREE_ZVAL(rv);
  2328. printf("hwapi_copy\n");
  2329. }
  2330. /* }}} */
  2331. /* {{{ proto string hwapi_link(array parameters)
  2332. Hyperwave dummy function */
  2333. PHP_FUNCTION(hwapi_link) {
  2334. pval **arg1, *id, *rv;
  2335. HW_API_link_In *in;
  2336. HW_API_link_Out out;
  2337. HW_API_HGCSP *db;
  2338. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2339. WRONG_PARAM_COUNT;
  2340. }
  2341. convert_to_array_ex(arg1);
  2342. id = getThis();
  2343. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2344. if(!db) {
  2345. RETURN_FALSE;
  2346. }
  2347. in = make_HW_API_link_In(*arg1);
  2348. out = db->link(*in);
  2349. delete in;
  2350. if (out.error().error()) {
  2351. HW_API_Error *err = new HW_API_Error(out.error());
  2352. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2353. SEPARATE_ZVAL(&rv);
  2354. *return_value = *rv;
  2355. FREE_ZVAL(rv);
  2356. return;
  2357. }
  2358. printf("hwapi_link\n");
  2359. RETURN_TRUE;
  2360. }
  2361. /* }}} */
  2362. /* {{{ proto string hwapi_move(array parameters)
  2363. Hyperwave dummy function */
  2364. PHP_FUNCTION(hwapi_move) {
  2365. pval **arg1, *id, *rv;
  2366. HW_API_move_In *in;
  2367. HW_API_move_Out out;
  2368. HW_API_HGCSP *db;
  2369. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2370. WRONG_PARAM_COUNT;
  2371. }
  2372. convert_to_array_ex(arg1);
  2373. id = getThis();
  2374. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2375. if(!db) {
  2376. RETURN_FALSE;
  2377. }
  2378. in = make_HW_API_move_In(*arg1);
  2379. out = db->move(*in);
  2380. delete in;
  2381. if (out.error().error()) {
  2382. HW_API_Error *err = new HW_API_Error(out.error());
  2383. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2384. SEPARATE_ZVAL(&rv);
  2385. *return_value = *rv;
  2386. FREE_ZVAL(rv);
  2387. return;
  2388. }
  2389. printf("hwapi_move\n");
  2390. RETURN_TRUE;
  2391. }
  2392. /* }}} */
  2393. /* {{{ proto string hwapi_lock(array parameters)
  2394. Hyperwave dummy function */
  2395. PHP_FUNCTION(hwapi_lock) {
  2396. pval **arg1, *id, *rv;
  2397. HW_API_lock_In *in;
  2398. HW_API_lock_Out out;
  2399. HW_API_HGCSP *db;
  2400. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2401. WRONG_PARAM_COUNT;
  2402. }
  2403. convert_to_array_ex(arg1);
  2404. id = getThis();
  2405. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2406. if(!db) {
  2407. RETURN_FALSE;
  2408. }
  2409. in = make_HW_API_lock_In(*arg1);
  2410. out = db->lock(*in);
  2411. delete in;
  2412. if (out.error().error()) {
  2413. HW_API_Error *err = new HW_API_Error(out.error());
  2414. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2415. SEPARATE_ZVAL(&rv);
  2416. *return_value = *rv;
  2417. FREE_ZVAL(rv);
  2418. return;
  2419. }
  2420. printf("hwapi_lock\n");
  2421. RETURN_TRUE;
  2422. }
  2423. /* }}} */
  2424. /* {{{ proto string hwapi_unlock(array parameters)
  2425. Hyperwave dummy function */
  2426. PHP_FUNCTION(hwapi_unlock) {
  2427. pval **arg1, *id, *rv;
  2428. HW_API_unlock_In *in;
  2429. HW_API_unlock_Out out;
  2430. HW_API_HGCSP *db;
  2431. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2432. WRONG_PARAM_COUNT;
  2433. }
  2434. convert_to_array_ex(arg1);
  2435. id = getThis();
  2436. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2437. if(!db) {
  2438. RETURN_FALSE;
  2439. }
  2440. in = make_HW_API_unlock_In(*arg1);
  2441. out = db->unlock(*in);
  2442. delete in;
  2443. if (out.error().error()) {
  2444. HW_API_Error *err = new HW_API_Error(out.error());
  2445. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2446. SEPARATE_ZVAL(&rv);
  2447. *return_value = *rv;
  2448. FREE_ZVAL(rv);
  2449. return;
  2450. }
  2451. printf("hwapi_unlock\n");
  2452. RETURN_TRUE;
  2453. }
  2454. /* }}} */
  2455. /* {{{ proto string hwapi_replace(array parameters)
  2456. Hyperwave dummy function */
  2457. PHP_FUNCTION(hwapi_replace) {
  2458. pval **arg1, *id, *rv;
  2459. HW_API_replace_In *in;
  2460. HW_API_replace_Out out;
  2461. HW_API_HGCSP *db;
  2462. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2463. WRONG_PARAM_COUNT;
  2464. }
  2465. convert_to_array_ex(arg1);
  2466. id = getThis();
  2467. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2468. if(!db) {
  2469. RETURN_FALSE;
  2470. }
  2471. in = make_HW_API_replace_In(*arg1);
  2472. out = db->replace(*in);
  2473. delete in;
  2474. if (!out.error().error()) {
  2475. HW_API_Object *object = new HW_API_Object(out.object());
  2476. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2477. } else {
  2478. HW_API_Error *err = new HW_API_Error(out.error());
  2479. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2480. }
  2481. SEPARATE_ZVAL(&rv);
  2482. *return_value = *rv;
  2483. FREE_ZVAL(rv);
  2484. }
  2485. /* }}} */
  2486. /* {{{ proto string hwapi_insert(array parameters)
  2487. Hyperwave dummy function */
  2488. PHP_FUNCTION(hwapi_insert) {
  2489. pval **arg1, *id, *rv;
  2490. HW_API_insert_In *in;
  2491. HW_API_insert_Out out;
  2492. HW_API_HGCSP *db;
  2493. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2494. WRONG_PARAM_COUNT;
  2495. }
  2496. convert_to_array_ex(arg1);
  2497. id = getThis();
  2498. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2499. if(!db) {
  2500. RETURN_FALSE;
  2501. }
  2502. in = make_HW_API_insert_In(*arg1);
  2503. out = db->insert(*in);
  2504. delete in;
  2505. if (!out.error().error()) {
  2506. HW_API_Object *object = new HW_API_Object(out.object());
  2507. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2508. } else {
  2509. HW_API_Error *err = new HW_API_Error(out.error());
  2510. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2511. }
  2512. SEPARATE_ZVAL(&rv);
  2513. *return_value = *rv;
  2514. FREE_ZVAL(rv);
  2515. }
  2516. /* }}} */
  2517. /* {{{ proto string hwapi_insertdocument(array parameters)
  2518. Hyperwave dummy function */
  2519. PHP_FUNCTION(hwapi_insertdocument) {
  2520. pval **arg1, *id, *rv;
  2521. HW_API_insertDocument_In *in;
  2522. HW_API_insertDocument_Out out;
  2523. HW_API_HGCSP *db;
  2524. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2525. WRONG_PARAM_COUNT;
  2526. }
  2527. convert_to_array_ex(arg1);
  2528. id = getThis();
  2529. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2530. if(!db) {
  2531. RETURN_FALSE;
  2532. }
  2533. in = make_HW_API_insertDocument_In(*arg1);
  2534. out = db->insertDocument(*in);
  2535. delete in;
  2536. if (!out.error().error()) {
  2537. HW_API_Object *object = new HW_API_Object(out.object());
  2538. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2539. } else {
  2540. HW_API_Error *err = new HW_API_Error(out.error());
  2541. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2542. }
  2543. SEPARATE_ZVAL(&rv);
  2544. *return_value = *rv;
  2545. FREE_ZVAL(rv);
  2546. printf("hwapi_insertdocument\n");
  2547. }
  2548. /* }}} */
  2549. /* {{{ proto string hwapi_insertcollection(array parameters)
  2550. Hyperwave dummy function */
  2551. PHP_FUNCTION(hwapi_insertcollection) {
  2552. pval **arg1, *id, *rv;
  2553. HW_API_insertCollection_In *in;
  2554. HW_API_insertCollection_Out out;
  2555. HW_API_HGCSP *db;
  2556. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2557. WRONG_PARAM_COUNT;
  2558. }
  2559. convert_to_array_ex(arg1);
  2560. id = getThis();
  2561. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2562. if(!db) {
  2563. RETURN_FALSE;
  2564. }
  2565. in = make_HW_API_insertCollection_In(*arg1);
  2566. out = db->insertCollection(*in);
  2567. delete in;
  2568. if (!out.error().error()) {
  2569. HW_API_Object *object = new HW_API_Object(out.object());
  2570. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2571. } else {
  2572. HW_API_Error *err = new HW_API_Error(out.error());
  2573. rv = php_hwapi_object_new((HW_API_Error *) &err, le_hwapi_errorp);
  2574. }
  2575. SEPARATE_ZVAL(&rv);
  2576. *return_value = *rv;
  2577. FREE_ZVAL(rv);
  2578. printf("hwapi_insertcollection\n");
  2579. }
  2580. /* }}} */
  2581. /* {{{ proto string hwapi_insertanchor(array parameters)
  2582. Hyperwave dummy function */
  2583. PHP_FUNCTION(hwapi_insertanchor) {
  2584. pval **arg1, *id, *rv;
  2585. HW_API_insertAnchor_In *in;
  2586. HW_API_insertAnchor_Out out;
  2587. HW_API_HGCSP *db;
  2588. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2589. WRONG_PARAM_COUNT;
  2590. }
  2591. convert_to_array_ex(arg1);
  2592. id = getThis();
  2593. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2594. if(!db) {
  2595. RETURN_FALSE;
  2596. }
  2597. in = make_HW_API_insertAnchor_In(*arg1);
  2598. out = db->insertAnchor(*in);
  2599. delete in;
  2600. if (!out.error().error()) {
  2601. HW_API_Object *object = new HW_API_Object(out.object());
  2602. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2603. } else {
  2604. HW_API_Error *err = new HW_API_Error(out.error());
  2605. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2606. }
  2607. SEPARATE_ZVAL(&rv);
  2608. *return_value = *rv;
  2609. FREE_ZVAL(rv);
  2610. printf("hwapi_insertanchor\n");
  2611. }
  2612. /* }}} */
  2613. /* {{{ proto string hwapi_srcanchors(array parameters)
  2614. Hyperwave dummy function */
  2615. PHP_FUNCTION(hwapi_srcanchors) {
  2616. pval **arg1, *id, *rv;
  2617. HW_API_ObjectArray objarr;
  2618. HW_API_srcAnchors_In *in;
  2619. HW_API_srcAnchors_Out out;
  2620. HW_API_HGCSP *db;
  2621. int i;
  2622. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2623. WRONG_PARAM_COUNT;
  2624. }
  2625. convert_to_array_ex(arg1);
  2626. id = getThis();
  2627. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2628. if(!db) {
  2629. RETURN_FALSE;
  2630. }
  2631. in = make_HW_API_srcAnchors_In(*arg1);
  2632. out = db->srcAnchors(*in);
  2633. delete in;
  2634. if (out.error().error()) {
  2635. HW_API_Error *err = new HW_API_Error(out.error());
  2636. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2637. SEPARATE_ZVAL(&rv);
  2638. *return_value = *rv;
  2639. FREE_ZVAL(rv);
  2640. return;
  2641. } else {
  2642. objarr = (HW_API_ObjectArray) out.objects();
  2643. }
  2644. objectArray2indexArray(&return_value, &objarr);
  2645. }
  2646. /* }}} */
  2647. /* {{{ proto string hwapi_dstanchors(array parameters)
  2648. Hyperwave dummy function */
  2649. PHP_FUNCTION(hwapi_dstanchors) {
  2650. pval **arg1, *id, *rv;
  2651. HW_API_ObjectArray objarr;
  2652. HW_API_dstAnchors_In *in;
  2653. HW_API_dstAnchors_Out out;
  2654. HW_API_HGCSP *db;
  2655. int i;
  2656. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2657. WRONG_PARAM_COUNT;
  2658. }
  2659. convert_to_array_ex(arg1);
  2660. id = getThis();
  2661. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2662. if(!db) {
  2663. RETURN_FALSE;
  2664. }
  2665. in = make_HW_API_dstAnchors_In(*arg1);
  2666. out = db->dstAnchors(*in);
  2667. delete in;
  2668. if (out.error().error()) {
  2669. HW_API_Error *err = new HW_API_Error(out.error());
  2670. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2671. SEPARATE_ZVAL(&rv);
  2672. *return_value = *rv;
  2673. FREE_ZVAL(rv);
  2674. return;
  2675. } else {
  2676. objarr = (HW_API_ObjectArray) out.objects();
  2677. }
  2678. objectArray2indexArray(&return_value, &objarr);
  2679. }
  2680. /* }}} */
  2681. /* {{{ proto string hwapi_objectbyanchor(array parameters)
  2682. Hyperwave dummy function */
  2683. PHP_FUNCTION(hwapi_objectbyanchor) {
  2684. pval **arg1, *id, *rv;
  2685. HW_API_objectByAnchor_In *in;
  2686. HW_API_objectByAnchor_Out out;
  2687. HW_API_HGCSP *db;
  2688. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2689. WRONG_PARAM_COUNT;
  2690. }
  2691. convert_to_array_ex(arg1);
  2692. id = getThis();
  2693. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2694. if(!db) {
  2695. RETURN_FALSE;
  2696. }
  2697. in = make_HW_API_objectByAnchor_In(*arg1);
  2698. /* FIXME: return value of any make_HW_API_xxx function should be checked
  2699. * for NULL
  2700. */
  2701. out = db->objectByAnchor(*in);
  2702. delete in;
  2703. if (!out.error().error()) {
  2704. HW_API_Object *object = new HW_API_Object(out.object());
  2705. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2706. } else {
  2707. HW_API_Error *err = new HW_API_Error(out.error());
  2708. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2709. }
  2710. SEPARATE_ZVAL(&rv);
  2711. *return_value = *rv;
  2712. FREE_ZVAL(rv);
  2713. printf("hwapi_objectbyanchor\n");
  2714. }
  2715. /* }}} */
  2716. /* {{{ proto string hwapi_dstofsrcanchor(array parameters)
  2717. Hyperwave dummy function */
  2718. PHP_FUNCTION(hwapi_dstofsrcanchor) {
  2719. pval **arg1, *id, *rv;
  2720. HW_API_dstOfSrcAnchor_In *in;
  2721. HW_API_dstOfSrcAnchor_Out out;
  2722. HW_API_HGCSP *db;
  2723. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2724. WRONG_PARAM_COUNT;
  2725. }
  2726. convert_to_array_ex(arg1);
  2727. id = getThis();
  2728. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2729. if(!db) {
  2730. RETURN_FALSE;
  2731. }
  2732. in = make_HW_API_dstOfSrcAnchor_In(*arg1);
  2733. out = db->dstOfSrcAnchor(*in);
  2734. delete in;
  2735. if (!out.error().error()) {
  2736. HW_API_Object *object = new HW_API_Object(out.object());
  2737. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2738. } else {
  2739. HW_API_Error *err = new HW_API_Error(out.error());
  2740. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2741. }
  2742. SEPARATE_ZVAL(&rv);
  2743. *return_value = *rv;
  2744. FREE_ZVAL(rv);
  2745. printf("hwapi_dstofsrcanchor\n");
  2746. }
  2747. /* }}} */
  2748. /* {{{ proto string hwapi_srcsofdst(array parameters)
  2749. Hyperwave dummy function */
  2750. PHP_FUNCTION(hwapi_srcsofdst) {
  2751. pval **arg1, *id, *rv;
  2752. HW_API_ObjectArray objarr;
  2753. HW_API_srcsOfDst_In *in;
  2754. HW_API_srcsOfDst_Out out;
  2755. HW_API_HGCSP *db;
  2756. int i;
  2757. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2758. WRONG_PARAM_COUNT;
  2759. }
  2760. convert_to_array_ex(arg1);
  2761. id = getThis();
  2762. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2763. if(!db) {
  2764. RETURN_FALSE;
  2765. }
  2766. in = make_HW_API_srcsOfDst_In(*arg1);
  2767. out = db->srcsOfDst(*in);
  2768. delete in;
  2769. if (out.error().error()) {
  2770. HW_API_Error *err = new HW_API_Error(out.error());
  2771. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2772. SEPARATE_ZVAL(&rv);
  2773. *return_value = *rv;
  2774. FREE_ZVAL(rv);
  2775. return;
  2776. } else {
  2777. objarr = (HW_API_ObjectArray) out.objects();
  2778. }
  2779. objectArray2indexArray(&return_value, &objarr);
  2780. }
  2781. /* }}} */
  2782. /* {{{ proto string hwapi_checkin(array parameters)
  2783. Checking in a document */
  2784. PHP_FUNCTION(hwapi_checkin) {
  2785. pval **arg1, *id, *rv;
  2786. HW_API_ObjectArray objarr;
  2787. HW_API_checkIn_In *in;
  2788. HW_API_checkIn_Out out;
  2789. HW_API_HGCSP *db;
  2790. int i;
  2791. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2792. WRONG_PARAM_COUNT;
  2793. }
  2794. convert_to_array_ex(arg1);
  2795. id = getThis();
  2796. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2797. if(!db) {
  2798. RETURN_FALSE;
  2799. }
  2800. in = make_HW_API_checkIn_In(*arg1);
  2801. out = db->checkIn(*in);
  2802. delete in;
  2803. if (out.error().error()) {
  2804. HW_API_Error *err = new HW_API_Error(out.error());
  2805. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2806. SEPARATE_ZVAL(&rv);
  2807. *return_value = *rv;
  2808. FREE_ZVAL(rv);
  2809. return;
  2810. } else {
  2811. RETURN_TRUE;
  2812. }
  2813. printf("hwapi_checkin\n");
  2814. }
  2815. /* }}} */
  2816. /* {{{ proto string hwapi_checkout(array parameters)
  2817. Checking out a document */
  2818. PHP_FUNCTION(hwapi_checkout) {
  2819. pval **arg1, *id, *rv;
  2820. HW_API_ObjectArray objarr;
  2821. HW_API_checkOut_In *in;
  2822. HW_API_checkOut_Out out;
  2823. HW_API_HGCSP *db;
  2824. int i;
  2825. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2826. WRONG_PARAM_COUNT;
  2827. }
  2828. convert_to_array_ex(arg1);
  2829. id = getThis();
  2830. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2831. if(!db) {
  2832. RETURN_FALSE;
  2833. }
  2834. in = make_HW_API_checkOut_In(*arg1);
  2835. out = db->checkOut(*in);
  2836. delete in;
  2837. if (out.error().error()) {
  2838. HW_API_Error *err = new HW_API_Error(out.error());
  2839. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2840. SEPARATE_ZVAL(&rv);
  2841. *return_value = *rv;
  2842. FREE_ZVAL(rv);
  2843. return;
  2844. } else {
  2845. RETURN_TRUE;
  2846. }
  2847. printf("hwapi_checkout\n");
  2848. }
  2849. /* }}} */
  2850. /* {{{ proto string hwapi_setcommittedversion(array parameters)
  2851. setcommittedversion */
  2852. PHP_FUNCTION(hwapi_setcommittedversion) {
  2853. pval **arg1, *id, *rv;
  2854. HW_API_ObjectArray objarr;
  2855. HW_API_setCommittedVersion_In *in;
  2856. HW_API_setCommittedVersion_Out out;
  2857. HW_API_HGCSP *db;
  2858. int i;
  2859. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2860. WRONG_PARAM_COUNT;
  2861. }
  2862. convert_to_array_ex(arg1);
  2863. id = getThis();
  2864. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2865. if(!db) {
  2866. RETURN_FALSE;
  2867. }
  2868. in = make_HW_API_setCommittedVersion_In(*arg1);
  2869. out = db->setCommittedVersion(*in);
  2870. delete in;
  2871. if (!out.error().error()) {
  2872. HW_API_Object *object = new HW_API_Object(out.object());
  2873. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  2874. } else {
  2875. HW_API_Error *err = new HW_API_Error(out.error());
  2876. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2877. }
  2878. SEPARATE_ZVAL(&rv);
  2879. *return_value = *rv;
  2880. FREE_ZVAL(rv);
  2881. printf("hwapi_setcommittedversion\n");
  2882. }
  2883. /* }}} */
  2884. /* {{{ proto string hwapi_revert(array parameters)
  2885. Reverting to a former document */
  2886. PHP_FUNCTION(hwapi_revert) {
  2887. pval **arg1, *id, *rv;
  2888. HW_API_ObjectArray objarr;
  2889. HW_API_revert_In *in;
  2890. HW_API_revert_Out out;
  2891. HW_API_HGCSP *db;
  2892. int i;
  2893. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2894. WRONG_PARAM_COUNT;
  2895. }
  2896. convert_to_array_ex(arg1);
  2897. id = getThis();
  2898. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2899. if(!db) {
  2900. RETURN_FALSE;
  2901. }
  2902. in = make_HW_API_revert_In(*arg1);
  2903. out = db->revert(*in);
  2904. delete in;
  2905. if (out.error().error()) {
  2906. HW_API_Error *err = new HW_API_Error(out.error());
  2907. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2908. SEPARATE_ZVAL(&rv);
  2909. *return_value = *rv;
  2910. FREE_ZVAL(rv);
  2911. return;
  2912. } else {
  2913. RETURN_TRUE;
  2914. }
  2915. printf("hwapi_revert\n");
  2916. }
  2917. /* }}} */
  2918. /* {{{ proto string hwapi_history(array parameters)
  2919. history */
  2920. PHP_FUNCTION(hwapi_history) {
  2921. pval **arg1, *id, *rv;
  2922. HW_API_ObjectArray objarr;
  2923. HW_API_history_In *in;
  2924. HW_API_history_Out out;
  2925. HW_API_HGCSP *db;
  2926. int i;
  2927. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2928. WRONG_PARAM_COUNT;
  2929. }
  2930. convert_to_array_ex(arg1);
  2931. id = getThis();
  2932. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2933. if(!db) {
  2934. RETURN_FALSE;
  2935. }
  2936. in = make_HW_API_history(*arg1);
  2937. out = db->history(*in);
  2938. delete in;
  2939. if (out.error().error()) {
  2940. HW_API_Error *err = new HW_API_Error(out.error());
  2941. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  2942. SEPARATE_ZVAL(&rv);
  2943. *return_value = *rv;
  2944. FREE_ZVAL(rv);
  2945. return;
  2946. } else {
  2947. objarr = (HW_API_ObjectArray) out.objects();
  2948. }
  2949. objectArray2indexArray(&return_value, &objarr);
  2950. }
  2951. /* }}} */
  2952. /* {{{ proto string hwapi_removeversion(array parameters)
  2953. Reverting to a former document */
  2954. PHP_FUNCTION(hwapi_removeversion) {
  2955. pval **arg1, *id, *rv;
  2956. HW_API_ObjectArray objarr;
  2957. HW_API_removeVersion_In *in;
  2958. HW_API_removeVersion_Out out;
  2959. HW_API_HGCSP *db;
  2960. int i;
  2961. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2962. WRONG_PARAM_COUNT;
  2963. }
  2964. convert_to_array_ex(arg1);
  2965. id = getThis();
  2966. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  2967. if(!db) {
  2968. RETURN_FALSE;
  2969. }
  2970. in = make_HW_API_removeVersion_In(*arg1);
  2971. out = db->removeVersion(*in);
  2972. delete in;
  2973. if (out.error().error()) {
  2974. HW_API_Error *err = new HW_API_Error(out.error());
  2975. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  2976. SEPARATE_ZVAL(&rv);
  2977. *return_value = *rv;
  2978. FREE_ZVAL(rv);
  2979. return;
  2980. } else {
  2981. RETURN_TRUE;
  2982. }
  2983. printf("hwapi_removeversion\n");
  2984. }
  2985. /* }}} */
  2986. /* {{{ proto object hwapi_freeversion(array parameters)
  2987. freeversion */
  2988. PHP_FUNCTION(hwapi_freeversion) {
  2989. pval **arg1, *id, *rv;
  2990. HW_API_ObjectArray objarr;
  2991. HW_API_freeVersion_In *in;
  2992. HW_API_freeVersion_Out out;
  2993. HW_API_HGCSP *db;
  2994. int i;
  2995. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  2996. WRONG_PARAM_COUNT;
  2997. }
  2998. convert_to_array_ex(arg1);
  2999. id = getThis();
  3000. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3001. if(!db) {
  3002. RETURN_FALSE;
  3003. }
  3004. in = make_HW_API_freeVersion_In(*arg1);
  3005. out = db->freeVersion(*in);
  3006. delete in;
  3007. if (!out.error().error()) {
  3008. HW_API_Object *object = new HW_API_Object(out.object());
  3009. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3010. } else {
  3011. HW_API_Error *err = new HW_API_Error(out.error());
  3012. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3013. }
  3014. SEPARATE_ZVAL(&rv);
  3015. *return_value = *rv;
  3016. FREE_ZVAL(rv);
  3017. printf("hwapi_freeversion\n");
  3018. }
  3019. /* }}} */
  3020. /* {{{ proto array hwapi_configurationhistory(array parameters)
  3021. Returns configuration history of object */
  3022. PHP_FUNCTION(hwapi_configurationhistory) {
  3023. zval **arg1, *id, *rv;
  3024. HW_API_ObjectArray objarr;
  3025. HW_API_configurationHistory_In *in;
  3026. HW_API_configurationHistory_Out out;
  3027. HW_API_HGCSP *db;
  3028. int i;
  3029. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3030. WRONG_PARAM_COUNT;
  3031. }
  3032. convert_to_array_ex(arg1);
  3033. id = getThis();
  3034. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3035. if(!db) {
  3036. RETURN_FALSE;
  3037. }
  3038. in = make_HW_API_configurationHistory_In(*arg1);
  3039. out = db->configurationHistory(*in);
  3040. delete in;
  3041. if (out.error().error()) {
  3042. HW_API_Error *err = new HW_API_Error(out.error());
  3043. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  3044. SEPARATE_ZVAL(&rv);
  3045. *return_value = *rv;
  3046. FREE_ZVAL(rv);
  3047. return;
  3048. } else {
  3049. objarr = (HW_API_ObjectArray) out.objects();
  3050. }
  3051. objectArray2indexArray(&return_value, &objarr);
  3052. }
  3053. /* }}} */
  3054. /* {{{ proto object hwapi_saveconfiguration(array parameters)
  3055. Save configuration for an object */
  3056. PHP_FUNCTION(hwapi_saveconfiguration) {
  3057. pval **arg1, *id, *rv;
  3058. HW_API_ObjectArray objarr;
  3059. HW_API_saveConfiguration_In *in;
  3060. HW_API_saveConfiguration_Out out;
  3061. HW_API_HGCSP *db;
  3062. int i;
  3063. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3064. WRONG_PARAM_COUNT;
  3065. }
  3066. convert_to_array_ex(arg1);
  3067. id = getThis();
  3068. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3069. if(!db) {
  3070. RETURN_FALSE;
  3071. }
  3072. in = make_HW_API_saveConfiguration_In(*arg1);
  3073. out = db->saveConfiguration(*in);
  3074. delete in;
  3075. if (!out.error().error()) {
  3076. HW_API_Object *object = new HW_API_Object(out.object());
  3077. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3078. } else {
  3079. HW_API_Error *err = new HW_API_Error(out.error());
  3080. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3081. }
  3082. SEPARATE_ZVAL(&rv);
  3083. *return_value = *rv;
  3084. FREE_ZVAL(rv);
  3085. printf("hwapi_saveconfiguration\n");
  3086. }
  3087. /* }}} */
  3088. /* {{{ proto object hwapi_restoreconfiguration(array parameters)
  3089. Restore configuration for an object */
  3090. PHP_FUNCTION(hwapi_restoreconfiguration) {
  3091. pval **arg1, *id, *rv;
  3092. HW_API_ObjectArray objarr;
  3093. HW_API_restoreConfiguration_In *in;
  3094. HW_API_restoreConfiguration_Out out;
  3095. HW_API_HGCSP *db;
  3096. int i;
  3097. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3098. WRONG_PARAM_COUNT;
  3099. }
  3100. convert_to_array_ex(arg1);
  3101. id = getThis();
  3102. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3103. if(!db) {
  3104. RETURN_FALSE;
  3105. }
  3106. in = make_HW_API_restoreConfiguration_In(*arg1);
  3107. out = db->restoreConfiguration(*in);
  3108. delete in;
  3109. if (!out.error().error()) {
  3110. RETURN_STRING((char *) (out.progressIdentifier().string()), 1);
  3111. } else {
  3112. HW_API_Error *err = new HW_API_Error(out.error());
  3113. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3114. }
  3115. SEPARATE_ZVAL(&rv);
  3116. *return_value = *rv;
  3117. FREE_ZVAL(rv);
  3118. printf("hwapi_restoreconfiguration\n");
  3119. }
  3120. /* }}} */
  3121. /* {{{ proto object hwapi_mergeconfiguration(array parameters)
  3122. Merge configuration for an object */
  3123. PHP_FUNCTION(hwapi_mergeconfiguration) {
  3124. pval **arg1, *id, *rv;
  3125. HW_API_ObjectArray objarr;
  3126. HW_API_mergeConfiguration_In *in;
  3127. HW_API_mergeConfiguration_Out out;
  3128. HW_API_HGCSP *db;
  3129. int i;
  3130. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3131. WRONG_PARAM_COUNT;
  3132. }
  3133. convert_to_array_ex(arg1);
  3134. id = getThis();
  3135. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3136. if(!db) {
  3137. RETURN_FALSE;
  3138. }
  3139. in = make_HW_API_mergeConfiguration_In(*arg1);
  3140. out = db->mergeConfiguration(*in);
  3141. delete in;
  3142. if (!out.error().error()) {
  3143. RETURN_STRING((char *) (out.progressIdentifier().string()), 1);
  3144. } else {
  3145. HW_API_Error *err = new HW_API_Error(out.error());
  3146. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3147. }
  3148. SEPARATE_ZVAL(&rv);
  3149. *return_value = *rv;
  3150. FREE_ZVAL(rv);
  3151. printf("hwapi_mergeconfiguration\n");
  3152. }
  3153. /* }}} */
  3154. /* {{{ proto object hwapi_removeconfiguration(array parameters)
  3155. Removes configuration */
  3156. PHP_FUNCTION(hwapi_removeconfiguration) {
  3157. pval **arg1, *id, *rv;
  3158. HW_API_ObjectArray objarr;
  3159. HW_API_removeConfiguration_In *in;
  3160. HW_API_removeConfiguration_Out out;
  3161. HW_API_HGCSP *db;
  3162. int i;
  3163. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3164. WRONG_PARAM_COUNT;
  3165. }
  3166. convert_to_array_ex(arg1);
  3167. id = getThis();
  3168. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3169. if(!db) {
  3170. RETURN_FALSE;
  3171. }
  3172. in = make_HW_API_removeConfiguration_In(*arg1);
  3173. out = db->removeConfiguration(*in);
  3174. delete in;
  3175. if (out.error().error()) {
  3176. HW_API_Error *err = new HW_API_Error(out.error());
  3177. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3178. SEPARATE_ZVAL(&rv);
  3179. *return_value = *rv;
  3180. FREE_ZVAL(rv);
  3181. return;
  3182. } else {
  3183. RETURN_TRUE;
  3184. }
  3185. printf("hwapi_removeconfiguration\n");
  3186. }
  3187. /* }}} */
  3188. /* {{{ proto string hwapi_user(array parameters)
  3189. Returns information about user */
  3190. PHP_FUNCTION(hwapi_user) {
  3191. pval **arg1, *id, *rv;
  3192. HW_API_user_In *in;
  3193. HW_API_user_Out out;
  3194. HW_API_HGCSP *db;
  3195. int argc;
  3196. id = getThis();
  3197. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3198. if(!db) {
  3199. RETURN_FALSE;
  3200. }
  3201. argc = ZEND_NUM_ARGS();
  3202. switch(argc) {
  3203. case 0:
  3204. out = db->user(HW_API_user_In());
  3205. break;
  3206. case 1:
  3207. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3208. WRONG_PARAM_COUNT;
  3209. }
  3210. convert_to_array_ex(arg1);
  3211. in = make_HW_API_user_In(*arg1);
  3212. if(NULL == in)
  3213. out = db->user(HW_API_user_In());
  3214. else
  3215. out = db->user(*in);
  3216. delete in;
  3217. break;
  3218. default:
  3219. WRONG_PARAM_COUNT;
  3220. }
  3221. if (!out.error().error()) {
  3222. HW_API_Object *object = new HW_API_Object(out.object());
  3223. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3224. } else {
  3225. HW_API_Error *err = new HW_API_Error(out.error());
  3226. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3227. }
  3228. SEPARATE_ZVAL(&rv);
  3229. *return_value = *rv;
  3230. FREE_ZVAL(rv);
  3231. }
  3232. /* }}} */
  3233. /* {{{ proto string hwapi_userlist(array parameters)
  3234. Returns list of login in users */
  3235. PHP_FUNCTION(hwapi_userlist) {
  3236. zval **arg1, *id, *rv;
  3237. HW_API_userlist_In *in;
  3238. HW_API_userlist_Out out;
  3239. HW_API_ObjectArray objarr;
  3240. HW_API_HGCSP *db;
  3241. int i;
  3242. int argc;
  3243. id = getThis();
  3244. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3245. if(!db) {
  3246. RETURN_FALSE;
  3247. }
  3248. argc = ZEND_NUM_ARGS();
  3249. switch(argc) {
  3250. case 0:
  3251. out = db->userlist(HW_API_userlist_In());
  3252. break;
  3253. case 1:
  3254. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3255. WRONG_PARAM_COUNT;
  3256. }
  3257. convert_to_array_ex(arg1);
  3258. in = make_HW_API_userlist_In(*arg1);
  3259. if(NULL == in)
  3260. out = db->userlist(HW_API_userlist_In());
  3261. else
  3262. out = db->userlist(*in);
  3263. delete in;
  3264. break;
  3265. default:
  3266. WRONG_PARAM_COUNT;
  3267. }
  3268. if (out.error().error()) {
  3269. HW_API_Error *err = new HW_API_Error(out.error());
  3270. rv = php_hwapi_object_new((HW_API_Error *) err, le_hwapi_errorp);
  3271. SEPARATE_ZVAL(&rv);
  3272. *return_value = *rv;
  3273. FREE_ZVAL(rv);
  3274. return;
  3275. } else {
  3276. objarr = (HW_API_ObjectArray) out.objects();
  3277. }
  3278. objectArray2indexArray(&return_value, &objarr);
  3279. }
  3280. /* }}} */
  3281. /* {{{ proto string hwapi_hwstat(array parameters)
  3282. Returns information about hgserver */
  3283. PHP_FUNCTION(hwapi_hwstat) {
  3284. pval **arg1, *id, *rv;
  3285. HW_API_hwStat_In *in;
  3286. HW_API_hwStat_Out out;
  3287. HW_API_HGCSP *db;
  3288. int argc;
  3289. id = getThis();
  3290. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3291. if(!db) {
  3292. RETURN_FALSE;
  3293. }
  3294. argc = ZEND_NUM_ARGS();
  3295. switch(argc) {
  3296. case 0:
  3297. out = db->hwStat(HW_API_hwStat_In());
  3298. break;
  3299. case 1:
  3300. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3301. WRONG_PARAM_COUNT;
  3302. }
  3303. convert_to_array_ex(arg1);
  3304. in = make_HW_API_hwStat_In(*arg1);
  3305. if(NULL == in)
  3306. out = db->hwStat(HW_API_hwStat_In());
  3307. else
  3308. out = db->hwStat(*in);
  3309. delete in;
  3310. break;
  3311. default:
  3312. WRONG_PARAM_COUNT;
  3313. }
  3314. if (!out.error().error()) {
  3315. HW_API_Object *object = new HW_API_Object(out.object());
  3316. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3317. } else {
  3318. HW_API_Error *err = new HW_API_Error(out.error());
  3319. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3320. }
  3321. SEPARATE_ZVAL(&rv);
  3322. *return_value = *rv;
  3323. FREE_ZVAL(rv);
  3324. }
  3325. /* }}} */
  3326. /* {{{ proto string hwapi_dcstat(array parameters)
  3327. Returns information about hgserver */
  3328. PHP_FUNCTION(hwapi_dcstat) {
  3329. pval **arg1, *id, *rv;
  3330. HW_API_dcStat_In *in;
  3331. HW_API_dcStat_Out out;
  3332. HW_API_HGCSP *db;
  3333. int argc;
  3334. id = getThis();
  3335. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3336. if(!db) {
  3337. RETURN_FALSE;
  3338. }
  3339. argc = ZEND_NUM_ARGS();
  3340. switch(argc) {
  3341. case 0:
  3342. out = db->dcStat(HW_API_dcStat_In());
  3343. break;
  3344. case 1:
  3345. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3346. WRONG_PARAM_COUNT;
  3347. }
  3348. convert_to_array_ex(arg1);
  3349. in = make_HW_API_dcStat_In(*arg1);
  3350. if(NULL == in)
  3351. out = db->dcStat(HW_API_dcStat_In());
  3352. else
  3353. out = db->dcStat(*in);
  3354. delete in;
  3355. break;
  3356. default:
  3357. WRONG_PARAM_COUNT;
  3358. }
  3359. if (!out.error().error()) {
  3360. HW_API_Object *object = new HW_API_Object(out.object());
  3361. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3362. } else {
  3363. HW_API_Error *err = new HW_API_Error(out.error());
  3364. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3365. }
  3366. SEPARATE_ZVAL(&rv);
  3367. *return_value = *rv;
  3368. FREE_ZVAL(rv);
  3369. }
  3370. /* }}} */
  3371. /* {{{ proto string hwapi_dbstat(array parameters)
  3372. Returns information about hgserver */
  3373. PHP_FUNCTION(hwapi_dbstat) {
  3374. pval **arg1, *id, *rv;
  3375. HW_API_dbStat_In *in;
  3376. HW_API_dbStat_Out out;
  3377. HW_API_HGCSP *db;
  3378. int argc;
  3379. id = getThis();
  3380. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3381. if(!db) {
  3382. RETURN_FALSE;
  3383. }
  3384. argc = ZEND_NUM_ARGS();
  3385. switch(argc) {
  3386. case 0:
  3387. out = db->dbStat(HW_API_dbStat_In());
  3388. break;
  3389. case 1:
  3390. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3391. WRONG_PARAM_COUNT;
  3392. }
  3393. convert_to_array_ex(arg1);
  3394. in = make_HW_API_dbStat_In(*arg1);
  3395. if(NULL == in)
  3396. out = db->dbStat(HW_API_dbStat_In());
  3397. else
  3398. out = db->dbStat(*in);
  3399. delete in;
  3400. break;
  3401. default:
  3402. WRONG_PARAM_COUNT;
  3403. }
  3404. if (!out.error().error()) {
  3405. HW_API_Object *object = new HW_API_Object(out.object());
  3406. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3407. } else {
  3408. HW_API_Error *err = new HW_API_Error(out.error());
  3409. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3410. }
  3411. SEPARATE_ZVAL(&rv);
  3412. *return_value = *rv;
  3413. FREE_ZVAL(rv);
  3414. }
  3415. /* }}} */
  3416. /* {{{ proto string hwapi_ftstat(array parameters)
  3417. Returns information about ftserver */
  3418. PHP_FUNCTION(hwapi_ftstat) {
  3419. pval **arg1, *id, *rv;
  3420. HW_API_ftStat_In *in;
  3421. HW_API_ftStat_Out out;
  3422. HW_API_HGCSP *db;
  3423. int argc;
  3424. id = getThis();
  3425. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3426. if(!db) {
  3427. RETURN_FALSE;
  3428. }
  3429. argc = ZEND_NUM_ARGS();
  3430. switch(argc) {
  3431. case 0:
  3432. out = db->ftStat(HW_API_ftStat_In());
  3433. break;
  3434. case 1:
  3435. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3436. WRONG_PARAM_COUNT;
  3437. }
  3438. convert_to_array_ex(arg1);
  3439. in = make_HW_API_ftStat_In(*arg1);
  3440. if(NULL == in)
  3441. out = db->ftStat(HW_API_ftStat_In());
  3442. else
  3443. out = db->ftStat(*in);
  3444. delete in;
  3445. break;
  3446. default:
  3447. WRONG_PARAM_COUNT;
  3448. }
  3449. if (!out.error().error()) {
  3450. HW_API_Object *object = new HW_API_Object(out.object());
  3451. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3452. } else {
  3453. HW_API_Error *err = new HW_API_Error(out.error());
  3454. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3455. }
  3456. SEPARATE_ZVAL(&rv);
  3457. *return_value = *rv;
  3458. FREE_ZVAL(rv);
  3459. }
  3460. /* }}} */
  3461. /* {{{ proto string hwapi_info(array parameters)
  3462. Returns information about server */
  3463. PHP_FUNCTION(hwapi_info) {
  3464. pval **arg1, *id, *rv, *rv1, *rv2, *rv3;
  3465. HW_API_info_In *in;
  3466. HW_API_info_Out out;
  3467. HW_API_HGCSP *db;
  3468. int argc;
  3469. id = getThis();
  3470. db = (HW_API_HGCSP *) php_hwapi_get_object(id, le_hwapip);
  3471. if(!db) {
  3472. RETURN_FALSE;
  3473. }
  3474. argc = ZEND_NUM_ARGS();
  3475. switch(argc) {
  3476. case 0:
  3477. out = db->info(HW_API_info_In());
  3478. break;
  3479. case 1:
  3480. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3481. WRONG_PARAM_COUNT;
  3482. }
  3483. convert_to_array_ex(arg1);
  3484. in = make_HW_API_info_In(*arg1);
  3485. if(NULL == in)
  3486. out = db->info(HW_API_info_In());
  3487. else
  3488. out = db->info(*in);
  3489. delete in;
  3490. break;
  3491. default:
  3492. WRONG_PARAM_COUNT;
  3493. }
  3494. if (!out.error().error()) {
  3495. HW_API_StringArray languages, customidx, systemidx;
  3496. array_init(return_value);
  3497. HW_API_Object *object = new HW_API_Object(out.typeInfo());
  3498. rv = php_hwapi_object_new(object, le_hwapi_objectp);
  3499. zend_hash_add(return_value->value.ht, "typeInfo", 9, &rv, sizeof(zval *), NULL);
  3500. languages = out.languages();
  3501. MAKE_STD_ZVAL(rv1);
  3502. if(0 == stringArray2indexArray(&rv1, &languages))
  3503. RETURN_FALSE;
  3504. zend_hash_add(return_value->value.ht, "languages", 10, &rv1, sizeof(zval *), NULL);
  3505. customidx = out.customIdx();
  3506. MAKE_STD_ZVAL(rv2);
  3507. if(0 == stringArray2indexArray(&rv2, &customidx))
  3508. RETURN_FALSE;
  3509. zend_hash_add(return_value->value.ht, "customIdx", 10, &rv2, sizeof(zval *), NULL);
  3510. systemidx = out.systemIdx();
  3511. MAKE_STD_ZVAL(rv3);
  3512. if(0 == stringArray2indexArray(&rv3, &systemidx))
  3513. RETURN_FALSE;
  3514. zend_hash_add(return_value->value.ht, "systemIdx", 10, &rv3, sizeof(zval *), NULL);
  3515. } else {
  3516. HW_API_Error *err = new HW_API_Error(out.error());
  3517. rv = php_hwapi_object_new(err, le_hwapi_errorp);
  3518. SEPARATE_ZVAL(&rv);
  3519. *return_value = *rv;
  3520. FREE_ZVAL(rv);
  3521. }
  3522. }
  3523. /* }}} */
  3524. /* {{{ proto string hwapi_object_new()
  3525. Creates new HW_API_Object */
  3526. PHP_FUNCTION(hwapi_object_new) {
  3527. pval **arg1, **arg2, *rv;
  3528. HW_API_Object *obj;
  3529. const HW_API_Object *srcobj;
  3530. int ret;
  3531. switch(ZEND_NUM_ARGS()) {
  3532. case 0:
  3533. obj = new HW_API_Object();
  3534. break;
  3535. case 1:
  3536. if (zend_get_parameters_ex(1, &arg1) == FAILURE)
  3537. WRONG_PARAM_COUNT;
  3538. srcobj = (const HW_API_Object *) php_hwapi_get_object(*arg1, le_hwapi_objectp);
  3539. obj = new HW_API_Object(*srcobj);
  3540. break;
  3541. default:
  3542. WRONG_PARAM_COUNT;
  3543. }
  3544. rv = php_hwapi_object_new(obj, le_hwapi_objectp);
  3545. //zend_print_pval_r(rv, 0);
  3546. SEPARATE_ZVAL(&rv);
  3547. *return_value = *rv;
  3548. FREE_ZVAL(rv);
  3549. }
  3550. /* }}} */
  3551. /* {{{ proto string hwapi_object_count()
  3552. Counts number of attributes of an HW_API_Object */
  3553. PHP_FUNCTION(hwapi_object_count) {
  3554. zval *id, **tmp;
  3555. HW_API_Object *objp;
  3556. int value;
  3557. id = getThis();
  3558. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3559. if(!objp) {
  3560. RETURN_FALSE;
  3561. }
  3562. value = objp->count();
  3563. RETURN_LONG(value);
  3564. }
  3565. /* }}} */
  3566. /* {{{ proto string hwapi_object_title(string language)
  3567. Returns title of HW_API_Object for given language */
  3568. PHP_FUNCTION(hwapi_object_title) {
  3569. zval **arg1, *id, **tmp;
  3570. HW_API_Object *objp;
  3571. char *value;
  3572. if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3573. WRONG_PARAM_COUNT;
  3574. }
  3575. id = getThis();
  3576. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3577. convert_to_string_ex(arg1);
  3578. // Warning: It is import to duplicate the string before RETURN.
  3579. // If that is not done the HW_API_String destructor will be called
  3580. // before RETURN_STRING can duplicate the string.
  3581. value = (char *) estrdup(objp->title(Z_STRVAL_PP(arg1)).string());
  3582. RETURN_STRING(value, 0);
  3583. }
  3584. /* }}} */
  3585. /* {{{ proto string hwapi_object_attreditable(int attr, string username, bool is_system)
  3586. Hyperwave object_attreditable function */
  3587. PHP_FUNCTION(hwapi_object_attreditable) {
  3588. zval *id, **arg1, **arg2, **arg3;
  3589. HW_API_Object *objp;
  3590. HW_API_Attribute *attrp;
  3591. bool value;
  3592. if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
  3593. WRONG_PARAM_COUNT;
  3594. }
  3595. id = getThis();
  3596. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3597. convert_to_string_ex(arg2);
  3598. convert_to_long_ex(arg3);
  3599. switch(Z_TYPE_PP(arg1)) {
  3600. case IS_STRING:
  3601. convert_to_string_ex(arg1);
  3602. value = objp->attributeEditable((char *) Z_STRVAL_PP(arg1), (char *) Z_STRVAL_PP(arg2), (bool) Z_LVAL_PP(arg3));
  3603. break;
  3604. case IS_OBJECT:
  3605. attrp = (HW_API_Attribute *) php_hwapi_get_object(*arg1, le_hwapi_attributep);
  3606. value = objp->attributeEditable(*attrp, (char *) Z_STRVAL_PP(arg2), (bool) Z_LVAL_PP(arg3));
  3607. break;
  3608. }
  3609. if(value) {
  3610. RETURN_TRUE;
  3611. } else {
  3612. RETURN_FALSE;
  3613. }
  3614. }
  3615. /* }}} */
  3616. /* {{{ proto object hwapi_object_assign(int object)
  3617. Hyperwave object_assign function */
  3618. PHP_FUNCTION(hwapi_object_assign) {
  3619. zval *id, **arg1, **arg2;
  3620. printf("hwapi_object_assign\n");
  3621. RETURN_TRUE;
  3622. }
  3623. /* }}} */
  3624. /* {{{ proto string hwapi_object_attribute(int index, object &attribute)
  3625. Hyperwave object_attribute function */
  3626. PHP_FUNCTION(hwapi_object_attribute) {
  3627. zval **arg1, *id, *rv;
  3628. HW_API_Attribute *attrp, attr;
  3629. HW_API_Object *objp;
  3630. int error;
  3631. if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3632. WRONG_PARAM_COUNT;
  3633. }
  3634. id = getThis();
  3635. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3636. if(!objp) {
  3637. RETURN_FALSE;
  3638. }
  3639. switch(Z_TYPE_PP(arg1)) {
  3640. case IS_LONG:
  3641. error = objp->attribute(Z_LVAL_PP(arg1), attr);
  3642. break;
  3643. case IS_STRING:
  3644. error = objp->attribute(HW_API_String(Z_STRVAL_PP(arg1)), attr);
  3645. break;
  3646. default:
  3647. php_error_docref(NULL TSRMLS_CC, E_WARNING, "HW_API_Object::attribute() needs string or long as parameter");
  3648. RETURN_FALSE;
  3649. }
  3650. if(error) {
  3651. attrp = new HW_API_Attribute(attr);
  3652. rv = php_hwapi_object_new(attrp, le_hwapi_attributep);
  3653. SEPARATE_ZVAL(&rv);
  3654. *return_value = *rv;
  3655. FREE_ZVAL(rv);
  3656. return;
  3657. } else {
  3658. RETURN_FALSE;
  3659. }
  3660. }
  3661. /* }}} */
  3662. /* {{{ proto string hwapi_object_insert(object attr)
  3663. Inserts new HW_API_Attribute into HW_API_Object */
  3664. PHP_FUNCTION(hwapi_object_insert) {
  3665. zval **arg1, *id;
  3666. HW_API_Object *objp;
  3667. HW_API_Attribute *attrp;
  3668. char *value;
  3669. if (ZEND_NUM_ARGS() != 1 || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
  3670. WRONG_PARAM_COUNT;
  3671. }
  3672. id = getThis();
  3673. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3674. if(!objp) {
  3675. RETURN_FALSE;
  3676. }
  3677. attrp = (HW_API_Attribute *) php_hwapi_get_object(*arg1, le_hwapi_attributep);
  3678. objp->insert(*attrp);
  3679. RETURN_TRUE;
  3680. }
  3681. /* }}} */
  3682. /* {{{ proto string hwapi_object_remove(string name)
  3683. Removes HW_API_Attribute with given name from HW_API_Object */
  3684. PHP_FUNCTION(hwapi_object_remove) {
  3685. zval **arg1, *id, **tmp;
  3686. HW_API_Object *objp;
  3687. int error;
  3688. if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3689. WRONG_PARAM_COUNT;
  3690. }
  3691. convert_to_string_ex(arg1);
  3692. id = getThis();
  3693. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3694. if(!objp) {
  3695. RETURN_FALSE;
  3696. }
  3697. error = objp->remove(Z_STRVAL_PP(arg1));
  3698. if(!error) {
  3699. RETURN_TRUE;
  3700. } else {
  3701. RETURN_FALSE;
  3702. }
  3703. }
  3704. /* }}} */
  3705. /* {{{ proto string hwapi_object_value(string name)
  3706. Returns attribute value of given attribute */
  3707. PHP_FUNCTION(hwapi_object_value) {
  3708. zval **arg1, *id;
  3709. HW_API_Object *objp;
  3710. HW_API_Attribute *attrp;
  3711. HW_API_String value;
  3712. int error;
  3713. if ((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3714. WRONG_PARAM_COUNT;
  3715. }
  3716. convert_to_string_ex(arg1);
  3717. id = getThis();
  3718. objp = (HW_API_Object *) php_hwapi_get_object(id, le_hwapi_objectp);
  3719. if(!objp) {
  3720. RETURN_FALSE;
  3721. }
  3722. error = objp->value((HW_API_String) Z_STRVAL_PP(arg1), value);
  3723. printf("hwapi_object_value\n");
  3724. if(error) {
  3725. char *str = (char *) estrdup(value.string());
  3726. RETURN_STRING(str, 0);
  3727. } else {
  3728. RETURN_FALSE;
  3729. }
  3730. }
  3731. /* }}} */
  3732. /* {{{ proto string hwapi_attribute_new([string name][, string value])
  3733. Creates new HW_API_Attribute */
  3734. PHP_FUNCTION(hwapi_attribute_new) {
  3735. zval *rv, **arg1, **arg2;
  3736. HW_API_Attribute *attrp;
  3737. int ret;
  3738. /* FIXME: I'm not sure if the constructor of HW_API_Attribute takes normal C-Strings
  3739. * or if it has to be HW_API_String. Currently C-Strings are passed.
  3740. */
  3741. switch(ZEND_NUM_ARGS()) {
  3742. case 0:
  3743. break;
  3744. attrp = new HW_API_Attribute();
  3745. case 1:
  3746. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3747. WRONG_PARAM_COUNT;
  3748. }
  3749. convert_to_string_ex(arg1);
  3750. attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1));
  3751. break;
  3752. case 2: //* FIXME: Second Parameter can be string or array of strings
  3753. if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
  3754. WRONG_PARAM_COUNT;
  3755. }
  3756. convert_to_string_ex(arg1);
  3757. switch((*arg2)->type) {
  3758. case IS_ARRAY: {
  3759. HashTable *lht = (*arg2)->value.ht;
  3760. int i, count;
  3761. HW_API_StringArray values;
  3762. if(NULL == lht)
  3763. RETURN_FALSE;
  3764. if(0 == (count = zend_hash_num_elements(lht))) {
  3765. attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1));
  3766. break;
  3767. }
  3768. zend_hash_internal_pointer_reset(lht);
  3769. for(i=0; i<count; i++) {
  3770. zval *keydata, **keydataptr;
  3771. zend_hash_get_current_data(lht, (void **) &keydataptr);
  3772. /* FIXME: just hope this doesn't do any harm. Maybe convert_to_string
  3773. * changes the type of the array element */
  3774. convert_to_string_ex(keydataptr);
  3775. keydata = *keydataptr;
  3776. values.insert(keydata->value.str.val);
  3777. zend_hash_move_forward(lht);
  3778. }
  3779. attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1), values);
  3780. break;
  3781. }
  3782. default:
  3783. convert_to_string_ex(arg2);
  3784. attrp = new HW_API_Attribute(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2));
  3785. }
  3786. break;
  3787. default:
  3788. WRONG_PARAM_COUNT;
  3789. }
  3790. rv = php_hwapi_object_new(attrp, le_hwapi_attributep);
  3791. SEPARATE_ZVAL(&rv);
  3792. *return_value = *rv;
  3793. FREE_ZVAL(rv);
  3794. printf("hwapi_attribute_new\n");
  3795. }
  3796. /* }}} */
  3797. /* {{{ proto string hwapi_attribute_key()
  3798. Returns key of an hwapi_attribute */
  3799. PHP_FUNCTION(hwapi_attribute_key) {
  3800. zval *id;
  3801. HW_API_Attribute *attrp;
  3802. char *value;
  3803. id = getThis();
  3804. attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
  3805. // Warning: It is import to duplicate the string before RETURN.
  3806. // If that is not done the HW_API_String destructor will be called
  3807. // before RETURN_STRING can duplicate the string.
  3808. value = (char *) estrdup((attrp->key()).string());
  3809. RETURN_STRING(value, 0);
  3810. }
  3811. /* }}} */
  3812. /* {{{ proto string hwapi_attribute_value()
  3813. Returns value of hw_api_attribute */
  3814. PHP_FUNCTION(hwapi_attribute_value) {
  3815. zval *id;
  3816. HW_API_Attribute *attrp;
  3817. char *value;
  3818. id = getThis();
  3819. attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
  3820. // Warning: It is import to duplicate the string before RETURN.
  3821. // If that is not done the HW_API_String destructor will be called
  3822. // before RETURN_STRING can duplicate the string.
  3823. value = (char *) estrdup(attrp->value().string());
  3824. RETURN_STRING(value, 0);
  3825. }
  3826. /* }}} */
  3827. /* {{{ proto string hwapi_attribute_values()
  3828. Returns all values of an attribute as an array */
  3829. PHP_FUNCTION(hwapi_attribute_values) {
  3830. zval *id, **tmp;
  3831. HW_API_Attribute *attrp;
  3832. HW_API_StringArray values;
  3833. id = getThis();
  3834. attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
  3835. values = attrp->values();
  3836. if(0 == stringArray2indexArray(&return_value, &values))
  3837. RETURN_FALSE;
  3838. }
  3839. /* }}} */
  3840. /* {{{ proto string hwapi_attribute_langdepvalue(string language)
  3841. Returns value of attribute with givenn language */
  3842. PHP_FUNCTION(hwapi_attribute_langdepvalue) {
  3843. zval **arg1, *id, **tmp;
  3844. HW_API_Attribute *attrp;
  3845. char *value;
  3846. if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
  3847. WRONG_PARAM_COUNT;
  3848. }
  3849. convert_to_string_ex(arg1);
  3850. id = getThis();
  3851. attrp = (HW_API_Attribute *) php_hwapi_get_object(id, le_hwapi_attributep);
  3852. value = (char *) attrp->langDepValue((*arg1)->value.str.val).string();
  3853. printf("hwapi_attribute_langdepvalue\n");
  3854. RETURN_STRING(value, 1);
  3855. }
  3856. /* }}} */
  3857. /* {{{ proto string hwapi_content_new([string name][, string value])
  3858. Creates new HW_API_Content */
  3859. PHP_FUNCTION(hwapi_content_new) {
  3860. zval *rv, **arg1, **arg2, **arg3;
  3861. HW_API_Content *contp;
  3862. int ret;
  3863. switch(ZEND_NUM_ARGS()) {
  3864. case 0:
  3865. contp = new HW_API_Content();
  3866. break;
  3867. case 1:
  3868. if (zend_get_parameters_ex(1, &arg1) == FAILURE) {
  3869. WRONG_PARAM_COUNT;
  3870. }
  3871. switch((*arg1)->type) {
  3872. case IS_OBJECT:
  3873. break;
  3874. default:
  3875. convert_to_string_ex(arg1);
  3876. contp = new HW_API_Content(Z_STRVAL_PP(arg1));
  3877. }
  3878. break;
  3879. case 2: //First Parameter is long, second the file name
  3880. if (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
  3881. WRONG_PARAM_COUNT;
  3882. }
  3883. convert_to_long_ex(arg1);
  3884. convert_to_string_ex(arg2);
  3885. contp = new HW_API_Content(HW_API_Content::File, Z_STRVAL_PP(arg2));
  3886. break;
  3887. case 3: //First Parameter is long or string, second and third is string
  3888. if (zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
  3889. WRONG_PARAM_COUNT;
  3890. }
  3891. switch((*arg1)->type) {
  3892. case IS_LONG:
  3893. convert_to_string_ex(arg2);
  3894. convert_to_string_ex(arg3);
  3895. contp = new HW_API_Content(HW_API_Content::File, Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
  3896. break;
  3897. default:
  3898. convert_to_string_ex(arg1);
  3899. convert_to_string_ex(arg2);
  3900. convert_to_string_ex(arg3);
  3901. contp = new HW_API_Content(Z_STRVAL_PP(arg1), Z_STRVAL_PP(arg2), Z_STRVAL_PP(arg3));
  3902. }
  3903. break;
  3904. default:
  3905. WRONG_PARAM_COUNT;
  3906. }
  3907. rv = php_hwapi_object_new(contp, le_hwapi_contentp);
  3908. SEPARATE_ZVAL(&rv);
  3909. *return_value = *rv;
  3910. FREE_ZVAL(rv);
  3911. }
  3912. /* }}} */
  3913. /* {{{ proto string hwapi_content_read(string buffer, int length)
  3914. Reads length bytes from content */
  3915. PHP_FUNCTION(hwapi_content_read) {
  3916. zval **arg1, **arg2, *id, **tmp;
  3917. HW_API_Content *contentp;
  3918. char *value;
  3919. int len;
  3920. if((ZEND_NUM_ARGS() != 2) || (zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE)) {
  3921. WRONG_PARAM_COUNT;
  3922. }
  3923. convert_to_long_ex(arg2);
  3924. id = getThis();
  3925. contentp = (HW_API_Content *) php_hwapi_get_object(id, le_hwapi_contentp);
  3926. zval_dtor(*arg1);
  3927. Z_TYPE_PP(arg1) = IS_STRING;
  3928. /* FIXME: Need to finish the new zval */
  3929. value = (char *) emalloc(Z_LVAL_PP(arg2)+1);
  3930. Z_STRVAL_PP(arg1) = value;
  3931. len = contentp->read(value, Z_LVAL_PP(arg2));
  3932. value[len] = '\0';
  3933. Z_STRLEN_PP(arg1) = len;
  3934. RETURN_LONG(len);
  3935. }
  3936. /* }}} */
  3937. /* {{{ proto string hwapi_content_mimetype()
  3938. Returns MimeType of document */
  3939. PHP_FUNCTION(hwapi_content_mimetype) {
  3940. zval *id;
  3941. HW_API_Content *contentp;
  3942. HW_API_String hwstr;
  3943. id = getThis();
  3944. contentp = (HW_API_Content *) php_hwapi_get_object(id, le_hwapi_contentp);
  3945. hwstr = contentp->mimetype();
  3946. RETURN_STRING((char *) hwstr.string(), 1);
  3947. }
  3948. /* }}} */
  3949. /* {{{ proto string hwapi_error_count()
  3950. Counts number of reasons of an HW_API_Error */
  3951. PHP_FUNCTION(hwapi_error_count) {
  3952. zval *id, **tmp;
  3953. HW_API_Error *objp;
  3954. int value;
  3955. id = getThis();
  3956. objp = (HW_API_Error *) php_hwapi_get_object(id, le_hwapi_errorp);
  3957. if(!objp) {
  3958. RETURN_FALSE;
  3959. }
  3960. value = objp->count();
  3961. RETURN_LONG(value);
  3962. }
  3963. /* }}} */
  3964. /* {{{ proto string hwapi_error_reason(int index)
  3965. Returns a reason of an HW_API_Error */
  3966. PHP_FUNCTION(hwapi_error_reason) {
  3967. zval **arg1, *id, **tmp;
  3968. HW_API_Error *objp;
  3969. HW_API_Reason reason;
  3970. bool error;
  3971. if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
  3972. WRONG_PARAM_COUNT;
  3973. }
  3974. convert_to_long_ex(arg1);
  3975. id = getThis();
  3976. objp = (HW_API_Error *) php_hwapi_get_object(id, le_hwapi_errorp);
  3977. if(!objp) {
  3978. RETURN_FALSE;
  3979. }
  3980. if(!objp->error())
  3981. php_error_docref(NULL TSRMLS_CC, E_WARNING, "This is not an error");
  3982. error = objp->reason(Z_LVAL_PP(arg1), reason);
  3983. if(error) {
  3984. zval *rv;
  3985. HW_API_Reason *reasonp = new HW_API_Reason(reason);
  3986. rv = php_hwapi_object_new(reasonp, le_hwapi_reasonp);
  3987. SEPARATE_ZVAL(&rv);
  3988. *return_value = *rv;
  3989. FREE_ZVAL(rv);
  3990. return;
  3991. } else {
  3992. RETURN_FALSE;
  3993. }
  3994. }
  3995. /* }}} */
  3996. /* {{{ proto string hwapi_reason_type()
  3997. Returns the type of HW_API_Reason */
  3998. PHP_FUNCTION(hwapi_reason_type) {
  3999. zval **arg1, *id, **tmp;
  4000. HW_API_Reason *objp;
  4001. id = getThis();
  4002. objp = (HW_API_Reason *) php_hwapi_get_object(id, le_hwapi_reasonp);
  4003. if(!objp) {
  4004. RETURN_FALSE;
  4005. }
  4006. RETURN_LONG((long) (objp->type()));
  4007. }
  4008. /* }}} */
  4009. /* {{{ proto string hwapi_reason_description(string language)
  4010. Returns description of HW_API_Reason */
  4011. PHP_FUNCTION(hwapi_reason_description) {
  4012. zval **arg1, *id, **tmp;
  4013. HW_API_Reason *objp;
  4014. HW_API_String desc;
  4015. if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &arg1) == FAILURE)) {
  4016. WRONG_PARAM_COUNT;
  4017. }
  4018. convert_to_string_ex(arg1);
  4019. id = getThis();
  4020. objp = (HW_API_Reason *) php_hwapi_get_object(id, le_hwapi_reasonp);
  4021. if(!objp) {
  4022. RETURN_FALSE;
  4023. }
  4024. desc = objp->description((HW_API_String) (Z_STRVAL_PP(arg1)));
  4025. RETURN_STRING((char *) desc.string(), 1);
  4026. }
  4027. /* }}} */
  4028. /* hw_api_class_get_property(zend_property_reference *property_reference) {{{
  4029. *
  4030. */
  4031. pval hw_api_class_get_property(zend_property_reference *property_reference) {
  4032. pval result;
  4033. zend_overloaded_element *overloaded_property;
  4034. zend_llist_element *element;
  4035. printf("Reading a property from a HW_API object:\n");
  4036. for (element=property_reference->elements_list->head; element; element=element->next) {
  4037. overloaded_property = (zend_overloaded_element *) element->data;
  4038. switch (Z_TYPE_P(overloaded_property)) {
  4039. case OE_IS_ARRAY:
  4040. printf("Array offset: ");
  4041. break;
  4042. case OE_IS_OBJECT:
  4043. printf("Object property: ");
  4044. break;
  4045. }
  4046. switch (Z_TYPE(overloaded_property->element)) {
  4047. case IS_LONG:
  4048. printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
  4049. break;
  4050. case IS_STRING:
  4051. printf("'%s'\n", Z_STRVAL(overloaded_property->element));
  4052. break;
  4053. }
  4054. pval_destructor(&overloaded_property->element);
  4055. }
  4056. Z_STRVAL(result) = estrndup("testing", 7);
  4057. Z_STRLEN(result) = 7;
  4058. Z_TYPE(result) = IS_STRING;
  4059. return result;
  4060. }
  4061. /* }}} */
  4062. /* hw_api_class_set_property(zend_property_reference *property_reference, pval *value) {{{
  4063. */
  4064. int hw_api_class_set_property(zend_property_reference *property_reference, pval *value) {
  4065. zend_overloaded_element *overloaded_property;
  4066. zend_llist_element *element;
  4067. printf("Writing to a property from a HW_API object:\n");
  4068. printf("Writing '");
  4069. zend_print_variable(value);
  4070. printf("'\n");
  4071. for (element=property_reference->elements_list->head; element; element=element->next) {
  4072. overloaded_property = (zend_overloaded_element *) element->data;
  4073. switch (Z_TYPE_P(overloaded_property)) {
  4074. case OE_IS_ARRAY:
  4075. printf("Array offset: ");
  4076. break;
  4077. case OE_IS_OBJECT:
  4078. printf("Object property: ");
  4079. break;
  4080. }
  4081. switch (Z_TYPE(overloaded_property->element)) {
  4082. case IS_LONG:
  4083. printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
  4084. break;
  4085. case IS_STRING:
  4086. printf("'%s'\n", Z_STRVAL(overloaded_property->element));
  4087. break;
  4088. }
  4089. pval_destructor(&overloaded_property->element);
  4090. }
  4091. return 0;
  4092. }
  4093. /* }}} */
  4094. /* hw_api_class_startup() {{{
  4095. */
  4096. void hw_api_class_startup() {
  4097. zend_class_entry ce;
  4098. INIT_OVERLOADED_CLASS_ENTRY(ce, "HW_API", php_hw_api_functions,
  4099. NULL,
  4100. NULL,
  4101. NULL);
  4102. hw_api_class_entry_ptr = zend_register_internal_class_ex(&ce, NULL, NULL);
  4103. }
  4104. /* }}} */
  4105. /* hw_api_object_class_get_property(zend_property_reference *property_reference) {{{
  4106. */
  4107. pval hw_api_object_class_get_property(zend_property_reference *property_reference) {
  4108. pval result;
  4109. zend_overloaded_element *overloaded_property;
  4110. zend_llist_element *element;
  4111. printf("Reading a property from a HW_API_Object object:\n");
  4112. for (element=property_reference->elements_list->head; element; element=element->next) {
  4113. overloaded_property = (zend_overloaded_element *) element->data;
  4114. switch (Z_TYPE_P(overloaded_property)) {
  4115. case OE_IS_ARRAY:
  4116. printf("Array offset: ");
  4117. break;
  4118. case OE_IS_OBJECT:
  4119. printf("Object property: ");
  4120. break;
  4121. }
  4122. switch (Z_TYPE(overloaded_property->element)) {
  4123. case IS_LONG:
  4124. printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
  4125. break;
  4126. case IS_STRING:
  4127. printf("'%s'\n", Z_STRVAL(overloaded_property->element));
  4128. break;
  4129. }
  4130. pval_destructor(&overloaded_property->element);
  4131. }
  4132. Z_STRVAL(result) = estrndup("testing", 7);
  4133. Z_STRLEN(result) = 7;
  4134. Z_TYPE(result) = IS_STRING;
  4135. return result;
  4136. }
  4137. /* }}} */
  4138. /* hw_api_object_class_set_property(zend_property_reference *property_reference, pval *value) {{{
  4139. */
  4140. int hw_api_object_class_set_property(zend_property_reference *property_reference, pval *value) {
  4141. zend_overloaded_element *overloaded_property;
  4142. zend_llist_element *element;
  4143. printf("Writing to a property from a HW_API_Object object:\n");
  4144. printf("Writing '");
  4145. zend_print_variable(value);
  4146. printf("'\n");
  4147. for (element=property_reference->elements_list->head; element; element=element->next) {
  4148. overloaded_property = (zend_overloaded_element *) element->data;
  4149. switch (Z_TYPE_P(overloaded_property)) {
  4150. case OE_IS_ARRAY:
  4151. printf("Array offset: ");
  4152. break;
  4153. case OE_IS_OBJECT:
  4154. printf("Object property: ");
  4155. break;
  4156. }
  4157. switch (Z_TYPE(overloaded_property->element)) {
  4158. case IS_LONG:
  4159. printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
  4160. break;
  4161. case IS_STRING:
  4162. printf("'%s'\n", Z_STRVAL(overloaded_property->element));
  4163. break;
  4164. }
  4165. pval_destructor(&overloaded_property->element);
  4166. }
  4167. return 0;
  4168. }
  4169. /* }}} */
  4170. /* {{{ hw_api_object_class_startup()
  4171. */
  4172. void hw_api_object_class_startup() {
  4173. zend_class_entry ce;
  4174. INIT_OVERLOADED_CLASS_ENTRY(ce, "hw_api_object", php_hw_api_object_functions,
  4175. NULL,
  4176. NULL,
  4177. NULL);
  4178. hw_api_object_class_entry_ptr = zend_register_internal_class_ex(&ce, NULL, NULL);
  4179. }
  4180. /* }}} */
  4181. /* hw_api_attribute_class_get_property(zend_property_reference *property_reference) {{{
  4182. */
  4183. pval hw_api_attribute_class_get_property(zend_property_reference *property_reference) {
  4184. pval result;
  4185. zend_overloaded_element *overloaded_property;
  4186. zend_llist_element *element;
  4187. printf("Reading a property from a HW_API_Attribute object:\n");
  4188. for (element=property_reference->elements_list->head; element; element=element->next) {
  4189. overloaded_property = (zend_overloaded_element *) element->data;
  4190. switch (Z_TYPE_P(overloaded_property)) {
  4191. case OE_IS_ARRAY:
  4192. printf("Array offset: ");
  4193. break;
  4194. case OE_IS_OBJECT:
  4195. printf("Object property: ");
  4196. break;
  4197. }
  4198. switch (Z_TYPE(overloaded_property->element)) {
  4199. case IS_LONG:
  4200. printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
  4201. break;
  4202. case IS_STRING:
  4203. printf("'%s'\n", Z_STRVAL(overloaded_property->element));
  4204. break;
  4205. }
  4206. pval_destructor(&overloaded_property->element);
  4207. }
  4208. Z_STRVAL(result) = estrndup("testing", 7);
  4209. Z_STRLEN(result) = 7;
  4210. Z_TYPE(result) = IS_STRING;
  4211. return result;
  4212. }
  4213. /* }}} */
  4214. /* hw_api_attribute_class_set_property(zend_property_reference *property_reference, pval *value) {{{
  4215. */
  4216. int hw_api_attribute_class_set_property(zend_property_reference *property_reference, pval *value) {
  4217. zend_overloaded_element *overloaded_property;
  4218. zend_llist_element *element;
  4219. printf("Writing to a property from a HW_API_Attribute object:\n");
  4220. printf("Writing '");
  4221. zend_print_variable(value);
  4222. printf("'\n");
  4223. for (element=property_reference->elements_list->head; element; element=element->next) {
  4224. overloaded_property = (zend_overloaded_element *) element->data;
  4225. switch (Z_TYPE_P(overloaded_property)) {
  4226. case OE_IS_ARRAY:
  4227. printf("Array offset: ");
  4228. break;
  4229. case OE_IS_OBJECT:
  4230. printf("Object property: ");
  4231. break;
  4232. }
  4233. switch (Z_TYPE(overloaded_property->element)) {
  4234. case IS_LONG:
  4235. printf("%ld (numeric)\n", Z_LVAL(overloaded_property->element));
  4236. break;
  4237. case IS_STRING:
  4238. printf("'%s'\n", Z_STRVAL(overloaded_property->element));
  4239. break;
  4240. }
  4241. pval_destructor(&overloaded_property->element);
  4242. }
  4243. return 0;
  4244. }
  4245. /* }}} */
  4246. /* hw_api_attribute_class_startup() {{{
  4247. */
  4248. void hw_api_attribute_class_startup() {
  4249. zend_class_entry hw_api_attribute_class_entry;
  4250. INIT_OVERLOADED_CLASS_ENTRY(hw_api_attribute_class_entry, "HW_API_Attribute", php_hw_api_attribute_functions,
  4251. NULL,
  4252. NULL,
  4253. NULL);
  4254. hw_api_attribute_class_entry_ptr = zend_register_internal_class(&hw_api_attribute_class_entry);
  4255. }
  4256. /* }}} */
  4257. /* hw_api_error_class_startup() {{{
  4258. */
  4259. void hw_api_error_class_startup() {
  4260. zend_class_entry hw_api_error_class_entry;
  4261. INIT_OVERLOADED_CLASS_ENTRY(hw_api_error_class_entry, "HW_API_Error", php_hw_api_error_functions,
  4262. NULL,
  4263. NULL,
  4264. NULL);
  4265. hw_api_error_class_entry_ptr = zend_register_internal_class(&hw_api_error_class_entry);
  4266. }
  4267. /* }}} */
  4268. /* hw_api_content_class_startup() {{{
  4269. */
  4270. void hw_api_content_class_startup() {
  4271. zend_class_entry hw_api_content_class_entry;
  4272. INIT_OVERLOADED_CLASS_ENTRY(hw_api_content_class_entry, "HW_API_Content", php_hw_api_content_functions,
  4273. NULL,
  4274. NULL,
  4275. NULL);
  4276. hw_api_content_class_entry_ptr = zend_register_internal_class(&hw_api_content_class_entry);
  4277. }
  4278. /* }}} */
  4279. /* hw_api_reason_class_startup() {{{
  4280. */
  4281. void hw_api_reason_class_startup() {
  4282. zend_class_entry hw_api_reason_class_entry;
  4283. INIT_OVERLOADED_CLASS_ENTRY(hw_api_reason_class_entry, "HW_API_Reason", php_hw_api_reason_functions,
  4284. NULL,
  4285. NULL,
  4286. NULL);
  4287. hw_api_reason_class_entry_ptr = zend_register_internal_class(&hw_api_reason_class_entry);
  4288. }
  4289. /* }}} */
  4290. #endif
  4291. /*
  4292. * Local variables:
  4293. * tab-width: 4
  4294. * c-basic-offset: 4
  4295. * End:
  4296. */