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: Anonymous 2010-12-27 7:24

>>27-28
I've written some damn messy CL code, but yours still beats mine...
Major differences in my style is that I tend to give most important variables a name, so I understand what my code is supposed to be doing.
You seem to have used quite a bit of reader macros in there, yet why not use a with-gensyms-like macro for all those gensyms you're using?

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