-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1d6d0e3
Showing
18 changed files
with
449 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
htmc version 24.10.20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Alessandro Salerno | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# `latest-linux-bundle` | ||
Here you can find build artifacts from the latest build of the `main` branch! | ||
|
||
These artifacts are for Linux only and include: | ||
|
||
| File | Location | Type | Description | | ||
| - | - | - | - | | ||
| `htmc` | `bin/htmc` | ELF executable | htmc executable program | | ||
| `libhtmc.a` | `bin/libhtmc.a` | Static library archive | htmc in library format | | ||
| `htmc-cgi-ws` | `bin/htmc-cgi-ws` | ELF executable | CGI Web Server for htmc | | ||
| `libhtmc.h` | `include/libhtmc/libhtmc.h` | C header | header for libhtmc | | ||
| `.htmc-version` | `.htmc-version` | Plain text file | htmc version file containing the output of `./bin/htmc --version` | |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-Iinclude/ | ||
-std=c2x | ||
-DHTMC_CGI_INTF | ||
-DEXT_HTMC_BUILD="\"PLACEHOLDER\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<html> | ||
<head> | ||
<title>htmc test page</title> | ||
</head> | ||
|
||
<body> | ||
<h1>htmc test page</h1> | ||
<p>Following are the first n positive integers</p> | ||
|
||
<p> | ||
<?c | ||
int max_num = 100; | ||
int scanf_read = htmc_query_scanf("max=%d", &max_num); | ||
|
||
for (int i = 0; i < max_num; i++) { | ||
htmc_printf("%d ", i); | ||
} | ||
?> | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
#include <stdbool.h> | ||
|
||
typedef struct { | ||
const char *input_file; | ||
const char *output_path; | ||
bool stop_splash; | ||
bool log_level_set; | ||
} cli_info_t; | ||
|
||
typedef int (*cli_fcn_t)(cli_info_t *info, const char *next); | ||
typedef int (*cli_exec_t)(cli_info_t info); | ||
|
||
typedef struct { | ||
const char *short_option; | ||
const char *full_option; | ||
cli_fcn_t handler; | ||
bool has_argument; | ||
cli_exec_t exec_handler; | ||
} cli_opt_desc_t; | ||
|
||
// Support functions | ||
void print_program_version(); | ||
void print_program_info(); | ||
|
||
// Handler functions (cli_fcn_t) | ||
int flag_no_splash(cli_info_t *info, const char *next); | ||
int flag_output(cli_info_t *info, const char *next); | ||
int flag_log_level(cli_info_t *info, const char *next); | ||
|
||
// Setup for executable functions | ||
int setup_cli_version(cli_info_t *info, const char *next); | ||
|
||
// Executable functions (cli_exec_t) | ||
int cli_help(cli_info_t info); | ||
int cli_license(cli_info_t info); | ||
int cli_version(cli_info_t info); | ||
int cli_translate(cli_info_t info); | ||
int cli_compile(cli_info_t info); | ||
int cli_run(cli_info_t info); | ||
int cli_load_shared(cli_info_t info); | ||
int cli_run(cli_info_t info); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
int compile_c_output(const char *src_path, const char *dst_path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
#include <stdio.h> | ||
|
||
void emit_str(FILE *dst_file, const char *str); | ||
void emit_base(FILE *dst_file); | ||
void emit_end(FILE *dst_file); | ||
void emit_html_base(FILE *dst_file); | ||
void emit_html_end(FILE *dst_file); | ||
void emit_html_block(FILE *dst_file); | ||
void emit_html_block_end(FILE *dst_file); | ||
void emit_char(FILE *dst_file, char chr); | ||
void emit_char_escaped(FILE *dst_file, char chr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
#include <stdio.h> | ||
|
||
// These functions compare the "last modified" value of two files | ||
// Return values: | ||
// * negative integer if the left file is older (right is newer) | ||
// * positive integer if the left file is newer (right is older) | ||
// * zero if they are equal or if one does not exist | ||
// The idea behind using zero as error is that, in any case, | ||
// if the two files were changed at the same time, when checking | ||
// for caching, it is safer to rebuild the file | ||
double fscache_cmp_ff(FILE *f1, FILE *f2); | ||
double fscache_cmp_pp(const char *p1, const char *p2); | ||
double fscache_cmp_fp(FILE *f1, const char *f2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
#include <stdarg.h> | ||
#include <stddef.h> | ||
|
||
#include "libhtmc/libhtmc.h" | ||
|
||
int impl_debug_vprintf(htmc_handover_t *handover, | ||
const char *fmt, | ||
va_list args); | ||
int impl_debug_puts(htmc_handover_t *handover, const char *s); | ||
void *impl_debug_alloc(htmc_handover_t *handover, size_t nbytes); | ||
void impl_debug_free(htmc_handover_t *handover, void *ptr); | ||
|
||
int impl_base_query_vscanf(htmc_handover_t *handover, | ||
const char *fmt, | ||
va_list args); | ||
int impl_base_form_vscanf(htmc_handover_t *handover, | ||
const char *fmt, | ||
va_list args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
#include <stdarg.h> | ||
#include <stdbool.h> | ||
#include <stdio.h> | ||
|
||
typedef enum htmc_handover_variant { | ||
HTMC_BASE_HANDOVER | ||
} htmc_handover_variant_t; | ||
|
||
typedef struct htmc_handover htmc_handover_t; | ||
typedef struct htmc_handover { | ||
const htmc_handover_variant_t variant_id; | ||
int (*vprintf)(htmc_handover_t *handover, const char *fmt, va_list args); | ||
int (*puts)(htmc_handover_t *handover, const char *s); | ||
int (*query_vscanf)(htmc_handover_t *handover, const char *fmt, va_list args); | ||
int (*form_vscanf)(htmc_handover_t *handover, const char *fmt, va_list args); | ||
void *(*alloc)(htmc_handover_t *handover, size_t nbytes); | ||
void (*free)(htmc_handover_t *handover, void *ptr); | ||
|
||
const char *request_method; | ||
const char *query_string; | ||
size_t content_length; | ||
const char *content_type; | ||
const char *request_body; | ||
} htmc_handover_t; | ||
|
||
void htmc_bind(htmc_handover_t *handover); | ||
int htmc_printf(const char *fmt, ...); | ||
int htmc_vprintf(const char *fmt, va_list args); | ||
int htmc_puts(const char *s); | ||
int htmc_query_scanf(const char *fmt, ...); | ||
int htmc_query_vscanf(const char *fmt, va_list args); | ||
int htmc_form_scanf(const char *fmt, ...); | ||
int htmc_form_vscafn(const char *fmt, va_list args); | ||
void *htmc_alloc(size_t nbytes); | ||
void htmc_free(void *ptr); | ||
void htmc_error(const char *fmt, ...); | ||
void htmc_verror(const char *fmt, va_list args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// MIT License | ||
// | ||
// Copyright (c) 2024 Alessandro Salerno | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
#include <stdbool.h> | ||
|
||
#include "libhtmc/libhtmc.h" | ||
|
||
#define HTMC_ENTRY_POINT_SYM "htmc_main" | ||
|
||
typedef int (*htmc_entry_point_t)(htmc_handover_t *); | ||
|
||
void *load_htmc_so(const char *so_file_path); | ||
htmc_entry_point_t get_htmc_entry_point(void *so_handle); | ||
int call_htmc_entry(htmc_entry_point_t entry_point, htmc_handover_t *handover); | ||
int run_htmc_so(const char *so_file_path, htmc_handover_t *handover); |
Oops, something went wrong.