plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

runetab.c (1142B)


      1 #include <u.h>
      2 #include <libc.h>
      3 #include <draw.h>
      4 #include <html.h>
      5 #include "impl.h"
      6 
      7 Rune **runeconsttab;
      8 char *_runeconsttab[] = {
      9 	"        ",
     10 	" ",
     11 	"",
     12 	"#",
     13 	"+",
     14 	", ",
     15 	"-",
     16 	"-->",
     17 	"1",
     18 	"<",
     19 	">",
     20 	"?",
     21 	"Index search terms:",
     22 	"Reset",
     23 	"Submit",
     24 	"^0-9",
     25 	"_ISINDEX_",
     26 	"_blank",
     27 	"_fr",
     28 	"_no_name_submit_",
     29 	"_parent",
     30 	"_self",
     31 	"_top",
     32 	"application/x-www-form-urlencoded",
     33 	"circle",
     34 	"cm",
     35 	"content-script-type",
     36 	"disc",
     37 	"em",
     38 	"in",
     39 	"javascript",
     40 	"jscript",
     41 	"jscript1.1",
     42 	"mm",
     43 	"none",
     44 	"pi",
     45 	"pt",
     46 	"refresh",
     47 	"select",
     48 	"square",
     49 	"textarea",
     50 };
     51 
     52 Rune**
     53 _cvtstringtab(char **tab, int n)
     54 {
     55 	int i;
     56 	Rune **rtab;
     57 
     58 	rtab = emalloc(n*sizeof(rtab[0]));
     59 	for(i=0; i<n; i++)
     60 		rtab[i] = toStr((uchar*)tab[i], strlen(tab[i]), US_Ascii);
     61 	return rtab;
     62 }
     63 
     64 StringInt*
     65 _cvtstringinttab(AsciiInt *tab, int n)
     66 {
     67 	int i;
     68 	StringInt *stab;
     69 
     70 	stab = emalloc(n*sizeof(stab[0]));
     71 	for(i=0; i<n; i++){
     72 		stab[i].key = toStr((uchar*)tab[i].key, strlen(tab[i].key), US_Ascii);
     73 		stab[i].val = tab[i].val;
     74 	}
     75 	return stab;
     76 }
     77 
     78 void
     79 _runetabinit(void)
     80 {
     81 	runeconsttab = _cvtstringtab(_runeconsttab, nelem(_runeconsttab));
     82 	return;
     83 }