www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ide - microEmacs in D

reply Walter Bright <newshound1 digitalmars.com> writes:
I finally got around to translating microEmacs from C into D. It's still 
in "C style", though :-)

ftp://ftp.digitalmars.com/med.zip

microEmacs is a simple text editor, easily customizable, portable, and 
is a great project to learn programming from. It's in the public domain.

For those wanting to have some fun with it, some projects could be:

1) add regular expression searching
2) use std.algorithms to implement a "sort" function on a range
3) for the really ambitious, add in dmdscript as a way for users to 
script microEmacs
Feb 19 2008
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Walter Bright wrote:
 I finally got around to translating microEmacs from C into D. It's still 
 in "C style", though :-)
 
 ftp://ftp.digitalmars.com/med.zip
 
 microEmacs is a simple text editor, easily customizable, portable, and 
 is a great project to learn programming from. It's in the public domain.
 
 For those wanting to have some fun with it, some projects could be:
 
 1) add regular expression searching
 2) use std.algorithms to implement a "sort" function on a range
 3) for the really ambitious, add in dmdscript as a way for users to 
 script microEmacs
Should probably mention that it's D2. Also it seems to be missing disp.d. There's a display.d, but several files are importing "disp". Not sure if they're supposed to be the same thing or not. --bb
Feb 19 2008
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
 Should probably mention that it's D2.
Yes.
 Also it seems to be missing disp.d.  There's a display.d, but several 
 files are importing "disp".  Not sure if they're supposed to be the same 
 thing or not.
Fixed that.
Feb 19 2008
next sibling parent reply Derek Parnell <derek nomail.afraid.org> writes:
On Tue, 19 Feb 2008 16:24:28 -0800, Walter Bright wrote:

 Bill Baxter wrote:
 Should probably mention that it's D2.
Yes.
 Also it seems to be missing disp.d.  There's a display.d, but several 
 files are importing "disp".  Not sure if they're supposed to be the same 
 thing or not.
Fixed that.
In what way was this fixed? Is the import supposed to be 'disp' or 'display'? There are a number of references to functions like "disp_..." that are not being found. eg. console.d line:65 has "disp_open();". -- Derek (skype: derek.j.parnell) Melbourne, Australia 20/02/2008 12:11:11 PM
Feb 19 2008
parent Walter Bright <newshound1 digitalmars.com> writes:
Derek Parnell wrote:
 Fixed that.
In what way was this fixed? Is the import supposed to be 'disp' or 'display'? There are a number of references to functions like "disp_..." that are not being found. eg. console.d line:65 has "disp_open();".
I had forgotten to add disp.d to the zip file, which I then did and uploaded.
Feb 19 2008
prev sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Walter Bright wrote:
 Bill Baxter wrote:
 Should probably mention that it's D2.
Yes.
 Also it seems to be missing disp.d.  There's a display.d, but several 
 files are importing "disp".  Not sure if they're supposed to be the 
 same thing or not.
Fixed that.
And did you update the zip on ftp too? Seems unchanged. --bb
Feb 19 2008
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
 And did you update the zip on ftp too?  Seems unchanged.
Ah, I see the problem, I copied the wrong file. Please try again.
Feb 19 2008
parent reply Derek Parnell <derek psych.ward> writes:
On Tue, 19 Feb 2008 19:33:56 -0800, Walter Bright wrote:

 Bill Baxter wrote:
 And did you update the zip on ftp too?  Seems unchanged.
Ah, I see the problem, I copied the wrong file. Please try again.
Still doesn't compile (dmd 2.010). console.d:32 "static INPUT_RECORD lookaheadir;" - what is an INPUT_RECORD? -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
Feb 19 2008
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Derek Parnell wrote:
 On Tue, 19 Feb 2008 19:33:56 -0800, Walter Bright wrote:
 
 Bill Baxter wrote:
 And did you update the zip on ftp too?  Seems unchanged.
Ah, I see the problem, I copied the wrong file. Please try again.
Still doesn't compile (dmd 2.010). console.d:32 "static INPUT_RECORD lookaheadir;" - what is an INPUT_RECORD?
Looks like maybe some bit of Windows API Walter hasn't checked into std.c.windows.windows yet: http://msdn2.microsoft.com/en-us/library/ms683499(VS.85).aspx?s=21 --bb
Feb 19 2008
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Bill Baxter wrote:
 Derek Parnell wrote:
 On Tue, 19 Feb 2008 19:33:56 -0800, Walter Bright wrote:

 Bill Baxter wrote:
 And did you update the zip on ftp too?  Seems unchanged.
Ah, I see the problem, I copied the wrong file. Please try again.
Still doesn't compile (dmd 2.010). console.d:32 "static INPUT_RECORD lookaheadir;" - what is an INPUT_RECORD?
Looks like maybe some bit of Windows API Walter hasn't checked into std.c.windows.windows yet: http://msdn2.microsoft.com/en-us/library/ms683499(VS.85).aspx?s=21
My bad, i hadn't unpacked dmd 2.011 yet. Those structs were indeed added to std.c.windows.windows in 2.011 so Walter could compile microemacs. --bb
Feb 19 2008
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Bill Baxter wrote:
 Bill Baxter wrote:
 Derek Parnell wrote:
 On Tue, 19 Feb 2008 19:33:56 -0800, Walter Bright wrote:

 Bill Baxter wrote:
 And did you update the zip on ftp too?  Seems unchanged.
Ah, I see the problem, I copied the wrong file. Please try again.
Still doesn't compile (dmd 2.010). console.d:32 "static INPUT_RECORD lookaheadir;" - what is an INPUT_RECORD?
Looks like maybe some bit of Windows API Walter hasn't checked into std.c.windows.windows yet: http://msdn2.microsoft.com/en-us/library/ms683499(VS.85).aspx?s=21
My bad, i hadn't unpacked dmd 2.011 yet. Those structs were indeed added to std.c.windows.windows in 2.011 so Walter could compile microemacs. --bb
... but now I get a link error: f:\usr\pkg\d2\dmd\bin\..\lib\phobos.lib(stdio) Error 42: Symbol Undefined _popen OS is WinXP. --bb
Feb 19 2008
parent reply Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
 ... but now I get a link error:
 
 f:\usr\pkg\d2\dmd\bin\..\lib\phobos.lib(stdio)
  Error 42: Symbol Undefined _popen
 
 OS is WinXP.
As a workaround, you can stick in a function: extern (C) void popen() { assert(0); }
Feb 20 2008
parent Walter Bright <newshound1 digitalmars.com> writes:
Walter Bright wrote:
 As a workaround, you can stick in a function:
 
     extern (C) void popen() { assert(0); }
Ah, I went ahead and did that and uploaded a new zip file.
Feb 20 2008
prev sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Bill Baxter wrote:
 Derek Parnell wrote:
 Still doesn't compile (dmd 2.010).

 console.d:32 "static INPUT_RECORD lookaheadir;" - what is an 
 INPUT_RECORD?
Looks like maybe some bit of Windows API Walter hasn't checked into std.c.windows.windows yet: http://msdn2.microsoft.com/en-us/library/ms683499(VS.85).aspx?s=21
Need dmd 2.011 with the updated windows API.
Feb 19 2008