Skip to content

Commit 150374d

Browse files
Improve app.rc
1 parent 0b6cbb8 commit 150374d

File tree

4 files changed

+71
-32
lines changed

4 files changed

+71
-32
lines changed

Makefile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,46 @@ CFLAGS += -Wextra
2828
CFLAGS += -Wno-unused-result
2929
CFLAGS += -Wno-unused-parameter
3030
CFLAGS += -Wno-implicit-fallthrough
31+
CFLAGS += -O2
3132

3233
ifeq ($(OS), Windows_NT)
34+
3335
WINDRES = windres
34-
RES = $(BIN)/res.o
36+
RC = windows/resources/app.rc
37+
RES = $(BIN)/resources.res
38+
3539
else
40+
3641
WINDRES = echo
42+
3743
endif
3844

3945
SOARE_FLAGS :=
4046
SOARE_FLAGS += -D __SOARE_COLORED_OUTPUT
41-
# SOARE_FLAGS += -D __SOARE_DEBUG
47+
# SOARE_FLAGS += -D __SOARE_DEBUG
4248

4349
default: $(BIN)/$(APP)
4450

4551
$(LIB)/libsoare$(VERSION_MAJOR).a: $(CORE_OBJS)
4652

4753
CORE_OBJS := $(patsubst $(CORE)/%.c, $(LIB)/%.o, $(wildcard $(CORE)/*.c))
4854

55+
$(BIN):
56+
mkdir $(BIN)
57+
4958
$(LIB):
50-
mkdir -p $(LIB)
59+
mkdir $(LIB)
60+
61+
$(RES):
62+
$(WINDRES) $(RC) -O coff -o $(RES)
5163

5264
$(LIB)/%.o: $(CORE)/%.c
5365
$(CC) -c $< -o $@ -I $(INCLUDE) $(CFLAGS) $(SOARE_FLAGS)
5466

55-
$(BIN)/$(APP): $(LIB) $(CORE_OBJS) $(SRC)/Main.c
56-
mkdir -p $(BIN)
57-
$(WINDRES) windows/resources/app.rc -coff $(RES)
67+
$(BIN)/$(APP): $(BIN) $(LIB) $(RES) $(CORE_OBJS)
5868
$(AR) rcs $(LIB)/libsoare$(VERSION_MAJOR).a $(CORE_OBJS)
5969
$(CC) $(RES) $(SRC)/*.c -o $(BIN)/$(APP) -I $(INCLUDE) -L$(LIB) -lsoare$(VERSION_MAJOR) $(CFLAGS) $(SOARE_FLAGS)
60-
rm $(CORE_OBJS) $(RES)
70+
rm $(CORE_OBJS)
6171

6272
run:
6373
$(BIN)/$(APP)

core/Math.c

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -356,17 +356,19 @@ static char *Array(char *value, AST array)
356356
*/
357357
char *Math(AST tree)
358358
{
359-
long double dx, dy;
360-
char *sx, *sy;
361-
char *result = NULL;
362-
363-
MEM get = NULL;
364-
365359
switch (tree->type)
366360
{
367-
case NODE_MEMGET:
361+
case NODE_VALUE:
362+
363+
return strdup(tree->value);
368364

369-
get = MemGet(MEMORY, tree->value);
365+
case NODE_CALL:
366+
367+
return RunFunction(tree);
368+
369+
case NODE_MEMGET:
370+
{
371+
MEM get = MemGet(MEMORY, tree->value);
370372

371373
if (!get)
372374
return LeaveException(UndefinedReference, tree->value, tree->file);
@@ -375,19 +377,12 @@ char *Math(AST tree)
375377
return LeaveException(VariableDefinedAsFunction, tree->value, tree->file);
376378

377379
return strdup(get->value);
378-
379-
case NODE_CALL:
380-
381-
return RunFunction(tree);
382-
383-
case NODE_VALUE:
384-
385-
return strdup(tree->value);
380+
}
386381

387382
case NODE_OPERATOR:
388-
389-
sx = Eval(tree->child);
390-
sy = Eval(tree->child->sibling);
383+
{
384+
char *sx = Eval(tree->child);
385+
char *sy = Eval(tree->child->sibling);
391386

392387
if (!sx || !sy)
393388
{
@@ -396,6 +391,8 @@ char *Math(AST tree)
396391
return NULL;
397392
}
398393

394+
char *result = NULL;
395+
399396
switch (*(tree->value))
400397
{
401398
case ',':
@@ -424,8 +421,9 @@ char *Math(AST tree)
424421
break;
425422
}
426423

427-
dx = strtold(sx, &result);
428-
dy = strtold(sy, &result);
424+
long double dx = strtold(sx, &result);
425+
long double dy = strtold(sy, &result);
426+
429427
free(sx);
430428
free(sy);
431429

@@ -434,11 +432,13 @@ char *Math(AST tree)
434432

435433
switch (*(tree->value))
436434
{
435+
// < or <=
437436
case '<':
438-
return __boolean(dx < dy || (dx == dy && tree->value[1] == '='));
437+
return __boolean(dx < dy || (tree->value[1] == '=' && dx == dy));
439438

439+
// > or >=
440440
case '>':
441-
return __boolean(dx > dy || (dx == dy && tree->value[1] == '='));
441+
return __boolean(dx > dy || (tree->value[1] == '=' && dx == dy));
442442

443443
case '&':
444444
return __boolean(dx && dy);
@@ -467,6 +467,7 @@ char *Math(AST tree)
467467
default:
468468
return LeaveException(MathError, tree->value, tree->file);
469469
}
470+
}
470471

471472
default:
472473
return LeaveException(MathError, tree->value, tree->file);

core/Runtime.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ static char *Runtime(AST tree)
340340
int Execute(char *__restrict__ file, char *__restrict__ rawcode)
341341
{
342342
if (!MEMORY)
343-
// Set default vars..
344343
MEMORY = Mem();
345344

346345
// Clear interpreter exception

windows/resources/app.rc

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
soare ICON "../../resources/icon/icon.ico"
1+
SOARE ICON "../../resources/icon/icon.ico"
2+
3+
1 VERSIONINFO
4+
FILEVERSION 1,0,0,0
5+
PRODUCTVERSION 1,0,0,0
6+
FILEFLAGSMASK 0x3fL
7+
FILEFLAGS 0x0L
8+
FILEOS 0x4L
9+
FILETYPE 0x1L
10+
FILESUBTYPE 0x0L
11+
BEGIN
12+
BLOCK "StringFileInfo"
13+
BEGIN
14+
BLOCK "040904b0"
15+
BEGIN
16+
VALUE "CompanyName", "Antoine LANDRIEUX"
17+
VALUE "FileDescription", "SOARE Interpreter"
18+
VALUE "FileVersion", "1.0.0"
19+
VALUE "InternalName", "SOARE"
20+
VALUE "LegalCopyright", "MIT License (c) 2024-2025 Antoine LANDRIEUX"
21+
VALUE "OriginalFilename", "soare.exe"
22+
VALUE "ProductName", "SOARE"
23+
VALUE "ProductVersion", "1.0.0"
24+
END
25+
END
26+
BLOCK "VarFileInfo"
27+
BEGIN
28+
VALUE "Translation", 0x409, 1200
29+
END
30+
END

0 commit comments

Comments
 (0)