[Jahshaka-cvs] jah/jahtools/jbatch jstack.py,1.16,1.17
Status: Beta
Brought to you by:
jahshaka
From: Charles Y. <lil...@us...> - 2007-05-28 20:33:08
|
Update of /cvsroot/jahshaka/jah/jahtools/jbatch In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22639 Modified Files: jstack.py Log Message: + jbatch server phase 2 begins... adds help to jstack (usage: jbatch help) Index: jstack.py =================================================================== RCS file: /cvsroot/jahshaka/jah/jahtools/jbatch/jstack.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- jstack.py 4 May 2007 17:01:29 -0000 1.16 +++ jstack.py 28 May 2007 20:33:04 -0000 1.17 @@ -15,44 +15,59 @@ def __init__( self ): self.objects = { } self.stack = [ ] + self.help = { } self.dict = { } - self.dict[ "purge" ] = self.purge - self.dict[ "clear" ] = self.clear - self.dict[ "swap" ] = self.swap - self.dict[ "2swap" ] = self.swap2 - self.dict[ "rot" ] = self.rot - self.dict[ "drop" ] = self.drop - self.dict[ "2drop" ] = self.drop2 - self.dict[ "dup" ] = self.dup - self.dict[ "debug" ] = self.debug - self.dict[ "decap" ] = self.decap - self.dict[ "clone" ] = self.clone - self.dict[ "over" ] = self.over - self.dict[ "render" ] = self.render - self.dict[ "nip" ] = self.nip - self.dict[ "tuck" ] = self.tuck - self.dict[ "size" ] = self.size - self.dict[ "dup!" ] = self.dup_assign - self.dict[ "!" ] = self.assign - self.dict[ "decap!" ] = self.assign_decap - self.dict[ ":" ] = self.start - self.dict[ ";" ] = self.end - self.dict[ "@" ] = self.deref - self.dict[ "play" ] = self.play - self.dict[ "store" ] = self.store - self.dict[ "store!" ] = self.assign_store - self.dict[ "stack" ] = self.show_stack - self.dict[ "vars" ] = self.vars - self.dict[ "functions" ] = self.show_functions - self.dict[ "+" ] = self.add - self.dict[ "-" ] = self.sub - self.dict[ "*" ] = self.mult - self.dict[ "/" ] = self.div + self.register( "purge", self.purge, "Clears all media objects and variables" ) + self.register( "clear", self.clear, "Clears the stack" ) + self.register( "swap", self.swap, "Swaps the top two items on the stack (1 2 swap = 2 1)" ) + self.register( "2swap", self.swap2, "Swaps the top four items on the stack (1 2 3 4 2swap = 3 4 1 2)" ) + self.register( "rot", self.rot, "Rotates the top three items on the stack (1 2 3 swap = 2 3 1)" ) + self.register( "drop", self.drop, "Drops the top of stack (1 2 drop = 1)" ) + self.register( "2drop", self.drop2, "Drops the top two items at the top of the stack (1 2 drop = <empty>)" ) + self.register( "dup", self.dup, "Duplicates the reference at the top of the stack" ) + self.register( "debug", self.debug, "Display the current stack contents" ) + self.register( "decap", self.decap, "Remove the furthest downstream filter of the top item of the stack" ) + self.register( "clone", self.clone, "Clones the item at the top of the stack" ) + self.register( "over", self.over, "Clones the second item on the stack and places it on the top (1 2 over = 1 2 1)" ) + self.register( "render", self.render, "Provides a filter graph ala oml/jbatch documentation on top of stack item" ) + self.register( "nip", self.nip, "Drops the item before the top of stack (1 2 nip = 2)" ) + self.register( "tuck", self.tuck, "Clones the item before the top of stack (1 2 tuck = 1 2 1)" ) + self.register( "size", self.size, "Puts the length of the item at the top of the stack on the stack (test: size = test: 250)" ) + self.register( "dup!", self.dup_assign, "Assigns a reference to an item to a variable (1 op:a dup! = 1)" ) + self.register( "!", self.assign, "Assigns a reference to an item to a variable (1 op:a ! = <empty>)" ) + self.register( "decap!", self.assign_decap, "Same as decap, but provides assignment of the removed filter to a var (<video> op:a decap!)" ) + self.register( ":", self.start, "Starts a function definition ( : name <body> ; )" ) + self.register( ";", self.end, "Terminates a function definition" ) + self.register( "@", self.deref, "Dereferences the variable at the top of the stack (op:a @ = a)" ) + self.register( "play", self.play, "Play the media at the top of the stack" ) + self.register( "store", self.store, "Play the media through a specific store" ) + self.register( "store!", self.assign_store, "Play the media through a store that generates an output, and assign output to the var" ) + self.register( "stack", self.show_stack, "Display all contents of the stack" ) + self.register( "vars", self.vars, "Display a list of all defined variables" ) + self.register( "functions", self.show_functions, "Display a list of all defined functions" ) + self.register( "+", self.add, "Adds two integers at top of stack and returns result to top (1 2 + = 3)" ) + self.register( "-", self.sub, "Subtracts two integers at top of stack and returns result to top (1 2 - = -1)" ) + self.register( "*", self.mult, "Multiplies two integers at top of stack and returns result to top (1 2 * = 2)" ) + self.register( "/", self.div, "Divides two integers at top of stack and returns result to top (1 2 / = 0)" ) + self.register( "help", self.helper, "This information" ) self.functions = { } self.defining = False self.definition = [ ] self.locals = [ { } ] + def register( self, name, command, help ): + self.dict[ name ] = command + self.help[ name ] = help + + def helper( self ): + words = self.dict.keys( ) + words.sort( ) + for n in words: + if n in self.help.keys( ): + print "%-10.10s - %s\n" % ( n, self.help[ n ] ), + else: + print "%-10.10s\n" % n, + def purge( self ): self.objects = { } |