Skip to content

Commit ee6a78d

Browse files
committed
InterfaceCompiler: More code generation stuff, Documentation: Start expading documentation
1 parent aa93fcb commit ee6a78d

File tree

19 files changed

+328
-114
lines changed

19 files changed

+328
-114
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ Ports/*
2727
Toolchain/*
2828
!Toolchain/*.sh
2929
!Toolchain/*.patch
30-
InterfaceCompiler/a.out
30+
InterfaceCompiler/lic

Documentation/Build/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Building Lemon OS and the Lemon OS Toolchain
2+
3+
### Building Lemon OS
4+
[Building Lemon OS with Docker (Recommended)](https://github.com/fido2020/Lemon-OS/wiki/Building-Lemon-OS-with-Docker)
5+
[Building Lemon OS with Docker (Requires building an LLVM toolchain which will take a decent amount of time)](https://github.com/fido2020/Lemon-OS/wiki/Building-Lemon-OS)

Documentation/Build/lic.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# LIC (Lemon Interface Compiler)
2+
3+
See [Inter-process Communication in Lemon OS](../System/IPC/README.md)
4+
5+
Usage: \
6+
`lic <source file>`

Documentation/Kernel/Network.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Kernel Network Configuration Interface

Documentation/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Lemon OS Documentation
2+
3+
[Kernel/](Kernel/README.md) Lemon Kernel
4+
5+
[System/](System/README.md) System Interfaces and Design
6+
7+
[API/](API/README.md) System APIs
8+
9+
[Userspace/](Userspace/README.md) Userspace applications (CLI and GUI)
10+
11+
[Build/](Build/README.md) Building Lemon OS and Lemon OS toolchain

Documentation/System/IPC/IPC.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

Documentation/System/IPC/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Inter-process Communication in Lemon OS
2+
3+
## Kernel-Level IPC interfaces
4+
### Services
5+
A service is a container allowing a single application to host multiple interfaces. Services also allow clients to identify and connect to an interface. An example of a service/interface pair is `lemon.lemonwm/Instance`.
6+
7+
### Interfaces
8+
An interface is a way for clients to open a connection to a server. Two operations can be performed on an interface.
9+
- ```SysInterfaceAccept``` - Accept incoming connections on an interface
10+
- ```SysInterfaceConnect``` - Connect to an interface
11+
12+
### Endpoints
13+
An endpoint can recieve from an send messages to a peer. Each endpoint has its own queue which can be read from and has a peer in which messages can be sent to.
14+
15+
## LibLemon IPC API
16+
17+
## Interface Description Language
18+
See [LIC (Lemon Interface Compiler)](../../Build/lic.md)
19+
20+
### Interfaces
21+
The `interface` keyword defines an interface. An interface consists of a server and a client. Clients can send *requests*, servers can reply with *responses*. Each request and response is given a unique ID starting from 100.
22+
23+
For each interface lic will generate the following:
24+
- A *server* class containing:
25+
- An enum with all request and response IDs (public)
26+
- A struct containing response data for each response (public)
27+
- Pure virtual callbacks for each request (protected)
28+
- A *client* class (inheriting from `Lemon::Endpoint`) containing:
29+
- A function for each request (public)
30+
31+
### Types
32+
`s8, s16, s32, s64` Signed integer \
33+
`u8. u16, u32. u64` Unsigned integer \
34+
`bool` boolean \
35+
`string` string \
36+
37+
### Requests
38+
39+
`AsynchronousRequest(string firstParameter, ...)` \
40+
`SynchronousRequest(bool firstParameter, ...) -> (s64 firstReturnParameter, ...)` \
41+
42+
Asynchronous requests do not wait for a reply (known as 'fire and forget'), these may be used in situation where there is no response needed from the server and that in the event that the server mishandles the message, the client will not have any issues.
43+
44+
Synchronous requests are useful when a reply is necessary or it is crucial that the server handles the message correctly.
45+
46+
The buffer for each request and response is stored on the stack and passed over to the endpoint.

Documentation/System/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Lemon OS System
2+
3+
[LemonWM/](LemonWM/README.md) LemonWM Interface
4+
5+
[IPC/](IPC/README.md) Inter-process communication in Lemon OS

InterfaceCompiler/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
g++ -o lic -std=c++17 main.cpp -Wall -Wextra

0 commit comments

Comments
 (0)