summary refs log tree commit diff
diff options
context:
space:
mode:
authorNakidai <nakidai@disroot.org>2025-03-31 17:05:36 +0300
committerNakidai <nakidai@disroot.org>2025-03-31 17:05:36 +0300
commit2abf5178e4957c18ee9f83490eff5e4135199ff1 (patch)
tree1e618dbf7cdb8978c4d352dd2898e18f59430fef
parent9bf6d941428e9fd2ba84dd1ebf1a4f7abd7f5642 (diff)
download3cl-2abf5178e4957c18ee9f83490eff5e4135199ff1.tar.gz
3cl-2abf5178e4957c18ee9f83490eff5e4135199ff1.zip
Some style improvments v1.3.1
- Rename readfile to allocfile (as it actually contains cccl_allocfile
  function)
- Add cccl_ prefix for functions defined in str.c
-rw-r--r--Makefile2
-rw-r--r--allocfile.c (renamed from readfile.c)0
-rw-r--r--cccl.h6
-rw-r--r--executor.c4
-rw-r--r--parser.c2
-rw-r--r--str.c6
6 files changed, 10 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 0f5e2f3..ca51ad7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
+OBJS += allocfile.o
 OBJS += cccl.o
 OBJS += executor.o
 OBJS += main.o
 OBJS += parser.o
-OBJS += readfile.o
 OBJS += str.o
 OBJS += tokenizer.o
 
diff --git a/readfile.c b/allocfile.c
index d4d17f8..d4d17f8 100644
--- a/readfile.c
+++ b/allocfile.c
diff --git a/cccl.h b/cccl.h
index eb08298..de67e5e 100644
--- a/cccl.h
+++ b/cccl.h
@@ -101,8 +101,8 @@ struct cccl_Node *cccl_parse(struct cccl_Token tokens[], size_t tokens_length, e
 enum cccl_ExecutorStatus cccl_execute(struct cccl_Node *code, struct cccl_Variables *scope, size_t depth);
 void cccl_dump(FILE *f);
 
-const char *strtoken(enum cccl_TokenType type);
-const char *strnode(enum cccl_NodeType type);
-const char *strstatus(enum cccl_ExecutorStatus status);
+const char *cccl_strtoken(enum cccl_TokenType type);
+const char *cccl_strnode(enum cccl_NodeType type);
+const char *cccl_strstatus(enum cccl_ExecutorStatus status);
 
 #endif /* __CCCL_H__ */
diff --git a/executor.c b/executor.c
index 144ad2c..e748a8c 100644
--- a/executor.c
+++ b/executor.c
@@ -72,9 +72,9 @@ enum cccl_ExecutorStatus cccl_execute(struct cccl_Node *code, struct cccl_Variab
 {
     if (verbose)
         if (code->value)
-            fprintf(stderr, "Executing %s with %d [%c], %lu nodes, depth %lu\n", strnode(code->type), code->value, code->value, code->in_length, depth);
+            fprintf(stderr, "Executing %s with %d [%c], %lu nodes, depth %lu\n", cccl_strnode(code->type), code->value, code->value, code->in_length, depth);
         else
-            fprintf(stderr, "Executing %s, %lu nodes, depth %lu\n", strnode(code->type), code->in_length, depth);
+            fprintf(stderr, "Executing %s, %lu nodes, depth %lu\n", cccl_strnode(code->type), code->in_length, depth);
     if (interactive)
     {
         ssize_t length = getline(&line.buf, &line.length, stdin);
diff --git a/parser.c b/parser.c
index 126d716..09f0f34 100644
--- a/parser.c
+++ b/parser.c
@@ -55,7 +55,7 @@ struct cccl_Node *cccl_parse(struct cccl_Token tokens[], size_t tokens_length, e
     for (size_t i = 0; i < tokens_length; ++i)
     {
         if (verbose)
-            fprintf(stderr, "T:[%c:%s] ", tokens[i].value, strtoken(tokens[i].type));
+            fprintf(stderr, "T:[%c:%s] ", tokens[i].value, cccl_strtoken(tokens[i].type));
         switch (tokens[i].type)
         {
         case cccl_Token_COMMAND: case cccl_Token_COMMANDWITHARG: case cccl_Token_BLOCKSTART:
diff --git a/str.c b/str.c
index a8d85bd..4ea84b3 100644
--- a/str.c
+++ b/str.c
@@ -3,7 +3,7 @@
 #include <stddef.h>
 
 
-const char *strtoken(enum cccl_TokenType type)
+const char *cccl_strtoken(enum cccl_TokenType type)
 {
     switch (type)
     {
@@ -16,7 +16,7 @@ const char *strtoken(enum cccl_TokenType type)
     return NULL;
 }
 
-const char *strnode(enum cccl_NodeType type)
+const char *cccl_strnode(enum cccl_NodeType type)
 {
     switch (type)
     {
@@ -44,7 +44,7 @@ const char *strnode(enum cccl_NodeType type)
     return NULL;
 }
 
-const char *strstatus(enum cccl_ExecutorStatus status)
+const char *cccl_strstatus(enum cccl_ExecutorStatus status)
 {
     switch (status)
     {