From 6d0f3b9197baf668b2bfb8cffcf59f5517f66e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 30 Nov 1999 02:57:33 +0100 Subject: [PATCH] Added some error-checking. Rev: tutorial/Wmml.pmod:1.44 --- tutorial/Wmml.pmod | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tutorial/Wmml.pmod b/tutorial/Wmml.pmod index 5ad04f71ea..63f5686255 100644 --- a/tutorial/Wmml.pmod +++ b/tutorial/Wmml.pmod @@ -940,9 +940,11 @@ SGML low_make_concrete_wmml(SGML data) low_make_concrete_wmml(tag->data), tag->file)}); } +#if 0 else if(!tag) { werror("Warning: NUL encountered in contents.\n"); } +#endif /* 0 */ else throw(({"Tag or contents has illegal type: "+sprintf("%O\n",tag), backtrace()})); @@ -1112,15 +1114,24 @@ array execute_contents(Tag tag) object po; po=compile_string(sprintf("#%d %O\n\n", __LINE__, __FILE__) + "array _res=({({})});\n" - "void write(mixed ...args) { _res[0]+=args; }\n" + "void write(mixed ...args) {\n" + " if (search(args, 0) == -1)\n" + " _res[0] += args;\n" + " else\n" + " error(\"write(): NUL data\\n\");\n" + "}\n" "\n" - "void begin_tag(string name,void|mapping p) " - "{ _res=({({}),({name,p})})+_res; }\n" - "object end_tag() " - "{ if (sizeof(_res)<2) " - "error(\"end_tag w/o begin_tag\\n\");\n" - "object t=mktag(@_res[1],_res[0]); " - "_res=_res[2..]; return t;}\n" + "void begin_tag(string name,void|mapping p) {\n" + " _res=({({}),({name,p})})+_res;\n" + "}\n" + "\n" + "object end_tag() {\n" + " if (sizeof(_res)<2)\n" + " error(\"end_tag w/o begin_tag\\n\");\n" + " object t=mktag(@_res[1],_res[0]);\n" + " _res=_res[2..];\n" + " return t;\n" + "}\n" "\n" "#1 \"inline wmml generating code\"\n" +data)(); -- GitLab