home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / gridtext.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  19.8 KB  |  631 lines

  1. //    Copyright (c) 1994, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        'HText'
  4. //    Include File:    gridtext.h
  5. //    Purpose:    Implement the 'member' functions of the HText 'class'
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //        Unlike other WWW clients, no display will be done here in
  8. //        gridtext.  In fact, many unique things will be taking place.
  9. //        Structures were moved to the gridtext.h header file for
  10. //        access by other client modules.
  11. //    Revision History:
  12. //        02-01-94    created, see gridtext.h for details.
  13. //        02-25-94    Began modification to serialize all changes
  14. //                in anchors, styles, and paragraphs by writing
  15. //                pointer values to file that will never change.
  16. //                All functions modified to assume that the
  17. //                HText structure is valid as is the image
  18. //                file.  If not, expect errors.  This was
  19. //                done for the sake of speed in a slow dos
  20. //                WWW client.
  21. #define Uses_TProgram
  22. #include"gridtext.h"
  23. #include"trace.h"
  24. #include"globals.h"
  25. #include"turlview.h"
  26. #include"ttempnam.h"
  27. #include"tform.h"
  28. #include<stdlib.h>
  29. #include<string.h>
  30.  
  31. //    These functions will be called by "C" source code.
  32. extern "C"    {
  33. #include"htfont.h"
  34.  
  35. //    The default style to use in case of no others being set.
  36. static HTStyle HTS_default = {    0,
  37.                 "(Unstyled)",
  38.                 "",
  39.                 (HTFont)0,
  40.                 1.0,
  41.                 HT_BLACK,
  42.                 0,
  43.                 0,
  44.                 0,
  45.                 0,
  46.                 0,
  47.                 HT_LEFT,
  48.                 1,
  49.                 0,
  50.                 0,
  51.                 NO,
  52.                 NO,
  53.                 0,
  54.                 0,
  55.                 0
  56. };
  57.  
  58.  
  59. extern HText *HText_new(HTParentAnchor *HTPAp_anchor)    {
  60. //    Purpose:    Construct a new HText object.
  61. //    Arguments:    HTPAp_anchr    The parent anchor of the HText object.
  62. //    Return Value:    HText *    The new HText object.
  63. //    Remarks/Portability/Dependencies/Restrictions:
  64. //        Does nothing more than member initialization.
  65. //    Revision History:
  66. //        02-01-94    created
  67. #ifndef RELEASE
  68.     trace("creating new HText object.");
  69. #endif // RELEASE
  70.     //    Allocate a new HText structure.
  71.     HText *HTp_text = new HText;
  72.     if(HTp_text == NULL)
  73.         return(NULL);
  74.  
  75.     //    Assign in the parent anchor.
  76.     HTp_text->HTPAp_node_anchor = HTPAp_anchor;
  77.  
  78.     //    Initially no views are owning this HText.
  79.     HTp_text->usi_Views = 0U;
  80.     //    No styles or paragraphs yet appended.
  81.     HTp_text->B_hasParagraph = False;
  82.     HTp_text->B_hasStyle = False;
  83.  
  84.     //    Create the temporary file name.
  85.     HTp_text->TTNp_fspname = new TTempName(cp_TempDir);
  86.  
  87.     //    No forms as of yet.
  88.     HTp_text->HTLp_forms = NULL;
  89.     HTp_text->B_inForm = False;
  90.  
  91.     //    Open the image stream in the temporary directory.
  92.     if(HTp_text->TTNp_fspname != NULL)    {
  93.         HTp_text->fsp_image = new fstream(HTp_text->TTNp_fspname->
  94.             getName(), ios::trunc | ios::out | ios::binary);
  95.     }
  96.  
  97.     //    If everything allocated correctly return.
  98.     if(HTp_text->fsp_image != NULL && HTp_text->TTNp_fspname != NULL)
  99.     {
  100.         //    Set the DosLynx HText collection to know there is a
  101.         //    new HText in memory and is begin loaded.
  102.         HTp_text->B_isLoading = True;
  103.         TNSCp_LoadedHTexts->insert((void *)HTp_text);
  104.  
  105.         //    Check to see if the number of current HTexts is over
  106.         //    the specified limit.  If so, try to find the amount
  107.         //    over not in use and free them, from the beginning
  108.         //    which are the older documents.
  109.         //    Exclude this newly created HText from the search.
  110.         if(usi_MaxLoadedHTexts < TNSCp_LoadedHTexts->getCount())
  111.         {
  112.             HText *HTp_remove;
  113.             unsigned short int usi_over = TNSCp_LoadedHTexts->
  114.                 getCount() - usi_MaxLoadedHTexts;
  115.             for(signed short int ssi_search = 0; ssi_search <
  116.                 TNSCp_LoadedHTexts->getCount() - 2;
  117.                 ssi_search++)    {
  118.                 HTp_remove = (HText *)(TNSCp_LoadedHTexts->
  119.                     at(ssi_search));
  120.                 if(HTp_remove->usi_Views != 0U)
  121.                     continue;
  122.                 HText_free(HTp_remove);
  123.                 //    Reset ssi_search since HText_free
  124.                 //    messed with the number in the
  125.                 //    collection.
  126.                 ssi_search--;
  127.                 if(--usi_over == 0U)
  128.                     break;
  129.             }
  130.         }
  131.  
  132.         //    Set WWW to know that the parent anchor is now
  133.         //    associated with this HText.
  134.         HTAnchor_setDocument(HTPAp_anchor, (HyperDoc *)HTp_text);
  135.  
  136.         //    Set TURLV_current to own this HText.
  137.         TURLV_current->registerText(HTp_text);
  138.  
  139.         //    Set the current style of the HText to the default.
  140.         HText_beginStyle(HTp_text, &HTS_default);
  141.         return(HTp_text);
  142.     }
  143.  
  144.     //    Not everything initialized correctly, return NULL after
  145.     //    releasing memory taken.
  146.     if(HTp_text->fsp_image != NULL && HTp_text->TTNp_fspname != NULL)
  147.     {
  148.         HTp_text->fsp_image->close();
  149.         delete(HTp_text->fsp_image);
  150.     }
  151.     if(HTp_text->TTNp_fspname != NULL)
  152.         delete(HTp_text->TTNp_fspname);
  153.  
  154.     return(NULL);
  155. }
  156.  
  157. extern HText *HText_new2(HTParentAnchor *HTPAp_anchor, HTStream *HTSp_stream)
  158. {
  159. //    Purpose:    Construct a new HText object associated with a
  160. //            HTStream.
  161. //    Arguments:    HTPAp_anchor    The parent anchor of this HText.
  162. //            HTSp_stream    The stream to direct output.
  163. //    Return Value:    HText *    The new HText object.
  164. //    Remarks/Portability/Dependencies/Restrictions:
  165. //        Assignment of a HTStream to a HText object is currently not
  166. //            supported.
  167. //    Revision History:
  168. //        02-01-94    created
  169.  
  170.     //    Just call the default constructor until support for a
  171.     //    HTStream is implemented.
  172.     return(HText_new(HTPAp_anchor));
  173.  
  174. #ifdef TODO
  175. #error Implement a HTStream hook into HText.
  176. #endif // TODO
  177. }
  178.  
  179. extern void HText_free(HText *HTp_text)    {
  180. //    Purpose:    Destroy a HText object.
  181. //    Arguments:    HTp_text    The HText to release from memory.
  182. //    Return Value:    void
  183. //    Remarks/Portability/Dependencies/Restrictions:
  184. //        Will also delete any temporary file associated with the
  185. //        HText object.
  186. //    Revision History:
  187. //        02-01-94    created
  188. //        04-28-94    Modified so that we take ourselves out of
  189. //                the global collection containing the loaded
  190. //                HTexts so that functions calling us don't
  191. //                worry about it.
  192.  
  193.     doslynxmessage("Freeing " << HTp_text->HTPAp_node_anchor->address);
  194.  
  195.     //    Take this out of the loaded HText collection.
  196.     TNSCp_LoadedHTexts->remove((void *)HTp_text);
  197.     TNSCp_LoadedHTexts->pack();
  198.  
  199.     //    Tell WWW to no longer associate this HText with its parent
  200.     //    anchor.
  201.     HTAnchor_setDocument(HTp_text->HTPAp_node_anchor, (HyperDoc *)NULL);
  202.  
  203.     //    Delete any anchors from this parent anchor.
  204.     HTAnchor_delete(HTp_text->HTPAp_node_anchor);
  205.  
  206.     //    Attempt to delete the image stream.
  207.     delete(HTp_text->TTNp_fspname);
  208.  
  209.     //    Delete the forms collection and the contained forms objects.
  210.     if(HTp_text->HTLp_forms != NULL)    {
  211.         while(HTList_isEmpty((HTp_text->HTLp_forms)) == NO)    {
  212.             delete((TForm *)HTList_removeLastObject(HTp_text->
  213.                 HTLp_forms));
  214.         }
  215.         HTList_delete((HTp_text->HTLp_forms));
  216.         HTp_text->HTLp_forms = NULL;
  217.     }
  218.  
  219.     //    Free the actual HText object.
  220.     delete(HTp_text);
  221. }
  222.  
  223. extern void HText_beginAppend(HText *HTp_text)    {
  224. //    Purpose:    Prepare the HText object for appending.
  225. //    Arguments:    HTp_text    The HText object to append to.
  226. //    Return Value:    void
  227. //    Remarks/Portability/Dependencies/Restrictions:
  228. //        Doesn't do a thing, just for compatibility with WWW.
  229. //    Revision History:
  230. //        02-01-94    created
  231. #ifndef RELEASE
  232.     trace("preparing HText for appending.");
  233. #endif // RELEASE
  234. }
  235.  
  236. extern void HText_endAppend(HText *HTp_text)    {
  237. //    Purpose:    End appending to the HText object.
  238. //    Arguments:    HTp_text    The HText object to end appends.
  239. //    Return Value:    void
  240. //    Remarks/Portability/Dependencies/Restrictions:
  241. //        Closes the image file opened upon HText creation.
  242. //    Revision History:
  243. //        02-01-94    created
  244.  
  245.     //    Finish any open styles and paragraphs.
  246.     HText_endParagraph(HTp_text);
  247.     HText_endStyle(HTp_text);
  248.  
  249. #ifndef RELEASE
  250.     trace("ending appends to HText.");
  251. #endif // RELEASE
  252.     //    Close then free the image file.
  253.     //    The actual file will not be deleted here, but will be deleted
  254.     //    in HText_free when it is called.  The name of the file is
  255.     //    preserved in TTNp_fspname.
  256.     HTp_text->fsp_image->close();
  257.     delete(HTp_text->fsp_image);
  258.     HTp_text->fsp_image = NULL;
  259.  
  260.     //    Set the HText object to no longer be loading.
  261.     HTp_text->B_isLoading = False;
  262. }
  263.  
  264. extern void HText_beginParagraph(HText *HTp_text)    {
  265. //    Purpose:    Begin a paragraph in the HText object.
  266. //    Arguments:    HTp_text    The HText object to create a paragraph
  267. //                    for.
  268. //    Return Value:    void
  269. //    Remarks/Portability/Dependencies/Restrictions:
  270. //        Will end any unended paragraphs before starting a new
  271. //        paragraph.
  272. //    Revision History:
  273. //        02-01-94    created
  274. //        02-17-94    Updated code to include the index of the
  275. //                paragraph.
  276. //        02-25-94    Serialized new paragraph.
  277.  
  278.     //    Close any open paragraphs.
  279.     HText_endParagraph(HTp_text);
  280.  
  281.     //    Put in the embedded character.
  282.     HTp_text->fsp_image->put(c_Embedded);
  283.     HTp_text->fsp_image->put(c_AppendParagraph);
  284.     //    If some type of error occured while writing, print a message
  285.     //    and close the file.
  286.     if(HTp_text->fsp_image->bad())    {
  287.         doslynxmessage("An error occured while writing to file " <<
  288.             HTp_text->TTNp_fspname->getName());
  289.         HTp_text->fsp_image->close();
  290.  
  291.         //    Cause the application to exit.
  292.         TEvent TE_quit;
  293.         TE_quit.what = evMessage;
  294.         TE_quit.message.command = cmQuit;
  295.         TProgram::application->handleEvent(TE_quit);
  296.     }
  297.  
  298.     //    Set flag so that endParagraph knows that there is one to end.
  299.     HTp_text->B_hasParagraph = True;
  300. }
  301.  
  302. extern void HText_endParagraph(HText *HTp_text)    {
  303. //    Purpose:    End a paragraph in the HText object.
  304. //    Arguments:    HTp_text    The HText object to end the paragraph
  305. //                    in.
  306. //    Return Value:    void
  307. //    Remarks/Portability/Dependencies/Restrictions:
  308. //        Will first check to see if a paragraph need be ended.
  309. //    Revision History:
  310. //        02-01-94    created.
  311. //        02-25-94    Modified so does nothing....
  312. //                Maybe in the future.
  313.  
  314.     //    Only the very first time this function is called there will
  315.     //    be no need to close a paragraph.
  316.     if(HTp_text->B_hasParagraph == False)
  317.         return;
  318.  
  319.     //    Do some special processing when a paragraph ends if needed.
  320. }
  321.  
  322. extern void HText_beginStyle(HText *HTp_text, HTStyle *HTSp_style)    {
  323. //    Purpose:    Start a particular style in a HText object.
  324. //    Arguments:    HTp_text    The HText to set the style for.
  325. //            HTSp_style    The style to set to.
  326. //    Return Value:    void.
  327. //    Remarks/Portability/Dependencies/Restrictions:
  328. //        Will end any open styles first.
  329. //    Revision History:
  330. //        02-01-94    created
  331. //        02-25-94    Writing style pointer to disk.
  332.  
  333.     //    End any open styles.
  334.     HText_endStyle(HTp_text);
  335.  
  336.     //    Put in the embedded character.
  337.     HTp_text->fsp_image->put(c_Embedded);
  338.     HTp_text->fsp_image->put(c_SetStyle);
  339.     //    Here's the trick, write a pointer to the style to file.
  340.     HTp_text->fsp_image->write((const char *)(&HTSp_style),
  341.         sizeof(HTStyle *));
  342.     //    If some type of error occured while writing, print a message
  343.     //    and close the file.
  344.     if(HTp_text->fsp_image->bad())    {
  345.         doslynxmessage("An error occured while writing to file " <<
  346.             HTp_text->TTNp_fspname->getName());
  347.         HTp_text->fsp_image->close();
  348.  
  349.         //    Cause the application to exit.
  350.         TEvent TE_quit;
  351.         TE_quit.what = evMessage;
  352.         TE_quit.message.command = cmQuit;
  353.         TProgram::application->handleEvent(TE_quit);
  354.     }
  355.  
  356.     //    Set a flag so that endStyle will know that there is a style
  357.     //    to end.
  358.     HTp_text->B_hasStyle = True;
  359. }
  360.  
  361. extern void HText_endStyle(HText *HTp_text)    {
  362. //    Purpose:    End the use of a style in a HText object.
  363. //    Arguments:    HTp_text    The HText object to end the style.
  364. //    Return Value:    void
  365. //    Remarks/Portability/Dependencies/Restrictions:
  366. //        Will first check and see if a style needs to be ended.
  367. //    Revision History:
  368. //        02-01-94    created
  369. //        02-25-94    Changed to do nothing, maybe in the future....
  370.  
  371.     //    Only the very first time this function is called will there
  372.     //    be no need to close a style.
  373.     if(HTp_text->B_hasStyle == False)
  374.         return;
  375.  
  376.     //    Do nothing unless special processing is needed to end a style.
  377. }
  378.  
  379. extern void HText_beginAnchor(HText *HTp_text, HTChildAnchor *HTCAp_anchor)
  380. {
  381. //    Purpose:    Begin an anchor in a HText object.
  382. //    Arguments:    HTp_text    The HText object to begin the anchor
  383. //                    in.
  384. //            HTCAp_anchor    The child anchor beginning the anchor
  385. //                    in HText.
  386. //    Return Value:    void
  387. //    Remarks/Portability/Dependencies/Restrictions:
  388. //    Revision History:
  389. //        02-01-94    created
  390. //        02-25-94    Modified to serialize the pointer value.
  391.  
  392.     //    Put in the embedded character.
  393.     HTp_text->fsp_image->put(c_Embedded);
  394.     HTp_text->fsp_image->put(c_BeginAnchor);
  395.     //    Here's the trick, write a pointer to the anchor to file.
  396.     HTp_text->fsp_image->write((const char *)(&HTCAp_anchor),
  397.         sizeof(HTChildAnchor *));
  398.     //    If some type of error occured while writing, print a message
  399.     //    and close the file.
  400.     if(HTp_text->fsp_image->bad())    {
  401.         doslynxmessage("An error occured while writing to file " <<
  402.             HTp_text->TTNp_fspname->getName());
  403.         HTp_text->fsp_image->close();
  404.  
  405.         //    Cause the application to exit.
  406.         TEvent TE_quit;
  407.         TE_quit.what = evMessage;
  408.         TE_quit.message.command = cmQuit;
  409.         TProgram::application->handleEvent(TE_quit);
  410.  
  411.     }
  412. }
  413.  
  414. extern void HText_endAnchor(HText *HTp_text)    {
  415. //    Purpose:    End an anchor in a HText object.
  416. //    Arguments:    HTp_text    The HText to end the anchor in.
  417. //    Return Value:    void
  418. //    Remarks/Portability/Dependencies/Restrictions:
  419. //        Unlike HText_endParagraph and HText_endStyle, there will
  420. //        always be an anchor to close; there is no need to check.
  421. //    Revision History:
  422. //        02-01-94    created
  423. //        02-25-94    Modified to serialize a marker to end the
  424. //                anchor.
  425.  
  426.     //    Put in the embedded character.
  427.     HTp_text->fsp_image->put(c_Embedded);
  428.     HTp_text->fsp_image->put(c_EndAnchor);
  429.     //    If some type of error occured while writing, print a message
  430.     //    and close the file.
  431.     if(HTp_text->fsp_image->bad())    {
  432.         doslynxmessage("An error occured while writing to file " <<
  433.             HTp_text->TTNp_fspname->getName());
  434.         HTp_text->fsp_image->close();
  435.         //    Cause the application to exit.
  436.         TEvent TE_quit;
  437.         TE_quit.what = evMessage;
  438.         TE_quit.message.command = cmQuit;
  439.         TProgram::application->handleEvent(TE_quit);
  440.     }
  441. }
  442.  
  443. extern void HText_appendCharacter(HText *HTp_text, char c_append)    {
  444. //    Purpose:    Add a character to the HText object.
  445. //    Arguments:    HTp_text    The HText object to append to.
  446. //            c_append    The character to add.
  447. //    Return Value:    void
  448. //    Remarks/Portability/Dependencies/Restrictions:
  449. //        Character not actually added to HText but appended to the
  450. //        image file.
  451. //    Revision History:
  452. //        02-01-94    created
  453.  
  454.     //    Write the character to the binary file stream.
  455.     HTp_text->fsp_image->put(c_append);
  456.  
  457.     //    If some type of error occured while writing, print a message
  458.     //    and close the file.
  459.     if(HTp_text->fsp_image->bad())    {
  460.         doslynxmessage("An error occured while writing to file " <<
  461.             HTp_text->TTNp_fspname->getName());
  462.         HTp_text->fsp_image->close();
  463.         //    Cause the application to exit.
  464.         TEvent TE_quit;
  465.         TE_quit.what = evMessage;
  466.         TE_quit.message.command = cmQuit;
  467.         TProgram::application->handleEvent(TE_quit);
  468.     }
  469. }
  470.  
  471. extern void HText_appendImage(HText *HTp_text, HTChildAnchor *HTCAp_anc,
  472.     const char *cp_alt, int ssi_alignment, BOOL B_isMap)    {
  473. //    Purpose:    Append an image in the HTML rendering.
  474. //    Arguments:    HTp_text    The hyper document in which to insert
  475. //                    the image.
  476. //            HTCAp_anc    The anchor pointing to the image.
  477. //            cp_alt        The title of the picture.
  478. //            ssi_alignment    How the picture should be aligned on
  479. //                    the screen.
  480. //            B_isMap        Whether or not portions are
  481. //                    selectable?
  482. //    Return Value:    void
  483. //    Remarks/Portability/Dependencies/Restrictions:
  484. //        Created just to fill where pictures should be with an anchor.
  485. //    Revision History:
  486. //        03-07-94    created
  487.  
  488.     auto char *cp_append = "<IMAGE>";
  489.  
  490.     if(cp_alt != NULL)    {
  491.         if(*cp_alt != '\0')    {
  492.             cp_append = (char *)cp_alt;
  493.         }
  494.     }
  495.  
  496.     HText_appendText(HTp_text, cp_append);
  497. }
  498.  
  499. extern void HText_appendText(HText *HTp_text, const char *cp_append)    {
  500. //    Purpose:    Add a string to the HText object.
  501. //    Arguments:    HTp_text    The HText object to add to.
  502. //    Return Value:    void
  503. //    Remarks/Portability/Dependencies/Restrictions:
  504. //        Characters are not actually added to HText but appended to the
  505. //        image file.
  506. //    Revision History:
  507. //        02-01-94    created
  508.  
  509.     for(char *cp = (char *)cp_append; *cp != '\0'; cp++)    {
  510.         HText_appendCharacter(HTp_text, *cp);
  511.     }
  512. }
  513.  
  514. extern BOOL HText_selectAnchor(HText *HTp_text, HTChildAnchor *HTCAp_anchor)
  515. {
  516. //    Purpose:    Selects the specified anchor in HText.
  517. //    Arguments:    HTp_text    The HText object with the anchor.
  518. //            HTCAp_anchor    The anchor to select.
  519. //    Return Value:    BOOL    TRUE    The anchor was selected.
  520. //                FALSE    The anchor could not be selected.
  521. //    Remarks/Portability/Dependencies/Restrictions:
  522. //        The only reason why an anchor is unable to be selected is
  523. //        if the anchor does not exists in the Anchor collection.
  524. //        Also, assume that if an anchor is selected, the HText is
  525. //        viewable in the current TURLView.  Since multiple views
  526. //        of the same HText can exists, we can not record the selected
  527. //        anchor in the HText structure, but must call a TURLView
  528. //        function to set the selected anchor for each different view.
  529. //    Revision History:
  530. //        02-01-94    created
  531.  
  532. #ifndef RELEASE
  533.     trace("selecting an anchor in HText.");
  534. #endif // RELEASE
  535.  
  536.     //    Have the view select the anchor.
  537.     if(TURLV_current->selectAnchor(HTCAp_anchor) == False)    {
  538.         //    Anchor wasn't found.
  539.         doslynxmessage("Attempt to select invalid anchor failed.");
  540.         return(FALSE);
  541.     }
  542.     return(TRUE);
  543. }
  544.  
  545. extern BOOL HText_select(HText *HTp_text)    {
  546. //    Purpose:    View the HText object NOW.
  547. //    Arguments:    HTp_text    The HText object to be viewed.
  548. //    Return Value:    BOOL    TRUE    The HText was selected.
  549. //                FALSE    The HText was not selected.
  550. //    Remarks/Portability/Dependencies/Restrictions:
  551. //        This function won't be called unless a request to load is
  552. //        made.
  553. //        The HText was loaded at some time and is still in memory, be
  554. //        it in none, one, or more windows.
  555. //        Inform the calling window that this HText exists, by simply
  556. //        manually assigning a pointer to this HText.
  557. //    Revision History:
  558. //        02-01-94    created.
  559.  
  560.     //    Use the global variable of the URL view to point to us.
  561.     TURLV_current->registerText(HTp_text);
  562.     return(TRUE);
  563. }
  564.  
  565. extern void HText_beginForm(HText *HTp_text, const char *cp_action,
  566.     const char *cp_method)    {
  567. //    Purpose:    Begin the creation of a Form in our hypertext object.
  568. //    Arguments:    HTp_text    The hypertext object owning this new
  569. //                        form.
  570. //            cp_action    The destination of our output.
  571. //            cp_method    The method to use to send the data,
  572. //                        could be as a URL or could
  573. //                        be sent as a post....
  574. //    Return Value:    void
  575. //    Remarks/Portability/Dependencies/Restrictions:
  576. //    Revision History:
  577. //        04-24-94    created
  578.  
  579. #ifndef RELEASE
  580.     trace("Begin form " << cp_action << " " << cp_method);
  581. #endif // RELEASE
  582.  
  583.     //    Create a new form object.
  584.     auto TForm *TFp_form = new TForm(cp_action, cp_method);
  585.  
  586.     //    Make sure the forms list exists.
  587.     if(HTp_text->HTLp_forms == NULL)    {
  588.         HTp_text->HTLp_forms = HTList_new();
  589.     }
  590.  
  591.     //    Insert the form into the list of forms in HText.  The current
  592.     //        form can always be considered the last form.
  593.     HTList_addObject((HTp_text->HTLp_forms), (void *)TFp_form);
  594.  
  595.     //    Mark that we are currently in a form.
  596.     HTp_text->B_inForm = True;
  597.  
  598.     //    We won't need to write anything to file since the form won't
  599.     //        be a displayable item itself, it's other parts will
  600.     //        be though....
  601. #ifndef RELEASE
  602.     trace("Returning");
  603. #endif // RELEASE
  604. }
  605.  
  606. extern void HText_endForm(HText *HTp_text)    {
  607. //    Purpose:    End the creation of a Form in the HyperText object.
  608. //    Arguments:    void
  609. //    Return Value:    void
  610. //    Remarks/Portability/Dependencies/Restrictions:
  611. //        Really we do nothing here....  Just put in for the future.
  612. //    Revision History:
  613. //        04-24-94    created
  614.  
  615.     //    Mark that we are no longer in a form.
  616.     HTp_text->B_inForm = False;
  617. }
  618.  
  619. extern BOOL HText_inForm(HText *HTp_text)    {
  620. //    Purpose:    Return wether or not currently handling a form.
  621. //    Arguments:    HTp_text    The hypertext being referred to.
  622. //    Return Value:    BOOL    TRUE    Yes, in a form.
  623. //                FALSE    No, not in a form.
  624. //    Remarks/Portability/Dependencies/Restrictions:
  625. //    Revision History:
  626. //        05-12-94    created
  627.  
  628.     return((BOOL)(HTp_text->B_inForm));
  629. }
  630.  
  631. }; // extern "C"