(#910) Introduce Lt adapters
parent
b7a9785c21
commit
57c92a3be4
|
@ -34,6 +34,8 @@ add_library(system STATIC
|
|||
src/system/log_script.c
|
||||
src/system/log_script.h
|
||||
src/system/lt.h
|
||||
src/system/lt_adapters.h
|
||||
src/system/lt_adapters.c
|
||||
src/system/nth_alloc.c
|
||||
src/system/nth_alloc.h
|
||||
src/system/stacktrace.c
|
||||
|
|
|
@ -10,14 +10,10 @@
|
|||
#include "ebisp/builtins.h"
|
||||
#include "ebisp/parser.h"
|
||||
#include "system/lt.h"
|
||||
#include "system/lt_adapters.h"
|
||||
|
||||
#define MAX_BUFFER_LENGTH (5 * 1000 * 1000)
|
||||
|
||||
static void fclose_lt(void* file)
|
||||
{
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
static struct ParseResult parse_expr(Gc *gc, struct Token current_token);
|
||||
|
||||
static struct ParseResult parse_cdr(Gc *gc, struct Token current_token)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "system/stacktrace.h"
|
||||
#include "system/nth_alloc.h"
|
||||
#include "system/lt.h"
|
||||
#include "system/lt_adapters.h"
|
||||
#include "system/log.h"
|
||||
#include "system/str.h"
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "system/stacktrace.h"
|
||||
#include "system/lt.h"
|
||||
#include "system/lt_adapters.h"
|
||||
#include "system/nth_alloc.h"
|
||||
#include "system/line_stream.h"
|
||||
#include "system/str.h"
|
||||
|
@ -56,7 +57,7 @@ LevelFolder *create_level_folder(const char *dirpath)
|
|||
// TODO(#920): Level Picker is probably broken on Windows
|
||||
// We have never tested our dirent implementation on Windows. So
|
||||
// it's probably broken. We need to check it.
|
||||
DIR *level_dir = PUSH_LT(lt, opendir(dirpath), closedir);
|
||||
DIR *level_dir = PUSH_LT(lt, opendir(dirpath), closedir_lt);
|
||||
|
||||
for (struct dirent *d = readdir(level_dir);
|
||||
d != NULL;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include "system/stacktrace.h"
|
||||
#include "file.h"
|
||||
#include "lt_adapters.h"
|
||||
|
||||
int last_modified(const char *filepath, time_t *time)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "line_stream.h"
|
||||
#include "lt.h"
|
||||
#include "lt_adapters.h"
|
||||
#include "system/nth_alloc.h"
|
||||
#include "system/log.h"
|
||||
#include "system/str.h"
|
||||
|
@ -20,11 +21,6 @@ struct LineStream
|
|||
bool unfinished;
|
||||
};
|
||||
|
||||
static void fclose_lt(void* file)
|
||||
{
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
// TODO(#905): create_line_stream probably does not need mode
|
||||
// Because LineStream interface doesn't even have anything
|
||||
// for writing to files. So we can just hardcode the mode
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "file.h"
|
||||
#include "lt_adapters.h"
|
||||
|
||||
void fclose_lt(void* file)
|
||||
{
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void closedir_lt(void *dir)
|
||||
{
|
||||
closedir(dir);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#ifndef LT_ADAPTERS_H_
|
||||
#define LT_ADAPTERS_H_
|
||||
|
||||
void fclose_lt(void* file);
|
||||
void closedir_lt(void *dir);
|
||||
|
||||
#endif // LT_ADAPTERS_H_
|
Loading…
Reference in New Issue