Re: IMAP library

2015-04-13 Thread Jens Bauer via Digitalmars-d-learn

On Monday, 13 April 2015 at 14:31:56 UTC, Johannes Pfau wrote:

Am Sun, 12 Apr 2015 17:27:31 +
schrieb Jens Bauer doc...@who.no:

I won't say it's impossible, but it would be cumbersome 
processing email on an AVR.


There are HTTP servers for AVR(8bit) devices, so it should be 
possible.


That's absolutely true, but usually they're very simple.
You can interface the AVR to an external SRAM or NOR-flash and 
thus store the entire email (or Web-page) there.
But imagine that someone sends an email with an attachment - or 
just writes 50K of babbling. -That might be difficult if you have 
an AVR with only 8K RAM.
It's much easier - and perhaps cheaper - to pick a Cortex-M, 
which has most of the things you need already; you can get 
ethernet PHYs for less than $2, which interfaces with a Cortex-M.


Re: IMAP library

2015-04-13 Thread Laeeth Isharc via Digitalmars-d-learn

On Monday, 13 April 2015 at 18:03:12 UTC, Jens Bauer wrote:

On Monday, 13 April 2015 at 14:31:56 UTC, Johannes Pfau wrote:

Am Sun, 12 Apr 2015 17:27:31 +
schrieb Jens Bauer doc...@who.no:

I won't say it's impossible, but it would be cumbersome 
processing email on an AVR.


There are HTTP servers for AVR(8bit) devices, so it should be 
possible.


That's absolutely true, but usually they're very simple.
You can interface the AVR to an external SRAM or NOR-flash and 
thus store the entire email (or Web-page) there.
But imagine that someone sends an email with an attachment - or 
just writes 50K of babbling. -That might be difficult if you 
have an AVR with only 8K RAM.
It's much easier - and perhaps cheaper - to pick a Cortex-M, 
which has most of the things you need already; you can get 
ethernet PHYs for less than $2, which interfaces with a 
Cortex-M.


I am reminded of the constraints from these days:
http://www.abook.ru/dmk/FidoNet/unpublished/fhist.html

My first 'open source' contribution was to a data structure in 
his BBS system a few years later.


Re: IMAP library

2015-04-13 Thread Laeeth Isharc via Digitalmars-d-learn

On Tuesday, 14 April 2015 at 02:31:23 UTC, Adam D. Ruppe wrote:
You might like my email.d too 
https://github.com/adamdruppe/arsd/blob/master/email.d


It is able to help construct emails and also read an mbox 
format - part of that code might help your imap library too.


Thanks, Adam.  Was just thinking earlier today that I should 
reread that code.


Laeeth



Re: DMD 64 bit on Windows

2015-04-13 Thread Dennis Ritchie via Digitalmars-d-learn

Main article here:
http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_%28COFF-compatible%29


DMD 64 bit on Windows

2015-04-13 Thread Etienne via Digitalmars-d-learn
I'm currently experiencing Out Of Memory errors when compiling in DMD on 
Windows


Has anyone found a way to compile a DMD x86_64 compiler on Windows?


Re: DMD 64 bit on Windows

2015-04-13 Thread Dennis Ritchie via Digitalmars-d-learn

On Tuesday, 14 April 2015 at 01:31:27 UTC, Etienne wrote:
I'm currently experiencing Out Of Memory errors when compiling 
in DMD on Windows


Has anyone found a way to compile a DMD x86_64 compiler on 
Windows?


For example, here:
https://translate.google.ru/translate?hl=rusl=rutl=enu=http%3A%2F%2Fblogsoftware.ru%2Fpost%2F116109292742%2F64-x-dmd


Re: DMD 64 bit on Windows

2015-04-13 Thread Etienne via Digitalmars-d-learn

On 4/13/2015 9:42 PM, Dennis Ritchie wrote:

Main article here:
http://wiki.dlang.org/Installing_DMD_on_64-bit_Windows_7_%28COFF-compatible%29



I think this might be about the -m64 option in the d compiler.

I'm actually having the Out Of Memory error with the -m64 option, 
because DMD crashes at 4gb of ram


What I need is DMD compiled with 64 bit pointer size


Re: IMAP library

