Rename plfunc/plfunc to plfunc/general.
Fix new docTexts cleanup.
This commit is contained in:
parent
08bf35940d
commit
b39db34208
|
@ -1,7 +1,7 @@
|
||||||
exe = pl
|
exe = pl
|
||||||
|
|
||||||
base_files = main.c pebblisp.c tokens.c object.c env.c hash.c
|
base_files = main.c pebblisp.c tokens.c object.c env.c hash.c
|
||||||
func_files = plfunc/web.c plfunc/plfunc.c plfunc/threads.c plfunc/plstring.c plfunc/pc.c
|
func_files = plfunc/web.c plfunc/general.c plfunc/threads.c plfunc/plstring.c plfunc/pc.c
|
||||||
files:= $(base_files) $(func_files)
|
files:= $(base_files) $(func_files)
|
||||||
|
|
||||||
libs = -lreadline -lmicrohttpd -lpthread
|
libs = -lreadline -lmicrohttpd -lpthread
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include "pebblisp.h"
|
#include "pebblisp.h"
|
||||||
#include "plfunc/web.h"
|
#include "plfunc/web.h"
|
||||||
#include "plfunc/threads.h"
|
#include "plfunc/threads.h"
|
||||||
#include "plfunc/plfunc.h"
|
#include "plfunc/general.h"
|
||||||
#include "plfunc/pc.h"
|
#include "plfunc/pc.h"
|
||||||
#include "plfunc/plstring.h"
|
#include "plfunc/plstring.h"
|
||||||
|
|
||||||
|
@ -480,10 +480,12 @@ int runTest(const char* test, const char* expected, int detailed)
|
||||||
size_t length;
|
size_t length;
|
||||||
char* result = stringObj(&o, &length);
|
char* result = stringObj(&o, &length);
|
||||||
cleanObject(&o);
|
cleanObject(&o);
|
||||||
int expectedLen = 0;
|
|
||||||
|
int expectedLen = 0; // Don't count anything after a semicolon
|
||||||
while (expected[expectedLen] && expected[expectedLen] != ';') {
|
while (expected[expectedLen] && expected[expectedLen] != ';') {
|
||||||
expectedLen++;
|
expectedLen++;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
if (strncmp(result, expected, expectedLen) != 0) {
|
if (strncmp(result, expected, expectedLen) != 0) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -491,10 +493,10 @@ int runTest(const char* test, const char* expected, int detailed)
|
||||||
printf("%s\n", test);
|
printf("%s\n", test);
|
||||||
printf("Expected '%s' but received '%s'\n", expected, result);
|
printf("Expected '%s' but received '%s'\n", expected, result);
|
||||||
} else {
|
} else {
|
||||||
|
ret = 1;
|
||||||
if (detailed) {
|
if (detailed) {
|
||||||
printf("[32;1m✓");
|
printf("[32;1m✓");
|
||||||
}
|
}
|
||||||
ret = 1;
|
|
||||||
}
|
}
|
||||||
free(result);
|
free(result);
|
||||||
deleteEnv(&env);
|
deleteEnv(&env);
|
||||||
|
|
|
@ -421,7 +421,14 @@ void cleanObject(Object* target)
|
||||||
if (!lambdaRefs(target)) {
|
if (!lambdaRefs(target)) {
|
||||||
cleanObject(&target->lambda->params);
|
cleanObject(&target->lambda->params);
|
||||||
cleanObject(&target->lambda->body);
|
cleanObject(&target->lambda->body);
|
||||||
free(lambdaDocs(target));
|
char** docTexts = lambdaDocs(target);
|
||||||
|
if (docTexts) {
|
||||||
|
while (*docTexts) {
|
||||||
|
free(*docTexts);
|
||||||
|
docTexts++;
|
||||||
|
}
|
||||||
|
free(lambdaDocs(target));
|
||||||
|
}
|
||||||
free(target->lambda);
|
free(target->lambda);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "plfunc.h"
|
#include "general.h"
|
||||||
|
|
||||||
Object reduce(Object* params, unused int length, struct Environment* env)
|
Object reduce(Object* params, unused int length, struct Environment* env)
|
||||||
{
|
{
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef PEBBLISP_PLFUNC_H
|
#ifndef PEBBLISP_GENERAL_H
|
||||||
#define PEBBLISP_PLFUNC_H
|
#define PEBBLISP_GENERAL_H
|
||||||
|
|
||||||
#include "../pebblisp.h"
|
#include "../pebblisp.h"
|
||||||
|
|
||||||
|
@ -181,4 +181,4 @@ tfn(getTime, "time",
|
||||||
"Get a struct of the current time with fields (minute hour sec)."
|
"Get a struct of the current time with fields (minute hour sec)."
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif // PEBBLISP_PLFUNC_H
|
#endif // PEBBLISP_GENERAL_H
|
Loading…
Reference in New Issue