SW500010 Microchip Technology, SW500010 Datasheet - Page 34

HI-TECH C PRO FOR PIC10/12/16

SW500010

Manufacturer Part Number
SW500010
Description
HI-TECH C PRO FOR PIC10/12/16
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC10/12/16r
Datasheets

Specifications of SW500010

Supported Families
PIC10, PIC12, PIC16
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC10/12/16
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC10, PIC12, PIC14, PIC16, PIC16E
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
019P
778-1006
778-1006
Runtime Files
It contains a minimal implementation of the printf function, but with the more advanced features
included as conditional code which can be utilized via preprocessor macros that are defined when it
is compiled.
function. For all calls, the placeholders that were specified in the printf format strings are collated
to produce a list of the desired functionality of the final function. The doprnt.c file is then
preprocessed with the those macros specified by the preliminary analysis, thus creating a custom
printf function for the project being compiled. After parsing, the p-code output derived from
doprnt.c is then combined with the remainder of the C program in the final code generation step.
If the format string in a call to printf is not a string literal as in the tutorial, but is rather a pointer
to a string, then the compiler will not be able to reliably predict the printf usage, and so it forces
a more complete version of printf to be generated. However, even without being able to scan
printf placeholders, the compiler can still make certain assumptions regarding the usage of the
function. In particular, the compiler can look at the number and type of the additional arguments
to printf (those following the format string expression) to determine which placeholders could
be valid. This enables the size and complexity of the generated printf routine to be kept to a
minimum.
34
This template file is found in the LIB directory of the compiler distribution and is called doprnt.c.
The parser and code generator analyze the C source code, searching for calls to the printf
T
C
printf(”input is:
The compiler will note that only the %d placeholder is used and the doprnt module
that is linked into the program will only contain code that handles printing of decimal
integers.
The code is latter changed and another call to printf is added. The new call looks
like:
printf(”output is %6d”);
Now the compiler will detect that in addition there must be code present in the doprnt
module that handles integers printed to a specific width. The code that handles this flag
will be introduced into the doprnt module.
The size of the doprnt module will increase as more printf features are detected.
T
P
printf in a program and it appears as in the following code:
UT RIAL
UT RIAL
RINTF WITHOUT LITERAL FORMAT STRINGS
ALLS TO PRINTF
A program contains one call to printf, which looks like:
$d”);
If there is only one reference to
PICC Command-line Driver

Related parts for SW500010