Commit Graph

29 Commits

Author SHA1 Message Date
Vincent Ollivier be6ca0c744
Replace some rust programs with lisp scripts (#445)
* Replace colors command with colors.lsp

* Replace geotime command with geotime.lsp

* Remove commands from shell

* Add comment
2022-11-30 23:27:15 +01:00
Vincent Ollivier ab9b488a49
Update lisp doc and examples (#428)
* Update documentation

* Add macro?

* Rewrite and and or with macros

* Move string-join

* Update built-in autocompletion

* Use define instead of def in core and examples

* Add changelog to doc

* Move aliases to lib

* Add let macro

* Add caar cadr cdar cddr functions

* Add fixme

* Fix let macro
2022-11-01 11:02:50 +01:00
Vincent Ollivier 0a29f533b2
Add TCO to Lisp (#420)
* Add TCO to Lisp

* Add sum.lsp

* Fix tests

* Refactor code

* Run clippy

* Use tmp var

* Refactor tmp

* Replace Lambda Rc by Box Lambda

* Remove exp clone

* Run clippy

* Remove another exp clone

* Reorder matches

* Remove another clone

* Run clippy

* Remove to_vec

* Add comments
2022-10-24 10:44:17 +02:00
Vincent Ollivier 1bafa2271c
Add apply to Lisp (#410)
* Replace mapcar by apply

* Add map and reduce to core lib

* Add pi.lsp example

* Fix tests

* Refactor pi-digits

* Move builtin join to core lib as string-join

* Rename decode-* and encode-* to *-decode and *-encode

* Update doc
2022-09-15 20:50:23 +02:00
Vincent Ollivier 5109608ea3
Add Conway's Game of Life (#409)
* Add the Game of Life

* Add seed interval

* Add option to load seed from file

* Add speed option

* Add a status bar at the bottom of the screen

* Refactor rules computation

* Refactor printing

* Add life to autocomplete list

* Fix autocomplete size

* Refactor file loading

* Add centinal.cells

* Add more cells files

* Add ^C to text editor

* Remove -f option

* Remove two patterns

* Remove extra newlines

* Remove code for comments

* Center cells
2022-09-10 10:57:55 +02:00
Vincent Ollivier e1be97167e
Add RTC device file (#400)
* Add RTC device file

* Add support for updating the RTC

* Handle 12 hour format

* Check date time

* Add device size
2022-08-28 18:38:48 +02:00
Vincent Ollivier 0724b5a07b
Move /ini/lisp to /lib/lisp (#398) 2022-08-27 13:07:32 +02:00
Vincent Ollivier f1a19e2055
Improve HTTP server (#391)
* Link host 8080 port to qemu 80

* Add root dir

* Add support for images

* Add Response struct

* Refactor response buffer creation

* Add index file support

* Copy www dir

* Update trailing slash rule

* Add command line arguments

* Remove strftime function

* Add read only mode

* Implement Display

* Add colored output

* Add Request struct

* Add common date time format

* Add time::now_utc

* Add connexions pool

* Reduce wait time

* Add install --yes

* Fix typo

* Add more mime types
2022-08-25 08:42:35 +02:00
Vincent Ollivier 78756bb94e
Add Brautigan poem (#373) 2022-08-01 21:28:28 +02:00
Vincent Ollivier e4ce2ab59c
Use exit code to set status var (#360)
* Use exit code

* Add macro_use to sys module

* Replace ExitCode with Result<usize, usize>

* Add status var

* Fix status code

* Replace status with ?

* Fix regex for var substitution

* Remove warnings

* Add temporary fix for failing tests

* Add q shortcut to calc

* Use usize for exit code

* Use process exit codes

* Reintroduce ExitCode enum

* Use ExitCode::UsageError where needed

* Display usage error in find command

* Add doc
2022-06-29 19:23:01 +02:00
Vincent Ollivier 82882ec355
Add shell aliases (#357)
* Add shell aliases

* Fix env output error

* Fix sort

* Read aliases from config file

* Simplify arguments parsing

* Fix test

* Clone params to spawn syscall

* Run clippy

* Revert "Clone params to spawn syscall"

This reverts commit 4c91bea196.

* Disable binary stripping

* Remove exit alias

* Update doc
2022-06-26 10:00:54 +02:00
Vincent Ollivier dd5899a74d
Read command line args from userspace programs (#351)
* Read command line args from userspace programs

* Use Stop syscall to debug pointers from userpace

* Fix address translation system

* Update binaries

* Move print to bin

* Add hardcoded alias system

* Strip debug from binaries

* Build userspace binaries before running tests

* Save all the args in args including the command invocation name

* Move sleep command to /bin

* Rebuild binaries
2022-06-14 22:43:33 +02:00
Vincent Ollivier 6e3f3afcb0
Add binaries (#350)
* Remove linker args

* Add binaries

* Read /bin for autocomplete

* Add /bin path to commands

* Remove api bin

* Remove usr reboot
2022-06-12 15:28:54 +02:00
Vincent Ollivier b2da75189f
Improve Lisp (#344)
* Add println

* Rewrite fib

* Refactor parse

* Update lisp completer

* Store args in env

* Add 'or' and 'and' builtins

* Add factorial.lsp

* Update docs

* Add cat operation

* Add join operation

* Add system command

* Add time command (#346)

* Add time command

* Fix merge artefact

* Fix call to realtime

* Replace clock syscalls with device files (#345)

* Replace clock syscalls with device files

* Add missing newline to read

* Update time command

* Use Rc<RefCell<Env>>

* Add first TCO

* Remove Box

* Change result of env_for_lambda

* Run clippy

* Remove env clone

* Remove TCO

* Change return type of env_for_lambda
2022-06-06 16:02:34 +02:00
Vincent Ollivier 28759df00c
Replace clock syscalls with device files (#345)
* Replace clock syscalls with device files

* Add missing newline to read

* Update time command
2022-06-05 13:58:05 +02:00
Vincent Ollivier f044066f77
Fix various issues while reading files (#307)
* Define device file buffer in kernel

* Implement from u8 for Device

* Reading /dev/null result in error

* Reading an empty dir should not result in error

* Print all bytes from reading devices

* Print errors while reading devices

* Handle ^C and ^D when reading /dev/console

* Create pseudo device files for clocks

* Avoid hardcoding ^C and ^D

* Add missing comment
2022-01-25 21:42:21 +01:00
Vincent Ollivier 5243c08f59 Fix dir creation during install 2022-01-22 21:31:06 +01:00
Vincent Ollivier 9708796976
Add directory support to userspace (#303)
* Create dirs from userspace

* Add delete syscall

* Add name to FileStat

* Add offset to Dir

* Add dynamic size to dir

* Add FileStat (de)serializer

* Add ReadDir#block_index

* Add FileStat::root

* Implement FileIO#read for Dir

* Add api::fs::read_dir

* Use read_dir for list command

* Allow read /path/to/dir/ commands

* Save dir size to dir entry

* Fix return value of api::fs::create_device

* Read dir from userspace

* Add proc command

* Close file handle when creating dir

* Add /dev/null

* Remove path restriction

* Allow listing of singular file

* Update doc

* Re-export fs struc in API

* Use read_dir in shell autocomplete

* Use fs::delete in httpd

* Rename stat to info

* Update doc

* Rename attributes
2022-01-18 08:44:10 +01:00
Vincent Ollivier 313f90ee73
Extend lisp language (#278)
* Add map builtin

* Rename ensure_length macro

* Update documentation

* Update map function

* Rename map to mapcar

* Add modulo to calculator

* Add division, modulo, and exponential to lisp

* Add type to built in functions

* Add string comparisons

* Update atom function

* Add basic load function

* Update load to parse multiple expressions

* Escape quote in string display

* Move print definition

* Rename read-file to read

* Simplify mapcar implementation

* Update tests

* Add comment and test

* Add standard library

* Add lib to install

* Refactor eval

* Refactor eq

* Refactor eval with ensure macros

* Add more tests

* Redefine primitives

* Move primitives to /ini/lisp/core.lsp

* Update install file

* Refactor eval

* Create /ini/lisp
2021-12-12 11:43:57 +01:00
Vincent Ollivier 749b111d68
Rewrite Lisp parser with Nom (#277)
* Rewrite Lisp parser

* Parse special symbols

* Add eval for calculator

* Replace original parser with the new one

* Handle escaped chars in strings

* Add more special characters to parser

* Refactor eval

* Add operations on files

* Refactor more of eval

* Add number parsing

* Refactor eval

* Improve error messages

* Use .lsp for lisp files

* Refactor eval

* Add ensure_len macro
2021-12-04 13:39:14 +01:00
Vincent Ollivier d053f17124
Add shell redirections (#262)
* Reorder syscalls

* Add DUP syscall

* Add api::fs::reopen

* Add shell redirections

* Use regex to parse arrow

* Add tests

* Refactor install

* Add eprint macro

* Change exit code of empty command in shell

* Update changelog
2021-11-05 09:06:40 +01:00
Vincent Ollivier 07ff76991a
Add basic userspace (#228)
* Testing userspace code

* Update program example

* Refactor code

* Read bin from dsk/bin at compile time

* Create mapper and frame allocator during process creation

* Read bin from disk at runtime

* Add missing file

* Add missing bin

* Add src bin

* Replace debug output by a test syscall+binary

* Remove comments from asm files

* Rewrite sleep

* Replace test by hello

* Refactor hello example

* Translate address from user code segment

* Rename entry label

* Update readme and changelog

* Use entry_name for DirEntry

* Increase stack size
2021-09-24 18:19:37 +02:00
Vincent Ollivier 43ac7cdc8c
Add file syscalls (#242)
* Add file syscalls

* Change syscalls return type

* Add stat syscall

* Add file creation

* Use api::fs::read_to_string in more user programs

* Use syscalls in fs api

* Move some functions from sys::fs to api::fs

* Add FileIO for generic read and write

* Write to stdout

* Add stdout test

* Disable output

* Move FileIO to API

* Add io::stdin and io::stdout to API

* Add a real /dev/random

* Fix test

* Add missing device file

* Refactor stdin read

* Truncate read_line result if larger than buf

* Use fs::read and fs::write to copy files

* Use fs::read for user password database

* Use fs::read for vga command

* Use api::syscall::stat instead of sys::fs::File::open

* Use fs::read and fs::write in httpd

* Add RNG to API

* Add fs::open_dir and fs::create_dir

* Add fs::exists
2021-09-15 22:27:32 +02:00
Vincent Ollivier e55ff2446e
Add beep command (#234)
* Add beep command

* Add pc speaker to qemu

* Add source to beep musics

* Use beep -l instead of beep -t

* Reuse PIT manipulation from time module
2021-08-21 10:57:39 +02:00
Vincent Ollivier 5e115ced6c
Fix clippy warnings (#214)
* Fix slow zero-filled vector initialization

* Fix warnings in user command

* Fix clippy error in httpd command

* Fix warnings about using print instead println

* Fix length comparison to zero

* Fix some clippy warnings

* Fix length comparison to zero

* Fix some clippy warnings

* Fix some clippy warnings

* Fix bug introduced by clippy
2021-07-25 12:41:44 +02:00
Vincent Ollivier f1084bfd62
Refactor line editing (#212)
* Rename height and width to rows and cols

* Refactor line editing

* Add partial support of delete key

* Use parser from vte crate to strip csi

* Use parser from vte crate to read input chars

* Add suppor of delete key in serial

* Move keys handling into separate functions

* Add history navigation

* Add autocompletion

* Use Prompt for shell

* Fix shell exiting

* Leave more space for kernel on disk
2021-07-25 01:07:12 +02:00
Vincent Ollivier 8af428beab
Add Lisp interpreter (#207)
* Add lisp interpreter

* Refactor lisp code

* Add copyright notice

* Add multiplication

* Shorten type names

* Remove print import

* Add tests

* Add tests for def and fn

* Add print builtin

* Add file eval

* Add fib.ls

* Use define and lambda instead of def and fn

* Rewrite the primitive operators

* Update fibonacci example

* Add syntactic sugar for quote

* Rename console::abort to console::end_of_text

* Add console::end_of_transmission

* Remove auto parenthesis

* Fix parsing quotes

* Refactor quote primitive

* Add empty list comparison to eq primitive

* Add defun primitive

* Rename example

* Fix install path

* Add doc

* Add eq? and atom? aliases
2021-07-21 09:40:40 +02:00
Vincent Ollivier 6826a9701d
Refactor print macros (#208) 2021-07-17 20:58:04 +02:00
Vincent Ollivier 6b8de261ca
Move kernel code to api (#204)
* Move code to api

* Add palette::from_csv

* Refactor palette::from_str with tests

* Add tests to api::font::from_bytes

* Add TODO comments to fs code

* Rename kernel and user dirs to sys and usr

* Add missing files from migration

* Move console::Style to api

* Add more missing changes
2021-07-16 10:19:18 +02:00