• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2004 - 2007, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   Common.h
15 
16 Abstract:
17 
18   Common include file for the ProcessDsc utility.
19 
20 --*/
21 
22 #ifndef _COMMON_H_
23 #define _COMMON_H_
24 
25 typedef char INT8;
26 typedef unsigned int UINT32;
27 
28 #include "EfiUtilityMsgs.h"
29 
30 #define MAX_LINE_LEN  1024
31 
32 #ifdef MAX_PATH
33 #undef MAX_PATH
34 #define MAX_PATH  1024
35 #endif
36 
37 //
38 // Defines for how to expand symbols
39 //
40 #define EXPANDMODE_NO_UNDEFS    0x01
41 #define EXPANDMODE_NO_DESTDIR   0x02
42 #define EXPANDMODE_NO_SOURCEDIR 0x04
43 #define EXPANDMODE_RECURSIVE    0x08
44 
45 //
46 // Defines for adding symbols
47 //
48 #define SYM_OVERWRITE 0x01      // overwrite existing assignments
49 #define SYM_GLOBAL    0x02      // global symbol (persistent)
50 #define SYM_LOCAL     0x04      // symbols at component level
51 #define SYM_FILE      0x08      // symbols at file level
52 #define SYM_FILEPATH  0x10      // symbol is a file path
53 #define SYM_FILENAME  0x20      // symbol is a file name
54 #define FV_DIR        "FV_DIR"  // symbol for base dir where FV files are
55 #define DSC_FILENAME  "DSC_FILENAME"
56 
57 //
58 // Smart file for better incremental build support.
59 // Only re-create .pkg .inf or .apr files when it's content is changed.
60 //
61 //
62 typedef struct _SMART_FILE {
63   char              *FileName;
64   char              *FileContent;        // Previous file content
65   int               FileLength;            // Previous file string length
66   int               FilePosition;        // The offset from FileContent for next comparison
67   FILE              *FilePtr;            // New file pointer if the file need to be re-created
68 } SMART_FILE;
69 
70 SMART_FILE *
71 SmartOpen (
72   char        *FileName
73   );
74 
75 int
76 SmartWrite (
77   SMART_FILE  *SmartFile,
78   char        *String
79   );
80 
81 void
82 SmartClose (
83   SMART_FILE  *SmartFile
84   );
85 
86 INT8  *
87 GetSymbolValue (
88   INT8 *SymbolName
89   );
90 
91 int
92 AddSymbol (
93   INT8  *Name,
94   INT8  *Value,
95   int   Mode
96   );
97 
98 int
99 ExpandSymbols (
100   INT8  *SourceLine,
101   INT8  *DestLine,
102   int   LineLen,
103   int   ExpandMode
104   );
105 
106 void
107 Message (
108   UINT32  PrintMask,
109   INT8    *Fmt,
110   ...
111   );
112 
113 int
114 MakeFilePath (
115   INT8 *FileName
116   );
117 
118 int
119 IsAbsolutePath (
120   INT8    *FileName
121   );
122 
123 #endif // ifndef _COMMON_H_
124