wml-tools-0.0.4.orig/0042700000175000017500000000000007045321606012520 5ustar ferferwml-tools-0.0.4.orig/WAP0100600000175000017500000000153307023570532013071 0ustar ferferWML stands for Wireless Markup Language, a sort of slimmed version of HTML intended for small, portable devices such as WAP enabled mobile phones. WAP stands for Wireless Access Protocol and is the low level protocol used by these devices to send and receive. In general, a WAP device will request data from a WAP gateway which will translate the requests from the WAP device to valid Internet protocols and also translate the response : Wireless Network Wired Network WAP-enabled <--------------> WAP <-----------> Server device WAP gateway IP What this translates to in the real world is that when a WAP device requests a WML deck, the WAP gateway sends (usually) an HTTP request to the server for the WML source, compiles it into bytecode and sends this back to the WAP device. wml-tools-0.0.4.orig/wmlv/0042700000175000017500000000000007045321511013500 5ustar ferferwml-tools-0.0.4.orig/wmlv/Makefile0100600000175000017500000000032007023770706015142 0ustar ferferOBJS = wmlv.o all: wmlv re: clean all .c.o: $(CC) $(CC_OPS) $(XML_CC_OPS) -c $*.c wmlv: $(OBJS) $(CC) $(CC_OPS) $(XML_CC_OPS) -o wmlv $(OBJS) $(LD_OPS) $(XML_LD_OPS) clean: rm -f $(OBJS) wmlv core *~ wml-tools-0.0.4.orig/wmlv/wmlv.c0100600000175000017500000000733607023571714014647 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ #include #include #include #include #include #define TA_NONE 0 #define TA_BOLD 1 #define TA_UNDERLINE 2 #define TA_ITALIC 4 #define ANSI_RESET "\033[00m" #define ANSI_BOLD "\033[01m" #define ANSI_UNDER "\033[04m" #define USE_ANSI 1 int debug = 0; int dumpNodeIndent = 0; void dumpNode(xmlNodePtr node) { while(node) { fprintf(stderr, "%*s == %s\n", dumpNodeIndent, "", node->name); if(node->childs) { dumpNodeIndent += 2; dumpNode(node->childs); dumpNodeIndent -= 2; } node = node->next; } } void showNode(xmlNodePtr node, int textAttr) { char *attr; int nTextAttr = textAttr; int oTextAttr; while(node) { oTextAttr = nTextAttr; if(strcmp(node->name, "p") == 0) { /* Should check for alignment (attr = xmlGetProp(node, "align")) */ if(node->content) puts(node->content); } else if(strcmp(node->name, "a") == 0) { if((attr = xmlGetProp(node, "name"))) { /* Subreference - ignore for now */ } else if((attr = xmlGetProp(node, "href"))) { /* Link */ printf("[A:%s]", attr); nTextAttr |= TA_UNDERLINE; } } else if(strcmp(node->name, "b") == 0) { nTextAttr |= TA_BOLD; } else if(strcmp(node->name, "img") == 0) { if((attr = xmlGetProp(node, "alt"))) printf("[IMG: %s]", attr); else printf("[IMG]"); } else if(strcmp(node->name, "br") == 0) { printf("\n"); if(node->content) puts(node->content); } else if(strcmp(node->name, "text") == 0) { if(node->content) { #ifdef USE_ANSI if((textAttr & TA_UNDERLINE)) printf("%s", ANSI_UNDER); if((textAttr & TA_BOLD)) printf("%s", ANSI_BOLD); printf("%s", node->content); if((textAttr & TA_BOLD)||(textAttr & TA_UNDERLINE)) printf("%s", ANSI_RESET); #else /* USE_ANSI */ if((textAttr & TA_UNDERLINE)) putchar('_'); if((textAttr & TA_BOLD)) putchar('*'); printf("%s", node->content); if((textAttr & TA_BOLD)) putchar('*'); if((textAttr & TA_UNDERLINE)) putchar('_'); #endif /* USE_ANSI */ } } else printf("\n#! : %s\n", node->name); if(node->childs) showNode(node->childs, nTextAttr); nTextAttr = oTextAttr; node = node->next; } } void showCard(xmlNodePtr cardNode) { if(!cardNode) printf("showCard(): cardNode == NULL\n"); else { printf("------------------------------------------\n"); printf("Card: %s (id: %s)\n", xmlGetProp(cardNode, "title"), xmlGetProp(cardNode, "id")); printf("------------------------------------------\n\n"); showNode(cardNode->childs, TA_NONE); printf("\n------------------------------------------\n"); } } xmlNodePtr findCard(xmlNodePtr node, char *id) { xmlNodePtr card; while(node) { if(strcmp(node->name, "card") == 0) { if(id) { if(strcmp(xmlGetProp(node, "id"), id) == 0) return node; } else return node; } if(node->childs) { if((card = findCard(node->childs, id))) return card; } node = node->next; } return NULL; } int main(int argc, char **argv) { char *filename, *card; xmlDocPtr doc; if(argc == 2) { filename = argv[1]; card = NULL; } else if(argc == 3) { filename = argv[1]; card = argv[2]; } else { fprintf(stderr, "Usage: %s file.wml [card ID]\n", argv[0]); exit(1); } doc = xmlParseFile(filename); if(!doc) { fprintf(stderr, "Couldn't parse %s as a valid XML document\n", filename); exit(1); } if(debug) dumpNode(doc->root); showCard(findCard(doc->root, card)); return 0; } wml-tools-0.0.4.orig/wmlv/README0100600000175000017500000000113707023565325014370 0ustar ferferThis is a very simple text-based WML deck viewer. It doesn't have any concept of WMLscript, definable widgets, images or tables. It just runs through the source putting it out as it thinks is best. Use it as "wmlv file.wml [card]" where [card] is an optional card to show from the deck (default is the first encountered). The end result should see the output from wmld being passed to here, thereby creating a viewer which can handle bytecode too. An X version of this is being planned which should be able to handle the definable widgets, images and tables. WMLscript is still beyond me at the minute. wml-tools-0.0.4.orig/wml/0042700000175000017500000000000007024005166013314 5ustar ferferwml-tools-0.0.4.orig/wml/tags.h0100600000175000017500000001060207024006646014423 0ustar ferfer#ifndef WML_TAGS #define WML_TAGS #ifndef WML_TOKENS #include #endif /* WML_TOKENS */ #define WML_TAGS_MIN WMLT_A #define WML_TAGS_MAX WMLT_WML static char *wml_tags[(WML_TAGS_MAX - WML_TAGS_MIN) + 1] = { /* 0x1C */ "a", /* 0x1D */ "td", /* 0x1E */ "tr", /* 0x1F */ "table", /* 0x20 */ "p", /* 0x21 */ "postfield", /* 0x22 */ "anchor", /* 0x23 */ "access", /* 0x24 */ "b", /* 0x25 */ "big", /* 0x26 */ "br", /* 0x27 */ "card", /* 0x28 */ "do", /* 0x29 */ "em", /* 0x2A */ "fieldset", /* 0x2B */ "go", /* 0x2C */ "head", /* 0x2D */ "i", /* 0x2E */ "img", /* 0x2F */ "input", /* 0x30 */ "meta", /* 0x31 */ "noop", /* 0x32 */ "prev", /* 0x33 */ "onevent", /* 0x34 */ "optgroup", /* 0x35 */ "option", /* 0x36 */ "refresh", /* 0x37 */ "select", /* 0x38 */ "small", /* 0x39 */ "strong", /* 0x3A */ NULL, /* 0x3B */ "template", /* 0x3C */ "timer", /* 0x3D */ "u", /* 0x3E */ "setvar", /* 0x3F */ "wml", }; #define WML_TAG_DESC(a) (((a>=WML_TAGS_MIN)&&(a<=WML_TAGS_MAX))?wml_tags[(a-WML_TAGS_MIN)]:NULL) #define WML_SATTR_MIN WMLS_ACCEPT_CHARSET #define WML_SATTR_MAX WMLS_HTTP_EQUIV_EXPIRES static char *wml_start_attributes[(WML_SATTR_MAX - WML_SATTR_MIN) + 1] = { /* 0x05 */ "accept-charset", /* 0x06 */ "align=\"bottom\"", /* 0x07 */ "align=\"center\"", /* 0x08 */ "align=\"middle\"", /* 0x09 */ NULL, /* 0x0A */ "align=\"right\"", /* 0x0B */ "align=\"top\"", /* 0x0C */ "alt", /* 0x0D */ "content", /* 0x0E */ NULL, /* 0x0F */ "domain", /* 0x10 */ "emptyok=\"false\"", /* 0x11 */ "emptyok-\"true\"", /* 0x12 */ "format", /* 0x13 */ "height", /* 0x14 */ "hspace", /* 0x15 */ "ivalue", /* 0x16 */ "iname", /* 0x17 */ NULL, /* 0x18 */ "label", /* 0x19 */ "localsrc", /* 0x1A */ "maxlength", /* 0x1B */ "method=\"get\"", /* 0x1C */ "method=\"post\"", /* 0x1D */ "mode=\"nowrap\"", /* 0x1E */ "mode=\"wrap\"", /* 0x1F */ "multiple=\"false\"", /* 0x20 */ "multiple=\"true\"", /* 0x21 */ "name", /* 0x22 */ "newcontext=\"false\"", /* 0x23 */ "newcontext=\"true\"", /* 0x24 */ "onpick", /* 0x25 */ "onenterbackward", /* 0x26 */ "onenterforward", /* 0x27 */ "ontimer", /* 0x28 */ "optional=\"false\"", /* 0x29 */ "optional=\"true\"", /* 0x2A */ "path", /* 0x2B */ NULL, /* 0x2C */ NULL, /* 0x2D */ NULL, /* 0x2E */ "scheme", /* 0x2F */ "sendreferer=\"false\"", /* 0x30 */ "sendreferer=\"true\"", /* 0x31 */ "size", /* 0x32 */ "src", /* 0x33 */ "ordered=\"true\"", /* 0x34 */ "ordered=\"false\"", /* 0x35 */ "tabindex", /* 0x36 */ "title", /* 0x37 */ "type", /* 0x38 */ "type=\"accept\"", /* 0x39 */ "type=\"delete\"", /* 0x3A */ "type=\"help\"", /* 0x3B */ "type=\"password\"", /* 0x3C */ "type=\"onpick\"", /* 0x3D */ "type=\"onenterbackward\"", /* 0x3E */ "type=\"onenterforward\"", /* 0x3F */ "type=\"ontimer\"", /* 0x40 */ NULL, /* 0x41 */ NULL, /* 0x42 */ NULL, /* 0x43 */ NULL, /* 0x44 */ NULL, /* 0x45 */ NULL, /* 0x46 */ "type=\"prev\"", /* 0x47 */ "type=\"reset\"", /* 0x48 */ "type=\"text\"", /* 0x49 */ "type=\"vnd\"", /* 0x4A */ "href", /* 0x4B */ "href=\"http://", /* 0x4C */ "href=\"https://", /* 0x4D */ "value", /* 0x4E */ "vspace", /* 0x4F */ "width", /* 0x50 */ "xml:lang", /* 0x51 */ NULL, /* 0x52 */ "align", /* 0x53 */ "columns", /* 0x54 */ "class", /* 0x55 */ "id", /* 0x56 */ "forua=\"false\"", /* 0x57 */ "forua=\"true\"", /* 0x58 */ "src=\"http://", /* 0x59 */ "src=\"https://", /* 0x5A */ "http-equiv", /* 0x5B */ "http-equiv=\"Content-Type\"", /* 0x5C */ "content=\"application/vnd.wap.wmlc;charset=", /* 0x5D */ "http-equiv=\"Expires\"" }; #define WML_SATTR_DESC(a) (((a>=WML_SATTR_MIN)&&(a<=WML_SATTR_MAX))?wml_start_attributes[(a-WML_SATTR_MIN)]:NULL) #define WML_VATTR_MIN WMLA_COM #define WML_VATTR_MAX WMLA_WWW static char *wml_value_attributes[(WML_VATTR_MAX - WML_VATTR_MIN) + 1] = { /* 0x85 */ ".com/", /* 0x86 */ ".edu/", /* 0x87 */ ".net/", /* 0x88 */ ".org/", /* 0x89 */ "accept", /* 0x8A */ "bottom", /* 0x8B */ "clear", /* 0x8C */ "delete", /* 0x8D */ "help", /* 0x8E */ "http://", /* 0x8F */ "http://www.", /* 0x90 */ "https://", /* 0x91 */ "https://www.", /* 0x92 */ NULL, /* 0x93 */ "middle", /* 0x94 */ "nowrap", /* 0x95 */ "onpick", /* 0x96 */ "onenterbackward", /* 0x97 */ "onenterforward", /* 0x98 */ "ontimer", /* 0x99 */ "options", /* 0x9A */ "password", /* 0x9B */ "reset", /* 0x9C */ NULL, /* 0x9D */ "text", /* 0x9E */ "top", /* 0x9F */ "unknown", /* 0xA0 */ "wrap", /* 0xA1 */ "www.", }; #define WML_VATTR_DESC(a) (((a>=WML_VATTR_MIN)&&(a<=WML_VATTR_MAX))?wml_value_attributes[(a-WML_VATTR_MIN)]:NULL) #endif /* WML_TAGS */ wml-tools-0.0.4.orig/wml/tokens.h0100600000175000017500000001401407025277121014770 0ustar ferfer#ifndef WML_TOKENS #define WML_TOKENS /* Global tokens */ #define WMLG_STR_I 0x03 #define WMLG_LITERAL 0x04 #define WMLG_EXT_I_0 0x40 #define WMLG_EXT_I_1 0x41 #define WMLG_EXT_I_2 0x42 #define WMLG_EXT_T_0 0x80 #define WMLG_EXT_T_1 0x81 #define WMLG_EXT_T_2 0x82 #define WMLG_STR_T 0x83 #define WMLG_EXT_0 0xC0 /* Reserved */ #define WMLG_EXT_1 0xC1 /* Reserved */ #define WMLG_EXT_2 0xC2 /* Reserved */ /* Tag tokens */ #define WMLT_A 0x1C #define WMLT_ANCHOR 0x22 #define WMLT_ACCESS 0x23 #define WMLT_B 0x24 #define WMLT_BIG 0x25 #define WMLT_BR 0x26 #define WMLT_CARD 0x27 #define WMLT_DO 0x28 #define WMLT_EM 0x29 #define WMLT_FIELDSET 0x2A #define WMLT_GO 0x2B #define WMLT_HEAD 0x2C #define WMLT_I 0x2D #define WMLT_IMG 0x2E #define WMLT_INPUT 0x2F #define WMLT_META 0x30 #define WMLT_NOOP 0x31 #define WMLT_P 0x20 #define WMLT_POSTFIELD 0x21 #define WMLT_PREV 0x32 #define WMLT_ONEVENT 0x33 #define WMLT_OPTGROUP 0x34 #define WMLT_OPTION 0x35 #define WMLT_REFRESH 0x36 #define WMLT_SELECT 0x37 #define WMLT_SETVAR 0x3E #define WMLT_SMALL 0x38 #define WMLT_STRONG 0x39 #define WMLT_TABLE 0x1F #define WMLT_TD 0x1D #define WMLT_TEMPLATE 0x3B #define WMLT_TIMER 0x3C #define WMLT_TR 0x1E #define WMLT_U 0x3D #define WMLT_WML 0x3F #define WMLTC_ATTRIBUTES 0x80 #define WMLTC_CONTENT 0x40 #define WMLTC_END 0x01 #define WMLTC_TAG_VALUE (~(WMLTC_ATTRIBUTES|WMLTC_CONTENT)) /* Attribute start tokens */ #define WMLS_ACCEPT_CHARSET 0x05 #define WMLS_ALIGN 0x52 #define WMLS_ALIGN_BOTTOM 0x06 #define WMLS_ALIGN_CENTER 0x07 #define WMLS_ALIGN_MIDDLE 0x08 #define WMLS_ALIGN_RIGHT 0x0A #define WMLS_ALIGN_TOP 0x0B #define WMLS_ALT 0x0C #define WMLS_CLASS 0x54 #define WMLS_COLUMNS 0x53 #define WMLS_CONTENT 0x0D #define WMLS_CONTENT_WMLC 0x5C #define WMLS_DOMAIN 0x0F #define WMLS_EMPTYOK_FALSE 0x10 #define WMLS_EMPTYOK_TRUE 0x11 #define WMLS_FORMAT 0x12 #define WMLS_FORUA_FALSE 0x56 #define WMLS_FORUA_TRUE 0x57 #define WMLS_HEIGHT 0x13 #define WMLS_HREF 0x4A #define WMLS_HREF_HTTP 0x4B #define WMLS_HREF_HTTPS 0x4C #define WMLS_HSPACE 0x14 #define WMLS_HTTP_EQUIV 0x5A #define WMLS_HTTP_EQUIV_CONTENT_TYPE 0x5B #define WMLS_HTTP_EQUIV_EXPIRES 0x5D #define WMLS_ID 0x55 #define WMLS_IVALUE 0x15 #define WMLS_INAME 0x16 #define WMLS_LABEL 0x18 #define WMLS_LOCALSRC 0x19 #define WMLS_MAXLENGTH 0x1A #define WMLS_METHOD_GET 0x1B #define WMLS_METHOD_POST 0x1C #define WMLS_MODE_NOWRAP 0x1D #define WMLS_MODE_WRAP 0x1E #define WMLS_MULTIPLE_FALSE 0x1F #define WMLS_MULTIPLE_TRUE 0x20 #define WMLS_NAME 0x21 #define WMLS_NEWCONTEXT_FALSE 0x22 #define WMLS_NEWCONTEXT_TRUE 0x23 #define WMLS_ONENTERBACKWARD 0x25 #define WMLS_ONENTERFORWARD 0x26 #define WMLS_ONPICK 0x24 #define WMLS_ONTIMER 0x27 #define WMLS_OPTIONAL_FALSE 0x28 #define WMLS_OPTIONAL_TRUE 0x29 #define WMLS_PATH 0x2A #define WMLS_SCHEME 0x2E #define WMLS_SENDREFERER_FALSE 0x2F #define WMLS_SENDREFERER_TRUE 0x30 #define WMLS_SIZE 0x31 #define WMLS_SRC 0x32 #define WMLS_SRC_HTTP 0x58 #define WMLS_SRC_HTTPS 0x59 #define WMLS_ORDERED_TRUE 0x33 #define WMLS_ORDERED_FALSE 0x34 #define WMLS_TABINDEX 0x35 #define WMLS_TITLE 0x36 #define WMLS_TYPE 0x37 #define WMLS_TYPE_ACCEPT 0x38 #define WMLS_TYPE_DELETE 0x39 #define WMLS_TYPE_HELP 0x3A #define WMLS_TYPE_PASSWORD 0x3B #define WMLS_TYPE_ONPICK 0x3C #define WMLS_TYPE_ONENTERBACKWARD 0x3D #define WMLS_TYPE_ONENTERFORWARD 0x3E #define WMLS_TYPE_ONTIMER 0x3F #define WMLS_TYPE_PREV 0x46 #define WMLS_TYPE_RESET 0x47 #define WMLS_TYPE_TEXT 0x48 #define WMLS_TYPE_VND 0x49 #define WMLS_VALUE 0x4D #define WMLS_VSPACE 0x4E #define WMLS_WIDTH 0x4F #define WMLS_XML_LANG 0x50 /* Attribute value tokens */ #define WMLA_COM 0x85 #define WMLA_EDU 0x86 #define WMLA_NET 0x87 #define WMLA_ORG 0x88 #define WMLA_ACCEPT 0x89 #define WMLA_BOTTOM 0x8A #define WMLA_CLEAR 0x8B #define WMLA_DELETE 0x8C #define WMLA_HELP 0x8D #define WMLA_HTTP 0x8E #define WMLA_HTTP_WWW 0x8F #define WMLA_HTTPS 0x90 #define WMLA_HTTPS_WWW 0x91 #define WMLA_MIDDLE 0x93 #define WMLA_NOWRAP 0x94 #define WMLA_ONENTERBACKWARD 0x96 #define WMLA_ONENTERFORWARD 0x97 #define WMLA_ONPICK 0x95 #define WMLA_ONTIMER 0x98 #define WMLA_OPTIONS 0x99 #define WMLA_PASSWORD 0x9A #define WMLA_RESET 0x9B #define WMLA_TEXT 0x9D #define WMLA_TOP 0x9E #define WMLA_UNKNOWN 0x9F #define WMLA_WRAP 0xA0 #define WMLA_WWW 0xA1 /* Misc */ #define WMLC_INLINE_STRING 0x03 #define WMLC_INLINE_STRING_END 0x00 #ifdef WML_NO_CLOSURES /* No closure tags */ static int wml_no_closure_tags[] = { WMLT_BR, WMLT_NOOP, WMLT_PREV, WMLT_IMG, WMLT_META, WMLT_TIMER, WMLT_SETVAR, -1 }; #endif /* WML_NO_CLOSURES */ #endif /* WML_TOKENS */ wml-tools-0.0.4.orig/wbmp/0042700000175000017500000000000007045321510013457 5ustar ferferwml-tools-0.0.4.orig/wbmp/wbmp2xpm.c0100600000175000017500000000305507023571714015410 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ #include #include int main(int argc, char **argv) { FILE *in, *out; int c, i, j, width, height, line, block, offset; char of[256], *p; if(argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); exit(1); } if(!(in = fopen(argv[1], "r"))) { fprintf(stderr, "Can't open %s for reading\n", argv[1]); exit(1); } strcpy(of, argv[1]); if((p = strrchr(of, '.'))) { p++; *(p++) = 'x'; *(p++) = 'p'; *(p++) = 'm'; *p = '\0'; } else strcat(of, ".xpm"); if(!(out = fopen(of, "w"))) { fprintf(stderr, "Can't open %s for writing\n", of); exit(1); } i = getc(in); j = getc(in); width = getc(in); height = getc(in); fprintf(out, "/* XPM */\nstatic char *xpm[] = {\n"); fprintf(out, "\"%d %d 2 1\",\n", width, height); fprintf(out, "\"a c #000000\",\n"); fprintf(out, "\"b c #ffffff\",\n"); for(line = 0; line < height; line++) { fputc('"', out); for(block = 0; block < width; block += 8) { c = getc(in); for(offset = 0; (offset<8)&&((offset+block)@À€ÿ?>a€€ÿ?>a€Àð>?ÿáÀÀð>?ÿóàÀð>?ÿóàÀð>?÷óàÀð>?÷÷ÀÀp>ó÷€À?ÿã÷€À?þãïÀà?þáïàðøÁïøøÿÿÿð Á*ÿÿÿð!*?ÿÿÿð!,?ÿÿÿðÑ-*}ÿÿÿðÌÌÊýþ«¯ðüý^©/ðþý.ª¯ðÿýn«¯ðÿÀýo[£ðÿðÿÿÿÿðÿÿÿÿÿÿÿðwml-tools-0.0.4.orig/wbmp/logo.xpm0100600000175000017500000000504607023564303015154 0ustar ferfer/* XPM */ static char *xpm[] = { "68 35 2 1", "a c #000000", "b c #ffffff", "bbbbbbbbbbbbbbbbaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "bbbbbbbbaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "bbbbbbbaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbb", "bbbbbbaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbaabbbb", "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbaaabbbb", "bbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbaaaabbbb", "aaaabbbaabbbbaaaabbbbbbaaaabbbaaaabaaaaabbbbbaaaaaabbbbbbbbaaaaaaaaa", "aaaabbbabbbbbbbaabbbbbbaaaabbbaaaabaaaaabbbaaaaaaaaaabbbbbaaaaaaaaaa", "aaabbbbbbbbbbbbaabbbbbbbaabbbbbaabaaaaaabbaaaaaaaaaaaabbbaaaaaaaaaaa", "aaabbbbbbbbbbbbbaabbbbbbaabbbbbaabbaaaabbaaaaaaaaaaaaaabbaaaaaaaaaaa", "aaabbbbbbbbbbbbbaabbbbbbaabbbbbaabbaaaabbaaaaaaaaaaaaaabbbaaaaaabbbb", "aabbbbbaabbbbbbbaabbbbbbbbbbbbbbbbbaaaabaaaaaabbbbaaaaaabbaaaaaabbbb", "aabbbbbaaabbbbbbaaabbbbbbbbbbbbbbbbbaabbaaaaabbbbbbaaaaabbaaaaaabbbb", "aabbbbbaaabbbbbbaaabbbbbbbbbbbbbbbbbaabbaaaaabbbbbbaaaaabbaaaaaabbbb", "aabbbbbaaabbbbbbaaaabbbbbbbbabbbbbbbaabbaaaaabbbbbbaaaaabbaaaaaabbbb", "aabbbbbaaabbbbbbaaaabbbbbbbbabbbbbbbabbbaaaaaabbbbaaaaaabbaaaaaaabbb", "aabbbbbaabbbbbbbaaaabbbbbbbbaabbbbbbabbbbaaaaaaaaaaaaaabbbaaaaaaaaaa", "aabbbbbbbbbbbbbbaaaaabbbbbbaaabbbbbbabbbbaaaaaaaaaaaaaabbbaaaaaaaaaa", "aabbbbbbbbbbbbbaaaaaabbbbbbaaabbbbbabbbbbbaaaaaaaaaaaabbbbbaaaaaaaaa", "aabbbbbbbbbbbbbaaaaaabbbbbbaaaabbbbabbbbbbbaaaaaaaaaabbbbbbbaaaaaaaa", "aaabbbbbbbbbbaaaaaaaaabbbbaaaaabbbbabbbbbbbbbaaaaaabbbbbbbbbbaaaaaaa", "aaabbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "aaabbbbaaaaabbaabbaaaaabaabababaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "aaaabbbaaaabaaabaabaaaabaabababaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "aaaabbbaaaabaaabaabaaaabaababbaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "aaaaabbabbabaaabaababbabaabababaabbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "aaaaaababbaabbaabbaabbaabbaabababbbbbbabbbbbbbbababababbbababbbbbbbb", "bbbbbbaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbabababbbbabababaabaababbbbbbbb", "bbbbbbbaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbabaababbbabababababababbbbbbbb", "bbbbbbbbaaaaaaaaaaaaaaaaaaaaabbbbbbbbbababbabbbababababbbababbbbbbbb", "bbbbbbbbbbaaaaaaaaaaaaaaaaabbbbbbbbbbbababbabbbbababbabbbabaaabbbbbb", "bbbbbbbbbbbbaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "bbbbbbbbbbbbbbbbaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" }; wml-tools-0.0.4.orig/wbmp/README0100600000175000017500000000106507023573075014351 0ustar ferferThese are tools for dealing with WBMP files - WAP bitmaps. These files are really simple - the first two bytes contain version information (I think) which at the minute is set to 0. The 3rd byte contains the width and the 4th byte the height (I guess this makes WBMP images max 255x255 pixels then). From the 5th byte onwards they are simply byte-padded binary encoded 1-bit images - 1 for white, 0 for black. wbmp2xpm generates 1-bit XPM files from WBMP files. An example WBMP file is included (logo.wbmp). Coming soon : something useful (i.e. a WBMP creator) wml-tools-0.0.4.orig/GOTCHAS0100600000175000017500000000323207044255013013525 0ustar ferferGotcha #1: XML, not SGML You can run into problems if you ever forget that WML is an XML language, not a plain SGML language. If you find your pages won't parse or display properly, make sure that standalone tags have a trailing slash in their name like
. Workaround: Check your own code! -- Gotcha #2: No "back" button ... or is there In a HTML browser there is always a facility to go backwards through the stack of visited pages, but a WAP browser promises no such feature. To get around this, you can implement your own global "back" button with the deck template and the tag. However, the Nokia WAP Toolkit shows a problem with this - some WAP browsers do have a back button. Nokia's toolkit shows two (fictional) phones, the 6150 and the 6110. The 6150 has no back button at all, while the 6110's action button changes to a back button after 2 seconds inactivity. This means that if you implement a global back button for all browsers, on the larger browsers there will be two visible. Workaround: It's probably possible to implement some WMLscript for this purpose, but that seems like a bit of overkill. -- Gotcha #3: Mishandled URLs While playing with the Ericsson WAP SDK I noticed that it doesn't handle some URLs properly. I had written several small files called "1.wml" through to "12.wml" and had used to reference them. However, Ericsson's virtual phone told me that it didn't know what protocol to use. If a URL begins with a number it appears that it forgets what protocol (http, local file) it uses and the path. Workaround: Don't start URLs with numbers. Or don't use Ericsson R320S mobile phones to view your WAP pages. -- wml-tools-0.0.4.orig/samples/0042700000175000017500000000000007025304530014157 5ustar ferferwml-tools-0.0.4.orig/samples/index.wmlc0100600000175000017500000000126707023563563016170 0ustar ferferjtoys{è8Back2çUinit6WelcomeàÜJ#exp®2logo.wbmp pwot.co.uk in WML!çUexp6pwotàßS2^]ÜJ#aboutabout]ÜJ#linkslinks^]ÜJscrib.wmlscribblings]ÜJtoys.wmlƒçUabout6about pwot`dpwot.co.uk has been ÜJme.wmlmy toy on the web for many years now. As a learning tool for WAP and WML I decided to try to convert some of my website.& I've converted my ÜJcv.wmlCV to WML and have also written some ÜJtoys.wmlƒ to play with on the nice new WAP-enabled phone you must have. çUlinks6pwot links` Unfortunetly I don't know of any other WML sites. If you know of any, please mail me at ponder@pwot.co.uk. wml-tools-0.0.4.orig/samples/slashdot.wml0100600000175000017500000000132507023563563016532 0ustar ferfer

