For some reason I cannot remove an element from a DList. I tried
several range approaches but to no avail. I'm a noob.
In the end I did this:
```
private void removeFromWaitingQueue(uint jid) {
auto arr = waitingQueue[].array;
arr = arr.remove!(job => job.jid == jid);
On Wednesday, 2 March 2016 at 05:04:37 UTC, David G. Maziero
wrote:
void RenderText( FontBMP font, int x, int y, const char* text,
Just one more correction for future reference, RenderText should
be
extern(C) void RenderText...
in order for it to work correctly with va_start/etc.
On Wednesday, 2 March 2016 at 05:04:37 UTC, David G. Maziero
wrote:
char[256] buff;
va_list ap;
va_start( ap, text );
sprintf( buff.ptr, text, ap );
va_end( ap );
Sorry again, where it reads "sprintf" should be "vsprintf".
I figured out what I wanted. Thanks for your answer Mike, sorry
to bother you though.
Here's the result:
void RenderText( FontBMP font, int x, int y, const char* text,
... )
{
SDL_Rect rect1, rect2;
rect2.x = x;
rect2.y = y;
rect2.w = font.width;
I forgot to add that the "RenderText(font,0,0,"FPS:
"~to!string(fps));" was an older version where it wasn't const
char *, but string. And I was using a foreach, so no
null-termination. But that's beyond the point of not using GC.
Yes, I'm aware of the null-termination thing. I might have pasted
code that I already changed.
But I already messed with sformat, and it seems that it does use
the GC. I've put @nogc in RenderText, and the compiler says
sformat uses GC, so I don't know.
But the thing is, I don't want to
Hi. I think it's the first time I post here.
I've been flirting with D for some time, but now I decided to
start a little project.
Consider the following function:
void RenderText( FontBMP font, int x, int y, const char* text )
{
SDL_Rect rect1, rect2;
rect2.x = x;
On Monday, 11 January 2016 at 20:19:50 UTC, Jason Jeffory wrote:
Sheesh, why is it so hard to do simple stuff?
1) Have you tryed passing --arch=x86_64 to dub?
2) > "versions-x86_64": ["XYZ"]
This is like a architecture dependent condition for version
definition.
So if your project will
On Monday, 11 January 2016 at 08:03:19 UTC, Saurabh Das wrote:
How can I get std.conv to understand std.typecons.Typedef?
You can do something like this:
QuestionId q = to!(TypedefType!QuestionId)("43");
In general, is there a better solution to orthogonal types than
Typedef?
Typedef is
On Monday, 11 January 2016 at 12:15:55 UTC, Saurabh Das wrote:
Any ideas?
Yes. Because Typedef is introducing new Types, which csvReader
doesn't know what they are,
you'll need a little workaround and cast the values yourself.
import std.csv, std.stdio, std.algorithm, std.range;
enum
On Sunday, 10 January 2016 at 10:10:46 UTC, zabruk70 wrote:
Hello.
1st Novice question:
i want function, operates sometimes with char[], sometimes with
ubyte[].
internally it works with ubyte.
i can use overloading:
void myFunc(ubyte[] arg) {...};
void myFunc(char[] arg) { ubyte[] arg2 =
The bug has been fixed...
On Sunday, 10 January 2016 at 09:41:16 UTC, Keywan Ghadami wrote:
On Friday, 8 January 2016 at 13:53:06 UTC, Guillaume Chatelet
wrote:
I still do not understand half of the syntax(still learning)
but my guess is that it is a bug in the csv reader:
In
On Sunday, 10 January 2016 at 19:07:52 UTC, Jesse Phillips wrote:
On Sunday, 10 January 2016 at 18:09:23 UTC, Tobi G. wrote:
The bug has been fixed...
Do you have a link for the fix? Is there a BugZilla entry?
Yes sure..
https://issues.dlang.org/show_bug.cgi?id=15545
and the fix at github
On Friday, 8 January 2016 at 15:45:52 UTC, zabruk70 wrote:
Should i create bugreport, or this is my mistake?
I get also a compilation error (with rdmd and -g).
Fortunately building manually with dmd works.
So there has to be a bug in rdmd..
togrue
On Friday, 8 January 2016 at 09:59:26 UTC, Guillaume Chatelet
wrote:
Any idea ?
No, sorry. Under Windows DMD v2.069.2 it works perfectly in both
cases.
Which compiler do you use?
You could run DMD with the -g option. This will print often more
useful output, if it fails.
togrue
On Friday, 8 January 2016 at 12:13:59 UTC, Guillaume Chatelet
wrote:
On Friday, 8 January 2016 at 12:07:05 UTC, Tobi G. wrote:
No, sorry. Under Windows DMD v2.069.2 it works perfectly in
both cases.
Which compiler do you use?
- DMD64 D Compiler v2.069.2 on Linux.
- LDC 0.16.1 (DMD v2.067.1
On Sunday, 3 January 2016 at 14:49:59 UTC, tsbockman wrote:
On Sunday, 3 January 2016 at 10:55:05 UTC, AntonSotov wrote:
import std.container.rbtree;
class myClass {
string str;
}
int main()
{
auto tree = new RedBlackTree!myClass;
return 0;
}
Error: mutable method
On Sunday, 3 January 2016 at 16:44:35 UTC, tsbockman wrote:
If it's a private internal data structure which is only used a
few places, then sure - just use the minimum code required to
get the job done.
But, if it's a part of the public API for a module and the
class logically has a natural
On Saturday, 2 January 2016 at 10:04:47 UTC, Shriramana Sharma
wrote:
I thought the promise of `immutable` was: never changes.
The compiler doesn't protect you by carrying a bomb. :)
But there is another usecase where it makes sense to allow
writing to other union members despite the
On Friday, 1 January 2016 at 14:00:41 UTC, TheDGuy wrote:
writeln("Which number should i guess?");
string input = readln();
int i = to!int(input);
The solution is that readln() returns a string that also contains
the newline
this can be solved by easily stripping the
On Friday, 1 January 2016 at 14:20:26 UTC, Tobi G. wrote:
The solution is that readln() returns a string that also
contains the newline
this can be solved by easily stripping the newline off
import std.string;
int i = to!int(input.strip);
Sorry my bad english.. i wrote solution but meant
I'd like to implement a Skyline Rectangle packing algorithm.
A DList should store the actual Skyline. (So the order is
important, it will mostly have to access the right or left node
element)
And a Binary Heap which should hold a pointer to every DList
element.
(Mostly for fast accessing the
On Friday, 1 January 2016 at 14:20:05 UTC, Suliman wrote:
https://github.com/Hackerpilot/dfmt
After run build.bat nothing do not happens. How can I build it?
The easiest way to do it is to download and install dub - the
package manager from https://code.dlang.org/ and then run
dub fetch
maade something obvious or silly.
Thanks g.
reuses the same address?
I got hit by this trying to do a tree structure builder, for hours searching
aand finally found this (feature | bug). If so, how I could get a new struct to
void changing (in a unnoticeable way) the same struct i just set.
thanks.
g g
Thanks for the answers
what I did is this ( i feel that it is quite clumsy):
Node* x = cast(Node*) (GC.malloc(Node.sizeof));
*x = xa;
x.up = curnode;
...
of a document.
--
Yao G.
).
They don't have licence because I didn't find an equivalent to the Boost
Licence but for documentation, but they can be used freely for whatever
need you have.
I still have to make some improvements, for example create a tree of
symbols, like the one in Kandil or CandyDoc.
--
Yao G.
of
Dil.
--
Yao G.
to
file.
Thanks in advance. :-)
std.datetime is your friend.
http://www.digitalmars.com/d/2.0/phobos/std_date.html
--
Yao G.
to convert it to a D function
pointer. Certainly, the inner pointer is easy:
void (* function(sqlite3_vfs*,void*, const(char) *zSymbol) xDlSym)();
But what about the outer one? I am missing something?
Thanks in advance.
--
Yao G.
, typeof(xDlSym).stringof);
outputs:
void function() function(sqlite3_vfs*, void*, const const(char*) zSymbol)
so I think it's a function pointer that takes those parameters and
returns a function pointer that takes no parameters and returns nothing.
-Steve
Thanks Steve!
--
Yao G.
is byte[] (chunk in std.stdio).
Is there a place where this stuff is documented? Or choosing one or
another is just a matter of preference and the differences are trivial?
Thanks in advance.
--
Yao G.
) { }
- Jonathan M Davis
Ha ha ha! What a shame, I was reading that page looking for a solution,
but it seems that I just skipped that part. Thanks and sorry for the
stupid question.
--
Yao G.
this;
}
private int _bar;
}
void main()
{
au
--
Yao G.
' is not of arithmetic type, it is a Foo
Error: 'f2' is not of arithmetic type, it is a Foo
Is there a way to make this work? Even changing the operator string in
opBinary to - doesn't do nothing. Or those kind of operators can't be
overloaded?
--
Yao G.
);
But if I ever tried a call like CheckedInt(10) in a unittest block, it
wouldn't work. So how does this magic work?
http://www.digitalmars.com/d/2.0/mixin.html
--
Yao G.
with more experience on
templates can give
you a better (or correct, I'm just guessing this :) ) answer.
--
Yao G.
Relevant links:
http://dsource.org/projects/bindings/wiki/WindowsApi
http://dsource.org/projects/bindings/browser/trunk/win32
--
Yao G.
For my projects, I rolled my own headers. They are based (like the ones
on
dsource) on the MinGW32 project. But mine target Windows 2000 as minimal
O.S. and use exclusively UTF-32 (the ASCI versions are not defined).
Also,
Replace UTF-32 with UTF-16 :D
--
Using Opera's revolutionary
/std_math.html#ceil
--
Yao G.
modified lib files with more functions defined. The ones
that come bundled with DMD are severely outdated.
If you have some linking problems, try to use the aliases that I suggested
on the code comments.
--
Yao G.
;
And make the change to the TCHAR alias too.
Remember that a lot of Windows functions, specially the ones that deal
with strings and characters, have two versions: functionNameA for
ASCI/UTF-8 and functionNameW for UTF-16.
--
Yao G.
. Specially the newer
ones. I grabbed the lib files I use from a link that somebody posted here
in the NG a few years ago. Sadly I can't find that link anymore.
--
Yao G.
:
---
import core.runtime;
import std.c.windows.windows,
std.process;
extern(Windows)
int WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
{
return system( rbin\someprogram.exe );
}
---
--
Yao G.
I have successfully made funtions and structs in shared libraries in linux with
dmd, but i have no idea how to do that with classes, and how call the static
this() funtion of the linked module, because variables ( even immutable ) are
not correctly set without calling it.
Thanks.
gzkp0s
(1), Month(1) );
---
So, what options do I have? I know that typedef is scheduled to
deprecation, so I would like to know if there's something else.
--
Yao G.
need, for example, that if you pass a
Year instance to the Month parameter, generate a compiler error.
--
Yao G.
the types that I'm
defining are value types. But thanks for the answer
--
Yao G.
this;
}
}
else static if ( type == Type.Sub )
{
@disable void opAssign( T value );
}
}
I think I'll do something similar as this. I don't need either explicit or
implicit cast between types.
--
Yao G.
DatePartImpl!(DatePart.Day) Day;
void foo( Year y, Month m, Day d ) {}
// Works correctly
foo( Year(2010), Month(8), Day(14) );
// But this isn't allowed
foo( Day(14), Year(2010), Month(8) );
---
--
Yao G.
. The docbook.ddoc
is on the same directory where I have the *.d files (code).
Thanks in advance.
--
Yao G.
I forgot to mention that I'm using the latest (beta) version of DMD 2 on
Windows XP.
On Tue, 10 Aug 2010 20:52:18 -0500, Yao G. nospam...@gmail.com wrote:
According to the DDOC spec (http://digitalmars.com/d/2.0/ddoc.html) if
you want to redefine some macros, one way is to pass one file
Thanks bearophile. I'll give it a try later.
--
Yao.G
On Thu, 03 Jun 2010 12:27:20 -0500, bearophile bearophileh...@lycos.com
wrote:
Yao G.:
I think the idea of a memory pool or freelist is good. Can you point me
where can I see your libs?
Instead of just giving you a link to the dlibs1
the copies and to make effective all the item modification
across all copies. But then I would be where I started: doing tons of heap
allocations.
So, how should I deal with this issue?
Thanks.
Yao G.
Hello.
I'm trying to learn more of D templates, but I'm stuck with an issue I
cannot resolve. Well, actually, I don't know if this is even allowed, and
that's why I'm posting here. Suppose I have a function declared like this:
---
import std.traits;
void foo(T...)(T args) if(
On Wed, 07 Apr 2010 03:05:34 -0400, Simen kjaeraas
simen.kja...@gmail.com wrote:
Yao G. nospamyaolt...@gmail.com wrote:
Hello.
Greetings.
foo( Hello World, first, second );
---
You can notice that the first argument is a string literal. What I want
to know is: If a function argument
strtr Wrote:
strtr Wrote:
This error also points to the enum which is probably incorrectly used
somewhere
s_def(32) Error: cannot implicitly convert expression (5) of type int to S
Still searching for the original bug btw :(
Found it, also a return type mismatch problem;
g Wrote:
strtr Wrote:
strtr Wrote:
This error also points to the enum which is probably incorrectly used
somewhere
s_def(32) Error: cannot implicitly convert expression (5) of type int to S
Still searching for the original bug btw :(
Found it, also a return type
, or
simpley beacuse nones know what to say.
In your case, i would say that be more explicit and don't be like resolve my
homework now.
just general recomendations, and be patient.
best regards.
g
div0 Wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
g wrote:
g Wrote:
I have been trying to actualize the
http://www.dsource.org/projects/dallegro binings to the lastest
typo: it is bindings, not binings
Downgrade your compiler version.
Every version after 2.028 has
= allegro.internal.dintern.cpu_vendor.ptr;
//_system_driver_list = allegro.misc._system_driver_list.ptr;
}
A strange way of wraping.
So...
Are there other bindings to allegro?
Does anyone has actualized this bindings?
Is Someone interested in helping?
Should i abdicate?
g
g Wrote:
I have been trying to actualize the http://www.dsource.org/projects/dallegro
binings to the lastest
typo: it is bindings, not binings
is there any library for D that implements fixed point arithmetic.
g
Don Wrote:
You can do stuff like:
struct Foo {
int x;
}
enum Foo b = Foo(56);
strange. you can do that only if there is no constructor.
Also trying with templates, i got a segfault, i dont know if it is already
reported.
Why this segfaults?. At least it should print a error
At what point structs are supported in CTFE.
Cause this fails in dmd 2.036:
import std.metastrings;
pragma(msg,toStringNow!(A.init.a));
struct A{
uint a;
}
with this message (note that the end seems truncated):
g...@g-desktop:~/Documentos/NCHESS$ dmd oh
oh.d(3): Error: no property
67 matches
Mail list logo