From a59ce1646fba67026f70f207c35d3f08c93229f7 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Tue, 15 Mar 2022 16:03:13 -0400 Subject: [PATCH] More comprehensive webby.pl Allow for longer strings, but there's still another limiting element somewhere. --- src/examples/webby.pl | 27 ++++++++++++++++++--------- src/object.c | 2 +- src/pebblisp.c | 5 +++-- 3 files changed, 22 insertions(+), 12 deletions(-) mode change 100644 => 100755 src/examples/webby.pl diff --git a/src/examples/webby.pl b/src/examples/webby.pl old mode 100644 new mode 100755 index c063773..cf174c2 --- a/src/examples/webby.pl +++ b/src/examples/webby.pl @@ -1,17 +1,26 @@ +#!/usr/bin/pl + (struct post (title body)) -(def x (post "Hey" "This is a post")) - (def html (fn (text) (cat "" text ""))) (def body (fn (text) (cat "" text ""))) -(def h1 (fn (text) (cat "

" text "

"))) -(def p (fn (text) (cat "

" text "

"))) +(def h1 (fn (text) (cat "

" text "

+"))) +(def h2 (fn (text) (cat "

" text "

"))) +(def p (fn (text) (cat "

" text "

+"))) (def htmlize (fn (po) - (html - (body (cat - (h1 po's title) - (p po's body)))))) + (cat + (h2 po's title) + (p po's body)))) -(prnl (htmlize x)) +(def p1 (post "Hey" "This is a post")) +(def p2 (post "This" "Is ALSO a post")) + +(prnl (html (body (cat + (h1 "This is Sage's Blog") + (htmlize p1) + (htmlize p2) + )))) diff --git a/src/object.c b/src/object.c index e363920..4ef693e 100644 --- a/src/object.c +++ b/src/object.c @@ -427,7 +427,7 @@ void _printObj(const Object* obj, int newline) return; } - char temp[100] = ""; + char temp[200] = ""; stringObj(temp, obj); if (newline) { printf("%s\n", temp); diff --git a/src/pebblisp.c b/src/pebblisp.c index a78c183..bc5c132 100644 --- a/src/pebblisp.c +++ b/src/pebblisp.c @@ -413,8 +413,9 @@ Object catObjects(const Object obj1, const Object obj2, struct Environment* env) Object evalObj1 = eval(&obj1, env); Object evalObj2 = eval(&obj2, env); - char str1[100] = ""; - char str2[100] = ""; +#define CAT_MAX 200 + char str1[CAT_MAX] = ""; + char str2[CAT_MAX] = ""; stringObj(str1, &evalObj1); stringObj(str2, &evalObj2); cleanObject(&evalObj1);