Slashdot:News for Nerds. Stuff that Matters.

The Genome Project and the Dark Side

Corporate vs Open Source:Sun Stealing Blackdown?

Napster Being Sued by RIAA

iCraveTV Sued by Networks

On Using X w/o the Rodent

V2 OS

Legos Declared Toy of Century

British Telecom Announces Unmetered Net Access

No Linux at Fox.com

VA Linux IPO Update

wml-tools-0.0.4.orig/samples/logo.wbmp0100600000175000017500000000047707023563563016026 0ustar ferferD#ÿÿÿÿÿÿÿðÿðÿÿÿÿðÿÀÿÿÿÿðÿÿÿÿÿðþÿÿÿþðüÿÿÿüðøÿÿÿøððÿÿððx~ øàþ~ àÀþ>@À€ÿ?>a€€ÿ?>a€Àð>?ÿáÀÀð>?ÿóàÀð>?ÿóàÀð>?÷óàÀð>?÷÷ÀÀp>ó÷€À?ÿã÷€À?þãïÀà?þáïàðøÁïøøÿÿÿð Á*ÿÿÿð!*?ÿÿÿð!,?ÿÿÿðÑ-*}ÿÿÿðÌÌÊýþ«¯ðüý^©/ðþý.ª¯ðÿýn«¯ðÿÀýo[£ðÿðÿÿÿÿðÿÿÿÿÿÿÿðwml-tools-0.0.4.orig/samples/cv.wml0100600000175000017500000000257107023563563015325 0ustar ferfer

