Archive for April, 2008|Monthly archive page
Amiga E IRC Channel
I have been pleasantly surprised with the activity of the new Amiga E programming channel on Freenode at #AmigaE. In the past three days, I’ve had Leif Salomonsson, developer of ECX in the channel. Chris Handley, developer of PortablE in the channel. Tomasz Wiszkowski, developer of CreativE in the channel.
Then tonight, the creator of Amiga E, Wouter van Oortmerssen logged into the channel! I was elated! I have been a fan of Wouter’s for a long time. You can find his web site in my blogroll in the right navigation. He is definitely my favorite programmer. So it was a pleasure to see him in the channel and chat with him for a bit.
Amiga E Programming for AROS
Chris Handley has made a beta version of his Amiga E implementation called PortablE available for AROS now. You can only obtain a copy of PortablE through the Amiga E mailing list available at http://www.freelists.org/list/positron. If you register and ask Chris for it, he will send you a link. Chris said PortablE is working well and may not be in beta stage much longer. So he will provide a link on the PortablE web site once the beta is finished.
I have been testing PortablE on AROS lately. In short, here is how PortablE works. You write your Amiga E code, use PortablE to translate it into a .cpp file and then use any C++ compiler to compile the file into an executable. I have been using g++ inside AROS. If you want to go to Amiga Classic, you can use PortablE to translate to Amiga E and then move it to Classic where you can use an Amiga E compiler like CreativE. More detailed information is available on the PortablE web site at the link I provided above.
There are a few things you need to setup in AROS for things to work. For one, you need a Stack of 100000. You can set this up by typing “stack 100000″ (without the quotes) in the AROS shell. You need to do an assign for PEmodules. Do this with this command: Assign PEmodules: VolumeName:PEmodules
You can put Assign commands like this in your user-startup file in AROS so you don’t have to do it everytime. User-startup is in System:S
You also need some Assigns placed in there for g++. The exact Assigns you need can be found in the INSTALL file located in System:Development
So here are the commands I entered on the command line once I had things setup to test a simple program.
PortablE test.e (This gave me a file named test.cpp)
g++ test.cpp -o test (This gave me a file named test to run as an executable)
So then I just typed in the name of my executable at the shell and it ran and printed “Hello, World!”.
Don’t forget to come and hang out with us on the #AmigaE IRC channel on Freenode if you are interested in Amiga E programming. I have recently created an Amiga E IRC channel on Freenode at #AmigaE.
Enjoy!
Next Indiana Programming Group Meeting
The Indiana Programming Group (This is what we decided to call ourselves.) is having our next meeting Wednesday, April 23rd at 5:30pm. We are meeting in Terre Haute, Indiana on the campus of Indiana State University at the Unix Lab in Root Hall. It is open to the public.
Our speaker for this meeting is tentatively Paul Cardwell. He is a local web developer specializing in his own PHP programming architecture.
Steve Baker has just setup Mailman to handle our new mailing list. To subscribe to the list, just go to: IPG Mailing List
I’ll be sending future news and meeting dates to this list, so if you are interested, please subscribe.
This is a new programming language group in Indiana. The group is for anyone interested in programming no matter what the language is. We do enjoy Common Lisp, so Lispers are definitely welcome anytime! But we have members with many different backgrounds in many different programming languages. I will try to have a speaker at each meeting. But anyone is welcome to discuss or present anything about programming.
Open File and Read
I mentioned I needed a project to work on and Zach Beane mentioned an SVG parser. I thought it sounded really cool, but I have never programmed a parser before in any language. So, I started writing code yesterday that hopefully will turn into an SVG parser. I started with simply opening an SVG and reading it line by line.
An SVG is actually created by using XML. I heard you can use javascript to do this, but I don’t know much about that yet. I have been reading the w3.org site for SVG information. They had an example of an upside down triangle, so I grabbed that to test my code. Here is the XML code that makes up the SVG. If you copied this to a text file and then saved it as a .svg, you could open the file with your web browser and see the red upside down triangle it creates.
<?xml version=”1.0″ standalone=”no”?>
<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN”
“http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd”>
<svg width=”4cm” height=”4cm” viewBox=”0 0 400 400″
xmlns=”http://www.w3.org/2000/svg” version=”1.1″>
<title>Example triangle01- simple example of a ‘path’</title>
<desc>A path that draws a triangle</desc>
<rect x=”1″ y=”1″ width=”398″ height=”398″
fill=”none” stroke=”blue” />
<path d=”M 100 100 L 300 100 L 200 300 z”
fill=”red” stroke=”blue” stroke-width=”3″ />
</svg>
I have been using CUSP lately to do all of my Common Lisp coding. Especially after talking with Jasko at the programming meetup we had last week. I like using it, plus I can use it on Windows and that is all I have at work, so it makes it more convenient.
What took me the longest with this code was the Windows pathname. I wasn’t sure how SBCL looks at that. SBCL is what CUSP uses as it’s implementation, by the way. Which is great, because I want to use SBCL. I had to play with it quite a bit but finally figured out the pathname. I placed my tri.svg file in my C:\lispstuff directory. So after playing in the REPL and trying different options, I figured out SBCL reads it as “C:\\lispstuff\\tri.svg”.
Once I had that, I knew the best thing to use to open a file and read it was the Common Lisp macro WITH-OPEN-FILE. Peter Seibel talks about this in his Practical Common Lisp book in chapter 14. Then I used a do loop to step through each line of the file and “format” to print them out. Here is the code:
Keep in mind this code is indented, but WordPress really sucks when it comes to handling code. I need to switch this to a different blog.
I uploaded the actual text file so you could see the indention, get it here.
(defun pjmain ()
(with-open-file (stream “C:\\lispstuff\\tri.svg”)
(do ((line (read-line stream nil)
(read-line stream nil)))
((null line))
(format t “~A~%” line))))
I will have to revisit this code for the parser, because I need a way for it to ask the person what SVG file they would like to parse. The next thing I need to do is try to parse this. I have a lot of reading to do. I know Zach mentioned he only needed the path data of the SVG, so I will concentrate on obtaining that first.
Any tips or suggestions on any of this is definitely welcome. I am a beginner after all.
Leave a Comment
Leave a Comment
Leave a Comment