[sldev] Offline compiler for LSL
Tim Shephard
tshephard at gmail.com
Thu Mar 1 02:44:24 PST 2007
I do a lot of LSL programming, so I find having an offline compiler
handy. Here's one that is open sourced and based off the current
code.
Just create a new project as your startup project, and use the
following main.cpp as it's sole file:
//
#include <windows.h>
#include <stdio.h>
#include "linden_common.h"
BOOL lscript_compile(const char * src_filename, const char *
dst_filename, const char * err_filename, BOOL is_god_like);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char bufLarge[2048];
char *buf2=bufLarge;
do {
*buf2++=*lpCmdLine++;
if (buf2[-1]=='/') {
buf2[-1]='\\';
buf2[0]='\\';
buf2++;
}
}
while(*lpCmdLine);
buf2[0]=0;
lscript_compile(bufLarge,"c:\\scripts\\scriptTemp.out","c:\\scripts\\scriptTemp.err",
false);
}
Here's the emacs macro I use to go to lines that have errors:
(defun compile-lsl (number)
"Compile LSL."
(interactive "p")
(save-buffer)
(shell-command (concat "c:\\scripts\\comp.exe " buffer-file-name))
(shell-command (concat "type " "c:\\scripts\\scriptTemp.err"))
(setq curbuff (current-buffer))
(set-buffer "*Shell Command Output*")
(goto-line 1)
(setq val1 (thing-at-point 'word))
(forward-word 2)
(setq val2 (thing-at-point 'word))
(set-buffer curbuff)
(goto-line (+ (string-to-number val1) 1))
(forward-char (string-to-number val2))
)
;;; Compare windows
(global-set-key "\C-cw" 'compile-lsl)
More information about the SLDev
mailing list