CV of Thomas Neill
Experience
Education
Interests
Skills
References

Personal interests include playing guitar (electric and classical), playing pool and snooker with friends, reading books (mostly by Terry Pratchett and Arthur C. Clarke) and playing video games.

Languages: C, C++, Perl, Java, JavaScript, HTML, WML, WMLscript
OSs: UNIX (Linux, Solaris, *BSD), Windows (Win9x, NT4, 2000)
Other skills: DHTML, CGI, TCP/IP (including firewalls, masquerading, secure connectivity), HTTP, HTTPS, FTP, SMTP, POP, DNS.

References are available on request to cv@pwot.co.uk

wml-tools-0.0.4.orig/samples/cv.wmlc0100600000175000017500000000145007023563563015463 0ustar ferferj{è8Back2çUcv6CV` CV of dThomas Neill&ßS1^]ÜJcv-exp.wmlExperience^]ÜJcv-edu.wmlEducation^]ÜJ#einInterests^]ÜJ#eskSkills^]ÜJ#ereReferencesçUein6CV - Interests` Personal interests include playing guitar (electric and classical), playing pool and snooker with friends, reading books (mostly by Terry Pratchett and Arthur C. Clarke) and playing video games. çUesk6CV - Skills`dLanguages: C, C++, Perl, Java, JavaScript, HTML, WML, WMLscript&dOSs: UNIX (Linux, Solaris, *BSD), Windows (Win9x, NT4, 2000)&dOther skills: DHTML, CGI, TCP/IP (including firewalls, masquerading, secure connectivity), HTTP, HTTPS, FTP, SMTP, POP, DNS. çUere6CV - References` References are available on request to cv@pwot.co.uk wml-tools-0.0.4.orig/samples/me.wml0100600000175000017500000000145507023563563015316 0ustar ferfer

I'm a recently graduated IT professional (colloquial term: spod) who is currently unemployed. I was born in 1979 and have lived in Dumbarton ever since. I endured 7 years at St. Michael's Primary School, 6 years at OLSP High School and 3 years at Strathclyde University. I now spend my time wasting bandwidth and trying to learn useless skills, such as WML programming. For more information on me of a different matter, try my CV.

wml-tools-0.0.4.orig/samples/me.wmlc0100600000175000017500000000077607023563563015466 0ustar ferferjçUme6pwot - meè8Back2è8CV«Jcv.wml` I'm a recently graduated IT professional (colloquial term: spod) who is currently unemployed. I was born in 1979 and have lived in Dumbarton ever since. I endured 7 years at St. Michael's Primary School, 6 years at OLSP High School and 3 years at Strathclyde University. I now spend my time wasting bandwidth and trying to learn useless skills, such as WML programming. For more information on me of a different matter, try ÜJcv.wmlmy CV. wml-tools-0.0.4.orig/samples/test.wml0100600000175000017500000000036307023563563015671 0ustar ferfer

This is the first line
This is the second line

wml-tools-0.0.4.orig/samples/test.wmlc0100600000175000017500000000007607025034673016032 0ustar ferferjg` This is the first line& This is the secondline wml-tools-0.0.4.orig/samples/cv-exp.wml0100600000175000017500000000340307023563563016112 0ustar ferfer

Website Administrator
Network Engineer
Software Engineer

Website Administrator, July 1998 - November 1999, Strathclyde University
Designed and created content for the Student's Union website.
Managed Windows NT and UNIX web servers running IIS and Apache.
Creation of a custom e-commerce system from the ground up in Perl.

Network Engineer, July 1998 - May 1999, Cowgate Books
Management of Windows 95 clients from a Novell server.
Evolution of internal network to support Internet connectivity.
Provided telephone support and repair callout.

Software Engineer, June 1998 - July 1998, Cowgate Books
Analysis and upgrade of existing database system.
Creation of software to allow web-based order tracking.
Design and creation of corporate website.

wml-tools-0.0.4.orig/samples/cv-exp.wmlc0100600000175000017500000000171307023563563016257 0ustar ferferj9Website AdministratorNetwork EngineerSoftware Engineer{è8Back2çUcv-exp6CV - Experience`ßS1^]ÜJ#ejaƒ^]ÜJ#ejbƒ^]ÜJ#ejcƒ'çUeja6CV - Experience`dƒ, July 1998 - November 1999, Strathclyde University&ßS1^]Designed and created content for the Student's Union website.^]Managed Windows NT and UNIX web servers running IIS and Apache.^]Creation of a custom e-commerce system from the ground up in Perl.çUejb6CV - Experience`dƒ, July 1998 - May 1999, Cowgate Books&ßS1^]Management of Windows 95 clients from a Novell server.^]Evolution of internal network to support Internet connectivity.^]Provided telephone support and repair callout.çUejc6CV - Experience`dƒ', June 1998 - July 1998, Cowgate Books&ßS1^]Analysis and upgrade of existing database system.^]Creation of software to allow web-based order tracking.^]Design and creation of corporate website.wml-tools-0.0.4.orig/samples/cv-edu.wml0100600000175000017500000000161307023563563016074 0ustar ferfer

