Re: D is totally useless

2013-05-02 Thread Jacob Carlborg

On 2013-05-01 16:18, Damian wrote:


The lack of proper windows headers is very discerning for windows users
and many have argued that D should come with these by default, I do think
that it does hurt D's reputation when a windows uses as to jump through
hoops just to display a window.


You're complaining about Windows. I can tell you that it doesn't look 
good for anyone. To get a window on Mac OS X you need to interact with 
Objective-C (no I don't want to use Carbon), which is possible but it's 
a pain in the ass.


--
/Jacob Carlborg


Re: D is totally useless

2013-05-02 Thread Andrei Alexandrescu

On 5/1/13 6:20 PM, Jesse Phillips wrote:

On Wednesday, 1 May 2013 at 22:33:40 UTC, John Colvin wrote:

On Wednesday, 1 May 2013 at 21:26:32 UTC, Temtaime wrote:

Because it's full of a drawing and many other functions. OpenGL is
part of WinAPI.


Is that strictly speaking true? I didn't think opengl was part of the
windows api (WinAPI) itself.


It is not. DirectX isn't even part of the WinAPI and that is what
Microsoft backs.


Probably would make for a good deimos addition.

Andrei


strange runtime error

2013-05-02 Thread gedaiu

can anyone help me tu understand this kind of errors?

/home/user/workspace/path/project/src(_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv+0x3e)[0x485ede]


Re: strange runtime error

2013-05-02 Thread evilrat

On Thursday, 2 May 2013 at 10:30:20 UTC, gedaiu wrote:

can anyone help me tu understand this kind of errors?

/home/user/workspace/path/project/src(_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv+0x3e)[0x485ede]


linux? segfault during unit test? if both is yes then sorry i 
can't help you, but maybe you can try find the source with 
try-catch construct and see what happens


Re: WinAPI callbacks and GC

2013-05-02 Thread Regan Heath
On Wed, 01 May 2013 01:12:39 +0100, Sean Kelly s...@invisibleduck.org  
wrote:



On Apr 23, 2013, at 2:21 PM, Jack Applegame jappleg...@gmail.com wrote:


According WinAPI documentation, CtrlHandler will be called in new  
additional thread. Is it safe to allocate GC memory in NOT Phobos  
threads?
If not, how to make it safe? I'm trying call thread_attachThis() at the  
beginning of CtrlHandler fucntion, but it doesn't compile because  
thread_attachThis() is not no throw.



thread_attachThis should probably just be labeled nothrow.  I don't  
think there's anything in that function that can throw an Exception.


That makes it callable.. but did you see my post about the various timing  
issues with using this in a non-GC thread (potentially while the GC is  
already collecting - or similar).


R

--
Using Opera's revolutionary email client: http://www.opera.com/mail/


[GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial application, 
but I do it very inproductive, so I'd like to get some help or I'm 
afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk application, 
that built with glade and has several typical widgets and signal 
handlers - it may help very much.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Mike Wey

On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:

How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial application,
but I do it very inproductive, so I'd like to get some help or I'm
afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk application,
that built with glade and has several typical widgets and signal
handlers - it may help very much.


There is an small example distributed with GtkD:
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d

--
Mike Wey


a FOR loop and floating variables

2013-05-02 Thread Carlos

I have this code :

import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5.0/9.0)*(fahr-32), \n);
write(Done!\n);
exit (0);
}
 Which works. but if I change the 5.0 for 5 I get cero on the 
celsius side.


import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5/9)*(fahr-32), \n);
write(Done!\n);
exit (0);
}

So why is this ?


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Thursday, 2 May 2013 at 17:43:28 UTC, Mike Wey wrote:

On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:

How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial 
application,
but I do it very inproductive, so I'd like to get some help or 
I'm

afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk 
application,
that built with glade and has several typical widgets and 
signal

handlers - it may help very much.


There is an small example distributed with GtkD:
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d


I get thhis error when trying to compile it :

