changeset 284:23b5586b9869

- cleanup: switched bool_t to bool in html.cc
author jcid
date Thu, 19 Jun 2008 21:20:16 +0200
parents f97319b762d2
children 6aa09f56686c
files src/html.cc src/html_common.hh
diffstat 2 files changed, 50 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/src/html.cc	Thu Jun 19 16:13:57 2008 +0200
+++ b/src/html.cc	Thu Jun 19 21:20:16 2008 +0200
@@ -476,7 +476,7 @@
    stack->getRef(0)->table_cell_style = NULL;
    stack->getRef(0)->parse_mode = DILLO_HTML_PARSE_MODE_INIT;
    stack->getRef(0)->table_mode = DILLO_HTML_TABLE_MODE_NONE;
-   stack->getRef(0)->cell_text_align_set = FALSE;
+   stack->getRef(0)->cell_text_align_set = false;
    stack->getRef(0)->list_type = HTML_LIST_NONE;
    stack->getRef(0)->list_number = 0;
    stack->getRef(0)->tag_idx = -1;               /* MUST not be used */
@@ -488,25 +488,24 @@
    InFlags = IN_NONE;
 
    Stash = dStr_new("");
-   StashSpace = FALSE;
+   StashSpace = false;
 
    pre_column = 0;
-   PreFirstChar = FALSE;
-   PrevWasCR = FALSE;
-   PrevWasOpenTag = FALSE;
-   PrevWasSPC = FALSE;
-   SPCPending = FALSE;
-   InVisitedLink = FALSE;
-   ReqTagClose = FALSE;
-   CloseOneTag = FALSE;
-   TagSoup = TRUE;
+   PreFirstChar = false;
+   PrevWasCR = false;
+   PrevWasOpenTag = false;
+   PrevWasSPC = false;
+   InVisitedLink = false;
+   ReqTagClose = false;
+   CloseOneTag = false;
+   TagSoup = true;
    NameVal = NULL;
 
    Num_HTML = Num_HEAD = Num_BODY = Num_TITLE = 0;
 
    attr_data = dStr_sized_new(1024);
 
-   parse_finished = FALSE;
+   parse_finished = false;
 
    /* Init page-handling variables */
    forms = new misc::SimpleVector <DilloHtmlForm*> (1);
@@ -678,7 +677,7 @@
    a_UIcmd_set_page_prog(bw, 0, 0);
 
    freeParseData();
-   parse_finished = TRUE;
+   parse_finished = true;
 }
 
 /*
@@ -829,7 +828,7 @@
 void a_Html_stash_init(DilloHtml *html)
 {
    S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_STASH;
-   html->StashSpace = FALSE;
+   html->StashSpace = false;
    dStr_truncate(html->Stash, 0);
 }
 
@@ -1080,11 +1079,9 @@
 
    if (parse_mode == DILLO_HTML_PARSE_MODE_STASH) {
       html->StashSpace = (html->Stash->len > 0);
-      html->SPCPending = FALSE;
 
    } else if (parse_mode == DILLO_HTML_PARSE_MODE_VERBATIM) {
       dStr_append_l(html->Stash, space, spacesize);
-      html->SPCPending = FALSE;
 
    } else if (parse_mode == DILLO_HTML_PARSE_MODE_PRE) {
       int spaceCnt = 0;
@@ -1103,7 +1100,7 @@
             DW2TB(html->dw)->addLinebreak (S_TOP(html)->style);
             html->pre_column = 0;
          }
-         html->PreFirstChar = FALSE;
+         html->PreFirstChar = false;
 
          /* cr and lf should not be rendered -- they appear as a break */
          switch (space[i]) {
@@ -1130,17 +1127,13 @@
          DW2TB(html->dw)->addText (dStrnfill(spaceCnt, ' '),
                S_TOP(html)->style);
       }
-      html->SPCPending = FALSE;
 
    } else {
       if (SGML_SPCDEL) {
          /* SGML_SPCDEL ignores white space inmediately after an open tag */
-         if (html->PrevWasOpenTag)
-            html->SPCPending = FALSE;
       } else if (!html->PrevWasSPC) {
          DW2TB(html->dw)->addSpace(S_TOP(html)->style);
-         html->SPCPending = FALSE;
-         html->PrevWasSPC = TRUE;
+         html->PrevWasSPC = true;
       }
 
       if (parse_mode == DILLO_HTML_PARSE_MODE_STASH_AND_BODY)
@@ -1165,7 +1158,7 @@
        parse_mode == DILLO_HTML_PARSE_MODE_STASH_AND_BODY) {
       if (html->StashSpace) {
          dStr_append_c(html->Stash, ' ');
-         html->StashSpace = FALSE;
+         html->StashSpace = false;
       }
       Pword = a_Html_parse_entities(html, word, size);
       dStr_append(html->Stash, Pword);
@@ -1193,7 +1186,7 @@
                                dStrndup(Pword + start, i - start),
                                S_TOP(html)->style);
             html->pre_column += i - start;
