posted on 2015-01-29 11:14:00
CHICKEN Scheme is a fantastic Scheme system. It is pretty portable, and lets one interact with C relatively painlessly.
Getting graphics, specifically SDL, to work on OS X is rather painful. It's not really CHICKEN's fault though; SDL has requirements on which thread owns what.
Here's the quick way to get started using graphics in CHICKEN Scheme using the doodle library.
First, as a one-time thing, install all of the system dependencies.
# Install Cairo brew install cairo # Install SDL requirements brew install sdl sdl_ttf sdl_image sdl_gfx sdl_net
Next, install some CHICKEN dependency libraries ("eggs"):
chicken-install sdl matchable
matchable isn't a strict requirement, just a requirement
for the example below.
You should have XQuartz installed. If you don't, go do that.
We need to install doodle separately as follows. We need to tell it
pkgconfig is from X11 so doodle can be built properly.
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig chicken-install doodle
We should be done with all of the one-time bits. Now we can write
graphics code. Unfortunately, there are a few hitches. As mentioned
previously, SDL has certain requirements on what thread
main is in,
and so on. This means that interactive graphics development on OS X is
a bit of a pain, if not currently impossible.
In your Scheme file, say
graphics.scm, you must have the following
at the top:
(use matchable doodle) ;; Required on OS X. (declare (foreign-declare "#include<SDL/SDL.h>\n")) (foreign-code "SDL_Init(SDL_INIT_EVERYTHING);") ;; graphics code follows...
Now we can write graphics code. See the doodle API for the functions you can use, and see the end of this post for an example application.
Once we've written our application, we can compile it. We need to link
it with SDL and provide the necessary SDL compilation configuration
parameters, which can be injected using the
program. The compilation line looks like this:
csc graphics.scm -lSDLmain `sdl-config --cflags --libs`
Now we should have an executable which we can run:
An example application, taken from the example on the doodle API page:
(use matchable doodle) ;; Required on OS X. (declare (foreign-declare "#include<SDL/SDL.h>\n")) (foreign-code "SDL_Init(SDL_INIT_EVERYTHING);") (define *paint* #f) (define red '(1 0 0 0.3)) (world-inits (lambda () (clear-screen) (set-font! "Vollkorn" 18 red) (text (/ doodle-width 2) (/ doodle-height 2) '("Welcome to doodle!" "Click the left mouse button to draw circles" "Press ESC to leave") align: #:center))) (world-changes (lambda (events dt exit) (for-each (lambda (e) (match e (('mouse 'pressed x y 1) (set! *paint* #t) (filled-circle x y 10 red)) (('mouse 'released x y 1) (set! *paint* #f)) (('mouse 'moved x y) (when *paint* (filled-circle x y 10 red))) (('key 'pressed #\esc) (exit #t)) (else (void)))) events))) (new-doodle title: "Doodle paint" background: solid-white) (run-event-loop)
posted on 2015-01-29 10:57:00
I have a Macintosh Quadra 650 with System 7.6.1 on it. I wanted to get software onto it, namely web browsers and other things. How does one do that on OS X?
It's actually relatively simple. Get the software you want into a
folder on your machine. Let's say
~/software. It seems to work best
if this software has been compressed with StuffIt Expander. If you
decompress it on your OS X ("host") machine, things don't seem to work
as well and things get lost.
We will need
cdrtools, so install that.
brew install cdrtools
Now that we have that, we can make an image we can burn. The image
needs to have HFS as its file system, as this is what is used my
System 7. Making images with this file system became unsupported in
versions of OS X after 10.5 "Leopard", but
still has this capability.
mkisofs -hfs -o software.iso ~/software
Once the image is made,
software.iso, you can open it with Disk
Utility and burn it. I recommend burning at the slowest speed and
When you pop the disk into your old Mac, you should be able to explore the contents of the CD.
posted on 2015-01-22 20:40:00
So, my last blog basically died. Some of you may notice that it has redirected to the Wayback Machine.
There was a catastrophic mishap, of course accidental, where the database of the website was deleted. I, assuming all system administrative duties were taken care of, did not ensure there was a complete backup. So, a lot of new material, and all partial drafts, are gone.
It's too bad, but not the end of the world. Slowly I will be manually migrating old content from Symbo1ics to Style Warning.
Style Warning is this new shiny website. It isn't as fancy as Symbo1ics in terms of features, because I decided I will go with nearly the bare minimum. This time, instead of Wordpress for dynamic content, I am going with Coleslaw, a Jekyll-like static blog generator written in Common Lisp.
Wordpress was a behemoth of PHP. Go check one of the sources on Symbo1ics. Your eyes will bleed. It is huge, bloated, and whenever something popped up on the front page of Hacker News, the entire site would come to a screeching halt. Also, the constant updates to the website were annoying. Eventually, it just began to bit rot, which in turn, made it insecure.
Why change domains? One might say this is a re-branding. There will be mostly the same kind of content, but just under a different name. Symbo1ics was originally supposed to be a website about my Lisp machines, but I never got to documenting them. I still hope to one day. Of course, "Symbo1ics" is a play on the name "Symbolics", which was the name of the at the time successful company that produced Lisp machines and a plethora of software.
Using the name "Symbo1ics" had its own problems though. Here is a typical exchange over the phone.
Them: So, Robert, what is your email address?
Me: It is
Q U A Dat
S Y M B Othe number one
I C Sdot
C O M. Quad at symbolics dot com, but with the L replaced with the number one.
Them: So let me repeat. It is quad at
S Y M B Othe number one
I C Sdot com?
Can you see the problem? Also, whenever I write the email address, I
have to always explicitly follow up saying to pay particular attention
to the number
1 in the name. Many have told me eventually that they
sent emails to
symbolics.com, which is a domain currently being
wasted by an investor for advertising.
Hopefully such issues will be partially mitigated by the new domain.
This website isn't complete. There are some things that I need to add or fix, like permalinking or maybe even comments. It also needs a better look. But for now, it's an improvement over the previous system.