Browse Source

move stuff around, fix strset issue

master
Martin Dørum 3 years ago
parent
commit
5b5dc3a43d
11 changed files with 4 additions and 5 deletions
  1. 1
    1
      build.bx
  2. 0
    0
      cmd/main.c
  3. 0
    3
      include/lang2/vm/vm.h
  4. 0
    0
      lib/bitset.c
  5. 0
    0
      lib/gen/gen.c
  6. 0
    0
      lib/io.c
  7. 0
    0
      lib/parse/lex.c
  8. 0
    0
      lib/parse/parse.c
  9. 3
    1
      lib/strset.c
  10. 0
    0
      lib/vm/namespace.c
  11. 0
    0
      lib/vm/vm.c

+ 1
- 1
build.bx View File

@@ -1,2 +1,2 @@
includes := include/lang2
files := src
files := lib cmd

src/main.c → cmd/main.c View File


+ 0
- 3
include/lang2/vm/vm.h View File

@@ -35,8 +35,6 @@ struct l2_vm_array {
l2_word data[];
};

void l2_vm_array_mark(struct l2_vm_value *arr);

struct l2_vm_namespace {
struct l2_vm_value *parent;
size_t len;
@@ -45,7 +43,6 @@ struct l2_vm_namespace {
l2_word data[];
};

void l2_vm_namespace_mark(struct l2_vm_value *ns);
void l2_vm_namespace_set(struct l2_vm_value *ns, l2_word key, l2_word val);
l2_word l2_vm_namespace_get(struct l2_vm_value *ns, l2_word key);


src/bitset.c → lib/bitset.c View File


src/gen/gen.c → lib/gen/gen.c View File


src/io.c → lib/io.c View File


src/parse/lex.c → lib/parse/lex.c View File


src/parse/parse.c → lib/parse/parse.c View File


src/strset.c → lib/strset.c View File

@@ -35,7 +35,7 @@ void grow(struct l2_strset *set) {
for (size_t j = 0; ; ++j) {
size_t index = (h + j) & set->mask;
char *k = set->keys[index];
if (k == NULL || strcmp(oldkey, k) != 0) {
if (k != NULL) {
continue;
}

@@ -79,6 +79,7 @@ size_t l2_strset_put_move(struct l2_strset *set, char **str) {
if (k == NULL) {
set->keys[index] = *str;
set->vals[index] = set->next++;
set->len += 1;
*str = NULL;
return set->vals[index];
} else if (strcmp(*str, k) == 0) {
@@ -101,6 +102,7 @@ size_t l2_strset_put_copy(struct l2_strset *set, const char *str) {
if (k == NULL) {
set->keys[index] = strdup(str);
set->vals[index] = set->next++;
set->len += 1;
return set->vals[index];
} else if (strcmp(str, k) == 0) {
return set->vals[index];

src/vm/namespace.c → lib/vm/namespace.c View File


src/vm/vm.c → lib/vm/vm.c View File


Loading…
Cancel
Save