Strathclyde University
OLSP High School

Strathclyde University (Glasgow)
Obtained BSc in Science Studies from 1996 to 1999. Course included HTML, C, UNIX, Windows (including Office).

OLSP High School (Dumbarton)
Highers: Computing (A), Technical Studies (B), Physics (B), English (B), Maths (B)

wml-tools-0.0.4.orig/samples/cv-edu.wmlc0100600000175000017500000000070507023563563016240 0ustar ferferj{è8Back2çUcv-edu6CV - Education`ßS1^]ÜJ#eeaStrathclyde University^]ÜJ#eebOLSP High SchoolçUeea6CV - Education`dStrathclyde University (Glasgow)& Obtained BSc in Science Studies from 1996 to 1999. Course included HTML, C, UNIX, Windows (including Office). çUeeb6CV - Education`dOLSP High School (Dumbarton)& Highers: Computing (A), Technical Studies (B), Physics (B), English (B), Maths (B) wml-tools-0.0.4.orig/samples/toys.wml0100600000175000017500000000131607023563563015707 0ustar ferfer

slashdot
BBC news

This will eventually be a /. headline converter. Eventually.

This will eventually be a BBC news headline converter.

wml-tools-0.0.4.orig/samples/toys.wmlc0100600000175000017500000000042307023563563016050 0ustar ferferj{è8Back2çUtoys6pwot toysàßS1^]ÜJ#slashslashdot^]ÜJ#bbcBBC newsçUslash6slashdot.org` This will eventually be a /. headline converter. Eventually. çUbbc6BBC news` This will eventually be a BBC news headline converter. wml-tools-0.0.4.orig/samples/scrib.wml0100600000175000017500000000100707023563563016010 0ustar ferfer

The Secret History of GCCS
Neon Genesis Evangelion

wml-tools-0.0.4.orig/samples/scrib.wmlc0100600000175000017500000000023407023563563016154 0ustar ferferj{è8Back2çUscrib6scribblingsàßS1^]ÜJscrib-gccs.wmlThe Secret History of GCCS^]ÜJnge/index.wmlNeon Genesis Evangelionwml-tools-0.0.4.orig/samples/scrib-gccs.wml0100600000175000017500000000176407023563563016737 0ustar ferfer

The GCCS office has been long thought of, by those who think they are in power, as an annoyance. They are much more than that. They're just too smart to let anyone else notice.

Many years ago, under the cover of darkness, an incredible strategic plan was carried out which saw GCCS seize control of the Union in less than 7 seconds. Since it took so little time to achieve, they didn't stop there. Soon Westminster came and went, then the Hague, the White House and so on.

There is no end to their cunning. To distract people from their plan, they concocted the Y2k bug to keep everyone busy until it was too late. If the lights go out on midnight of 31st December, don't be so sure it was a technical fault ...

wml-tools-0.0.4.orig/samples/scrib-gccs.wmlc0100600000175000017500000000137207023563563017075 0ustar ferferjçUgccs6GCCSè8Back2` The GCCS office has been long thought of, by those who think they are in power, as an annoyance. They are much more than that. They're just too smart to let anyone else notice. ` Many years ago, under the cover of darkness, an incredible strategic plan was carried out which saw GCCS seize control of the Union in less than 7 seconds. Since it took so little time to achieve, they didn't stop there. Soon Westminster came and went, then the Hague, the White House and so on. ` There is no end to their cunning. To distract people from their plan, they concocted the Y2k bug to keep everyone busy until it was too late. If the lights go out on midnight 31st of December, don't be so sure it was a technical fault ... wml-tools-0.0.4.orig/samples/index.wml0100600000175000017500000000250207023563564016017 0ustar ferfer

pwot.co.uk in WML!

about links
scribblings toys

pwot.co.uk has been my toy on the web for many years now. As a learning tool for WAP and WML I decided to try to convert some of my website.
I've converted my CV to WML and have also written some toys to play with on the nice new WAP-enabled phone you must have.

Unfortunetly I don't know of any other WML sites. If you know of any, please mail me at ponder@pwot.co.uk.

wml-tools-0.0.4.orig/samples/slashdot.wmlc0100600000175000017500000000063207025304530016662 0ustar ferferj{è8Back2çUinit6Headlines`dSlashdot:News for Nerds. Stuff that Matters.`The Genome Project and the Dark Side`Corporate vs Open Source:Sun Stealing Blackdown?`Napster Being Sued by RIAA`iCraveTV Sued by Networks`On Using X w/o the Rodent`V2 OS`Legos Declared Toy of Century`British Telecom Announces Unmetered Net Access`No Linux at Fox.com`VA Linux IPO Updatewml-tools-0.0.4.orig/README0100600000175000017500000000253207045321603013374 0ustar ferferwml-tools v0.0.4 (31/1/2000) This is the latest release of wml-tools. At the moment it only contains a WBMP viewer, a simple WML bytecode decoder, a very simple WML deck viewer and a tempremental WML to HTML converter. Also included as a bonus is a Netscape RDF to WML deck converter. Vital to get the /. headlines on your WAP device. It seems to work on a few Linux boxes I have access to (Slackware 3.6, 4.0, 7.0, Redhat 5.2) and I should be able to test it elsewhere soon. If it doesn't compile for you, let me know what setup you have and I'll see about fixing it. These tools require libxml and libz (which libxml requires). The configure script and makefiles are still as dire as ever but should be replaced by something better soon. Compilation should just be a matter of ./configure then make. There is a README file in each tool's directory to give some notes and instructions. In the samples directory are some WML decks I used to teach myself the basics of WML - they should be of some use in understanding the layout of WML files. The bugs are being squashed steadily. Feedback on these tools are always welcome. Send any comments, queries, bugfixes or BNL guitar tab to the address at the bottom of the file. Keep any spam and flames to yourself or forever be consigned to /dev/null. Thomas -- ( wml-tools@pwot.co.uk ) - ( http://pwot.co.uk/wml/ ) wml-tools-0.0.4.orig/rdfwml/0042700000175000017500000000000007045321510014005 5ustar ferferwml-tools-0.0.4.orig/rdfwml/slashdot.rdf0100600000175000017500000000353407023533501016326 0ustar ferfer Slashdot:News for Nerds. Stuff that Matters. http://slashdot.org/index.pl?section= News for Nerds. Stuff that Matters Slashdot http://slashdot.org/images/slashdotlg.gif http://slashdot.org The Genome Project and the Dark Side http://slashdot.org/article.pl?sid=99/12/01/1232256 Corporate vs Open Source:Sun Stealing Blackdown? http://slashdot.org/article.pl?sid=99/12/08/027200 Napster Being Sued by RIAA http://slashdot.org/article.pl?sid=99/12/08/0752248 iCraveTV Sued by Networks http://slashdot.org/article.pl?sid=99/12/08/025251 On Using X w/o the Rodent http://slashdot.org/article.pl?sid=99/12/08/0157254 V2 OS http://slashdot.org/article.pl?sid=99/12/07/1617224 Legos Declared Toy of Century http://slashdot.org/article.pl?sid=99/12/07/152238 British Telecom Announces Unmetered Net Access http://slashdot.org/article.pl?sid=99/12/07/0923250 No Linux at Fox.com http://slashdot.org/article.pl?sid=99/12/07/1315234 VA Linux IPO Update http://slashdot.org/article.pl?sid=99/12/07/169214 wml-tools-0.0.4.orig/rdfwml/Makefile0100600000175000017500000000042207023770515015451 0ustar ferferSRC = rdfwml.c all: rdfwml rdfwml.cgi re: clean all rdfwml: $(CC) $(CC_OPS) $(XML_CC_OPS) -o rdfwml $(SRC) $(LD_OPS) $(XML_LD_OPS) rdfwml.cgi: $(CC) $(CC_OPS) $(XML_CC_OPS) -DCGI_BIN -o rdfwml.cgi $(SRC) $(LD_OPS) $(XML_LD_OPS) clean: rm -f *.o rdfwml rdfwml.cgi *~ wml-tools-0.0.4.orig/rdfwml/rdfwml.c0100600000175000017500000000615307024160602015446 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ #include #include #include #include #include #ifdef CGI_BIN void wmlError(char *error) { puts(""); puts(""); puts(""); puts(" "); puts(" "); printf("

%s

\n", error); puts("
"); puts("
"); } #endif /* CGI_BIN */ void outputString(char *str) { while(*str != '\0') { switch(*str) { case '$': printf("$$"); break; case '<': printf("<"); break; case '>': printf(">"); break; default: putchar(*str); break; } str++; } } void parseChannel(xmlNodePtr channel) { xmlNodePtr node, on; for(node = channel; node != NULL; node = node->next) { if(strcasecmp("title", node->name) == 0) { on = node->childs; if(strcasecmp("text", on->name) == 0) printf("

%s

\n", on->content); } } } void parseHeadline(xmlNodePtr item) { xmlNodePtr node, on; for(node = item; node != NULL; node = node->next) { if(strcasecmp("title", node->name) == 0) { on = node->childs; if(strcasecmp("text", on->name) == 0) printf("

----

\n"); printf("

"); outputString(on->content); printf("

\n"); } } } void parseRdf(xmlNodePtr rdf) { xmlNodePtr node; puts(""); puts(""); puts(""); puts(" "); puts(" "); for(node = rdf->childs; node != NULL; node = node->next) { if(strcasecmp("channel", node->name) == 0) parseChannel(node->childs); else if(strcasecmp("item", node->name) == 0) parseHeadline(node->childs); } puts(" "); puts(""); } int main(int argc, char **argv) { xmlDocPtr rdf; char *filename; #ifdef CGI_BIN printf("Content-type: text/vnd.wap.wml\n\n"); if(!(filename = getenv("QUERY_STRING"))) { wmlError("No channel file requested."); exit(0); } if(strchr(filename, '/') || strchr(filename, '%')) { wmlError("No channel file requested."); exit(0); } #else if(argc != 2) { fprintf(stderr, "Usage: %s file.rdf\n", argv[0]); exit(1); } filename = argv[1]; #endif /* CGI_BIN */ rdf = xmlParseFile(filename); if(!rdf) { #ifdef CGI_BIN wmlError("Error parsing channel file."); exit(0); #else fprintf(stderr, "Couldn't parse %s as a valid XML document\n", argv[1]); exit(1); #endif /* CGI_BIN */ } parseRdf(rdf->root); exit(0); } wml-tools-0.0.4.orig/rdfwml/README0100600000175000017500000000063607023564135014677 0ustar ferferThis is a simple converter for Netscape RDF channel files to small WML decks which contain a small card with each item. The CGI variant just adds the correct Content-Type header and works out the file to parse from the QUERY_STRING variable. To use rdfwml just call it with an RDF file (one from Slashdot is provided). To use rdfwml.cgi, link it like: News! wml-tools-0.0.4.orig/wmld/0042700000175000017500000000000007045321510013455 5ustar ferferwml-tools-0.0.4.orig/wmld/Makefile0100600000175000017500000000023407023771010015111 0ustar ferferOBJS = wmld.o all: wmld re: clean all .c.o: $(CC) $(CC_OPS) -c $*.c wmld: $(OBJS) $(CC) $(CC_OPS) -o wmld $(OBJS) clean: rm -f $(OBJS) wmld core *~ wml-tools-0.0.4.orig/wmld/.hexlist0100600000175000017500000001040007023545012015127 0ustar ferfer/* 0x00 */ NULL, /* 0x01 */ NULL, /* 0x02 */ NULL, /* 0x03 */ NULL, /* 0x04 */ NULL, /* 0x05 */ NULL, /* 0x06 */ NULL, /* 0x07 */ NULL, /* 0x08 */ NULL, /* 0x09 */ NULL, /* 0x0A */ NULL, /* 0x0B */ NULL, /* 0x0C */ NULL, /* 0x0D */ NULL, /* 0x0E */ NULL, /* 0x0F */ NULL, /* 0x10 */ NULL, /* 0x11 */ NULL, /* 0x12 */ NULL, /* 0x13 */ NULL, /* 0x14 */ NULL, /* 0x15 */ NULL, /* 0x16 */ NULL, /* 0x17 */ NULL, /* 0x18 */ NULL, /* 0x19 */ NULL, /* 0x1A */ NULL, /* 0x1B */ NULL, /* 0x1C */ NULL, /* 0x1D */ NULL, /* 0x1E */ NULL, /* 0x1F */ NULL, /* 0x20 */ NULL, /* 0x21 */ NULL, /* 0x22 */ NULL, /* 0x23 */ NULL, /* 0x24 */ NULL, /* 0x25 */ NULL, /* 0x26 */ NULL, /* 0x27 */ NULL, /* 0x28 */ NULL, /* 0x29 */ NULL, /* 0x2A */ NULL, /* 0x2B */ NULL, /* 0x2C */ NULL, /* 0x2D */ NULL, /* 0x2E */ NULL, /* 0x2F */ NULL, /* 0x30 */ NULL, /* 0x31 */ NULL, /* 0x32 */ NULL, /* 0x33 */ NULL, /* 0x34 */ NULL, /* 0x35 */ NULL, /* 0x36 */ NULL, /* 0x37 */ NULL, /* 0x38 */ NULL, /* 0x39 */ NULL, /* 0x3A */ NULL, /* 0x3B */ NULL, /* 0x3C */ NULL, /* 0x3D */ NULL, /* 0x3E */ NULL, /* 0x3F */ NULL, /* 0x40 */ NULL, /* 0x41 */ NULL, /* 0x42 */ NULL, /* 0x43 */ NULL, /* 0x44 */ NULL, /* 0x45 */ NULL, /* 0x46 */ NULL, /* 0x47 */ NULL, /* 0x48 */ NULL, /* 0x49 */ NULL, /* 0x4A */ NULL, /* 0x4B */ NULL, /* 0x4C */ NULL, /* 0x4D */ NULL, /* 0x4E */ NULL, /* 0x4F */ NULL, /* 0x50 */ NULL, /* 0x51 */ NULL, /* 0x52 */ NULL, /* 0x53 */ NULL, /* 0x54 */ NULL, /* 0x55 */ NULL, /* 0x56 */ NULL, /* 0x57 */ NULL, /* 0x58 */ NULL, /* 0x59 */ NULL, /* 0x5A */ NULL, /* 0x5B */ NULL, /* 0x5C */ NULL, /* 0x5D */ NULL, /* 0x5E */ NULL, /* 0x5F */ NULL, /* 0x60 */ NULL, /* 0x61 */ NULL, /* 0x62 */ NULL, /* 0x63 */ NULL, /* 0x64 */ NULL, /* 0x65 */ NULL, /* 0x66 */ NULL, /* 0x67 */ NULL, /* 0x68 */ NULL, /* 0x69 */ NULL, /* 0x6A */ NULL, /* 0x6B */ NULL, /* 0x6C */ NULL, /* 0x6D */ NULL, /* 0x6E */ NULL, /* 0x6F */ NULL, /* 0x70 */ NULL, /* 0x71 */ NULL, /* 0x72 */ NULL, /* 0x73 */ NULL, /* 0x74 */ NULL, /* 0x75 */ NULL, /* 0x76 */ NULL, /* 0x77 */ NULL, /* 0x78 */ NULL, /* 0x79 */ NULL, /* 0x7A */ NULL, /* 0x7B */ NULL, /* 0x7C */ NULL, /* 0x7D */ NULL, /* 0x7E */ NULL, /* 0x7F */ NULL, /* 0x80 */ NULL, /* 0x81 */ NULL, /* 0x82 */ NULL, /* 0x83 */ NULL, /* 0x84 */ NULL, /* 0x85 */ NULL, /* 0x86 */ NULL, /* 0x87 */ NULL, /* 0x88 */ NULL, /* 0x89 */ NULL, /* 0x8A */ NULL, /* 0x8B */ NULL, /* 0x8C */ NULL, /* 0x8D */ NULL, /* 0x8E */ NULL, /* 0x8F */ NULL, /* 0x90 */ NULL, /* 0x91 */ NULL, /* 0x92 */ NULL, /* 0x93 */ NULL, /* 0x94 */ NULL, /* 0x95 */ NULL, /* 0x96 */ NULL, /* 0x97 */ NULL, /* 0x98 */ NULL, /* 0x99 */ NULL, /* 0x9A */ NULL, /* 0x9B */ NULL, /* 0x9C */ NULL, /* 0x9D */ NULL, /* 0x9E */ NULL, /* 0x9F */ NULL, /* 0xA0 */ NULL, /* 0xA1 */ NULL, /* 0xA2 */ NULL, /* 0xA3 */ NULL, /* 0xA4 */ NULL, /* 0xA5 */ NULL, /* 0xA6 */ NULL, /* 0xA7 */ NULL, /* 0xA8 */ NULL, /* 0xA9 */ NULL, /* 0xAA */ NULL, /* 0xAB */ NULL, /* 0xAC */ NULL, /* 0xAD */ NULL, /* 0xAE */ NULL, /* 0xAF */ NULL, /* 0xB0 */ NULL, /* 0xB1 */ NULL, /* 0xB2 */ NULL, /* 0xB3 */ NULL, /* 0xB4 */ NULL, /* 0xB5 */ NULL, /* 0xB6 */ NULL, /* 0xB7 */ NULL, /* 0xB8 */ NULL, /* 0xB9 */ NULL, /* 0xBA */ NULL, /* 0xBB */ NULL, /* 0xBC */ NULL, /* 0xBD */ NULL, /* 0xBE */ NULL, /* 0xBF */ NULL, /* 0xC0 */ NULL, /* 0xC1 */ NULL, /* 0xC2 */ NULL, /* 0xC3 */ NULL, /* 0xC4 */ NULL, /* 0xC5 */ NULL, /* 0xC6 */ NULL, /* 0xC7 */ NULL, /* 0xC8 */ NULL, /* 0xC9 */ NULL, /* 0xCA */ NULL, /* 0xCB */ NULL, /* 0xCC */ NULL, /* 0xCD */ NULL, /* 0xCE */ NULL, /* 0xCF */ NULL, /* 0xD0 */ NULL, /* 0xD1 */ NULL, /* 0xD2 */ NULL, /* 0xD3 */ NULL, /* 0xD4 */ NULL, /* 0xD5 */ NULL, /* 0xD6 */ NULL, /* 0xD7 */ NULL, /* 0xD8 */ NULL, /* 0xD9 */ NULL, /* 0xDA */ NULL, /* 0xDB */ NULL, /* 0xDC */ NULL, /* 0xDD */ NULL, /* 0xDE */ NULL, /* 0xDF */ NULL, /* 0xE0 */ NULL, /* 0xE1 */ NULL, /* 0xE2 */ NULL, /* 0xE3 */ NULL, /* 0xE4 */ NULL, /* 0xE5 */ NULL, /* 0xE6 */ NULL, /* 0xE7 */ NULL, /* 0xE8 */ NULL, /* 0xE9 */ NULL, /* 0xEA */ NULL, /* 0xEB */ NULL, /* 0xEC */ NULL, /* 0xED */ NULL, /* 0xEE */ NULL, /* 0xEF */ NULL, /* 0xF0 */ NULL, /* 0xF1 */ NULL, /* 0xF2 */ NULL, /* 0xF3 */ NULL, /* 0xF4 */ NULL, /* 0xF5 */ NULL, /* 0xF6 */ NULL, /* 0xF7 */ NULL, /* 0xF8 */ NULL, /* 0xF9 */ NULL, /* 0xFA */ NULL, /* 0xFB */ NULL, /* 0xFC */ NULL, /* 0xFD */ NULL, /* 0xFE */ NULL, /* 0xFF */ NULL, wml-tools-0.0.4.orig/wmld/wmld.c0100600000175000017500000001510107025301502014554 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ #include #include #define WML_NO_CLOSURES #include #include #undef WML_NO_CLOSURES FILE *in; FILE *out; int depth; unsigned char *stringTable; int stringTableLength; void crashBurn(void) { fflush(out); fprintf(stderr, "\nFATAL: Decompile halted at byte %lu.\n", ftell(in)); fclose(in); fclose(out); exit(1); } inline char *stringTableRef(int idx) { return (idx<=stringTableLength)?(&stringTable[idx]):NULL; } void parseString(void) { int input; while((input = getc(in)) != WMLC_INLINE_STRING_END) fputc(input, out); } void parseValueAttributes(void) { int input, ref; char *vattr, *st; while(1==1) { input = getc(in); if(input == WMLG_STR_T) { ref = getc(in); if((st = stringTableRef(ref))) { fprintf(out, "%s", st); } else { fprintf(stderr, "Parse error: string table entry %d referenced but invalid.\n", ref); } } else if((input == WMLG_EXT_T_2)||(input == WMLG_EXT_T_1)||(input == WMLG_EXT_T_0)) { ref = getc(in); if((st = stringTableRef(ref))) { fprintf(out, "$(%s)", st); } else { fprintf(stderr, "Parse error: string table entry %d referenced but invalid.\n", ref); } } else if((input == WMLG_EXT_I_2)||(input == WMLG_EXT_I_1)||(input == WMLG_EXT_I_0)) { fprintf(out, "$("); parseString(); fprintf(out, ")"); } else if(input == WMLC_INLINE_STRING) { parseString(); } else if((vattr = WML_VATTR_DESC(input))) { fputs(vattr, out); } else { ungetc(input, in); return; } } } void parseAttributes(void) { int input, ref; char *attr, *st; while((input = getc(in)) != WMLTC_END) { if(input == WMLG_STR_T) { ref = getc(in); if((st = stringTableRef(ref))) { fprintf(out, "%s", st); } else { fprintf(stderr, "Parse error: string table entry %d referenced but invalid.\n", ref); crashBurn(); } } else { if(!(attr = WML_SATTR_DESC(input))) { fprintf(stderr, "Parse error: expected attribute, got 0x%x.\n", input); crashBurn(); } if(!(strchr(attr, '"'))) { fprintf(out, " %s=\"", attr); parseValueAttributes(); fprintf(out, "\""); } else { fprintf(out, " %s", attr); if(attr[strlen(attr)-1] != '"') { parseValueAttributes(); fprintf(out, "\""); } } } } } void parseTags(void) { int input, tag, content, attributes, ref; char *st; while((input = getc(in)) != EOF) { /* Codes we can come across at this point could be : * WMLC_INLINE_STRING - Inline strings * WMLG_STR_T - String table references * WMLG_EXT_T_? - Inline variables, a bit like environment variables I think * WMLG_EXT_I_? - Inline variables but named as inline strings * Tags * (there might be more, but I don't think so) We need to check for all of them */ /* Case 1: An inline string. Just print it out. */ if(input == WMLC_INLINE_STRING) { fprintf(out, "%*s", (depth * 2), ""); parseString(); fputc('\n', out); /* Case 2: A string table reference. Find it and print it. */ } else if(input == WMLG_STR_T) { ref = getc(in); if((st = stringTableRef(ref))) { fprintf(out, "%*s%s\n", (depth * 2), "", st); } else { fprintf(stderr, "Parse error: string table entry %d referenced but invalid.\n", ref); } /* Case 3: A variable reference from the string table. Find, format and print. */ } else if((input == WMLG_EXT_T_2)||(input == WMLG_EXT_T_1)||(input == WMLG_EXT_T_0)) { ref = getc(in); if((st = stringTableRef(ref))) { fprintf(out, "%*s$(%s)\n", (depth * 2), "", st); } else { fprintf(stderr, "Parse error: string table entry %d referenced but invalid.\n", ref); } /* Case 4: A variable reference as an inline string. Format and print. */ } else if((input == WMLG_EXT_I_2)||(input == WMLG_EXT_I_1)||(input == WMLG_EXT_I_0)) { fprintf(out, "%*s$(", (depth * 2), ""); parseString(); fprintf(out, ")\n"); /* Case 5: A tag. Find out what one and decode. */ } else { tag = (input & WMLTC_TAG_VALUE); content = (input & WMLTC_CONTENT); attributes = (input & WMLTC_ATTRIBUTES); if(input == WMLTC_END) return; if(!(WML_TAG_DESC(tag))) { fprintf(stderr, "Parse error: expected tag, got 0x%x (0x%x).\n", input, tag); crashBurn(); } fprintf(out, "%*s<%s", (depth * 2), "", WML_TAG_DESC(tag)); if(attributes) parseAttributes(); if(content) { fprintf(out, ">\n"); depth++; parseTags(); depth--; fprintf(out, "%*s\n", (depth * 2), "", WML_TAG_DESC(tag)); } else fprintf(out, "/>\n"); } } } char *buildNewFilename(char *old) { static char str[256]; strcpy(str, old); if(str[strlen(old) - 1] == 'c') str[strlen(old) - 1] = '\0'; else strcat(str, ".wml"); return str; } int main(int argc, char **argv) { int wbxmlVersion, wmlVersion, charset, i, j; char *inf, *outf; if(argc == 2) { inf = argv[1]; outf = buildNewFilename(inf); } else if(argc == 3) { inf = argv[1]; outf = argv[2]; } else { fprintf(stderr, "Usage: %s file.wmlc [output.wml]\n", argv[0]); exit(1); } if(!(in = fopen(inf, "r"))) { fprintf(stderr, "Can't open %s for reading\n", inf); exit(1); } if(!(out = fopen(outf, "w"))) { fprintf(stderr, "Can't open %s for writing\n", outf); exit(1); } depth = 0; wbxmlVersion = getc(in); wmlVersion = getc(in); if((wbxmlVersion != 1) || (wmlVersion != 4)) { fprintf(stderr, "Wrong version numbers (got %d %d, expected %d %d)\n", wbxmlVersion, wmlVersion, 1, 4); crashBurn(); } /* I don't have the charset codes, so I don't know how to handle this. Just read it and hope for UTF-8 */ charset = getc(in); if((stringTableLength = getc(in)) > 0) { if(!(stringTable = (char*)malloc(stringTableLength))) { fprintf(stderr, "String table allocation failed\n"); crashBurn(); } for(i = 0; i < stringTableLength; i++) stringTable[i] = getc(in); } /* We should now expect to start parsing tags, so spit out the XML and DTD headers. */ fputs("\n", out); fputs("\n\n", out); parseTags(); return 0; } wml-tools-0.0.4.orig/wmld/README0100600000175000017500000000121307025302460014330 0ustar ferferAt the moment this is a simple WML bytecode decompiler, wmld. This has been built out of the few WML bytecode references I have (they are incredibly difficult to get a hold of without having to sign your life away on licensing agreements or paying ridiculous amounts of cash for). The decompiler can now handle value attributes properly, inline strings, the string table (with references by normal text or by variable name) and can now decode bytecode to useable WML code with just about everything I can throw at it. I'd probably say that this isn't alpha code anymore. It's now beta. It stops being beta when I test it with a LOT more bytecode. wml-tools-0.0.4.orig/configure0100700000175000017500000000676107045321464014436 0ustar ferfer#!/bin/sh VERSION="0.0.4" LD_OPS="" CC_OPS="-I../" CC="" OPTIMISE_IF_GCC="y" XML_CONFIG="xml-config" SHARED_LINK="" echo "wml-tools v$VERSION configuration script" while [ $# -gt 0 ]; do case "$1" in --cc) shift CC="$1" echo "Setting compiler to '$CC'" ;; --cc-flags) shift CC_OPS="$CC_OPS $1" echo "Adding compiler flags '$1'" ;; --xml-config) shift XML_CONFIG="$1" echo "Setting xml-config command to '$XML_CONFIG'" ;; *) echo "Unknown option '$1'" echo "" echo "Known options:" echo "" echo " --cc : Set compiler to " echo " --cc-flags : Set standard compiler flags to " echo " --xml-config : Set xml-config program to " echo "" exit 1 ;; esac shift done #### Test if compiler works CC_WORKS="n" for CC_TEST in "$CC" gcc cc; do if [ "$CC_WORKS" = "n" -a "$CC_TEST" != "" ]; then CC="$CC_TEST" echo -n "Testing compiler $CC ... " cat >/tmp/.pwt.c << EOF #include void main(void) { puts("CC Test"); } EOF $CC -o /tmp/.pwt /tmp/.pwt.c >/dev/null 2>&1 if [ -e "/tmp/.pwt" ]; then echo "Found" echo -n "Checking if compiler $CC works ... " if [ "`/tmp/.pwt`" = "CC Test" ]; then echo "Yes" CC_WORKS="y" else echo "No" CC_WORKS="n" fi else echo "Not found" CC_WORKS="n" fi fi done rm -f /tmp/.pwt /tmp/.pwt.c if [ "$CC_WORKS" = "n" ]; then echo "Couldn't find a working compiler" exit 1 fi if [ "$CC" = "gcc" ]; then if [ "$OPTIMISE_IF_GCC" = "y" ]; then echo "Adding optimising flags for compiler" CC_OPS="$CC_OPS -O2" fi fi #### ##### We don't need socket code yet so miss out # ##### Solaris check (-lsocket) # #echo -n "Testing for bind() in -lsocket ... " #cat >/tmp/.pwt.c << EOF ##include ##include ##include #void main(void) { #struct sockaddr* mad; #int i; # bind(i, (struct sockaddr*) &mad, 1); #} #EOF # #$CC -o /tmp/.pwt /tmp/.pwt.c >/dev/null 2>&1 #if [ -e "/tmp/.pwt" ]; then # echo "Not required" #else # $CC -o /tmp/.pwt /tmp/.pwt.c -lsocket >/dev/null 2>&1 # if [ -e "/tmp/.pwt" ]; then # echo "Found" # LD_OPS="$LD_OPS -lsocket -lnsl" # else # echo "Needed but not found" # rm -f /tmp/.pwt /tmp/.pwt.c # exit 1 # fi #fi #rm -f /tmp/.pwt /tmp/.pwt.c # ##### #### XML config echo -n "Getting XML compilation flags ... " XML_CC_OPS="`$XML_CONFIG --cflags`" XML_LD_OPS="`$XML_CONFIG --libs`" if [ "$XML_CC_OPS" = "" -o "$XML_LD_OPS" = "" ]; then echo "Not found" echo "WARNING: Couldn't execute '$XML_CONFIG' for XML compilation flags." echo "WARNING: Check libxml is installed and try again." exit 1 else echo "Done" fi #### echo "Compilation flags :" echo "" echo " CC : $CC" echo " CC_OPS : $CC_OPS" echo " LD_OPS : $LD_OPS" echo "XML flags : Include '$XML_CC_OPS'" echo " : Link '$XML_LD_OPS'" echo "" echo "Building Makefile" if [ -f "Makefile" ]; then mv -f Makefile Makefile.bak fi CC_USE=`echo $CC | sed 's/\\//\\\\\//g'` CC_OPS_USE=`echo $CC_OPS | sed 's/\\//\\\\\//g'` LD_OPS_USE=`echo $LD_OPS | sed 's/\\//\\\\\//g'` XML_CC_OPS_USE=`echo $XML_CC_OPS | sed 's/\\//\\\\\//g'` XML_LD_OPS_USE=`echo $XML_LD_OPS | sed 's/\\//\\\\\//g'` sed "s/%CC%/$CC_USE/g s/%CC_OPS%/$CC_OPS_USE/g s/%LD_OPS%/$LD_OPS_USE/g s/%XML_CC_OPS%/$XML_CC_OPS_USE/g s/%XML_LD_OPS%/$XML_LD_OPS_USE/g" Makefile echo "Done" wml-tools-0.0.4.orig/LICENSE0100600000175000017500000000317407025034644013530 0ustar ferfer(I hate legal stuff, but here goes ...) Terms used in this document : * I, me : The author, the person who coded these tools * you : The user, the person reading this, the person to whom the license applies * programs : The source code and executables in this package Disclaimer : These programs come with no warranty, implied or stated. I cannot be held responsible for the actions of the programs. If they damage your equipment or even you I accept no liability. If it breaks, well, sorry but that's tough. What you are entitled to : You can download, compile and use these programs for any non-commercial activities. You can distribute them freely so long as no charge (other than REASONABLE media charges) are made. You may make changes to these programs and redistribute them so long as : * The new distribution makes clear that it is derived from these programs * The changes made can be freely incorporated in future releases of these programs * The changes are only used for non-commercial activities * The copyright notices are unchanged You are NOT entitled to : You may not sell these programs or engage in any activity that generates profit from the use of these programs. You may not redistribute these programs without maintaining the copyright notices. You may not redistribute modified versions of these programs without maintaining the copyright notices and clear notices that these programs were the basis of the new distribution. Summary : Use, compile and be happy. Give credit where credit is due and don't try to make money out of it. wml-tools-0.0.4.orig/wmlc/0042700000175000017500000000000007045321510013454 5ustar ferferwml-tools-0.0.4.orig/wmlc/Makefile0100600000175000017500000000032007023770771015121 0ustar ferferOBJS = wmlc.o all: wmlc re: clean all .c.o: $(CC) $(CC_OPS) $(XML_CC_OPS) -c $*.c wmlc: $(OBJS) $(CC) $(CC_OPS) $(XML_CC_OPS) -o wmlc $(OBJS) $(LD_OPS) $(XML_LD_OPS) clean: rm -f $(OBJS) wmlc core *~ wml-tools-0.0.4.orig/wmlc/README0100600000175000017500000000152207025304504014333 0ustar ferferThis is a basic WML compiler. It takes the WML source and compiles into WML bytecode ready for transmission to a WAP device. It is quite basic and has a lot of limitations, but things it can compile can be decompiled by wmld and vice versa. So long as scripts and variables aren't involved, the pages compiled seem to work reasonably well in Nokia's WAP Toolkit and Ericsson's WAP SDK. It isn't most efficient, however, and the bytecode will be larger than other compilers. Optimisation is Coming Soon(tm). In order to compile bytecode in which simple scripts can work there needs to be a mechanism for building up the string table and also finding out what tag is appropriate (other compilers use WMLG_STR_T, WMLG_EXT_T_2 or WMLG_EXT_I_2 to specify that a variable is coming and I don't know which one to use - or even if it makes a difference) wml-tools-0.0.4.orig/wmlc/wmlc.c0100600000175000017500000001215307045321161014563 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ #include #include #include #include #include #define WML_NO_CLOSURES #include #include #undef WML_NO_CLOSURES #define WHITESPACE " \t\n\r" FILE *out; void crashBurn(void) { fflush(out); fprintf(stderr, "FATAL: Compile failed\n"); fclose(out); exit(1); } int tagHasClosure(int tag) { int i; for(i = 0; wml_no_closure_tags[i] > 0; i++) { if(tag == wml_no_closure_tags[i]) return 0; } return 1; } int getTagIndex(const char *tagText) { int i; for(i = 0; i < ((WML_TAGS_MAX - WML_TAGS_MIN)+1); i++) { if(wml_tags[i]) { if(strcmp(tagText, wml_tags[i]) == 0) return (i + WML_TAGS_MIN); } } return -1; } int getSattrIndex(const char *attrText) { int i; for(i = 0; i < ((WML_SATTR_MAX - WML_SATTR_MIN)+1); i++) { if(wml_start_attributes[i]) { if(strcmp(attrText, wml_start_attributes[i]) == 0) return (i + WML_SATTR_MIN); } } return -1; } void outputString(char *str) { int justPassedWhitespace = 0; fputc(WMLC_INLINE_STRING, out); while(*str != '\0') { if(strchr(WHITESPACE, *str)) { if(justPassedWhitespace == 0) { fputc(' ', out); justPassedWhitespace = 1; } } else { fputc(*str, out); justPassedWhitespace = 0; } str++; } fputc(WMLC_INLINE_STRING_END, out); } void compileAttributes(xmlAttrPtr attributes) { xmlNodePtr val; int sattrNum; char buffer[256]; while(attributes) { val = attributes->val; if(strcmp(val->name, "text") != 0) { fprintf(stderr, "Parse error: can't handle non plaintext attribute values\n"); crashBurn(); } /* This is rather nasty. There are many attribute tags, but some can only ever have two values or so and these only exist for those values. We need to check for those first. There also tags which take the start portion of an attribute and follow it with an inline string, such as WMLA_HREF_HTTP which expands to href="http:// and should be followed by the rest of the url. There also many ways of doing things here. Say your attribute reads : href="http://www.site.com/" You could compile this to : WMLS_HREF WMLC_INLINE_STRING "http://www.site.com/" WMLC_INLINE_STRING_END WMLS_HREF_HTTP WMLC_INLINE_STRING "www.site.com" WMLC_INLINE_STRING_END WMLS_HREF WMLA_HTTP_WWW WMLC_INLINE_STRING "site.com" WMLC_INLINE_STRING_END WMLS_HREF WMLA_HTTP_WWW WMLC_INLINE_STRING "site" WMLC_INLINE_STRING_END WMLA_COM and all are valid. However, we should be aiming for the shortest bytecode, which is the last option. At the moment we assume one code for the full attribute or the attribute name and an inline string as that at least lets it all compile, even if it's not the most efficient. */ sprintf(buffer, "%s=\"%s\"", attributes->name, val->content); if((sattrNum = getSattrIndex(buffer)) >= 0) { fputc(sattrNum, out); } else if((sattrNum = getSattrIndex(attributes->name)) >= 0) { fputc(sattrNum, out); outputString(val->content); } else { fprintf(stderr, "Parse error: unknown attribute %s (%s)\n", attributes->name, buffer); crashBurn(); } attributes = attributes->next; } fputc(WMLTC_END, out); } void compileTags(xmlNodePtr node) { int tagVal, tagNum = -1; while(node) { if(strcmp("text", node->name) == 0) { outputString(node->content); } else { if((tagNum = getTagIndex(node->name)) < 0) { fprintf(stderr, "Parse error: unknown tag %s\n", node->name); crashBurn(); } tagVal = tagNum; if(node->properties) tagVal |= WMLTC_ATTRIBUTES; if(node->childs) tagVal |= WMLTC_CONTENT; fputc(tagVal, out); if(node->properties) compileAttributes(node->properties); if(node->childs) compileTags(node->childs); if(tagHasClosure(tagNum)) fputc(WMLTC_END, out); } node = node->next; } } char *buildOutputFilename(char *oldFilename) { static char newFilename[256]; sprintf(newFilename, "%sc", oldFilename); return newFilename; } int main(int argc, char **argv) { xmlDocPtr doc; char *inf, *outf; /* This next line is just purley to shut GCC up */ inf = wml_value_attributes[0]; if(argc == 2) { inf = argv[1]; outf = buildOutputFilename(inf); } else if(argc == 3) { inf = argv[1]; outf = argv[2]; } else { fprintf(stderr, "Usage: %s file.wml [output.wmlc]\n", argv[0]); exit(1); } doc = xmlParseFile(inf); if(!doc) { fprintf(stderr, "Couldn't parse %s as a valid XML document\n", inf); exit(1); } if(!(out = fopen(outf, "w"))) { fprintf(stderr, "Couldn't open %s for writing\n", outf); exit(1); } /* Set the version numbers, charset and string table length (0) */ fputc(0x01, out); fputc(0x04, out); fputc(0x6A, out); fputc(0x00, out); compileTags(doc->root); fclose(out); return 0; } wml-tools-0.0.4.orig/COPYRIGHT0100600000175000017500000000043407023571635014016 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ wml-tools-0.0.4.orig/Changelog0100600000175000017500000000266607045321456014344 0ustar ferfer31/1/2000 - v0.0.4 * wmlc and wmlhtml now use the correct variable type for XML attribute pointers (xmlAttrPtr, not struct xmlAttr*). Now they will compile with newer versions of libxml. * Added wmlhtml to Makefile.in. Thanks to Peter Hanecak for pointing out this glaring omission (oops :). 14/12/1999 - v0.0.3 * wmld now uses the string table properly (oops) and can deal with references to the table from both strings and variable names. I'd say that this is no longer alpha code and could probably be used with reasonable success. * Remebered to change the version number in the configure script. 13/12/1999 - v0.0.2 * wmld now parses the string table and can use it accordingly. The code for this was missing from my copy of the bytecode specifications. Please note that all documentation relating to WML is gratefully accepted! * Added wmlhtml - a simple WML to HTML converter. This is just a quick hack and doesn't do a great job but gives a better idea than wmlv of how a WML deck will look. 10/12/1999 - v0.0.1 * First public release * Added files LICENSE and COPYRIGHT * wmlc now generates bytecode which now works in Nokia's WAP toolkit and Ericsson's WAP SDK. Most of the time, anyway * Fixed rdfwml to deal with <, > or $ in the input and fix accordingly 9/12/1999 - v0.0.0 * First noted build * wmld, wmlv, wbmp2xpm and rdfwml all compile * wmlc does nasty things wml-tools-0.0.4.orig/Makefile.in0100600000175000017500000000101707044254770014567 0ustar ferferCC = %CC% CC_OPS = %CC_OPS% LD_OPS = %LD_OPS% XML_CC_OPS = %XML_CC_OPS% XML_LD_OPS = %XML_LD_OPS% TOOLS = rdfwml wbmp wmlc wmld wmlv wmlhtml all: @for i in $(TOOLS); do \ ( cd $$i && $(MAKE) CC='$(CC)' CC_OPS='$(CC_OPS)' LD_OPS='$(LD_OPS)' XML_CC_OPS='$(XML_CC_OPS)' XML_LD_OPS='$(XML_LD_OPS)' all ) || exit 1; \ done clean: @for i in $(TOOLS); do \ ( cd $$i && $(MAKE) CC='$(CC)' CC_OPS='$(CC_OPS)' LD_OPS='$(LD_OPS)' XML_CC_OPS='$(XML_CC_OPS)' XML_LD_OPS='$(XML_LD_OPS)' clean ) || exit 1; \ done re: clean all wml-tools-0.0.4.orig/wmlhtml/0042700000175000017500000000000007045321511014177 5ustar ferferwml-tools-0.0.4.orig/wmlhtml/Makefile0100600000175000017500000000033707024715735015653 0ustar ferferOBJS = wmlhtml.o all: wmlhtml re: clean all .c.o: $(CC) $(CC_OPS) $(XML_CC_OPS) -c $*.c wmlhtml: $(OBJS) $(CC) $(CC_OPS) $(XML_CC_OPS) -o wmlhtml $(OBJS) $(LD_OPS) $(XML_LD_OPS) clean: rm -f $(OBJS) wmlhtml core *~ wml-tools-0.0.4.orig/wmlhtml/README0100600000175000017500000000041607025034401015052 0ustar ferferThis is a very simple WML to HTML converter. All it does is swap some tags around so that browsers can render it. It leaves in a lot of WML-specific tags but the HTML spec kindly tells browsers to ignore anything they don't understand, so the pages can still be viewed. wml-tools-0.0.4.orig/wmlhtml/wmlhtml.c0100600000175000017500000000524407045321200016024 0ustar ferfer/* wml-tools Copyright (C) 1999 Thomas Neill (tneill@pwot.co.uk) This file is part of the wml-tools package and it's usage is subject to the terms and conditions as given in the license. See the file LICENSE in the root directory of the distribution for details. */ #include #include #include #include #include FILE *out; int debug = 0; int dumpNodeIndent = 0; int htmlIndent = 0; void dumpNode(xmlNodePtr node) { while(node) { fprintf(stderr, "%*s == %s\n", dumpNodeIndent, "", node->name); if(node->childs) { dumpNodeIndent += 2; dumpNode(node->childs); dumpNodeIndent -= 2; } node = node->next; } } void showHtml(xmlNodePtr node) { xmlNodePtr val; xmlAttrPtr attr; while(node) { if(strcmp("text", node->name) == 0) { fprintf(out, "%*s%s\n", htmlIndent, "", node->content); } else if(strcmp("wml", node->name) == 0) { fprintf(out, "\n"); fprintf(out, "\n"); } else if(strcmp("card", node->name) == 0) { fprintf(out, "%*s\n", htmlIndent, ""); fprintf(out, "%*s\n", (htmlIndent + 2), "", xmlGetProp(node, "id"), xmlGetProp(node, "title")); fprintf(out, "%*s
%s
\n", htmlIndent, ""); } else if(strcmp("table", node->name) == 0) { fprintf(out, "%*s\n", htmlIndent, ""); } else { fprintf(out, "%*s<%s", htmlIndent, "", node->name); attr = node->properties; while(attr) { val = attr->val; if(strcmp(val->name, "text") != 0) continue; else fprintf(out, " %s=\"%s\"", attr->name, val->content); attr = attr->next; } fprintf(out, ">\n"); } if(node->childs) { htmlIndent += 2; showHtml(node->childs); htmlIndent -= 2; } if(strcmp("wml", node->name) == 0) { fprintf(out, "\n"); fprintf(out, "\n"); } else if(strcmp("card", node->name) == 0) { fprintf(out, "%*s
\n", htmlIndent, ""); } else if(strcmp("text", node->name) != 0) fprintf(out, "%*s\n", htmlIndent, "", node->name); node = node->next; } } int main(int argc, char **argv) { char *inf, *outf; xmlDocPtr doc; if(argc == 2) { inf = argv[1]; out = stdout; } else { fprintf(stderr, "Usage: %s file.wml [output.html]\n", argv[0]); exit(1); } doc = xmlParseFile(inf); if(!doc) { fprintf(stderr, "Couldn't parse %s as a valid XML document\n", inf); exit(1); } if(debug) dumpNode(doc->root); showHtml(doc->root); return 0; }