Branch: refs/heads/1.22_release
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 08 Jul 2012 21:10:53
Commit: b38189f5380a84cc2ae437254dd78ec4dae839ba
https://github.com/geany/geany-plugins/commit/b38189f5380a84cc2ae437254dd78…
Log Message:
-----------
PrettyPrinter: Don't use C++-style comments
Modified Paths:
--------------
pretty-printer/src/ConfigUI.c
pretty-printer/src/ConfigUI.h
pretty-printer/src/PluginEntry.c
pretty-printer/src/PluginEntry.h
pretty-printer/src/PrettyPrinter.c
pretty-printer/src/PrettyPrinter.h
Modified: pretty-printer/src/ConfigUI.c
16 files changed, 8 insertions(+), 8 deletions(-)
===================================================================
@@ -18,15 +18,15 @@
#include "ConfigUI.h"
-//======================= FUNCTIONS ====================================================================
+/*======================= FUNCTIONS ====================================================================*/
-//static GtkWidget* createTwoOptionsBox(const char* label, const char* checkBox1, const char* checkBox2, gboolean cb1Active, gboolean cb2Active, GtkWidget** option1, GtkWidget** option2);
+/*static GtkWidget* createTwoOptionsBox(const char* label, const char* checkBox1, const char* checkBox2, gboolean cb1Active, gboolean cb2Active, GtkWidget** option1, GtkWidget** option2);*/
static GtkWidget* createThreeOptionsBox(const char* label, const char* checkBox1, const char* checkBox2, const char* checkBox3, gboolean cb1Active, gboolean cb2Active, gboolean cb3Active, GtkWidget** option1, GtkWidget** option2, GtkWidget** option3);
static GtkWidget* createEmptyTextOptions(gboolean emptyNodeStripping, gboolean emptyNodeStrippingSpace, gboolean forceEmptyNodeSplit);
static GtkWidget* createIndentationOptions(char indentation, int count);
static GtkWidget* createLineReturnOptions(const char* lineReturn);
-//============================================ PRIVATE PROPERTIES ======================================
+/*============================================ PRIVATE PROPERTIES ======================================*/
static GtkWidget* commentOneLine;
static GtkWidget* commentInline;
@@ -44,15 +44,15 @@
static GtkWidget* indentationCount;
static GtkWidget* lineBreak;
-//============================================= PUBLIC FUNCTIONS ========================================
+/*============================================= PUBLIC FUNCTIONS ========================================*/
-//redeclaration of extern variable
+/* redeclaration of extern variable */
PrettyPrintingOptions* prettyPrintingOptions;
-//Will never be used, just here for example
+/* Will never be used, just here for example */
GtkWidget* createPrettyPrinterConfigUI(GtkDialog * dialog)
{
- //default printing options
+ /* default printing options */
if (prettyPrintingOptions == NULL) { prettyPrintingOptions = createDefaultPrettyPrintingOptions(); }
PrettyPrintingOptions* ppo = prettyPrintingOptions;
@@ -111,7 +111,7 @@ void saveSettings(void)
else ppo->newLineChars = "\r\n";
}
-//============================================= PRIVATE FUNCTIONS =======================================
+/*============================================= PRIVATE FUNCTIONS =======================================*/
/*GtkWidget* createTwoOptionsBox(const char* label,
const char* checkBox1,
Modified: pretty-printer/src/ConfigUI.h
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -19,7 +19,7 @@
#ifndef PP_CONFIG_UI_H
#define PP_CONFIG_UI_H
-//========================================== INCLUDES =========================================================
+/*========================================== INCLUDES =========================================================*/
#include <gtk/gtk.h>
@@ -30,11 +30,11 @@
#include "PrettyPrinter.h"
-//========================================== VARIABLES ========================================================
+/*========================================== VARIABLES ========================================================*/
extern PrettyPrintingOptions* prettyPrintingOptions;
-//========================================== FUNCTIONS ========================================================
+/*========================================== FUNCTIONS ========================================================*/
GtkWidget* createPrettyPrinterConfigUI(GtkDialog* dialog);
void saveSettings(void);
Modified: pretty-printer/src/PluginEntry.c
56 files changed, 28 insertions(+), 28 deletions(-)
===================================================================
@@ -28,7 +28,7 @@
GeanyData* geany_data;
GeanyFunctions* geany_functions;
-//========================================== PLUGIN INFORMATION ==========================================================
+/*========================================== PLUGIN INFORMATION ==========================================================*/
PLUGIN_VERSION_CHECK(130)
PLUGIN_SET_TRANSLATABLE_INFO(
@@ -39,11 +39,11 @@
PRETTY_PRINTER_VERSION, "Cédric Tabin - http://www.astorm.ch")
PLUGIN_KEY_GROUP(prettyprinter, 1)
-//========================================== DECLARATIONS ================================================================
+/*========================================== DECLARATIONS ================================================================*/
-static GtkWidget* main_menu_item = NULL; //the main menu of the plugin
+static GtkWidget* main_menu_item = NULL; /*the main menu of the plugin*/
-//declaration of the functions
+/* declaration of the functions */
static void xml_format(GtkMenuItem *menuitem, gpointer gdata);
static void kb_run_xml_pretty_print(G_GNUC_UNUSED guint key_id);
static void config_closed(GtkWidget* configWidget, gint response, gpointer data);
@@ -52,51 +52,51 @@
void plugin_cleanup(void);
GtkWidget* plugin_configure(GtkDialog * dialog);
-//========================================== FUNCTIONS ===================================================================
+/*========================================== FUNCTIONS ===================================================================*/
void plugin_init(GeanyData *data)
{
- //initializes the libxml2
+ /* initializes the libxml2 */
LIBXML_TEST_VERSION
- //mutilanguage support
+ /* mutilanguage support */
main_locale_init(LOCALEDIR, GETTEXT_PACKAGE);
- //put the menu into the Tools
+ /* put the menu into the Tools */
main_menu_item = gtk_menu_item_new_with_mnemonic(_("PrettyPrinter XML"));
ui_add_document_sensitive(main_menu_item);
gtk_widget_show(main_menu_item);
gtk_container_add(GTK_CONTAINER(geany->main_widgets->tools_menu), main_menu_item);
- //init keybindings
+ /* init keybindings */
keybindings_set_item(plugin_key_group, 0, kb_run_xml_pretty_print,
0, 0, "run_pretty_printer_xml", _("Run the PrettyPrinter XML"),
main_menu_item);
- //add activation callback
+ /* add activation callback */
g_signal_connect(main_menu_item, "activate", G_CALLBACK(xml_format), NULL);
}
void plugin_cleanup(void)
{
- //destroys the plugin
+ /* destroys the plugin */
gtk_widget_destroy(main_menu_item);
}
GtkWidget* plugin_configure(GtkDialog * dialog)
{
- //creates the configuration widget
+ /* creates the configuration widget */
GtkWidget* widget = createPrettyPrinterConfigUI(dialog);
g_signal_connect(dialog, "response", G_CALLBACK(config_closed), NULL);
return widget;
}
-//========================================== LISTENERS ===================================================================
+/*========================================== LISTENERS ===================================================================*/
void config_closed(GtkWidget* configWidget, gint response, gpointer gdata)
{
- //if the user clicked OK or APPLY, then save the settings
+ /* if the user clicked OK or APPLY, then save the settings */
if (response == GTK_RESPONSE_OK ||
response == GTK_RESPONSE_APPLY)
{
@@ -111,39 +111,39 @@ void kb_run_xml_pretty_print(G_GNUC_UNUSED guint key_id)
void xml_format(GtkMenuItem* menuitem, gpointer gdata)
{
- //retrieves the current document
+ /* retrieves the current document */
GeanyDocument* doc = document_get_current();
g_return_if_fail(doc != NULL);
GeanyEditor* editor = doc->editor;
ScintillaObject* sco = editor->sci;
- //default printing options
+ /* default printing options */
if (prettyPrintingOptions == NULL) { prettyPrintingOptions = createDefaultPrettyPrintingOptions(); }
- //prepare the buffer that will contain the text
- //from the scintilla object
+ /* prepare the buffer that will contain the text
+ * from the scintilla object */
int length = sci_get_length(sco)+1;
char* buffer = (char*)malloc(length*sizeof(char));
- if (buffer == NULL) { exit(-1); } //malloc error
+ if (buffer == NULL) { exit(-1); } /* malloc error */
- //retrieves the text
+ /* retrieves the text */
sci_get_text(sco, length, buffer);
- //checks if the data is an XML format
+ /* checks if the data is an XML format */
xmlDoc* parsedDocument = xmlParseDoc((unsigned char*)buffer);
- //this is not a valid xml => exit with an error message
+ /* this is not a valid xml => exit with an error message */
if(parsedDocument == NULL)
{
dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Unable to parse the content as XML."));
return;
}
- //free all
+ /* free all */
xmlFreeDoc(parsedDocument);
- //process pretty-printing
+ /* process pretty-printing */
int result = processXMLPrettyPrinting(&buffer, &length, prettyPrintingOptions);
if (result != PRETTY_PRINTING_SUCCESS)
{
@@ -151,14 +151,14 @@ void xml_format(GtkMenuItem* menuitem, gpointer gdata)
return;
}
- //updates the document
+ /* updates the document */
sci_set_text(sco, buffer);
- //set the line
+ /* set the line */
int xOffset = scintilla_send_message(sco, SCI_GETXOFFSET, 0, 0);
- scintilla_send_message(sco, SCI_LINESCROLL, -xOffset, 0); //TODO update with the right function-call for geany-0.19
+ scintilla_send_message(sco, SCI_LINESCROLL, -xOffset, 0); /* TODO update with the right function-call for geany-0.19 */
- //sets the type
+ /* sets the type */
GeanyFiletype* fileType = filetypes_index(GEANY_FILETYPES_XML);
document_set_filetype(doc, fileType);
}
Modified: pretty-printer/src/PluginEntry.h
6 files changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -19,7 +19,7 @@
#ifndef PLUGIN_ENTRY_H
#define PLUGIN_ENTRY_H
-//========================================== INCLUDES ==========================================================
+/*========================================== INCLUDES ==========================================================*/
#include <stdlib.h>
#include <stdio.h>
@@ -34,8 +34,8 @@
#include "PrettyPrinter.h"
#include "ConfigUI.h"
-//========================================== PROPERTIES ========================================================
+/*========================================== PROPERTIES ========================================================*/
-//========================================== FUNCTIONS =========================================================
+/*========================================== FUNCTIONS =========================================================*/
#endif
Modified: pretty-printer/src/PrettyPrinter.c
458 files changed, 229 insertions(+), 229 deletions(-)
===================================================================
@@ -18,63 +18,63 @@
#include "PrettyPrinter.h"
-//======================= FUNCTIONS ====================================================================
+/*======================= FUNCTIONS ====================================================================*/
-//error reporting functions
-static void PP_ERROR(const char* fmt, ...) G_GNUC_PRINTF(1,2); //prints an error message
+/* error reporting functions */
+static void PP_ERROR(const char* fmt, ...) G_GNUC_PRINTF(1,2); /* prints an error message */
-//xml pretty printing functions
-static void putCharInBuffer(char charToAdd); //put a char into the new char buffer
-static void putCharsInBuffer(const char* charsToAdd); //put the chars into the new char buffer
-static void putNextCharsInBuffer(int nbChars); //put the next nbChars of the input buffer into the new buffer
-static int readWhites(bool considerLineBreakAsWhite); //read the next whites into the input buffer
-static char readNextChar(void); //read the next char into the input buffer;
-static char getNextChar(void); //returns the next char but do not increase the input buffer index (use readNextChar for that)
-static char getPreviousInsertedChar(void); //returns the last inserted char into the new buffer
-static bool isWhite(char c); //check if the specified char is a white
-static bool isSpace(char c); //check if the specified char is a space
-static bool isLineBreak(char c); //check if the specified char is a new line
-static bool isQuote(char c); //check if the specified char is a quote (simple or double)
-static int putNewLine(void); //put a new line into the new char buffer with the correct number of whites (indentation)
-static bool isInlineNodeAllowed(void); //check if it is possible to have an inline node
-static bool isOnSingleLine(int skip, char stop1, char stop2); //check if the current node data is on one line (for inlining)
-static void resetBackwardIndentation(bool resetLineBreak); //reset the indentation for the current depth (just reset the index in fact)
+/* xml pretty printing functions */
+static void putCharInBuffer(char charToAdd); /* put a char into the new char buffer */
+static void putCharsInBuffer(const char* charsToAdd); /* put the chars into the new char buffer */
+static void putNextCharsInBuffer(int nbChars); /* put the next nbChars of the input buffer into the new buffer */
+static int readWhites(bool considerLineBreakAsWhite); /* read the next whites into the input buffer */
+static char readNextChar(void); /* read the next char into the input buffer; */
+static char getNextChar(void); /* returns the next char but do not increase the input buffer index (use readNextChar for that) */
+static char getPreviousInsertedChar(void); /* returns the last inserted char into the new buffer */
+static bool isWhite(char c); /* check if the specified char is a white */
+static bool isSpace(char c); /* check if the specified char is a space */
+static bool isLineBreak(char c); /* check if the specified char is a new line */
+static bool isQuote(char c); /* check if the specified char is a quote (simple or double) */
+static int putNewLine(void); /* put a new line into the new char buffer with the correct number of whites (indentation) */
+static bool isInlineNodeAllowed(void); /* check if it is possible to have an inline node */
+static bool isOnSingleLine(int skip, char stop1, char stop2); /* check if the current node data is on one line (for inlining) */
+static void resetBackwardIndentation(bool resetLineBreak); /* reset the indentation for the current depth (just reset the index in fact) */
-//specific parsing functions
-static int processElements(void); //returns the number of elements processed
-static void processElementAttribute(void); //process on attribute of a node
-static void processElementAttributes(void); //process all the attributes of a node
-static void processHeader(void); //process the header <?xml version="..." ?>
-static void processNode(void); //process an XML node
-static void processTextNode(void); //process a text node
-static void processComment(void); //process a comment
-static void processCDATA(void); //process a CDATA node
-static void processDoctype(void); //process a DOCTYPE node
-static void processDoctypeElement(void); //process a DOCTYPE ELEMENT node
+/* specific parsing functions */
+static int processElements(void); /* returns the number of elements processed */
+static void processElementAttribute(void); /* process on attribute of a node */
+static void processElementAttributes(void); /* process all the attributes of a node */
+static void processHeader(void); /* process the header <?xml version="..." ?> */
+static void processNode(void); /* process an XML node */
+static void processTextNode(void); /* process a text node */
+static void processComment(void); /* process a comment */
+static void processCDATA(void); /* process a CDATA node */
+static void processDoctype(void); /* process a DOCTYPE node */
+static void processDoctypeElement(void); /* process a DOCTYPE ELEMENT node */
-//debug function
-static void printError(const char *msg, ...) G_GNUC_PRINTF(1,2); //just print a message like the printf method
-static void printDebugStatus(void); //just print some variables into the console for debugging
+/* debug function */
+static void printError(const char *msg, ...) G_GNUC_PRINTF(1,2); /* just print a message like the printf method */
+static void printDebugStatus(void); /* just print some variables into the console for debugging */
-//============================================ PRIVATE PROPERTIES ======================================
+/*============================================ PRIVATE PROPERTIES ======================================*/
-//those are variables that are shared by the functions and
-//shouldn't be altered.
+/* those are variables that are shared by the functions and
+ * shouldn't be altered. */
-static int result; //result of the pretty printing
-static char* xmlPrettyPrinted; //new buffer for the formatted XML
-static int xmlPrettyPrintedLength; //buffer size
-static int xmlPrettyPrintedIndex; //buffer index (position of the next char to insert)
-static char* inputBuffer; //input buffer
-static int inputBufferLength; //input buffer size
-static int inputBufferIndex; //input buffer index (position of the next char to read into the input string)
-static int currentDepth; //current depth (for indentation)
-static char* currentNodeName; //current node name
-static bool appendIndentation; //if the indentation must be added (with a line break before)
-static bool lastNodeOpen; //defines if the last action was a not opening or not
-static PrettyPrintingOptions* options; //options of PrettyPrinting
+static int result; /* result of the pretty printing */
+static char* xmlPrettyPrinted; /* new buffer for the formatted XML */
+static int xmlPrettyPrintedLength; /* buffer size */
+static int xmlPrettyPrintedIndex; /* buffer index (position of the next char to insert) */
+static char* inputBuffer; /* input buffer */
+static int inputBufferLength; /* input buffer size */
+static int inputBufferIndex; /* input buffer index (position of the next char to read into the input string) */
+static int currentDepth; /* current depth (for indentation) */
+static char* currentNodeName; /* current node name */
+static bool appendIndentation; /* if the indentation must be added (with a line break before) */
+static bool lastNodeOpen; /* defines if the last action was a not opening or not */
+static PrettyPrintingOptions* options; /* options of PrettyPrinting */
-//============================================ GENERAL FUNCTIONS =======================================
+/*============================================ GENERAL FUNCTIONS =======================================*/
static void PP_ERROR(const char* fmt, ...)
{
@@ -88,11 +88,11 @@ static void PP_ERROR(const char* fmt, ...)
int processXMLPrettyPrinting(char** buffer, int* length, PrettyPrintingOptions* ppOptions)
{
- //empty buffer, nothing to process
+ /* empty buffer, nothing to process */
if (*length == 0) { return PRETTY_PRINTING_EMPTY_XML; }
if (buffer == NULL || *buffer == NULL) { return PRETTY_PRINTING_EMPTY_XML; }
- //initialize the variables
+ /* initialize the variables */
result = PRETTY_PRINTING_SUCCESS;
bool freeOptions = FALSE;
if (ppOptions == NULL)
@@ -116,43 +116,43 @@ int processXMLPrettyPrinting(char** buffer, int* length, PrettyPrintingOptions*
xmlPrettyPrinted = (char*)malloc(sizeof(char)*(*length));
if (xmlPrettyPrinted == NULL) { PP_ERROR("Allocation error (initialisation)"); return PRETTY_PRINTING_SYSTEM_ERROR; }
- //go to the first char
+ /* go to the first char */
readWhites(TRUE);
- //process the pretty-printing
+ /* process the pretty-printing */
processElements();
- //close the buffer
+ /* close the buffer */
putCharInBuffer('\0');
- //adjust the final size
+ /* adjust the final size */
char* reallocated = (char*)realloc(xmlPrettyPrinted, xmlPrettyPrintedIndex);
if (reallocated == NULL) { PP_ERROR("Allocation error (reallocation size is %d)", xmlPrettyPrintedIndex); return PRETTY_PRINTING_SYSTEM_ERROR; }
xmlPrettyPrinted = reallocated;
- //freeing the unused values
+ /* freeing the unused values */
if (freeOptions) { free(options); }
- //if success, then update the values
+ /* if success, then update the values */
if (result == PRETTY_PRINTING_SUCCESS)
{
free(*buffer);
*buffer = xmlPrettyPrinted;
- *length = xmlPrettyPrintedIndex-2; //the '\0' is not in the length
+ *length = xmlPrettyPrintedIndex-2; /* the '\0' is not in the length */
}
- //else clean the other values
+ /* else clean the other values */
else
{
free(xmlPrettyPrinted);
}
- //updating the pointers for the using into the caller function
- xmlPrettyPrinted = NULL; //avoid reference
- inputBuffer = NULL; //avoid reference
- currentNodeName = NULL; //avoid reference
- options = NULL; //avoid reference
+ /* updating the pointers for the using into the caller function */
+ xmlPrettyPrinted = NULL; /* avoid reference */
+ inputBuffer = NULL; /* avoid reference */
+ currentNodeName = NULL; /* avoid reference */
+ options = NULL; /* avoid reference */
- //and finally the result
+ /* and finally the result */
return result;
}
@@ -198,7 +198,7 @@ void putNextCharsInBuffer(int nbChars)
void putCharInBuffer(char charToAdd)
{
- //check if the buffer is full and reallocation if needed
+ /* check if the buffer is full and reallocation if needed */
if (xmlPrettyPrintedIndex >= xmlPrettyPrintedLength)
{
if (charToAdd == '\0') { ++xmlPrettyPrintedLength; }
@@ -208,7 +208,7 @@ void putCharInBuffer(char charToAdd)
xmlPrettyPrinted = reallocated;
}
- //putting the char and increase the index for the next one
+ /* putting the char and increase the index for the next one */
xmlPrettyPrinted[xmlPrettyPrintedIndex] = charToAdd;
++xmlPrettyPrintedIndex;
}
@@ -291,70 +291,70 @@ bool isLineBreak(char c)
bool isInlineNodeAllowed(void)
{
- //the last action was not an opening => inline not allowed
+ /* the last action was not an opening => inline not allowed */
if (!lastNodeOpen) { return FALSE; }
- int firstChar = getNextChar(); //should be '<' or we are in a text node
- int secondChar = inputBuffer[inputBufferIndex+1]; //should be '!'
- int thirdChar = inputBuffer[inputBufferIndex+2]; //should be '-' or '['
+ int firstChar = getNextChar(); /* should be '<' or we are in a text node */
+ int secondChar = inputBuffer[inputBufferIndex+1]; /* should be '!' */
+ int thirdChar = inputBuffer[inputBufferIndex+2]; /* should be '-' or '[' */
- //loop through the content up to the next opening/closing node
- int currentIndex = inputBufferIndex+1;
+ /* loop through the content up to the next opening/closing node */
+ currentIndex = inputBufferIndex+1;
if (firstChar == '<')
{
- //another node is being open ==> no inline !
+ /* another node is being open ==> no inline ! */
if (secondChar != '!') { return FALSE; }
- //okay we are in a comment/cdata node, so read until it is closed
+ /* okay we are in a comment/cdata node, so read until it is closed */
- //select the closing char
+ /* select the closing char */
char closingComment = '-';
if (thirdChar == '[') { closingComment = ']'; }
- //read until closing
+ /* read until closing */
char oldChar = ' ';
- currentIndex += 3; //that bypass meanless chars
+ currentIndex += 3; /* that bypass meanless chars */
bool loop = TRUE;
while (loop)
{
char current = inputBuffer[currentIndex];
- if (current == closingComment && oldChar == closingComment) { loop = FALSE; } //end of comment/cdata
+ if (current == closingComment && oldChar == closingComment) { loop = FALSE; } /* end of comment/cdata */
oldChar = current;
++currentIndex;
}
- //okay now avoid blanks
- // inputBuffer[index] is now '>'
+ /* okay now avoid blanks */
+ /* inputBuffer[index] is now '>' */
++currentIndex;
while (isWhite(inputBuffer[currentIndex])) { ++currentIndex; }
}
else
{
- //this is a text node. Simply loop to the next '<'
+ /* this is a text node. Simply loop to the next '<' */
while (inputBuffer[currentIndex] != '<') { ++currentIndex; }
}
- //check what do we have now
- char currentChar = inputBuffer[currentIndex];
+ /* check what do we have now */
+ currentChar = inputBuffer[currentIndex];
if (currentChar == '<')
{
- //check if that is a closing node
+ /* check if that is a closing node */
currentChar = inputBuffer[currentIndex+1];
if (currentChar == '/')
{
- //as we are in a correct XML (so far...), if the node is
- //being directly closed, the inline is allowed !!!
+ /* as we are in a correct XML (so far...), if the node is */
+ /* being directly closed, the inline is allowed !!! */
return TRUE;
}
}
- //inline not allowed...
+ /* inline not allowed... */
return FALSE;
}
bool isOnSingleLine(int skip, char stop1, char stop2)
{
- int currentIndex = inputBufferIndex+skip; //skip the n first chars (in comment <!--)
+ int currentIndex = inputBufferIndex+skip; /* skip the n first chars (in comment <!--) */
bool onSingleLine = TRUE;
char oldChar = inputBuffer[currentIndex];
@@ -377,7 +377,7 @@ bool isOnSingleLine(int skip, char stop1, char stop2)
{
while(oldChar != stop1 && currentChar != stop2)
{
- //okay there is something else => this is not on one line
+ /* okay there is something else => this is not on one line */
if (!isWhite(oldChar)) return FALSE;
++currentIndex;
@@ -385,8 +385,8 @@ bool isOnSingleLine(int skip, char stop1, char stop2)
currentChar = inputBuffer[currentIndex+1];
}
- //the end of the node has been reached with only whites. Then
- //the node can be considered being one single line
+ /* the end of the node has been reached with only whites. Then
+ * the node can be considered being one single line */
return TRUE;
}
}
@@ -404,15 +404,15 @@ void resetBackwardIndentation(bool resetLineBreak)
}
}
-//#########################################################################################################################################
-//-----------------------------------------------------------------------------------------------------------------------------------------
+/*#########################################################################################################################################*/
+/*-----------------------------------------------------------------------------------------------------------------------------------------*/
-//-----------------------------------------------------------------------------------------------------------------------------------------
-//=============================================================== NODE FUNCTIONS ==========================================================
-//-----------------------------------------------------------------------------------------------------------------------------------------
+/*-----------------------------------------------------------------------------------------------------------------------------------------*/
+/*=============================================================== NODE FUNCTIONS ==========================================================*/
+/*-----------------------------------------------------------------------------------------------------------------------------------------*/
-//-----------------------------------------------------------------------------------------------------------------------------------------
-//#########################################################################################################################################
+/*-----------------------------------------------------------------------------------------------------------------------------------------*/
+/*#########################################################################################################################################*/
int processElements(void)
{
@@ -421,36 +421,36 @@ int processElements(void)
bool loop = TRUE;
while (loop && result == PRETTY_PRINTING_SUCCESS)
{
- //strip unused whites
+ /* strip unused whites */
readWhites(TRUE);
char nextChar = getNextChar();
- if (nextChar == '\0') { return 0; } //no more data to read
+ if (nextChar == '\0') { return 0; } /* no more data to read */
- //put a new line with indentation
+ /* put a new line with indentation */
if (appendIndentation) { putNewLine(); }
- //always append indentation (but need to store the state)
+ /* always append indentation (but need to store the state) */
bool indentBackward = appendIndentation;
appendIndentation = TRUE;
- //okay what do we have now ?
+ /* okay what do we have now ? */
if (nextChar != '<')
{
- //a simple text node
+ /* a simple text node */
processTextNode();
++counter;
}
- else //some more check are needed
+ else /* some more check are needed */
{
nextChar = inputBuffer[inputBufferIndex+1];
if (nextChar == '!')
{
char oneMore = inputBuffer[inputBufferIndex+2];
- if (oneMore == '-') { processComment(); ++counter; } //a comment
- else if (oneMore == '[') { processCDATA(); ++counter; } //cdata
- else if (oneMore == 'D') { processDoctype(); ++counter; } //doctype <!DOCTYPE ... >
- else if (oneMore == 'E') { processDoctypeElement(); ++counter; } //doctype element <!ELEMENT ... >
+ if (oneMore == '-') { processComment(); ++counter; } /* a comment */
+ else if (oneMore == '[') { processCDATA(); ++counter; } /* cdata */
+ else if (oneMore == 'D') { processDoctype(); ++counter; } /* doctype <!DOCTYPE ... > */
+ else if (oneMore == 'E') { processDoctypeElement(); ++counter; } /* doctype element <!ELEMENT ... > */
else
{
printError("processElements : Invalid char '%c' afer '<!'", oneMore);
@@ -459,22 +459,22 @@ int processElements(void)
}
else if (nextChar == '/')
{
- //close a node => stop the loop !!
+ /* close a node => stop the loop !! */
loop = FALSE;
if (indentBackward)
{
- //INDEX HACKING
+ /* INDEX HACKING */
xmlPrettyPrintedIndex -= options->indentLength;
}
}
else if (nextChar == '?')
{
- //this is a header
+ /* this is a header */
processHeader();
}
else
{
- //a new node is open
+ /* a new node is open */
processNode();
++counter;
}
@@ -487,7 +487,7 @@ int processElements(void)
void processElementAttribute(void)
{
- //process the attribute name
+ /* process the attribute name */
char nextChar = readNextChar();
while (nextChar != '=')
{
@@ -495,13 +495,13 @@ void processElementAttribute(void)
nextChar = readNextChar();
}
- putCharInBuffer(nextChar); //that's the '='
+ putCharInBuffer(nextChar); /* that's the '=' */
- //read the simple quote or double quote and put it into the buffer
+ /* read the simple quote or double quote and put it into the buffer */
char quote = readNextChar();
putCharInBuffer(quote);
- //process until the last quote
+ /* process until the last quote */
char value = readNextChar();
while(value != quote)
{
@@ -509,13 +509,13 @@ void processElementAttribute(void)
value = readNextChar();
}
- //simply add the last quote
+ /* simply add the last quote */
putCharInBuffer(quote);
}
void processElementAttributes(void)
{
- char current = getNextChar(); //should not be a white
+ char current = getNextChar(); /* should not be a white */
if (isWhite(current))
{
printError("processElementAttributes : first char shouldn't be a white");
@@ -526,15 +526,15 @@ void processElementAttributes(void)
bool loop = TRUE;
while (loop)
{
- readWhites(TRUE); //strip the whites
+ readWhites(TRUE); /* strip the whites */
- char next = getNextChar(); //don't read the last char (processed afterwards)
+ char next = getNextChar(); /* don't read the last char (processed afterwards) */
if (next == '/') { loop = FALSE; } /* end of node */
else if (next == '>') { loop = FALSE; } /* end of tag */
else if (next == '?') { loop = FALSE; } /* end of header */
else
{
- putCharInBuffer(' '); //put only one space to separate attributes
+ putCharInBuffer(' '); /* put only one space to separate attributes */
processElementAttribute();
}
}
@@ -542,8 +542,8 @@ void processElementAttributes(void)
void processHeader(void)
{
- int firstChar = inputBuffer[inputBufferIndex]; //should be '<'
- int secondChar = inputBuffer[inputBufferIndex+1]; //must be '?'
+ int firstChar = inputBuffer[inputBufferIndex]; /* should be '<' */
+ int secondChar = inputBuffer[inputBufferIndex+1]; /* must be '?' */
if (firstChar != '<')
{
@@ -554,7 +554,7 @@ void processHeader(void)
if (secondChar == '?')
{
- //puts the '<' and '?' chars into the new buffer
+ /* puts the '<' and '?' chars into the new buffer */
putNextCharsInBuffer(2);
while(!isWhite(getNextChar())) { putNextCharsInBuffer(1); }
@@ -562,7 +562,7 @@ void processHeader(void)
readWhites(TRUE);
processElementAttributes();
- //puts the '?' and '>' chars into the new buffer
+ /* puts the '?' and '>' chars into the new buffer */
putNextCharsInBuffer(2);
}
}
@@ -579,17 +579,17 @@ void processNode(void)
putCharInBuffer(opening);
- //read the node name
+ /* read the node name */
int nodeNameLength = 0;
while (!isWhite(getNextChar()) &&
- getNextChar() != '>' && //end of the tag
- getNextChar() != '/') //tag is being closed
+ getNextChar() != '>' && /* end of the tag */
+ getNextChar() != '/') /* tag is being closed */
{
putNextCharsInBuffer(1);
++nodeNameLength;
}
- //store the name
+ /* store the name */
char* nodeName = (char*)malloc(sizeof(char)*nodeNameLength+1);
if (nodeName == NULL) { PP_ERROR("Allocation error (node name length is %d)", nodeNameLength); return ; }
nodeName[nodeNameLength] = '\0';
@@ -600,34 +600,34 @@ void processNode(void)
nodeName[i] = xmlPrettyPrinted[tempIndex];
}
- currentNodeName = nodeName; //set the name for using in other methods
+ currentNodeName = nodeName; /* set the name for using in other methods */
lastNodeOpen = TRUE;
- //process the attributes
+ /* process the attributes */
readWhites(TRUE);
processElementAttributes();
- //process the end of the tag
+ /* process the end of the tag */
int subElementsProcessed = 0;
- char nextChar = getNextChar(); //should be either '/' or '>'
- if (nextChar == '/') //the node is being closed immediatly
+ char nextChar = getNextChar(); /* should be either '/' or '>' */
+ if (nextChar == '/') /* the node is being closed immediatly */
{
- //closing node directly
+ /* closing node directly */
if (options->emptyNodeStripping || !options->forceEmptyNodeSplit)
{
if (options->emptyNodeStrippingSpace) { putCharInBuffer(' '); }
putNextCharsInBuffer(2);
}
- //split the closing nodes
+ /* split the closing nodes */
else
{
- readNextChar(); //removing '/'
- readNextChar(); //removing '>'
+ readNextChar(); /* removing '/' */
+ readNextChar(); /* removing '>' */
putCharInBuffer('>');
if (!options->inlineText)
{
- //no inline text => new line !
+ /* no inline text => new line ! */
putNewLine();
}
@@ -641,7 +641,7 @@ void processNode(void)
}
else if (nextChar == '>')
{
- //the tag is just closed (maybe some content)
+ /* the tag is just closed (maybe some content) */
putNextCharsInBuffer(1);
subElementsProcessed = processElements();
}
@@ -652,8 +652,8 @@ void processNode(void)
return;
}
- //if the code reaches this area, then the processElements has been called and we must
- //close the opening tag
+ /* if the code reaches this area, then the processElements has been called and we must
+ * close the opening tag */
char closeChar = getNextChar();
if (closeChar != '<')
{
@@ -669,37 +669,37 @@ void processNode(void)
}
while(closeChar != '>');
- //there is no elements
+ /* there is no elements */
if (subElementsProcessed == 0)
{
- //the node will be stripped
+ /* the node will be stripped */
if (options->emptyNodeStripping)
{
- //because we have '<nodeName ...></nodeName>'
+ /* because we have '<nodeName ...></nodeName>' */
xmlPrettyPrintedIndex -= nodeNameLength+4;
resetBackwardIndentation(TRUE);
if (options->emptyNodeStrippingSpace) { putCharInBuffer(' '); }
putCharsInBuffer("/>");
}
- //the closing tag will be put on the same line
+ /* the closing tag will be put on the same line */
else if (options->inlineText)
{
- //correct the index because we have '</nodeName>'
+ /* correct the index because we have '</nodeName>' */
xmlPrettyPrintedIndex -= nodeNameLength+3;
resetBackwardIndentation(TRUE);
- //rewrite the node name
+ /* rewrite the node name */
putCharsInBuffer("</");
putCharsInBuffer(currentNodeName);
putCharInBuffer('>');
}
}
- //the node is closed
+ /* the node is closed */
lastNodeOpen = FALSE;
- //freeeeeeee !!!
+ /* freeeeeeee !!! */
free(nodeName);
nodeName = NULL;
currentNodeName = NULL;
@@ -712,23 +712,23 @@ void processComment(void)
if (inlineAllowed && !options->oneLineComment) { inlineAllowed = isOnSingleLine(4, '-', '-'); }
if (inlineAllowed) { resetBackwardIndentation(TRUE); }
- putNextCharsInBuffer(4); //add the chars '<!--'
+ putNextCharsInBuffer(4); /* add the chars '<!--' */
char oldChar = '-';
bool loop = TRUE;
while (loop)
{
char nextChar = readNextChar();
- if (oldChar == '-' && nextChar == '-') //comment is being closed
+ if (oldChar == '-' && nextChar == '-') /* comment is being closed */
{
loop = FALSE;
}
- if (!isLineBreak(nextChar)) //the comment simply continues
+ if (!isLineBreak(nextChar)) /* the comment simply continues */
{
if (options->oneLineComment && isSpace(nextChar))
{
- //removes all the unecessary spaces
+ /* removes all the unecessary spaces */
while(isSpace(getNextChar()))
{
nextChar = readNextChar();
@@ -738,44 +738,44 @@ void processComment(void)
}
else
{
- //comment is left untouched
+ /* comment is left untouched */
putCharInBuffer(nextChar);
oldChar = nextChar;
}
- if (!loop && options->alignComment) //end of comment
+ if (!loop && options->alignComment) /* end of comment */
{
- //ensures the chars preceding the first '-' are all spaces (there are at least
- //5 spaces in front of the '-->' for the alignment with '<!--')
+ /* ensures the chars preceding the first '-' are all spaces (there are at least
+ * 5 spaces in front of the '-->' for the alignment with '<!--') */
bool onlySpaces = xmlPrettyPrinted[xmlPrettyPrintedIndex-3] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-4] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-5] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-6] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-7] == ' ';
- //if all the preceding chars are white, then go for replacement
+ /* if all the preceding chars are white, then go for replacement */
if (onlySpaces)
{
- xmlPrettyPrintedIndex -= 7; //remove indentation spaces
- putCharsInBuffer("--"); //reset the first chars of '-->'
+ xmlPrettyPrintedIndex -= 7; /* remove indentation spaces */
+ putCharsInBuffer("--"); /* reset the first chars of '-->' */
}
}
}
- else if (!options->oneLineComment && !inlineAllowed) //oh ! there is a line break
+ else if (!options->oneLineComment && !inlineAllowed) /* oh ! there is a line break */
{
- //if the comments need to be aligned, just add 5 spaces
+ /* if the comments need to be aligned, just add 5 spaces */
if (options->alignComment)
{
- int read = readWhites(FALSE); //strip the whites and new line
- if (nextChar == '\r' && read == 0 && getNextChar() == '\n') //handles the \r\n return line
+ int read = readWhites(FALSE); /* strip the whites and new line */
+ if (nextChar == '\r' && read == 0 && getNextChar() == '\n') /* handles the \r\n return line */
{
readNextChar();
readWhites(FALSE);
}
- putNewLine(); //put a new indentation line
- putCharsInBuffer(" "); //align with <!--
- oldChar = ' '; //and update the last char
+ putNewLine(); /* put a new indentation line */
+ putCharsInBuffer(" "); /* align with <!-- */
+ oldChar = ' '; /* and update the last char */
}
else
{
@@ -783,11 +783,11 @@ void processComment(void)
oldChar = nextChar;
}
}
- else //the comments must be inlined
+ else /* the comments must be inlined */
{
- readWhites(TRUE); //strip the whites and add a space if needed
+ readWhites(TRUE); /* strip the whites and add a space if needed */
if (getPreviousInsertedChar() != ' ' &&
- strncmp(xmlPrettyPrinted+xmlPrettyPrintedIndex-4, "<!--", 4) != 0) //prevents adding a space at the beginning
+ strncmp(xmlPrettyPrinted+xmlPrettyPrintedIndex-4, "<!--", 4) != 0) /* prevents adding a space at the beginning */
{
putCharInBuffer(' ');
oldChar = ' ';
@@ -795,7 +795,7 @@ void processComment(void)
}
}
- char lastChar = readNextChar(); //should be '>'
+ char lastChar = readNextChar(); /* should be '>' */
if (lastChar != '>')
{
printError("processComment : last char must be '>' (not '%c')", lastChar);
@@ -806,36 +806,36 @@ void processComment(void)
if (inlineAllowed) { appendIndentation = FALSE; }
- //there vas no node open
+ /* there vas no node open */
lastNodeOpen = FALSE;
}
void processTextNode(void)
{
- //checks if inline is allowed
+ /* checks if inline is allowed */
bool inlineTextAllowed = FALSE;
if (options->inlineText) { inlineTextAllowed = isInlineNodeAllowed(); }
if (inlineTextAllowed && !options->oneLineText) { inlineTextAllowed = isOnSingleLine(0, '<', '/'); }
if (inlineTextAllowed || !options->alignText)
{
- resetBackwardIndentation(TRUE); //remove previous indentation
+ resetBackwardIndentation(TRUE); /* remove previous indentation */
if (!inlineTextAllowed) { putNewLine(); }
}
- //the leading whites are automatically stripped. So we re-add it
+ /* the leading whites are automatically stripped. So we re-add it */
if (!options->trimLeadingWhites)
{
int backwardIndex = inputBufferIndex-1;
while (isSpace(inputBuffer[backwardIndex]))
{
- --backwardIndex; //backward rolling
+ --backwardIndex; /* backward rolling */
}
- //now the input[backwardIndex] IS NOT a white. So we go to
- //the next char...
+ /* now the input[backwardIndex] IS NOT a white. So we go to
+ * the next char... */
++backwardIndex;
- //and then re-add the whites
+ /* and then re-add the whites */
while (inputBuffer[backwardIndex] == ' ' ||
inputBuffer[backwardIndex] == '\t')
{
@@ -844,7 +844,7 @@ void processTextNode(void)
}
}
- //process the text into the node
+ /* process the text into the node */
while(getNextChar() != '<')
{
char nextChar = readNextChar();
@@ -854,21 +854,21 @@ void processTextNode(void)
{
readWhites(TRUE);
- //as we can put text on one line, remove the line break
- //and replace it by a space but only if the previous
- //char wasn't a space
+ /* as we can put text on one line, remove the line break
+ * and replace it by a space but only if the previous
+ * char wasn't a space */
if (getPreviousInsertedChar() != ' ') { putCharInBuffer(' '); }
}
else if (options->alignText)
{
int read = readWhites(FALSE);
- if (nextChar == '\r' && read == 0 && getNextChar() == '\n') //handles the '\r\n'
+ if (nextChar == '\r' && read == 0 && getNextChar() == '\n') /* handles the '\r\n' */
{
nextChar = readNextChar();
readWhites(FALSE);
}
- //put a new line only if the closing tag is not reached
+ /* put a new line only if the closing tag is not reached */
if (getNextChar() != '<')
{
putNewLine();
@@ -885,7 +885,7 @@ void processTextNode(void)
}
}
- //strip the trailing whites
+ /* strip the trailing whites */
if (options->trimTrailingWhites)
{
while(getPreviousInsertedChar() == ' ' ||
@@ -895,10 +895,10 @@ void processTextNode(void)
}
}
- //remove the indentation for the closing tag
+ /* remove the indentation for the closing tag */
if (inlineTextAllowed) { appendIndentation = FALSE; }
- //there vas no node open
+ /* there vas no node open */
lastNodeOpen = FALSE;
}
@@ -909,7 +909,7 @@ void processCDATA(void)
if (inlineAllowed && !options->oneLineCdata) { inlineAllowed = isOnSingleLine(9, ']', ']'); }
if (inlineAllowed) { resetBackwardIndentation(TRUE); }
- putNextCharsInBuffer(9); //putting the '<![CDATA[' into the buffer
+ putNextCharsInBuffer(9); /* putting the '<![CDATA[' into the buffer */
bool loop = TRUE;
char oldChar = '[';
@@ -917,13 +917,13 @@ void processCDATA(void)
{
char nextChar = readNextChar();
char nextChar2 = getNextChar();
- if (oldChar == ']' && nextChar == ']' && nextChar2 == '>') { loop = FALSE; } //end of cdata
+ if (oldChar == ']' && nextChar == ']' && nextChar2 == '>') { loop = FALSE; } /* end of cdata */
- if (!isLineBreak(nextChar)) //the cdata simply continues
+ if (!isLineBreak(nextChar)) /* the cdata simply continues */
{
if (options->oneLineCdata && isSpace(nextChar))
{
- //removes all the unecessary spaces
+ /* removes all the unecessary spaces */
while(isSpace(nextChar2))
{
nextChar = readNextChar();
@@ -935,15 +935,15 @@ void processCDATA(void)
}
else
{
- //comment is left untouched
+ /* comment is left untouched */
putCharInBuffer(nextChar);
oldChar = nextChar;
}
- if (!loop && options->alignCdata) //end of cdata
+ if (!loop && options->alignCdata) /* end of cdata */
{
- //ensures the chars preceding the first '-' are all spaces (there are at least
- //10 spaces in front of the ']]>' for the alignment with '<![CDATA[')
+ /* ensures the chars preceding the first '-' are all spaces (there are at least
+ * 10 spaces in front of the ']]>' for the alignment with '<![CDATA[') */
bool onlySpaces = xmlPrettyPrinted[xmlPrettyPrintedIndex-3] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-4] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-5] == ' ' &&
@@ -954,29 +954,29 @@ void processCDATA(void)
xmlPrettyPrinted[xmlPrettyPrintedIndex-10] == ' ' &&
xmlPrettyPrinted[xmlPrettyPrintedIndex-11] == ' ';
- //if all the preceding chars are white, then go for replacement
+ /* if all the preceding chars are white, then go for replacement */
if (onlySpaces)
{
- xmlPrettyPrintedIndex -= 11; //remove indentation spaces
- putCharsInBuffer("]]"); //reset the first chars of '-->'
+ xmlPrettyPrintedIndex -= 11; /* remove indentation spaces */
+ putCharsInBuffer("]]"); /* reset the first chars of '-->' */
}
}
}
- else if (!options->oneLineCdata && !inlineAllowed) //line break
+ else if (!options->oneLineCdata && !inlineAllowed) /* line break */
{
- //if the cdata need to be aligned, just add 9 spaces
+ /* if the cdata need to be aligned, just add 9 spaces */
if (options->alignCdata)
{
- int read = readWhites(FALSE); //strip the whites and new line
- if (nextChar == '\r' && read == 0 && getNextChar() == '\n') //handles the \r\n return line
+ int read = readWhites(FALSE); /* strip the whites and new line */
+ if (nextChar == '\r' && read == 0 && getNextChar() == '\n') /* handles the \r\n return line */
{
readNextChar();
readWhites(FALSE);
}
- putNewLine(); //put a new indentation line
- putCharsInBuffer(" "); //align with <![CDATA[
- oldChar = ' '; //and update the last char
+ putNewLine(); /* put a new indentation line */
+ putCharsInBuffer(" "); /* align with <![CDATA[ */
+ oldChar = ' '; /* and update the last char */
}
else
{
@@ -984,11 +984,11 @@ void processCDATA(void)
oldChar = nextChar;
}
}
- else //cdata are inlined
+ else /* cdata are inlined */
{
- readWhites(TRUE); //strip the whites and add a space if necessary
+ readWhites(TRUE); /* strip the whites and add a space if necessary */
if(getPreviousInsertedChar() != ' ' &&
- strncmp(xmlPrettyPrinted+xmlPrettyPrintedIndex-9, "<![CDATA[", 9) != 0) //prevents adding a space at the beginning
+ strncmp(xmlPrettyPrinted+xmlPrettyPrintedIndex-9, "<![CDATA[", 9) != 0) /* prevents adding a space at the beginning */
{
putCharInBuffer(' ');
oldChar = ' ';
@@ -996,10 +996,10 @@ void processCDATA(void)
}
}
- //if the cdata is inline, then all the trailing spaces are removed
+ /* if the cdata is inline, then all the trailing spaces are removed */
if (options->oneLineCdata)
{
- xmlPrettyPrintedIndex -= 2; //because of the last ']]' inserted
+ xmlPrettyPrintedIndex -= 2; /* because of the last ']]' inserted */
while(isWhite(xmlPrettyPrinted[xmlPrettyPrintedIndex-1]))
{
--xmlPrettyPrintedIndex;
@@ -1007,8 +1007,8 @@ void processCDATA(void)
putCharsInBuffer("]]");
}
- //finalize the cdata
- char lastChar = readNextChar(); //should be '>'
+ /* finalize the cdata */
+ lastChar = readNextChar(); /* should be '>' */
if (lastChar != '>')
{
printError("processCDATA : last char must be '>' (not '%c')", lastChar);
@@ -1020,38 +1020,38 @@ void processCDATA(void)
if (inlineAllowed) { appendIndentation = FALSE; }
- //there was no node open
+ /* there was no node open */
lastNodeOpen = FALSE;
}
void processDoctype(void)
{
- putNextCharsInBuffer(9); //put the '<!DOCTYPE' into the buffer
+ putNextCharsInBuffer(9); /* put the '<!DOCTYPE' into the buffer */
bool loop = TRUE;
while(loop)
{
readWhites(TRUE);
- putCharInBuffer(' '); //only one space for the attributes
+ putCharInBuffer(' '); /* only one space for the attributes */
int nextChar = readNextChar();
while(!isWhite(nextChar) &&
- !isQuote(nextChar) && //begins a quoted text
- nextChar != '=' && //begins an attribute
- nextChar != '>' && //end of doctype
- nextChar != '[') //inner <!ELEMENT> types
+ !isQuote(nextChar) && /* begins a quoted text */
+ nextChar != '=' && /* begins an attribute */
+ nextChar != '>' && /* end of doctype */
+ nextChar != '[') /* inner <!ELEMENT> types */
{
putCharInBuffer(nextChar);
nextChar = readNextChar();
}
- if (isWhite(nextChar)) {} //do nothing, just let the next loop do the job
+ if (isWhite(nextChar)) {} /* do nothing, just let the next loop do the job */
else if (isQuote(nextChar) || nextChar == '=')
{
if (nextChar == '=')
{
putCharInBuffer(nextChar);
- nextChar = readNextChar(); //now we should have a quote
+ nextChar = readNextChar(); /* now we should have a quote */
if (!isQuote(nextChar))
{
@@ -1061,7 +1061,7 @@ void processDoctype(void)
}
}
- //simply process the content
+ /* simply process the content */
char quote = nextChar;
do
{
@@ -1069,14 +1069,14 @@ void processDoctype(void)
nextChar = readNextChar();
}
while (nextChar != quote);
- putCharInBuffer(nextChar); //now the last char is the last quote
+ putCharInBuffer(nextChar); /* now the last char is the last quote */
}
- else if (nextChar == '>') //end of doctype
+ else if (nextChar == '>') /* end of doctype */
{
putCharInBuffer(nextChar);
loop = FALSE;
}
- else //the char is a '[' => not supported yet
+ else /* the char is a '[' => not supported yet */
{
printError("DOCTYPE inner ELEMENT is currently not supported by PrettyPrinter\n");
result = PRETTY_PRINTING_NOT_SUPPORTED_YET;
Modified: pretty-printer/src/PrettyPrinter.h
46 files changed, 23 insertions(+), 23 deletions(-)
===================================================================
@@ -19,7 +19,7 @@
#ifndef PRETTY_PRINTER_H
#define PRETTY_PRINTER_H
-//========================================== INCLUDES ==========================================================
+/*========================================== INCLUDES ==========================================================*/
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -34,7 +34,7 @@
#include <glib.h>
#endif
-//========================================== DEFINES ===========================================================
+/*========================================== DEFINES ===========================================================*/
#define PRETTY_PRINTER_VERSION "1.3"
@@ -54,7 +54,7 @@
typedef unsigned int bool;
-//========================================== STRUCTURES =======================================================
+/*========================================== STRUCTURES =======================================================*/
/**
* The PrettyPrintingOptions struct allows the programmer to tell the
@@ -62,29 +62,29 @@
*/
typedef struct
{
- const char* newLineChars; //char used to generate a new line (generally \r\n)
- char indentChar; //char used for indentation
- int indentLength; //number of char to use for indentation (by default 2 spaces)
- bool oneLineText; //text is put on one line
- bool inlineText; //if possible text are inline (no return after the opening node and before closing node)
- bool oneLineComment; //comments are put on one line
- bool inlineComment; //if possible comments are inline (no return after the opening node and before closing node)
- bool oneLineCdata; //cdata are put on one line
- bool inlineCdata; //if possible cdata are inline (no return after the opening node and before closing node)
- bool emptyNodeStripping; //the empty nodes such <node></node> are set to <node/>
- bool emptyNodeStrippingSpace; //put a space before the '/>' when a node is stripped
- bool forceEmptyNodeSplit; //force an empty node to be splitted : <node /> becomes <node></node> (only if emptyNodeStripping = false)
- bool trimLeadingWhites; //trim the leading whites in a text node
- bool trimTrailingWhites; //trim the trailing whites in a text node
- bool alignComment; //align the comments. If false, comments are untouched (only if oneLineComment = false)
- bool alignText; //align the text in a node. If false, text is untouched (only if oneLineText = false)
- bool alignCdata; //align the cdata. If false, cdata is untouched (only if oneLineCdata = false)
+ const char* newLineChars; /* char used to generate a new line (generally \r\n) */
+ char indentChar; /* char used for indentation */
+ int indentLength; /* number of char to use for indentation (by default 2 spaces) */
+ bool oneLineText; /* text is put on one line */
+ bool inlineText; /* if possible text are inline (no return after the opening node and before closing node) */
+ bool oneLineComment; /* comments are put on one line */
+ bool inlineComment; /* if possible comments are inline (no return after the opening node and before closing node) */
+ bool oneLineCdata; /* cdata are put on one line */
+ bool inlineCdata; /* if possible cdata are inline (no return after the opening node and before closing node) */
+ bool emptyNodeStripping; /* the empty nodes such <node></node> are set to <node/> */
+ bool emptyNodeStrippingSpace; /* put a space before the '/>' when a node is stripped */
+ bool forceEmptyNodeSplit; /* force an empty node to be splitted : <node /> becomes <node></node> (only if emptyNodeStripping = false) */
+ bool trimLeadingWhites; /* trim the leading whites in a text node */
+ bool trimTrailingWhites; /* trim the trailing whites in a text node */
+ bool alignComment; /* align the comments. If false, comments are untouched (only if oneLineComment = false) */
+ bool alignText; /* align the text in a node. If false, text is untouched (only if oneLineText = false) */
+ bool alignCdata; /* align the cdata. If false, cdata is untouched (only if oneLineCdata = false) */
}
PrettyPrintingOptions;
-//========================================== FUNCTIONS =========================================================
+/*========================================== FUNCTIONS =========================================================*/
-int processXMLPrettyPrinting(char** xml, int* length, PrettyPrintingOptions* ppOptions); //process the pretty-printing on a valid xml string (no check done !!!). The ppOptions ARE NOT FREE-ED after processing. The method returns 0 if the pretty-printing has been done.
-PrettyPrintingOptions* createDefaultPrettyPrintingOptions(void); //creates a default PrettyPrintingOptions object
+int processXMLPrettyPrinting(char** xml, int* length, PrettyPrintingOptions* ppOptions); /* process the pretty-printing on a valid xml string (no check done !!!). The ppOptions ARE NOT FREE-ED after processing. The method returns 0 if the pretty-printing has been done. */
+PrettyPrintingOptions* createDefaultPrettyPrintingOptions(void); /* creates a default PrettyPrintingOptions object */
#endif
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 08 Jul 2012 18:05:48
Commit: 17105b17532f159f0f5cf8636e9d09de0f7d714b
https://github.com/geany/geany-plugins/commit/17105b17532f159f0f5cf8636e9d0…
Log Message:
-----------
GeanySendMail: Remove useless \ before %
Modified Paths:
--------------
geanysendmail/src/geanysendmail.c
Modified: geanysendmail/src/geanysendmail.c
10 files changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -313,12 +313,12 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
if (mailer != NULL)
gtk_entry_set_text(GTK_ENTRY(pref_widgets.entry), mailer);
- label2 = gtk_label_new(_("Note: \n\t\%f will be replaced by your file."\
- "\n\t\%r will be replaced by recipient's email address."\
- "\n\t\%b will be replaced by basename of a file"\
+ label2 = gtk_label_new(_("Note: \n\t%f will be replaced by your file."\
+ "\n\t%r will be replaced by recipient's email address."\
+ "\n\t%b will be replaced by basename of a file"\
"\n\tExamples:"\
- "\n\tsylpheed --attach \"\%f\" --compose \"\%r\""\
- "\n\tmutt -s \"Sending \'\%b\'\" -a \"\%f\" \"\%r\""));
+ "\n\tsylpheed --attach \"%f\" --compose \"%r\""\
+ "\n\tmutt -s \"Sending \'%b\'\" -a \"%f\" \"%r\""));
gtk_label_set_selectable(GTK_LABEL(label2), TRUE);
gtk_widget_show(label2);
gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/1.22_release
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 08 Jul 2012 18:05:48
Commit: 17105b17532f159f0f5cf8636e9d09de0f7d714b
https://github.com/geany/geany-plugins/commit/17105b17532f159f0f5cf8636e9d0…
Log Message:
-----------
GeanySendMail: Remove useless \ before %
Modified Paths:
--------------
geanysendmail/src/geanysendmail.c
Modified: geanysendmail/src/geanysendmail.c
10 files changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -313,12 +313,12 @@ GtkWidget *plugin_configure(GtkDialog *dialog)
if (mailer != NULL)
gtk_entry_set_text(GTK_ENTRY(pref_widgets.entry), mailer);
- label2 = gtk_label_new(_("Note: \n\t\%f will be replaced by your file."\
- "\n\t\%r will be replaced by recipient's email address."\
- "\n\t\%b will be replaced by basename of a file"\
+ label2 = gtk_label_new(_("Note: \n\t%f will be replaced by your file."\
+ "\n\t%r will be replaced by recipient's email address."\
+ "\n\t%b will be replaced by basename of a file"\
"\n\tExamples:"\
- "\n\tsylpheed --attach \"\%f\" --compose \"\%r\""\
- "\n\tmutt -s \"Sending \'\%b\'\" -a \"\%f\" \"\%r\""));
+ "\n\tsylpheed --attach \"%f\" --compose \"%r\""\
+ "\n\tmutt -s \"Sending \'%b\'\" -a \"%f\" \"%r\""));
gtk_label_set_selectable(GTK_LABEL(label2), TRUE);
gtk_widget_show(label2);
gtk_misc_set_alignment(GTK_MISC(label2), 0, 0.5);
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
Branch: refs/heads/master
Author: Colomban Wendling <ban(a)herbesfolles.org>
Committer: Colomban Wendling <ban(a)herbesfolles.org>
Date: Sun, 08 Jul 2012 18:02:29
Commit: f61a90c92f4bcf1f5e5281a665ea9beaa3f77818
https://github.com/geany/geany-plugins/commit/f61a90c92f4bcf1f5e5281a665ea9…
Log Message:
-----------
GeanySendMail: Use N_() for translations in arrays
_() is a function and it then can't be used to initialize an array
element in C89, so use N_() that only marks the string for extracting
without actually translating it. This is not an issue here since the
translation will be done automatically later by GTK (using the
GETTEXT_PATKAGE registered in the same array).
Modified Paths:
--------------
geanysendmail/src/geanysendmail.c
Modified: geanysendmail/src/geanysendmail.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -184,7 +184,7 @@ static void add_stock_item(void)
GtkIconSet *icon_set;
GtkIconFactory *factory = gtk_icon_factory_new();
GtkIconTheme *theme = gtk_icon_theme_get_default();
- GtkStockItem item = { GEANYSENDMAIL_STOCK_MAIL, _("Mail"), 0, 0, GETTEXT_PACKAGE };
+ GtkStockItem item = { GEANYSENDMAIL_STOCK_MAIL, N_("Mail"), 0, 0, GETTEXT_PACKAGE };
if (gtk_icon_theme_has_icon(theme, "mail-message-new"))
{
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).