Revision: 819 http://svn.sourceforge.net/geany/?rev=819&view=rev Author: ntrel Date: 2006-09-17 12:58:04 -0700 (Sun, 17 Sep 2006)
Log Message: ----------- Move all static strings from templates.h to templates.c. Fix sign comparison warning.
Modified Paths: -------------- trunk/ChangeLog trunk/src/sci_cb.c trunk/src/templates.c trunk/src/templates.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-09-15 15:09:13 UTC (rev 818) +++ trunk/ChangeLog 2006-09-17 19:58:04 UTC (rev 819) @@ -1,3 +1,10 @@ +2006-09-17 Nick Treleaven nick.treleaven@btinternet.com + + * src/templates.h, src/templates.c: + Move all static strings from templates.h to templates.c. + * src/sci_cb.c: Fix sign comparison warning. + + 2006-09-15 Nick Treleaven nick.treleaven@btinternet.com
* src/ui_utils.h, src/ui_utils.c, src/callbacks.c, src/dialogs.c:
Modified: trunk/src/sci_cb.c =================================================================== --- trunk/src/sci_cb.c 2006-09-15 15:09:13 UTC (rev 818) +++ trunk/src/sci_cb.c 2006-09-17 19:58:04 UTC (rev 819) @@ -1396,7 +1396,7 @@ line_start = sci_get_position_from_line(doc_list[idx].sci, sci_get_line_from_position(doc_list[idx].sci, sel_start)); sci_cb_get_indent(doc_list[idx].sci, sel_start, TRUE); - if ((sel_start - line_start) <= strlen(indent)) + if ((sel_start - line_start) <= (gint) strlen(indent)) a = 0;
sci_set_selection_start(doc_list[idx].sci, sel_start + a);
Modified: trunk/src/templates.c =================================================================== --- trunk/src/templates.c 2006-09-15 15:09:13 UTC (rev 818) +++ trunk/src/templates.c 2006-09-17 19:58:04 UTC (rev 819) @@ -29,6 +29,224 @@ #include "utils.h" #include "document.h"
+ +// default templates, only for initial tempate file creation on first start of Geany +static const gchar templates_gpl_notice[] = "\ + * This program is free software; you can redistribute it and/or modify\n\ + * it under the terms of the GNU General Public License as published by\n\ + * the Free Software Foundation; either version 2 of the License, or\n\ + * (at your option) any later version.\n\ + *\n\ + * This program is distributed in the hope that it will be useful,\n\ + * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + * GNU General Public License for more details.\n\ + *\n\ + * You should have received a copy of the GNU General Public License\n\ + * along with this program; if not, write to the Free Software\n\ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ +"; + +static const gchar templates_gpl_notice_pascal[] = "\ + This program is free software; you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation; either version 2 of the License, or\n\ + (at your option) any later version.\n\ +\n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details.\n\ +\n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; if not, write to the Free Software\n\ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ +"; + +static const gchar templates_gpl_notice_route[] = "\ +# This program is free software; you can redistribute it and/or modify\n\ +# it under the terms of the GNU General Public License as published by\n\ +# the Free Software Foundation; either version 2 of the License, or\n\ +# (at your option) any later version.\n\ +#\n\ +# This program is distributed in the hope that it will be useful,\n\ +# but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ +# GNU General Public License for more details.\n\ +#\n\ +# You should have received a copy of the GNU General Public License\n\ +# along with this program; if not, write to the Free Software\n\ +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ +"; + +static const gchar templates_function_description[] = "\ +/* \n\ + * name: {functionname}\n\ + * @param\n\ + * @return\n\ +*/\n"; + +static const gchar templates_function_description_pascal[] = "\ +{\n\ + name: {functionname}\n\ + @param\n\ + @return\n\ +}\n"; + +static const gchar templates_function_description_route[] = "\ +#\n\ +# name: {functionname}\n\ +# @param\n\ +# @return\n\ +"; + +static const gchar templates_multiline[] = "\ +/* \n\ + * \n\ +*/"; + +static const gchar templates_multiline_pascal[] = "\ +{\n\ + \n\ +}"; + +static const gchar templates_multiline_route[] = "\ +#\n\ +#"; + +static const gchar templates_fileheader[] = "\ +/*\n\ + * {filename}\n\ + *\n\ + * Copyright {year} {developer} <{mail}>\n\ + *\n\ +{gpl}\ + */\n\n"; + +static const gchar templates_fileheader_pascal[] = "\ +{\n\ + {filename}\n\ +\n\ + Copyright {year} {developer} <{mail}>\n\ +\n\ +{gpl}\ +}\n\n"; + +static const gchar templates_fileheader_route[] = "\ +#\n\ +# {filename}\n\ +#\n\ +# Copyright {year} {developer} <{mail}>\n\ +#\n\ +{gpl}\ +#\n\n"; + +static const gchar templates_changelog[] = "\ +{date} {developer} <{mail}>\n\ +\n\ + * \n\n\n"; + +static const gchar templates_filetype_none[] = ""; + +static const gchar templates_filetype_c[] = "\n\ +#include <stdio.h>\n\ +\n\ +int main(int argc, char** argv)\n\ +{\n\ + \n\ + return 0;\n\ +}\n\ +"; + +static const gchar templates_filetype_cpp[] = "\n\ +#include <iostream>\n\ +\n\ +int main(int argc, char** argv)\n\ +{\n\ + \n\ + return 0;\n\ +}\n\ +"; + +static const gchar templates_filetype_d[] = "\n\ +import std.stdio;\n\ +\n\ +int main(char[][] args)\n\ +{\n\ +\n\ + return 0;\n\ +}\n\ +"; + +static const gchar templates_filetype_php[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\ + \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\ +<html xmlns="http://www.w3.org/1999/xhtml%5C" xml:lang="en" lang="en">\n\ +\n\ +<head>\n\ + <title>{untitled}</title>\n\ + <meta http-equiv="content-type" content="text/html;charset=utf-8" />\n\ + <meta name="generator" content="{geanyversion}" />\n\ +</head>\n\ +\n\ +<body>\n\ +\n\ +</body>\n\ +</html>\n\ +"; + +static const gchar templates_filetype_html[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\ + \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\ +<html xmlns="http://www.w3.org/1999/xhtml%5C" xml:lang="en" lang="en">\n\ +\n\ +<head>\n\ + <title>{untitled}</title>\n\ + <meta http-equiv="content-type" content="text/html;charset=utf-8" />\n\ + <meta name="generator" content="{geanyversion}" />\n\ +</head>\n\ +\n\ +<body>\n\ +\n\ +</body>\n\ +</html>\n\ +"; + +static const gchar templates_filetype_pascal[] = "program {untitled};\n\ +\n\ +uses crt;\n\ +var i : byte;\n\ +\n\ +BEGIN\n\ + \n\ + \n\ +END.\n\ +"; + +static const gchar templates_filetype_java[] = "\n\ +\n\ +public class {untitled} {\n\ +\n\ + public static void main (String args[]) {\n\ + \n\ + \n\ + }\n\ +}\n\ +"; + +static const gchar templates_filetype_ruby[] = "\n\ +\n\ +class StdClass\n\ + def initialize\n\ + \n\ + end\n\ +end\n\ +\n\ +x = StdClass.new\n\ +"; + + +static gchar *templates[GEANY_MAX_TEMPLATES]; + + // some simple macros to reduce code size and make the code readable #define templates_get_filename(x) g_strconcat(app->configdir, G_DIR_SEPARATOR_S, x, NULL) #define templates_create_file(x, y) if (! g_file_test(x, G_FILE_TEST_EXISTS)) utils_write_file(x, y) @@ -36,11 +254,9 @@
// prototype, because this function should never be used outside of templates.c -gchar *templates_replace_all(gchar *source, gchar *year, gchar *date); +static gchar *templates_replace_all(gchar *source, gchar *year, gchar *date);
-static gchar *templates[GEANY_MAX_TEMPLATES];
- void templates_init(void) { gchar *template_filename_fileheader = templates_get_filename("template.fileheader"); @@ -300,7 +516,7 @@ }
-gchar *templates_replace_all(gchar *text, gchar *year, gchar *date) +static gchar *templates_replace_all(gchar *text, gchar *year, gchar *date) { text = utils_str_replace(text, "{year}", year); text = utils_str_replace(text, "{date}", date);
Modified: trunk/src/templates.h =================================================================== --- trunk/src/templates.h 2006-09-15 15:09:13 UTC (rev 818) +++ trunk/src/templates.h 2006-09-17 19:58:04 UTC (rev 819) @@ -69,219 +69,4 @@ };
- - -// default templates, only for initial tempate file creation on first start of Geany -static const gchar templates_gpl_notice[] = "\ - * This program is free software; you can redistribute it and/or modify\n\ - * it under the terms of the GNU General Public License as published by\n\ - * the Free Software Foundation; either version 2 of the License, or\n\ - * (at your option) any later version.\n\ - *\n\ - * This program is distributed in the hope that it will be useful,\n\ - * but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ - * GNU General Public License for more details.\n\ - *\n\ - * You should have received a copy of the GNU General Public License\n\ - * along with this program; if not, write to the Free Software\n\ - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ -"; - -static const gchar templates_gpl_notice_pascal[] = "\ - This program is free software; you can redistribute it and/or modify\n\ - it under the terms of the GNU General Public License as published by\n\ - the Free Software Foundation; either version 2 of the License, or\n\ - (at your option) any later version.\n\ -\n\ - This program is distributed in the hope that it will be useful,\n\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ - GNU General Public License for more details.\n\ -\n\ - You should have received a copy of the GNU General Public License\n\ - along with this program; if not, write to the Free Software\n\ - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ -"; - -static const gchar templates_gpl_notice_route[] = "\ -# This program is free software; you can redistribute it and/or modify\n\ -# it under the terms of the GNU General Public License as published by\n\ -# the Free Software Foundation; either version 2 of the License, or\n\ -# (at your option) any later version.\n\ -#\n\ -# This program is distributed in the hope that it will be useful,\n\ -# but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ -# GNU General Public License for more details.\n\ -#\n\ -# You should have received a copy of the GNU General Public License\n\ -# along with this program; if not, write to the Free Software\n\ -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\ -"; - -static const gchar templates_function_description[] = "\ -/* \n\ - * name: {functionname}\n\ - * @param\n\ - * @return\n\ -*/\n"; - -static const gchar templates_function_description_pascal[] = "\ -{\n\ - name: {functionname}\n\ - @param\n\ - @return\n\ -}\n"; - -static const gchar templates_function_description_route[] = "\ -#\n\ -# name: {functionname}\n\ -# @param\n\ -# @return\n\ -"; - -static const gchar templates_multiline[] = "\ -/* \n\ - * \n\ -*/"; - -static const gchar templates_multiline_pascal[] = "\ -{\n\ - \n\ -}"; - -static const gchar templates_multiline_route[] = "\ -#\n\ -#"; - -static const gchar templates_fileheader[] = "\ -/*\n\ - * {filename}\n\ - *\n\ - * Copyright {year} {developer} <{mail}>\n\ - *\n\ -{gpl}\ - */\n\n"; - -static const gchar templates_fileheader_pascal[] = "\ -{\n\ - {filename}\n\ -\n\ - Copyright {year} {developer} <{mail}>\n\ -\n\ -{gpl}\ -}\n\n"; - -static const gchar templates_fileheader_route[] = "\ -#\n\ -# {filename}\n\ -#\n\ -# Copyright {year} {developer} <{mail}>\n\ -#\n\ -{gpl}\ -#\n\n"; - -static const gchar templates_changelog[] = "\ -{date} {developer} <{mail}>\n\ -\n\ - * \n\n\n"; - -static const gchar templates_filetype_none[] = ""; - -static const gchar templates_filetype_c[] = "\n\ -#include <stdio.h>\n\ -\n\ -int main(int argc, char** argv)\n\ -{\n\ - \n\ - return 0;\n\ -}\n\ -"; - -static const gchar templates_filetype_cpp[] = "\n\ -#include <iostream>\n\ -\n\ -int main(int argc, char** argv)\n\ -{\n\ - \n\ - return 0;\n\ -}\n\ -"; - -static const gchar templates_filetype_d[] = "\n\ -import std.stdio;\n\ -\n\ -int main(char[][] args)\n\ -{\n\ -\n\ - return 0;\n\ -}\n\ -"; - -static const gchar templates_filetype_php[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\ - \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\ -<html xmlns="http://www.w3.org/1999/xhtml%5C" xml:lang="en" lang="en">\n\ -\n\ -<head>\n\ - <title>{untitled}</title>\n\ - <meta http-equiv="content-type" content="text/html;charset=utf-8" />\n\ - <meta name="generator" content="{geanyversion}" />\n\ -</head>\n\ -\n\ -<body>\n\ -\n\ -</body>\n\ -</html>\n\ -"; - -static const gchar templates_filetype_html[] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\ - \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\ -<html xmlns="http://www.w3.org/1999/xhtml%5C" xml:lang="en" lang="en">\n\ -\n\ -<head>\n\ - <title>{untitled}</title>\n\ - <meta http-equiv="content-type" content="text/html;charset=utf-8" />\n\ - <meta name="generator" content="{geanyversion}" />\n\ -</head>\n\ -\n\ -<body>\n\ -\n\ -</body>\n\ -</html>\n\ -"; - -static const gchar templates_filetype_pascal[] = "program {untitled};\n\ -\n\ -uses crt;\n\ -var i : byte;\n\ -\n\ -BEGIN\n\ - \n\ - \n\ -END.\n\ -"; - -static const gchar templates_filetype_java[] = "\n\ -\n\ -public class {untitled} {\n\ -\n\ - public static void main (String args[]) {\n\ - \n\ - \n\ - }\n\ -}\n\ -"; - -static const gchar templates_filetype_ruby[] = "\n\ -\n\ -class StdClass\n\ - def initialize\n\ - \n\ - end\n\ -end\n\ -\n\ -x = StdClass.new\n\ -"; - #endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.