CVS update: php3/functions

From: Date: Wed, 11 Nov 1998 17:42:27 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2338@lists.php.net to get a copy of this message
Date: Wednesday November 11, 1998 @ 12:42 Author: steinm Update of /repository/php3/functions In directory asf:/u2/tmp/cvs-serv9905/functions Modified Files: hw.c Log Message: - added protoypes for each function - bugfixes - hw-docbyanchorobj() returns string now Index: php3/functions/hw.c diff -c php3/functions/hw.c:1.14 php3/functions/hw.c:1.15 *** php3/functions/hw.c:1.14 Fri Oct 9 03:56:09 1998 --- php3/functions/hw.c Wed Nov 11 12:42:26 1998 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.14 1998/10/09 07:56:09 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hw.c,v 1.15 1998/11/11 17:42:26 steinm Exp $ */ #if COMPILE_DL #include "dl/phpdl.h" #endif *************** *** 672,687 **** --- 672,695 ---- efree(userdata); } + /* Start of user level functions */ + /* ***************************** */ + /* {{{ proto int hw_connect(string host, int port [string username [, string password]]) + Connect to the Hyperwave server */ void php3_hw_connect(INTERNAL_FUNCTION_PARAMETERS) { php3_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } + /* {{{ proto int hw_pconnect(string host, int port [string username [, string password]]) + Connect to the Hyperwave server persistent */ void php3_hw_pconnect(INTERNAL_FUNCTION_PARAMETERS) { php3_hw_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } + /* {{{ proto void hw_close(int link) + Close connection to Hyperwave server */ void php3_hw_close(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; *************** *** 702,707 **** --- 710,717 ---- RETURN_TRUE; } + /* {{{ proto void hw_info(int link) + Outputs info string */ void php3_hw_info(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; *************** *** 733,738 **** --- 743,750 ---- RETURN_FALSE; } + /* {{{ proto int hw_error(int link) + Returns last error number */ void php3_hw_error(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; *************** *** 753,758 **** --- 765,772 ---- RETURN_LONG(ptr->lasterror); } + /* {{{ proto string hw_errormsg(int link) + Returns last error message */ void php3_hw_errormsg(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; *************** *** 839,844 **** --- 853,860 ---- RETURN_STRING(errstr, 1); } + /* {{{ proto hw_root(void) + Returns object id of root collection */ void php3_hw_root(INTERNAL_FUNCTION_PARAMETERS) { TLS_VARS; *************** *** 873,878 **** --- 889,896 ---- } } + /* {{{ proto string hw_stat(int link) + Returns status string */ void php3_hw_stat(INTERNAL_FUNCTION_PARAMETERS) { char *object; *************** *** 885,890 **** --- 903,910 ---- return_value->type = IS_STRING; } + /* {{{ proto array hw_who(int link) + Returns names and info of users loged in */ void php3_hw_who(INTERNAL_FUNCTION_PARAMETERS) { pval user_arr; char *object, *ptr, *temp, *attrname; *************** *** 1027,1032 **** --- 1047,1054 ---- } } + /* {{{ proto string hw_getobject(int link, int objid) + Returns object record */ void php3_hw_getobject(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1060,1065 **** --- 1082,1089 ---- } } + /* {{{ proto int hw_insertobject(int link, string objrec, string parms) + Inserts an object */ void php3_hw_insertobject(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; int link, type; *************** *** 1092,1097 **** --- 1116,1123 ---- } } + /* {{{ proto string hw_getandlock(int link, int objid) + Returns object record and locks object */ void php3_hw_getandlock(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1118,1142 **** if (0 != (ptr->lasterror = send_getandlock(ptr->socket, id, &object))) RETURN_FALSE; ! if (array_init(return_value) == FAILURE) { ! php3_error(E_ERROR, "Unable to initialize array"); ! efree(object); ! RETURN_FALSE; ! } ! attrname = strtok(object, "\n"); ! while(attrname != NULL) { ! str = attrname; ! while((*str != '=') && (*str != '\0')) ! str++; ! *str = '\0'; ! str++; ! add_assoc_string(return_value, attrname, str, 1); ! attrname = strtok(NULL, "\n"); ! } ! efree(object); } } void php3_hw_unlock(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; --- 1144,1155 ---- if (0 != (ptr->lasterror = send_getandlock(ptr->socket, id, &object))) RETURN_FALSE; ! RETURN_STRING(object, 0); } } + /* {{{ proto void hw_unlock(int link, int objid) + Unlocks object */ void php3_hw_unlock(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1163,1168 **** --- 1176,1183 ---- RETURN_TRUE; } + /* {{{ proto void hw_deleteobject(int link, int objid) + Deletes object */ void php3_hw_deleteobject(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1188,1193 **** --- 1203,1210 ---- RETURN_TRUE; } + /* {{{ proto void hw_changeobject(int link, int objid, array attributes) + Changes attributes of an object */ void php3_hw_changeobject(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; int link, id, type, i; *************** *** 1366,1379 **** --- 1383,1402 ---- RETURN_LONG(docIDcount + collIDcount); } + /* {{{ proto void hw_mv(int link, array objrec, int from, int dest) + Moves object */ void php3_hw_mv(INTERNAL_FUNCTION_PARAMETERS) { php3_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, MOVE); } + /* {{{ proto void hw_cp(int link, array objrec, int dest) + Copies object */ void php3_hw_cp(INTERNAL_FUNCTION_PARAMETERS) { php3_hw_mvcp(INTERNAL_FUNCTION_PARAM_PASSTHRU, COPY); } + /* {{{ proto hwdoc hw_gettext(int link, int objid[, int rootid]) + Returns text document. Links are relative to rootid if given */ void php3_hw_gettext(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[3]; int argc, link, id, type, mode; *************** *** 1423,1429 **** return_value->type = IS_LONG; } } ! void php3_hw_edittext(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, doc, type; --- 1446,1453 ---- return_value->type = IS_LONG; } } ! /* {{{ proto void hw_edittext(int link, hwdoc doc) ! Modifies text document */ void php3_hw_edittext(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, doc, type; *************** *** 1463,1468 **** --- 1487,1494 ---- RETURN_TRUE; } + /* {{{ proto hwdoc hw_getcgi(int link, int objid) + Returns the output of a cgi script */ void php3_hw_getcgi(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1522,1527 **** --- 1548,1555 ---- } } + /* {{{ proto hwdoc hw_getremote(int link, int objid) + Returns the output of a remote document */ void php3_hw_getremote(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1560,1565 **** --- 1588,1595 ---- } } + /* {{{ proto [array|hwdoc] hw_getremotechildren(int link, int objid) + Returns the remote document if only one or an array of object records */ void php3_hw_getremotechildren(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, type, i; *************** *** 1616,1621 **** --- 1646,1653 ---- } } + /* {{{ proto void hw_setlinkroot(int link, int rootid) + Set the id to which links are calculated */ void php3_hw_setlinkroot(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, type, rootid; *************** *** 1639,1644 **** --- 1671,1678 ---- RETURN_LONG(rootid); } + /* {{{ proto hwdoc hw_pipedocument(int link, int objid) + Returns document */ void php3_hw_pipedocument(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[3]; int link, id, type, argc, mode; *************** *** 1651,1657 **** TLS_VARS; argc = ARG_COUNT(ht); ! if((argc > 3) || (argc < 2)) WRONG_PARAM_COUNT; if (getParametersArray(ht, argc, argv) == FAILURE) --- 1685,1691 ---- TLS_VARS; argc = ARG_COUNT(ht); ! if((argc > 2) || (argc < 2)) WRONG_PARAM_COUNT; if (getParametersArray(ht, argc, argv) == FAILURE) *************** *** 1689,1695 **** #if APACHE serv->server_hostname, #else ! "localhost", #endif id, mode, rootid, &attributes, &bodytag, &object, &count))) RETURN_FALSE; --- 1723,1729 ---- #if APACHE serv->server_hostname, #else ! getenv("HOST"), #endif id, mode, rootid, &attributes, &bodytag, &object, &count))) RETURN_FALSE; *************** *** 1705,1710 **** --- 1739,1746 ---- } } + /* {{{ proto hwdoc hw_pipecgi(int link, int objid) + Returns output of cgi script */ void php3_hw_pipecgi(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 1751,1757 **** #if APACHE serv->server_hostname, #else ! "localhost", #endif id, cgi_env_str, &attributes, &object, &count))) RETURN_FALSE; --- 1787,1793 ---- #if APACHE serv->server_hostname, #else ! getenv("HOST"), #endif id, cgi_env_str, &attributes, &object, &count))) RETURN_FALSE; *************** *** 1766,1771 **** --- 1802,1809 ---- } } + /* {{{ proto void hw_insertdocument(int link, int parentid, hwdoc doc) + Insert new document */ void php3_hw_insertdocument(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; int link, id, doc, type; *************** *** 1796,1808 **** set_swap(ptr->swap_on); { ! if (0 != (ptr->lasterror = send_putdocument(ptr->socket, "localhost", id, docptr->attributes, docptr->data, docptr->size))) { RETURN_FALSE; } } RETURN_TRUE; } void php3_hw_new_document(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; hw_document *doc; --- 1834,1854 ---- set_swap(ptr->swap_on); { ! if (0 != (ptr->lasterror = send_putdocument(ptr->socket, ! #if APACHE ! serv->server_hostname, ! #else ! getenv("HOST"), ! #endif ! id, docptr->attributes, docptr->data, docptr->size))) { RETURN_FALSE; } } RETURN_TRUE; } + /* {{{ proto hwdoc hw_new_document(int link, string data, string objrec, int size) + Create a new document */ void php3_hw_new_document(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; hw_document *doc; *************** *** 1825,1830 **** --- 1871,1878 ---- return_value->type = IS_LONG; } + /* {{{ proto void hw_free_document(hwdoc doc) + Frees memory of document */ void php3_hw_free_document(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; *************** *** 1845,1850 **** --- 1893,1900 ---- RETURN_TRUE; } + /* {{{ proto void hw_output_document(hwdoc doc) + Prints document */ void php3_hw_output_document(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type, count; *************** *** 1875,1880 **** --- 1925,1932 ---- RETURN_TRUE; } + /* {{{ proto string hw_document_bodytag(hwdoc doc [, string prefix]) + Return bodytag prefixed by prefix */ void php3_hw_document_bodytag(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[2]; int id, type, argc; *************** *** 1913,1918 **** --- 1965,1972 ---- } } + /* {{{ proto string hw_document_content(hwdoc doc) + Returns content of document */ void php3_hw_document_content(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[1]; int id, type, argc; *************** *** 1937,1942 **** --- 1991,1998 ---- RETURN_STRING(ptr->data, 1); } + /* {{{ proto int hw_document_content(hwdoc doc) + Returns size of document */ void php3_hw_document_size(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; *************** *** 1957,1962 **** --- 2013,2020 ---- RETURN_LONG(ptr->size); } + /* {{{ proto string hw_document_content(hwdoc doc) + Returns object record of document */ void php3_hw_document_attributes(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int id, type; *************** *** 1978,1983 **** --- 2036,2043 ---- /* make_return_array_from_objrec(&return_value, ptr->attributes); */ } + /* {{{ proto array hw_getparentsobj(int link, int objid) + Returns array of parent object records */ void php3_hw_getparentsobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2011,2016 **** --- 2071,2078 ---- RETURN_FALSE; } + /* {{{ proto array hw_getparents(int link, int objid) + Returns array of parent object ids */ void php3_hw_getparents(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2054,2059 **** --- 2116,2123 ---- } + /* {{{ proto array hw_children(int link, int objid) + Returns array of children object ids */ void php3_hw_children(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2097,2102 **** --- 2161,2168 ---- } + /* {{{ proto array hw_children(int link, int objid) + Returns array of children object records */ void php3_hw_childrenobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2130,2135 **** --- 2196,2203 ---- RETURN_FALSE; } + /* {{{ proto array hw_childcoll(int link, int objid) + Returns array of child collection object ids */ void php3_hw_getchildcoll(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2173,2178 **** --- 2241,2248 ---- } + /* {{{ proto array hw_childcollobj(int link, int objid) + Returns array of child collection object records */ void php3_hw_getchildcollobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2206,2211 **** --- 2276,2283 ---- RETURN_FALSE; } + /* {{{ proto int hw_docbyanchor(int link, int anchorid) + Returns objid of document belonging to anchorid */ void php3_hw_docbyanchor(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2235,2240 **** --- 2307,2314 ---- } } + /* {{{ proto array hw_docbyanchorobj(int link, int anchorid) + Returns object record of document belonging to anchorid */ void php3_hw_docbyanchorobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2260,2270 **** --- 2334,2349 ---- if (0 != (ptr->lasterror = send_docbyanchorobj(ptr->socket, id, &object))) RETURN_FALSE; + RETURN_STRING(object, 0); + /* make_return_array_from_objrec(&return_value, object); efree(object); + */ } } + /* {{{ proto array hw_getobjectbyquery(int link, string query, int maxhits) + Search for query and return maxhits objids */ void php3_hw_getobjectbyquery(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; int link, type, maxhits; *************** *** 2306,2311 **** --- 2385,2392 ---- efree(childIDs); } + /* {{{ proto array hw_getobjectbyqueryobj(int link, string query, int maxhits) + Search for query and return maxhits object records */ void php3_hw_getobjectbyqueryobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; int link, type, maxhits; *************** *** 2342,2347 **** --- 2423,2430 ---- RETURN_FALSE; } + /* {{{ proto array hw_getobjectbyquerycoll(int link, int collid, string query, int maxhits) + Search for query in collection and return maxhits objids */ void php3_hw_getobjectbyquerycoll(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3, *arg4; int link, id, type, maxhits; *************** *** 2385,2390 **** --- 2468,2475 ---- efree(childIDs); } + /* {{{ proto array hw_getobjectbyquerycollobj(int link, int collid, string query, int maxhits) + Search for query in collection and return maxhits object records */ void php3_hw_getobjectbyquerycollobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3, *arg4; int link, id, type, maxhits; *************** *** 2423,2428 **** --- 2508,2515 ---- RETURN_FALSE; } + /* {{{ proto array hw_getchilddoccoll(int link, int objid) + Returns all children ids which are documents */ void php3_hw_getchilddoccoll(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2460,2465 **** --- 2547,2554 ---- efree(childIDs); } + /* {{{ proto array hw_getchilddoccollobj(int link, int objid) + Returns all children object records which are documents */ void php3_hw_getchilddoccollobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2493,2498 **** --- 2582,2589 ---- } + /* {{{ proto array hw_getanchors(int link, int objid) + Return all anchors of object */ void php3_hw_getanchors(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2530,2535 **** --- 2621,2628 ---- efree(anchorIDs); } + /* {{{ proto array hw_getanchorsobj(int link, int objid) + Return all object records of anchors of object */ void php3_hw_getanchorsobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, id, type; *************** *** 2562,2567 **** --- 2655,2662 ---- RETURN_FALSE; } + /* {{{ proto string hw_getusername(int link) + Returns the current user name */ void php3_hw_getusername(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; int link, type; *************** *** 2585,2590 **** --- 2680,2687 ---- } + /* {{{ proto void hw_identify(int link, string username, string password) + Identifies at Hyperwave server */ void php3_hw_identify(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; int link, type; *************** *** 2632,2637 **** --- 2729,2736 ---- } } + /* {{{ proto array hw_objrec2array(string objrec) + Returns object array of object record*/ void php3_hw_objrec2array(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; TLS_VARS; *************** *** 2643,2648 **** --- 2742,2749 ---- make_return_array_from_objrec(&return_value, arg1->value.str.val); } + /* {{{ proto string hw_array2objrec(array objarr) + Returns object record of object array */ void php3_hw_array2objrec(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1; char *objrec, *retobj; *************** *** 2661,2666 **** --- 2762,2769 ---- RETURN_FALSE; } + /* {{{ proto array hw_incollections(int link, array objids, array collids, int para) + Returns object ids which are in collections */ void php3_hw_incollections(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3, *arg4; int type, link, i; *************** *** 2720,2725 **** --- 2823,2830 ---- } + /* {{{ proto void hw_inscoll(int link, int parentid, array objarr) + Inserts collection */ void php3_hw_inscoll(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3; char *objrec; *************** *** 2756,2761 **** --- 2861,2868 ---- RETURN_LONG(newid); } + /* {{{ proto void hw_inscoll(int link, int parentid, array objarr [, string text]) + Inserts document */ void php3_hw_insdoc(INTERNAL_FUNCTION_PARAMETERS) { pval *argv[4]; char *objrec, *text; *************** *** 2796,2801 **** --- 2903,2910 ---- RETURN_LONG(newid); } + /* {{{ proto int hw_getsrcbydestobj(int link, int destid) + Returns object id of source docuent by destination anchor */ void php3_hw_getsrcbydestobj(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2; int link, type, id; *************** *** 2828,2833 **** --- 2937,2944 ---- RETURN_FALSE; } + /* {{{ proto string hw_getrellink(int link, int rootid, int sourceid, int destid) + Get link form source to dest relative to rootid */ void php3_hw_getrellink(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3, *arg4; int link, type; -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2338) next »