Name
Trim.exe or Trim.py – Convert the preprocessed source files by C compiler to the expected style file to be processed further by EDKII tool.
Synopsis
trim [-s|-r|-a|-8] [-c] [-v|-d <debug_level>|-q] [-o <output_file>] <input_file>
trim –h
trim --version

Description
Trim tool process the preprocessed file by a Compiler to remove the unused content and generate the file to be processed further by EDKII tools.
Trim tool can also be used generate the expected source file to work with EDKII build system and EDKII core code. It extends the EDKII build system to support more source file types.

Options
input_file
	The input file may be the preprocessed source code, the preprocessed VFR file, ASL file or R8 framework source file.
-s, --source-code     
The input file is a preprocessed source code, including C or assembly code. All generated codes from the include header files are remove all. Only content in source file is kept.
-r, --vfr-file        
The input file is a preprocessed VFR file. All generated codes from the include header files are remove except for the typedef structure.
-a, --asl-file        
The input file is an ASL file. The asl source include style Include(*.asi) will be changed to C style #include *.asi. The preprocessed asl file can be preprocessed by C compiler. 
-8, --Edk-source-code  
The input file is the EDK style source code to be trimmed for ECP platform. Some EDK framework source file will be modified to work with EDKII thunk and core drivers. A window script tool “ImportTool.bat” is created to process a group of EDK framework source files in the same file directory. 
-c, --convert-hex     
Converts standard hex format (0xabcd) to MASM format (abcdh).
-o OUTPUTFILE, --output=OUTPUTFILE
The output file stores the trimmed content.
-v, --verbose
 	Enable verbose output with informational messages printed
-d LOGLEVEL, --debug=LOGLEVEL [0-9]
Enable debug messages at specified level.
-q, --quiet
Disable all messages except FATAL ERRORS 
--version
Show program version number and exit
-h, -?, --help
Show this help message and exit
Status codes returned
0	The action was completed as requested.	
1	The action failed.	
Example
1. Trim the preprocessed source file (test.i) by C compiler to remove all generated codes from the include header files by this source file (test.s) to the output file test.iii, which only contains the content in this source file (test.s).
Trim --source-code -o test.iii test.i
2. Trim the preprocessed source file (test.i) by a C compiler to remove all generated codes from the include header files by this source file (test.asm) and convert standard hex format (0xabcd) to MASM format (abcdh) to the output file test.iii, which only contains the content in this source file (test.s).
Trim --source-code --convert-hex -o test.iii test.i
3. Trim the preprocessed source file (test.i) by a C compiler to remove all generated codes from the include header files by this source file (test.vfr) except for the typedef structures to the output file (test.iii).
Trim --vfr-file -o test.iii test.i
4. Trim the ASL source file (test.asl) to convert the ASL style Include(*.asi) to the C style #include *.asi. The updated ASL will output to test.i.
Trim --asl-file -o test.i test.asl
5. Modify an EDK style framework source file to work with EDKII thunk and core drivers.
Trim --r8-source-code -o test.c test.c
5. Modify all EDK style framework source files (*.c and *.h) in current directory to work with EDKII thunk and core drivers by the script “ImportTool.bat”.
ImportTool *.c
ImportTool *.h

Bugs
No known issues.
Report bugs to edk2-buildtools-devel@lists.sourceforge.net
Files
None
See also
None
License
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available 
under the terms and conditions of the BSD License which accompanies this 
distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.