Re: No map file?

2009-03-25 Thread Frank Benoit
Derek Parnell schrieb:
 On Mon, 23 Mar 2009 10:02:28 +0100, Frank Benoit wrote:
 
 How can i make DMD (link/optlink) not to generate a map file?

 -L/NOM or -LNOMAP

 both seem not work.
 
 You can't using dmd. It doesn't generate the right linker options for you
 to avoid the map file. I do it in Bud by not having DMD invoke the linker,
 instead I have Bud invoke the linker with the right options.
 
 The easiest way is to delete the .map files after compiling.
 

Ok, so i created http://d.puremagic.com/issues/show_bug.cgi?id=2760
Thanks for the answer.


idup portable D1/D2

2009-03-25 Thread Frank Benoit
I want to make code compilable with D1+D2.

So i thought, i can make

version(D_Version2){
} else { // D1
  string idup( char[] str ){ return str.dup; }
}

But this does not work.
D1:
str.idup;   // compile error
str.idup(); // OK

D2:
str.idup;   // OK
str.idup(); // compile error

Ideas?


Re: idup portable D1/D2

2009-03-25 Thread Frank Benoit
hm, the moment of pressing the send button is often enough a moment of
enlightment :)

version( D_Version2 ){
mixin(invariant(T)[] _idup(T)( T[] str ){ return str.idup; });
} else { // D1
String _idup( char[] str ){
return str.dup;
}
}

str._idup(); // compiles with D1+D2


digitalmars lib.exe, what does the pagesize mean?

2009-03-25 Thread Frank Benoit
What does the pagesize mean? When is it needed to increase? What is the
cost?


LPT

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


Re: LPT

2009-03-25 Thread Jarrett Billingsley
On Wed, Mar 25, 2009 at 4:21 PM, Zarathustra adam.chrapkow...@gmail.com wrote:
 Have you got any idea how to manipulate LPT port in Windows XP with D?


Um, the same way you'd do it with any other language...?


Re: LPT

2009-03-25 Thread Jarrett Billingsley
On Wed, Mar 25, 2009 at 5:00 PM, Jarrett Billingsley
jarrett.billings...@gmail.com wrote:
 On Wed, Mar 25, 2009 at 4:21 PM, Zarathustra adam.chrapkow...@gmail.com 
 wrote:
 Have you got any idea how to manipulate LPT port in Windows XP with D?


 Um, the same way you'd do it with any other language...?

I mean, if you computer even _HAS_ an LPT port.  I haven't seen one in years.


Re: LPT

2009-03-25 Thread Mike James
Zarathustra Wrote:

 Have you got any idea how to manipulate LPT port in Windows XP with D?

Hi,

Try the dlportio driver. I've used it in the past with XP - PIC programmers, 
etc. :-)

Regards, mike.


Re: LPT

2009-03-25 Thread grauzone

Jarrett Billingsley wrote:

On Wed, Mar 25, 2009 at 5:00 PM, Jarrett Billingsley
jarrett.billings...@gmail.com wrote:

On Wed, Mar 25, 2009 at 4:21 PM, Zarathustra adam.chrapkow...@gmail.com wrote:

Have you got any idea how to manipulate LPT port in Windows XP with D?


Um, the same way you'd do it with any other language...?


I mean, if you computer even _HAS_ an LPT port.  I haven't seen one in years.


My computer is only a year old and has one LPT and two serial ports. The 
only traditional thing that's missing is a floppy drive.


dwt2 help

2009-03-25 Thread Saaa
I filled in the Phobos implementation, but I'm not sure if it is all correct 
as I don't fully understand the exception handling.

module java.lang.Byte;

import java.lang.util;
import java.lang.exceptions;

version(Tango){
static import tango.text.convert.Integer;
} else { // Phobos
static import std.conv;
}
class Byte : ValueWrapperT!(byte) {
public static byte parseByte( String s ){
version(Tango){
try{
int res = tango.text.convert.Integer.parse( s );
if( res  byte.min || res  byte.max ){
throw new NumberFormatException( out of range );
}
return res;
}
catch( IllegalArgumentException e ){
//How does this work? It catches e and gives it as an argument to a new 
exception.
throw new NumberFormatException( e );
}
} else if version(Phobos){ // Phobos
try{
byte res = to!(byte)(s);
return res;
}
catch(Object e){ // ConvError or ConvOverflowError
//Is this the correct translation?
throw new NumberFormatException( e );
}
return 0;
}
}
this( byte value ){
super( value );
}

public static String toString( byte i ){
return String_valueOf(i);
}

}
alias Byte ValueWrapperByte; 




Re: dwt2 help

2009-03-25 Thread Sergey Gromov
Thu, 26 Mar 2009 00:29:44 +0100, Saaa wrote:

 I filled in the Phobos implementation, but I'm not sure if it is all correct 
 as I don't fully understand the exception handling.
 
 [...]

 catch( IllegalArgumentException e ){
 //How does this work? It catches e and gives it as an argument to a new 
 exception.
 throw new NumberFormatException( e );
 }

Obviously NumberFormatException can store another exception object
inside.  This code effectively converts IllegalArgumentException into
NumberFormatException, storing the original argument exception inside so
that one can examine it later if they're curious.

 [...]

 catch(Object e){ // ConvError or ConvOverflowError
 //Is this the correct translation?
 throw new NumberFormatException( e );
 }

It depends on what NumberFormatException can  accept as an argument.  If
it accepts an Object then it's fine.


Re: dwt2 help

2009-03-25 Thread Saaa
 Obviously NumberFormatException can store another exception object
 inside.  This code effectively converts IllegalArgumentException into
 NumberFormatException, storing the original argument exception inside so
 that one can examine it later if they're curious.
Thanks, yes this is obvious...


 [...]

 catch(Object e){ // ConvError or ConvOverflowError
 //Is this the correct translation?
 throw new NumberFormatException( e );
 }

 It depends on what NumberFormatException can  accept as an argument.  If
 it accepts an Object then it's fine.

class NumberFormatException : IllegalArgumentException {
this( String e ){
super(e);
}
this( Exception e ){
super(e.toString);
}
}

Can Object be implicitly converted to Exception?





Re: dwt2 help

2009-03-25 Thread Sergey Gromov
Thu, 26 Mar 2009 01:40:25 +0100, Saaa wrote:

 [...]

 catch(Object e){ // ConvError or ConvOverflowError
 //Is this the correct translation?
 throw new NumberFormatException( e );
 }

 It depends on what NumberFormatException can  accept as an argument.  If
 it accepts an Object then it's fine.
 
 class NumberFormatException : IllegalArgumentException {
 this( String e ){
 super(e);
 }
 this( Exception e ){
 super(e.toString);
 }
 }
 
 Can Object be implicitly converted to Exception?

No it cannot.  Object is the root of the D class hierarchy.  In D1
Exception is derived directly from Object.  In D2 Exception is derived
from Throwable which in turn is derived from Object.  You can cast
Exception to Object but not the other way around.

What's worse, ConvError and ConvOverflowError in D2 are derived from
Error which is a separate class from Exception and cannot be cast
implicitly.  I think you'd want to fix the NumberFormatException to
accept Throwable for instance which is a base of both Exception and
Error in D2.