Re: GTKD resources

2017-08-10 Thread captaindet via Digitalmars-d-learn
On 2017-08-11 13:00, Mr. Pib wrote: How can one include external files such as glade, icons, images that are static in nature in to the binary but not require extraction on program run to be used? gtk's builder doesn't seem to take an in memory representation of glade files and building a

Re: core.stdc.stdlib.malloc & alignment

2016-06-28 Thread captaindet via Digitalmars-d-learn
On 2016-06-29 14:39, Hiemlick Hiemlicker wrote: Yes, the C standard requires malloc to be aligned to the platform size(4 for 32bit, 8 for 64-bit). just what i was hopping for. thanks!

core.stdc.stdlib.malloc & alignment

2016-06-28 Thread captaindet via Digitalmars-d-learn
is there an alignment guarantee for core.stdc.stdlib.malloc? more specifically, using DMD and compiling for 32bit on windows, can i assume proper alignment for int or uint variables? background: i like to re-use a (ubyte) buffer, sometimes it will store only bytes, sometimes it shall store

Re: Using .lib and .dll in D applications

2016-06-19 Thread captaindet via Digitalmars-d-learn
On 2016-06-20 06:33, moe wrote: I see where I went wrong. I thought that it's possible to only use the .lib file without the source code of dbar. Having access to the source makes what I am trying somewhat pointless. Is it otherwise possible to provide some functionality without having to give

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-15 Thread captaindet via Digitalmars-d-learn
string cssPath = "test.css"; CssProvider provider = new CssProvider(); provider.loadFromPath(cssPath); unfortunately i don't know anything about yr specific problem. but i just wanted to mention (in case you are not aware of it) that the CSS can be embedded into

Re: How to share an appender!string?

2016-05-19 Thread captaindet via Digitalmars-d-learn
On 2016-05-20 07:49, Era Scarecrow wrote: Experimented and quickly got what looks like good clean results. Took your code, ripped out what I didn't want and added in what I did. Simple! https://dpaste.dzfl.pl/6952fdf463b66 i am most curious about your solution. why does printAll() has a

Re: Anonymous structure

2016-04-18 Thread captaindet via Digitalmars-d-learn
On 2016-04-18 14:12, Tofu Ninja wrote: Also is there a way to have a named substructure, not a nested structure but something to just add an additional name, maybe something like struct a{ struct{ int x; int y; int z; } b; } not sure what you mean by "named

Re: static void arrays under garbage control?

