1*da2e3ebdSchin /*********************************************************************** 2*da2e3ebdSchin * * 3*da2e3ebdSchin * This software is part of the ast package * 4*da2e3ebdSchin * Copyright (c) 1986-2007 AT&T Knowledge Ventures * 5*da2e3ebdSchin * and is licensed under the * 6*da2e3ebdSchin * Common Public License, Version 1.0 * 7*da2e3ebdSchin * by AT&T Knowledge Ventures * 8*da2e3ebdSchin * * 9*da2e3ebdSchin * A copy of the License is available at * 10*da2e3ebdSchin * http://www.opensource.org/licenses/cpl1.0.txt * 11*da2e3ebdSchin * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) * 12*da2e3ebdSchin * * 13*da2e3ebdSchin * Information and Software Systems Research * 14*da2e3ebdSchin * AT&T Research * 15*da2e3ebdSchin * Florham Park NJ * 16*da2e3ebdSchin * * 17*da2e3ebdSchin * Glenn Fowler <gsf@research.att.com> * 18*da2e3ebdSchin * * 19*da2e3ebdSchin ***********************************************************************/ 20*da2e3ebdSchin #pragma prototyped 21*da2e3ebdSchin /* 22*da2e3ebdSchin * Glenn Fowler 23*da2e3ebdSchin * AT&T Research 24*da2e3ebdSchin * 25*da2e3ebdSchin * preprocessor printf using ppputchar() buffering 26*da2e3ebdSchin */ 27*da2e3ebdSchin 28*da2e3ebdSchin #include "pplib.h" 29*da2e3ebdSchin 30*da2e3ebdSchin int 31*da2e3ebdSchin ppprintf(char* format, ...) 32*da2e3ebdSchin { 33*da2e3ebdSchin va_list ap; 34*da2e3ebdSchin Sfio_t* sp; 35*da2e3ebdSchin 36*da2e3ebdSchin if (!(sp = sfnew(NiL, pp.outp, MAXTOKEN, -1, SF_WRITE|SF_STRING))) 37*da2e3ebdSchin error(3, "temporary buffer allocation error"); 38*da2e3ebdSchin va_start(ap, format); 39*da2e3ebdSchin sfvprintf(sp, format, ap); 40*da2e3ebdSchin va_end(ap); 41*da2e3ebdSchin pp.outp += sfseek(sp, 0L, SEEK_CUR); 42*da2e3ebdSchin ppcheckout(); 43*da2e3ebdSchin sfclose(sp); 44*da2e3ebdSchin return 0; 45*da2e3ebdSchin } 46