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>
Description
Trim tool is used to process the preprocessed file by Compiler to remove the unused content to generate the file to be processed further by EDKII tools.
Trim tool can also be used to process the source file to generate the expected source file to work with EDKII build system and EDKII core code. 
Trim tool is a usual tool to process the source file to generate the file that can be used in EDKII build system. It extends EDKII build system to support more source file type.
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 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 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 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, --r8-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     
Convert standard hex format (0xabcd) to MASM format (abcdh).
-o OUTPUTFILE, --output=OUTPUTFILE
The output file is to store the trimmed content.
-v, --verbose
 	Run with verbose information.
-d LOGLEVEL, --debug=LOGLEVEL [0-9]
Enable debug messages at specified level.
-q, --quiet
Run with little information in quiet mode.
--version
Show program's version number and exit
-h, -?, --help
Show this help message and exit
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 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 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 ASL source file (test.asl) to convert the ASL style Include(*.asi) to the C style #include *.asi. The update 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 bugs.
Report bugs to edk2-buildtools-devel@lists.sourceforge.net
Files
None
See also
None
License
Copyright (c) 2007 - 2009, 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.