-            html->PreFirstChar = FALSE;
+            html->PreFirstChar = false;
          }
       dFree(Pword);
 
@@ -1207,11 +1200,10 @@
       DW2TB(html->dw)->addText(Pword, S_TOP(html)->style);
    }
 
-   html->PrevWasOpenTag = FALSE;
-   html->PrevWasSPC = FALSE;
-   html->SPCPending = FALSE;
+   html->PrevWasOpenTag = false;
+   html->PrevWasSPC = false;
    if (html->InFlags & IN_LI)
-      html->WordAfterLI = TRUE;
+      html->WordAfterLI = true;
 }
 
 /*
@@ -1313,7 +1305,7 @@
 
    if (html->CloseOneTag) {
       Html_real_pop_tag(html);
-      html->CloseOneTag = FALSE;
+      html->CloseOneTag = false;
       return;
    }
 
@@ -1342,7 +1334,7 @@
                     Tags[toptag_idx].name);
 
          /* Close this and only this tag */
-         html->CloseOneTag = TRUE;
+         html->CloseOneTag = true;
          Tags[toptag_idx].close (html, toptag_idx);
       }
 
@@ -1589,7 +1581,7 @@
 {
    if (html->InFlags & IN_BODY || html->Num_BODY > 0) {
       BUG_MSG("HEAD element must go before the BODY section\n");
-      html->ReqTagClose = TRUE;
+      html->ReqTagClose = true;
       return;
    }
 
@@ -1772,7 +1764,7 @@
 {
    if ((html->InFlags & IN_LI) && !html->WordAfterLI) {
       /* ignore first parbreak after an empty <LI> */
-      html->WordAfterLI = TRUE;
+      html->WordAfterLI = true;
    } else {
       DW2TB(html->dw)->addParbreak (9, S_TOP(html)->style);
    }
@@ -1867,7 +1859,7 @@
    cell_style->unref ();
 
    S_TOP(html)->table_mode = DILLO_HTML_TABLE_MODE_TOP;
-   S_TOP(html)->cell_text_align_set = FALSE;
+   S_TOP(html)->cell_text_align_set = false;
    S_TOP(html)->table = table;
 #endif
 }
@@ -2045,7 +2037,7 @@
          style->unref ();
 
       if (a_Html_get_attr (html, tag, tagsize, "align")) {
-         S_TOP(html)->cell_text_align_set = TRUE;
+         S_TOP(html)->cell_text_align_set = true;
          Html_tag_set_align_attr (html, tag, tagsize);
       }
 
@@ -2769,7 +2761,7 @@
       style_attrs = *old_style;
 
       if (a_Capi_get_flags(url) & CAPI_IsCached) {
-         html->InVisitedLink = TRUE;
+         html->InVisitedLink = true;
          style_attrs.color = Color::createSimple (
             HT2LT(html),
             html->visited_color
@@ -2811,7 +2803,7 @@
  */
 static void Html_tag_close_a(DilloHtml *html, int TagIdx)
 {
-   html->InVisitedLink = FALSE;
+   html->InVisitedLink = false;
    a_Html_pop_tag(html, TagIdx);
 }
 
@@ -2990,7 +2982,7 @@
    char buf[16];
 
    html->InFlags |= IN_LI;
-   html->WordAfterLI = FALSE;
+   html->WordAfterLI = false;
 
    /* Get our parent tag's variables (used as state storage) */
    list_number = &html->stack->getRef(html->stack->size()-2)->list_number;
@@ -3026,7 +3018,7 @@
       numtostr((*list_number)++, buf, 16, S_TOP(html)->style->listStyleType);
       list_item->initWithText (dStrdup(buf), word_style);
       list_item->addSpace (word_style);
-      html->PrevWasSPC = TRUE;
+      html->PrevWasSPC = true;
       break;
    case HTML_LIST_NONE:
       BUG_MSG("<li> outside <ul> or <ol>\n");
@@ -3043,7 +3035,7 @@
 static void Html_tag_close_li(DilloHtml *html, int TagIdx)
 {
    html->InFlags &= ~IN_LI;
-   html->WordAfterLI = FALSE;
+   html->WordAfterLI = false;
    ((ListItem *)html->dw)->flush (false);
    a_Html_pop_tag(html, TagIdx);
 }
@@ -3147,7 +3139,7 @@
    S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_PRE;
    HTML_SET_TOP_ATTR (html, whiteSpace, WHITE_SPACE_PRE);
    html->pre_column = 0;
-   html->PreFirstChar = TRUE;
+   html->PreFirstChar = true;
    html->InFlags |= IN_PRE;
 }
 
@@ -3238,9 +3230,9 @@
          {
             int SaveFlags = html->InFlags;
             html->InFlags = IN_BODY;
-            html->TagSoup = FALSE;
+            html->TagSoup = false;
             Html_write_raw(html, ds_msg->str, ds_msg->len, 0);
-            html->TagSoup = TRUE;
+            html->TagSoup = true;
             html->InFlags = SaveFlags;
          }
          dStr_free(ds_msg, 1);
@@ -3797,13 +3789,13 @@
       }
 
       /* let the parser know this was an open tag */
-      html->PrevWasOpenTag = TRUE;
+      html->PrevWasOpenTag = true;
 
       /* Request inmediate close for elements with forbidden close tag. */
       /* todo: XHTML always requires close tags. A simple implementation
        * of the commented clause below will make it work. */
       if  (/* parsing HTML && */ Tags[ni].EndTag == 'F')
-         html->ReqTagClose = TRUE;
+         html->ReqTagClose = true;
 
       /* Don't break! Open tags may also close themselves */
 
@@ -3819,8 +3811,8 @@
    
          Tags[ni].close (html, ni);
          /* This was a close tag */
-         html->PrevWasOpenTag = FALSE;
-         html->ReqTagClose = FALSE;
+         html->PrevWasOpenTag = false;
+         html->ReqTagClose = false;
       }
    }
 }
