annotate gara/main.c @ 71:75de5903355c

Giagantic changes that update Dowa library to be more align with stb style array and hashmap. Updated Seobeo to be caching on server side instead of file level caching. Deleted bunch of things I don't really use.
author June Park <parkjune1995@gmail.com>
date Sun, 28 Dec 2025 20:34:22 -0800
parents a0f0ad5e42eb
children 19cccf6e866a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
1 #include "seobeo/seobeo.h"
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
2 #include "stdio.h"
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
3
66
a0f0ad5e42eb [Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents: 45
diff changeset
4 void HandleClientRequest(Seobeo_Handle *p_cli_handle) {
45
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
5 char *hello = "Hello good sir";
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
6 Seobeo_Handle_Queue(p_cli_handle, (uint8_t*)hello, 14);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
7 Seobeo_Handle_Flush(p_cli_handle);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
8
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
9 while (1)
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
10 {
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
11 int n = Seobeo_Handle_Read(p_cli_handle);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
12 if (n > 0)
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
13 {
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
14 printf(p_cli_handle->read_buffer);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
15 Seobeo_Handle_Consume(p_cli_handle, n);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
16 }
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
17 }
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
18 }
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
19
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
20 int main()
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
21 {
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
22
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
23 printf("Server initializing\n");
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
24 const char *PORT = "3322";
66
a0f0ad5e42eb [Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents: 45
diff changeset
25 Seobeo_Handle *server = Seobeo_Stream_Handle_Server_Create(NULL, PORT);
45
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
26
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
27 printf("Server running\n");
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
28 while (1)
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
29 {
66
a0f0ad5e42eb [Misc] taking out capital P stuff.
June Park <parkjune1995@gmail.com>
parents: 45
diff changeset
30 Seobeo_Handle *p_cli_handle =
45
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
31 Seobeo_Stream_Handle_Server_Accept(server);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
32 if (!p_cli_handle) continue;
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
33
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
34 if (fork() == 0)
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
35 {
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
36 HandleClientRequest(p_cli_handle);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
37 _exit(0);
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
38 }
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
39 }
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
40
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
41 return 0;
ac8626c7859c [Gara] Re-writing basic logic in C and hoping that I can import that into Java.
MrJuneJune <me@mrjunejune.com>
parents:
diff changeset
42 }