feat: implement include directive with path resolution and recursive rendering for modular template composition
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user