At 02:32 PM 7/26/01, Rob Mayoff wrote:
>+---------- On Jul 26, Jerry Asher said:
> > But at first glance, what I would probably want to store would be Tcl
> > objects, so that we could write functions to make this meta data available
> > to Tcl procedures.  So while a pointer to raw binary parsed xml object
> > couldn't be placed in the set, a tcl handle (ala ns_db, ns_xml, ns_set,
> > nsv_set) to that binary object could be placed in there.
>
>Then C modules have to go to the Tcl interpreter. In which case why not
>just use a Tcl variable?

I'm probably being imprecise again.  Well see, here's where it just outside
my domain...  (And it's why I open endedly asked what better could be done...)

Is it true that C modules have to go to the Tcl interpreter or is it the
case they just have to create and manipulate Tcl objects?  I believe it's
just the latter.

When ns_xml creates various ns_xml objects to represent an ns_xml doc, what
it does is to:

a)  construct the name of a handle
b)  stick that name into a hash table (getting a hash entry)
c)  create an internal doc_info structure
d)  fill in that doc_info structure with a pointer to the xml
e)  setting the value of that hash entry to the internal doc_info structure

   do {
     Ns_DStringTrunc(&result, 0);
     Ns_DStringPrintf(&result, "%c%u", prefix, info->next_doc_id);
     info->next_doc_id += 1;
     entry = Tcl_CreateHashEntry(&info->doc_hash_byid,
               Ns_DStringValue(&result), &new);
   } while (!new);
   d_info = doc_info_create(xmlDoc);
   Tcl_SetHashValue(entry, d_info);

A connection's tcl interpreter doesn't know anything about this.  If
anything, it just passes the handle around as a string.  Users do have to
know that this is an xml handle and not a db handle and use nsxml methods
to manipulate it, but there are no variables within the connection's tcl
interpreter necessarily associated with it.

For another c based module to use it, they would a) find it by key name in
the meta set, b) "know" that that value was an xml handle, and c)
manipulate it using ns_xml methods....

Does that clarify my suggestion?


Jerry

=====================================================
Jerry Asher                       [EMAIL PROTECTED]
1678 Shattuck Avenue Suite 161    Tel: (510) 549-2980
Berkeley, CA 94709                Fax: (877) 311-8688

Reply via email to