testgithub.d(3): Error: module Builder is in file 'gtk/Builder.d' 
which cannot be read

import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
import path[2] = /usr/local/includes/d


I installed from here :

link : http://www.dsource.org/projects/gtkd/wiki/DebianPackages


Re: a FOR loop and floating variables

2013-05-02 Thread Simen Kjaeraas

On 2013-05-02, 20:14, Carlos wrote:


I have this code :

import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5.0/9.0)*(fahr-32), \n);
write(Done!\n);
exit (0);
}
  Which works. but if I change the 5.0 for 5 I get cero on the  
celsius side.


import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5/9)*(fahr-32), \n);
write(Done!\n);
exit (0);
}

So why is this ?


Both 5 and 9 in the second example are integers (int). When you divide
one int by another, the result is an int, and hence (5/9) is 0.

--
Simen


Re: a FOR loop and floating variables

2013-05-02 Thread Martin Drašar

Dne 2.5.2013 20:14, Carlos napsal(a):

I have this code :

import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5.0/9.0)*(fahr-32), \n);
write(Done!\n);
exit (0);
}
  Which works. but if I change the 5.0 for 5 I get cero on the
celsius side.

import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5/9)*(fahr-32), \n);
write(Done!\n);
exit (0);
}

So why is this ?


Hi Carlos,

the second code performs integral division which very much behave like 
floating-point division, but the fractional part is chopped off.


 5/9 ~ 0.556 = 0
10/9 ~ 1.111 = 1

If you want precise (i.e. floating point) results, you have to have at 
least one float or double in your equation.


This would work:

write(fahr, \t, (5.0/9)*(fahr-32), \n);

Regards,
Martin


Re: a FOR loop and floating variables

2013-05-02 Thread bearophile

Simen Kjaeraas:

Both 5 and 9 in the second example are integers (int). When you 
divide

one int by another, the result is an int, and hence (5/9) is 0.


Yes, smarter languages (like Pascal..., but also Python, Ada, 
etc) have two different division operators to avoid such silly C 
semantics, that sometimes causes bugs.


Bye,
bearophile


Re: strange runtime error

2013-05-02 Thread Jesse Phillips

On Thursday, 2 May 2013 at 10:30:20 UTC, gedaiu wrote:

can anyone help me tu understand this kind of errors?

/home/user/workspace/path/project/src(_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv+0x3e)[0x485ede]


Basic translation: 
core.runtime.runModuleUnitTests.unittest-SegvHandler-core.sys.posix.signal-siginfo 
= tPvZv+0x3e[0x485ede] - Memory location


Re: D is totally useless

2013-05-02 Thread Jesse Phillips
On Thursday, 2 May 2013 at 07:39:29 UTC, Andrei Alexandrescu 
wrote:

On 5/1/13 6:20 PM, Jesse Phillips wrote:

On Wednesday, 1 May 2013 at 22:33:40 UTC, John Colvin wrote:

On Wednesday, 1 May 2013 at 21:26:32 UTC, Temtaime wrote:
Because it's full of a drawing and many other functions. 
OpenGL is

part of WinAPI.


Is that strictly speaking true? I didn't think opengl was 
part of the

windows api (WinAPI) itself.


It is not. DirectX isn't even part of the WinAPI and that is 
what

Microsoft backs.


Probably would make for a good deimos addition.

Andrei


Agreed probably would be a good pull request for 
https://github.com/D-Programming-Deimos/OpenGL


Re: D is totally useless

2013-05-02 Thread Rob T

On Thursday, 2 May 2013 at 04:27:10 UTC, evilrat wrote:
learn what? opengl is C API specification, any resource about 
opengl will work, the only thing required for apply it to D is 
to know D basics. but unfortunately for D itself it is really 
hard to find good tutorials


I use this on-line book on D.

http://ddili.org/ders/d.en/index.html

Unfortunately, not 100% translated yet, but it's still an active 
project being worked on so I expect eventually it will get filly 
translated. A really nice thing about it, is that it gets updated 
to reflect the latest changes and additions to D.


