Created
April 25, 2017 07:58
-
-
Save gabrielschulhof/a4dc3dfd17b2df55c1129634ff2febbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( process.argv.length < 3 ) { | |
console.error( "Need an argument" ); | |
process.exit( 1 ); | |
} | |
var the_string = process.argv[ 2 ]; | |
var index; | |
console.log( | |
"set $the_string = (char *)jmem_heap_alloc_block(" + ( the_string.length + 1 ) + ")" ); | |
console.log( "call memset($the_string, 0, " + ( the_string.length + 1 ) + ")" ); | |
for (index = 0; index < the_string.length; index++) { | |
console.log( "set $the_string[" + index + "] = '" + the_string[index] + "'" ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment