ChucK/Dev/Shell
From CSWiki
(Redirected from ChucK Shell)
Contents |
[edit]
goal
- shell
- support intended functionality
- support on-the-fly programming
- execute code inline
- run-time code modification
- framework component re-use
- support intended functionality
[edit]
milestones
- have a shell toggled by flag (--shell)
- interfaces classes with document
- on-the-fly programming
- checkpoint (11/14)
- shell documentation
- miniAudicle documentation
- presentation (12/9)
- some examples
[edit]
documentation outline
- introduction
- table of contents
- tutorial
- command line options
- shell commands (see below)
- in-shell coding
- option tutorial 2
[edit]
ideas
- --shell automatically starts a VM
- shell exits when VM is finished running currently, but keeping the shell alive after the VM ends is an option to consider
- --empty restricts VM
- chuck @ hostname -pPORT --shell causes ChucK shell to automatically attach/add the VM at hostname:port. --empty is implicit in this option
- shell commands
-
vm attach [hostname[:port]]orvm @ [hostname[:port]]attempts to attach to a ChucK VM running on hostname:port. The default port is 8888. If no hostname or port is specified, the shell attempts to attach to the in-process VM- prints a success message and the VM reference number for each successful attachment; prints a failure message for each failed attachment
-
vm +orvm add- saves the current VM for later use
-
vm - [vm_reference]orvm remove [vm_reference]- removes specified VM--it is no longer on the VM list
-
vm = [vm_reference]orvm swap [vm_reference] -
vmsorvm list- lists all VMs plus the current VM
-
vm @+ hostname:portadds and attaches the specified VM -
add [files]or+ [files]- adds [files] to current VM and prints out a shred reference number for each file
-
remove [ids]or- [ids] -
removeall -
replace id filename [id filename]... -
--(remove shred with highest id) -
statusor^ -
killkills the current vm--shuts down the shell too if current_vm is the process vm -
ls(like unix ls) -
aliasandunalias(simple substitution-based, bash-like command aliases) -
shredslist all shreds on the current VM -
pwd -
cd(change directory, also change current dir for chuck so paths are consistent) -
exitexit everything -
closeclose down shell, keep process VM running
-
- Ge: thoughts on these commands? ^
- they look great! few questions/thoughts:
- depending on the command line flag issued, the shell could automatically attach the most appropriate thing
- (maybe by default, the shell is attached to 'process'
- --local and --process probably don't need to be be flags since they are targets of the attach shell command (local or process or self may suffice?)
- the multiple attached target vms is totally cool!
- they look great! few questions/thoughts:
[edit]
executing chuck code dynamically
-
{ [code] }addscodeto the current VM- A
{ }block can be stretched out over a number of lines - if so, the shell prompt will change to
codeand will also print the current scope level of the code entry. Also, the code entry will be considered complete when the shell finds a matching brace for the first opening brace - If an alphannumeric text string is supplied after the final brace, the code will be saved within the shell and will be associated with that particular name. Non-CR/LF whitespace may separate the brace and the code name.
- example:
{ 0 => int i; } foowill be saved as 'foo'
- example:
- (potential advanced feature) specifying an arbitrary alphanumeric context name after the keyword
contextwill apply the state context of that name to any code segment which opens on that line.- example:
context bar { 0 => int i; }will apply context 'bar' to the following code - if a context doesn't exist, it will be created using the state of the subsequent code entry
- a context is essentially a scope. by executing two segments of code in a single context, they will have access to the same top-scope variables
- if no context is specified, then no new context is created and no special context is used
- example:
- A
-
code list [code_name] -
code print [code_name] -
code save code_namesaves last code entry as code_name -
code delete code_name -
code add code_nameadds code_name to current VM -
code write code_name filewrites code_name to file -
code read code_name filereads code in file to code_name
[edit]
things that would be nice to have from existing chuck code
- more feedback from otf_ functions
- status sends status report back to calling process
- add sends back the shred number of the added process
- single exit path for Chuck_VM -- instead of calling exit(), it would be helpful if the VM simply stopped running when it recieves a kill command
