Skip to content

Commit

Permalink
fixes bug
Browse files Browse the repository at this point in the history
  • Loading branch information
actboy168 committed Apr 11, 2024
1 parent 2b433e5 commit 2a1a515
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
8 changes: 8 additions & 0 deletions 3rd/lua/utf8_crt.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#if defined(_WIN32)

#if defined(__cplusplus)
extern "C" {
#endif

# include <stdio.h>
# include <stdlib.h>

Expand Down Expand Up @@ -34,4 +38,8 @@ void utf8_free_args(int argc, char** argv);

#endif

#if defined(__cplusplus)
}
#endif

#endif
3 changes: 2 additions & 1 deletion 3rd/lua/utf8_lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
# define main(a, b) utf8_main(a, b)
# include "lua.c"
# undef main

# include <wchar.h>

# include "utf8_crt.h"

static void enable_vtmode(HANDLE h) {
if (h == INVALID_HANDLE_VALUE) {
return;
Expand Down
3 changes: 2 additions & 1 deletion 3rd/lua/utf8_luac.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
# define main(a, b) utf8_main(a, b)
# include "luac.c"
# undef main

# include <wchar.h>

# include "utf8_crt.h"

int wmain(int argc, wchar_t **wargv) {
char **argv = utf8_create_args(argc, wargv);
if (!argv) {
Expand Down
9 changes: 1 addition & 8 deletions 3rd/lua/utf8_prefix.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
#ifndef _LUAUTF8_PREFIX_H_
#define _LUAUTF8_PREFIX_H_

#if defined(__cplusplus)
extern "C" {
#endif
#include "utf8_crt.h"
#if defined(__cplusplus)
}
#endif

#if defined(lua_c) || defined(luac_c)
#else
#if !defined(lua_c) && !defined(luac_c)
# if defined fopen
# undef fopen
# endif
Expand Down
2 changes: 0 additions & 2 deletions bootstrap/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

#if defined(_WIN32)
# include <bee/platform/win/wtf8.h>
extern "C" {
# include <3rd/lua/utf8_crt.h>
}
#endif

#include <bee/nonstd/filesystem.h>
Expand Down
2 changes: 2 additions & 0 deletions compile/lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ if lm.os == "windows" then
}
lm:executable "lua" {
deps = "lua54",
includes = ".",
sources = {
"3rd/lua/utf8_lua.c",
"3rd/lua/utf8_crt.c",
}
}
lm:executable "luac" {
includes = ".",
sources = {
"3rd/lua/onelua.c",
"3rd/lua/utf8_crt.c",
Expand Down

0 comments on commit 2a1a515

Please sign in to comment.