* BUG: XmlReader: Fix text node management.
* BUG: Fix Gambas headers inclusion in various places.

git-svn-id: svn://localhost/gambas/trunk@7571 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Adrien Prokopowicz 2016-01-09 12:13:38 +00:00
parent 3eb39cad1e
commit 71ad28e365
6 changed files with 23 additions and 6 deletions

View File

@ -1,7 +1,7 @@
#ifndef GBINTERFACE_H
#define GBINTERFACE_H
#include "../gambas.h"
#include "gambas.h"
extern "C" GB_INTERFACE GB;

View File

@ -33,7 +33,7 @@
#include "serializer.h"
#include "parser.h"
#include "../gambas.h"
#include "gambas.h"
#include "html/gb.xml.html.h"
GB_INTERFACE GB EXPORT;

View File

@ -359,7 +359,7 @@ int Reader::ReadChar(char car)
inComment = true;
//DESTROYPARENT(curNode);
//UNREF(curNode);
curNode = XMLCDATA_New();
curNode = XMLComment_New();
//GB.Ref(curNode);
}
}
@ -424,7 +424,7 @@ int Reader::ReadChar(char car)
curNode = newNode;
//GB.Ref(curNode);
}
else if(!curNode || (curNode->type != Node::NodeText && !inTag))//Pas de nœud courant -> nœud texte
else if(!curNode || (!XML_isTextNode(curNode) && !inTag))//Pas de nœud courant -> nœud texte
{
if(isWhiteSpace(car)) return 0;
TextNode* newNode = XMLTextNode_New(&car, 1);
@ -471,7 +471,8 @@ int Reader::ReadChar(char car)
++lenAttrVal;
}
}
else if(curNode->type == Node::NodeText)
else if(XML_isTextNode(curNode))
{
char *&textContent = ((TextNode*)curNode)->content;
size_t &lenTextContent = ((TextNode*)curNode)->lenContent;

View File

@ -313,3 +313,16 @@ CDATANode* XMLCDATA_New(const char *ncontent, const size_t nlen)
return newComment;
}
bool XML_isTextNode(Node *node)
{
switch(node->type)
{
case Node::NodeText:
case Node::Comment:
case Node::CDATA:
return true;
default:
return false;
}
}

View File

@ -38,6 +38,8 @@ void XMLTextNode_setEscapedTextContent(TextNode *node, const char *ncontent, con
void XMLTextNode_TrimContent(TextNode *node);
bool XML_isTextNode(Node *node);
CommentNode* XMLComment_New();
CommentNode* XMLComment_New(const char *ncontent, const size_t nlen);

View File

@ -21,10 +21,11 @@
#include "utils.h"
#include "gbinterface.h"
#include "../gb_common.h"
#include "gb_common.h"
#include "textnode.h"
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#ifdef OS_MACOSX