feat: implement include directive with path resolution and recursive rendering for modular template composition

This commit is contained in:
2025-11-23 14:23:59 +00:00
parent d669b1da3d
commit 6a34114899
9 changed files with 394 additions and 15 deletions
+18
View File
@@ -0,0 +1,18 @@
int add(int a, int b) {
return a + b;
}
int subtract(int a, int b) {
return a - b;
}
int multiply(int a, int b) {
return a * b;
}
int divide(int a, int b) {
if (b == 0) {
return 0;
}
return a / b;
}
+19
View File
@@ -0,0 +1,19 @@
int string_length(char *s) {
return strlen(s);
}
char* string_upper(char *s) {
return upper(s);
}
char* string_lower(char *s) {
return lower(s);
}
int string_contains(char *haystack, char *needle) {
int pos = strpos(haystack, needle);
if (pos >= 0) {
return 1;
}
return 0;
}
+14
View File
@@ -0,0 +1,14 @@
#include "math_lib.rc"
#include "string_lib.rc"
int is_even(int n) {
int half = divide(n, 2);
return multiply(half, 2) == n;
}
int is_odd(int n) {
if (is_even(n)) {
return 0;
}
return 1;
}