fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Function_Type.cxx
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // C function type code for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2016 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 #include <FL/Fl.H>
19 #include <FL/Fl_Window.H>
20 #include <FL/Fl_Preferences.H>
21 #include <FL/Fl_File_Chooser.H>
22 #include "Fl_Type.h"
23 #include <FL/fl_show_input.H>
24 #include <FL/Fl_File_Chooser.H>
25 #include "alignment_panel.h"
26 #include "../src/flstring.h"
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <string.h>
30 
31 #ifdef WIN32
33 #else
34  #include "ExternalCodeEditor_UNIX.h"
35 #endif
36 
37 extern int i18n_type;
38 extern const char* i18n_include;
39 extern const char* i18n_function;
40 extern const char* i18n_file;
41 extern const char* i18n_set;
42 extern char i18n_program[];
43 
44 extern int batch_mode;
45 
46 extern void redraw_browser();
47 extern void goto_source_dir();
48 extern void leave_source_dir();
49 extern Fl_Window *main_window;
50 
52 // quick check of any C code for legality, returns an error message
53 
54 static char buffer[128]; // for error messages
55 
56 // check a quoted string ending in either " or ' or >:
57 const char *_q_check(const char * & c, int type) {
58  for (;;) switch (*c++) {
59  case '\0':
60  sprintf(buffer,"missing %c",type);
61  return buffer;
62  case '\\':
63  if (*c) c++;
64  break;
65  default:
66  if (*(c-1) == type) return 0;
67  }
68 }
69 
70 // check normal code, match braces and parenthesis:
71 const char *_c_check(const char * & c, int type) {
72  const char *d;
73  for (;;) switch (*c++) {
74  case 0:
75  if (!type) return 0;
76  sprintf(buffer, "missing %c", type);
77  return buffer;
78  case '/':
79  // Skip comments as needed...
80  if (*c == '/') {
81  while (*c != '\n' && *c) c++;
82  } else if (*c == '*') {
83  c++;
84  while ((*c != '*' || c[1] != '/') && *c) c++;
85  if (*c == '*') c+=2;
86  else {
87  return "missing '*/'";
88  }
89  }
90  break;
91  case '#':
92  // treat cpp directives as a comment:
93  while (*c != '\n' && *c) c++;
94  break;
95  case '{':
96  if (type==')') goto UNEXPECTED;
97  d = _c_check(c,'}');
98  if (d) return d;
99  break;
100  case '(':
101  d = _c_check(c,')');
102  if (d) return d;
103  break;
104  case '\"':
105  d = _q_check(c,'\"');
106  if (d) return d;
107  break;
108  case '\'':
109  d = _q_check(c,'\'');
110  if (d) return d;
111  break;
112  case '}':
113  case ')':
114  UNEXPECTED:
115  if (type == *(c-1)) return 0;
116  sprintf(buffer, "unexpected %c", *(c-1));
117  return buffer;
118  }
119 }
120 
121 const char *c_check(const char *c, int type) {
122  return _c_check(c,type);
123 }
124 
126 
128 
131  while (p && !p->is_decl_block()) p = p->parent;
133  o->name("make_window()");
134  o->return_type = 0;
135  o->add(p);
136  o->factory = this;
137  o->public_ = 1;
138  o->cdecl_ = 0;
139  return o;
140 }
141 
144  switch (public_) {
145  case 0: write_string("private"); break;
146  case 2: write_string("protected"); break;
147  }
148  if (cdecl_) write_string("C");
149  if (return_type) {
150  write_string("return_type");
152  }
153 }
154 
155 void Fl_Function_Type::read_property(const char *c) {
156  if (!strcmp(c,"private")) {
157  public_ = 0;
158  } else if (!strcmp(c,"protected")) {
159  public_ = 2;
160  } else if (!strcmp(c,"C")) {
161  cdecl_ = 1;
162  } else if (!strcmp(c,"return_type")) {
164  } else {
166  }
167 }
168 
169 #include "function_panel.h"
170 #include <FL/fl_ask.H>
171 
176  if (is_in_class()) {
180  } else {
184  }
186  const char *c = comment();
187  f_comment_input->buffer()->text(c?c:"");
188  function_panel->show();
189  const char* message = 0;
190  for (;;) { // repeat as long as there are errors
191  if (message) fl_alert("%s", message);
192  for (;;) {
193  Fl_Widget* w = Fl::readqueue();
194  if (w == f_panel_cancel) goto BREAK2;
195  else if (w == f_panel_ok) break;
196  else if (!w) Fl::wait();
197  }
198  const char*c = f_name_input->value();
199  while (isspace(*c)) c++;
200  message = c_check(c); if (message) continue;
201  const char *d = c;
202  for (; *d != '('; d++) if (isspace(*d) || !*d) break;
203  if (*c && *d != '(') {
204  message = "must be name(arguments), try again:"; continue;
205  }
206  int mod = 0;
207  c = f_return_type_input->value();
208  message = c_check(c); if (message) continue;
209  name(f_name_input->value());
211  if (is_in_class()) {
213  mod = 1;
215  redraw_browser();
216  }
217  } else {
218  if (public_ != f_public_choice->value()) {
219  mod = 1;
221  redraw_browser();
222  }
223  }
224  if (cdecl_ != f_c_button->value()) {
225  mod = 1;
226  cdecl_ = f_c_button->value();
227  }
228  c = f_comment_input->buffer()->text();
229  if (c && *c) {
230  if (!comment() || strcmp(c, comment())) redraw_browser();
231  comment(c);
232  } else {
233  if (comment()) redraw_browser();
234  comment(0);
235  }
236  if (c) free((void*)c);
237  if (mod) set_modflag(1);
238  break;
239  }
240 BREAK2:
241  function_panel->hide();
242 }
243 
245 
246 extern const char* subclassname(Fl_Type*);
247 
249  constructor=0;
250  havewidgets = 0;
251  Fl_Type *child;
252  // if the function has no children (hence no body), Fluid will not generate
253  // the function either. This is great if you decide to implement that function
254  // inside another module
255  char havechildren = 0;
256  for (child = next; child && child->level > level; child = child->next) {
257  havechildren = 1;
258  if (child->is_widget()) {
259  havewidgets = 1;
260  break;
261  }
262  }
263  if (havechildren)
264  write_c("\n");
265  if (ismain()) {
266  if (havechildren)
267  write_c("int main(int argc, char **argv) {\n");
268  } else {
269  const char* rtype = return_type;
270  const char* star = "";
271  // from matt: let the user type "static " at the start of type
272  // in order to declare a static method;
273  int is_static = 0;
274  int is_virtual = 0;
275  if (rtype) {
276  if (!strcmp(rtype,"static")) {is_static = 1; rtype = 0;}
277  else if (!strncmp(rtype, "static ",7)) {is_static = 1; rtype += 7;}
278  if (!strcmp(rtype, "virtual")) {is_virtual = 1; rtype = 0;}
279  else if (!strncmp(rtype, "virtual ",8)) {is_virtual = 1; rtype += 8;}
280  }
281  if (!rtype) {
282  if (havewidgets) {
283  rtype = subclassname(child);
284  star = "*";
285  } else rtype = "void";
286  }
287 
288  const char* k = class_name(0);
289  if (k) {
290  if (havechildren)
291  write_comment_c();
293  if (name()[0] == '~')
294  constructor = 1;
295  else {
296  size_t n = strlen(k);
297  if (!strncmp(name(), k, n) && name()[n] == '(') constructor = 1;
298  }
299  write_h(" ");
300  if (is_static) write_h("static ");
301  if (is_virtual) write_h("virtual ");
302  if (!constructor) {
303  write_h("%s%s ", rtype, star);
304  if (havechildren)
305  write_c("%s%s ", rtype, star);
306  }
307 
308  // if this is a subclass, only write_h() the part before the ':'
309  char s[1024], *sptr = s;
310  char *nptr = (char *)name();
311 
312  while (*nptr) {
313  if (*nptr == ':') {
314  if (nptr[1] != ':') break;
315  // Copy extra ":" for "class::member"...
316  *sptr++ = *nptr++;
317  }
318  *sptr++ = *nptr++;
319  }
320  *sptr = '\0';
321 
322  write_h("%s;\n", s);
323  // skip all function default param. init in body:
324  int skips=0,skipc=0;
325  int nc=0,plevel=0;
326  for (sptr=s,nptr=(char*)name(); *nptr; nc++,nptr++) {
327  if (!skips && *nptr=='(') plevel++;
328  else if (!skips && *nptr==')') plevel--;
329  if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') )
330  skips = skips ? 0 : 1;
331  else if(!skips && *nptr=='\'' && !(nc && *(nptr-1)=='\\'))
332  skipc = skipc ? 0 : 1;
333  if(!skips && !skipc && plevel==1 && *nptr =='=' &&
334  !(nc && *(nptr-1)=='\'') ) // ignore '=' case
335  while(*++nptr && (skips || skipc || ( (*nptr!=',' && *nptr!=')') || plevel!=1) )) {
336  if ( *nptr=='"' && *(nptr-1)!='\\' )
337  skips = skips ? 0 : 1;
338  else if(!skips && *nptr=='\'' && *(nptr-1)!='\\')
339  skipc = skipc ? 0 : 1;
340  if (!skips && !skipc && *nptr=='(') plevel++;
341  else if (!skips && *nptr==')') plevel--;
342  }
343 
344  if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr;
345  }
346  *sptr = '\0';
347 
348  if (havechildren)
349  write_c("%s::%s {\n", k, s);
350  } else {
351  if (havechildren)
352  write_comment_c();
353  if (public_) {
354  if (cdecl_)
355  write_h("extern \"C\" { %s%s %s; }\n", rtype, star, name());
356  else
357  write_h("%s%s %s;\n", rtype, star, name());
358  } else {
359  if (havechildren)
360  write_c("static ");
361  }
362 
363  // write everything but the default parameters (if any)
364  char s[1024], *sptr;
365  char *nptr;
366  int skips=0,skipc=0;
367  int nc=0,plevel=0;
368  for (sptr=s,nptr=(char*)name(); *nptr; nc++,nptr++) {
369  if (!skips && *nptr=='(') plevel++;
370  else if (!skips && *nptr==')') plevel--;
371  if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') )
372  skips = skips ? 0 : 1;
373  else if(!skips && *nptr=='\'' && !(nc && *(nptr-1)=='\\'))
374  skipc = skipc ? 0 : 1;
375  if(!skips && !skipc && plevel==1 && *nptr =='=' &&
376  !(nc && *(nptr-1)=='\'') ) // ignore '=' case
377  while(*++nptr && (skips || skipc || ( (*nptr!=',' && *nptr!=')') || plevel!=1) )) {
378  if ( *nptr=='"' && *(nptr-1)!='\\' )
379  skips = skips ? 0 : 1;
380  else if(!skips && *nptr=='\'' && *(nptr-1)!='\\')
381  skipc = skipc ? 0 : 1;
382  if (!skips && !skipc && *nptr=='(') plevel++;
383  else if (!skips && *nptr==')') plevel--;
384  }
385 
386  if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr;
387  }
388  *sptr = '\0';
389 
390  if (havechildren)
391  write_c("%s%s %s {\n", rtype, star, s);
392  }
393  }
394 
395  if (havewidgets && !child->name()) write_c(" %s* w;\n", subclassname(child));
396  indentation += 2;
397 }
398 
400  Fl_Type *child;
401  const char *var = "w";
402  char havechildren = 0;
403  for (child = next; child && child->level > level; child = child->next) {
404  havechildren = 1;
405  if (child->is_window() && child->name()) var = child->name();
406  }
407 
408  if (ismain()) {
409  if (havewidgets) write_c(" %s->show(argc, argv);\n", var);
410  if (havechildren) write_c(" return Fl::run();\n");
411  } else if (havewidgets && !constructor && !return_type) {
412  write_c(" return %s;\n", var);
413  }
414  if (havechildren)
415  write_c("}\n");
416  indentation = 0;
417 }
418 
419 int Fl_Function_Type::has_signature(const char *rtype, const char *sig) const {
420  if (rtype && !return_type) return 0;
421  if (!name()) return 0;
422  if ( (rtype==0L || strcmp(return_type, rtype)==0)
423  && fl_filename_match(name(), sig)) {
424  return 1;
425  }
426  return 0;
427 }
428 
430 
433  while (p && !p->is_code_block()) p = p->parent;
434  if (!p) {
435  fl_message("Please select a function");
436  return 0;
437  }
438  Fl_Code_Type *o = new Fl_Code_Type();
439  o->name("printf(\"Hello, World!\\n\");");
440  o->add(p);
441  o->factory = this;
442  return o;
443 }
444 
446  // Using an external code editor? Open it..
448  const char *cmd = G_external_editor_command;
449  const char *code = name();
450  if ( editor_.open_editor(cmd, code) == 0 )
451  return; // return if editor opened ok, fallthru to built-in if not
452  }
453  // Use built-in code editor..
454  if (!code_panel) make_code_panel();
455  const char *text = name();
456  code_input->buffer()->text( text ? text : "" );
457  code_panel->show();
458  const char* message = 0;
459  for (;;) { // repeat as long as there are errors
460  if (message) fl_alert("%s", message);
461  for (;;) {
462  Fl_Widget* w = Fl::readqueue();
463  if (w == code_panel_cancel) goto BREAK2;
464  else if (w == code_panel_ok) break;
465  else if (!w) Fl::wait();
466  }
467  char*c = code_input->buffer()->text();
468  message = c_check(c); if (message) continue;
469  name(c);
470  free(c);
471  break;
472  }
473 BREAK2:
474  code_panel->hide();
475 }
476 
478 
480  // External editor changes? If so, load changes into ram, update mtime/size
481  if ( handle_editor_changes() == 1 ) {
482  main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
483  }
484  Fl_Type::write();
485 }
486 
488  // External editor changes? If so, load changes into ram, update mtime/size
489  if ( handle_editor_changes() == 1 ) {
490  main_window->redraw(); // tell fluid to redraw; edits may affect tree's contents
491  }
492 
493  const char* c = name();
494  if (!c) return;
495 
496  const char *pch;
497  const char *ind = indent();
498  while( (pch=strchr(c,'\n')) )
499  {
500  int line_len = pch - c;
501  write_c("%s%.*s\n", ind, line_len, c);
502  c = pch+1;
503  }
504  write_c("%s%s\n", ind, c);
505 }
506 
508 
510 
513  while (p && !p->is_code_block()) p = p->parent;
514  if (!p) {
515  fl_message("Please select a function");
516  return 0;
517  }
519  o->name("if (test())");
520  o->after = 0;
521  o->add(p);
522  o->factory = this;
523  return o;
524 }
525 
528  if (after) {
529  write_string("after");
530  write_word(after);
531  }
532 }
533 
534 void Fl_CodeBlock_Type::read_property(const char *c) {
535  if (!strcmp(c,"after")) {
537  } else {
539  }
540 }
541 
547  const char* message = 0;
548  for (;;) { // repeat as long as there are errors
549  if (message) fl_alert("%s", message);
550  for (;;) {
551  Fl_Widget* w = Fl::readqueue();
552  if (w == codeblock_panel_cancel) goto BREAK2;
553  else if (w == codeblock_panel_ok) break;
554  else if (!w) Fl::wait();
555  }
556  const char*c = code_before_input->value();
557  message = c_check(c); if (message) continue;
558  name(c);
559  c = code_after_input->value();
560  message = c_check(c); if (message) continue;
561  storestring(c, after);
562  break;
563  }
564 BREAK2:
566 }
567 
569 
571  const char* c = name();
572  write_c("%s%s {\n", indent(), c ? c : "");
573  indentation += 2;
574 }
575 
577  indentation -= 2;
578  if (after) write_c("%s} %s\n", indent(), after);
579  else write_c("%s}\n", indent());
580 }
581 
583 
585 {
586  Fl_Type *p = parent;
587  while (p && !p->is_decl_block()) p = p->parent;
588  if(p && p->is_public() && public_)
589  return public_;
590  else if(!p)
591  return public_;
592  return 0;
593 }
594 
597  while (p && !p->is_decl_block()) p = p->parent;
598  Fl_Decl_Type *o = new Fl_Decl_Type();
599  o->public_ = 0;
600  o->static_ = 1;
601  o->name("int x;");
602  o->add(p);
603  o->factory = this;
604  return o;
605 }
606 
609  switch (public_) {
610  case 0: write_string("private"); break;
611  case 1: write_string("public"); break;
612  case 2: write_string("protected"); break;
613  }
614  if (static_)
615  write_string("local");
616  else
617  write_string("global");
618 }
619 
620 void Fl_Decl_Type::read_property(const char *c) {
621  if (!strcmp(c,"public")) {
622  public_ = 1;
623  } else if (!strcmp(c,"private")) {
624  public_ = 0;
625  } else if (!strcmp(c,"protected")) {
626  public_ = 2;
627  } else if (!strcmp(c,"local")) {
628  static_ = 1;
629  } else if (!strcmp(c,"global")) {
630  static_ = 0;
631  } else {
633  }
634 }
635 
637  if (!decl_panel) make_decl_panel();
639  if (is_in_class()) {
642  decl_choice->hide();
643  } else {
644  decl_choice->value((public_&1)|((static_&1)<<1));
645  decl_choice->show();
647  }
648  const char *c = comment();
649  decl_comment_input->buffer()->text(c?c:"");
650  decl_panel->show();
651  const char* message = 0;
652  for (;;) { // repeat as long as there are errors
653  if (message) fl_alert("%s", message);
654  for (;;) {
655  Fl_Widget* w = Fl::readqueue();
656  if (w == decl_panel_cancel) goto BREAK2;
657  else if (w == decl_panel_ok) break;
658  else if (!w) Fl::wait();
659  }
660  const char*c = decl_input->value();
661  while (isspace(*c)) c++;
662  message = c_check(c&&c[0]=='#' ? c+1 : c);
663  if (message) continue;
664  name(c);
665  if (is_in_class()) {
666  if (public_!=decl_class_choice->value()) {
667  set_modflag(1);
669  }
670  } else {
671  if (public_!=(decl_choice->value()&1)) {
672  set_modflag(1);
673  public_ = (decl_choice->value()&1);
674  }
675  if (static_!=((decl_choice->value()>>1)&1)) {
676  set_modflag(1);
677  static_ = ((decl_choice->value()>>1)&1);
678  }
679  }
680  c = decl_comment_input->buffer()->text();
681  if (c && *c) {
682  if (!comment() || strcmp(c, comment())) redraw_browser();
683  comment(c);
684  } else {
685  if (comment()) redraw_browser();
686  comment(0);
687  }
688  if (c) free((void*)c);
689  break;
690  }
691 BREAK2:
692  decl_panel->hide();
693 }
694 
696 
698  const char* c = name();
699  if (!c) return;
700  // handle a few keywords differently if inside a class
701  if (is_in_class() && ( (!strncmp(c,"class",5) && isspace(c[5]))
702  || (!strncmp(c,"typedef",7) && isspace(c[7]))
703  || (!strncmp(c,"FL_EXPORT",9) && isspace(c[9]))
704  || (!strncmp(c,"struct",6) && isspace(c[6]))
705  ) ) {
707  write_comment_h(" ");
708  write_h(" %s\n", c);
709  return;
710  }
711  // handle putting #include, extern, using or typedef into decl:
712  if ( (!isalpha(*c) && *c != '~')
713  || (!strncmp(c,"extern",6) && isspace(c[6]))
714  || (!strncmp(c,"class",5) && isspace(c[5]))
715  || (!strncmp(c,"typedef",7) && isspace(c[7]))
716  || (!strncmp(c,"using",5) && isspace(c[5]))
717  || (!strncmp(c,"FL_EXPORT",9) && isspace(c[9]))
718  // || !strncmp(c,"struct",6) && isspace(c[6])
719  ) {
720  if (public_) {
721  write_comment_h();
722  write_h("%s\n", c);
723  } else {
724  write_comment_c();
725  write_c("%s\n", c);
726  }
727  return;
728  }
729  // find the first C++ style comment
730  const char* e = c+strlen(c), *csc = c;
731  while (csc<e && (csc[0]!='/' || csc[1]!='/')) csc++;
732  if (csc!=e) e = csc; // comment found
733  // lose all trailing semicolons so I can add one:
734  while (e>c && e[-1]==' ') e--;
735  while (e>c && e[-1]==';') e--;
736  if (class_name(1)) {
738  write_comment_h(" ");
739  write_h(" %.*s; %s\n", (int)(e-c), c, csc);
740  } else {
741  if (public_) {
742  if (static_)
743  write_h("extern ");
744  else
745  write_comment_h();
746  write_h("%.*s; %s\n", (int)(e-c), c, csc);
747  if (static_) {
748  write_comment_c();
749  write_c("%.*s; %s\n", (int)(e-c), c, csc);
750  }
751  } else {
752  write_comment_c();
753  if (static_)
754  write_c("static ");
755  write_c("%.*s; %s\n", (int)(e-c), c, csc);
756  }
757  }
758 }
759 
761 
763 
766  while (p && !p->is_decl_block()) p = p->parent;
767  Fl_Data_Type *o = new Fl_Data_Type();
768  o->public_ = 1;
769  o->static_ = 1;
770  o->filename_ = 0;
771  o->name("myBinaryData");
772  o->add(p);
773  o->factory = this;
774  return o;
775 }
776 
779  if (filename_) {
780  write_string("filename");
782  }
783 }
784 
785 void Fl_Data_Type::read_property(const char *c) {
786  if (!strcmp(c,"filename")) {
788  } else {
790  }
791 }
792 
794  if (!data_panel) make_data_panel();
796  if (is_in_class()) {
799  data_choice->hide();
800  } else {
801  data_choice->value((public_&1)|((static_&1)<<1));
802  data_choice->show();
804  }
806  const char *c = comment();
807  data_comment_input->buffer()->text(c?c:"");
808  data_panel->show();
809  const char* message = 0;
810  for (;;) { // repeat as long as there are errors
811  if (message) fl_alert("%s", message);
812  for (;;) {
813  Fl_Widget* w = Fl::readqueue();
814  if (w == data_panel_cancel) goto BREAK2;
815  else if (w == data_panel_ok) break;
816  else if (w == data_filebrowser) {
817  goto_source_dir();
818  const char *fn = fl_file_chooser("Load Binary Data", 0L, data_filename->value(), 1);
820  if (fn) {
821  if (strcmp(fn, data_filename->value()))
822  set_modflag(1);
823  data_filename->value(fn);
824  }
825  }
826  else if (!w) Fl::wait();
827  }
828  // store the variable name:
829  const char*c = data_input->value();
830  char *s = strdup(c), *p = s, *q, *n;
831  for (;;++p) {
832  if (!isspace((unsigned char)(*p))) break;
833  }
834  n = p;
835  if ( (!isalpha((unsigned char)(*p))) && ((*p)!='_') && ((*p)!=':') ) goto OOPS;
836  ++p;
837  for (;;++p) {
838  if ( (!isalnum((unsigned char)(*p))) && ((*p)!='_') && ((*p)!=':') ) break;
839  }
840  q = p;
841  for (;;++q) {
842  if (!*q) break;
843  if (!isspace((unsigned char)(*q))) goto OOPS;
844  }
845  if (n==q) {
846  OOPS: message = "variable name must be a C identifier";
847  free((void*)s);
848  continue;
849  }
850  *p = 0;
851  name(n);
852  free(s);
853  // store flags
854  if (is_in_class()) {
855  if (public_!=data_class_choice->value()) {
856  set_modflag(1);
858  }
859  } else {
860  if (public_!=(data_choice->value()&1)) {
861  set_modflag(1);
862  public_ = (data_choice->value()&1);
863  }
864  if (static_!=((data_choice->value()>>1)&1)) {
865  set_modflag(1);
866  static_ = ((data_choice->value()>>1)&1);
867  }
868  }
869  // store the filename
870  c = data_filename->value();
871  if (filename_ && strcmp(filename_, data_filename->value()))
872  set_modflag(1);
873  else if (!filename_ && *c)
874  set_modflag(1);
875  if (filename_) { free((void*)filename_); filename_ = 0L; }
876  if (c && *c) filename_ = strdup(c);
877  // store the comment
878  c = data_comment_input->buffer()->text();
879  if (c && *c) {
880  if (!comment() || strcmp(c, comment())) redraw_browser();
881  comment(c);
882  } else {
883  if (comment()) redraw_browser();
884  comment(0);
885  }
886  if (c) free((void*)c);
887  break;
888  }
889 BREAK2:
890  data_panel->hide();
891 }
892 
894 
896  const char *message = 0;
897  const char *c = name();
898  if (!c) return;
899  const char *fn = filename_;
900  char *data = 0;
901  int nData = -1;
902  // path should be set correctly already
903  if (filename_ && !write_sourceview) {
904  FILE *f = fl_fopen(filename_, "rb");
905  if (!f) {
906  message = "Can't include binary file. Can't open";
907  } else {
908  fseek(f, 0, SEEK_END);
909  nData = ftell(f);
910  fseek(f, 0, SEEK_SET);
911  if (nData) {
912  data = (char*)calloc(nData, 1);
913  if (fread(data, nData, 1, f)==0) { /* use default */ }
914  }
915  fclose(f);
916  }
917  } else {
918  fn = "<no filename>";
919  }
920  if (is_in_class()) {
922  write_comment_h(" ");
923  write_h(" static unsigned char %s[%d];\n", c, nData);
924  write_c("unsigned char %s::%s[%d] = /* binary data included from %s */\n", class_name(1), c, nData, fn);
925  if (message) write_c("#error %s %s\n", message, fn);
926  write_cdata(data, nData);
927  write_c(";\n");
928  } else {
929  // the "header only" option does not apply here!
930  if (public_) {
931  if (static_) {
932  write_h("extern unsigned char %s[%d];\n", c, nData);
933  write_comment_c();
934  write_c("unsigned char %s[%d] = /* binary data included from %s */\n", c, nData, fn);
935  if (message) write_c("#error %s %s\n", message, fn);
936  write_cdata(data, nData);
937  write_c(";\n");
938  } else {
939  write_comment_h();
940  write_h("#error Unsupported declaration loading binary data %s\n", fn);
941  write_h("unsigned char %s[3] = { 1, 2, 3 };\n", c);
942  }
943  } else {
944  write_comment_c();
945  if (static_)
946  write_c("static ");
947  write_c("unsigned char %s[%d] = /* binary data included from %s */\n", c, nData, fn);
948  if (message) write_c("#error %s %s\n", message, fn);
949  write_cdata(data, nData);
950  write_c(";\n");
951  }
952  }
953  // if we are in interactive mode, we pop up a warning dialog
954  // giving the error: (batch_mode && !write_sourceview) ???
955  if (message && !write_sourceview) {
956  if (batch_mode)
957  fprintf(stderr, "FLUID ERROR: %s %s\n", message, fn);
958  else
959  fl_alert("%s\n%s\n", message, fn);
960  }
961  if (data) free(data);
962 }
963 
965 
967 
969 
972  while (p && !p->is_decl_block()) p = p->parent;
974  o->name("#if 1");
975  o->public_ = 0;
976  o->after = strdup("#endif");
977  o->add(p);
978  o->factory = this;
979  return o;
980 }
981 
984  switch (public_) {
985  case 1: write_string("public"); break;
986  case 2: write_string("protected"); break;
987  }
988  write_string("after");
989  write_word(after);
990 }
991 
992 void Fl_DeclBlock_Type::read_property(const char *c) {
993  if(!strcmp(c,"public")) {
994  public_ = 1;
995  } else if(!strcmp(c,"protected")) {
996  public_ = 2;
997  } else if (!strcmp(c,"after")) {
999  } else {
1001  }
1002 }
1003 
1009  declblock_panel->show();
1010  const char* message = 0;
1011  for (;;) { // repeat as long as there are errors
1012  if (message) fl_alert("%s", message);
1013  for (;;) {
1014  Fl_Widget* w = Fl::readqueue();
1015  if (w == declblock_panel_cancel) goto BREAK2;
1016  else if (w == declblock_panel_ok) break;
1017  else if (!w) Fl::wait();
1018  }
1019  const char*c = decl_before_input->value();
1020  while (isspace(*c)) c++;
1021  message = c_check(c&&c[0]=='#' ? c+1 : c);
1022  if (message) continue;
1023  name(c);
1024  c = decl_after_input->value();
1025  while (isspace(*c)) c++;
1026  message = c_check(c&&c[0]=='#' ? c+1 : c);
1027  if (message) continue;
1028  storestring(c,after);
1030  set_modflag(1);
1032  redraw_browser();
1033  }
1034  break;
1035  }
1036 BREAK2:
1037  declblock_panel->hide();
1038 }
1039 
1041 
1043  const char* c = name();
1044  if (public_)
1045  write_h("%s\n", c);
1046  write_c("%s\n", c);
1047 }
1048 
1050  const char* c = after;
1051  if (public_)
1052  write_h("%s\n", c);
1053  write_c("%s\n", c);
1054 }
1055 
1057 
1060  while (p && !p->is_code_block()) p = p->parent;
1061  Fl_Comment_Type *o = new Fl_Comment_Type();
1062  o->in_c_ = 1;
1063  o->in_h_ = 1;
1064  o->style_ = 0;
1065  o->name("my comment");
1066  o->add(p);
1067  o->factory = this;
1068  o->title_buf[0] = 0;
1069  return o;
1070 }
1071 
1074  if (in_c_) write_string("in_source"); else write_string("not_in_source");
1075  if (in_h_) write_string("in_header"); else write_string("not_in_header");
1076 }
1077 
1078 void Fl_Comment_Type::read_property(const char *c) {
1079  if (!strcmp(c,"in_source")) {
1080  in_c_ = 1;
1081  } else if (!strcmp(c,"not_in_source")) {
1082  in_c_ = 0;
1083  } else if (!strcmp(c,"in_header")) {
1084  in_h_ = 1;
1085  } else if (!strcmp(c,"not_in_header")) {
1086  in_h_ = 0;
1087  } else {
1089  }
1090 }
1091 
1092 #include "comments.h"
1093 
1095  static const char * const predefined_comment[] = {
1096  "GNU Public License/GPL Header", "GNU Public License/GPL Footer",
1097  "GNU Public License/LGPL Header", "GNU Public License/LGPL Footer",
1098  "FLTK/Header", "FLTK/Footer" };
1099  int i;
1100  menu.set("n", 6);
1101  Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
1102  for (i=0; i<6; i++) {
1103  menu.set(Fl_Preferences::Name(i), predefined_comment[i]);
1104  db.set(predefined_comment[i], comment_text[i]);
1105  }
1106 }
1107 
1110  const char *text = name();
1111  {
1112  int i=0, n=0;
1113  Fl_Preferences menu(Fl_Preferences::USER, "fltk.org", "fluid_comments_menu");
1115  comment_predefined->add("_Edit/Add current comment...");
1116  comment_predefined->add("_Edit/Remove last selection...");
1117  menu.get("n", n, -1);
1118  if (n==-1) load_comments_preset(menu);
1119  menu.get("n", n, 0);
1120  for (i=0;i<n;i++) {
1121  char *text;
1122  menu.get(Fl_Preferences::Name(i), text, "");
1123  comment_predefined->add(text);
1124  free(text);
1125  }
1126  }
1127  comment_input->buffer()->text( text ? text : "" );
1130  comment_panel->show();
1131  const char* message = 0;
1132  char itempath[FL_PATH_MAX]; itempath[0] = 0;
1133  int last_selected_item = 0;
1134  for (;;) { // repeat as long as there are errors
1135  if (message) fl_alert("%s", message);
1136  for (;;) {
1137  Fl_Widget* w = Fl::readqueue();
1138  if (w == comment_panel_cancel) goto BREAK2;
1139  else if (w == comment_panel_ok) break;
1140  else if (w == comment_predefined) {
1141  if (comment_predefined->value()==1) {
1142  // add the current comment to the database
1143  const char *xname = fl_input(
1144  "Please enter a name to reference the current\ncomment in your database.\n\n"
1145  "Use forward slashes '/' to create submenus.",
1146  "My Comment");
1147  if (xname) {
1148  char *name = strdup(xname);
1149  for (char*s=name;*s;s++) if (*s==':') *s = ';';
1150  int n;
1151  Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
1152  db.set(name, comment_input->buffer()->text());
1153  Fl_Preferences menu(Fl_Preferences::USER, "fltk.org", "fluid_comments_menu");
1154  menu.get("n", n, 0);
1155  menu.set(Fl_Preferences::Name(n), name);
1156  menu.set("n", ++n);
1158  free(name);
1159  }
1160  } else if (comment_predefined->value()==2) {
1161  // remove the last selected comment from the database
1162  if (itempath[0]==0 || last_selected_item==0) {
1163  fl_message("Please select an entry form this menu first.");
1164  } else if (fl_choice("Are you sure that you want to delete the entry\n"
1165  "\"%s\"\nfrom the database?", "Cancel", "Delete",
1166  NULL, itempath)) {
1167  Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
1168  db.deleteEntry(itempath);
1169  comment_predefined->remove(last_selected_item);
1170  Fl_Preferences menu(Fl_Preferences::USER, "fltk.org", "fluid_comments_menu");
1171  int i, n;
1172  for (i=4, n=0; i<comment_predefined->size(); i++) {
1173  const Fl_Menu_Item *mi = comment_predefined->menu()+i;
1174  if (comment_predefined->item_pathname(itempath, 255, mi)==0) {
1175  if (itempath[0]=='/') memmove(itempath, itempath+1, 255);
1176  if (itempath[0]) menu.set(Fl_Preferences::Name(n++), itempath);
1177  }
1178  }
1179  menu.set("n", n);
1180  }
1181  } else {
1182  // load the selected comment from the database
1183  if (comment_predefined->item_pathname(itempath, 255)==0) {
1184  if (itempath[0]=='/') memmove(itempath, itempath+1, 255);
1185  Fl_Preferences db(Fl_Preferences::USER, "fltk.org", "fluid_comments");
1186  char *text;
1187  db.get(itempath, text, "(no text found in data base)");
1188  comment_input->buffer()->text(text);
1189  free(text);
1190  last_selected_item = comment_predefined->value();
1191  }
1192  }
1193  }
1194  else if (w == comment_load) {
1195  // load a comment from disk
1196  fl_file_chooser_ok_label("Use File");
1197  const char *fname = fl_file_chooser("Pick a comment", 0L, 0L);
1199  if (fname) {
1200  if (comment_input->buffer()->loadfile(fname)) {
1201  fl_alert("Error loading file\n%s", fname);
1202  }
1203  }
1204  }
1205  else if (!w) Fl::wait();
1206  }
1207  char*c = comment_input->buffer()->text();
1208  name(c);
1209  free(c);
1210  int mod = 0;
1211  if (in_c_ != comment_in_source->value()) {
1213  mod = 1;
1214  }
1215  if (in_h_ != comment_in_header->value()) {
1217  mod = 1;
1218  }
1219  if (mod) set_modflag(1);
1220  break;
1221  }
1222 BREAK2:
1223  title_buf[0] = 0;
1224  comment_panel->hide();
1225 }
1226 
1227 const char *Fl_Comment_Type::title() {
1228  const char* n = name();
1229  if (!n || !*n) return type_name();
1230  if (title_buf[0]==0) {
1231  const char *s = n;
1232  char *d = title_buf;
1233  int i = 50;
1234  while (--i > 0) {
1235  char n = *s++;
1236  if (n==0) break;
1237  if (n=='\r') { *d++ = '\\'; *d++ = 'r'; i--; }
1238  else if (n=='\n') { *d++ = '\\'; *d++ = 'n'; i--; }
1239  else if (n<32) { *d++ = '^'; *d++ = 'A'+n; i--; }
1240  else *d++ = n;
1241  }
1242  if (i<=0) { *d++ = '.'; *d++ = '.'; *d++ = '.'; }
1243  *d++ = 0;
1244  }
1245  return title_buf;
1246 }
1247 
1249 
1251  const char* c = name();
1252  if (!c) return;
1253  if (!in_c_ && !in_h_) return;
1254  // find out if there is already a valid comment:
1255  const char *s = c;
1256  while (isspace(*s)) s++;
1257  // if this seems to be a C style comment, copy the block as is
1258  // (it's up to the user to correctly close the comment)
1259  if (s[0]=='/' && s[1]=='*') {
1260  if (in_h_) write_h("%s\n", c);
1261  if (in_c_) write_c("%s\n", c);
1262  return;
1263  }
1264  // copy the comment line by line, add the double slash if needed
1265  char *txt = strdup(c);
1266  char *b = txt, *e = txt;
1267  for (;;) {
1268  // find the end of the line and set it to NUL
1269  while (*e && *e!='\n') e++;
1270  char eol = *e;
1271  *e = 0;
1272  // check if there is a C++ style comment at the beginning of the line
1273  char *s = b;
1274  while (isspace(*s)) s++;
1275  if (s!=e && ( s[0]!='/' || s[1]!='/') ) {
1276  // if no comment marker was found, we add one ourselves
1277  if (in_h_) write_h("// ");
1278  if (in_c_) write_c("// ");
1279  }
1280  // now copy the rest of the line
1281  if (in_h_) write_h("%s\n", b);
1282  if (in_c_) write_c("%s\n", b);
1283  if (eol==0) break;
1284  *e++ = eol;
1285  b = e;
1286  }
1287 }
1288 
1290 
1292 
1293 const char* Fl_Type::class_name(const int need_nest) const {
1294  Fl_Type* p = parent;
1295  while (p) {
1296  if (p->is_class()) {
1297  // see if we are nested in another class, we must fully-qualify name:
1298  // this is lame but works...
1299  const char* q = 0;
1300  if(need_nest) q=p->class_name(need_nest);
1301  if (q) {
1302  static char s[256];
1303  if (q != s) strlcpy(s, q, sizeof(s));
1304  strlcat(s, "::", sizeof(s));
1305  strlcat(s, p->name(), sizeof(s));
1306  return s;
1307  }
1308  return p->name();
1309  }
1310  p = p->parent;
1311  }
1312  return 0;
1313 }
1314 
1319  Fl_Type* p = parent;
1320  while (p) {
1321  if (p->is_class()) {
1322  return (Fl_Class_Type*)p;
1323  }
1324  p = p->parent;
1325  }
1326  return 0;
1327 }
1328 
1329 int Fl_Class_Type::is_public() const {return public_;}
1330 
1331 void Fl_Class_Type::prefix(const char*p) {
1332  free((void*) class_prefix);
1333  class_prefix=strdup(p ? p : "" );
1334 }
1335 
1338  while (p && !p->is_decl_block()) p = p->parent;
1339  Fl_Class_Type *o = new Fl_Class_Type();
1340  o->name("UserInterface");
1341  o->class_prefix=0;
1342  o->subclass_of = 0;
1343  o->public_ = 1;
1344  o->add(p);
1345  o->factory = this;
1346  return o;
1347 }
1348 
1351  if (subclass_of) {
1352  write_string(":");
1354  }
1355  switch (public_) {
1356  case 0: write_string("private"); break;
1357  case 2: write_string("protected"); break;
1358  }
1359 }
1360 
1361 void Fl_Class_Type::read_property(const char *c) {
1362  if (!strcmp(c,"private")) {
1363  public_ = 0;
1364  } else if (!strcmp(c,"protected")) {
1365  public_ = 2;
1366  } else if (!strcmp(c,":")) {
1368  } else {
1370  }
1371 }
1372 
1374  if (!class_panel) make_class_panel();
1375  char fullname[FL_PATH_MAX]="";
1376  if (prefix() && strlen(prefix()))
1377  sprintf(fullname,"%s %s",prefix(),name());
1378  else
1379  strcpy(fullname, name());
1380  c_name_input->static_value(fullname);
1383  const char *c = comment();
1384  c_comment_input->buffer()->text(c?c:"");
1385  class_panel->show();
1386  const char* message = 0;
1387 
1388  char *na=0,*pr=0,*p=0; // name and prefix substrings
1389 
1390  for (;;) { // repeat as long as there are errors
1391  if (message) fl_alert("%s", message);
1392  for (;;) {
1393  Fl_Widget* w = Fl::readqueue();
1394  if (w == c_panel_cancel) goto BREAK2;
1395  else if (w == c_panel_ok) break;
1396  else if (!w) Fl::wait();
1397  }
1398  const char*c = c_name_input->value();
1399  char *s = strdup(c);
1400  size_t len = strlen(s);
1401  if (!*s) goto OOPS;
1402  p = (char*) (s+len-1);
1403  while (p>=s && isspace(*p)) *(p--)='\0';
1404  if (p<s) goto OOPS;
1405  while (p>=s && is_id(*p)) p--;
1406  if ( (p<s && !is_id(*(p+1))) || !*(p+1) ) {
1407  OOPS: message = "class name must be C++ identifier";
1408  free((void*)s);
1409  continue;
1410  }
1411  na=p+1; // now we have the name
1412  if(p>s) *p--='\0';
1413  while (p>=s && isspace(*p)) *(p--)='\0';
1414  while (p>=s && is_id(*p)) p--;
1415  if (p<s) p++;
1416  if (is_id(*p) && p<na) pr=p; // prefix detected
1417  c = c_subclass_input->value();
1418  message = c_check(c);
1419  if (message) { free((void*)s);continue;}
1420  name(na);
1421  prefix(pr);
1422  free((void*)s);
1424  if (public_ != c_public_button->value()) {
1426  set_modflag(1);
1427  }
1428  c = c_comment_input->buffer()->text();
1429  if (c && *c) {
1430  if (!comment() || strcmp(c, comment())) redraw_browser();
1431  comment(c);
1432  } else {
1433  if (comment()) redraw_browser();
1434  comment(0);
1435  }
1436  if (c) free((void*)c);
1437  break;
1438  }
1439 BREAK2:
1440  class_panel->hide();
1441 }
1442 
1444 
1447 void write_public(int state) {
1448  if (!current_class && !current_widget_class) return;
1453  switch (state) {
1454  case 0: write_h("private:\n"); break;
1455  case 1: write_h("public:\n"); break;
1456  case 2: write_h("protected:\n"); break;
1457  }
1458 }
1459 
1462  current_class = this;
1463  write_public_state = 0;
1464  write_h("\n");
1465  write_comment_h();
1466  if (prefix() && strlen(prefix()))
1467  write_h("class %s %s ", prefix(), name());
1468  else
1469  write_h("class %s ", name());
1470  if (subclass_of) write_h(": %s ", subclass_of);
1471  write_h("{\n");
1472 }
1473 
1475  write_h("};\n");
1477 }
1478 
1482 int Fl_Class_Type::has_function(const char *rtype, const char *sig) const {
1483  Fl_Type *child;
1484  for (child = next; child && child->level > level; child = child->next) {
1485  if (child->level == level+1 && strcmp(child->type_name(), "Function")==0) {
1486  const Fl_Function_Type *fn = (const Fl_Function_Type*)child;
1487  if (fn->has_signature(rtype, sig))
1488  return 1;
1489  }
1490  }
1491  return 0;
1492 }
1493 
1494 //
1495 // End of "$Id$".
1496 //
fl_file_chooser_ok_label
void fl_file_chooser_ok_label(const char *l)
Fl_Text_Display::buffer
void buffer(Fl_Text_Buffer *buf)
Definition: Fl_Text_Display.cxx:384
Fl_Class_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:1361
Fl_Class_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:1349
f_name_input
Fl_Input * f_name_input
Definition: function_panel.cxx:59
Fl_Class_Type::write_public_state
char write_public_state
Definition: Fl_Type.h:348
Fl_CodeBlock_Type::Fl_CodeBlock_Type
Fl_CodeBlock_Type()
Definition: Fl_Type.h:250
Fl.H
Fl_Function_type
Fl_Function_Type Fl_Function_type
Definition: Fl_Function_Type.cxx:244
Fl_Class_Type::subclass_of
const char * subclass_of
Definition: Fl_Type.h:339
Fl_Widget_Class_Type
Definition: Fl_Type.h:644
Fl_Menu_::item_pathname
int item_pathname(char *name, int namelen, const Fl_Menu_Item *finditem=0) const
Definition: Fl_Menu_.cxx:65
Fl_DeclBlock_Type
Definition: Fl_Type.h:300
decl_panel_cancel
Fl_Button * decl_panel_cancel
Definition: function_panel.cxx:365
Fl_Button::value
int value(int v)
Definition: Fl_Button.cxx:41
Fl_Comment_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:1072
Fl_Comment_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:1078
Fl_Decl_Type::public_
char public_
Definition: Fl_Type.h:269
f_c_button
Fl_Light_Button * f_c_button
Definition: function_panel.cxx:57
SEEK_END
#define SEEK_END
Definition: zconf.h:486
Fl_Function_Type::is_public
virtual int is_public() const
Definition: Fl_Function_Type.cxx:127
Fl_Type::current
static Fl_Type * current
Definition: Fl_Type.h:114
Fl_Type::next
Fl_Type * next
Definition: Fl_Type.h:71
Fl_Menu_::menu
const Fl_Menu_Item * menu() const
Definition: Fl_Menu_.H:110
fl_message
void fl_message(const char *,...)
Definition: fl_ask.cxx:338
Fl_Function_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:399
c_name_input
Fl_Input * c_name_input
Definition: function_panel.cxx:542
Fl_Data_Type::open
void open()
Definition: Fl_Function_Type.cxx:793
decl_comment_input
Fl_Text_Editor * decl_comment_input
Definition: function_panel.cxx:361
comment_input
CodeEditor * comment_input
Definition: function_panel.cxx:621
Fl_Comment_Type::in_c_
char in_c_
Definition: Fl_Type.h:322
G_use_external_editor
int G_use_external_editor
Definition: fluid.cxx:97
i18n_type
int i18n_type
Definition: fluid.cxx:702
codeblock_panel_cancel
Fl_Button * codeblock_panel_cancel
Definition: function_panel.cxx:214
Fl_Type::write_properties
virtual void write_properties()
Definition: Fl_Type.cxx:935
Fl_Widget::show
virtual void show()
Definition: Fl_Widget.cxx:271
current_class
Fl_Class_Type * current_class
Definition: Fl_Function_Type.cxx:1445
Fl_Function_Type::public_
char public_
Definition: Fl_Type.h:167
G_external_editor_command
char G_external_editor_command[512]
Definition: fluid.cxx:99
Fl_Class_Type::is_public
virtual int is_public() const
Definition: Fl_Function_Type.cxx:1329
comment_in_source
Fl_Light_Button * comment_in_source
Definition: function_panel.cxx:627
Fl_Comment_type
Fl_Comment_Type Fl_Comment_type
Definition: Fl_Function_Type.cxx:1248
function_panel.h
Fl_Code_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:507
make_comment_panel
Fl_Double_Window * make_comment_panel()
Definition: function_panel.cxx:635
Fl_Function_Type::open
void open()
Definition: Fl_Function_Type.cxx:172
Fl_Type::parent
Fl_Type * parent
Definition: Fl_Type.h:63
Fl_Code_Type::write
void write()
Definition: Fl_Function_Type.cxx:479
codeblock_panel_ok
Fl_Return_Button * codeblock_panel_ok
Definition: function_panel.cxx:212
Fl_Class_Type::class_prefix
const char * class_prefix
Definition: Fl_Type.h:369
Fl_Comment_Type::open
void open()
Definition: Fl_Function_Type.cxx:1108
Fl_Data_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:777
Fl_Data_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:964
fl_ask.H
Fl_Preferences::USER
Preferences apply only to the current user.
Definition: Fl_Preferences.H:68
message
static Fl_Box * message
Definition: fl_ask.cxx:47
Fl_Input_::value
int value(const char *)
Definition: Fl_Input_.cxx:1284
make_decl_panel
Fl_Double_Window * make_decl_panel()
Definition: function_panel.cxx:367
decl_input
Fl_Input * decl_input
Definition: function_panel.cxx:359
Fl_Type::add
void add(Fl_Type *parent)
Definition: Fl_Type.cxx:574
Fl_Menu_::add
int add(const char *, int shortcut, Fl_Callback *, void *=0, int=0)
Definition: Fl_Menu_add.cxx:332
state
int state
Definition: Fl_Text_Editor.cxx:92
Fl_CodeBlock_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:511
code_panel_cancel
Fl_Button * code_panel_cancel
Definition: function_panel.cxx:160
Fl::readqueue
static Fl_Widget * readqueue()
Definition: Fl_Widget.cxx:76
Fl_Function_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:248
c_comment_input
Fl_Text_Editor * c_comment_input
Definition: function_panel.cxx:546
load_comments_preset
static void load_comments_preset(Fl_Preferences &menu)
Definition: Fl_Function_Type.cxx:1094
Fl_Class_Type::has_function
int has_function(const char *, const char *) const
Definition: Fl_Function_Type.cxx:1482
code_panel_ok
Fl_Return_Button * code_panel_ok
Definition: function_panel.cxx:158
Fl_Data_Type::filename_
const char * filename_
Definition: Fl_Type.h:284
i18n_set
const char * i18n_set
Definition: fluid.cxx:706
Fl_Type::level
int level
Definition: Fl_Type.h:69
free
void free()
declblock_panel_cancel
Fl_Button * declblock_panel_cancel
Definition: function_panel.cxx:275
main_window
Fl_Window * main_window
Definition: fluid.cxx:176
Fl_Type::is_widget
virtual int is_widget() const
Definition: Fl_Type.cxx:749
codeblock_panel
Fl_Double_Window * codeblock_panel
Definition: function_panel.cxx:206
Fl_CodeBlock_Type::after
const char * after
Definition: Fl_Type.h:248
NULL
#define NULL
Definition: forms.H:34
declblock_public_choice
Fl_Choice * declblock_public_choice
Definition: function_panel.cxx:259
Fl_CodeBlock_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:534
Fl_Type::write
virtual void write()
Definition: Fl_Type.cxx:912
data_panel_cancel
Fl_Button * data_panel_cancel
Definition: function_panel.cxx:462
Fl_DeclBlock_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:1042
Fl_Comment_Type::title
virtual const char * title()
Definition: Fl_Function_Type.cxx:1227
Fl_Function_Type::return_type
const char * return_type
Definition: Fl_Type.h:166
decl_before_input
Fl_Input * decl_before_input
Definition: function_panel.cxx:269
data_panel_ok
Fl_Return_Button * data_panel_ok
Definition: function_panel.cxx:460
write_c
void write_c(const char *format,...)
Definition: code.cxx:265
fl_fopen
FILE * fl_fopen(const char *f, const char *mode)
Definition: fl_utf8.cxx:498
b
long b
Definition: jpegint.h:397
Fl_Data_Type
Definition: Fl_Type.h:283
Fl_CodeBlock_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:576
Fl_Type::is_in_class
const class Fl_Class_Type * is_in_class() const
Definition: Fl_Function_Type.cxx:1318
Fl_Decl_Type::static_
char static_
Definition: Fl_Type.h:270
Fl_DeclBlock_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:992
fl_choice
int fl_choice(const char *q, const char *b0, const char *b1, const char *b2,...)
Definition: fl_ask.cxx:459
subclassname
const char * subclassname(Fl_Type *)
Definition: Fl_Widget_Type.cxx:55
make_function_panel
Fl_Double_Window * make_function_panel()
Definition: function_panel.cxx:69
Fl_Decl_Type::is_public
virtual int is_public() const
Definition: Fl_Function_Type.cxx:584
Fl_CodeBlock_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:570
decl_panel
Fl_Double_Window * decl_panel
Definition: function_panel.cxx:338
redraw_browser
void redraw_browser()
Definition: Fl_Type.cxx:452
make_declblock_panel
Fl_Double_Window * make_declblock_panel()
Definition: function_panel.cxx:277
Fl_Comment_Type::in_h_
char in_h_
Definition: Fl_Type.h:322
Fl_Type.h
SEEK_SET
#define SEEK_SET
Definition: zconf.h:484
Fl_Class_Type::parent_class
Fl_Class_Type * parent_class
Definition: Fl_Type.h:349
Fl_Window.H
code_before_input
Fl_Input * code_before_input
Definition: function_panel.cxx:208
Fl_Decl_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:607
Fl_CodeBlock_Type
Definition: Fl_Type.h:247
p
static menustate * p
Definition: Fl_Menu.cxx:606
Fl_Type::comment
const char * comment()
Definition: Fl_Type.h:106
Fl_Code_Type
Definition: Fl_Type.h:194
fl_file_chooser
char * fl_file_chooser(const char *message, const char *pat, const char *fname, int relative=0)
Fl_Comment_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:1250
Fl_Class_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:1474
fl_input
const char * fl_input(const char *label, const char *deflt=0,...)
Definition: fl_ask.cxx:505
Fl_DeclBlock_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:970
f_return_type_input
Fl_Input * f_return_type_input
Definition: function_panel.cxx:61
Fl_CodeBlock_Type::open
void open()
Definition: Fl_Function_Type.cxx:542
Fl_Data_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:764
Fl_Function_Type::constructor
char constructor
Definition: Fl_Type.h:167
Fl_Comment_Type::type_name
virtual const char * type_name()
Definition: Fl_Type.h:329
Fl_Widget_Class_Type::write_public_state
char write_public_state
Definition: Fl_Type.h:651
FL_PATH_MAX
#define FL_PATH_MAX
Definition: filename.H:38
fl_filename_match
int fl_filename_match(const char *name, const char *pattern)
Definition: filename_match.cxx:44
f_comment_input
Fl_Text_Editor * f_comment_input
Definition: function_panel.cxx:63
Fl_Code_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:487
fname
static const char * fname
Definition: file.cxx:128
comment_in_header
Fl_Light_Button * comment_in_header
Definition: function_panel.cxx:629
data_filebrowser
Fl_Button * data_filebrowser
Definition: function_panel.cxx:456
Fl_DeclBlock_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:982
Fl_Decl_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:760
Fl_Type::type_name
virtual const char * type_name()=0
decl_panel_ok
Fl_Return_Button * decl_panel_ok
Definition: function_panel.cxx:363
Fl_Decl_type
Fl_Decl_Type Fl_Decl_type
Definition: Fl_Function_Type.cxx:695
make_data_panel
Fl_Double_Window * make_data_panel()
Definition: function_panel.cxx:464
Fl_Code_type
Fl_Code_Type Fl_Code_type
Definition: Fl_Function_Type.cxx:477
data_choice
Fl_Choice * data_choice
Definition: function_panel.cxx:433
strlcpy
#define strlcpy
Definition: flstring.h:84
Fl_Preferences::get
char get(const char *entry, int &value, int defaultValue)
Definition: Fl_Preferences.cxx:509
Fl_Data_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:785
f_panel_cancel
Fl_Button * f_panel_cancel
Definition: function_panel.cxx:67
Fl_Preferences::set
char set(const char *entry, int value)
Definition: Fl_Preferences.cxx:525
write_string
void write_string(const char *format,...)
Definition: file.cxx:93
Fl_Type::is_window
virtual int is_window() const
Definition: Fl_Type.cxx:759
indentation
int indentation
Definition: code.cxx:98
fl_show_input.H
Fl_Choice::value
int value() const
Definition: Fl_Choice.H:95
Fl_Window
Definition: Fl_Window.H:57
i18n_program
char i18n_program[]
Definition: fluid.cxx:707
Fl_Menu_::remove
void remove(int)
Definition: Fl_Menu_add.cxx:482
Fl_Double_Window::hide
void hide()
Definition: Fl_Double_Window.cxx:505
Fl_Widget::hide
virtual void hide()
Definition: Fl_Widget.cxx:283
Fl_File_Chooser.H
Fl_Type
Definition: Fl_Type.h:43
Fl_Comment_Type
Definition: Fl_Type.h:321
Fl_Data_type
Fl_Data_Type Fl_Data_type
Definition: Fl_Function_Type.cxx:893
Fl_Type::write_comment_h
void write_comment_h(const char *ind="")
Definition: Fl_Type.cxx:1004
indent
const char * indent()
Definition: code.cxx:99
c_public_button
Fl_Light_Button * c_public_button
Definition: function_panel.cxx:540
ExternalCodeEditor_UNIX.h
Fl_Function_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:142
Fl_Decl_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:595
f_panel_ok
Fl_Return_Button * f_panel_ok
Definition: function_panel.cxx:65
Fl_Type::class_name
const char * class_name(const int need_nest) const
Definition: Fl_Function_Type.cxx:1293
make_class_panel
Fl_Double_Window * make_class_panel()
Definition: function_panel.cxx:552
data_panel
Fl_Double_Window * data_panel
Definition: function_panel.cxx:431
Fl_Widget::redraw
void redraw()
Definition: Fl.cxx:1782
i18n_file
const char * i18n_file
Definition: fluid.cxx:705
Fl_Widget
Definition: Fl_Widget.H:101
_c_check
const char * _c_check(const char *&c, int type)
Definition: Fl_Function_Type.cxx:71
Fl_Comment_Type::title_buf
char title_buf[64]
Definition: Fl_Type.h:323
Fl_Input_::static_value
int static_value(const char *)
Definition: Fl_Input_.cxx:1248
alignment_panel.h
write_word
void write_word(const char *w)
Definition: file.cxx:58
comment_predefined
Fl_Menu_Button * comment_predefined
Definition: function_panel.cxx:631
Fl_CodeBlock_Type::write_properties
void write_properties()
Definition: Fl_Function_Type.cxx:526
Fl_Code_Type::handle_editor_changes
int handle_editor_changes()
Definition: Fl_Type.h:232
Fl_Class_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:1460
Fl_Preferences::Name
Definition: Fl_Preferences.H:159
make_codeblock_panel
Fl_Double_Window * make_codeblock_panel()
Definition: function_panel.cxx:216
Fl_Function_Type::havewidgets
char havewidgets
Definition: Fl_Type.h:167
Fl_Type::read_property
virtual void read_property(const char *)
Definition: Fl_Type.cxx:965
Fl_Decl_Type::open
void open()
Definition: Fl_Function_Type.cxx:636
buffer
static char buffer[128]
Definition: Fl_Function_Type.cxx:54
Fl_Menu_::value
int value() const
Definition: Fl_Menu_.H:140
Fl_Class_type
Fl_Class_Type Fl_Class_type
Definition: Fl_Function_Type.cxx:1443
goto_source_dir
void goto_source_dir()
Definition: fluid.cxx:126
i18n_function
const char * i18n_function
Definition: fluid.cxx:704
c_subclass_input
Fl_Input * c_subclass_input
Definition: function_panel.cxx:544
code_input
CodeEditor * code_input
Definition: function_panel.cxx:156
Fl_Class_Type::open
void open()
Definition: Fl_Function_Type.cxx:1373
Fl_DeclBlock_type
Fl_DeclBlock_Type Fl_DeclBlock_type
Definition: Fl_Function_Type.cxx:1040
function_panel
Fl_Double_Window * function_panel
Definition: function_panel.cxx:38
Fl_Decl_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:697
decl_class_choice
Fl_Choice * decl_class_choice
Definition: function_panel.cxx:350
declblock_panel_ok
Fl_Return_Button * declblock_panel_ok
Definition: function_panel.cxx:273
Fl_Decl_Type
Definition: Fl_Type.h:267
Fl_DeclBlock_Type::public_
char public_
Definition: Fl_Type.h:302
write_h
void write_h(const char *format,...)
Definition: code.cxx:272
comment_load
Fl_Button * comment_load
Definition: function_panel.cxx:633
c_panel_ok
Fl_Return_Button * c_panel_ok
Definition: function_panel.cxx:548
set_modflag
void set_modflag(int mf)
Definition: fluid.cxx:1687
Fl_Function_Type::has_signature
int has_signature(const char *, const char *) const
Definition: Fl_Function_Type.cxx:419
leave_source_dir
void leave_source_dir()
Definition: fluid.cxx:143
code_after_input
Fl_Input * code_after_input
Definition: function_panel.cxx:210
Fl_DeclBlock_Type::after
const char * after
Definition: Fl_Type.h:301
Fl_CodeBlock_type
Fl_CodeBlock_Type Fl_CodeBlock_type
Definition: Fl_Function_Type.cxx:568
Fl::wait
static int wait()
Definition: Fl.cxx:666
storestring
int storestring(const char *n, const char *&p, int nostrip)
Definition: Fl_Type.cxx:670
comment_panel_cancel
Fl_Button * comment_panel_cancel
Definition: function_panel.cxx:625
Fl_Code_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:431
class_panel
Fl_Double_Window * class_panel
Definition: function_panel.cxx:538
comment_text
static const char *const comment_text[]
Definition: comments.h:2
comment_panel_ok
Fl_Return_Button * comment_panel_ok
Definition: function_panel.cxx:623
Fl_Class_Type::public_
char public_
Definition: Fl_Type.h:340
Fl_Menu_Item
Definition: Fl_Menu_Item.H:112
read_word
const char * read_word(int wantbrace)
Definition: file.cxx:230
Fl_Type::name
const char * name() const
Definition: Fl_Type.h:96
decl_after_input
Fl_Input * decl_after_input
Definition: function_panel.cxx:271
Fl_Preferences
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:60
calloc
voidp calloc()
f_public_choice
Fl_Choice * f_public_choice
Definition: function_panel.cxx:49
Fl_Class_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:1336
Fl_Class_Type::prefix
const char * prefix() const
Definition: Fl_Type.h:366
Fl_DeclBlock_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:1049
code_panel
Fl_Double_Window * code_panel
Definition: function_panel.cxx:148
f_public_member_choice
Fl_Choice * f_public_member_choice
Definition: function_panel.cxx:40
is_id
int is_id(char c)
Definition: code.cxx:40
f
Fl_Box_Draw_F * f
Definition: fl_boxtype.cxx:285
Fl_Type::write_comment_c
void write_comment_c(const char *ind="")
Definition: Fl_Type.cxx:1027
data_input
Fl_Input * data_input
Definition: function_panel.cxx:452
write_sourceview
int write_sourceview
Definition: code.cxx:282
Fl_Data_Type::write_code1
void write_code1()
Definition: Fl_Function_Type.cxx:895
i18n_include
const char * i18n_include
Definition: fluid.cxx:703
Fl_Decl_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:620
Fl_Preferences::deleteEntry
char deleteEntry(const char *entry)
Definition: Fl_Preferences.cxx:478
Fl_Double_Window::show
void show()
Definition: Fl_Double_Window.cxx:79
Fl_Preferences.H
make_code_panel
Fl_Double_Window * make_code_panel()
Definition: function_panel.cxx:162
Fl_DeclBlock_Type::is_public
virtual int is_public() const
Definition: Fl_Function_Type.cxx:968
Fl_Function_Type::ismain
int ismain()
Definition: Fl_Type.h:180
strlcat
#define strlcat
Definition: flstring.h:79
Fl_Function_Type::read_property
void read_property(const char *)
Definition: Fl_Function_Type.cxx:155
current_widget_class
Fl_Widget_Class_Type * current_widget_class
Definition: Fl_Window_Type.cxx:1435
Fl_Type::factory
Fl_Type * factory
Definition: Fl_Type.h:73
Fl_Code_Type::open
void open()
Definition: Fl_Function_Type.cxx:445
data_class_choice
Fl_Choice * data_class_choice
Definition: function_panel.cxx:443
code
Definition: inftrees.h:24
data_filename
Fl_Input * data_filename
Definition: function_panel.cxx:454
Fl_Comment_Type::write_code2
void write_code2()
Definition: Fl_Function_Type.cxx:1289
ExternalCodeEditor_WIN32.h
ExternalCodeEditor::open_editor
int open_editor(const char *editor_cmd, const char *code)
Definition: ExternalCodeEditor_UNIX.cxx:385
Fl_Menu_::clear
void clear()
Definition: Fl_Menu_.cxx:457
fl_alert
void fl_alert(const char *,...)
Definition: fl_ask.cxx:361
batch_mode
int batch_mode
Definition: fluid.cxx:697
declblock_panel
Fl_Double_Window * declblock_panel
Definition: function_panel.cxx:257
write_cdata
void write_cdata(const char *s, int length)
Definition: code.cxx:225
decl_choice
Fl_Choice * decl_choice
Definition: function_panel.cxx:340
c_check
const char * c_check(const char *c, int type)
Definition: Fl_Function_Type.cxx:121
c_panel_cancel
Fl_Button * c_panel_cancel
Definition: function_panel.cxx:550
Fl_Function_Type::cdecl_
char cdecl_
Definition: Fl_Type.h:167
Fl_Class_Type
Definition: Fl_Type.h:338
Fl_Function_Type
Definition: Fl_Type.h:165
Fl_Function_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:129
comment_panel
Fl_Double_Window * comment_panel
Definition: function_panel.cxx:619
_q_check
const char * _q_check(const char *&c, int type)
Definition: Fl_Function_Type.cxx:57
Fl_Menu_::size
int size() const
Definition: Fl_Menu_.cxx:407
data_comment_input
Fl_Text_Editor * data_comment_input
Definition: function_panel.cxx:458
Fl_Comment_Type::make
Fl_Type * make()
Definition: Fl_Function_Type.cxx:1058
Fl_DeclBlock_Type::open
void open()
Definition: Fl_Function_Type.cxx:1004
Fl_Code_Type::editor_
ExternalCodeEditor editor_
Definition: Fl_Type.h:195
comments.h
write_public
void write_public(int state)
Definition: Fl_Function_Type.cxx:1447