mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
version bump and documentation update
This commit is contained in:
parent
0cc4c192d2
commit
90a6e9e405
4 changed files with 57 additions and 25 deletions
|
|
@ -1,6 +1,6 @@
|
|||
var clite = {
|
||||
state:{
|
||||
version:'0.6.1',
|
||||
version:'0.8.0',
|
||||
isinit:false,
|
||||
runlevel:1,
|
||||
bios:null,
|
||||
|
|
@ -362,7 +362,10 @@ cat /etc/greeting
|
|||
if (typeof fn === 'string') {
|
||||
f.data.content = fn;
|
||||
}else{
|
||||
f.data.content = fn.toString().substring(8);
|
||||
f.data.content = fn.toString().substring(23);
|
||||
var e = f.data.content.lastIndexOf('return main(');
|
||||
if (e > -1)
|
||||
f.data.content = f.data.content.substring(0,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ The Boot Process:
|
|||
/etc/shrc init file for the shell (prints the above and so on)
|
||||
12. The default device files are initialised in /dev:
|
||||
/dev/local provides an interface for upload from and
|
||||
downloading to the users computer.
|
||||
downloading to the user's computer.
|
||||
/dev/null the null device
|
||||
/dev/random read from this for a random number
|
||||
/dev/initctl for accessing and changing the system runlevel
|
||||
|
|
@ -176,10 +176,13 @@ The Boot Process:
|
|||
17. The guest user account's home directory is created at /usr/home/guest,
|
||||
shell dot files added, and /usr/share/site is symlinked to
|
||||
/usr/home/guest/web
|
||||
18. PID 1 is forked. At present this new process simply sets its uid and
|
||||
gid to 1 (guest) then executes /bin/sh. At which point the shell
|
||||
starts up, runs its rc files, and presents a command prompt to
|
||||
the user.
|
||||
18. PID 1 is forked. At present PID 1 is /bin/login which either logs in
|
||||
automatically to the guest account, or presents a login prompt
|
||||
if another count, with a password, exists.
|
||||
19. Upon succesful log in, /bin login forks a new process, sets its uid
|
||||
and gid to the new user according to /etc/passwd, then executes
|
||||
/bin/sh. At which point the shell starts up, runs its rc files,
|
||||
and presents a command prompt to the user.
|
||||
|
||||
|
||||
The Lifecycle of a Process:
|
||||
|
|
@ -206,7 +209,7 @@ The Lifecycle of a Process:
|
|||
less than zero for internal error
|
||||
greater than zero for the program's own use
|
||||
This ends the program, and notifies the process manager that the
|
||||
process has exit.
|
||||
process has exited.
|
||||
The process manager will then remove the process from the process
|
||||
list, delete the process' data file in /proc/<pid>, then handle
|
||||
any wait() calls that have been queued for the process exit.
|
||||
|
|
|
|||
|
|
@ -56,8 +56,11 @@ Synchronous Program:
|
|||
|
||||
clite.commands.load('hello',function(args,env,io) {
|
||||
var stdio = io.include('stdio');
|
||||
stdio.printf("Hello World!\n");
|
||||
return 0;
|
||||
function main(argc,argv) {
|
||||
stdio.printf("Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
return main(args.length,args);
|
||||
}
|
||||
|
||||
Asynchronous Program:
|
||||
|
|
@ -73,15 +76,6 @@ clite.commands.load('show',function(args,env,io) {
|
|||
var stdlib = io.include('stdlib');
|
||||
var stdio = io.include('stdio');
|
||||
|
||||
// check there's a file to read from
|
||||
if (args.length != 2) {
|
||||
stdio.write(io.stderr,'Specify a file to read\n');
|
||||
return 1; // not asyncronous yet, so just return
|
||||
}
|
||||
|
||||
// take the argument, and get it's full path
|
||||
var file = stdlib.resolvePath(args[1]);
|
||||
|
||||
// file callback function that will receive the file descriptor
|
||||
// once the file has data in it
|
||||
function fcb(fd) {
|
||||
|
|
@ -112,11 +106,41 @@ clite.commands.load('show',function(args,env,io) {
|
|||
io.exit(0);
|
||||
}
|
||||
|
||||
// open the file, and set the callback
|
||||
var fd = stdio.open(file,stdio.flags.O_RDONLY,fcb);
|
||||
function main(argc,argv) {
|
||||
// check there's a file to read from
|
||||
if (argc != 2) {
|
||||
stdio.write(io.stderr,'Specify a file to read\n');
|
||||
return 1; // not asyncronous yet, so just return
|
||||
}
|
||||
|
||||
// we don't want to exit the program yet,
|
||||
// so return null to let the system know that the
|
||||
// program is asyncronous (reads user data, or loads remote data)
|
||||
return null;
|
||||
// take the argument, and get it's full path
|
||||
var file = stdlib.resolvePath(argv[1]);
|
||||
|
||||
// open the file, and set the callback
|
||||
var fd = stdio.open(file,stdio.flags.O_RDONLY,fcb);
|
||||
|
||||
// we don't want to exit the program yet,
|
||||
// so return null to let the system know that the
|
||||
// program is asyncronous (reads user data, or loads remote data)
|
||||
return null;
|
||||
}
|
||||
|
||||
return main(args.length,args);
|
||||
}
|
||||
|
||||
Programs written in CLIte may be compiled using the `cc' command, this
|
||||
will turn a javascript source file into an excutable object. There is
|
||||
currently no support for compiling programs from multiple source files,
|
||||
yet. However simple single-file programs may be compiled easily, for
|
||||
instance a simple hello world's source would look like this:
|
||||
|
||||
var stdio = io.include('stdio');
|
||||
function main(argc,argv) {
|
||||
stdio.printf("Hello World!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Which would be compiled with:
|
||||
cc -o hw hw.js
|
||||
|
||||
The file 'hw' could then be executed from the shell.
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ user - user account manager
|
|||
|
||||
passwd - change user passwords
|
||||
|
||||
cc - code compiler
|
||||
|
||||
|
||||
Running any command with the argument -? will give you help for that
|
||||
program.
|
||||
|
|
|
|||
Loading…
Reference in a new issue