-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
69 lines (57 loc) · 1.33 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/***********************************************************************
* evilscheme, Copyright (c) 2012-2015, Maximilian Burke
* This file is distributed under the FreeBSD license.
* See LICENSE.TXT for details.
***********************************************************************/
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "object.h"
#include "evil_scheme.h"
#include "environment.h"
#include "gc.h"
#include "runtime.h"
#include "test.h"
#ifdef _MSC_VER
#include <malloc.h>
void *
evil_aligned_alloc(size_t alignment, size_t size)
{
return _aligned_malloc(size, alignment);
}
void
evil_aligned_free(void *ptr)
{
_aligned_free(ptr);
}
#else
void *
evil_aligned_alloc(size_t alignment, size_t size)
{
void *mem;
if (posix_memalign(&mem, alignment, size) != 0)
{
return NULL;
}
return mem;
}
void
evil_aligned_free(void *ptr)
{
free(ptr);
}
#endif
/*
* TODO: add tests for closures:
* (define closure-test (lambda (foo) (lambda () (set! foo (+ 1 foo)) foo)))
* (define closure-test-fn (closure-test 0))
* (closure-test-fn)
* (closure-test-fn)
*/
int
main(int argc, char *argv[])
{
return evil_run_tests(argc, argv);
}