extern void gvdevice_format(GVJ_t * job);
extern void gvdevice_finalize(GVJ_t * job);
- extern char * gvprintnum(int *len, double num);
+ extern unsigned char * gvprintnum(int *len, double num);
extern void gvdevice_printnum(GVJ_t * job, double num);
extern void gvdevice_printpointf(GVJ_t * job, pointf p);
+ extern void gvdevice_printpointflist(GVJ_t * job, pointf *p, int n);
/* render */
void gvdevice_printnum(GVJ_t * job, double num)
{
- char *buf;
+ unsigned char *buf;
int len;
buf = gvprintnum(&len, num);
void gvdevice_printpointf(GVJ_t * job, pointf p)
{
- char *buf;
+ unsigned char *buf;
int len;
buf = gvprintnum(&len, p.x);
gvdevice_write(job, buf, len);
- gvdevice_write(job, " ", 1);
+ gvdevice_write(job, (unsigned char*)" ", 1);
buf = gvprintnum(&len, p.y);
gvdevice_write(job, buf, len);
}
+void gvdevice_printpointflist(GVJ_t * job, pointf *p, int n)
+{
+ int i = 0;
+
+ while (TRUE) {
+ gvdevice_printpointf(job, p[i]);
+ if (++i >= n) break;
+ gvdevice_write(job, (unsigned char*)" ", 1);
+ }
+}
+
static void auto_output_filename(GVJ_t *job)
{
static char *buf;
#define DECPLACES_SCALE 100
/* use macro so maxnegnum is stated just once for both double and string versions */
-#define val_str(n, x) static double n = x; static char n##str[] = #x;
+#define val_str(n, x) static double n = x; static unsigned char n##str[] = #x;
val_str(maxnegnum, -999999999999999.99)
/* Note. Returned string is only good until the next call to gvprintnum */
-char * gvprintnum (int *len, double number)
+unsigned char * gvprintnum (int *len, double number)
{
- static char tmpbuf[sizeof(maxnegnumstr)]; /* buffer big enough for worst case */
- char *result = tmpbuf+sizeof(maxnegnumstr); /* init result to end of tmpbuf */
+ static unsigned char tmpbuf[sizeof(maxnegnumstr)]; /* buffer big enough for worst case */
+ unsigned char *result = tmpbuf+sizeof(maxnegnumstr); /* init result to end of tmpbuf */
long int N;
bool showzeros, negative;
int digit, i;
N = number + 0.5;
if (N == 0) { /* special case for exactly 0 */
*len = 1;
- return "0";
+ return (unsigned char *)"0";
}
if ((negative = (N < 0))) /* avoid "-0" by testing rounded int */
N = -N; /* make number +ve */
#ifdef GVPRINTNUM_TEST
int main (int argc, char *argv[])
{
- char *buf;
+ unsigned char *buf;
int len;
double test[] = {