2015-04-13 Thread Adam D. Ruppe via Digitalmars-d-learn
You might like my email.d too 
https://github.com/adamdruppe/arsd/blob/master/email.d


It is able to help construct emails and also read an mbox format 
- part of that code might help your imap library too.


Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-13 Thread biozic via Digitalmars-d-learn

On Sunday, 12 April 2015 at 21:34:21 UTC, H. S. Teoh wrote:
On Sun, Apr 12, 2015 at 02:33:03PM +, ketmar via 
Digitalmars-d-learn wrote:

On Sun, 12 Apr 2015 14:18:21 +, JR wrote:

 But the compiler has all the pieces of information needed to 
 see

 it's wrong, doesn't it?

no, it doesn't. compiler doesn't know about 
`std.format.format` and
it's special abilities. while it is possible to add such 
checks to the
compiler, it will introduce interdependency between compiler 
and

phobos, which is not desirable.

writing CTFE `writef` version is possible without template 
bloat in

binary, but it will take more memory in compile time and slows
compilation. there were talks about having 
`writef!fmt(args)` in

phobos, but nobody took that task yet.


It's not hard to write a CTFE version of writef/writeln/etc., 
that takes
the format argument at compile-time, since std.format itself is 
already

CTFE-able.


Except for floating-point values (at least).


Re: Auto ref function : How is this possible ?

2015-04-13 Thread matovitch via Digitalmars-d-learn

Thanks for the tip ! I was looking at something like this.


Re: IMAP library

2015-04-13 Thread Johannes Pfau via Digitalmars-d-learn
Am Sun, 12 Apr 2015 17:27:31 +
schrieb Jens Bauer doc...@who.no:

 On Saturday, 11 April 2015 at 22:45:39 UTC, Laeeth Isharc wrote:
 
  Yes - nice to know it can do that also.  For me I need to have 
  a way of managing large amounts of email (I have about 2mm 
  messages) including for natural language processing etc.  
  Dovecot/sieve + pipe facility is ok, but not perfect for 
  everything.  I guess it should work fine for regular ARM etc - 
  perhaps not an Arduino!
 
 I won't say it's impossible, but it would be cumbersome 
 processing email on an AVR.

There are HTTP servers for AVR(8bit) devices, so it should be possible.
Doesn't mean it's a good idea though ;-)


Re: Auto ref function : How is this possible ?

2015-04-13 Thread Steven Schveighoffer via Digitalmars-d-learn

On 4/11/15 6:08 AM, matovitch wrote:

Hi,

I just learn about auto ref functions and tried this :

import std.stdio;

auto ref foo(int i, ref float f)
{
  if (i  f)
  {
  return i;
  }
  else
  {
  return f;
  }
}

void main()
{
  int i = 1;
  float f1 = 1.1;
  float f2 = 0.9;
  writeln(foo(i, f1));
  writeln(foo(i, f2));
}

Tricky questions : Does it compiles ? If yes what does it do ?
Then my question : How is this possible ?


D has great compile-time tools to examine what the compiler is doing.

A great feature of D for investigating compiler internals is pragma(msg, 
...). This prints at compile time some message (a string) that is based 
on the state at the time. For example:


void main()
{
 int i = 1;
 float f1 = 1.1;
 float f2 = 0.9;
 pragma(msg, typeof(foo(i, f1)).stringof); // prints what type 
foo returns

 auto x = foo(i, f2);
 pragma(msg, typeof(x).stringof); // same thing, but easier to 
understand.

}

result (prints while compiling):

float
float

-Steve


Re: writefln patterns with mismatching compile-time known number of arguments

2015-04-13 Thread ketmar via Digitalmars-d-learn
On Sun, 12 Apr 2015 14:31:40 -0700, H. S. Teoh via Digitalmars-d-learn
wrote:

 It's not hard to write a CTFE version of writef/writeln/etc., that takes
 the format argument at compile-time, since std.format itself is already
 CTFE-able.

i didn't know that (didn't checked, actually), so i rewrote simple string 
and number formatters in my iv.writer. anyway, `std.format` will allocate 
on %40s, i believe, which is completely unnecessary for `write`, as one 
can write by arbitrary sized chunks.

signature.asc
Description: PGP signature