Any special exception-handling would look like this:
(on-err
(fn ()
#|do stuff...|#)
(fn (e)
(if (isa e 'MyExceptionType)
(let reason (rep e)
#|handle according to reason|#)
; unknown error, rethrow:
(err e))))
In fact, I have a draft implementation of 'on-err and 'err for arc2c:
(set on-err
(fn (f fh)
(ccc
(fn (k)
; let tmp (%curr-err)
((fn (tmp)
; set up a continuation guard
(%cont-guard-up)
(%set-err
(fn (e)
; tear down continuation guard
; and current error handler
(%cont-guard-down)
(%set-err tmp)
; so that if fh throws, it throws
; on the original err instead of
; recursing
(k (fh e)) ))
(f)
; tear down continuation guard and
; reset error handler
(%cont-guard-down)
(%set-err tmp))
(%curr-err))))))
(set err
(fn (e)
((%curr-err) e)))
(%set-err
(fn (e)
(%pr "Error of type: ")
(%prn (%type e))
(%pr "Error: ")
(%prn (%rep e))
(%halt)))
%curr-err and %set-err would have to set a thread-local variable in the C-side. %cont-guard-up and %cont-guard-down just need to set up continuation guards.
It may not be pure OpenGL, but my OpenGL book says that glXUseXFont will load an X font, which builds a bunch of display lists, each one of which containing a character rendered with that font.
I'm curious though. Why OpenGL? SDL plus SDL_ttf could have handled things just as well, plus Y would have pointed down, not up.
Simple DirectMedia Layer. Cross-platform multimedia library that has audio, input and 2D graphics. SDL_ttf is a standard extension to it that provides TrueType font support. If Arc can load C libraries, it can should be able to load SDL.