Re: need to link a structure to each anchor

Jean Alexis Montignies <ja@lithnext.epfl.ch> wrote:

> I need, to program my browser to link any HTAnchor (child or parent) structure  
> with a client specific structure, wich is in my case an Objective-C object id.
> If the library was in Objective-C, i should have made a sub-class of the  
> HTAnchor class, but that's not the case ;-).
> For the moment, i've modified the HTAnchor.c module to manage one more field :  
> 'userData'.

The definition of a parent anchor is as follows (taken from

struct _HTParentAnchor {
  /* Common part from the generic anchor structure */
  HTLink	mainLink;	/* Main (or default) destination of this */
  HTList *	links;  	/* List of extra links from this, if any */
  HTParentAnchor * parent;	/* Parent of this anchor (self) */

  /* ParentAnchor-specific information */
  HTList *	children;	/* Subanchors of this, if any */
  HTList *	sources;	/* List of anchors pointing to this, if any */
  HyperDoc *	document;	/* The document within which this is an anchor */
  char * 	address;	/* Absolute address of this node */
  HTFormat	format; 	/* Pointer to node format descriptor */
  BOOL		isIndex;	/* Acceptance of a keyword search */
  char *	title;		/* Title of document */
  HTList*	methods;	/* Methods available as HTAtoms */
  void *	protocol;	/* Protocol object */
  char *	physical;	/* Physical address */
  HTList *	cacheItems;	/* Cache hits (see HTFWriter) for this URL */
  long int      size;           /* Indicative size only if multiformat */ 

The HyperDoc is a undefined structure that the client can use to put in
necessary information of the graphical object the anchor represents
when the object is loaded and in memory. Remember that it's only parent
anchors that have a graphical object associated with them - not child
anchors, see


for more information on anchors.

You can have a look at how the Line Mode Browser defines it in
GridText.c. Here it is called HText, but it is the same as hyperdoc.

-- cheers --

Henrik Frystyk