33 #ifndef HAVE_STRCASECMP
38 static int xml_isentity(
char *
s)
43 if (*s ==
'x' || *s ==
'X') {
45 while ((*s >=
'0' && *s <=
'9')
46 || (*s >=
'a' && *s <=
'f')
47 || (*s >=
'A' && *s <=
'F'))
50 while (*s >=
'0' && *s <=
'9')
54 while ((*s >=
'a' && *s <=
'z')
55 || (*s >=
'A' && *s <=
'Z'))
63 static void vml_bzptarray(
GVJ_t * job,
pointf * A,
int n)
69 for (i = 0; i < n; i++) {
87 if (color.
u.
rgba[3] == 0)
98 static void vml_grstroke(
GVJ_t * job,
int filled)
102 gvputs(job,
"<v:stroke color=\"");
103 vml_print_color(job, obj->
pencolor);
107 gvputs(job,
"\" dashstyle=\"dash");
109 gvputs(job,
"\" dashstyle=\"dot");
115 static void vml_grfill(
GVJ_t * job,
int filled)
120 gvputs(job,
" filled=\"true\" fillcolor=\"");
124 gvputs(job,
" filled=\"false\" ");
131 static char *buf =
NULL;
132 static int bufsize = 0;
135 int temp,cnt,remaining=0;
148 if (pos > (bufsize - 8)) {
154 if (*s ==
'&' && !(xml_isentity(s))) {
160 else if (*s ==
'<') {
164 else if (*s ==
'>') {
168 else if (*s ==
'-') {
172 else if (*s ==
' ' && prev && *prev ==
' ') {
177 else if (*s ==
'"') {
181 else if (*s ==
'\'') {
185 else if ((
unsigned char)*s > 127) {
186 byte=(
unsigned char)*s;
188 for (mask=127; mask < byte; mask=mask >>1){
211 *(sub--)=(
char)((
int)
'0'+ temp);
215 fprintf(stderr,
"Error during conversion to \"UTF-8\". Quiting.\n");
236 static void vml_comment(
GVJ_t * job,
char *
str)
242 static void vml_begin_job(
GVJ_t * job)
245 gvputs(job,
"\n<!-- Generated by ");
254 static void vml_begin_graph(
GVJ_t * job)
263 gvputs(job,
"<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n");
276 gvputs(job,
" <SCRIPT LANGUAGE='Javascript'>\n");
277 gvputs(job,
" function browsercheck()\n");
279 gvputs(job,
" var ua = window.navigator.userAgent\n");
280 gvputs(job,
" var msie = ua.indexOf ( 'MSIE ' )\n");
281 gvputs(job,
" var ievers;\n");
282 gvputs(job,
" var item;\n");
283 gvputs(job,
" var VMLyes=new Array('_VML1_','_VML2_');\n");
284 gvputs(job,
" var VMLno=new Array('_notVML1_','_notVML2_');\n");
285 gvputs(job,
" if ( msie > 0 ){ // If Internet Explorer, return version number\n");
286 gvputs(job,
" ievers= parseInt (ua.substring (msie+5, ua.indexOf ('.', msie )))\n");
288 gvputs(job,
" if (ievers>=5){\n");
289 gvputs(job,
" for (x in VMLyes){\n");
290 gvputs(job,
" item = document.getElementById(VMLyes[x]);\n");
291 gvputs(job,
" if (item) {\n");
292 gvputs(job,
" item.style.visibility='visible';\n");
295 gvputs(job,
" for (x in VMLno){\n");
296 gvputs(job,
" item = document.getElementById(VMLno[x]);\n");
297 gvputs(job,
" if (item) {\n");
298 gvputs(job,
" item.style.visibility='hidden';\n");
302 gvputs(job,
" for (x in VMLyes){\n");
303 gvputs(job,
" item = document.getElementById(VMLyes[x]);\n");
304 gvputs(job,
" if (item) {\n");
305 gvputs(job,
" item.style.visibility='hidden';\n");
308 gvputs(job,
" for (x in VMLno){\n");
309 gvputs(job,
" item = document.getElementById(VMLno[x]);\n");
310 gvputs(job,
" if (item) {\n");
311 gvputs(job,
" item.style.visibility='visible';\n");
316 gvputs(job,
" </SCRIPT>\n");
319 gvputs(job,
"<BODY onload='browsercheck();'>\n");
321 gvputs(job,
"<DIV id='_VML1_' style=\"position:relative; display:inline; visibility:hidden");
324 gvputs(job,
"v\\:* { behavior: url(#default#VML);display:inline-block}\n");
325 gvputs(job,
"</STYLE>\n");
326 gvputs(job,
"<xml:namespace ns=\"urn:schemas-microsoft-com:vml\" prefix=\"v\" />\n");
328 gvputs(job,
" <v:group style=\"position:relative; ");
333 static void vml_end_graph(
GVJ_t * job)
335 gvputs(job,
"</v:group>\n");
338 gvputs(job,
"<DIV id='_VML2_' style=\"position:relative;visibility:hidden\">\n");
339 gvputs(job,
"<!-- insert any other html content here -->\n");
341 gvputs(job,
"<DIV id='_notVML1_' style=\"position:relative;\">\n");
342 gvputs(job,
"<!-- this should only display on NON-IE browsers -->\n");
343 gvputs(job,
"<H2>Sorry, this diagram will only display correctly on Internet Explorer 5 (and up) browsers.</H2>\n");
345 gvputs(job,
"<DIV id='_notVML2_' style=\"position:relative;\">\n");
346 gvputs(job,
"<!-- insert any other NON-IE html content here -->\n");
349 gvputs(job,
"</BODY>\n</HTML>\n");
353 vml_begin_anchor(
GVJ_t * job,
char *href,
char *tooltip,
char *target,
char *
id)
358 if (tooltip && tooltip[0])
360 if (target && target[0])
365 static void vml_end_anchor(
GVJ_t * job)
376 switch (span->
just) {
408 gvprintf(job,
"<v:rect style=\"position:absolute; ");
409 gvprintf(job,
" left: %.2f; top: %.2f;", p1.
x, p1.
y);
410 gvprintf(job,
" width: %.2f; height: %.2f\"", p2.
x-p1.
x, p2.
y-p1.
y);
411 gvputs(job,
" stroked=\"false\" filled=\"false\">\n");
412 gvputs(job,
"<v:textbox inset=\"0,0,0,0\" style=\"position:absolute; v-text-wrapping:'false';padding:'0';");
434 gvprintf(job,
"color:#%02x%02x%02x;",
440 gvputs(job,
"\"><center>");
442 gvputs(job,
"</center></v:textbox>\n");
443 gvputs(job,
"</v:rect>\n");
446 static void vml_ellipse(
GVJ_t * job,
pointf * A,
int filled)
451 gvputs(job,
" <v:oval style=\"position:absolute;");
460 gvprintf(job,
" left: %.2f; top: %.2f;",left, top);
461 gvprintf(job,
" width: %.2f; height: %.2f\"", 2*dx, 2*dy);
463 vml_grfill(job, filled);
465 vml_grstroke(job, filled);
466 gvputs(job,
"</v:oval>\n");
470 vml_bezier(
GVJ_t * job,
pointf * A,
int n,
int arrow_at_start,
471 int arrow_at_end,
int filled)
473 gvputs(job,
" <v:shape style=\"position:absolute; ");
476 vml_grfill(job, filled);
478 vml_grstroke(job, filled);
479 gvputs(job,
"<v:path v=\"");
480 vml_bzptarray(job, A, n);
481 gvputs(job,
"/></v:shape>\n");
484 static void vml_polygon(
GVJ_t * job,
pointf * A,
int n,
int filled)
489 gvputs(job,
" <v:shape style=\"position:absolute; ");
491 vml_grfill(job, filled);
493 vml_grstroke(job, filled);
495 gvputs(job,
"<v:path v=\"");
496 for (i = 0; i < n; i++)
504 gvprintf(job,
"%.0f %.0f ", px, py);
505 if (i==0)
gvputs(job,
"l ");
506 if (i==n-1)
gvputs(job,
"x e \"/>");
508 gvputs(job,
"</v:shape>\n");
511 static void vml_polyline(
GVJ_t * job,
pointf * A,
int n)
515 gvputs(job,
" <v:shape style=\"position:absolute; ");
517 gvputs(job,
"<v:path v=\"");
518 for (i = 0; i < n; i++)
520 if (i==0)
gvputs(job,
" m ");
522 if (i==0)
gvputs(job,
" l ");
523 if (i==n-1)
gvputs(job,
" e ");
526 vml_grstroke(job, 0);
527 gvputs(job,
"</v:shape>\n");
534 static char *vml_knowncolors[] = {
535 "aqua",
"black",
"blue",
"fuchsia",
536 "gray",
"green",
"lime",
"maroon",
537 "navy",
"olive",
"purple",
"red",
538 "silver",
"teal",
"white",
"yellow"
583 sizeof(vml_knowncolors) /
sizeof(
char *),
void s1(graph_t *, node_t *)
void * grealloc(void *ptr, size_t size)
gvdevice_features_t device_features_vml
gvplugin_installed_t gvrender_vml_types[]
gvplugin_installed_t gvdevice_vml_types[]
gvrender_features_t render_features_vml
void * gmalloc(size_t nbytes)
gvdevice_features_t device_features_vmlz
#define GVRENDER_DOES_TRANSFORM
char * html_string(char *s)
gvrender_engine_t vml_engine
#define GVRENDER_Y_GOES_DOWN
int gvputs(GVJ_t *job, const char *s)
#define GVRENDER_DOES_TARGETS
#define GVRENDER_DOES_TOOLTIPS
CGRAPH_API char * agnameof(void *)
PostscriptAlias * postscript_alias
#define GVRENDER_DOES_MAPS
int strcasecmp(const char *s1, const char *s2)
#define GVDEVICE_COMPRESSED_FORMAT
#define GVRENDER_DOES_LABELS
#define GVDEVICE_DOES_TRUECOLOR
void gvprintf(GVJ_t *job, const char *format,...)