Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

TGA loader in LISP

Name: Anonymous 2010-12-26 3:20

`class` macro automatically generates everything

class Tga
  idLength   = U1  // 00h Size of Image ID field
  cmapType   = U1  // 01h Color map type
  imageType  = U1  // 02h Image type code
  cmapStart  = U2  // 03h Color map origin
  cmapLength = U2  // 05h Color map length
  cmapDepth  = U1  // 07h Depth of color map entries
  xOffset    = U2  // 08h X origin of image
  yOffset    = U2  // 0Ah Y origin of image
  width      = U2  // 0Ch Width of image
  height     = U2  // 0Eh Heigth of image
  bpp        = U1  // 10h Image pixel size
  descriptor = U1  // 11h Image descriptor byte
  idField    = idLength++U1
  cmap       = cmapLength++U1
  bmap       = (width*height*bpp%8)++U1

Name: >>2 2010-12-26 8:12

>>10
I considered that possibility, however some of the code he posted earlier seemed elaborate enough that it might just be something written in a real implementation.

I wrote a similar binary class reader/writer implementation in the past, and i find it pretty comfortable to use, but I'm not one to bother actually making a lexer/parser and giving up the advantages of s-expressions, so my DSL is just S-Exp based and just uses standard CL syntax without any syntax sugar on top.

His language seems to depart a lot from Lisps and just seems to be a language in its own right which is (supposedly) implemented on top of CL. I'm not even sure one has to right to call it a Lisp. For example, if I were to write some O'Caml which is interpreted by an interpreter written in CL, should I say I wrote Lisp, not O'Caml? Or what if I wrote some Python code and ran it with clpython (a Python compiler written in Common Lisp, http://common-lisp.net/project/clpython/), can I really say I wrote Lisp code (even though, I can compile the python code to Lisp, and it would be "Lisp", even if the original is not). Would it be fair to say that you wrote C code when you wrote some Scheme or Haskell code which you then compiled to C code? Or say you wrote x86 asm code when you just took some C code and compiled it to x86 asm?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List