CVS update: php3/functions
| From: | steinm | Date: | Thu, 14 Jan 1999 17:47:50 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-3536@lists.php.net to get a copy of this message | ||
Date: Thursday January 14, 1999 @ 12:47
Author: steinm
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv4749/functions
Modified Files:
hg_comm.c hg_comm.h
Log Message:
- Hyperwave links with Position-field set to 'invisible' are now
handled properly
- hw_insertdocument() now returns the object id on success
Index: php3/functions/hg_comm.c
diff -c php3/functions/hg_comm.c:1.12 php3/functions/hg_comm.c:1.13
*** php3/functions/hg_comm.c:1.12 Tue Jan 12 12:36:18 1999
--- php3/functions/hg_comm.c Thu Jan 14 12:47:50 1999
***************
*** 23,29 ****
+----------------------------------------------------------------------+
*/
! /* $Id: hg_comm.c,v 1.12 1999/01/12 17:36:18 steinm Exp $ */
/* #define HW_DEBUG */
--- 23,29 ----
+----------------------------------------------------------------------+
*/
! /* $Id: hg_comm.c,v 1.13 1999/01/14 17:47:50 steinm Exp $ */
/* #define HW_DEBUG */
***************
*** 251,442 ****
docofanchorptr = docofanchorrec[i];
reldestptr = reldestrec[i];
! /* Determine Position. Doesn't matter if Src or Dest */
str = strstr(object, "Position");
str += 9;
! sscanf(str, "0x%X 0x%X", &start, &end);
!
! /* Determine ObjectID */
! objectID = 0;
! if(NULL != (str = strstr(object, "ObjectID"))) {
! str += 9;
! sscanf(str, "0x%X", &objectID);
! }
!
! cur_ptr = fnAddAnchor(pAnchorList, objectID, start, end);
!
! /* Determine Type of Anchor */
! str = strstr(object, "TAnchor");
! str += 8;
! if(*str == 'S') {
! char destdocname[200];
! char nameanchor[200];
! cur_ptr->tanchor = 1;
! cur_ptr->destdocname = NULL;
! if(NULL != (str = strstr(object, "Dest"))) {
! char *tempptr;
!
! /* No need to care about the value of Dest, because we take the info
! from docofanchorptr.
! Since the anchor has a destination there are two possibilities.
! 1. The destination is an anchor or
! 2. or the destination is a document already.
! In both cases docofanchorptr has the proper info because GETDOCBYANCHOR
! is such a nice message.
! */
! switch(anchormode) {
! case 0:
! tempptr = docofanchorptr;
! break;
! default:
! tempptr = reldestptr;
! }
! if(NULL != tempptr) {
! /* It's always nice to deal with names, so let's first check
! for a name. If there is none we take the ObjectID.
*/
! if(NULL != (str = strstr(tempptr, "Name="))) {
! str += 5;
! } else if(NULL != (str = strstr(tempptr, "ObjectID="))) {
! str += 9;
}
! if(sscanf(str, "%s\n", destdocname)) {
! cur_ptr->destdocname = estrdup(destdocname);
}
- destid = 0;
- if(NULL != (str = strstr(tempptr, "ObjectID="))) {
- str += 9;
- sscanf(str, "0x%X", &destid);
- }
}
! }
!
! /* Get the Id of the anchor destination and the document id that belongs
! to that anchor. We need that soon in order to determine if the anchor
! points to a document or a dest anchor in a document.
! */
! anchordestid = 0;
! if(NULL != (str = strstr(object, "Dest="))) {
! str += 5;
! sscanf(str, "0x%X", &anchordestid);
! }
!
! /* if anchordestid != destid then the destination is an anchor in a document whose
! name (objectID) is already in destdocname. We will have to extend the link
! by '#...'
! */
! cur_ptr->nameanchor = NULL;
! if(anchordestid != destid) {
if(NULL != (str = strstr(object, "Dest="))) {
str += 5;
! if(sscanf(str, "%s\n", nameanchor))
! cur_ptr->nameanchor = estrdup(nameanchor);
}
! }
!
! if(!cur_ptr->destdocname) {
! cur_ptr->link = NULL;
! if(NULL != (str = strstr(object, "Hint=URL:"))) {
! str += 9;
! if(sscanf(str, "%s\n", link))
! cur_ptr->link = estrdup(link);
! } else if(NULL != (str = strstr(object, "Hint="))) {
! str += 5;
! if(sscanf(str, "%s\n", link))
! cur_ptr->link = estrdup(link);
! }
! }
!
! cur_ptr->fragment = NULL;
! if(NULL != (str = strstr(object, "Fragment="))) {
! str += 9;
! if(sscanf(str, "%s\n", link))
! cur_ptr->fragment = estrdup(link);
! }
!
! cur_ptr->htmlattr = NULL;
! if(NULL != (str = strstr(object, "HtmlAttr="))) {
! str += 9;
! str1 = str;
! while((*str1 != '\n') && (*str1 != '\0'))
! str1++;
! cur_ptr->htmlattr = emalloc(str1 - str + 1);
! strncpy(cur_ptr->htmlattr, str, str1 - str);
! cur_ptr->htmlattr[str1 - str] = '\0';
! }
!
! if(NULL != (str = strstr(object, "LinkType="))) {
! str += 9;
! if(strncmp(str, "background", 10) == 0)
! cur_ptr->linktype=HW_BACKGROUND_LINK;
! else
! if(strncmp(str, "intag", 5) == 0) {
! cur_ptr->linktype=HW_INTAG_LINK;
! cur_ptr->tagattr = NULL;
! if(NULL != (str = strstr(object, "TagAttr="))) {
! str += 8;
! str1 = str;
! while((*str1 != '\n') && (*str1 != '\0'))
! str1++;
! cur_ptr->tagattr = emalloc(str1 - str + 1);
! memcpy(cur_ptr->tagattr, str, str1 - str);
! cur_ptr->tagattr[str1 - str] = '\0';
! }
! } else
! if(strncmp(str, "applet", 6) == 0) {
! cur_ptr->linktype=HW_APPLET_LINK;
! cur_ptr->codebase = NULL;
! if(NULL != (str = strstr(object, "CodeBase="))) {
! str += 9;
! str1 = str;
! while((*str1 != '\n') && (*str1 != '\0'))
! str1++;
! cur_ptr->codebase = emalloc(str1 - str + 1);
! memcpy(cur_ptr->codebase, str, str1 - str);
! cur_ptr->codebase[str1 - str] = '\0';
! }
! cur_ptr->code = NULL;
! if(NULL != (str = strstr(object, "Code="))) {
str += 5;
! str1 = str;
! while((*str1 != '\n') && (*str1 != '\0'))
! str1++;
! cur_ptr->code = emalloc(str1 - str + 1);
! memcpy(cur_ptr->code, str, str1 - str);
! cur_ptr->code[str1 - str] = '\0';
}
} else
cur_ptr->linktype=HW_DEFAULT_LINK;
! } else
! cur_ptr->linktype=HW_DEFAULT_LINK;
!
! } else { /* Destination Anchor */
! char nameanchor[200];
!
! cur_ptr->tanchor = 2;
! cur_ptr->link = NULL;
!
! /* Here is the only additional info for the name attribute */
! cur_ptr->nameanchor = NULL;
! if(NULL != (str = strstr(object, "ObjectID="))) {
! str += 9;
! if(sscanf(str, "%s\n", nameanchor))
! cur_ptr->nameanchor = estrdup(nameanchor);
! }
!
! cur_ptr->keyword = NULL;
! if(NULL != (str = strstr(object, "Keyword="))) {
! str += 8;
! if(sscanf(str, "%s\n", nameanchor))
! cur_ptr->keyword = estrdup(nameanchor);
}
!
}
-
- efree(anchors[i]);
- if(docofanchorrec[i]) efree(docofanchorrec[i]);
- if(reldestrec[i]) efree(reldestrec[i]);
}
}
return pAnchorList;
--- 251,449 ----
docofanchorptr = docofanchorrec[i];
reldestptr = reldestrec[i];
! /* Determine Position. Doesn't matter if Src or Dest
! The Position field should always be there. Though there
! are case in which the position has no meaning, e.g. if
! a document is annotated and the annotation text doesn't
! contain a link of type annotation,
! In such a case the Position has the value 'invisible' */
str = strstr(object, "Position");
str += 9;
! if(0 != strncmp(str, "invisible", 9)) {
! sscanf(str, "0x%X 0x%X", &start, &end);
!
! /* Determine ObjectID */
! objectID = 0;
! if(NULL != (str = strstr(object, "ObjectID"))) {
! str += 9;
! sscanf(str, "0x%X", &objectID);
! }
!
! cur_ptr = fnAddAnchor(pAnchorList, objectID, start, end);
!
! /* Determine Type of Anchor */
! str = strstr(object, "TAnchor");
! str += 8;
! if(*str == 'S') {
! char destdocname[200];
! char nameanchor[200];
! cur_ptr->tanchor = 1;
!
! cur_ptr->destdocname = NULL;
! if(NULL != (str = strstr(object, "Dest"))) {
! char *tempptr;
! /* No need to care about the value of Dest, because we take the info
! from docofanchorptr.
! Since the anchor has a destination there are two possibilities.
! 1. The destination is an anchor or
! 2. or the destination is a document already.
! In both cases docofanchorptr has the proper info because GETDOCBYANCHOR
! is such a nice message.
*/
! switch(anchormode) {
! case 0:
! tempptr = docofanchorptr;
! break;
! default:
! tempptr = reldestptr;
}
! if(NULL != tempptr) {
! /* It's always nice to deal with names, so let's first check
! for a name. If there is none we take the ObjectID.
! */
! if(NULL != (str = strstr(tempptr, "Name="))) {
! str += 5;
! } else if(NULL != (str = strstr(tempptr, "ObjectID="))) {
! str += 9;
! }
! if(sscanf(str, "%s\n", destdocname)) {
! cur_ptr->destdocname = estrdup(destdocname);
! }
! destid = 0;
! if(NULL != (str = strstr(tempptr, "ObjectID="))) {
! str += 9;
! sscanf(str, "0x%X", &destid);
! }
}
}
!
! /* Get the Id of the anchor destination and the document id that belongs
! to that anchor. We need that soon in order to determine if the anchor
! points to a document or a dest anchor in a document.
! */
! anchordestid = 0;
if(NULL != (str = strstr(object, "Dest="))) {
str += 5;
! sscanf(str, "0x%X", &anchordestid);
}
!
! /* if anchordestid != destid then the destination is an anchor in a document whose
! name (objectID) is already in destdocname. We will have to extend the link
! by '#...'
! */
! cur_ptr->nameanchor = NULL;
! if(anchordestid != destid) {
! if(NULL != (str = strstr(object, "Dest="))) {
str += 5;
! if(sscanf(str, "%s\n", nameanchor))
! cur_ptr->nameanchor = estrdup(nameanchor);
}
+ }
+
+ if(!cur_ptr->destdocname) {
+ cur_ptr->link = NULL;
+ if(NULL != (str = strstr(object, "Hint=URL:"))) {
+ str += 9;
+ if(sscanf(str, "%s\n", link))
+ cur_ptr->link = estrdup(link);
+ } else if(NULL != (str = strstr(object, "Hint="))) {
+ str += 5;
+ if(sscanf(str, "%s\n", link))
+ cur_ptr->link = estrdup(link);
+ }
+ }
+
+ cur_ptr->fragment = NULL;
+ if(NULL != (str = strstr(object, "Fragment="))) {
+ str += 9;
+ if(sscanf(str, "%s\n", link))
+ cur_ptr->fragment = estrdup(link);
+ }
+
+ cur_ptr->htmlattr = NULL;
+ if(NULL != (str = strstr(object, "HtmlAttr="))) {
+ str += 9;
+ str1 = str;
+ while((*str1 != '\n') && (*str1 != '\0'))
+ str1++;
+ cur_ptr->htmlattr = emalloc(str1 - str + 1);
+ strncpy(cur_ptr->htmlattr, str, str1 - str);
+ cur_ptr->htmlattr[str1 - str] = '\0';
+ }
+
+ if(NULL != (str = strstr(object, "LinkType="))) {
+ str += 9;
+ if(strncmp(str, "background", 10) == 0)
+ cur_ptr->linktype=HW_BACKGROUND_LINK;
+ else
+ if(strncmp(str, "intag", 5) == 0) {
+ cur_ptr->linktype=HW_INTAG_LINK;
+ cur_ptr->tagattr = NULL;
+ if(NULL != (str = strstr(object, "TagAttr="))) {
+ str += 8;
+ str1 = str;
+ while((*str1 != '\n') && (*str1 != '\0'))
+ str1++;
+ cur_ptr->tagattr = emalloc(str1 - str + 1);
+ memcpy(cur_ptr->tagattr, str, str1 - str);
+ cur_ptr->tagattr[str1 - str] = '\0';
+ }
+ } else
+ if(strncmp(str, "applet", 6) == 0) {
+ cur_ptr->linktype=HW_APPLET_LINK;
+ cur_ptr->codebase = NULL;
+ if(NULL != (str = strstr(object, "CodeBase="))) {
+ str += 9;
+ str1 = str;
+ while((*str1 != '\n') && (*str1 != '\0'))
+ str1++;
+ cur_ptr->codebase = emalloc(str1 - str + 1);
+ memcpy(cur_ptr->codebase, str, str1 - str);
+ cur_ptr->codebase[str1 - str] = '\0';
+ }
+ cur_ptr->code = NULL;
+ if(NULL != (str = strstr(object, "Code="))) {
+ str += 5;
+ str1 = str;
+ while((*str1 != '\n') && (*str1 != '\0'))
+ str1++;
+ cur_ptr->code = emalloc(str1 - str + 1);
+ memcpy(cur_ptr->code, str, str1 - str);
+ cur_ptr->code[str1 - str] = '\0';
+ }
+ } else
+ cur_ptr->linktype=HW_DEFAULT_LINK;
} else
cur_ptr->linktype=HW_DEFAULT_LINK;
!
! } else { /* Destination Anchor */
! char nameanchor[200];
!
! cur_ptr->tanchor = 2;
! cur_ptr->link = NULL;
!
! /* Here is the only additional info for the name attribute */
! cur_ptr->nameanchor = NULL;
! if(NULL != (str = strstr(object, "ObjectID="))) {
! str += 9;
! if(sscanf(str, "%s\n", nameanchor))
! cur_ptr->nameanchor = estrdup(nameanchor);
! }
!
! cur_ptr->keyword = NULL;
! if(NULL != (str = strstr(object, "Keyword="))) {
! str += 8;
! if(sscanf(str, "%s\n", nameanchor))
! cur_ptr->keyword = estrdup(nameanchor);
! }
!
}
!
! efree(anchors[i]);
! if(docofanchorrec[i]) efree(docofanchorrec[i]);
! if(reldestrec[i]) efree(reldestrec[i]);
}
}
}
return pAnchorList;
***************
*** 4245,4251 ****
return(0);
}
! int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectRec, char *text,
int count)
{
hg_msg msg, *retmsg;
int length, len;
--- 4252,4258 ----
return(0);
}
! int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectRec, char *text,
int count, hw_objectID *objectID)
{
hg_msg msg, *retmsg;
int length, len;
***************
*** 4253,4259 ****
struct sockaddr_in serv_addr;
struct hostent *hostptr;
char *hostip = NULL;
! int newfd, fd, port, objectID, error;
int *ptr;
/* First of all we have to insert the document record */
--- 4260,4266 ----
struct sockaddr_in serv_addr;
struct hostent *hostptr;
char *hostip = NULL;
! int newfd, fd, port, error;
int *ptr;
/* First of all we have to insert the document record */
***************
*** 4285,4291 ****
ptr = (int *) retmsg->buf;
if(0 == (error = *ptr)) {
ptr++;
! objectID = *ptr;
} else {
efree(retmsg);
if(retmsg->buf) efree(retmsg->buf);
--- 4292,4298 ----
ptr = (int *) retmsg->buf;
if(0 == (error = *ptr)) {
ptr++;
! *objectID = *ptr;
} else {
efree(retmsg);
if(retmsg->buf) efree(retmsg->buf);
***************
*** 4338,4344 ****
return(-1);
}
! tmp = build_msg_int(msg.buf, objectID);
tmp = build_msg_int(tmp, port);
tmp = build_msg_str(tmp, hostip);
tmp = build_msg_str(tmp, "Hyperwave");
--- 4345,4351 ----
return(-1);
}
! tmp = build_msg_int(msg.buf, *objectID);
tmp = build_msg_int(tmp, port);
tmp = build_msg_str(tmp, hostip);
tmp = build_msg_str(tmp, "Hyperwave");
Index: php3/functions/hg_comm.h
diff -c php3/functions/hg_comm.h:1.3 php3/functions/hg_comm.h:1.4
*** php3/functions/hg_comm.h:1.3 Fri Jan 1 12:59:11 1999
--- php3/functions/hg_comm.h Thu Jan 14 12:47:50 1999
***************
*** 23,29 ****
*/
! /* $Id: hg_comm.h,v 1.3 1999/01/01 17:59:11 zeev Exp $ */
#ifndef _HG_COMM_H
#define _HG_COMM_H
--- 23,29 ----
*/
! /* $Id: hg_comm.h,v 1.4 1999/01/14 17:47:50 steinm Exp $ */
#ifndef _HG_COMM_H
#define _HG_COMM_H
***************
*** 178,184 ****
extern int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
extern int send_pipedocument(int sockfd, char *hostname, hw_objectID objectID, int mode, int
rootid, char** objattr, char **bodytag, char **text, int *count);
extern int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char
**objattr, char **text, int *count);
! extern int send_putdocument(int sockfd, char *hostname, hw_objectID objectID, char *objectRec,
char *text, int count);
extern int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID
*new_objectID);
extern int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID);
extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID
*new_objectID);
--- 178,184 ----
extern int send_getparentsobj(int sockfd, hw_objectID objectID, char ***childrec, int *count);
extern int send_pipedocument(int sockfd, char *hostname, hw_objectID objectID, int mode, int
rootid, char** objattr, char **bodytag, char **text, int *count);
extern int send_pipecgi(int sockfd, char *host, hw_objectID objectID, char *cgi_env_str, char
**objattr, char **text, int *count);
! extern int send_putdocument(int sockfd, char *hostname, hw_objectID parentID, char *objectRec,
char *text, int count, hw_objectID *objectID);
extern int send_inscoll(int sockfd, hw_objectID objectID, char *objrec, hw_objectID
*new_objectID);
extern int send_insertobject(int sockfd, char *objrec, char *parms, hw_objectID *objectID);
extern int send_insdoc(int sockfd, hw_objectID objectID, char *objrec, char *text, hw_objectID
*new_objectID);
--
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