#include "all.h"
#include "mygraph.h"
#include "justify.h"

#define true (!false)
#define false 0
#define dbg if ((gle_debug & 32)>0)
extern int gle_debug;

extern long *(*gpcode)[];   /* gpcode is a polonger to an array of poiter to long */
extern long (*gplen)[];   /* gpcode is a pointer to an array of long */
extern int ngpcode;


begin_text(int *pln,long *pcode, int *cp,double width)
{
    int sl,i,bl,cjust,z=0;
    static char tbuff[2000];
    bl = 0;
    for (;;) {
	/* showpcode(pcode); */
	if (*(pcode+*cp-1)==0) { /* END XXX */
		break;
	}
	z++;
	if (z>2) {
		sl = strlen((char *) (pcode+*cp));
		dbg gprint("text == %d {%s} \n",sl,pcode+*cp);
		strcpy(&tbuff[0] + bl,(char *) (pcode+*cp));
		tbuff[bl+sl] = '\n';
		bl = bl + sl + 1;
	}
	pcode = (*gpcode)[(*pln)++];
	*cp = 2;
    }
	tbuff[bl] = 0;
	(*pln)--;
    dbg printf("Buffer length %d %d \n",bl,strlen(tbuff));
   g_get_just(&cjust);
    text_block(tbuff,width,cjust);
}












