Files
c_soft/main.c

63 lines
928 B
C
Raw Normal View History

2024-06-18 19:37:43 +08:00
#include "stdio.h"
#include "regex.h"
#include "stdlib.h"
#include "stdint.h"
#include "soft/exception.h"
#include "soft/mythread.h"
#include "unistd.h"
#include "soft/debug.h"
2024-10-30 19:08:46 +08:00
#include "string.h"
#include "soft/clexical.h"
2024-06-18 19:37:43 +08:00
2024-10-30 19:08:46 +08:00
2024-11-28 19:11:39 +08:00
const char g_str[] =
"int main() {\n"
" int index=-1000;\n"
" while(index--){\n"
" printf(index>=0);\n"
" }\n"
2024-10-30 19:08:46 +08:00
"}";
2024-12-27 19:07:01 +08:00
__attribute__((weak)) int thread_fun(void* t) {
2025-06-26 16:15:07 +08:00
DBG_LOG("run in default thread_fun.\n");
2024-12-31 16:29:03 +08:00
// lex_analysis(g_str , strlen(g_str));
2024-06-18 19:37:43 +08:00
return 0;
}
2024-12-31 16:29:03 +08:00
int g_argc;
char** g_argv;
2024-06-18 19:37:43 +08:00
2024-12-31 16:29:03 +08:00
void set_argv(int argc, char* argv[]) {
g_argc = argc;
g_argv = argv;
}
int get_argv(char** argv[]) {
*argv = (g_argv);
return g_argc;
}
2024-06-18 19:37:43 +08:00
void SystemInit();
extern char **environ;
2024-12-31 16:29:03 +08:00
int main(int argc, char* argv[]) {
set_argv(argc, argv);
debug_init(NULL);
2024-12-31 16:29:03 +08:00
DBG_INFO("hello world.%ld\n", (size_t)pthread_self());
2024-06-18 19:37:43 +08:00
2025-06-25 11:29:06 +08:00
myth_create(thread_fun, NULL,"main_thread");
2024-06-18 19:37:43 +08:00
2025-06-26 00:33:08 +08:00
myth_join();
2024-06-18 19:37:43 +08:00
}