Re: Modern Windows GUI visual styles
Hi, Take a look Windows API: CreateActCtx, ActivateActCtx, DeactivateActCtx and ReleaseActCtx and the struct ACTCTX You still need a manifest file, but that file can generate by program, and you can turn on/off the XP theme. "ACTCTX.lpSource Null-terminated string specifying the path of the manifest file or PE image to be used to create the activation context. If this path refers to an EXE or DLL file, the lpResourceName member is required." The attachment is the cpp code I wrote for Java... Regards, Eric Suen > Recently I spent a few hours to find a way to enable a new styles of > Windows XP controls from the code (without manual created external > manifest files, resource files, ...). The only solution I found in DFL > library and it looks quite complicated. > > Maybe should create that function at the level of the compiler or linker? begin 666 spket.cpp M(V1E9FEN92!?5TE.,S)?5TE.3E0@,'@P-3$P#0H-"B-I;F-L=61E(#QW:6YD M;w=...@^#0hc:6YC;'5D92 \'1E2 ]("AA='ep...@96yv+3y'97104-R M:71I8V%L*&IA2...@2dy)7T9!3%-%*2D@/3...@3e5,3"d...@9v]t;R!D;VYE M.PT*( T*(V1E9FEN92!214Q%05-%*&IA2...@8v%r2...@96yv+3y296qe87-e4')I;6ET:79E07)R87E#2...@2dy)7T%"3U)4*3L-"B-D969I;f...@4d5, M14%315]#3U!9*&IA2...@8v%r2...@96yv+3y296qe87-e4')I;6ET:79E07)R87E#2P@,"D[#0H-"G1Y<&5d...@2$%.1$q%("A*3DE#04Q,("I#$%07!E9&5F M($)/3...@*$i.24-!3$p@*D%C=&EV871E06-T0W1X4')O8RDH2$%.1$Q%+"!5 M3$].1U]05%(J*3L-"G1Y<&5d...@0d]/3" H2DY)0T%,3" J1&5A8W1I=F%T M94%C=$-T>%!R;V,I*$173U)$+"!53$].1U]05%(I.PT*='EP961E9B!V;VED M("A*3DE#04Q,("I296QE87-E06-T0W1X4')O8RDH2$%.1$Q%*3L-"@T*4U!+ M151?1E5#*&IB;V]L96%N+"!?86-T:79E5&AE;6EN9RD-"B @*$I.245N=B J M96YV+"!J8VQA$%RPT*"4A)3E-404Y#12!T:&5M94QI8B ]($QO861,:6)R87)Y M*")5>%1H96UE(BD[#0H):6...@*'1H96UE3&EB(#T]($Y53$PI#0H)"7)E='5R M;B!*3DE?1D%,4T4[#0H)"0T*"49R965,:6)R87)Y*'1H96UE3&EB*3L-"@D- M"@DO+TES5&AE;65!8W1I=F4@)b...@27-!<'!4:&5M960@;F]T('=OF4@/2!S:7IE;V8H=F5R26YF;RD[#0H)"0E(4D5354Q4(&AR(#...@9&QL M4')o...@f=f5r26yf;RD[#0H)"0EI9B H4U5#0T5%1$5$*&AR*2 F)B!V97)) M;F9O+F1W36%J;W)697)S:6]N(#X](#8I('L-"@D)"0EI2...@b2v5r;F5L,S(B*3L-"@D):6...@*&MEF4@/"!L96YG=&@I#0H)"0D)"0D)8G)E M86L[#0H)"0D)"0D-"@D)"0D)"6Y3:7IE(#T@,#L-"@D)"0D)"6EF("AL<$9I M;&5N86UE("$](&9I;&5N86UE*0T*"0D)"0D)"61E;&5T95M=(&QP1FEL96YA M;64[#0H)"0D)"0D)#0H)"0D)"0EL96YG=&@@*...@34%87u!!5$@[#0H)"0D) M"0EL<$9I;&5N86UE(#T@;F5W(%=#2$%26VQE;F=T:%T[#0H)"0D)"0EI9B H M;'!&:6QE;F%M92 ]/2!.54Q,*0T*"0D)"0D)"6)R96%K.PT*"0D)"0E]('=H M:6QE("AT" ](&-R96%T94%C=$-T>%!R;V,H M)F%C=&-T>"D[#0H)"0D)"7T-"@D)"0D):6...@*&QP1FEL96YA;64@(3...@3e5, M3" F)B!L<$9I;&5N86UE("$](&9I;&5N86UE*0T*"0D)"0D)9&5L971E6UT@ M;'!&:6QE;F%M93L-"@D)"0E]#0H)"0E](&5LPT*"0D)"4-R96%T94%C M=$-T>$%0%!R;V,@/2 H0W)E871E06-T0W1X05!R M;V,I($=E=%!R;V-!9&1R97-S*&ME$$B*3L- M"@D)"0EI9B H8W)E871E06-T0W1X4')O8R A/2!.54Q,*2![#0H)"0D)"4%# m5$-4...@86-t8w1x.pt*"0D)"0E$5T]21"!L96YG=&@@/2!-05A?4$%42#L- M"@D)"0D)8VAAF4@/2 P.PT*"0D) M"0D):6...@*&QP1FEL96YA;64@(3...@9fel96ya;64I#0H)"0D)"0D)9&5L971E M6UT@;'!&:6QE;F%M93L-"@D)"0D)"0D-"@D)"0D)"6QE;F=T:" K/2!-05A? M4$%42#L-"@D)"0D)"6QP1FEL96YA;64@/2!N97<@8VAAF5O9BAA8W1C='@I.PT* M"0D)"0D)86-T8W1X+FQP4V]U"YD=T9L86=S(#...@04-40u187t9,04=?4D533U520T5?3D%-15]604Q) M1#L-"@D)"0D)"6%C=&-T>"YL<%)E" A/2!)3E9!3$E$7TA!3D1,15]604Q512D@>PT*"0D)"7)C M(#...@86-t:79A=&5!8W1#='A0PT*"0D)"0E#3TY615)4 M*&II;G0J+"!C='@L(&-T>$%R$%R M"(I.PT*"0D)"0EI9B H%!R;V,@(3...@3e5,3"D-"@D) M"0D)"7)E;&5A%!R;V,@(3...@3e5,3"D-"@D)"0ER96QE87-E06-T0W1X4')O m...@j:$%C=$-T>"D[#0H)"7T-"@D)#0H)"49R965,:6)R87)Y*&ME#L-"@D)9&5L971E('5L<$%C=&EV871I M;VY#;V]K:64[#0H)?0T*"0T*"7)E='5R;B!*3DE?5%)513L-"GT-"@T*0D]/ M3"!!4$E%3E1262!$;&Q-86EN("A(24Y35$%.0T4@:$ENPT*"7-P:V5T7VAA;F1L92 ] M(&A);G-T.PT*"0T*"7)E='5R;b!44e5%.pt*?0t*#0...@t*PT*"6EF("AT:&5M95]S=&%T=7,@/3T@ M,"D@>PT*"0ET:&5M95]S=&%T=7,@/2 Q.PT*"0E(24y35$%@=&AE;64@ M/2!,;V%D3&EB2...@b57a4:&5M92(I.PT*"0EI9B H=&AE;64@(3...@3e5, M3"D@>PT*"0D)=&AE;65?PT*"6EF("@A M27-4:&5M95-U<'!OF4@/2!S:7IE;V8H M=F5R26YF;RD[#0H)"0E(4D5354Q4(&AR(#...@9&QL4')o...@f=f5r26yf;RD[ M#0H)"0EI9B H4U5#0T5%1$5$*&AR*2 F)B!V97));F9O+F1W36%J;W)697)S M:6]N(#X](#8I('L-"@D)"0E(24y35$%@=&AE;65,:6(@/2!,;V%D3&EB M2...@b57a4:&5M92(I.PT*"0D)"6EF("AT:&5M94QI8B A/2!.54Q,*2![ M#0H)"0D)"4ES5&AE;65!8W1I=F50PT*"0D)"0D)27-!<'!4:&5M96102AC;VUC=$QI8BD[#0H)?0T*"7)E='5R;B H:7-! M<'!4:&5M960@/3...@5%)512 _('1r...@.b!f86qs92d[#0i]#0h-"G-T871I M8R!B;V]L($5N86)L951H96UI;F%1H96UE(BD[#0H):6...@*'1H96UE3&EB("$]($Y53$PI('L-"@D)16YA M8FQE5&AE;6EN9U!R;V,@=&AE;6EN9U!R;V,@/2 H16YA8FQE5&AE;6EN9U!R M;V,I($=E=%!R;V-!9&1R97-S*'1H96UE3&EB+" B16YA8FQE5&AE;6EN9R(I M.PT*"0EI9B H=&AE;6EN9U!R;V,@(3...@3e5,3"D-"@D)"7)C(#...@=&AE;6EN M9U!R;V,H96YA8FQE(#...@5%)512 Z($9!3%-%*2 ]/2!37T]+.PT*"0D-"@D) M1G)E94QI8G)A
Re: Apache HTTPD server module in D (linux)
Sorry all. Just realized that this question belongs in D.learn.
Re: Modern Windows GUI visual styles
Stewart Gordon wrote: Indeed, I drove myself mad trying to find out how to make it work, and eventually discovered keeping a .manifest file alongside the .exe. We need more resources (NPI) teaching how to do it the tidier way. In your .rc file (which more or less all WIN32 GUI apps needs anyway) write in a line like: CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "manifest.xml" *** In a separate file named: manifest.xml YourApplication Also to work, the executable flags of the .exe file has to specifiy NT version 4.0 or higher as a requirement (probably default in most compilers by now.) Roald
Re: Template Metaprogramming Made Easy (Huh?)
language_fan Wrote: > Tue, 08 Sep 2009 17:25:08 -0400, Justin Johansson thusly wrote: > > ** Yes I know, there is > > nothing as pure as LISP macros but since I tend to lead a rather impure > > life 'D' has my attention now. > > I do not know what is so pure in LISP's macros. Macro is a "pure" > evaluation function that takes a meta-program and outputs another program I put that caveat in there to avoid being flamed by religious LISPers. It was a "diplomatic" concession. The argument I've often seen regarding LISP style macros is that they let you directly manipulate the AST which is why they (well some of them) think macro systems in other PLs are a poor imitation of the one true LISP macro. :-) > > > for Scala, FP etc, perhaps Walter Bright should be considered for a > > Fields Medal for D :-) http://en.wikipedia.org/wiki/Fields_Medal > > Martin is a computer scientist, Walter is an engineer. Martin creates new > science, Walter just applies existing knowledge. Those awards are only > meant for real scientists - engineers have their own award systems. Indeed; wasn't meant to be taken too literally; poetic license; my friend's brother has a Fields Medal so I'm well aware what this is.
Re: Modern Windows GUI visual styles
On Wed, Sep 09, 2009 at 08:27:56PM +0100, Stewart Gordon wrote: > Indeed, I'd like to know why M$ decided to bundle two versions of the > relevant DLLs and require the programmer to use a manifest in order to > access the modern version. Backward compatibility. Details here: http://blogs.msdn.com/oldnewthing/archive/2008/01/29/7294949.aspx -- Adam D. Ruppe http://arsdnet.net
Re: Modern Windows GUI visual styles
Valery wrote: Jeremie Pelletier Wrote: As far as I know, the only way to get the newer common controls library is to use an assembly manifest, be it external or compiled as a resource. I haven't looked into DFL but I'm pretty sure it simply generates the proper manifest resource and link it in the executable. Yes, in DFL creates a manifest file and so on, but it's done at runtime by method enableVisualStyles. I think that there should be a simpler way to enable new styles independent of library or native Win32 API you use. Indeed, I'd like to know why M$ decided to bundle two versions of the relevant DLLs and require the programmer to use a manifest in order to access the modern version. Or at least describe the process of change styles through the manifest files in the documentation and the section D for Win32 on site. Indeed, I drove myself mad trying to find out how to make it work, and eventually discovered keeping a .manifest file alongside the .exe. We need more resources (NPI) teaching how to do it the tidier way. Stewart.
Re: Modern Windows GUI visual styles
On 9/9/09 11:19, Valery wrote: Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated. Maybe should create that function at the level of the compiler or linker? There is no good solution for this problem. I was working on this for DWT and you somehow always need to have a manifest file. The problem is that windows doesn't load the correct dll and that's what the manifest file is for. You can look at the bottom of http://hg.dsource.org/projects/dwt-win/file/210994f12c4c/README.txt for a couple of options. If I remember correctly DFL creates a manifest file at runtime and then loads it. /Jacob Carlborg
Re: Compiled dmd2.032 in VC++ 2009!
Don wrote: Actually I think that even DMD should be using a 128-bit emulator for internal constants, regardless of the machine precision. That's a way off, still, but I think emulator is the way to go, long-term. Likewise, the compiler should not depend on NaNs being handled correctly in the C++ compiler. An emulator wouldn't be hard, I just have to get around to it :-)
Re: Template Metaprogramming Made Easy (Huh?)
Tue, 08 Sep 2009 18:09:01 -0400, bearophile thusly wrote: > CLisp macros are not pure at all, Scheme macros are a bit less dirty :-) Even though conversation on this newsgroup is mostly bikeshedding, it is wrong to use confusing new unestablished terms like dirtyness. The correct word is hygiene, and there is even a wikipedia page for all you folks who have forgotten what it means: http://en.wikipedia.org/wiki/ Hygienic_macro
Re: Template Metaprogramming Made Easy (Huh?)
Tue, 08 Sep 2009 17:25:08 -0400, Justin Johansson thusly wrote: > D is to C++ as Scala is to Java. The word you are looking for may be 'successor'. > The very articulate Paul Graham writes in "The Hundred-Year Language" > http://www.paulgraham.com/hundred.html "Though the situation is better > in the sciences, the overlap between the kind of work you're allowed to > do and the kind of work that yields good languages is distressingly > small. ... types seem to be an inexhaustible source of research papers, > despite the fact that static typing seems to preclude true macros-- > without which, in my opinion, no language is worth using." If I'm not > mistaken, (LISP) macros**, metaprogramming, templates are different > views of the same thing and any language which makes template > metaprogramming easy is definitely worth it. ** Yes I know, there is > nothing as pure as LISP macros but since I tend to lead a rather impure > life 'D' has my attention now. I do not know what is so pure in LISP's macros. Macro is a "pure" evaluation function that takes a meta-program and outputs another program that can be compiled to an executable (or interpreted). The larger difference is that macros in LISP are cleaner since they allow modifying all code as data. The lack of type system is another thing. A type system for meta-language has non-trivial requirements and I have to say that the most general system in D (string mixins) is not that large an improvement over LISP's macros. Go and see how template haskell did the same.. > Given Martin Odersky awarded top ACM recognition > http://actualites.epfl.ch/index.php? module=procontent&func=display&id=2046 > for Scala, FP etc, perhaps Walter Bright should be considered for a > Fields Medal for D :-) http://en.wikipedia.org/wiki/Fields_Medal Martin is a computer scientist, Walter is an engineer. Martin creates new science, Walter just applies existing knowledge. Those awards are only meant for real scientists - engineers have their own award systems.
Re: Nullable or Optional? Or something else?
Daniel Keep wrote: Andrei Alexandrescu wrote: I plan to add a Nullable struct to Phobos (akin to C#'s Nullable, Boost's Optional). Apparently a good design is to define Optional!T with a minimum of member functions (ideally none) and have it use the "alias this" feature to masquerade as a T. That way Optional!T looks and feels much like a T, except that it supports a function bool isNull(T)(Optional!T value); Am I on the right track? If so, what is the name you'd prefer for this artifact? Andrei Given the apocalyptic battle raging in this thread at the moment, maybe it would be pertinent to have both. Sometimes, you do want a generic mechanism for representing "this may or may not have a value". Other times, you just want something with a "no value set" sentinel. Nullable!T would be a type for which 'null' is a valid value. By this definition, Nullable!(Nullable!T) is obviously equivalent to Nullable!T; it's equivalent to T if T is either a pointer, array or object. Optional!T would be a type where an instance may or may not have a value of type T; even if T is itself Optional. I'm tempted to put an alias this into Optional and just define an external contentsOf function that pulls out the value contained in the Optional. Not sure if that's the right choice or not. So that gives us: [snip] Thanks. I think what I'll do for now is define Optional and see where things go. Andrei
Re: Modern Windows GUI visual styles
Or at least describe the process of change styles through the manifest files in the documentation and the section D for Win32 on site.
Re: Modern Windows GUI visual styles
Jeremie Pelletier Wrote: > As far as I know, the only way to get the newer common controls library is to > use an assembly manifest, be it external or compiled as a resource. I haven't > looked into DFL but I'm pretty sure it simply generates the proper manifest > resource and link it in the executable. Yes, in DFL creates a manifest file and so on, but it's done at runtime by method enableVisualStyles. I think that there should be a simpler way to enable new styles independent of library or native Win32 API you use.
Re: Modern Windows GUI visual styles
On Wed, 09 Sep 2009 05:19:22 -0400, Valery wrote: Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated. Maybe should create that function at the level of the compiler or linker? Out of curiosity, why not use DFL? Since then you'd only have to call Application.enableVisualStyles(); I'm pretty sure both QT and GTK (or whatever GUI lib you want to use) also have a nice wrapper for enabling XP styles.
BigInts in Tango/Phobos
I have tried to find Don's email address, but so far I have failed (and I have not seen him on IRC d.tango), so I talk here, even if this isn't the best place. I think this is the data representation of a Tango BigInt: alias uint BigDigit; const BigDigit[] ZERO = [0]; struct BigUint { BigDigit[] data = ZERO; } struct BigInt { BigUint data; // BigInt adds signed arithmetic to BigUint. bool sign = false; } I think the following representation may be better: struct BigInt { size_t* data; int sizeVal; // sign(sizeVal) is always the sign of the BigInt. // If data!=null then abs(sizeVal) is the actually size used // of the memory block, otherwise sizeVal is the value of this // BigInt (useful for small BigInts), with overflow tests too. int capacity; // The available size of the block } So the operations on such BigInts are cheap if the numbers can be stored in a 32 bit int (it just has to test if data is null and then perform a safe operation on 32 bit numbers). This first part can be done in a small struct method that I hope will always be inlined. If data isn't null then there's a call to the bigint machienery. When a 32 bit sizeVal produces overflow the bigint is converted into a normal bigint. Small integers are very common, so speeding up this case is very useful. Overflow tests in C: http://www.fefe.de/intof.html The capacity/sizeVal pair is modeled on a similar pair of the C++ vector, so it can mutate inplace and grow avoiding some reallocations (GNU GMP too allows inplace mutation). In theory inside such BigInt struct there's space for a 64 bit value (as a union) but I think 64 bit values aren't common enouggh to justify the little slowdown on smaller values. Bye, bearophile
Re: Modern Windows GUI visual styles
Valery Wrote: > Recently I spent a few hours to find a way to enable a new styles of Windows > XP controls from the code (without manual created external manifest files, > resource files, ...). The only solution I found in DFL library and it looks > quite complicated. > > Maybe should create that function at the level of the compiler or linker? As far as I know, the only way to get the newer common controls library is to use an assembly manifest, be it external or compiled as a resource. I haven't looked into DFL but I'm pretty sure it simply generates the proper manifest resource and link it in the executable.
Apache HTTPD server module in D (linux)
Seeing this topic discussed here before but unable to ascertain a definitive answer on the issue, please forgive me for asking again. Is there any technical reason (e.g. position dependent code) why DMD 1.0 + Phobos cannot be used to build an Apache HTTPD server module as a linux shared object (.so)? I've tried linking some D + C code together (the C code already being working apache module) and have encountered unresolved symbol issues (which undoubtedly is no surprise). There was some previous report that gcd would cut it, but for this project I need to stick with DMD or my D project will be hosed. I dread the thought of going back to Tomcat + Java. Now I've read how to build a Windows DLL with D and well understand the GC mechanics. If its just a matter of hacking the runtime (CRT) startup code I'm prepared to get my hands dirty but need some hints to get there. Alternative perhaps is to link the D module statically into the Apache core but this doesn't fit well having to distribute a custom build of Apache server. Any hints or help on this mercy assignment would be much appreciated. Again my apologies if this topic has been definitively dealt with before on this forum. Thanks.
Re: Template Metaprogramming Made Easy (Huh?)
Justin Johansson: >you (allegedly) say< Nope, look better, those words are written by Jari-Matti M.. Bye, bearophile
Re: Template Metaprogramming Made Easy (Huh?)
Justin Johansson wrote: You're welcome, Walter, and whilst I tend to fear of being flamed in a public forum (I don't have a thick enough skin to be a politician), I tried to practice, and not just preach, by making my own contribution to the reddit discussion a short while ago. I noticed, and thanks! Also thanks for the bio. It's nice to put a little flesh on the bones of those who post here, so to speak :-)
Modern Windows GUI visual styles
Recently I spent a few hours to find a way to enable a new styles of Windows XP controls from the code (without manual created external manifest files, resource files, ...). The only solution I found in DFL library and it looks quite complicated. Maybe should create that function at the level of the compiler or linker?
Re: Compiled dmd2.032 in VC++ 2009!
negerns Wrote: > I ran into the __pascal calling convention. VS2008 no longer support > > The __pascal calling convention is no longer supported in VS2008. How > did you resolve this? I assumed these were remainders of older code, and removed the __pascal from both the prototypes and declarations. You're gonna hit a few other issues, mostly unresolved symbols. In backend/cc.h there's a prototype for cpp_prettyident but no declaration, I hacked it away: inline char *cpp_prettyident (Symbol *s) { return s->Sident; } In cg87.cpp the compiler will whine about not having the M_*_L symbols, just define them as aliases of the * symbols (#define M_PI_L PI). VS has no long double support other than knowing its a different type. In cgobj.cpp the compiler also whines about a few char arrays being out of bounds. I exploded the strings into array literals: "SMCLV" -> {'S','M','C','L','V'}. There are a few of them in the file. In the same file, the compiler string has a hex character in it and VS is too dumb to notice it should be 8 bytes, fix it by breaking the string in two parts: "\0\xDB" "Digital Mars C/C++". Again in the same file, in the function obj_bytes(), VS whines about ((char *)p)++; not being a l-value, just add a local char* variable to use as the pointer, be careful about the goto here, you have to replace p with your variable everywhere in the function, not just the first half. In backend/cod3.cpp, the FLUSH() macro should be the same as the one for ELFOBJ. That's about it, these were the few tricky issues I had, there are plenty more but they are trivial to solve.
Re: Compiled dmd2.032 in VC++ 2009!
I ran into the __pascal calling convention. VS2008 no longer support The __pascal calling convention is no longer supported in VS2008. How did you resolve this?