Permalink
Browse files

PrettyPrinter: Don't use C++-style comments

  • Loading branch information...
b4n committed Jul 8, 2012
1 parent 2cb4144 commit b38189f5380a84cc2ae437254dd78ec4dae839ba
@@ -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* indentationChar;
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,
@@ -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);
@@ -28,7 +28,7 @@ GeanyPlugin* geany_plugin;
GeanyData* geany_data;
GeanyFunctions* geany_functions;
-//========================================== PLUGIN INFORMATION ==========================================================
+/*========================================== PLUGIN INFORMATION ==========================================================*/
PLUGIN_VERSION_CHECK(130)
PLUGIN_SET_TRANSLATABLE_INFO(
@@ -39,11 +39,11 @@ PLUGIN_SET_TRANSLATABLE_INFO(
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_init(GeanyData *data);
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,54 +111,54 @@ 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)
{
dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Unable to process PrettyPrinting on the specified XML because some features are not supported.\n\nSee Help > Debug messages for more details..."));
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);
}
@@ -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
Oops, something went wrong.

0 comments on commit b38189f

Please sign in to comment.