Kaynağa Gözat

Fixed cosmetic incongruities

main
Ludovic 'Archivist' Lagouardette 1 ay önce
ebeveyn
işleme
d2d8e73e1e
2 değiştirilmiş dosya ile 30 ekleme ve 11 silme
  1. +24
    -9
      lib.c
  2. +6
    -2
      main.c

+ 24
- 9
lib.c Dosyayı Görüntüle

@ -40,12 +40,18 @@
#define MAX_MAIN_SIZE 256
#endif
#ifndef INK_STEP_BATCH_COUNT
#define INK_STEP_BATCH_COUNT 1
#endif
struct label {
int active;
int dest;
char* name;
};
static void noop(void) {}
#ifdef NOSTDLIB
static size_t strlen(const char* c) {
@ -436,15 +442,15 @@ static char* ink_itoa(struct context* _, int cpy) {
#ifndef NOSTDLIB
static void* ink_malloc(struct context* _, size_t sz) {
_=_;
(void)(_);
return malloc(sz);
}
static void* ink_realloc(struct context* _, void* ptr, size_t sz) {
_=_;
(void)(_);
return realloc(ptr, sz);
}
static void ink_free(struct context* _, void* ptr) {
_=_;
(void)(_);
free(ptr);
}
static int ink_putchar(struct context* _, int c) {
@ -498,7 +504,7 @@ static int ink_consume_one(int* end, struct context* pContext, char* r, int is_s
return 0;
}
#endif
is_str = is_str;
(void)(is_str);
if(*end == 0) {
return 0;
}
@ -986,7 +992,7 @@ static int ink_parse(struct context* pContext, struct elem* executable_buffer, i
function_buffer_top += 1;
break;
}
next_token: i=i;
next_token: noop();
}
#ifndef NOEXTRACHECKS
if(mode == MODE_FUNCTION || mode == MODE_DO) {
@ -2084,10 +2090,15 @@ static void dump_stack(struct context* ctx) {
return;
}
static void collect_noop() {}
static void collect_noop(struct context* ctx, void* array) {
(void)(ctx);
(void)(array);
}
static struct ink_collection_list gc_noop() {
struct ink_collection_list c;
static struct ink_collection_list gc_noop(struct context* ctx, void* array) {
struct ink_collection_list c;
(void)(ctx);
(void)(array);
c.elements = NULL;
c.count = 0;
return c;
@ -2235,7 +2246,7 @@ static void push_delimited_array(struct context* ctx) {
/* Don't copy the delimiter */
idx -= 1;
ary->elements = malloc(sizeof(struct elem) * idx);
ary->elements = ctx->malloc(ctx, sizeof(struct elem) * idx);
#ifndef NOEXTRACHECKS
if(ary->elements == NULL) {
currentRoutine->panic = -541;
@ -2507,3 +2518,7 @@ int ink_std_library(struct context* ctx) {
return v;
}
#ifdef INK_DUMMY_MAIN
int main() {}
#endif

+ 6
- 2
main.c Dosyayı Görüntüle

@ -2,8 +2,12 @@
#include <stdio.h>
#include <time.h>
#ifndef INK_SH_READ_BUFF
#define INK_SH_READ_BUFF 32768
#endif // INK_SH_READ_BUFF
int main(int argc, char** argv) {
char read_buffer[2048];
char read_buffer[n">INK_SH_READ_BUFF];
struct timespec start_time, end_time;
clock_t begin, end;
double time_spent;
@ -16,7 +20,7 @@ int main(int argc, char** argv) {
FILE* file;
size_t cnt;
file = fopen(*argv, "r");
cnt = fread(read_buffer, 1, mi">2047, file);
cnt = fread(read_buffer, 1, n">INK_SH_READ_BUFF - 1, file);
if(cnt == 0) {
fprintf(stderr, "Can't read file !! -> %s\n", *argv);
}

Yükleniyor…
İptal
Kaydet