$include (..\lib\compStch.ext) /* *============================================================================ * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE * * Permission to use for any purpose, modify, copy, and make enhancements * and derivative works of the software is granted if attribution is given to * R.M. Gillmore, dba the ACME Software Deli, as the author * * While the ACME Software Deli does not work for money, there is nonetheless * a significant amount of work involved. The ACME Software Deli maintains the * rights to all code written, though it may be used and distributed as long as * the following conditions are maintained. * * 1. The copyright statement at the top of each code block is maintained in * your distribution. * 2. You do not identify yourself as the ACME Software Deli * 3. Any changes made to the software are sent to the ACME Software Deli *============================================================================ */ /* * printf - a special case of fprintf (writing to stdout) * cprintf - a special case of printf (writing with a particular color) * fprintf - uses sprintf * sprintf - creates a string by interpreting the format string, and using the * variables whose addresses are in the last parameter */ cprintfModule: do; $if not noID declare IDString (*) byte data ( '@(#)cprintf.p86 $Author: rmgillmore $ $Date:: 2025-05-04 19:35:39#$:', 0 ); $endif $set ( cprintfSource ) $include (..\lib\prtfEng.ext) $include (..\lib\fileIO.ext) $include (..\lib\string.ext) $include (..\lib\parmData.ext) $include (..\lib\sysCalls.ext) $include (..\lib\videoIO.ext) cprintfProcedure: procedure ( firstArg ) reentrant public; declare firstArg word, parameterData paramDataStruct; declare referenceAddress pointer, userString (1024) char, stringLength word, returnCode integer; declare textColor byte; referenceAddress = @firstArg; call initParamData( referenceAddress, @parameterData ); call GetByte( @parameterData, @textColor ); call sprintfEngine( @userString, @parameterData ); stringLength = strlen( @userString ); do; declare currentLocation word, currentCoordinate coordinate_t at ( @currentLocation ); currentLocation = curPos; call clrWindow( currentCoordinate.x, currentCoordinate.y, currentCoordinate.x + stringLength - 1, currentCoordinate.y, textColor ); end; returnCode = signed( fwrite( stdout, @userString, stringLength ) ); end cprintfProcedure; declare cprintf pointer public data (@cprintfProcedure); end cprintfModule;