Skip to content

Commit 3f21b2b

Browse files
committed
slim compiler interface a little
1 parent 55aa05e commit 3f21b2b

3 files changed

Lines changed: 9 additions & 29 deletions

File tree

compiler_intrinsics/buildlib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
gcc metac_compiler_interface.c -fPIC -shared -Os -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-stack-protector -o libcompiler.so

compiler_intrinsics/metac_compiler_interface.c

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,40 @@
11
#include <stdio.h>
2-
#include "../os/os.c"
32
#include "metac_compiler_interface.h"
43
#include "../semantic/metac_type.h"
54
#include "metac_type_kind.c"
65

76
extern metac_compiler_t compiler;
87

9-
uint32_t compiler_CurrentTimeStamp ()
10-
{
11-
uint32_t ts;
12-
OS.GetTimeStamp(&ts);
13-
return ts;
14-
}
15-
16-
void compiler_Message(struct metac_compiler_t* compilerP,
8+
static void compiler_Message(struct metac_compiler_t* compilerP,
179
const char* str)
1810
{
1911
}
2012

21-
void compiler_Error(struct metac_compiler_t* compilerP,
13+
static void compiler_Error(struct metac_compiler_t* compilerP,
2214
const char* str)
2315
{
2416

2517
}
2618

27-
metac_type_kind_t compiler_GetTypeKind (uint32_t T)
19+
static metac_type_kind_t compiler_GetTypeKind (uint32_t T)
2820
{
2921
metac_type_index_t typeIdx;
3022
typeIdx.v = T;
3123
return (metac_type_kind_t)TYPE_INDEX_KIND(typeIdx);
3224
}
3325

34-
const char* compiler_TypeKindString(metac_type_kind_t T)
26+
static const char* compiler_TypeKindString(metac_type_kind_t T)
3527
{
3628
return MetaCTypeKind_toChars(T);
3729
}
3830

39-
const char* compiler_Help ()
31+
static const char* compiler_Help ()
4032
{
4133
return "Hello I am Mr. compiler. I cannot help you ...";
4234
}
4335

4436

45-
void compiler_PrintInt(int32_t value)
46-
{
47-
char Buffer[24];
48-
int len = sprintf(Buffer, "%d", value);
49-
Buffer[len] = '\0';
50-
//compiler.Message(&compiler, Buffer, 0);
51-
fprintf(stderr, "-> %s\n", Buffer);
52-
}
53-
metac_enum_members_t* compiler_GetEnumMembers (struct metac_compiler_t* compilerP, uint32_t T)
37+
static metac_enum_members_t* compiler_GetEnumMembers (struct metac_compiler_t* compilerP, uint32_t T)
5438
{
5539

5640
}
@@ -61,7 +45,6 @@ metac_enum_members_t* compiler_GetEnumMembers (struct metac_compiler_t* compiler
6145
metac_compiler_t compiler = {
6246
0,
6347

64-
compiler_CurrentTimeStamp,
6548
compiler_Help,
6649

6750
compiler_Message,
@@ -70,8 +53,6 @@ metac_compiler_t compiler = {
7053
compiler_GetTypeKind,
7154
compiler_TypeKindString,
7255

73-
compiler_PrintInt,
74-
7556
compiler_GetEnumMembers,
7657

7758
"v0.1",

compiler_intrinsics/metac_compiler_interface.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ typedef struct metac_compiler_t
4040
{
4141
void* semanticState;
4242

43-
uint32_t (*CurrentTimeStamp) ();
44-
4543
const char* (*Help) ();
4644

4745
void (*Message) (struct metac_compiler_t* compilerP,
@@ -53,8 +51,6 @@ typedef struct metac_compiler_t
5351
metac_type_kind_t (*GetTypeKind) (uint32_t T);
5452
const char* (*TypeKindString)(metac_type_kind_t Kind);
5553

56-
void (*PrintInt) (int32_t value);
57-
5854
metac_enum_members_t* (*GetEnumMembers) (struct metac_compiler_t* compilerP, uint32_t T);
5955

6056
const char* Version;

0 commit comments

Comments
 (0)