diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /fluid/Fl_Function_Type.cxx | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'fluid/Fl_Function_Type.cxx')
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 118 |
1 files changed, 56 insertions, 62 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 030c6c454..d39e2164d 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // C function type code for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2016 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #include <FL/Fl.H> #include <FL/Fl_Window.H> @@ -286,7 +284,7 @@ void Fl_Function_Type::write_code1() { star = "*"; } else rtype = "void"; } - + const char* k = class_name(0); if (k) { if (havechildren) @@ -306,21 +304,21 @@ void Fl_Function_Type::write_code1() { if (havechildren) write_c("%s%s ", rtype, star); } - + // if this is a subclass, only write_h() the part before the ':' char s[1024], *sptr = s; char *nptr = (char *)name(); - + while (*nptr) { if (*nptr == ':') { if (nptr[1] != ':') break; // Copy extra ":" for "class::member"... *sptr++ = *nptr++; - } + } *sptr++ = *nptr++; } *sptr = '\0'; - + write_h("%s;\n", s); // skip all function default param. init in body: int skips=0,skipc=0; @@ -328,25 +326,25 @@ void Fl_Function_Type::write_code1() { for (sptr=s,nptr=(char*)name(); *nptr; nc++,nptr++) { if (!skips && *nptr=='(') plevel++; else if (!skips && *nptr==')') plevel--; - if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') ) + if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && !(nc && *(nptr-1)=='\\')) skipc = skipc ? 0 : 1; - if(!skips && !skipc && plevel==1 && *nptr =='=' && - !(nc && *(nptr-1)=='\'') ) // ignore '=' case + if(!skips && !skipc && plevel==1 && *nptr =='=' && + !(nc && *(nptr-1)=='\'') ) // ignore '=' case while(*++nptr && (skips || skipc || ( (*nptr!=',' && *nptr!=')') || plevel!=1) )) { - if ( *nptr=='"' && *(nptr-1)!='\\' ) + if ( *nptr=='"' && *(nptr-1)!='\\' ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && *(nptr-1)!='\\') skipc = skipc ? 0 : 1; if (!skips && !skipc && *nptr=='(') plevel++; else if (!skips && *nptr==')') plevel--; } - - if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr; + + if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr; } *sptr = '\0'; - + if (havechildren) write_c("%s::%s {\n", k, s); } else { @@ -361,7 +359,7 @@ void Fl_Function_Type::write_code1() { if (havechildren) write_c("static "); } - + // write everything but the default parameters (if any) char s[1024], *sptr; char *nptr; @@ -370,30 +368,30 @@ void Fl_Function_Type::write_code1() { for (sptr=s,nptr=(char*)name(); *nptr; nc++,nptr++) { if (!skips && *nptr=='(') plevel++; else if (!skips && *nptr==')') plevel--; - if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') ) + if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && !(nc && *(nptr-1)=='\\')) skipc = skipc ? 0 : 1; - if(!skips && !skipc && plevel==1 && *nptr =='=' && - !(nc && *(nptr-1)=='\'') ) // ignore '=' case + if(!skips && !skipc && plevel==1 && *nptr =='=' && + !(nc && *(nptr-1)=='\'') ) // ignore '=' case while(*++nptr && (skips || skipc || ( (*nptr!=',' && *nptr!=')') || plevel!=1) )) { - if ( *nptr=='"' && *(nptr-1)!='\\' ) + if ( *nptr=='"' && *(nptr-1)!='\\' ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && *(nptr-1)!='\\') skipc = skipc ? 0 : 1; if (!skips && !skipc && *nptr=='(') plevel++; else if (!skips && *nptr==')') plevel--; } - - if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr; + + if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr; } *sptr = '\0'; - + if (havechildren) write_c("%s%s %s {\n", rtype, star, s); } } - + if (havewidgets && child && !child->name()) write_c(" %s* w;\n", subclassname(child)); indentation += 2; } @@ -406,7 +404,7 @@ void Fl_Function_Type::write_code2() { havechildren = 1; if (child->is_window() && child->name()) var = child->name(); } - + if (ismain()) { if (havewidgets) write_c(" %s->show(argc, argv);\n", var); if (havechildren) write_c(" return Fl::run();\n"); @@ -421,7 +419,7 @@ void Fl_Function_Type::write_code2() { int Fl_Function_Type::has_signature(const char *rtype, const char *sig) const { if (rtype && !return_type) return 0; if (!name()) return 0; - if ( (rtype==0L || strcmp(return_type, rtype)==0) + if ( (rtype==0L || strcmp(return_type, rtype)==0) && fl_filename_match(name(), sig)) { return 1; } @@ -585,7 +583,7 @@ void Fl_CodeBlock_Type::write_code2() { //////////////////////////////////////////////////////////////// -int Fl_Decl_Type::is_public() const +int Fl_Decl_Type::is_public() const { Fl_Type *p = parent; while (p && !p->is_decl_block()) p = p->parent; @@ -615,7 +613,7 @@ void Fl_Decl_Type::write_properties() { case 1: write_string("public"); break; case 2: write_string("protected"); break; } - if (static_) + if (static_) write_string("local"); else write_string("global"); @@ -743,7 +741,7 @@ void Fl_Decl_Type::write_code1() { write_h(" %.*s; %s\n", (int)(e-c), c, csc); } else { if (public_) { - if (static_) + if (static_) write_h("extern "); else write_comment_h(); @@ -754,7 +752,7 @@ void Fl_Decl_Type::write_code1() { } } else { write_comment_c(); - if (static_) + if (static_) write_c("static "); write_c("%.*s; %s\n", (int)(e-c), c, csc); } @@ -830,7 +828,7 @@ void Fl_Data_Type::open() { leave_source_dir(); if (fn) { if (strcmp(fn, data_filename->value())) - set_modflag(1); + set_modflag(1); data_filename->value(fn); } } @@ -852,7 +850,7 @@ void Fl_Data_Type::open() { for (;;++q) { if (!*q) break; if (!isspace((unsigned char)(*q))) goto OOPS; - } + } if (n==q) { OOPS: message = "variable name must be a C identifier"; free((void*)s); @@ -881,7 +879,7 @@ void Fl_Data_Type::open() { // store the filename c = data_filename->value(); if (filename_ && strcmp(filename_, data_filename->value())) - set_modflag(1); + set_modflag(1); else if (!filename_ && *c) set_modflag(1); if (filename_) { free((void*)filename_); filename_ = 0L; } @@ -974,7 +972,7 @@ void Fl_Data_Type::write_code1() { } } else { write_comment_c(); - if (static_) + if (static_) write_c("static "); if (text_mode_) { write_c("const char *%s = /* text inlined from %s */\n", c, fn); @@ -988,7 +986,7 @@ void Fl_Data_Type::write_code1() { write_c(";\n"); } } - // if we are in interactive mode, we pop up a warning dialog + // if we are in interactive mode, we pop up a warning dialog // giving the error: (batch_mode && !write_sourceview) ??? if (message && !write_sourceview) { if (batch_mode) @@ -1109,7 +1107,7 @@ Fl_Type *Fl_Comment_Type::make() { void Fl_Comment_Type::write_properties() { Fl_Type::write_properties(); - if (in_c_) write_string("in_source"); else write_string("not_in_source"); + if (in_c_) write_string("in_source"); else write_string("not_in_source"); if (in_h_) write_string("in_header"); else write_string("not_in_header"); } @@ -1133,11 +1131,11 @@ static void load_comments_preset(Fl_Preferences &menu) { static const char * const predefined_comment[] = { "GNU Public License/GPL Header", "GNU Public License/GPL Footer", "GNU Public License/LGPL Header", "GNU Public License/LGPL Footer", - "FLTK/Header", "FLTK/Footer" }; + "FLTK/Header" }; int i; - menu.set("n", 6); + menu.set("n", 5); Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments"); - for (i=0; i<6; i++) { + for (i=0; i<5; i++) { menu.set(Fl_Preferences::Name(i), predefined_comment[i]); db.set(predefined_comment[i], comment_text[i]); } @@ -1180,7 +1178,7 @@ void Fl_Comment_Type::open() { // add the current comment to the database const char *xname = fl_input( "Please enter a name to reference the current\ncomment in your database.\n\n" - "Use forward slashes '/' to create submenus.", + "Use forward slashes '/' to create submenus.", "My Comment"); if (xname) { char *name = strdup(xname); @@ -1200,8 +1198,8 @@ void Fl_Comment_Type::open() { if (itempath[0]==0 || last_selected_item==0) { fl_message("Please select an entry form this menu first."); } else if (fl_choice("Are you sure that you want to delete the entry\n" - "\"%s\"\nfrom the database?", "Cancel", "Delete", - NULL, itempath)) { + "\"%s\"\nfrom the database?", "Cancel", "Delete", + NULL, itempath)) { Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments"); db.deleteEntry(itempath); comment_predefined->remove(last_selected_item); @@ -1221,7 +1219,7 @@ void Fl_Comment_Type::open() { if (comment_predefined->item_pathname(itempath, 255)==0) { if (itempath[0]=='/') memmove(itempath, itempath+1, 255); Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments"); - char *text; + char *text; db.get(itempath, text, "(no text found in data base)"); comment_input->buffer()->text(text); free(text); @@ -1231,9 +1229,9 @@ void Fl_Comment_Type::open() { } else if (w == comment_load) { // load a comment from disk - fl_file_chooser_ok_label("Use File"); + fl_file_chooser_ok_label("Use File"); const char *fname = fl_file_chooser("Pick a comment", 0L, 0L); - fl_file_chooser_ok_label(NULL); + fl_file_chooser_ok_label(NULL); if (fname) { if (comment_input->buffer()->loadfile(fname)) { fl_alert("Error loading file\n%s", fname); @@ -1263,7 +1261,7 @@ BREAK2: } const char *Fl_Comment_Type::title() { - const char* n = name(); + const char* n = name(); if (!n || !*n) return type_name(); if (title_buf[0]==0) { const char *s = n; @@ -1338,11 +1336,11 @@ const char* Fl_Type::class_name(const int need_nest) const { const char* q = 0; if(need_nest) q=p->class_name(need_nest); if (q) { - static char s[256]; - if (q != s) strlcpy(s, q, sizeof(s)); - strlcat(s, "::", sizeof(s)); - strlcat(s, p->name(), sizeof(s)); - return s; + static char s[256]; + if (q != s) strlcpy(s, q, sizeof(s)); + strlcat(s, "::", sizeof(s)); + strlcat(s, p->name(), sizeof(s)); + return s; } return p->name(); } @@ -1412,9 +1410,9 @@ void Fl_Class_Type::read_property(const char *c) { void Fl_Class_Type::open() { if (!class_panel) make_class_panel(); char fullname[FL_PATH_MAX]=""; - if (prefix() && strlen(prefix())) + if (prefix() && strlen(prefix())) sprintf(fullname,"%s %s",prefix(),name()); - else + else strcpy(fullname, name()); c_name_input->static_value(fullname); c_subclass_input->static_value(subclass_of); @@ -1423,9 +1421,9 @@ void Fl_Class_Type::open() { c_comment_input->buffer()->text(c?c:""); class_panel->show(); const char* message = 0; - + char *na=0,*pr=0,*p=0; // name and prefix substrings - + for (;;) { // repeat as long as there are errors if (message) fl_alert("%s", message); for (;;) { @@ -1454,7 +1452,7 @@ void Fl_Class_Type::open() { if (p<s) p++; if (is_id(*p) && p<na) pr=p; // prefix detected c = c_subclass_input->value(); - message = c_check(c); + message = c_check(c); if (message) { free((void*)s);continue;} name(na); prefix(pr); @@ -1529,7 +1527,3 @@ int Fl_Class_Type::has_function(const char *rtype, const char *sig) const { } return 0; } - -// -// End of "$Id$". -// |
