src/interp/rassa.c
/*========================================+
 * poutput -- Output string in current mode
 *=======================================*/
- Output string in current mode
- Output string in current mode
void
poutput (STRING str, BOOLEAN *eflg)
{
	STRING p;
	ZSTR zstr = 0;
	INT c, len;
	XLAT ttmr = transl_get_predefined_xlat(MINRP);
	if (!str || (len = strlen(str)) <= 0) return;
	zstr = translate_string_to_zstring(ttmr, str);
	str = zs_str(zstr);
	if ((len = strlen(str)) <= 0)
		goto exit_poutput;
	if (!Poutfp) {
		if (!request_file(eflg))
			goto exit_poutput;
		setbuf(Poutfp, NULL);
	}
	switch (outputmode) {
	case UNBUFFERED:
		fwrite(str, len, 1, Poutfp);
		adjust_cols(str);
		goto exit_poutput;
	case BUFFERED:
		if (len >= 1024) {
			fwrite(linebuffer, linebuflen, 1, Poutfp);
			fwrite(str, len, 1, Poutfp);
			linebuflen = 0;
			bufptr = (STRING)linebuffer;
			adjust_cols(str);
			goto exit_poutput;
		}
		if (len + linebuflen >= 1024) {
			fwrite(linebuffer, linebuflen, 1, Poutfp);
			linebuflen = 0;
			bufptr = (STRING)linebuffer;
		}
		linebuflen += len;
		while ((c = *bufptr++ = *str++)) {
			if (c == '\n')
				curcol = 1;
			else
				curcol++;
		}
		--bufptr;
		goto exit_poutput;
	case PAGEMODE:
		p = pagebuffer + (currow - 1)*__cols + curcol - 1;
		while ((c = *str++)) {
			if (c == '\n') {
				curcol = 1;
				currow++;
				p = pagebuffer + (currow - 1)*__cols;
			} else {
				if (curcol <= __cols && currow <= __rows)
					*p++ = c;
				curcol++;
			}
		}
		goto exit_poutput;
	default:
		FATAL();
	}
exit_poutput:
	zs_free(&zstr);
}
void poutput ( STRING str , BOOLEAN * eflg ) { STRING p ; ZSTR zstr = 0 ; INT c , len ; XLAT ttmr = transl_get_predefined_xlat ( MINRP ) ; if ( ! str || ( len = strlen ( str ) ) <= 0 ) return ; zstr = translate_string_to_zstring ( ttmr , str ) ; str = zs_str ( zstr ) ; if ( ( len = strlen ( str ) ) <= 0 ) goto exit_poutput ; if ( ! Poutfp ) { if ( ! request_file ( eflg ) ) goto exit_poutput ; setbuf ( Poutfp , NULL ) ; } switch ( outputmode ) { case UNBUFFERED : fwrite ( str , len , 1 , Poutfp ) ; adjust_cols ( str ) ; goto exit_poutput ; case BUFFERED : if ( len >= 1024 ) { fwrite ( linebuffer , linebuflen , 1 , Poutfp ) ; fwrite ( str , len , 1 , Poutfp ) ; linebuflen = 0 ; bufptr = ( STRING ) linebuffer ; adjust_cols ( str ) ; goto exit_poutput ; } if ( len + linebuflen >= 1024 ) { fwrite ( linebuffer , linebuflen , 1 , Poutfp ) ; linebuflen = 0 ; bufptr = ( STRING ) linebuffer ; } linebuflen += len ; while ( ( c = * bufptr ++ = * str ++ ) ) { if ( c == ' \n ' ) curcol = 1 ; else curcol ++ ; } -- bufptr ; goto exit_poutput ; case PAGEMODE : p = pagebuffer + ( currow - 1 ) * __cols + curcol - 1 ; while ( ( c = * str ++ ) ) { if ( c == ' \n ' ) { curcol = 1 ; currow ++ ; p = pagebuffer + ( currow - 1 ) * __cols ; } else { if ( curcol <= __cols && currow <= __rows ) * p ++ = c ; curcol ++ ; } } goto exit_poutput ; default : FATAL ( ) ; } exit_poutput : zs_free ( & zstr ) ; }
+
 poutput -- Output string in current mode
+ poutput -- Output string in current mode