--- a/src/html_common.hh	Thu Jun 19 16:13:57 2008 +0200
+++ b/src/html_common.hh	Thu Jun 19 21:20:16 2008 +0200
@@ -112,7 +112,7 @@
    dw::core::style::Style *style, *table_cell_style;
    DilloHtmlParseMode parse_mode;
    DilloHtmlTableMode table_mode;
-   bool_t cell_text_align_set;
+   bool cell_text_align_set;
    DilloHtmlListMode list_type;
    int list_number;
 
@@ -174,19 +174,18 @@
    int InFlags; /* tracks which elements we are in */
 
    Dstr *Stash;
-   bool_t StashSpace;
+   bool StashSpace;
 
    int pre_column;        /* current column, used in PRE tags with tabs */
-   bool_t PreFirstChar;   /* used to skip the first CR or CRLF in PRE tags */
-   bool_t PrevWasCR;      /* Flag to help parsing of "\r\n" in PRE tags */
-   bool_t PrevWasOpenTag; /* Flag to help deferred parsing of white space */
-   bool_t SPCPending;     /* Flag to help deferred parsing of white space */
-   bool_t PrevWasSPC;     /* Flag to help handling collapsing white space */
-   bool_t InVisitedLink;  /* used to 'contrast_visited_colors' */
-   bool_t ReqTagClose;    /* Flag to help handling bad-formed HTML */
-   bool_t CloseOneTag;    /* Flag to help Html_tag_cleanup_at_close() */
-   bool_t WordAfterLI;    /* Flag to help ignoring the 1st <P> after <LI> */
-   bool_t TagSoup;        /* Flag to enable the parser's cleanup functions */
+   bool PreFirstChar;     /* used to skip the first CR or CRLF in PRE tags */
+   bool PrevWasCR;        /* Flag to help parsing of "\r\n" in PRE tags */
+   bool PrevWasOpenTag;   /* Flag to help deferred parsing of white space */
+   bool PrevWasSPC;       /* Flag to help handling collapsing white space */
+   bool InVisitedLink;    /* used to 'contrast_visited_colors' */
+   bool ReqTagClose;      /* Flag to help handling bad-formed HTML */
+   bool CloseOneTag;      /* Flag to help Html_tag_cleanup_at_close() */
+   bool WordAfterLI;      /* Flag to help ignoring the 1st <P> after <LI> */
+   bool TagSoup;          /* Flag to enable the parser's cleanup functions */
    char *NameVal;         /* used for validation of "NAME" and "ID" in <A> */
 
    /* element counters: used for validation purposes */
@@ -206,7 +205,7 @@
    int32_t visited_color;
 
 private:
-   bool_t parse_finished;
+   bool parse_finished;
    void freeParseData();
    void initDw();  /* Used by the constructor */