Re: ending the HTML parser loop

At 17:24 2/17/99 -0700, Mathew Cucuzella wrote:
>I'm using the showtags.c example program for the HTML parser. I want
>to be able to enter the event loop, parse the page, and then come
>back to my program. Here is the code I changed:
>
>  /* No change here. Call to register our own termination filter */
>  HTNet_addAfter(my_terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);
>
>
>  PRIVATE int my_terminate_handler (HTRequest * request, HTResponse *
response,
>			       void * param, int status) 
>  {
>    /* No change. We are done with this request */
>    HTRequest_delete(request);
>
>    /* No Change. Terminate libwww */
>    HTProfile_delete();
>
>    /* This use to be exit(0), I changed to ... */
>--> HTEventList_stopLoop();
>  }
>
>This seems to work, because I now come back from the HTEventList_loop(),
>but I'm not sure if it is the right call, or if there is a better
>way to do this. I would also like to call this code multiple times for
>different URI's which dumps core right now, but I haven't looked into
>that problem yet.

Stopping the loop is fine - but I wouldn't terminate libwww (delete the
profile) if I were you if you know that you are entering it again later.

That may also be the problem with the core.

Henrik
--
Henrik Frystyk Nielsen,
World Wide Web Consortium
http://www.w3.org/People/Frystyk

Received on Wednesday, 17 February 1999 19:40:15 UTC