--rt


Re: D is totally useless

2013-05-02 Thread Diggory
The wgl*** functions and SwapBuffers ARE part of the windows 
api even though they are implemented in opengl32.dll (they are 
declared in wingdi.h IIRC)


Re: [GtkD] How to use Glade?

2013-05-02 Thread Mike Wey

On 05/02/2013 08:21 PM, Carlos wrote:

On Thursday, 2 May 2013 at 17:43:28 UTC, Mike Wey wrote:

On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:

How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial application,
but I do it very inproductive, so I'd like to get some help or I'm
afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk application,
that built with glade and has several typical widgets and signal
handlers - it may help very much.


There is an small example distributed with GtkD:
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d



I get thhis error when trying to compile it :

testgithub.d(3): Error: module Builder is in file 'gtk/Builder.d' which
cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
import path[2] = /usr/local/includes/d



I installed from here :

link : http://www.dsource.org/projects/gtkd/wiki/DebianPackages


Try:

dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)

--
Mike Wey


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos



I get thhis error when trying to compile it :

testgithub.d(3): Error: module Builder is in file 
'gtk/Builder.d' which

cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
import path[2] = /usr/local/includes/d



I installed from here :

link : http://www.dsource.org/projects/gtkd/wiki/DebianPackages


Try:

dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)


Now I get this error on tha command line :

No glade file specified, using default builderTest.glade
glib.GException.GException@src/glib/GException.d(75): Failed to 
open file 'builderTest.glade': No such file or directory


./testgithub(_Dmain+0x10f) [0x67a7ff]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void runMain()+0x18) 
[0x843bb4]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void tryExec(scope void 
delegate())+0x2a) [0x8436f2]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void runAll()+0x3b) [0x843bfb]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void tryExec(scope void 
delegate())+0x2a) [0x8436f2]

./testgithub(_d_run_main+0x1a8) [0x8436ac]
./testgithub(main+0x17) [0x8434ff]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) 
[0x7f3b7001dea5]



Downloaded from here :


link : 
https://github.com/SawfishWM/rep-gtk/blob/master/examples/gtk-builder-test.glade


And still get errors.

No glade file specified, using default builderTest.glade
glib.GException.GException@src/glib/GException.d(75): Failed to 
open file 'builderTest.glade': No such file or directory


./testgithub(_Dmain+0x10f) [0x67a7ff]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void runMain()+0x18) 
[0x843bb4]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void tryExec(scope void 
delegate())+0x2a) [0x8436f2]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void runAll()+0x3b) [0x843bfb]
./testgithub(extern (C) int rt.dmain2._d_run_main(int, char**, 
extern (C) int function(char[][])*).void tryExec(scope void 
delegate())+0x2a) [0x8436f2]

./testgithub(_d_run_main+0x1a8) [0x8436ac]
./testgithub(main+0x17) [0x8434ff]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) 
[0x7f98ed0ceea5]




Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos




Try:

dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)


It compiles but doesn't run well. I'm checking this comment on 
the code.


/**
* Usage ./gladeText /path/to/your/glade/file.glade
*
*/


Re: D is totally useless

2013-05-02 Thread Carlos

On Thursday, 2 May 2013 at 04:27:10 UTC, evilrat wrote:

On Thursday, 2 May 2013 at 02:07:23 UTC, Carlos wrote:

On Wednesday, 1 May 2013 at 08:53:18 UTC, Raphaël Jakse wrote:

Le 01/05/2013 10:42, Temtaime a écrit :

I'm new in D, so i'm tried to write some in that langugage.
That's story about how i tried to port OGL sample, that 
renders one

triangle.



You can do much better with the D programming langage.
See :
- http://www.asahi-net.or.jp/~cs8k-cyu/windows/tt_e.html
- http://www.emhsoft.com/ttrooper/

So yes, you can do OpenGL with D, and it works.


But where can this be learned ? Do you know any books on the 
subject ?


