summaryrefslogtreecommitdiffstats
path: root/src/archive
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2025-03-02 14:21:02 +0200
committergrm <grm@eyesin.space>2025-03-02 14:21:02 +0200
commit092f4e2740a2e59a6b6c5aa064f59d9970790e23 (patch)
tree3a07a7c5bda8eaa3413ca69770e1c1380f814b9e /src/archive
parent9847614871e861c216425b95a8300dba37b0f6e6 (diff)
downloadsynth-project-092f4e2740a2e59a6b6c5aa064f59d9970790e23.tar.gz
synth-project-092f4e2740a2e59a6b6c5aa064f59d9970790e23.tar.bz2
synth-project-092f4e2740a2e59a6b6c5aa064f59d9970790e23.zip
some archive
Diffstat (limited to 'src/archive')
-rw-r--r--src/archive/cxxflags22
-rw-r--r--src/archive/microhttpd.c51
2 files changed, 73 insertions, 0 deletions
diff --git a/src/archive/cxxflags b/src/archive/cxxflags
new file mode 100644
index 0000000..bcff863
--- /dev/null
+++ b/src/archive/cxxflags
@@ -0,0 +1,22 @@
+
+void cxxflags(B_Cmd *cmd)
+{
+ b_cmd_append(cmd, "-Wall", "-Wextra");
+ b_cmd_append(cmd, "-Wno-string-plus-int", "-Wno-nullability-completeness", "-Wno-unused-function", "-Wno-missing-field-initializers", "-Wno-unused-parameter", "-Wno-unused-variable");
+
+ debug_or_release(cmd);
+
+ b_cmd_append(cmd, "-march=native");
+ b_cmd_append(cmd, "-fno-math-errno", "-funroll-loops");
+ b_cmd_append(cmd, "-flto", "-pthread");
+
+ inlcude_dirs(cmd);
+ //b_cmd_append(cmd, "-O3");
+}
+
+void cxx(B_Cmd *cmd)
+{
+ b_cmd_append(cmd, "clang");
+ cxxflags(cmd);
+}
+
diff --git a/src/archive/microhttpd.c b/src/archive/microhttpd.c
new file mode 100644
index 0000000..c75d715
--- /dev/null
+++ b/src/archive/microhttpd.c
@@ -0,0 +1,51 @@
+#include <microhttpd.h>
+
+// HTTP request handler
+enum MHD_Result handle_request(void *cls, struct MHD_Connection *connection,
+ const char *url, const char *method,
+ const char *version, const char *upload_data,
+ size_t *upload_data_size, void **con_cls) {
+ (void)version;
+ (void)upload_data;
+ (void)upload_data_size;
+ (void)con_cls;
+ struct MHD_Response *response;
+ enum MHD_Result ret;
+
+ if (strcmp(url, "/slider") == 0 && strcmp(method, "GET") == 0) {
+ const char *value_str = MHD_lookup_connection_value(connection, MHD_GET_ARGUMENT_KIND, "value");
+ if (value_str) {
+ int value = atoi(value_str);
+ handle_slider_change(cls, value);
+ }
+ response = MHD_create_response_from_buffer(0, "", MHD_RESPMEM_PERSISTENT);
+ ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+
+ if (strcmp(url, "/button") == 0 && strcmp(method, "GET") == 0) {
+ handle_button_click(cls);
+ response = MHD_create_response_from_buffer(0, "", MHD_RESPMEM_PERSISTENT);
+ ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+ MHD_destroy_response(response);
+ return ret;
+ }
+
+ response = MHD_create_response_from_buffer(strlen(html_content), (void *)html_content, MHD_RESPMEM_PERSISTENT);
+ ret = MHD_queue_response(connection, MHD_HTTP_OK, response);
+ MHD_destroy_response(response);
+ return ret;
+}
+
+
+ // Start the HTTP server
+ server = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION, HTTP_PORT, NULL, NULL, &handle_request, (void *)synth, MHD_OPTION_END);
+ if (server == NULL) {
+ fprintf(stderr, "Failed to start server\n");
+ return;
+ }
+
+
+
+ MHD_stop_daemon(server);