1 | /* $Id: scm.h 98368 2023-01-31 15:46:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT Testcase / Tool - Source Code Massager.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef VBOX_INCLUDED_SRC_bldprogs_scm_h
|
---|
29 | #define VBOX_INCLUDED_SRC_bldprogs_scm_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include "scmstream.h"
|
---|
35 |
|
---|
36 | RT_C_DECLS_BEGIN
|
---|
37 |
|
---|
38 | /** Pointer to the rewriter state. */
|
---|
39 | typedef struct SCMRWSTATE *PSCMRWSTATE;
|
---|
40 | /** Pointer to const massager settings. */
|
---|
41 | typedef struct SCMSETTINGSBASE const *PCSCMSETTINGSBASE;
|
---|
42 |
|
---|
43 |
|
---|
44 | /** @name Subversion Access
|
---|
45 | * @{ */
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * SVN property.
|
---|
49 | */
|
---|
50 | typedef struct SCMSVNPROP
|
---|
51 | {
|
---|
52 | /** The property. */
|
---|
53 | char *pszName;
|
---|
54 | /** The value.
|
---|
55 | * When used to record updates, this can be set to NULL to trigger the
|
---|
56 | * deletion of the property. */
|
---|
57 | char *pszValue;
|
---|
58 | } SCMSVNPROP;
|
---|
59 | /** Pointer to a SVN property. */
|
---|
60 | typedef SCMSVNPROP *PSCMSVNPROP;
|
---|
61 | /** Pointer to a const SVN property. */
|
---|
62 | typedef SCMSVNPROP const *PCSCMSVNPROP;
|
---|
63 |
|
---|
64 |
|
---|
65 | void ScmSvnInit(void);
|
---|
66 | void ScmSvnTerm(void);
|
---|
67 | bool ScmSvnIsDirInWorkingCopy(const char *pszDir);
|
---|
68 | bool ScmSvnIsInWorkingCopy(PSCMRWSTATE pState);
|
---|
69 | int ScmSvnQueryProperty(PSCMRWSTATE pState, const char *pszName, char **ppszValue);
|
---|
70 | int ScmSvnQueryParentProperty(PSCMRWSTATE pState, const char *pszName, char **ppszValue);
|
---|
71 | int ScmSvnSetProperty(PSCMRWSTATE pState, const char *pszName, const char *pszValue);
|
---|
72 | int ScmSvnDelProperty(PSCMRWSTATE pState, const char *pszName);
|
---|
73 | int ScmSvnDisplayChanges(PSCMRWSTATE pState);
|
---|
74 | int ScmSvnApplyChanges(PSCMRWSTATE pState);
|
---|
75 |
|
---|
76 | /** @} */
|
---|
77 |
|
---|
78 |
|
---|
79 | /** @name Code Parsing
|
---|
80 | * @{ */
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Comment style.
|
---|
84 | */
|
---|
85 | typedef enum SCMCOMMENTSTYLE
|
---|
86 | {
|
---|
87 | kScmCommentStyle_Invalid = 0,
|
---|
88 | kScmCommentStyle_C,
|
---|
89 | kScmCommentStyle_Hash,
|
---|
90 | kScmCommentStyle_Python, /**< Same as hash, except for copyright/license. */
|
---|
91 | kScmCommentStyle_Semicolon,
|
---|
92 | kScmCommentStyle_Rem_Upper,
|
---|
93 | kScmCommentStyle_Rem_Lower,
|
---|
94 | kScmCommentStyle_Rem_Camel,
|
---|
95 | kScmCommentStyle_Sql,
|
---|
96 | kScmCommentStyle_Tick,
|
---|
97 | kScmCommentStyle_Xml,
|
---|
98 | kScmCommentStyle_End
|
---|
99 | } SCMCOMMENTSTYLE;
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Comment types.
|
---|
103 | */
|
---|
104 | typedef enum SCMCOMMENTTYPE
|
---|
105 | {
|
---|
106 | kScmCommentType_Invalid = 0, /**< Customary invalid zero value. */
|
---|
107 | kScmCommentType_Line, /**< Line comment. */
|
---|
108 | kScmCommentType_Line_JavaDoc, /**< Line comment, JavaDoc style. */
|
---|
109 | kScmCommentType_Line_JavaDoc_After, /**< Line comment, JavaDoc after-member style. */
|
---|
110 | kScmCommentType_Line_Qt, /**< Line comment, JavaDoc style. */
|
---|
111 | kScmCommentType_Line_Qt_After, /**< Line comment, JavaDoc after-member style. */
|
---|
112 | kScmCommentType_MultiLine, /**< Multi-line comment (e.g. ansi C). */
|
---|
113 | kScmCommentType_MultiLine_JavaDoc, /**< Multi-line comment, JavaDoc style. */
|
---|
114 | kScmCommentType_MultiLine_JavaDoc_After, /**< Multi-line comment, JavaDoc after-member style. */
|
---|
115 | kScmCommentType_MultiLine_Qt, /**< Multi-line comment, Qt style. */
|
---|
116 | kScmCommentType_MultiLine_Qt_After, /**< Multi-line comment, Qt after-member style. */
|
---|
117 | kScmCommentType_DocString, /**< Triple quoted python doc string. */
|
---|
118 | kScmCommentType_Xml, /**< XML comment style. */
|
---|
119 | kScmCommentType_End /**< Customary exclusive end value. */
|
---|
120 | } SCMCOMMENTTYPE;
|
---|
121 |
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * Comment information.
|
---|
125 | */
|
---|
126 | typedef struct SCMCOMMENTINFO
|
---|
127 | {
|
---|
128 | /** Comment type. */
|
---|
129 | SCMCOMMENTTYPE enmType;
|
---|
130 | /** Start line number (0-based). */
|
---|
131 | uint32_t iLineStart;
|
---|
132 | /** Start line offset (0-based). */
|
---|
133 | uint32_t offStart;
|
---|
134 | /** End line number (0-based). */
|
---|
135 | uint32_t iLineEnd;
|
---|
136 | /** End line offset (0-based). */
|
---|
137 | uint32_t offEnd;
|
---|
138 | /** Number of blank lines before the body (@a pszBody). */
|
---|
139 | uint32_t cBlankLinesBefore;
|
---|
140 | /** Number of blank lines after the body (@a pszBody + @a cchBody). */
|
---|
141 | uint32_t cBlankLinesAfter;
|
---|
142 | /** @todo add min/max indent. Raw length. Etc. */
|
---|
143 | } SCMCOMMENTINFO;
|
---|
144 | /** Pointer to comment info. */
|
---|
145 | typedef SCMCOMMENTINFO *PSCMCOMMENTINFO;
|
---|
146 | /** Pointer to const comment info. */
|
---|
147 | typedef SCMCOMMENTINFO const *PCSCMCOMMENTINFO;
|
---|
148 |
|
---|
149 |
|
---|
150 | /**
|
---|
151 | * Comment enumeration callback function.
|
---|
152 | *
|
---|
153 | * @returns IPRT style status code. Failures causes immediate return. While an
|
---|
154 | * informational status code is saved (first one) and returned later.
|
---|
155 | * @param pInfo Additional comment info.
|
---|
156 | * @param pszBody The comment body. This is somewhat stripped.
|
---|
157 | * @param cchBody The comment body length.
|
---|
158 | * @param pvUser User callback argument.
|
---|
159 | */
|
---|
160 | typedef DECLCALLBACKTYPE(int, FNSCMCOMMENTENUMERATOR,(PCSCMCOMMENTINFO pInfo, const char *pszBody, size_t cchBody, void *pvUser));
|
---|
161 | /** Poiter to a omment enumeration callback function. */
|
---|
162 | typedef FNSCMCOMMENTENUMERATOR *PFNSCMCOMMENTENUMERATOR;
|
---|
163 |
|
---|
164 | int ScmEnumerateComments(PSCMSTREAM pIn, SCMCOMMENTSTYLE enmCommentStyle, PFNSCMCOMMENTENUMERATOR pfnCallback, void *pvUser);
|
---|
165 |
|
---|
166 |
|
---|
167 | /**
|
---|
168 | * Include directive type.
|
---|
169 | */
|
---|
170 | typedef enum SCMINCLUDEDIR
|
---|
171 | {
|
---|
172 | kScmIncludeDir_Invalid = 0, /**< Constomary invalid enum value. */
|
---|
173 | kScmIncludeDir_Quoted, /**< \#include \"filename.h\" */
|
---|
174 | kScmIncludeDir_Bracketed, /**< \#include \<filename.h\> */
|
---|
175 | kScmIncludeDir_Macro, /**< \#include MACRO_H */
|
---|
176 | kScmIncludeDir_End /**< End of valid enum values. */
|
---|
177 | } SCMINCLUDEDIR;
|
---|
178 |
|
---|
179 | SCMINCLUDEDIR ScmMaybeParseCIncludeLine(PSCMRWSTATE pState, const char *pchLine, size_t cchLine,
|
---|
180 | const char **ppchFilename, size_t *pcchFilename);
|
---|
181 |
|
---|
182 | /**
|
---|
183 | * Checks if the given character is a valid C identifier lead character.
|
---|
184 | *
|
---|
185 | * @returns true / false.
|
---|
186 | * @param ch The character to inspect.
|
---|
187 | * @sa vbcppIsCIdentifierLeadChar
|
---|
188 | */
|
---|
189 | DECLINLINE(bool) ScmIsCIdentifierLeadChar(char ch)
|
---|
190 | {
|
---|
191 | return RT_C_IS_ALPHA(ch)
|
---|
192 | || ch == '_';
|
---|
193 | }
|
---|
194 |
|
---|
195 |
|
---|
196 | /**
|
---|
197 | * Checks if the given character is a valid C identifier character.
|
---|
198 | *
|
---|
199 | * @returns true / false.
|
---|
200 | * @param ch The character to inspect.
|
---|
201 | * @sa vbcppIsCIdentifierChar
|
---|
202 | */
|
---|
203 | DECLINLINE(bool) ScmIsCIdentifierChar(char ch)
|
---|
204 | {
|
---|
205 | return RT_C_IS_ALNUM(ch)
|
---|
206 | || ch == '_';
|
---|
207 | }
|
---|
208 |
|
---|
209 |
|
---|
210 | /** @} */
|
---|
211 |
|
---|
212 |
|
---|
213 | /** @name Rewriters
|
---|
214 | * @{ */
|
---|
215 |
|
---|
216 | /**
|
---|
217 | * Rewriter state.
|
---|
218 | */
|
---|
219 | typedef struct SCMRWSTATE
|
---|
220 | {
|
---|
221 | /** The filename. */
|
---|
222 | const char *pszFilename;
|
---|
223 | /** Set after the printing the first verbose message about a file under
|
---|
224 | * rewrite. */
|
---|
225 | bool fFirst;
|
---|
226 | /** Set if the file requires manual repair. */
|
---|
227 | bool fNeedsManualRepair;
|
---|
228 | /** Cached ScmSvnIsInWorkingCopy response. 0 indicates not known, 1 means it
|
---|
229 | * is in WC, -1 means it doesn't. */
|
---|
230 | int8_t fIsInSvnWorkingCopy;
|
---|
231 | /** The number of SVN property changes. */
|
---|
232 | size_t cSvnPropChanges;
|
---|
233 | /** Pointer to an array of SVN property changes. */
|
---|
234 | struct SCMSVNPROP *paSvnPropChanges;
|
---|
235 | /** For error propagation. */
|
---|
236 | int32_t rc;
|
---|
237 | } SCMRWSTATE;
|
---|
238 |
|
---|
239 | /** Rewriter result. */
|
---|
240 | typedef enum { kScmUnmodified = 0, kScmModified, kScmMaybeModified } SCMREWRITERRES;
|
---|
241 |
|
---|
242 | /**
|
---|
243 | * A rewriter.
|
---|
244 | *
|
---|
245 | * This works like a stream editor, reading @a pIn, modifying it and writing it
|
---|
246 | * to @a pOut.
|
---|
247 | *
|
---|
248 | * @returns kScmUnmodified, kScmModified or kScmMaybeModified.
|
---|
249 | * @param pIn The input stream.
|
---|
250 | * @param pOut The output stream.
|
---|
251 | * @param pSettings The settings.
|
---|
252 | */
|
---|
253 | typedef SCMREWRITERRES FNSCMREWRITER(PSCMRWSTATE pState, PSCMSTREAM pIn, PSCMSTREAM pOut, PCSCMSETTINGSBASE pSettings);
|
---|
254 | /** Pointer to a rewriter method. */
|
---|
255 | typedef FNSCMREWRITER *PFNSCMREWRITER;
|
---|
256 |
|
---|
257 | FNSCMREWRITER rewrite_StripTrailingBlanks;
|
---|
258 | FNSCMREWRITER rewrite_ExpandTabs;
|
---|
259 | FNSCMREWRITER rewrite_ForceNativeEol;
|
---|
260 | FNSCMREWRITER rewrite_ForceLF;
|
---|
261 | FNSCMREWRITER rewrite_ForceCRLF;
|
---|
262 | FNSCMREWRITER rewrite_AdjustTrailingLines;
|
---|
263 | FNSCMREWRITER rewrite_SvnNoExecutable;
|
---|
264 | FNSCMREWRITER rewrite_SvnNoKeywords;
|
---|
265 | FNSCMREWRITER rewrite_SvnNoEolStyle;
|
---|
266 | FNSCMREWRITER rewrite_SvnBinary;
|
---|
267 | FNSCMREWRITER rewrite_SvnKeywords;
|
---|
268 | FNSCMREWRITER rewrite_SvnSyncProcess;
|
---|
269 | FNSCMREWRITER rewrite_UnicodeChecks;
|
---|
270 | FNSCMREWRITER rewrite_PageChecks;
|
---|
271 | FNSCMREWRITER rewrite_ForceHrcVrcInsteadOfRc;
|
---|
272 | FNSCMREWRITER rewrite_Copyright_CstyleComment;
|
---|
273 | FNSCMREWRITER rewrite_Copyright_HashComment;
|
---|
274 | FNSCMREWRITER rewrite_Copyright_PythonComment;
|
---|
275 | FNSCMREWRITER rewrite_Copyright_RemComment;
|
---|
276 | FNSCMREWRITER rewrite_Copyright_SemicolonComment;
|
---|
277 | FNSCMREWRITER rewrite_Copyright_SqlComment;
|
---|
278 | FNSCMREWRITER rewrite_Copyright_TickComment;
|
---|
279 | FNSCMREWRITER rewrite_Copyright_XmlComment;
|
---|
280 | FNSCMREWRITER rewrite_Makefile_kup;
|
---|
281 | FNSCMREWRITER rewrite_Makefile_kmk;
|
---|
282 | FNSCMREWRITER rewrite_FixFlowerBoxMarkers;
|
---|
283 | FNSCMREWRITER rewrite_Fix_C_and_CPP_Todos;
|
---|
284 | FNSCMREWRITER rewrite_Fix_Err_H;
|
---|
285 | FNSCMREWRITER rewrite_FixHeaderGuards;
|
---|
286 | FNSCMREWRITER rewrite_C_and_CPP;
|
---|
287 |
|
---|
288 | /**
|
---|
289 | * Rewriter configuration.
|
---|
290 | */
|
---|
291 | typedef struct SCMREWRITERCFG
|
---|
292 | {
|
---|
293 | /** The rewriter function. */
|
---|
294 | PFNSCMREWRITER pfnRewriter;
|
---|
295 | /** The name of the rewriter. */
|
---|
296 | const char *pszName;
|
---|
297 | } SCMREWRITERCFG;
|
---|
298 | /** Pointer to a const rewriter config. */
|
---|
299 | typedef SCMREWRITERCFG const *PCSCMREWRITERCFG;
|
---|
300 |
|
---|
301 | /** @} */
|
---|
302 |
|
---|
303 |
|
---|
304 | /** @name Settings
|
---|
305 | * @{ */
|
---|
306 |
|
---|
307 | /**
|
---|
308 | * Configuration entry.
|
---|
309 | */
|
---|
310 | typedef struct SCMCFGENTRY
|
---|
311 | {
|
---|
312 | /** Number of rewriters. */
|
---|
313 | size_t cRewriters;
|
---|
314 | /** Pointer to an array of rewriters. */
|
---|
315 | PCSCMREWRITERCFG const *paRewriters;
|
---|
316 | /** Set if the entry handles binaries. */
|
---|
317 | bool fBinary;
|
---|
318 | /** File pattern (simple). */
|
---|
319 | const char *pszFilePattern;
|
---|
320 | /** Name (for treat as). */
|
---|
321 | const char *pszName;
|
---|
322 | } SCMCFGENTRY;
|
---|
323 | typedef SCMCFGENTRY *PSCMCFGENTRY;
|
---|
324 | typedef SCMCFGENTRY const *PCSCMCFGENTRY;
|
---|
325 |
|
---|
326 |
|
---|
327 | /** License update options. */
|
---|
328 | typedef enum SCMLICENSE
|
---|
329 | {
|
---|
330 | kScmLicense_LeaveAlone = 0, /**< Leave it alone. */
|
---|
331 | kScmLicense_OseGpl, /**< VBox OSE GPL if public. */
|
---|
332 | kScmLicense_OseDualGplCddl, /**< VBox OSE dual GPL & CDDL if public. */
|
---|
333 | kScmLicense_OseCddl, /**< VBox OSE CDDL if public. */
|
---|
334 | kScmLicense_Lgpl, /**< LGPL if public. */
|
---|
335 | kScmLicense_Mit, /**< MIT if public. */
|
---|
336 | kScmLicense_BasedOnMit, /**< Copyright us but based on someone else's MIT. */
|
---|
337 | kScmLicense_End
|
---|
338 | } SCMLICENSE;
|
---|
339 |
|
---|
340 | /**
|
---|
341 | * Source Code Massager Settings.
|
---|
342 | */
|
---|
343 | typedef struct SCMSETTINGSBASE
|
---|
344 | {
|
---|
345 | bool fConvertEol;
|
---|
346 | bool fConvertTabs;
|
---|
347 | bool fForceFinalEol;
|
---|
348 | bool fForceTrailingLine;
|
---|
349 | bool fStripTrailingBlanks;
|
---|
350 | bool fStripTrailingLines;
|
---|
351 |
|
---|
352 | /** Whether to fix C/C++ flower box section markers. */
|
---|
353 | bool fFixFlowerBoxMarkers;
|
---|
354 | /** The minimum number of blank lines we want before flowerbox markers. */
|
---|
355 | uint8_t cMinBlankLinesBeforeFlowerBoxMakers;
|
---|
356 |
|
---|
357 | /** Whether to fix C/C++ header guards and \#pragma once directives. */
|
---|
358 | bool fFixHeaderGuards;
|
---|
359 | /** Whether to include a pragma once statement with the header guard. */
|
---|
360 | bool fPragmaOnce;
|
---|
361 | /** Whether to fix the \#endif part of a header guard. */
|
---|
362 | bool fFixHeaderGuardEndif;
|
---|
363 | /** Whether to add a comment on the \#endif part of the header guard. */
|
---|
364 | bool fEndifGuardComment;
|
---|
365 | /** The guard name prefix. */
|
---|
366 | char *pszGuardPrefix;
|
---|
367 | /** Header guards should be normalized using prefix and this directory.
|
---|
368 | * When NULL the guard identifiers found in the header is preserved. */
|
---|
369 | char *pszGuardRelativeToDir;
|
---|
370 |
|
---|
371 | /** Whether to fix C/C++ todos. */
|
---|
372 | bool fFixTodos;
|
---|
373 | /** Whether to fix C/C++ err.h/errcore.h usage. */
|
---|
374 | bool fFixErrH;
|
---|
375 | /** No PAGE_SIZE, PAGE_SHIFT, PAGE_OFFSET_MASK allowed in C/C++, only the GUEST_
|
---|
376 | * or HOST_ prefixed versions. */
|
---|
377 | bool fOnlyGuestHostPage;
|
---|
378 | /** No ASMMemIsZeroPage or ASMMemZeroPage calls allowed (C/C++). */
|
---|
379 | bool fNoASMMemPageUse;
|
---|
380 | /** No rc declarations allowed, only hrc or vrc depending on the result type. */
|
---|
381 | bool fOnlyHrcVrcInsteadOfRc;
|
---|
382 |
|
---|
383 | /** Whether to standarize kmk makefiles. */
|
---|
384 | bool fStandarizeKmk;
|
---|
385 |
|
---|
386 | /** Update the copyright year. */
|
---|
387 | bool fUpdateCopyrightYear;
|
---|
388 | /** Only external copyright holders. */
|
---|
389 | bool fExternalCopyright;
|
---|
390 | /** Whether there should be a LGPL disclaimer. */
|
---|
391 | bool fLgplDisclaimer;
|
---|
392 | /** How to update the license. */
|
---|
393 | SCMLICENSE enmUpdateLicense;
|
---|
394 |
|
---|
395 | /** Only process files that are part of a SVN working copy. */
|
---|
396 | bool fOnlySvnFiles;
|
---|
397 | /** Only recurse into directories containing an .svn dir. */
|
---|
398 | bool fOnlySvnDirs;
|
---|
399 | /** Set svn:eol-style if missing or incorrect. */
|
---|
400 | bool fSetSvnEol;
|
---|
401 | /** Set svn:executable according to type (unusually this means deleting it). */
|
---|
402 | bool fSetSvnExecutable;
|
---|
403 | /** Set svn:keyword if completely or partially missing. */
|
---|
404 | bool fSetSvnKeywords;
|
---|
405 | /** Skip checking svn:sync-process. */
|
---|
406 | bool fSkipSvnSyncProcess;
|
---|
407 | /** Skip the unicode checks. */
|
---|
408 | bool fSkipUnicodeChecks;
|
---|
409 | /** Tab size. */
|
---|
410 | uint8_t cchTab;
|
---|
411 | /** Optimal source code width. */
|
---|
412 | uint8_t cchWidth;
|
---|
413 | /** Free the treat as structure. */
|
---|
414 | bool fFreeTreatAs;
|
---|
415 | /** Prematched config entry. */
|
---|
416 | PCSCMCFGENTRY pTreatAs;
|
---|
417 | /** Only consider files matching these patterns. This is only applied to the
|
---|
418 | * base names. */
|
---|
419 | char *pszFilterFiles;
|
---|
420 | /** Filter out files matching the following patterns. This is applied to base
|
---|
421 | * names as well as the absolute paths. */
|
---|
422 | char *pszFilterOutFiles;
|
---|
423 | /** Filter out directories matching the following patterns. This is applied
|
---|
424 | * to base names as well as the absolute paths. All absolute paths ends with a
|
---|
425 | * slash and dot ("/."). */
|
---|
426 | char *pszFilterOutDirs;
|
---|
427 | } SCMSETTINGSBASE;
|
---|
428 | /** Pointer to massager settings. */
|
---|
429 | typedef SCMSETTINGSBASE *PSCMSETTINGSBASE;
|
---|
430 |
|
---|
431 | /**
|
---|
432 | * File/dir pattern + options.
|
---|
433 | */
|
---|
434 | typedef struct SCMPATRNOPTPAIR
|
---|
435 | {
|
---|
436 | char *pszPattern;
|
---|
437 | char *pszOptions;
|
---|
438 | char *pszRelativeTo;
|
---|
439 | bool fMultiPattern;
|
---|
440 | } SCMPATRNOPTPAIR;
|
---|
441 | /** Pointer to a pattern + option pair. */
|
---|
442 | typedef SCMPATRNOPTPAIR *PSCMPATRNOPTPAIR;
|
---|
443 |
|
---|
444 |
|
---|
445 | /** Pointer to a settings set. */
|
---|
446 | typedef struct SCMSETTINGS *PSCMSETTINGS;
|
---|
447 | /**
|
---|
448 | * Settings set.
|
---|
449 | *
|
---|
450 | * This structure is constructed from the command line arguments or any
|
---|
451 | * .scm-settings file found in a directory we recurse into. When recursing in
|
---|
452 | * and out of a directory, we push and pop a settings set for it.
|
---|
453 | *
|
---|
454 | * The .scm-settings file has two kinds of setttings, first there are the
|
---|
455 | * unqualified base settings and then there are the settings which applies to a
|
---|
456 | * set of files or directories. The former are lines with command line options.
|
---|
457 | * For the latter, the options are preceded by a string pattern and a colon.
|
---|
458 | * The pattern specifies which files (and/or directories) the options applies
|
---|
459 | * to.
|
---|
460 | *
|
---|
461 | * We parse the base options into the Base member and put the others into the
|
---|
462 | * paPairs array.
|
---|
463 | */
|
---|
464 | typedef struct SCMSETTINGS
|
---|
465 | {
|
---|
466 | /** Pointer to the setting file below us in the stack. */
|
---|
467 | PSCMSETTINGS pDown;
|
---|
468 | /** Pointer to the setting file above us in the stack. */
|
---|
469 | PSCMSETTINGS pUp;
|
---|
470 | /** File/dir patterns and their options. */
|
---|
471 | PSCMPATRNOPTPAIR paPairs;
|
---|
472 | /** The number of entires in paPairs. */
|
---|
473 | uint32_t cPairs;
|
---|
474 | /** The base settings that was read out of the file. */
|
---|
475 | SCMSETTINGSBASE Base;
|
---|
476 | } SCMSETTINGS;
|
---|
477 | /** Pointer to a const settings set. */
|
---|
478 | typedef SCMSETTINGS const *PCSCMSETTINGS;
|
---|
479 |
|
---|
480 | /** @} */
|
---|
481 |
|
---|
482 |
|
---|
483 | void ScmVerboseBanner(PSCMRWSTATE pState, int iLevel);
|
---|
484 | void ScmVerbose(PSCMRWSTATE pState, int iLevel, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
|
---|
485 | SCMREWRITERRES ScmError(PSCMRWSTATE pState, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
|
---|
486 | bool ScmFixManually(PSCMRWSTATE pState, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3);
|
---|
487 | bool ScmFixManuallyV(PSCMRWSTATE pState, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
|
---|
488 |
|
---|
489 | extern const char g_szTabSpaces[16+1];
|
---|
490 | extern const char g_szAsterisks[255+1];
|
---|
491 | extern const char g_szSpaces[255+1];
|
---|
492 | extern uint32_t g_uYear;
|
---|
493 |
|
---|
494 | RT_C_DECLS_END
|
---|
495 |
|
---|
496 | #endif /* !VBOX_INCLUDED_SRC_bldprogs_scm_h */
|
---|
497 |
|
---|