learn what? opengl is C API specification, any resource about 
opengl will work, the only thing required for apply it to D is 
to know D basics. but unfortunately for D itself it is really 
hard to find good tutorials


Ok


Re: [GtkD] How to use Glade?

2013-05-02 Thread Mike Wey

On 05/02/2013 11:25 PM, Carlos wrote:




Try:

dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)


It compiles but doesn't run well. I'm checking this comment on the code.

/**
* Usage ./gladeText /path/to/your/glade/file.glade
*
*/


Normally the example looks for builderTest.glade in the directory where 
the binary is.


There one in the GtkD git 
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


You can also specify a different glade file on the commandline, the 
example code tries to access a wiget named window1 if it's not pressent 
in the glade file it will print No window? and exit.


--
Mike Wey


Re: Getting environment variables?

2013-05-02 Thread Mark Fischer

Better late than never...

On Sunday, 23 November 2008 at 02:28:30 UTC, Christopher Wright
wrote:
...
I thought (perhaps wrongly) C allowed you to declare main as 
taking a list of environment variables, which is why I asked


Indeed, on Unix { not POSIX } and Windows:

From Wiki:
==
Other platform-dependent formats are also allowed by the C and
C++ standards, except that in C++ the return type must always be
int;[3] for example, Unix (though not POSIX.1) and Microsoft
Windows have a third argument giving the program's environment,
otherwise accessible through getenv in stdlib.h:

int main(int argc, char **argv, char **envp);

Mac OS X and Darwin have a fourth parameter containing arbitrary
OS-supplied information, such as the path to the executing
binary:[4]
==

Mark



Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Thursday, 2 May 2013 at 22:07:46 UTC, Mike Wey wrote:

On 05/02/2013 11:25 PM, Carlos wrote:




Try:

dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)


It compiles but doesn't run well. I'm checking this comment on 
the code.


/**
* Usage ./gladeText /path/to/your/glade/file.glade
*
*/


Normally the example looks for builderTest.glade in the 
directory where the binary is.


There one in the GtkD git 
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


You can also specify a different glade file on the commandline, 
the example code tries to access a wiget named window1 if it's 
not pressent in the glade file it will print No window? and 
exit.


I can't believe an hour has passed so easy.

How do I specify the doferent glade ?, During compilation ?


