Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-21 Thread Greg Ercolano
On 03/21/13 11:24, MacArthur, Ian (Selex ES, UK) wrote:
> Oh, was Gonzalo asking whether fluid could support namespaces?
> 
> I suppose in fluid a namespace might be entered a bit like a grouping widget,
> such that other entities would be declared nested inside it? Is that the sort 
> of thing?

Right, I think so; quoting the OP:
"Any chance of adding namespaces to fluid1.3"

..and I can certainly see the need for it, if one wanted to create
a widget or suite of tools in fluid attached to a namespace, or be able
to have multiple namespaces.

And yes, I think both the thing we use in fluid now for "Declaration 
Block"
could work for namespaces, as well as allowing a "single declaration"
to open and close should be possible too.

> I had thought he was asking if fltk-1.3 itself would have namespaces (which 
> for compatibility I guess it can't).

Right, I don't think he's asking for an API change.

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-21 Thread Roman Kantor
I am using namespaces in fluid, although with some tricks. Fluid complains (and 
does not accept) lines with open "{" brackets so first I have defined macros

#define NAMESPACE_START(name)  namespace name {
#define NAMESPACE_END}

and then use these macros as

1) either in "declaration block" and putting all your code in that declaration 
block and switch property of that declaration block to "in header and source 
file"

2) at the beginning and end of fluid files in simple "declarations" but  you 
need to do it twice, one for option "include in header file" and one for 
"include
in source file" as there is no option to "include in both" for simple 
declarations.


R.


___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-21 Thread MacArthur, Ian (Selex ES, UK)

> > I am trying to port my software from flkt2 to fltk1.3.
> > However fluid1.3 complains due to lacking namespaces.
> > Any chance of adding namespaces to fluid1.3 or a work-around?
> 
> Gonzalo, I've opened STR #2936 for this feature request,
> so that it doesn't get lost.


Oh, was Gonzalo asking whether fluid could support namespaces? I had thought he 
was asking if fltk-1.3 itself would have namespaces (which for compatibility I 
guess it can't).

I suppose in fluid a namespace might be entered a bit like a grouping widget, 
such that other entities would be declared nested inside it? Is that the sort 
of thing?




Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132

This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.


___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-21 Thread Greg Ercolano
> I am trying to port my software from flkt2 to fltk1.3.
> However fluid1.3 complains due to lacking namespaces.
> Any chance of adding namespaces to fluid1.3 or a work-around?

Gonzalo, I've opened STR #2936 for this feature request,
so that it doesn't get lost.

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-20 Thread Greg Ercolano
On 03/20/13 14:26, Greg Ercolano wrote:
>Perhaps an easy hack is to modify this line in Fl_Decl_Type::open():
> message = c_check(c&&c[0]=='#' ? c+1 : c);
>..to instead read something like:
> if ( !strncmp(c,"namespace",9) &&
>  !strcmp(c,"};") ) message = c_check(c&&c[0]=='#' ? c+1 : c);
> 

Hmm, this should actually work; replace the "message = .." line with:

if (strncmp(c,"namespace",9)==0 || strncmp(c,"};",2)==0) { message = 0; }
else { message = c_check(c&&c[0]=='#' ? c+1 : c); }

I actually tested it this time; my original post wasn't checked,
and wasn't right.

This mod allows you to include a comment after the }; so you can
do something like:

namespace foo {

..and:

};// end namespace foo

..without getting errors.

The above change is still a hack, it would take some work probably
to 'do it right', though I'm not sure what 'right' should be.
___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-20 Thread Greg Ercolano
On 03/20/13 13:51, Greg Ercolano wrote:
> Sorry I can't think of anything better; looks like fluid needs to
> be modified, because New->Code->Declaration complains about the unclosed 
> brace.

I don't know fluid's code well at all, but it looks like the 'code check'
is due to the Fl_Decl_Type::open() method calling c_check() in 
fluid/Fl_Function_Type.cxx.

Perhaps an easy hack is to modify this line in Fl_Decl_Type::open():

message = c_check(c&&c[0]=='#' ? c+1 : c);

..to instead read something like:

if ( !strncmp(c,"namespace",9) &&
 !strcmp(c,"};") ) message = c_check(c&&c[0]=='#' ? c+1 : c);

Then you can probably use New->Code->Declaration to start a namespace:

namespace foo {

..and a separate one to end it with:

};

I'm not sure if there are checks for this elsewhere in the code.
I think Matt and Bill are our resident fluid experts.





___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


Re: [fltk.general] fltk1.3 namespace in fluid

2013-03-20 Thread Greg Ercolano
On 03/20/13 11:25, Gonzalo Garramuno wrote:
> I am trying to port my software from flkt2 to fltk1.3.
> However fluid1.3 complains due to lacking namespaces.
> Any chance of adding namespaces to fluid1.3 or a work-around?

To use a namespace, I'd think New->Code->Declaration, and set it to:

using namespace whatever;

..and to define a namespace, I guess you might have to do
something like put:

#include "foo-namespace-start.h"
...
#include "foo-namespace-end.h"

..where foo-namespace-start.h contains: namespace foo {
..and foo-namespace-end.h contains: };

Sorry I can't think of anything better; looks like fluid needs to
be modified, because New->Code->Declaration complains about the unclosed 
brace.
Probably an easy fix to have the Declaration input check be ignored if 
there's
a 'namespace' command..




___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk


[fltk.general] fltk1.3 namespace in fluid

2013-03-20 Thread Gonzalo Garramuno
I am trying to port my software from flkt2 to fltk1.3.  However fluid1.3 
complains due to lacking namespaces.  Any chance of adding namespaces to 
fluid1.3 or a work-around?

___
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk