How syampullamar/preprocessor works
This small C preprocessor accepts one source filename, prepares macro storage, scans definitions, then processes each line for includes, comments, and macro substitutions before writing a .i output file. The README names the same core capabilities. The sampled source supports the call and write relationships shown; header inclusion handles angle-bracket paths under /usr/include/.
Main entry points: main.c Preprocessing driver · headerfile.c Include headers · macro.c Replace macros · comment.c Remove line comments
Components 11
Preprocessing driver
- Preprocessing driver
main.c
Directive handling
- Count definitions
macro.c - Allocate macro storage
macro.c - Store definitions
macro.c - Include headers
headerfile.c
Source transforms
- Remove line comments
comment.c - Remove block comments
comment.c - Replace macros
macro.c
Other components
- User
- C source file
- Preprocessed file
Connections 12
- User → Preprocessing driver: invokes
- C source file → Preprocessing driver: reads
- Preprocessing driver → Preprocessed file: opens
- Preprocessing driver → Count definitions: counts definitions
- Preprocessing driver → Allocate macro storage: allocates storage
- Preprocessing driver → Store definitions: scans definitions
- Preprocessing driver → Include headers: processes includes
- Preprocessing driver → Remove line comments: removes comments
- Preprocessing driver → Remove block comments: removes comments
- Preprocessing driver → Replace macros: replaces macros
- Include headers → Preprocessed file: writes headers
- Replace macros → Preprocessed file: writes transformed lines