Re: [GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

03.05.2013 6:12, Carlos пишет:


Normally the example looks for builderTest.glade in the directory
where the binary is.

There one in the GtkD git
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


You can also specify a different glade file on the commandline, the
example code tries to access a wiget named window1 if it's not
pressent in the glade file it will print No window? and exit.


I can't believe an hour has passed so easy.

How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. but if 
you just want to use another glade file with the same name then answer 
is no. this different glade file should has window widget with name 
window1 but with the rest no other restrictions exist. with glade you 
can create more complex application easer and after debugging build 
glade file into your application.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

03.05.2013 0:43, Mike Wey пишет:


There is an small example distributed with GtkD:
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d



Oops, didn't see.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

03.05.2013 7:24, Alexandr Druzhinin пишет:


I can't believe an hour has passed so easy.

How do I specify the doferent glade ?, During compilation ?

if you mean glade file with different name then answer is yes. but if
you just want to use another glade file with the same name then answer
is no. this different glade file should has window widget with name
window1 but with the rest no other restrictions exist. with glade you
can create more complex application easer and after debugging build
glade file into your application.

I was totally wrong - didn't look at code before :(
The right answer to your question is you can specify your own glade file 
into command line as second argument like this:

builder /path/to/your/glade/file/your.glade
it will be enough


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Friday, 3 May 2013 at 00:24:50 UTC, Alexandr Druzhinin wrote:

03.05.2013 6:12, Carlos пишет:


Normally the example looks for builderTest.glade in the 
directory

where the binary is.

There one in the GtkD git
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


You can also specify a different glade file on the 
commandline, the

example code tries to access a wiget named window1 if it's not
pressent in the glade file it will print No window? and 
exit.


I can't believe an hour has passed so easy.

How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. 
but if you just want to use another glade file with the same 
name then answer is no. this different glade file should has 
window widget with name window1 but with the rest no other 
restrictions exist. with glade you can create more complex 
application easer and after debugging build glade file into 
your application.

Right now I want to use the glade file form the site.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

I was totally wrong - didn't look at code before :(
The right answer to your question is you can specify your own 
glade file into command line as second argument like this:

builder /path/to/your/glade/file/your.glade
it will be enough


Ok I'll try that.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Friday, 3 May 2013 at 00:30:00 UTC, Alexandr Druzhinin wrote:

03.05.2013 7:24, Alexandr Druzhinin пишет:


I can't believe an hour has passed so easy.

How do I specify the doferent glade ?, During compilation ?
if you mean glade file with different name then answer is yes. 
but if
you just want to use another glade file with the same name 
then answer
is no. this different glade file should has window widget with 
name
window1 but with the rest no other restrictions exist. with 
glade you
can create more complex application easer and after debugging 
build

glade file into your application.

I was totally wrong - didn't look at code before :(
The right answer to your question is you can specify your own 
glade file into command line as second argument like this:

builder /path/to/your/glade/file/your.glade
it will be enough


Sorry if this was too wild but this is what I can do at the 
moment since I don't see a gladeText program which I believe is 
required for this action I did my guess.


code:

dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder 
~/Documents/Glade/builderTest.glade


gives error :

Error: unrecognized file extension glade

-

gtkD samples give error but I'm not using the same software from 
developers I'll try to install by purge all gtkD programs 
installed by no and trying make install again. Then check if 
the samples compile right.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

03.05.2013 7:55, Carlos пишет:


Sorry if this was too wild but this is what I can do at the moment since
I don't see a gladeText program which I believe is required for this
action I did my guess.

code:

dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder
~/Documents/Glade/builderTest.glade

gives error :

Error: unrecognized file extension glade

-

gtkD samples give error but I'm not using the same software from
developers I'll try to install by purge all gtkD programs installed by
no and trying make install again. Then check if the samples compile
right.

first build application:
dmd builderTest.d $(pkg-config --cflags --libs gtkd-2)

then run it:
builder ~/Documents/Glade/builderTest.glade


Re: [GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

03.05.2013 0:43, Mike Wey пишет:

On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:

How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial application,
but I do it very inproductive, so I'd like to get some help or I'm
afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk application,
that built with glade and has several typical widgets and signal
handlers - it may help very much.


There is an small example distributed with GtkD:
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d


won't it be better to have the simple template to hide cast() using 
Builder.getObject():


auto getObjectAs(T)(Builder b, string object_name) {
return cast(T) b.getObject(object_name);
}
?


Re: C++ and D bool compatibility

2013-05-02 Thread bearophile

Jeremy DeHaan:

D bools are 1 byte, and C/C++ chars are 1 byte as well and it 
works.


D bools are 1 byte, but C chars don't need to be 1 byte, so you 
are working with an implementation detail.


I think in C99+ it's better to use uint8_t from stdint.h, that's 
safely always 1 byte long.


Bye,
bearophile


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Friday, 3 May 2013 at 00:58:36 UTC, Alexandr Druzhinin wrote:

03.05.2013 7:55, Carlos пишет:


Sorry if this was too wild but this is what I can do at the 
moment since
I don't see a gladeText program which I believe is required 
for this

action I did my guess.

code:

dmd builderTest.d $(pkg-config --cflags --libs gtkd-2) builder
~/Documents/Glade/builderTest.glade

gives error :

Error: unrecognized file extension glade

-

gtkD samples give error but I'm not using the same software 
from
developers I'll try to install by purge all gtkD programs 
installed by
no and trying make install again. Then check if the samples 
compile

right.

first build application:
dmd builderTest.d $(pkg-config --cflags --libs gtkd-2)

then run it:
builder ~/Documents/Glade/builderTest.glade


I got it working now. I'm using the sample code and I made 
another layout with Glade for GTK+3 and saved it with the same 
name, so when I compile the file is called and I get the UI I 
wanted.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Friday, 3 May 2013 at 01:00:48 UTC, Alexandr Druzhinin wrote:

03.05.2013 0:43, Mike Wey пишет:

On 05/02/2013 03:58 PM, Alexandr Druzhinin wrote:

How to use GtkD with Glade? Is some tutorial available?
I spent some time trying to use Glade to build non-trivial 
application,
but I do it very inproductive, so I'd like to get some help 
or I'm

afraid it will be lasting for years...
For example, if somebody would upload some example of Gtk 
application,
that built with glade and has several typical widgets and 
signal

handlers - it may help very much.


There is an small example distributed with GtkD:
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.d


won't it be better to have the simple template to hide cast() 
using Builder.getObject():


auto getObjectAs(T)(Builder b, string object_name) {
return cast(T) b.getObject(object_name);
}
?
Thank you very much for your help! It's being the whole day 
working on this.


Re: [GtkD] How to use Glade?

2013-05-02 Thread Carlos

On Thursday, 2 May 2013 at 22:07:46 UTC, Mike Wey wrote:

On 05/02/2013 11:25 PM, Carlos wrote:




Try:

dmd testgithub.d $(pkg-config --cflags --libs gtkd-2)


It compiles but doesn't run well. I'm checking this comment on 
the code.


/**
* Usage ./gladeText /path/to/your/glade/file.glade
*
*/


Normally the example looks for builderTest.glade in the 
directory where the binary is.


There one in the GtkD git 
https://github.com/gtkd-developers/GtkD/blob/master/demos/builder/builderTest.glade


You can also specify a different glade file on the commandline, 
the example code tries to access a wiget named window1 if it's 
not pressent in the glade file it will print No window? and 
exit.

Thanks Mike Wey this was crucial on this workaround.


Re: C++ and D bool compatibility

2013-05-02 Thread Jeremy DeHaan

On Friday, 3 May 2013 at 01:03:39 UTC, bearophile wrote:

Jeremy DeHaan:

D bools are 1 byte, and C/C++ chars are 1 byte as well and it 
works.


D bools are 1 byte, but C chars don't need to be 1 byte, so you 
are working with an implementation detail.


Technically speaking, you are right. Generally speaking, it's 
probably going to be pretty rare for a compiler these days to 
define a char type as more the 8 bits so I figured I would be 
safe.


I think in C99+ it's better to use uint8_t from stdint.h, 
that's safely always 1 byte long.




I agree with you on this though, and it is definitely a better 
solution. Question though, is there any difference between uint_t 
and int8_t for this kind of purpose? They are the same size, but 
the former is just unsigned.




Re: [GtkD] How to use Glade?

2013-05-02 Thread Alexandr Druzhinin

03.05.2013 8:29, Carlos пишет:


I got it working now. I'm using the sample code and I made another
layout with Glade for GTK+3 and saved it with the same name, so when I
compile the file is called and I get the UI I wanted.


SO now next step is to learn the signals part, Right ?

right. and it's very very simpler than in plain C


Re: strange runtime error

2013-05-02 Thread gedaiu

On Thursday, 2 May 2013 at 19:55:23 UTC, Jesse Phillips wrote:

On Thursday, 2 May 2013 at 10:30:20 UTC, gedaiu wrote:

can anyone help me tu understand this kind of errors?

/home/user/workspace/path/project/src(_D4core7runtime18runModuleUnitTestsUZb19unittestSegvHandlerUiPS4core3sys5posix6signal9siginfo_tPvZv+0x3e)[0x485ede]


Basic translation: 
core.runtime.runModuleUnitTests.unittest-SegvHandler-core.sys.posix.signal-siginfo 
= tPvZv+0x3e[0x485ede] - Memory location


Yes, i am using linux.

Thanks!
Bogdan