Sha256: 6c3fc1106f40aa76933c8711a7dc1f8add979b5aeebee40228b44e519eec3abb

Contents?: true

Size: 1.49 KB

Versions: 4

Compression:

Stored size: 1.49 KB

Contents

var logs = "";;

fun log t tab=
  let "|"::nil -> all in
  (
    for i = tablen tab; i > 0 ; i - 1 do
    (
      let itoa tab.(i - 1) -> data in
      set all =  data::","::all
    );
  set logs = strcatlist logs::t::","::(itoa time_ms)::","::all
  )
;;

fun TLtoS tlist=
  if tlist == nil then
    ""
  else
    let hd tlist -> [a b] in
    strcatlist (itoa a)::b::(TLtoS tl tlist)::nil
;;

//----------- Data Dump

// echo a string list as string
fun SLecho list=
  Secho strcatlist list
;;

fun SLecholn list=
  SLecho list;
  Secholn ""
;;

// echo a integer list as string
fun ILecho list=
  Secho listtostr list
;;

fun ILecholn list=
  ILecho list;
  Secholn ""
;;

fun TLecho tlist=
  Secho TLtoS tlist
;;

//----------- Data Transformation

// string to list of hex chars
fun _webmac key i=
  if i < strlen key then (ctoh strget key i)::_webmac key i+1;;
fun webmac key=
  strcatlist _webmac key 0;;

//convert chars into int (there is a limit!!!)
fun _StoI val pos len=
  let strget val pos -> v in
  if(len >= 0) then
    v << (8 * len) + _StoI val (pos + 1) (len - 1)
  else
    0
;;
fun StoI val=
  _StoI val 0 (strlen val) - 1
;;

//convert first 3 chars into int (perfect to set led color)
fun StoI3 val=
  _StoI val 0 2
;;

//convert first 2 chars into int (perfect to set led color)
fun StoI2 val=
  _StoI val 0 1
;;

fun CtoI3 s offset=
  (strget s offset) << 16 + (strget s offset+1) << 8 + strget s offset+2
;;

// -------------------- other stuff

fun exit=
  Secholn "\n";
  reboot 0x0407FE58 0x13fb6754
;;

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nabaztag_hack_kit-0.1.0.alpha2 bytecode/lib/data_helper.mtl
nabaztag_hack_kit-0.1.0.alpha1 bytecode/lib/data_helper.mtl
nabaztag_hack_kit-0.0.3 bytecode/lib/data_helper.mtl
nabaztag_hack_kit-0.0.2 bytecode/lib/data_helper.mtl