User:JB Kraft

From Second Life Wiki
Revision as of 23:15, 8 March 2008 by JB Kraft (talk | contribs) (→‎LSL)
Jump to navigation Jump to search
c'est moi

CV

I'm a professional programmer/musician. I'm mostly here for the code and somewhat for the insanity :) I'm literate in most major languages with a bias to C++, Python, Smalltalk and Lisp and I'm a *nix head from way back; yeah BL (Before Linux). Don't ask me anything about Windoze.

SL

I run a scripting/gadget biz in SL under the handle Kwerks but mainly do custom work. Feel free to give me a buzz if you have something on your mind. The lab is in Alleni/66/190/31.

JIRA

Some viewer patches I have lobbed at the JIRA

Load/save script files to the editor from local disk
https://jira.secondlife.com/browse/VWR-5206
Autosave scripts in case of crash
https://jira.secondlife.com/browse/VWR-5215
Line number gutter for script editor
https://jira.secondlife.com/browse/VWR-5283
Toggle comment selection for script editor
https://jira.secondlife.com/browse/VWR-5304
Preference panel for the script editor
https://jira.secondlife.com/browse/VWR-5318

LSL

Escape XML
http://wiki.secondlife.com/wiki/EscapeXML
Texture Cycle
http://wiki.secondlife.com/wiki/Texture_Cycle
Voting Script
http://wiki.secondlife.com/wiki/Vote_Simple
Color Cycle
http://wiki.secondlife.com/wiki/Color_Cycle
PHP5 class for the XTEA impl
http://wiki.secondlife.com/wiki/XTEA_Strong_Encryption_Implementation#XTEA_LSL_.3C-.3E_PHP

Offline LSL Syntax Checker

I use this to do a quick syntax check on LSL files from my normal editors (emacs or TextMate) when I am offline. To build this you must have the viewer source installed and built on your machine. I built it on OS/X so Linux will probably be fine and I have no clue how to make it go on windows. If you get it to run on windows send me the instructions and I will post them here.

<lsl> /*

* lslcheck.cpp
* macview
*
* Created by JB Kraft.
*
* A small utility to use as a syntax check for LSL scripts outside of 
* Second Life. I built this on OS/X. YMMV.
*
* Building:
* - you need the source code for the viewer installed and compiled on your 
*   machine
* - create a makefile or project or whatever you do and compile this code and
*   link it against libapr-?.a, libllcommon.a
*
* Command line:
* ./lslchecker [FILES...]
*/
  1. include "linden_common.h"
  1. include "lscript_bytecode.h"
  2. include "lscript_error.h"
  3. include "lscript_rt_interface.h"

const std::string ERR_FILE = "out.err"; const std::string DAT_FILE = "out.dat";

/**

*
*/

void usage( ) { std::cout << "lslchecker [FILES]" << std::endl; exit(0); }

/**

*
*/

std::string trim( std::string str ) { std::string::size_type ndx = str.find_last_not_of(" \t\r\n"); str.erase( ndx + 1 ); return str; }

/**

*
*/

void check( std::string fname ) { std::cout << fname << ": "; if( !lscript_compile( fname.c_str(), DAT_FILE.c_str(), ERR_FILE.c_str() )) { // spit out an the output from the error file std::ifstream err( ERR_FILE.c_str() ); if( err.is_open()) { std::string line; while( !err.eof()) { getline( err, line ); std::cout << trim(line) << std::endl; } err.close(); } else { // couldn't read it? std::cout << "!. see file: " << ERR_FILE << std::endl; } } else { // it's good std::cout << "ok" << std::endl; } }

/**

*
*/

int main( int argc, char **argv ) { if( argc == 1 ) { usage(); }

for( int i = 1; i < argc; i++ ) { check( argv[i] ); } return 0; } </lsl>