2015-02-26 Thread captaindet via Digitalmars-d-learn
On 2015-02-26 10:07, Steven Schveighoffer wrote: Static data I believe is always scanned conservatively because no type information is stored for it ever, even on allocation (i.e. program startup). ouh, the confusion goes on... are you saying that { // will be all scanned by GC for

Re: static void arrays under garbage control?

2015-02-26 Thread captaindet via Digitalmars-d-learn
On 2015-02-26 12:07, Steven Schveighoffer wrote: On 2/26/15 11:57 AM, captaindet wrote: On 2015-02-26 10:07, Steven Schveighoffer wrote: Static data I believe is always scanned conservatively because no type information is stored for it ever, even on allocation (i.e. program startup). ouh

Re: static void arrays under garbage control?

2015-02-25 Thread captaindet via Digitalmars-d-learn
On 2015-02-25 20:45, H. S. Teoh via Digitalmars-d-learn wrote: On Wed, Feb 25, 2015 at 08:20:37PM -0600, captaindet via Digitalmars-d-learn wrote: [...] struct Stuff2Do{ static ubyte[1024*1024] buffer4speed = void; // even if untyped at this point // more } [...] Tangential note

Re: static void arrays under garbage control?

2015-02-25 Thread captaindet via Digitalmars-d-learn
On 2015-02-25 19:24, Adam D. Ruppe wrote: does this warning only apply to dynamic void[] arrays but not to static void[CTconstant] arrays? Both of those will be scanned for pointers. thanks, adam, so i should always use struct Stuff2Do{ static ubyte[1024*1024] buffer4speed = void; //

static void arrays under garbage control?

2015-02-25 Thread captaindet via Digitalmars-d-learn
if i understand correctly, static arrays are exempt from GC scanning for memory pointers http://dlang.org/garbage.html : Pointers in D can be broadly divided into two categories: Those that point to garbage collected memory, and those that do not. Examples of the latter are pointers created by

one of the weirdest bugs ever - request for testing

2014-06-12 Thread captaindet via Digitalmars-d-learn
hi, i just run into a (wrong code gen?) bug that manifests itself only under certain conditions. before i file it, i'd like to know if it is still around in the latest DMD version and/or if other platforms and 64bit code is affected as well. bug description: std.algorithm.countUntil fails to

Re: one of the weirdest bugs ever - request for testing

2014-06-12 Thread captaindet via Digitalmars-d-learn
On 2014-06-12 14:20, captaindet wrote: before i file it, i'd like to know if it is still around in the latest DMD version and/or if other platforms and 64bit code is affected as well. thanks andrew, philippe, i had the suspicion that it is a windows only problem anyway because the only

Re: one of the weirdest bugs ever - request for testing

2014-06-12 Thread captaindet via Digitalmars-d-learn
On 2014-06-12 17:27, Rene Zwanenburg wrote: On Thursday, 12 June 2014 at 22:14:23 UTC, captaindet wrote: On 2014-06-12 14:20, captaindet wrote: before i file it, i'd like to know if it is still around in the latest DMD version and/or if other platforms and 64bit code is affected as well

delegate issue

2014-06-02 Thread captaindet via Digitalmars-d-learn
hi, i stumbled upon something weird - it looks like a bug to me but maybe it is a feature that is unclear to me. so i know i can declare function and delegate pointers at module level. for function pointers, i can initialize with a lambda. BUT for delegates i get an error - see below i found

Re: delegate issue

2014-06-02 Thread captaindet via Digitalmars-d-learn
On 2014-06-02 08:08, Marc Schütz schue...@gmx.net wrote: On Monday, 2 June 2014 at 06:56:54 UTC, captaindet wrote: hi, i stumbled upon something weird - it looks like a bug to me but maybe it is a feature that is unclear to me. so i know i can declare function and delegate pointers at module

Re: delegate issue

2014-06-02 Thread captaindet via Digitalmars-d-learn
On 2014-06-02 08:03, MrSmith wrote: On Monday, 2 June 2014 at 06:56:54 UTC, captaindet wrote: hi, i stumbled upon something weird - it looks like a bug to me but maybe it is a feature that is unclear to me. so i know i can declare function and delegate pointers at module level. for function

Re: delegate issue

2014-06-02 Thread captaindet via Digitalmars-d-learn
On 2014-06-02 08:08, Marc Schütz schue...@gmx.net wrote: On Monday, 2 June 2014 at 06:56:54 UTC, captaindet wrote: hi, i stumbled upon something weird - it looks like a bug to me but maybe it is a feature that is unclear to me. so i know i can declare function and delegate pointers at module

Re: delegate issue

2014-06-02 Thread captaindet via Digitalmars-d-learn
On 2014-06-02 08:08, Marc Schütz schue...@gmx.net wrote: On Monday, 2 June 2014 at 06:56:54 UTC, captaindet wrote: hi, i stumbled upon something weird - it looks like a bug to me but maybe it is a feature that is unclear to me. so i know i can declare function and delegate pointers at module

Re: delegate issue

2014-06-02 Thread captaindet via Digitalmars-d-learn
On 2014-06-02 09:57, Steven Schveighoffer wrote: On Mon, 02 Jun 2014 10:37:07 -0400, captaindet 2k...@gmx.net wrote: On 2014-06-02 08:03, MrSmith wrote: On Monday, 2 June 2014 at 06:56:54 UTC, captaindet wrote: hi, i stumbled upon something weird - it looks like a bug to me but maybe

Re: templates, enums, CT reflection: compiler bug or not?

2014-04-06 Thread captaindet
no one any ideas? well, i filed two bug reports for now: https://d.puremagic.com/issues/show_bug.cgi?id=12532 https://d.puremagic.com/issues/show_bug.cgi?id=12533

templates, enums, CT reflection: compiler bug or not?

2014-04-04 Thread captaindet
i stumbled upon something strange while wondering around meta/codegen-lands. it took me almost a week to reduce it to the following test case. i have no clue what is going on, whether i have entered bug territory or just encountered my own limitations mind you, i have 2 issues with the

Re: shouldn't this work? / how to make it work?

2014-03-23 Thread captaindet
On 2014-03-22 19:37, anonymous wrote: On Saturday, 22 March 2014 at 22:54:15 UTC, captaindet wrote: pls see example code below. the two 'test' templates work fine by themselves. if, however, in the same module, the eponymous template does not work anymore. instead the compiler seems to try

shouldn't this work? / how to make it work?

2014-03-22 Thread captaindet
pls see example code below. the two 'test' templates work fine by themselves. if, however, in the same module, the eponymous template does not work anymore. instead the compiler seems to try instantiating the variadic template. a) why? for how i understand it, this should not happen as o they

std.algorithm.find and array of needles?

2014-03-03 Thread captaindet
std.algorithm.find has an overload that works with several needles: // phobos doc example: int[] a = [ 1, 4, 2, 3 ]; assert(find(a, [ 1, 3 ], 4) == tuple([ 4, 2, 3 ], 2)); the function i want to write has to deal with variadic arguments serving as needles. unfortunately, i failed trying to

Re: std.algorithm.find and array of needles?

2014-03-03 Thread captaindet
On 2014-03-03 14:58, John Colvin wrote: On Monday, 3 March 2014 at 19:35:53 UTC, captaindet wrote: std.algorithm.find has an overload that works with several needles: // phobos doc example: int[] a = [ 1, 4, 2, 3 ]; assert(find(a, [ 1, 3 ], 4) == tuple([ 4, 2, 3 ], 2)); the function i want

Re: std.algorithm.find and array of needles?

2014-03-03 Thread captaindet
On 2014-03-03 16:19, John Colvin wrote: On Monday, 3 March 2014 at 22:03:24 UTC, captaindet wrote: On 2014-03-03 14:58, John Colvin wrote: On Monday, 3 March 2014 at 19:35:53 UTC, captaindet wrote: std.algorithm.find has an overload that works with several needles: // phobos doc example: int

Re: objects as AA keys

2013-10-15 Thread captaindet
On 2013-10-15 08:32, Daniel Davidson wrote: On Tuesday, 15 October 2013 at 05:44:25 UTC, captaindet wrote: hi, i am a bit confused. the official language ref ( http://dlang.org/hash-map.html ) states: Classes can be used as the KeyType. For this to work, the class definition must override

objects as AA keys

2013-10-14 Thread captaindet
hi, i am a bit confused. the official language ref ( http://dlang.org/hash-map.html ) states: Classes can be used as the KeyType. For this to work, the class definition must override the following member functions of class Object: hash_t toHash() bool opEquals(Object) int opCmp(Object) ...

Re: more enum and pragma troubles

2013-08-19 Thread captaindet
On 2013-08-19 00:31, JS wrote: module main; import std.stdio, std.conv; template foo(alias T) { string foo(string s) { string x = to!string(T) ~ s ~ ; //pragma(msg, x); // pragma see's x as a run time variable(or rather pragma is executed before x is truly defined) return x; } well, i

Re: more enum and pragma troubles

2013-08-18 Thread captaindet
On 2013-08-17 21:54, JS wrote: On Sunday, 18 August 2013 at 00:17:22 UTC, captaindet wrote: On 2013-08-17 14:36, Jesse Phillips wrote: Third you've declared a variable, bar, which will store your enumerated value, 4. Variables are not compile time, even if the value stored came from a compile

Re: more enum and pragma troubles

2013-08-17 Thread captaindet
[enum foo = Test.test2;] On 2013-08-17 01:03, JS wrote: pragma( msg, foo ); // why does it print: cast(Test)2 // it should be: test2 // or at least simply: 2 It is 2! Notice the 2 at the end? The cast is just mumbo jumbo due to the the compiler deals with the stuff. You can remove the casts

Re: more enum and pragma troubles

2013-08-17 Thread captaindet
On 2013-08-17 01:51, captaindet wrote: named enums become runtime objects - named enums become runtime *only* objects

Re: more enum and pragma troubles

2013-08-17 Thread captaindet
On 2013-08-17 01:51, captaindet wrote: my understanding was that enums are all compile time entities that are just copied around. at compile time. a named enum type should make no difference. oh i see now, naming them is just creating a disguise for the base type. then they can become compile

Re: more enum and pragma troubles

2013-08-17 Thread captaindet
On 2013-08-17 14:36, Jesse Phillips wrote: Third you've declared a variable, bar, which will store your enumerated value, 4. Variables are not compile time, even if the value stored came from a compile time known value. yep, it completely escaped me that these are 'normal' variables. and i

more enum and pragma troubles

2013-08-16 Thread captaindet
are these bugs or expected behavior? (2 issues, see code below) i thought enums are just compile time copypaste magic so i cannot think of a reason why it should not be available at compile time... if buggy, what is broken, enum (really bad) or pragma(msg,...) (worse enough)? and are they in

Re: enum and tuples

2013-08-10 Thread captaindet
I'm pretty sure that this is just a bad error message. void main(){ writeln(ok: , ok, ok[0]: , ok[0]); // ok: Tuple!(string, string, string)(one, two, three) ok[0]: one writeln(er: , er, er[0]: , er[0]); // er: onetwothree er[0]: one } What I expect is happening is that TypeTuples don't

enum and tuples

2013-08-09 Thread captaindet
hi, i am still struggling getting to grips with tuples, especially typetuples. i got into this when trying module introspection and the surprise discovery that __traits(allMembers, .) seems to return a typetuple of strings. (the tuple article on dlang and philippe's template tutorial do help

Re: enum and tuples

2013-08-09 Thread captaindet
On 2013-08-09 11:36, Ali Çehreli wrote: as I am in the process of revising and translating a Tuples chapter. thanks for the reply, Ali. as a matter of fact, i am checking your website regularly, eagerly awaiting the translations of the tuples chapter. and the __traits and the template

Re: Reading a structured binary file?

2013-08-02 Thread captaindet
On 2013-08-02 17:13, Jonathan M Davis wrote: On Friday, August 02, 2013 19:49:54 Gary Willoughby wrote: What library commands do i use to read from a structured binary file? I want to read the byte stream 1, 2 maybe 4 bytes at a time and cast these to bytes, shorts and ints respectively. I

Re: reading a structure (eg header info) from file

2013-07-04 Thread captaindet
thanks everyone for your help! i should have mentioned that i did play with std.stdio.File.readf and rawRead but was too thick to figure out a working solution. o i could not figure out how to make readf work with my self defined struct o same with rawRead. but here i understand my mistake

reading a structure (eg header info) from file

2013-07-03 Thread captaindet
hi, whilst converting some of my C code into D i got stuck. in C: typedef struct { /* info */ } INFO; INFO info; size_t checkio; // read INFO from data file: pf_datafile = fopen(datafile,rb); checkio = fread((char *) info, sizeof(info), 1, pf_datafile); how do i do this in D? i'd like to

Re: Why there is too many uneccessary casts?

2013-06-12 Thread captaindet
On 2013-06-11 19:48, captaindet wrote: On 2013-06-11 07:35, Adam D. Ruppe wrote: On Tuesday, 11 June 2013 at 10:12:27 UTC, Temtaime wrote: ubyte k = 10; ubyte c = k + 1; This code fails to compile because of: Error: cannot implicitly convert expression (cast(int)k + 1) of type int to ubyte

Re: Why there is too many uneccessary casts?

2013-06-11 Thread captaindet
On 2013-06-11 07:35, Adam D. Ruppe wrote: On Tuesday, 11 June 2013 at 10:12:27 UTC, Temtaime wrote: ubyte k = 10; ubyte c = k + 1; This code fails to compile because of: Error: cannot implicitly convert expression (cast(int)k + 1) of type int to ubyte The reason is arithmetic operations

Re: modulename

2012-09-05 Thread captaindet
On 2012-09-04 15:36, Andrej Mitrovic wrote: 9/4/12, Ellery Newcomerellery-newco...@utulsa.edu wrote: On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: __FILE__? It doesn't necessarily have the exact package hierarchy. We could really use __MODULE__ then. I think it's been asked before but

Re: modulename

2012-09-05 Thread captaindet
On 2012-09-05 13:05, Jose Armando Garcia wrote: On Sep 5, 2012, at 10:56, captaindet 2k...@gmx.net wrote: On 2012-09-04 15:36, Andrej Mitrovic wrote: 9/4/12, Ellery Newcomerellery-newco...@utulsa.edu wrote: On 09/04/2012 12:41 PM, Andrej Mitrovic wrote: __FILE__? It doesn't necessarily

caller trouble

2012-07-14 Thread captaindet
i need a discreet handle on the calling/instantiating source file (module). using __FILE__, it is surprisingly easy for functions (via argument) and templated functions (via template parameter) but i cannot get it working for templated classes. how can i make them aware of the calling module?

Re: caller trouble

2012-07-14 Thread captaindet
On 2012-07-14 02:12, Jonathan M Davis wrote: [..] I believe that __FILE__ and __LINE__ are treated specially with functions in order for them to be filled in at the call site rather than the declaration site. If it's not working with classes, then that probably means that whatever special logic

Re: caller trouble

2012-07-14 Thread captaindet
auto _fun = fun(); //_fun == main.d auto _tfun = tfun(); //_tfun == main.d auto _tclass = new tclass!(); //_tclass.from == other.d !!! //this works but i do not want to provide __FILE__ explicitly: auto _tclassx = new tclass!(__FILE__)(); //_tclass.from == main.d //and why do i get 2 different

starting independent processes

2011-07-12 Thread captaindet
i am just in the middle of my first little d project. i came to the point where i have to start new processes command line style incl arguments. they need to run independent of the main program, i.e., several such processes need to be started and must run parallel while the main program