On 6/13/2011 9:00 PM, Loopback wrote:
Hello!
I've been test programming win32 applications recently, and since the
phobos win32 library is so limited, I decided to download and test the
WindowsAPI Binding
(http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the
latest snapshot (as o
I'm in the process of porting WinAPI examples from Petzold's Windows
Programming book to D. In the book there's a chapter on
multithreading. It covers thread creation, messaging queues, critical
sections, TLS (heh..), and event signaling.
Since we pretty much have all of this in D already (+ its
m
On Mon, Jun 13, 2011 at 6:33 AM, Lloyd Dupont wrote:
> Let's learn together then! :P
> http://galador.net/codeblog/?tag=/D
>
> While my blog post are only about setting up the environment so far.. I have
> delved in the code for 2 weeks now! (Although I had some day off (work and
> programing) in
On 2011-06-13 17:38, Andrej Mitrovic wrote:
> So why's it in core.stdc.string, instead of say.. core.memory?
>
> Btw, I've had some imports already in the module and it seems these
> two conflict:
>
> import core.thread;
> import core.stdc.string;
>
> void main()
> {
> int* p, x;
> memcp
Andrej Mitrovic:
> Right, haven't thought about the C functions at all (silly me).
> Thanks, this did the trick:
> extern (C) void* memcpy(void*, const void*, size_t);
Maybe you are able to wrap that memcpy in a templated D function (named
copyMemory) that does what you want in a bit safer way,
Trass3r Wrote:
> > Shouldn't the linker/compiler be able to solve this on its own then?
>
> Use rdmd or xfBuild to automatically compile all needed modules.
Everyone we'll keep asking that question forever until the D compiler does this
by itself :-)
Bye,
bearophile
Thanks for all the answers! Seems like rdmd did the trick.
I don't see why this isn't built in to dmd though, or does it cause
overhead when you are using rdmd? Benefits, Drawbacks?
I've also stumbled upon an additional error with the win32 DirectX
bindings, but this seems D related actually. Whe
So why's it in core.stdc.string, instead of say.. core.memory?
Btw, I've had some imports already in the module and it seems these
two conflict:
import core.thread;
import core.stdc.string;
void main()
{
int* p, x;
memcpy(p, x, 1);
}
test.d(9): Error: core.stdc.string.memcpy at
D:\DMD\d
On 2011-06-13 17:01, Andrej Mitrovic wrote:
> Right, haven't thought about the C functions at all (silly me).
> Thanks, this did the trick:
> extern (C) void* memcpy(void*, const void*, size_t);
core.stdc.string has memcpy's declaration in it. You should be able to just
import it rather than decl
Right, haven't thought about the C functions at all (silly me).
Thanks, this did the trick:
extern (C) void* memcpy(void*, const void*, size_t);
On 2011-06-13 16:27, Andrej Mitrovic wrote:
> Apparently in the Windows API there's a whole lot of byte-copying going
> around.
>
> Here's an example:
>
> int CALLBACK EnhMetaFileProc (HDC hdc, HANDLETABLE * pHandleTable,
> CONST ENHMETARECORD * pEmfRecord,
> int iHandles, LPARAM pData)
> {
> ENH
Apparently in the Windows API there's a whole lot of byte-copying going around.
Here's an example:
int CALLBACK EnhMetaFileProc (HDC hdc, HANDLETABLE * pHandleTable,
CONST ENHMETARECORD * pEmfRecord,
int iHandles, LPARAM pData)
{
EN
On Sat, 04 Jun 2011 20:27:16 +0200, Andrej Mitrovic wrote:
> This is my #1 problem with ranges right now:
>
> import std.range;
>
> int[3] a = [1, 2, 3];
> shared range = cycle(a[]); // nope
>
> void main()
> {
> foo();
> }
>
> void foo()
> {
> // do something with range
> }
>
> test
Shouldn't the linker/compiler be able to solve this on its own then?
Use rdmd or xfBuild to automatically compile all needed modules.
sc.ini is going to get overwritten when you upgrade DMD so changing it
is a bad idea. An alternative is to copy sc.ini to your projects local
directory, this way DMD will use that one instead of its own. But this
is all working around the issue that you should be passing import
directories via a bu
On 2011-06-13 23:51, Jonathan M Davis wrote:
On 2011-06-13 14:44, Loopback wrote:
Thanks for your answer!
Seems like supplying with the file location solved the problem, though I
still wonder about one thing. The imported module is located in
"c:/d/dmd2/import/win32/windef.d" and I have used th
I'm trying to run the test suite for DMD, but I'm running into issues.
I've cloned dmd from github, and successfully built dmd, but when I run
'make' from the dmd/test dir, I get:
$ make
Creating output directory: test_results
Building d_do_test tool
object.d: Error: module object is i
On 2011-06-13 14:44, Loopback wrote:
> Thanks for your answer!
>
> Seems like supplying with the file location solved the problem, though I
> still wonder about one thing. The imported module is located in
> "c:/d/dmd2/import/win32/windef.d" and I have used this command line to
> the DMD compiler:
Thanks for your answer!
Seems like supplying with the file location solved the problem, though I
still wonder about one thing. The imported module is located in
"c:/d/dmd2/import/win32/windef.d" and I have used this command line to
the DMD compiler: -I"c:/d/dmd2/import/". Shouldn't the linker/
On 2011-06-13 14:18, Loopback wrote:
> Hi!
>
> Let me begin by saying, I'm sorry if this is caused of some obvious
> error but since I am new to D, I am not aware of all the tricks and
> treats it offers.
>
> I am working with the WindowsAPI binding at dsource.org (though I do not
> believe this
useo:
> toRender is my AA which contains the textures as key (instances of my
> class "Texture") and the tiles (position of them) as values. When I
> remove the first two lines (clear and set null) it doesn't drops down
> to 1 FPS, it runs normal.
>
> I hope anyone know a solution :)
Try to disa
Importing it means dmd knows about the function and emits a call but
doesn't automatically generate the function code.
This is only done if you also pass the file containing it to dmd.
Am 13.06.2011 23:18, schrieb Loopback:
Hi!
Let me begin by saying, I'm sorry if this is caused of some obvious
error but since I am new to D, I am not aware of all the tricks and
treats it offers.
I am working with the WindowsAPI binding at dsource.org (though I do not
believe this is related t
Hi!
Let me begin by saying, I'm sorry if this is caused of some obvious
error but since I am new to D, I am not aware of all the tricks and
treats it offers.
I am working with the WindowsAPI binding at dsource.org (though I do not
believe this is related to the binding itself). However, in m
"Nick Sabalausky" wrote in message
news:it5ui1$1l75$1...@digitalmars.com...
> "Loopback" wrote in message
> news:it4ud4$1kf5$1...@digitalmars.com...
>> Hello!
>>
>> I've been test programming win32 applications recently, and since the
>> phobos win32 library is so limited, I decided to downloa
"Loopback" wrote in message
news:it4ud4$1kf5$1...@digitalmars.com...
> Hello!
>
> I've been test programming win32 applications recently, and since the
> phobos win32 library is so limited, I decided to download and test the
> WindowsAPI Binding
> (http://www.dsource.org/projects/bindings/wiki
== Auszug aus Steven Schveighoffer (schvei...@yahoo.com)'s Artikel
> On Mon, 13 Jun 2011 15:44:01 -0400, nrgyzer
wrote:
> >> On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer
> > wrote:
> >> >> On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer
> >> > wrote:
> >> >> > Hi there,
> >> >> >
> >> >> > is there a
On Mon, 13 Jun 2011 15:44:01 -0400, nrgyzer wrote:
On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer
wrote:
>> On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer
> wrote:
>> > Hi there,
>> >
>> > is there any possibility to get a sliced array from another
array
>> > between two ranges like:
>> >
>> >
> On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer
wrote:
> >> On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer
> > wrote:
> >> > Hi there,
> >> >
> >> > is there any possibility to get a sliced array from another
array
> >> > between two ranges like:
> >> >
> >> > int[uint] myArray;
> >> > myArray[10] = 1
On Mon, 13 Jun 2011 14:52:24 -0400, nrgyzer wrote:
On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer
wrote:
> Hi there,
>
> is there any possibility to get a sliced array from another array
> between two ranges like:
>
> int[uint] myArray;
> myArray[10] = 1000;
> myArray[20] = 2000;
> myArray[30]
> On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer
wrote:
> > Hi there,
> >
> > is there any possibility to get a sliced array from another array
> > between two ranges like:
> >
> > int[uint] myArray;
> > myArray[10] = 1000;
> > myArray[20] = 2000;
> > myArray[30] = 3000;
> > myArray[40] = 4000;
> > m
On 2011-06-13 09:15, nrgyzer wrote:
> Hi there,
>
> is there any possibility to get a sliced array from another array
> between two ranges like:
>
> int[uint] myArray;
> myArray[10] = 1000;
> myArray[20] = 2000;
> myArray[30] = 3000;
> myArray[40] = 4000;
> myArray[50] = 5000;
>
> int[] newArray
On Mon, 13 Jun 2011 13:25:39 -0400, bearophile <
wrote:
Steven Schveighoffer:
But the dcollections.TreeMap API is more polished.
I think most people will want to use just Phobos, to avoid a dependency,
even if the Phobos one is less polished...
Sure, but it's difficult to demonstrate
Steven Schveighoffer:
> But the dcollections.TreeMap API is more polished.
I think most people will want to use just Phobos, to avoid a dependency, even
if the Phobos one is less polished...
Bye,
bearophile
On Mon, 13 Jun 2011 12:15:40 -0400, nrgyzer wrote:
Hi there,
is there any possibility to get a sliced array from another array
between two ranges like:
int[uint] myArray;
myArray[10] = 1000;
myArray[20] = 2000;
myArray[30] = 3000;
myArray[40] = 4000;
myArray[50] = 5000;
int[] newArray = myAr
Hi there,
is there any possibility to get a sliced array from another array
between two ranges like:
int[uint] myArray;
myArray[10] = 1000;
myArray[20] = 2000;
myArray[30] = 3000;
myArray[40] = 4000;
myArray[50] = 5000;
int[] newArray = myArray[>= 20 .. <= 40]; // not able to do this
writeln(new
> I'm trying to create 2 extra method for arrays ("range" would be
> better, though I don't quite understand what is a "range")
> Although I have some indecipherable (to me) compiler error...
>
> What's wrong with the code below?
> ==
> import std.algorithm;
>
> public:
>
> void rem
On 13.06.2011 16:49, Lloyd Dupont wrote:
ho.. plenty of silly mistake indeed.. thanks for spotting them!
(maybe I should take a break and play the witcher 2 hey!?!? :)
Why not ? ;-)
however I still have a problem with removeAt now! :(
===
void removeAt(T)(ref T[] array, int index)
{
if(ind
Thanks Jonathan, that cleared things up for me.
Josh
On Sat, Jun 11, 2011 at 12:00 PM, wrote:
> Send Digitalmars-d-learn mailing list submissions to
>digitalmars-d-learn@puremagic.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
>
> http://lists.puremagic.com/cgi-bin/ma
Works a treat!
Thanks for your detailed sample! :)
"Robert Clipsham" wrote in message news:it5395$2028$1...@digitalmars.com...
See: http://www.digitalmars.com/d/2.0/traits.html
class MyClass
{
void method1(){}
void method2(){}
}
import std.stdio;
void main()
{
foreach (me
On 13/06/2011 13:56, Lloyd Dupont wrote:
Thanks Robert!
Mm.. can you (per chance!) share some code?
I'm a newbie and compile time reflection is something which eludes me
(so far...)!
See: http://www.digitalmars.com/d/2.0/traits.html
class MyClass
{
void method1(){}
void method2(){
Thanks Robert!
Mm.. can you (per chance!) share some code?
I'm a newbie and compile time reflection is something which eludes me (so
far...)!
"Robert Clipsham" wrote in message news:it4vp1$1n5q$1...@digitalmars.com...
Anyway of ... making the runtime update xgetMembers?
My understanding
ho.. plenty of silly mistake indeed.. thanks for spotting them!
(maybe I should take a break and play the witcher 2 hey!?!? :)
however I still have a problem with removeAt now! :(
===
void removeAt(T)(ref T[] array, int index)
{
if(index < 0 || index >= array.length)
return;
array.re
On 13/06/2011 13:11, Lloyd Dupont wrote:
Interesting... I think I understand...
Thanks! :)
However an other problem arise with getMembers() it always returns null!
Looking at the code it seems (from my beginner's perspective) that
getMembers() rely on the member field (function) xgetMembers whic
removed some obvious error, still stumped on the templated syntax ...
so.. why is it not compiling?
(error:
Error: template std.algorithm.countUntil(alias pred = "a == b",R1,R2) if
(is(typeof(startsWith!(pred)(haystack,needle does not match any function
template declaration
)
=
import s
On 13.06.2011 16:03, Lloyd Dupont wrote:
I'm trying to create 2 extra method for arrays ("range" would be
better, though I don't quite understand what is a "range")
Although I have some indecipherable (to me) compiler error...
What's wrong with the code below?
==
import std.algo
Interesting... I think I understand...
Thanks! :)
However an other problem arise with getMembers() it always returns null!
Looking at the code it seems (from my beginner's perspective) that
getMembers() rely on the member field (function) xgetMembers which is always
null, as far as I can tell (
I'm trying to create 2 extra method for arrays ("range" would be better,
though I don't quite understand what is a "range")
Although I have some indecipherable (to me) compiler error...
What's wrong with the code below?
==
import std.algorithm;
public:
void remove(T)(ref T[] ar
Lloyd Dupont wrote:
>trying to learn introspection, I have this simple test method:
>
>===
>static void dumpelement(Object o)
>{
>if (!o)
>return;
>
>auto ci = o.classinfo;
>foreach(mi ; ci.getMembers(null))
>{
>writefln("%s . %s", ci.name, mi.name())
Hello!
I've been test programming win32 applications recently, and since the
phobos win32 library is so limited, I decided to download and test the
WindowsAPI Binding
(http://www.dsource.org/projects/bindings/wiki/WindowsApi). Using the
latest snapshot (as of this writing) I receive the follo
trying to learn introspection, I have this simple test method:
===
static void dumpelement(Object o)
{
if (!o)
return;
auto ci = o.classinfo;
foreach(mi ; ci.getMembers(null))
{
writefln("%s . %s", ci.name, mi.name());
}
}
==
However
Let's learn together then! :P
http://galador.net/codeblog/?tag=/D
While my blog post are only about setting up the environment so far.. I have
delved in the code for 2 weeks now! (Although I had some day off (work and
programing) in Darwin) I'm right into it now, should have a new blog post
so
I see mm
Thanks for the info!
"Jonathan M Davis" wrote in message
news:mailman.866.1307943671.14074.digitalmars-d-le...@puremagic.com...
Object is not currently const-correct:
http://d.puremagic.com/issues/show_bug.cgi?id=1824
As a result, a number of basic functions do not currently
Trying to play with introspection.
trying o, for a given object, to check its property by name.
Experimenting with the function below.
1. it doesn't compile! mi.name() seems to be a problem?
2. match is always null! even though I pass the name of an existing property
and / or field!
==
54 matches
Mail list logo