first commit of the recode
70% of the code was re-writter from scratch
This commit is contained in:
22
tests/Makefile
Normal file
22
tests/Makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
SRC = lib_use.c
|
||||
OBJ = $(SRC:.c=.o)
|
||||
NAME = lib_use
|
||||
CFLAGS = -Wall -Wextra -Wpedantic -I../include
|
||||
CLIBS = ../libpasm.a
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJ)
|
||||
cd .. && $(MAKE) lib
|
||||
gcc $(SRC) $(CFLAGS) $(CLIBS) -o $(NAME)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
re: fclean
|
||||
re: $(NAME)
|
||||
|
||||
.PHONY : all $(NAME) clean fclean re
|
||||
12
tests/interpreter.c
Normal file
12
tests/interpreter.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "../include/pasm.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 2 || strcmp(argv[1], "-h") == 0) {
|
||||
fprintf(stderr, "Usage : %s filename\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
return pasm_run_script(argv[1], 0, 0, stderr);
|
||||
}
|
||||
11
tests/lib_use.c
Normal file
11
tests/lib_use.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "../include/pasm.h"
|
||||
|
||||
int main(void) {
|
||||
char output[1024] = {0};
|
||||
FILE *memfile = fmemopen(output, sizeof(output), "w");
|
||||
|
||||
pasm_run_script("../examples/test.pasm", 0, 0, memfile);
|
||||
fclose(memfile);
|
||||
printf("%s", output);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user