commit 4e11e68437bd1e1eba16fc95073f027e2ad36d4a Author: lixulun Date: Mon May 25 17:58:51 2026 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c0160d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +out/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..629ce23 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +## An echo server write in C3 lang \ No newline at end of file diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/.gitkeep b/lib/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/project.json b/project.json new file mode 100644 index 0000000..cae402e --- /dev/null +++ b/project.json @@ -0,0 +1,45 @@ +{ + // Language version of C3. + "langrev": "1", + // Warnings used for all targets. + "warnings": [ "no-unused" ], + // Directories where C3 library files may be found. + "dependency-search-paths": [ "lib" ], + // Libraries to use for all targets. + "dependencies": [ ], + // Authors, optionally with email. + "authors": [ "John Doe " ], + // Version using semantic versioning. + "version": "0.1.0", + // Sources compiled for all targets. + "sources": [ "src/**" ], + // Test sources compiled for all targets. + "test-sources": [ "test/**" ], + // C sources if the project also compiles C sources + // relative to the project file. + // "c-sources": [ "csource/**" ], + // Include directories for C sources relative to the project file. + // "c-include-dirs": [ "csource/include" ], + // Build location, relative to project file. + "build-dir": "build", + // Output location, relative to project file. + "output": "build", + // Architecture and OS target. + // You can use 'c3c --list-targets' to list all valid targets. + // "target": "windows-x64", + // Targets. + "targets": { + "tcp_echo": { + // Executable or library. + "type": "executable", + // Additional libraries, sources + // and overrides of global settings here. + }, + }, + // Global settings. + // CPU name, used for optimizations in the LLVM backend. + "cpu": "generic", + // Optimization: "O0", "O1", "O2", "O3", "O4", "O5", "Os", "Oz". + "opt": "O0" + // See resources/examples/project_all_settings.json and 'c3c --list-project-properties' to see more properties. +} \ No newline at end of file diff --git a/resources/.gitkeep b/resources/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/scripts/.gitkeep b/scripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/.gitkeep b/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/main.c3 b/src/main.c3 new file mode 100644 index 0000000..9ed35f8 --- /dev/null +++ b/src/main.c3 @@ -0,0 +1,8 @@ +module tcp_echo; +import std::io; + +fn int main(String[] args) +{ + io::printn("Hello, World!"); + return 0; +} diff --git a/src/server.c3 b/src/server.c3 new file mode 100644 index 0000000..b2d9aff --- /dev/null +++ b/src/server.c3 @@ -0,0 +1,13 @@ +module server; +import std::net::tcp; + +// run_server block +// handle(str message) -> message + +fn String handle(String message) { + return message; +} + +fn TcpServerSocket run_server(String host, int port) { + TcpServerSocket socket = connect_to(host, port); +} diff --git a/test/.gitkeep b/test/.gitkeep new file mode 100644 index 0000000..e69de29