Re: How to uncompress gzip archive compressed by deflate method.

2010-11-13 Thread Zarathustra
Ok, I found the solution: _uncompressed = uncompress(_compressed, *cast(uint*)&_compressed[_compressed.length-4], 30);

Re: How to uncompress gzip archive compressed by deflate method.

2010-11-13 Thread Zarathustra
Thanks for a tip, but it's still does not work. My test gzip file have 10 (minimum gzip header) header bytes and 8 trailing bytes, so I tried: auto _uncompressed = uncompress(_compressed[0x0A.._compressed.length - 0x08]); But the exception still occurs. Maybe the compressed data need to be aligne

How to uncompress gzip archive compressed by deflate method.

2010-11-12 Thread Zarathustra
Maybe it is a stupid question but I need yours help. As in the topic. I have a Gzip archive in the buffer and I need to extract these archive into another buffer. I tried: void[] _uncompressed = uncompress(_compressed); but it throws 'std.zlib.ZlibException: data error.' Is it possible to do wit

Re: delegates with C linkage

2010-06-06 Thread Zarathustra
> my fault - yes its possible to use delegates in non D but delegat-struct > knowing languages (and a small pice of special calling code), sorry > Zarathrustra i missed the point of your post in whole No problem, I'm glad that we have reached an agreement. > wouldn't it be nice to have an complete

Re: GUIs in D1?

2010-06-06 Thread Zarathustra
> What's the current preferred way of doing cross-platform GUIs in > nowadays? DWT looks like a good option, but apparently its been dead for > a while? > > --Mike L. DWT is great but yes it looks dead for half a year. There are gtkd (also not updated for a while but it works well with D1 (I'm not

Re: delegates with C linkage

2010-06-05 Thread Zarathustra
> but that will help on the caller side (you using gcc?) but D still won't > accept an delegat in an extern C because this type does not exists in > the C world Maybe it is the reason but the error message is still nonsense. > btw: can show us code where you do this and it works - why don't you us

Re: delegates with C linkage

2010-06-05 Thread Zarathustra
> only with static methods - a real delegate needs the this-pointer in a > register (not on the stack), thats the main difference between function > ptr and delegates, thats why you can't use a (non static) method on for > example the win-api callbacks, because the caller don't know your object gc

Re: delegates with C linkage

2010-06-05 Thread Zarathustra
> For starters, your first delegate is declared in an extern(C) block, > meaning it has C linkage. The second is declared outside of the block, > meaning it has D linkage. So they are two different types of delegates. What is the difference? > Secondly, I'm not sure if you can pass delegates to a

delegates with C linkage

