Omnimaga
Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: compu on August 18, 2011, 03:51:12 pm
-
rshell is a command-line interface for Nspire using the RS232 port.
It has the ability to launch ndless executables and pass C's argc and argv to them.
I have included some programs for filesystem operations:
ls - list content of a directory
cp - Copy a file
mkdir - Create a directory
stat - Show size and type of a file
rm - Remove a file (for some reason buggy sometimes)
All these commands are in their own TNS-File that has to be located in /documents/bin or the current directory.
Built-in commands are:
cd - Change directory
exit - Exit rshell
Demonstration:
ls
A:\documents\>ls.tns
.\
..\
Examples\
bin\
A:\documents\>ls.tns /
dev\
tmp\
phoenix\
documents\
ti84\
logs\
widgets\
cp
A:\documents\>cp.tns
USAGE: cp.tns SOURCE DESTINATION
Copies a file from SOURCE to DESTINATION.
A:\documents\>cp.tns bin/stat.tns copied.tns
A:\documents\>ls.tns
.\
..\
Examples\
bin\
copied.tns
mkdir
A:\documents\>mkdir.tns
USAGE: mkdir.tns NAME
Creates a directory named NAME.
A:\documents\>mkdir.tns lol
A:\documents\>ls.tns
.\
..\
Examples\
bin\
copied.tns
lol\
stat
A:\documents\>stat.tns
USAGE: stat.tns FILE
Shows stat data for FILE.
A:\documents\>stat.tns copied.tns
Mode: File
Size: 0 KBytes
(Shows 0KB here, because it is smaller than 0.5KB and got rounded down...)
rm
A:\documents\>rm.tns
USAGE: rm.tns FILE
Removes the FILE.
A:\documents\>rm.tns copied.tns
A:\documents\>ls.tns
.\
..\
Examples\
bin\
lol\
cd
A:\documents\>cd examples
A:\documents\examples\>cd ..
A:\documents\>cd /
A:\>cd phoenix
A:\phoenix\>cd /documents
A:\documents\>cd \
A:\>
-
Looks very nice :)
Good job!
-
This is even more than awesome, really nice indeed !
-
WANT. Also, any chance of integrating such a shell into the nspire without the RS232? :P
-
WANT. Also, any chance of integrating such a shell into the nspire without the RS232? :P
Maybe I can use one of my older projects (http://nspforge.unsads.com/p/nspireio) for on-screen output and keyboard input, it shouldn't be too hard to integrate.
-
yay, because that's been something I've wanted for a while.
Oh, also, if we cp to a non-tns name, will it then not show up in the menu, but still be in the calc? That would rock.
-
yay, because that's been something I've wanted for a while.
Oh, also, if we cp to a non-tns name, will it then not show up in the menu, but still be in the calc? That would rock.
Yes, files with a non-tns extension will not be shown by the document browser, but you can "hack" the OS (http://ourl.ca/10562) :P
-
well, of course, but I was thinking it'd be a lot more organized to not see all the roms from gbc4nspire, or all the text files from that one text editor, and only the things we can actually execute in the main menu.
-
Nice job, compu!
Just one question though: does this require Ndless?
-
I'd bet on it: Lua doesn't have any RS232 support as far as I'm aware, so it'd have to be ndless.
-
Awwwww :(
Oh well... Still, great job!!! :)
-
Ndless for 3.0 will come, just wait!
-
I'd bet on it: Lua doesn't have any RS232 support as far as I'm aware, so it'd have to be ndless.
Lua has a function to send data via RS232, but you can't receive any data with it. So yes, this requires Ndless.
Ndless for 3.0 will come, just wait!
Lua + C would be awesome :D
-
About that Lua outputting to the RS232 port, it's just a print() actually that outputs stuff to the console, which is actually the serial port
-
so, TI essentially set up the RS232 to be a shell, and ended it at that? Or is it just marked as stdout?
How hard would it be for you to integrate rshell into the calc if there was a way to display whatever went into and out of RS232 on-screen, in a terminal-like fashion? Just curious.
-
The rs232 is stdout, using printf in ndless programs outputs to there.
-
Nice compu :)
I really should export Ndless's program launcher to let you call it instead of replicating it in your shell. This would avoid:
- bugs duplication such as the missing clear_cache() in your code which may make the launch crash in some conditions
- breaking your shell if the program format changes, which may happen when new features are included (such as compatibility flags or other programs metadata)
-
Update :)
- Using on-screen console instead of RS232
- Launched programs can use Nspire I/O (http://ourl.ca/9468) to write to (and read from) rshell's console
- Programs that need to be run with rshell have the header "RSH\0" instead of "PRG\0" to prevent errors when launching with the standard loader
- Included program rshell_header.exe to replace "PRG\0" with "RSH\0"
- Launching a program does not require the .tns ending anymore
(for example you can type "ls" instead of "ls.tns")
My solution isn't very memory-efficient yet, because I didn't get shared variables/functions (http://ourl.ca/12697) to work.
-
Is that a run indicator I see in the corner?
-
Unfortunately not, it is a bug. :P
-
Update:
Made compatible with Nspire I/O 2.0.
+ I have ported argtable2 (http://argtable.sourceforge.net/) which allows us to have fancy command-line arguments, and therefore to create powerful console applications :)
Download can be found at http://nspforge.unsads.com/p/rshell/downloader
And a screenshot of what argtable2 can do: