forked from starnakin/IronGOLEM
Compare commits
No commits in common. "6051375f6ad3c1d1827afdbdf5964af540b5fd64" and "29c3992343db30013f20f409346b901ac6d8d846" have entirely different histories.
6051375f6a
...
29c3992343
24
README.md
24
README.md
@ -1,24 +0,0 @@
|
|||||||
# IronGOLEM
|
|
||||||
librairy for [Golem Programming Language](https://golem.re)
|
|
||||||
|
|
||||||
## How to use in your projet
|
|
||||||
You can simply add the [latest release](https://git.chauvet.pro/starnakin/IronGOLEM/releases) to your golem projet and merge IronGolem.asm with your own .asm
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
- [orga](https://kdx.re/cgit/orga/)
|
|
||||||
- [golem](https://kdx.re/cgit/golem/)
|
|
||||||
|
|
||||||
## Build
|
|
||||||
``` bash
|
|
||||||
./run.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## Fonctions list
|
|
||||||
- [aton](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/aton)
|
|
||||||
- [aton_s](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/aton_s)
|
|
||||||
- [bzero](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/bzero)
|
|
||||||
- [aton_s](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/aton_s)
|
|
||||||
- [galloc](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/galloc)
|
|
||||||
- [free](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/free)
|
|
||||||
- [ntoa](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/ntoa)
|
|
||||||
- [ntoa_s](https://git.chauvet.pro/starnakin/IronGOLEM/wiki/ntoa_s)
|
|
4
run.sh
4
run.sh
@ -1,4 +1,4 @@
|
|||||||
cat src/* >tmp.🗿
|
cat src/* >tmp.🗿
|
||||||
golemc tmp.🗿 >tmp.asm
|
golemc tmp.🗿 >tmp.asm
|
||||||
# orgaasm tmp.asm tmp.rom
|
orgaasm tmp.asm tmp.rom
|
||||||
# orgaemu tmp.rom
|
orgaemu tmp.rom
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
aton_s(str)
|
atoi(str)
|
||||||
{
|
{
|
||||||
local i = 0;
|
local i = 0;
|
||||||
local sign = 0;
|
local sign = 0;
|
18
src/aton.🗿
18
src/aton.🗿
@ -1,18 +0,0 @@
|
|||||||
aton(str)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
local out = 0;
|
|
||||||
|
|
||||||
loop {
|
|
||||||
if ([str + i] != '+')
|
|
||||||
break;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
loop {
|
|
||||||
if ([str + i] == 0 | isdigit([str + i]) == 0)
|
|
||||||
break;
|
|
||||||
out = out * 10 + [str + i] - '0';
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
define NUM_MAX = 0xffff;
|
|
||||||
define NUM_MIN = 0x0000;
|
|
||||||
define NUM_S_MIN = 0x8000;
|
|
||||||
define NUM_S_MAX = 0x7fff;
|
|
||||||
define NULL = 0;
|
|
||||||
define ZIED = NUM_MAX;
|
|
@ -1,13 +0,0 @@
|
|||||||
free_tab(tab)
|
|
||||||
{
|
|
||||||
local tmp = tab;
|
|
||||||
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if ([tmp] == 0)
|
|
||||||
return;
|
|
||||||
free([tmp]);
|
|
||||||
tmp++;
|
|
||||||
}
|
|
||||||
free(tab);
|
|
||||||
}
|
|
38
src/galloc.🗿
38
src/galloc.🗿
@ -33,7 +33,7 @@ define LOCATION_PREV = 3;
|
|||||||
define LOCATION_NEXT = 4;
|
define LOCATION_NEXT = 4;
|
||||||
define LOCATION_DATA = HEADER_SIZE + PADDING_SIZE;
|
define LOCATION_DATA = HEADER_SIZE + PADDING_SIZE;
|
||||||
|
|
||||||
galloc_setup_header(ptr, used, size, next_block, prev_block)
|
setup_header(ptr, used, size, next_block, prev_block)
|
||||||
{
|
{
|
||||||
local i;
|
local i;
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ galloc_setup_header(ptr, used, size, next_block, prev_block)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
galloc_find_next_space(size)
|
find_next_space(size)
|
||||||
{
|
{
|
||||||
local current;
|
local current;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ galloc_find_next_space(size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
galloc_print_heap()
|
print_heap()
|
||||||
{
|
{
|
||||||
local i;
|
local i;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ galloc_print_heap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
galloc_split_block(ptr, size)
|
split_block(ptr, size)
|
||||||
{
|
{
|
||||||
local old_next;
|
local old_next;
|
||||||
local next;
|
local next;
|
||||||
@ -100,9 +100,9 @@ galloc_split_block(ptr, size)
|
|||||||
old_next = [ptr + LOCATION_NEXT];
|
old_next = [ptr + LOCATION_NEXT];
|
||||||
next = ptr + size + HEADER_SIZE + PADDING_SIZE * 2;
|
next = ptr + size + HEADER_SIZE + PADDING_SIZE * 2;
|
||||||
prev = [ptr + LOCATION_PREV];
|
prev = [ptr + LOCATION_PREV];
|
||||||
🗿 galloc_setup_header(ptr, used, size, next_block, prev_block);
|
🗿 setup_header(ptr, used, size, next_block, prev_block);
|
||||||
galloc_setup_header(ptr, 1, size, ptr + HEADER_SIZE + PADDING_SIZE * 2 + size, prev);
|
setup_header(ptr, 1, size, ptr + HEADER_SIZE + PADDING_SIZE * 2 + size, prev);
|
||||||
galloc_setup_header(next, 0, old_size - size - HEADER_SIZE - PADDING_SIZE * 2, old_next, ptr);
|
setup_header(next, 0, old_size - size - HEADER_SIZE - PADDING_SIZE * 2, old_next, ptr);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ galloc(size)
|
|||||||
local ptr;
|
local ptr;
|
||||||
|
|
||||||
if ([heap] == 0) 🗿 if the heap is not initialised
|
if ([heap] == 0) 🗿 if the heap is not initialised
|
||||||
galloc_setup_header(heap, 0, HEAP_SIZE - HEADER_SIZE - PADDING_SIZE * 2, 0, 0); 🗿 initialised all the heap
|
setup_header(heap, 0, HEAP_SIZE - HEADER_SIZE - PADDING_SIZE * 2, 0, 0); 🗿 initialised all the heap
|
||||||
ptr = galloc_find_next_space(size);
|
ptr = find_next_space(size);
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
return (0);
|
return (0);
|
||||||
if ([ptr + LOCATION_SIZE] == size)
|
if ([ptr + LOCATION_SIZE] == size)
|
||||||
@ -120,20 +120,20 @@ galloc(size)
|
|||||||
[ptr + LOCATION_USED] = 1;
|
[ptr + LOCATION_USED] = 1;
|
||||||
return (ptr + LOCATION_DATA);
|
return (ptr + LOCATION_DATA);
|
||||||
}
|
}
|
||||||
galloc_split_block(ptr, size);
|
split_block(ptr, size);
|
||||||
return (ptr + LOCATION_DATA);
|
return (ptr + LOCATION_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
galloc_merge_blocks(first_block, last_block)
|
merge_blocks(first_block, last_block)
|
||||||
{
|
{
|
||||||
local size;
|
local size;
|
||||||
|
|
||||||
if (last_block == first_block)
|
if (last_block == first_block)
|
||||||
{
|
{
|
||||||
galloc_setup_header(first_block, 0, [first_block + LOCATION_SIZE], [first_block + LOCATION_NEXT], [first_block + LOCATION_PREV]);
|
setup_header(first_block, 0, [first_block + LOCATION_SIZE], [first_block + LOCATION_NEXT], [first_block + LOCATION_PREV]);
|
||||||
}
|
}
|
||||||
size = last_block - first_block + [last_block + LOCATION_SIZE];
|
size = last_block - first_block + [last_block + LOCATION_SIZE];
|
||||||
galloc_setup_header(first_block, 0, size, [last_block + LOCATION_NEXT], [first_block + LOCATION_PREV]);
|
setup_header(first_block, 0, size, [last_block + LOCATION_NEXT], [first_block + LOCATION_PREV]);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ptr)
|
free(ptr)
|
||||||
@ -144,11 +144,6 @@ free(ptr)
|
|||||||
local first_block;
|
local first_block;
|
||||||
local last_block;
|
local last_block;
|
||||||
|
|
||||||
if (ptr > heap + HEAP_SIZE | heap > ptr)
|
|
||||||
{
|
|
||||||
putstr("Error: free: invalid ptr\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
block = ptr - LOCATION_DATA;
|
block = ptr - LOCATION_DATA;
|
||||||
prev_block = [block + LOCATION_PREV];
|
prev_block = [block + LOCATION_PREV];
|
||||||
if (prev_block == 0 | [prev_block + LOCATION_USED])
|
if (prev_block == 0 | [prev_block + LOCATION_USED])
|
||||||
@ -160,10 +155,5 @@ free(ptr)
|
|||||||
last_block = block;
|
last_block = block;
|
||||||
else
|
else
|
||||||
last_block = next_block;
|
last_block = next_block;
|
||||||
galloc_merge_blocks(first_block, last_block);
|
merge_blocks(first_block, last_block);
|
||||||
}
|
|
||||||
|
|
||||||
leaks()
|
|
||||||
{
|
|
||||||
return ([heap + LOCATION_NEXT] != 0);
|
|
||||||
}
|
}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
geadline(prompt) {
|
|
||||||
local capacity = 64,
|
|
||||||
size = 0,
|
|
||||||
i = 0,
|
|
||||||
c,
|
|
||||||
buf = galloc(capacity);
|
|
||||||
if (prompt)
|
|
||||||
putstr(prompt);
|
|
||||||
if (buf == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
loop {
|
|
||||||
red &c;
|
|
||||||
if ((c == 0xffff) | (c == 0x04)) {
|
|
||||||
if ((size == 0) | (c == 0xffff)) {
|
|
||||||
free(buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else if (c == 0x007f) {
|
|
||||||
if (size) {
|
|
||||||
size = size - 1;
|
|
||||||
i = i - 1;
|
|
||||||
[buf + size] = 0;
|
|
||||||
|
|
||||||
wrt 0x1b;
|
|
||||||
wrt 0x5b;
|
|
||||||
wrt 0x44;
|
|
||||||
wrt ' ';
|
|
||||||
wrt 0x1b;
|
|
||||||
wrt 0x5b;
|
|
||||||
wrt 0x44;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
size = size + 1;
|
|
||||||
if (size > capacity) {
|
|
||||||
buf = reallocarray(buf, capacity, capacity * 2);
|
|
||||||
if (buf == NULL)
|
|
||||||
return NULL;
|
|
||||||
capacity = capacity * 2;
|
|
||||||
}
|
|
||||||
[buf + i] = c;
|
|
||||||
i = i + 1;
|
|
||||||
[buf + i] = 0;
|
|
||||||
wrt c;
|
|
||||||
if (c == '\n')
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
define GET_LINE_BUFFER=100;
|
|
||||||
|
|
||||||
get_line()
|
|
||||||
{
|
|
||||||
local tmp;
|
|
||||||
local out;
|
|
||||||
local c;
|
|
||||||
local i;
|
|
||||||
|
|
||||||
out = NULL;
|
|
||||||
i = 0;
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (i % GET_LINE_BUFFER == 0)
|
|
||||||
{
|
|
||||||
tmp = reallocarray(out, i, i + GET_LINE_BUFFER + 1);
|
|
||||||
if (tmp == NULL)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
red &c;
|
|
||||||
if (c == 0xffff)
|
|
||||||
return NULL;
|
|
||||||
[tmp + i] = c;
|
|
||||||
i++;
|
|
||||||
if (c == '\n')
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
[tmp + i] = 0;
|
|
||||||
out = strdup(tmp);
|
|
||||||
free(tmp);
|
|
||||||
return out;
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
get_raw_bit(number)
|
|
||||||
{
|
|
||||||
local tab = galloc(16);
|
|
||||||
if (tab == NULL)
|
|
||||||
return (NULL);
|
|
||||||
[tab] = number & 0x8000;
|
|
||||||
[tab + 1] = number & 0x4000;
|
|
||||||
[tab + 2] = number & 0x2000;
|
|
||||||
[tab + 3] = number & 0x1000;
|
|
||||||
[tab + 4] = number & 0x800;
|
|
||||||
[tab + 5] = number & 0x400;
|
|
||||||
[tab + 6] = number & 0x200;
|
|
||||||
[tab + 7] = number & 0x100;
|
|
||||||
[tab + 8] = number & 0x80;
|
|
||||||
[tab + 9] = number & 0x40;
|
|
||||||
[tab + 10] = number & 0x20;
|
|
||||||
[tab + 11] = number & 0x10;
|
|
||||||
[tab + 12] = number & 0x8;
|
|
||||||
[tab + 13] = number & 0x4;
|
|
||||||
[tab + 14] = number & 0x2;
|
|
||||||
[tab + 15] = number & 0x1;
|
|
||||||
return tab;
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
ntoa_get_size(number)
|
itoa_get_size(number)
|
||||||
{
|
{
|
||||||
local size = 0;
|
local size = 0;
|
||||||
|
|
||||||
@ -13,12 +13,12 @@ ntoa_get_size(number)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ntoa(number)
|
itoa(number)
|
||||||
{
|
{
|
||||||
local str;
|
local str;
|
||||||
local size;
|
local size;
|
||||||
|
|
||||||
size = ntoa_get_size(number);
|
size = itoa_get_size(number);
|
||||||
str = galloc(size + 1);
|
str = galloc(size + 1);
|
||||||
if (str == 0)
|
if (str == 0)
|
||||||
return (0);
|
return (0);
|
44
src/ntoa_s.🗿
44
src/ntoa_s.🗿
@ -1,44 +0,0 @@
|
|||||||
ntoa_get_size(number)
|
|
||||||
{
|
|
||||||
local size = 0;
|
|
||||||
|
|
||||||
if (number == 0)
|
|
||||||
size++;
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (number == 0)
|
|
||||||
return (size);
|
|
||||||
number = number / 10;
|
|
||||||
size++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ntoa_s(number)
|
|
||||||
{
|
|
||||||
local str, sign, size;
|
|
||||||
|
|
||||||
if (number >= 0x8000)
|
|
||||||
{
|
|
||||||
number = 0 - number;
|
|
||||||
sign = 1;
|
|
||||||
}
|
|
||||||
size = ntoa_get_size(number);
|
|
||||||
if (sign)
|
|
||||||
size++;
|
|
||||||
str = galloc(size + 1);
|
|
||||||
if (str == 0)
|
|
||||||
return (0);
|
|
||||||
[str + size] = 0;
|
|
||||||
if (sign)
|
|
||||||
[str] = '-';
|
|
||||||
else if (number == 0)
|
|
||||||
[str] = '0';
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (number == 0)
|
|
||||||
return (str);
|
|
||||||
[str + size - 1] = number % 10 + '0';
|
|
||||||
number = number / 10;
|
|
||||||
size--;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
print_raw_bit(number)
|
|
||||||
{
|
|
||||||
local tab = get_raw_bit(number), i = 0;
|
|
||||||
puttab_num(tab, 16);
|
|
||||||
free(tab);
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
putnum(number)
|
|
||||||
{
|
|
||||||
local str;
|
|
||||||
str = ntoa(number);
|
|
||||||
if (str == 0)
|
|
||||||
return;
|
|
||||||
putstr(str);
|
|
||||||
free(str);
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
putnum_s(num_s)
|
|
||||||
{
|
|
||||||
local str = ntoa_s(num_s);
|
|
||||||
putstr(str);
|
|
||||||
free(str);
|
|
||||||
}
|
|
35
src/puttab.🗿
35
src/puttab.🗿
@ -1,35 +0,0 @@
|
|||||||
puttab_str(tab)
|
|
||||||
{
|
|
||||||
local tmp = tab;
|
|
||||||
|
|
||||||
putchar('[');
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if ([tmp] == 0)
|
|
||||||
break;
|
|
||||||
putchar('"');
|
|
||||||
putstr([tmp]);
|
|
||||||
putchar('"');
|
|
||||||
if ([tmp + 1] != 0)
|
|
||||||
putstr(", ");
|
|
||||||
tmp++;
|
|
||||||
}
|
|
||||||
putchar(']');
|
|
||||||
}
|
|
||||||
|
|
||||||
puttab_num(tab, size)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
|
|
||||||
putchar('[');
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (i == size)
|
|
||||||
break;
|
|
||||||
putnum([tab + i]);
|
|
||||||
i++;
|
|
||||||
if (i != size)
|
|
||||||
putstr(", ");
|
|
||||||
}
|
|
||||||
putchar(']');
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
reallocarray(ptr, nmemb, size)
|
|
||||||
{
|
|
||||||
local tmp;
|
|
||||||
local start;
|
|
||||||
|
|
||||||
start = ptr;
|
|
||||||
tmp = galloc(size);
|
|
||||||
if (tmp == NULL)
|
|
||||||
return NULL;
|
|
||||||
if (ptr == NULL)
|
|
||||||
return tmp;
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (start - ptr == nmemb)
|
|
||||||
break;
|
|
||||||
[tmp + start - ptr] = [start];
|
|
||||||
start++;
|
|
||||||
}
|
|
||||||
free(ptr);
|
|
||||||
return tmp;
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
replace(str, fill, start, stop)
|
|
||||||
{
|
|
||||||
local out;
|
|
||||||
local sum;
|
|
||||||
|
|
||||||
out = galloc(strlen(str) + strlen(fill) - (stop - start) + 1);
|
|
||||||
if (out == NULL)
|
|
||||||
return (NULL);
|
|
||||||
strncpy(out, str, start);
|
|
||||||
strncpy(out + start, fill, strlen(fill));
|
|
||||||
sum = start + strlen(fill);
|
|
||||||
strncpy(out + sum, str + stop, strlen(str) - stop);
|
|
||||||
[out + sum + strlen(str) - stop] = 0;
|
|
||||||
return (out);
|
|
||||||
}
|
|
69
src/split.🗿
69
src/split.🗿
@ -1,69 +0,0 @@
|
|||||||
split_delimiter_size(str, delimiter, delimiter_len)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (strncmp(str + i, delimiter, delimiter_len) != 0 | delimiter_len == 0)
|
|
||||||
return (i);
|
|
||||||
i = i + delimiter_len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
split_get_size_need(str, delimiter)
|
|
||||||
{
|
|
||||||
local tmp = str;
|
|
||||||
local len = 0;
|
|
||||||
local delimiter_len = strlen(delimiter);
|
|
||||||
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
len++;
|
|
||||||
tmp = strstr(tmp, delimiter);
|
|
||||||
if (tmp == 0 | [tmp] == 0)
|
|
||||||
return (len);
|
|
||||||
tmp = tmp + split_delimiter_size(tmp, delimiter, delimiter_len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
split_fill_tab(tab, str, delimiter, delimiter_len)
|
|
||||||
{
|
|
||||||
local tab_tmp = tab;
|
|
||||||
local tmp = str;
|
|
||||||
local next;
|
|
||||||
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
next = strstr(tmp, delimiter);
|
|
||||||
if (next != 0)
|
|
||||||
[tab_tmp] = strndup(tmp, next - tmp);
|
|
||||||
else
|
|
||||||
[tab_tmp] = strdup(tmp);
|
|
||||||
if ([tab_tmp] == 0)
|
|
||||||
{
|
|
||||||
free_tab(tab);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if (next == 0 | [next] == 0)
|
|
||||||
return (0);
|
|
||||||
tmp = next + split_delimiter_size(next, delimiter, delimiter_len);
|
|
||||||
tab_tmp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
split(str, delimiter)
|
|
||||||
{
|
|
||||||
local len, tab, delimiter_len;
|
|
||||||
|
|
||||||
delimiter_len = strlen(delimiter);
|
|
||||||
len = split_get_size_need(str, delimiter);
|
|
||||||
tab = galloc(len + 1);
|
|
||||||
if (tab == 0)
|
|
||||||
return (0);
|
|
||||||
[tab + len] = 0;
|
|
||||||
if (split_fill_tab(tab, str, delimiter, delimiter_len))
|
|
||||||
{
|
|
||||||
free(tab);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
return (tab);
|
|
||||||
}
|
|
@ -10,10 +10,8 @@ strcat(dst, src)
|
|||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
if ([src + j] == 0)
|
if ([src + j] == 0)
|
||||||
break;
|
return (dst);
|
||||||
[dst + i + j] = [src + j];
|
[dst + i + j] = [src + j];
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
[dst + i + j] = 0;
|
|
||||||
return j;
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
strchri(str, c)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
|
|
||||||
loop {
|
|
||||||
if ([str + i] == c)
|
|
||||||
return (i);
|
|
||||||
if ([str + i] == 0)
|
|
||||||
return (0 - 1);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,10 +4,8 @@ strcpy(dst, src)
|
|||||||
|
|
||||||
loop {
|
loop {
|
||||||
if ([src + i] == 0)
|
if ([src + i] == 0)
|
||||||
break;
|
return (dst);
|
||||||
[dst + i] = [src + i];
|
[dst + i] = [src + i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
[dst + i] = 0;
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
10
src/strdup.🗿
10
src/strdup.🗿
@ -1,10 +0,0 @@
|
|||||||
strdup(str)
|
|
||||||
{
|
|
||||||
local out;
|
|
||||||
|
|
||||||
out = galloc(strlen(str) + 1);
|
|
||||||
if (out == 0)
|
|
||||||
return (0);
|
|
||||||
strcpy(out, str);
|
|
||||||
return (out);
|
|
||||||
}
|
|
@ -3,11 +3,9 @@ strncpy(dst, src, size)
|
|||||||
local i = 0;
|
local i = 0;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if ([src + i] == 0 | i >= size)
|
if ([src + i] == 0 | i == size)
|
||||||
break;
|
return (dst);
|
||||||
[dst + i] = [src + i];
|
[dst + i] = [src + i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
[dst + i] = 0;
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
strndup(str, n)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
local out;
|
|
||||||
local size;
|
|
||||||
|
|
||||||
size = strlen(str);
|
|
||||||
if (size > n)
|
|
||||||
size = n;
|
|
||||||
out = galloc(size + 1);
|
|
||||||
if (out == 0)
|
|
||||||
return (0);
|
|
||||||
[out + size] = 0;
|
|
||||||
strncpy(out, str, size);
|
|
||||||
return (out);
|
|
||||||
}
|
|
15
src/strstr.🗿
15
src/strstr.🗿
@ -1,15 +0,0 @@
|
|||||||
strstr(str, to_find)
|
|
||||||
{
|
|
||||||
local to_find_size;
|
|
||||||
local tmp;
|
|
||||||
|
|
||||||
to_find_size = strlen(to_find);
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
tmp = strchr(str, [to_find]);
|
|
||||||
if (tmp == 0)
|
|
||||||
return (0);
|
|
||||||
if (strncmp(tmp, to_find, to_find_size) == 0)
|
|
||||||
return (tmp);
|
|
||||||
}
|
|
||||||
}
|
|
25
src/tabcmp.🗿
25
src/tabcmp.🗿
@ -1,25 +0,0 @@
|
|||||||
tabcmp_str(tab1, tab2)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (strcmp([tab1 + i], [tab2 + i]) | [tab1 + i] == 0)
|
|
||||||
return ([tab1 + i] - [tab2 + i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tabcmp_num(tab1, tab2, size)
|
|
||||||
{
|
|
||||||
local i = 0;
|
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
return (0);
|
|
||||||
loop
|
|
||||||
{
|
|
||||||
if (i == size & [tab1 + i] == [tab2 + i])
|
|
||||||
return ([tab1 + i] - [tab2 + i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
22
test.sh
22
test.sh
@ -1,18 +1,4 @@
|
|||||||
tester()
|
cat src/*.🗿 tests/$1.🗿 tests/test.🗿 >tmp.🗿
|
||||||
{
|
golemc tmp.🗿 > tmp.asm
|
||||||
for val in $@
|
orgaasm tmp.asm tmp.rom
|
||||||
do
|
orgaemu tmp.rom
|
||||||
echo $val
|
|
||||||
cat src/*.🗿 tests/$val.🗿 tests/test.🗿 >tmp.🗿
|
|
||||||
golemc tmp.🗿 > tmp.asm
|
|
||||||
orgaasm tmp.asm tmp.rom
|
|
||||||
orgaemu tmp.rom
|
|
||||||
echo
|
|
||||||
done
|
|
||||||
}
|
|
||||||
if [ $# -eq 0 ]
|
|
||||||
then
|
|
||||||
tester $(ls tests/ | grep -v 'test.🗿' | sed 's/^tests\///; s/\.🗿$//' | tr '\n' ' ' );
|
|
||||||
else
|
|
||||||
tester $@;
|
|
||||||
fi
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
name = "aton";
|
|
||||||
|
|
||||||
test_num(aton("33"), 33, "");
|
|
||||||
test_num(aton(""), 0, "");
|
|
||||||
test_num(aton("40"), 40, "");
|
|
||||||
test_num(aton("1"), 1, "");
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
name = "aton_s";
|
|
||||||
|
|
||||||
test_num_s(aton_s("33"), 33, "");
|
|
||||||
test_num_s(aton_s(""), 0, "");
|
|
||||||
test_num_s(aton_s("40"), 40, "");
|
|
||||||
test_num_s(aton_s("1"), 1, "");
|
|
||||||
test_num_s(aton_s("-"), 0, "");
|
|
||||||
test_num_s(aton_s("-40"), 0 - 40, "");
|
|
||||||
test_num_s(aton_s("-1"), 0 - 1, "");
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
name = "define";
|
|
||||||
|
|
||||||
test_num_s(NUM_MAX, 0 - 1, "NUM_MAX");
|
|
||||||
test_num_s(NUM_S_MAX, 0xffff / 2, "NUM_S_MAX");
|
|
||||||
test_num_s(NUM_MIN, 0, "NUM_MAX");
|
|
||||||
test_num_s(NUM_S_MIN, 0xffff / 2 + 1, "NUM_S_MAX");
|
|
||||||
test_num_s(NULL, 0, "NULL");
|
|
||||||
test_num_s(ZIED, NUM_MAX, "ZIED");
|
|
||||||
}
|
|
@ -7,18 +7,13 @@ main()
|
|||||||
name = "galloc";
|
name = "galloc";
|
||||||
|
|
||||||
ptr1 = galloc(1);
|
ptr1 = galloc(1);
|
||||||
test_num(ptr1, heap + LOCATION_DATA, "");
|
test_int(ptr1, heap + LOCATION_DATA, "");
|
||||||
free(ptr1);
|
free(ptr1);
|
||||||
|
|
||||||
ptr1 = galloc(1);
|
ptr1 = galloc(1);
|
||||||
test_num(ptr1, heap + LOCATION_DATA, "alloc after free");
|
test_int(ptr1, heap + LOCATION_DATA, "alloc after free");
|
||||||
free(ptr1);
|
free(ptr1);
|
||||||
|
|
||||||
ptr2 = galloc(0x9000);
|
ptr2 = galloc(0x9000);
|
||||||
test_num(ptr2, 0, "alloc too big");
|
test_int(ptr2, 0, "alloc too big");
|
||||||
|
|
||||||
test_num(leaks(), 0, "leaks");
|
|
||||||
ptr1 = galloc(1);
|
|
||||||
test_num(leaks(), 1, "leaks");
|
|
||||||
free(ptr1);
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
define GET_LINE=0;
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
local ptr;
|
|
||||||
|
|
||||||
name = "get_line";
|
|
||||||
if (GET_LINE == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
putstr("yo\n");
|
|
||||||
ptr = get_line();
|
|
||||||
test_str(ptr, "yo\n", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
putstr("ENTER\n");
|
|
||||||
ptr = get_line();
|
|
||||||
test_str(ptr, "\n", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
putstr("ctrl + D\n");
|
|
||||||
ptr = get_line();
|
|
||||||
test_num(ptr, NULL, "");
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local tab;
|
|
||||||
|
|
||||||
name = "get_raw_bit";
|
|
||||||
|
|
||||||
tab = get_raw_bit(1);
|
|
||||||
test_tab_num(tab, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, 16, "");
|
|
||||||
free(tab);
|
|
||||||
|
|
||||||
tab = get_raw_bit(2);
|
|
||||||
test_tab_num(tab, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, 16, "");
|
|
||||||
free(tab);
|
|
||||||
|
|
||||||
tab = get_raw_bit(0x8000);
|
|
||||||
test_tab_num(tab, {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 16, "");
|
|
||||||
free(tab);
|
|
||||||
}
|
|
@ -2,15 +2,15 @@ main()
|
|||||||
{
|
{
|
||||||
local ptr;
|
local ptr;
|
||||||
|
|
||||||
name = "ntoa";
|
name = "itoa";
|
||||||
|
|
||||||
ptr = ntoa(9000);
|
ptr = itoa(9000);
|
||||||
test_str(ptr, "9000", "");
|
test_str(ptr, "9000", "");
|
||||||
free(ptr);
|
free(ptr);
|
||||||
ptr = ntoa(55);
|
ptr = itoa(55);
|
||||||
test_str(ptr, "55", "");
|
test_str(ptr, "55", "");
|
||||||
free(ptr);
|
free(ptr);
|
||||||
ptr = ntoa(0);
|
ptr = itoa(0);
|
||||||
test_str(ptr, "0", "");
|
test_str(ptr, "0", "");
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
@ -1,26 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local ptr;
|
|
||||||
|
|
||||||
name = "ntoa_s";
|
|
||||||
|
|
||||||
ptr = ntoa_s(9000);
|
|
||||||
test_str(ptr, "9000", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = ntoa_s(55);
|
|
||||||
test_str(ptr, "55", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = ntoa_s(0);
|
|
||||||
test_str(ptr, "0", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = ntoa_s(0 - 55);
|
|
||||||
test_str(ptr, "-55", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = ntoa_s(0 - 1);
|
|
||||||
test_str(ptr, "-1", "");
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local tmp;
|
|
||||||
name = "reallocarray";
|
|
||||||
|
|
||||||
tmp = strdup("yo");
|
|
||||||
if (tmp == NULL)
|
|
||||||
return 1;
|
|
||||||
tmp = reallocarray(tmp, strlen(tmp), 5);
|
|
||||||
test_str(tmp, "yo", "");
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
name = "replace";
|
|
||||||
|
|
||||||
test_str(replace("yo ca va ?", "t", 2, 3), "yotca va ?", "");
|
|
||||||
test_str(replace("yo ca va ?", "", 2, 3), "yoca va ?", "empty fill");
|
|
||||||
test_str(replace("yo ca va ?", "aaaaa", 2, 3), "yoaaaaaca va ?", "");
|
|
||||||
test_str(replace("", "aaaaa", 0, 0), "aaaaa", "");
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local tab, reach_tab;
|
|
||||||
name = "split";
|
|
||||||
|
|
||||||
reach_tab = galloc(4);
|
|
||||||
[reach_tab] = "salut";
|
|
||||||
[reach_tab + 1] = "ca";
|
|
||||||
[reach_tab + 2] = "va";
|
|
||||||
[reach_tab + 3] = 0;
|
|
||||||
|
|
||||||
tab = split("salut ca va", " ");
|
|
||||||
test_tab_str(tab, reach_tab, "");
|
|
||||||
|
|
||||||
tab = split("salut ca va", " ");
|
|
||||||
test_tab_str(tab, reach_tab, "multiple delimiter past");
|
|
||||||
|
|
||||||
tab = split("salutbozocabozova", "bozo");
|
|
||||||
test_tab_str(tab, reach_tab, "mutiple char in delimiter");
|
|
||||||
|
|
||||||
[reach_tab] = "salut";
|
|
||||||
[reach_tab + 1] = 0;
|
|
||||||
|
|
||||||
tab = split("salut", "bozo");
|
|
||||||
test_tab_str(tab, reach_tab, "delimiter not in str");
|
|
||||||
|
|
||||||
[reach_tab] = "";
|
|
||||||
[reach_tab + 1] = 0;
|
|
||||||
tab = split("", "bozo");
|
|
||||||
test_tab_str(tab, reach_tab, "empty str");
|
|
||||||
|
|
||||||
[reach_tab] = "";
|
|
||||||
[reach_tab + 1] = 0;
|
|
||||||
tab = split("", "");
|
|
||||||
test_tab_str(tab, reach_tab, "empty delimiter and empty str🗿");
|
|
||||||
}
|
|
@ -1,14 +1,10 @@
|
|||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
local str;
|
local str;
|
||||||
|
|
||||||
name = "strchr";
|
name = "strchr";
|
||||||
|
|
||||||
str = "bozoman du 36";
|
str = "bozoman du 36";
|
||||||
test_str(strchr(str, 'z'), str + 2, "");
|
test_str(strchr(str, 'z'), str + 2, "");
|
||||||
test_str(strchr(str, 0), str + 13, "");
|
test_str(strchr(str, 0), str + 13, "");
|
||||||
test_str(strchr(str, '5'), 0, "");
|
test_str(strchr(str, '5'), 0, "");
|
||||||
test_str(strchr(str, '6'), str + 12, "");
|
test_str(strchr(str, '6'), str + 12, "");
|
||||||
test_str(strchr("", 'q'), 0, "empty str");
|
|
||||||
test_str(strchr("", 0), "", "empty str and \0 to find");
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
name = "strchri";
|
|
||||||
|
|
||||||
test_num(strchri("bozoman", 'm'), 4, "");
|
|
||||||
test_num(strchri("bozoman", 'v'), 0 - 1, "");
|
|
||||||
test_num(strchri("", 'v'), 0 - 1, "");
|
|
||||||
}
|
|
@ -2,8 +2,8 @@ main()
|
|||||||
{
|
{
|
||||||
name = "strcmp";
|
name = "strcmp";
|
||||||
|
|
||||||
test_num(strcmp("test", "test"), 0, "same chars");
|
test_int(strcmp("test", "test"), 0, "same chars");
|
||||||
test_num(strcmp("s", "b"), 17, "");
|
test_int(strcmp("s", "b"), 17, "");
|
||||||
test_num(strcmp("", ""), 0, "empty strings");
|
test_int(strcmp("", ""), 0, "empty strings");
|
||||||
test_num(strcmp("", "a"), 65439, "");
|
test_int(strcmp("", "a"), 65439, "");
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local str;
|
|
||||||
|
|
||||||
name = "strcpy";
|
|
||||||
|
|
||||||
str = galloc(10);
|
|
||||||
|
|
||||||
strcpy(str, "yo");
|
|
||||||
test_str(str, "yo", "");
|
|
||||||
|
|
||||||
strcpy(str, "");
|
|
||||||
test_str(str, "", "");
|
|
||||||
|
|
||||||
strcpy(str, "bonjorsss");
|
|
||||||
strcpy(str, "bonjour");
|
|
||||||
test_str(str, "bonjour", "set last \0");
|
|
||||||
|
|
||||||
free(str);
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local ptr;
|
|
||||||
name = "strdup";
|
|
||||||
|
|
||||||
ptr = "bozoman";
|
|
||||||
test_str(strdup(ptr), ptr, "");
|
|
||||||
|
|
||||||
ptr = "";
|
|
||||||
test_str(strdup(ptr), ptr, "");
|
|
||||||
|
|
||||||
ptr = "hello world!";
|
|
||||||
test_str(strdup(ptr), ptr, "");
|
|
||||||
}
|
|
@ -2,6 +2,6 @@ main()
|
|||||||
{
|
{
|
||||||
name = "strlen";
|
name = "strlen";
|
||||||
|
|
||||||
test_num(strlen("bozoman du 36"), 13, "");
|
test_int(strlen("bozoman du 36"), 13, "");
|
||||||
test_num(strlen(""), 0, "Empty string");
|
test_int(strlen(""), 0, "Empty string");
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@ main()
|
|||||||
{
|
{
|
||||||
name = "strncmp";
|
name = "strncmp";
|
||||||
|
|
||||||
test_num(strncmp("test", "test", 4), 0, "same chars");
|
test_int(strncmp("test", "test", 4), 0, "same chars");
|
||||||
test_num(strncmp("s", "b", 4), 17, "");
|
test_int(strncmp("s", "b", 4), 17, "");
|
||||||
test_num(strncmp("", "", 4), 0, "empty strings");
|
test_int(strncmp("", "", 4), 0, "empty strings");
|
||||||
test_num(strncmp("", "a", 0), 0, "");
|
test_int(strncmp("", "a", 0), 0, "");
|
||||||
test_num(strncmp("ab", "ac", 1), 0, "");
|
test_int(strncmp("ab", "ac", 1), 0, "");
|
||||||
test_num(strncmp("aq", "a", 1), 0, "");
|
test_int(strncmp("aq", "a", 1), 0, "");
|
||||||
test_num(strncmp("aq", "a", 2), 113, "");
|
test_int(strncmp("aq", "a", 2), 113, "");
|
||||||
}
|
}
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
local ptr;
|
|
||||||
name = "strndup";
|
|
||||||
|
|
||||||
ptr = strndup("bozoman", 7);
|
|
||||||
test_str(ptr, "bozoman", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = strndup("bozoman", 4);
|
|
||||||
test_str(ptr, "bozo", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = strndup("bozoman", 10);
|
|
||||||
test_str(ptr, "bozoman", "");
|
|
||||||
free(ptr);
|
|
||||||
|
|
||||||
ptr = strndup("bozoman", 0);
|
|
||||||
test_str(ptr, "", "");
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
main()
|
|
||||||
{
|
|
||||||
name = "strstr";
|
|
||||||
|
|
||||||
test_str(strstr("test", "t"), "test", "");
|
|
||||||
test_str(strstr("test", "st"), "st", "");
|
|
||||||
test_str(strstr("hello world!", "s"), 0, "non present to_find");
|
|
||||||
test_str(strstr("", "s"), 0, "empty str");
|
|
||||||
test_str(strstr("", ""), "", "empty str and empty to find");
|
|
||||||
}
|
|
83
tests/test.🗿
83
tests/test.🗿
@ -22,82 +22,33 @@ test_str(value, reach_value, description)
|
|||||||
wrt '\n';
|
wrt '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
test_num(value, reach_value, description)
|
test_int(value, reach_value, description)
|
||||||
{
|
{
|
||||||
|
local value_str;
|
||||||
|
local reach_value_str;
|
||||||
|
|
||||||
putstr(name);
|
putstr(name);
|
||||||
if (value != reach_value)
|
if (value != reach_value)
|
||||||
{
|
{
|
||||||
|
value_str = itoa(value);
|
||||||
|
if (value_str == 0)
|
||||||
|
return (0);
|
||||||
|
reach_value_str = itoa(reach_value);
|
||||||
|
if (reach_value_str == 0)
|
||||||
|
{
|
||||||
|
free(value_str);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
putstr(": ERROR: ");
|
putstr(": ERROR: ");
|
||||||
putstr(", ");
|
putstr(", ");
|
||||||
putstr(description);
|
putstr(description);
|
||||||
putstr(" [");
|
putstr(" [");
|
||||||
putnum(reach_value);
|
putstr(reach_value_str);
|
||||||
putstr(" != ");
|
putstr(" != ");
|
||||||
putnum(value);
|
putstr(value_str);
|
||||||
putstr("]");
|
putstr("]");
|
||||||
}
|
free(value_str);
|
||||||
else
|
free(reach_value_str);
|
||||||
{
|
|
||||||
putstr(": OK: ");
|
|
||||||
putstr(description);
|
|
||||||
}
|
|
||||||
wrt '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
test_num_s(value, reach_value, description)
|
|
||||||
{
|
|
||||||
putstr(name);
|
|
||||||
if (value != reach_value)
|
|
||||||
{
|
|
||||||
putstr(": ERROR: ");
|
|
||||||
putstr(", ");
|
|
||||||
putstr(description);
|
|
||||||
putstr(" [");
|
|
||||||
putnum_s(reach_value);
|
|
||||||
putstr(" != ");
|
|
||||||
putnum_s(value);
|
|
||||||
putstr("]");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
putstr(": OK: ");
|
|
||||||
putstr(description);
|
|
||||||
}
|
|
||||||
wrt '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
test_tab_str(value, reach_value, description)
|
|
||||||
{
|
|
||||||
putstr(name);
|
|
||||||
if (tabcmp_str(value, reach_value))
|
|
||||||
{
|
|
||||||
putstr(": ERROR: ");
|
|
||||||
putstr(", ");
|
|
||||||
putstr(description);
|
|
||||||
puttab_str(reach_value);
|
|
||||||
putstr(" != ");
|
|
||||||
puttab_str(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
putstr(": OK: ");
|
|
||||||
putstr(description);
|
|
||||||
}
|
|
||||||
wrt '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
test_tab_num(value, reach_value, size, description)
|
|
||||||
{
|
|
||||||
putstr(name);
|
|
||||||
if (tabcmp_num(value, reach_value, size))
|
|
||||||
{
|
|
||||||
putstr(": ERROR: ");
|
|
||||||
putstr(", ");
|
|
||||||
putstr(description);
|
|
||||||
puttab_num(reach_value, size);
|
|
||||||
putstr(" != ");
|
|
||||||
puttab_num(value, size);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user