2010-06-04 Thread Zarathustra
I have obtained a strange error message when I tried to use delegate as an argument in a C linkage function. private extern (C) static { void d_foo_add_event_handler(Foo, void delegate()); } class Foo { void addEventHandler(void delegate() handler) { d_foo_add_event_handler(this, handler)

Never called destructor

2010-03-25 Thread Zarathustra
Why, in the following piece of code, destructor for 'x' is never called? class A{ char [] s; this(char [] o_s){ s = o_s; } ~this(){ writefln(s); }; } void main(){ A y; { scope A x = new A("x".dup); y = new A("y".dup); x = y; // } } output: y // where is x Destructors fo

Re: Struct definition after static if

2009-12-14 Thread Zarathustra
Simen kjaeraas Wrote: > Looks to me like a forward reference problem. Sadly, there > still are some of those in the language. > > Yes. http://www.digitalmars.com/d/2.0/faq.html#anonymous > > > struct Foo > { > union { int a; int b; } // I HAZ NO NAYM > struct { int c; int d; } // I

Re: Struct definition after static if

2009-12-14 Thread Zarathustra
Don Wrote: > Does that compile??? It shouldn't. !< is a floating-point operator. Of course that compile (thanks Got DMD behaviors logically). In this case !< mean nothing less >= NOT GREATER THAN is semantically same as GREATER OR EQUAL. Yes, you're right !< is a floationg-point operator bu

Struct definition after static if

2009-12-14 Thread Zarathustra
I must to put a 'struct definition' inside a 'static if block' but other 'struct definition' doesn't see them. static if(_WIN32IE !< 0x0400) struct TVINSERTSTRUCT{ HTREEITEM hparent ; HTREEITEM hinsertafter; union tagDUMMYUNIONNAME{ TVITEMEX itemex; TVITEM item; } tagDUMM

Mixins output handling

2009-10-30 Thread Zarathustra
Is there a some compiler switch to produce mixins output. I mean [d_file_with_mixins] -> [d_file_without_mixins].

Re: How to override function?

2009-10-22 Thread Zarathustra
grauzone Wrote: > Zarathustra wrote: > > I would like to know, how to override function if subclass and super class > > are located in the same package and different modules. > > > > For instance when they are in the same module: > > //__

How to override function?

2009-10-22 Thread Zarathustra
I would like to know, how to override function if subclass and super class are located in the same package and different modules. For instance when they are in the same module: //___ module main; class Foo{ this(){ proc(); } void proc(){ writefln(

Re: amazing function behavior

2009-10-21 Thread Zarathustra
I resolved my access violation problem by including at the begin of wndProc inside Window class, the following code: // private dword wndProc(ptr o_hwnd, dword o_msg, ... { asm{ push 0x; push [o_hwnd]; call [user

Re: this pointer

2009-10-21 Thread Zarathustra
Steven Schveighoffer Wrote: > On Wed, 21 Oct 2009 16:53:20 -0400, Zarathustra > wrote: > > > Why value of pointer to this is different in global function, member > > fun

this pointer

2009-10-21 Thread Zarathustra
Why value of pointer to this is different in global function, member function and constructor? //--- module test; class Foo{ this(){ writefln("ctor 0x%08X", cast(dword)&this); } void func(){

Re: amazing function behavior

2009-10-20 Thread Zarathustra
Phil Deets Wrote: > I don't know what the problem is, but I would try checking to see if the > pointer at window construction and the this pointer before calling > onMouseDown are the same. Maybe there is a problem with using the result > of getWindowLong as a pointer. For example, one value

Re: amazing function behavior

2009-10-20 Thread Zarathustra
Don Wrote: > It isn't. Tfunc2 is a function pointer, which is typically the same as > size_t. So any int can be stored inside it. It's generally a very bad > idea to do so, of course. Never mind what is stored inside func2. 0x00 is only to simplify the code. Tfunc1 - pointer to function without

Re: convert ... to array

2009-10-20 Thread Zarathustra
import std.stdio; class Foo{ final int array(...){ for(uint i = 0; i < _arguments.length; i++){ if(_arguments[i] == typeid(int [])){ int [] l_arr = *cast(int []*)_argptr; writefln("%d", l_arr[0]); } } return 0x0; } } // Foo

Re: amazing function behavior

2009-10-19 Thread Zarathustra
Oh, I just find out cause of this behaviour in other module I had: extern (Windows) alias dword function() Tfunc1; extern (Windows) alias dword function(wstr) Tfunc2; const Tfunc2 func2; static this(){ func2 = cast(Tfunc1)0x0; // for DMD2 It is not error!!! // but it do

Re: amazing function behavior

2009-10-19 Thread Zarathustra
In addition I tested the code in DMD1.050 and DMD2.035. In DMD 1 It works correctly, but in DMD2 line: 'this.onMouseDown(l_mea);' works like 'break' (no exceptions, neither compilation nor linking warnings, just like break). Is it DMD2 bug?

Re: amazing function behavior

2009-10-19 Thread Zarathustra
Daniel Keep Wrote: > It shouldn't even COMPILE. > > You can't use member functions as Windows callbacks. You haven't even > used the correct calling convention on it. > > Callbacks for Win API functions have to be, I believe, extern(Windows), > and they have to be free functions or static membe

amazing function behavior

2009-10-19 Thread Zarathustra
Function is never called but why? look at: window.Window.wndProc : case WM.LBUTTONDOWN //__ module window; private import base; private import structs; private static import user32; private static import kernel32; private static import gdi32; private:

Re: HWND is NULL but GetLastError returns 0x00

2009-10-17 Thread Zarathustra
Ok thanks, My fault ;p

Re: HWND is NULL but GetLastError returns 0x00

2009-10-17 Thread Zarathustra
ageBox(null, user32.translateErrorCode(kernel32.getLastError()), cast(str)"error", 0x); assert(handle); } } catch(Object o){ MsgBox(cast(char[])o.toString); } } // div0 Wrote: > -----BEGIN PGP SIGNED MESSAGE- > Hash:

HWND is NULL but GetLastError returns 0x00

2009-10-16 Thread Zarathustra
I have the problem with the following code in D2: CreateWindowEx returns NULL but I haven't got idea why? module test; import base; static import user32; static import kernel32; void MsgBox(immutable char [] o_str){ user32.messageBox(null, cast(str)o_str, cast(str)"msg", 0x0); } struct WndCla

__func__

2009-10-04 Thread Zarathustra
Does in D exist something like __func__? For example in gcc: int main(){ printf("%s", __func__); ...} returns "main".

Re: alias syntax

2009-08-05 Thread Zarathustra
Ellery Newcomer Wrote: > > You mean how the compiler rejects "alias const int x;" but not "alias > > static int x;"? That is strange.. > > I want to know why > > alias static int x; > > is allowed in the first place d.grammar accepts: alias const int a; but compiler no (it is ok). d.grammar a

Re: LPT

2009-03-25 Thread Zarathustra
I found a WinIO library. Have you got any expreriance with that in Windows XP? By the way of course in the newer computers haven't got LPT but it is not a problem. I want to use LPT to control a machine. Mike James Wrote: > Zarathustra Wrote: > > > Have you got any idea how

LPT

2009-03-25 Thread Zarathustra
Have you got any idea how to manipulate LPT port in Windows XP with D?

Re: ASM

2009-02-13 Thread Zarathustra
Thanks a lot :) Daniel Keep Wrote: > > Zarathustra wrote: > > I need to make some calculations with asm in D. > > Could somebody write how to do this, micro tutorial ;p > > I find the 'need' hard to believe. The only way you would need to use > assemble

ASM

2009-02-13 Thread Zarathustra
I need to make some calculations with asm in D. Could somebody write how to do this, micro tutorial ;p x86 Especially inc, dec, add, sub, mul, imul, div, idiv instructions. Also ja, jb, jg, jl, jo; jc ... and, or, not, xor, sal, shl, sar, shr

Re: Constants?

2009-02-11 Thread Zarathustra
For more documentation: d1: const: final: invariant: enums: d2

Re: Structuring a library project—best practices

2009-02-11 Thread Zarathustra
Hello Joel Maybe, you should look on the Helix Library. www.dsource.org/projects/helix But in my opinion you should write down all classes which You want to implement in your library, and then all relations between these classes. This approach warrants you essentially correct structure. I don't

Re: Internal error: ..\ztc\evalu8.c 2093

2009-02-11 Thread Zarathustra
It is really strange, but when I removed dsss and tango with dmd, and then put them back. The problem disappeared. I still use DSSS 0.78 and Tango 0.99.7 with DMD 1.033.

Re: Internal error: ..\ztc\evalu8.c 2093

2009-02-10 Thread Zarathustra
Of course, but bug is still not resolved. Any ideas, what can I do to bypass a problem? Jarrett Billingsley Wrote: > On Tue, Feb 10, 2009 at 3:50 PM, Zarathustra > wrote: > > When I trying build dwt-win 3.4.1 I get the following error: > > Internal error: ..\ztc\evalu8.c 20

Internal error: ..\ztc\evalu8.c 2093

2009-02-10 Thread Zarathustra
When I trying build dwt-win 3.4.1 I get the following error: Internal error: ..\ztc\evalu8.c 2093 command line: dsss build I using DSSS 0.78, Tango 0.99.7 with DMD 1.033. OS: Windows XP Any ideas?

Re: Cyclic Dependencies

2008-12-08 Thread Zarathustra
Ellery Newcomer Wrote: > Hello all, > > I began learning D a few months ago, and now I have a question about > cyclic dependencies (and some random whining). > > I come from a java background and have had no serious exposure to C++. > In java, cyclic dependencies are legit to the best of my kn

Re: why the array bounds array

2008-12-08 Thread Zarathustra
Michael P. Wrote: > Okay, I'm getting an array bounds error, and I have no clue why. Here is the > code that affect it: > > //Constants > const int SCREEN_WIDTH = 640; > const int SCREEN_HEIGHT = 480; > const int TILE_WIDTH = 20; > const int TILE_HEIGHT = 20; //how big one tile is, in pixels > c

override keyword

2008-11-27 Thread Zarathustra
When 'override' is so really required?

Personal Digital Assistant, Windows Mobile, Internet, D

2008-11-04 Thread Zarathustra
I need to write some application for working (data swop) with located on the server database via Internet. Application must working with PDA and Windows Mobile. Is It possible with D, if yes where will I find informations about it. I mean libraries or something like this. How to start do somethi