Difference between revisions of "User:JB Kraft"

From Second Life Wiki
Jump to navigation Jump to search
Line 31: Line 31:
; PHP5 class for the XTEA impl  
; PHP5 class for the XTEA impl  
: http://wiki.secondlife.com/wiki/XTEA_Strong_Encryption_Implementation#XTEA_LSL_.3C-.3E_PHP
: 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 editor. It requires that you have the viewer source installed and built on your machine. I built this on OS/X so Linux will probably be fine and I have no clue how to make it go on windows.
<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...]
*/
#include "linden_common.h"
#include "lscript_bytecode.h"
#include "lscript_error.h"
#include "lscript_rt_interface.h"
#define ERR_FILE "out.err"
#define 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, ERR_FILE )) {
// spit out an the output from the error file
std::ifstream err( ERR_FILE );
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>

Revision as of 04:29, 6 March 2008

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 thrown 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, shift selection left/right for script editor
https://jira.secondlife.com/browse/VWR-5304
Preference panel for the script editor
https://jira.secondlife.com/browse/VWR-5318

LSL

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 editor. It requires that you have the viewer source installed and built on your machine. I built this on OS/X so Linux will probably be fine and I have no clue how to make it go on windows.

<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"
  1. define ERR_FILE "out.err"
  2. define 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, ERR_FILE )) { // spit out an the output from the error file std::ifstream err( ERR_FILE ); 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>