From 5e3327e456714d84b1cabdd698e7aad07e9ea7d4 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 2 Dec 2011 09:10:46 +0000 Subject: Support automatic processing through cpp --- README | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'README') diff --git a/README b/README index 08fa293..3d3a774 100644 --- a/README +++ b/README @@ -8,6 +8,9 @@ Dependencies: - pycparser - http://code.google.com/p/pycparser/ - PLY (Python Lex-Yacc) - http://www.dabeaz.com/ply/ +Recommended: +- cpp - a C preprocessor + Python is often installed by default on Linux distributions. For Windows, you probably need to run the installer from the above link. Extract the pycparser ZIP file (see link above) and copy the pycparser subdirectory to the directory @@ -16,7 +19,15 @@ the ply/ directory into the directory containing pp2cc. pp2cc is a console program, you need to open a terminal (or cmd on Windows) to see compiler messages. -Usage: python pp2cc.py [options] filename.. +The cpp program is installed on most Linux distributions. If not, install a +conforming cpp, say gcc (GNU C Compiler). On Windows, you might want to +download mcpp from http://mcpp.sourceforge.net/. Put it in your %PATH% (or the +directory containing pp2cc) and rename it to "cpp.exe". If you do not install +a C preprocessor, you need to pass the --no-cpp option in order to skip the +processing through cpp. You will not be able to use comments or macros in this +case. + +Usage: pp2cc.py [options] filename.. Multiple input files can be specified, options can be specified before and after filenames. Options: @@ -25,6 +36,10 @@ Options: added. --tree Instead of compiling the file into assembly, show the parse tree. + -D name + -D name=definition This option is passed to the cpp program, and acts like + adding #define name or #define name definition respectively + --no-cpp Disable the use of the C Preprocessor Conformance with the K&R interpretation of C and feature support ================================================================ @@ -118,4 +133,4 @@ Not supported by parser, use a dedicated preprocessor like cpp and enable removal of comments. Example: cpp -P file.c A13 Grammar -Not checked \ No newline at end of file +Not checked -- cgit v1.2.1