VirtualBox

source: vbox/trunk/tools/bin/gen-slickedit-workspace.sh@ 104054

Last change on this file since 104054 was 102431, checked in by vboxsync, 12 months ago

gen-slickedit-workspace.sh: updates

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 43.1 KB
Line 
1#!/usr/bin/env kmk_ash
2# $Id: gen-slickedit-workspace.sh 102431 2023-12-02 02:39:49Z vboxsync $
3## @file
4# Script for generating a SlickEdit workspace.
5#
6# The gen-vscode-workspace.sh script is derived from this one, so fixes here
7# may apply there too.
8#
9
10#
11# Copyright (C) 2009-2023 Oracle and/or its affiliates.
12#
13# This file is part of VirtualBox base platform packages, as
14# available from https://www.virtualbox.org.
15#
16# This program is free software; you can redistribute it and/or
17# modify it under the terms of the GNU General Public License
18# as published by the Free Software Foundation, in version 3 of the
19# License.
20#
21# This program is distributed in the hope that it will be useful, but
22# WITHOUT ANY WARRANTY; without even the implied warranty of
23# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24# General Public License for more details.
25#
26# You should have received a copy of the GNU General Public License
27# along with this program; if not, see <https://www.gnu.org/licenses>.
28#
29# SPDX-License-Identifier: GPL-3.0-only
30#
31
32#
33# Include code we share with gen-vscode-workspace.sh
34#
35MY_SCRIPT_DIR=.
36case "$0" in
37 */*|*\\*)
38 MY_SCRIPT_DIR=$(echo "$0" | kmk_sed -e 's,[/\][^/\][^/\]*$,,')
39 ;;
40esac
41. "${MY_SCRIPT_DIR}/common-gen-workspace.inc.sh"
42
43
44#
45# Globals.
46#
47MY_PROJECT_FILES=""
48
49
50#
51# Parameters w/ defaults.
52#
53MY_OUT_DIR="SlickEdit"
54MY_PRJ_PRF="VBox-"
55MY_WS_NAME="VirtualBox.vpw"
56MY_DBG=""
57MY_WINDOWS_HOST=""
58MY_OPT_MINIMAL=""
59MY_OPT_USE_WILDCARDS="yes"
60MY_OPT_ONLY_USERCPP=""
61
62
63##
64# Generate folders for the specified directories and files.
65#
66# @param $1 The output (base) file name.
67# @param $2+ The files and directories to traverse.
68my_generate_folder()
69{
70 MY_FILE="$1"
71 shift
72
73 # Zap existing file collections.
74 > "${MY_FILE}-All.lst"
75 > "${MY_FILE}-Sources.lst"
76 > "${MY_FILE}-Headers.lst"
77 > "${MY_FILE}-Assembly.lst"
78 > "${MY_FILE}-Testcases.lst"
79 > "${MY_FILE}-Others.lst"
80
81 # Traverse the directories and files.
82 while test $# -ge 1 -a -n "${1}";
83 do
84 for f in ${MY_ROOT_DIR}/$1;
85 do
86 if test -d "${f}";
87 then
88 if test -z "${MY_OPT_USE_WILDCARDS}";
89 then
90 my_sub_tree "${MY_FILE}" "${f}"
91 else
92 case "${f}" in
93 ${MY_ROOT_DIR}/include*)
94 #my_sub_tree "${MY_FILE}" "${f}" "Headers"
95 my_wildcard "${MY_FILE}" "${f}" "Headers"
96 ;;
97 *) my_wildcard "${MY_FILE}" "${f}"
98 ;;
99 esac
100 fi
101 else
102 my_file "${MY_FILE}" "${f}"
103 fi
104 done
105 shift
106 done
107
108 # Generate the folders.
109 if test -s "${MY_FILE}-All.lst";
110 then
111 ${MY_SORT} "${MY_FILE}-All.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
112 fi
113 if test -s "${MY_FILE}-Sources.lst";
114 then
115 echo ' <Folder Name="Sources" Filters="*.c;*.cpp;*.cpp.h;*.c.h;*.m;*.mm;*.pl;*.py;*.as">' >> "${MY_FILE}"
116 ${MY_SORT} "${MY_FILE}-Sources.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
117 echo ' </Folder>' >> "${MY_FILE}"
118 fi
119 if test -s "${MY_FILE}-Headers.lst";
120 then
121 if test -z "${MY_OPT_USE_WILDCARDS}";
122 then
123 echo ' <Folder Name="Headers" Filters="*.h;*.hpp">' >> "${MY_FILE}"
124 else
125 echo ' <Folder Name="Headers" Filters="">' >> "${MY_FILE}"
126 fi
127 ${MY_SORT} "${MY_FILE}-Headers.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
128 echo ' </Folder>' >> "${MY_FILE}"
129 fi
130 if test -s "${MY_FILE}-Assembly.lst";
131 then
132 echo ' <Folder Name="Assembly" Filters="*.asm;*.s;*.S;*.inc;*.mac">' >> "${MY_FILE}"
133 ${MY_SORT} "${MY_FILE}-Assembly.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
134 echo ' </Folder>' >> "${MY_FILE}"
135 fi
136 if test -s "${MY_FILE}-Testcases.lst";
137 then
138 echo ' <Folder Name="Testcases" Filters="tst*;">' >> "${MY_FILE}"
139 ${MY_SORT} "${MY_FILE}-Testcases.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
140 echo ' </Folder>' >> "${MY_FILE}"
141 fi
142 if test -s "${MY_FILE}-Others.lst";
143 then
144 echo ' <Folder Name="Others" Filters="">' >> "${MY_FILE}"
145 ${MY_SORT} "${MY_FILE}-Others.lst" | ${MY_SED} -e 's/<!-- sortkey: [^>]*>/ /' >> "${MY_FILE}"
146 echo ' </Folder>' >> "${MY_FILE}"
147 fi
148
149 # Cleanup
150 ${MY_RM} "${MY_FILE}-All.lst" "${MY_FILE}-Sources.lst" "${MY_FILE}-Headers.lst" "${MY_FILE}-Assembly.lst" \
151 "${MY_FILE}-Testcases.lst" "${MY_FILE}-Others.lst"
152}
153
154##
155# Function generating a project build config.
156#
157# @param $1 The project file name.
158# @param $2 Build config name.
159# @param $3 Extra kBuild command line options, variant 1.
160# @param $4 Extra kBuild command line options, variant 2.
161# @param $4+ Include directories.
162# @param $N --end-includes
163my_generate_project_config()
164{
165 MY_FILE="${1}";
166 MY_CFG_NAME="${2}";
167 MY_KMK_EXTRAS1="${3}";
168 MY_KMK_EXTRAS2="${4}";
169 MY_KMK_EXTRAS3="${5}";
170 MY_KMK_EXTRAS4="${6}";
171 shift; shift; shift; shift; shift; shift;
172
173 echo ' <Config Name="'"${MY_CFG_NAME}"'" OutputFile="" CompilerConfigName="Latest Version">' >> "${MY_FILE}"
174 echo ' <Menu>' >> "${MY_FILE}"
175
176 echo ' <Target Name="Compile" MenuCaption="&amp;Compile" CaptureOutputWith="ProcessBuffer"' >> "${MY_FILE}"
177 echo ' SaveOption="SaveCurrent" RunFromDir="%p" ClearProcessBuffer="1">' >> "${MY_FILE}"
178 echo -n ' <Exec CmdLine="'"${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS1}"' -C %p %n.o' >> "${MY_FILE}"
179 if test -n "${MY_KMK_EXTRAS2}"; then
180 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS2} -C %p %n.o" >> "${MY_FILE}"
181 fi
182 if test -n "${MY_KMK_EXTRAS3}"; then
183 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS3} -C %p %n.o" >> "${MY_FILE}"
184 fi
185 if test -n "${MY_KMK_EXTRAS4}"; then
186 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS4} -C %p %n.o" >> "${MY_FILE}"
187 fi
188 echo '"/>' >> "${MY_FILE}"
189 echo ' </Target>' >> "${MY_FILE}"
190
191 echo ' <Target Name="Build" MenuCaption="&amp;Build"CaptureOutputWith="ProcessBuffer"' >> "${MY_FILE}"
192 echo ' SaveOption="SaveWorkspaceFiles" RunFromDir="%rw" ClearProcessBuffer="1">' >> "${MY_FILE}"
193 echo -n ' <Exec CmdLine="'"${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS1}"' -C %rw' >> "${MY_FILE}"
194 if test -n "${MY_KMK_EXTRAS2}"; then
195 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS2} -C %rw" >> "${MY_FILE}"
196 fi
197 if test -n "${MY_KMK_EXTRAS3}"; then
198 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS3} -C %rw" >> "${MY_FILE}"
199 fi
200 if test -n "${MY_KMK_EXTRAS4}"; then
201 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS4} -C %rw" >> "${MY_FILE}"
202 fi
203 echo '"/>' >> "${MY_FILE}"
204 echo ' </Target>' >> "${MY_FILE}"
205
206 echo ' <Target Name="Rebuild" MenuCaption="&amp;Rebuild" CaptureOutputWith="ProcessBuffer"' >> "${MY_FILE}"
207 echo ' SaveOption="SaveWorkspaceFiles" RunFromDir="%rw" ClearProcessBuffer="1">' >> "${MY_FILE}"
208 echo -n ' <Exec CmdLine="'"${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS1}"' -C %rw' >> "${MY_FILE}"
209 if test -n "${MY_KMK_EXTRAS2}"; then
210 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS2} -C %rw rebuild" >> "${MY_FILE}"
211 fi
212 if test -n "${MY_KMK_EXTRAS3}"; then
213 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS3} -C %rw rebuild" >> "${MY_FILE}"
214 fi
215 if test -n "${MY_KMK_EXTRAS4}"; then
216 echo -n " && ${MY_KMK_INVOCATION} ${MY_KMK_EXTRAS4} -C %rw rebuild" >> "${MY_FILE}"
217 fi
218 echo '"/>' >> "${MY_FILE}"
219 echo ' </Target>' >> "${MY_FILE}"
220
221 #echo ' <Target Name="Debug" MenuCaption="&amp;Debug" SaveOption="SaveNone" RunFromDir="%rw">' >> "${MY_FILE}"
222 #echo ' <Exec/>' >> "${MY_FILE}"
223 #echo ' </Target>' >> "${MY_FILE}"
224 #echo ' <Target Name="Execute" MenuCaption="E&amp;xecute" SaveOption="SaveNone" RunFromDir="%rw">'>> "${MY_FILE}"
225 #echo ' <Exec/>' >> "${MY_FILE}"
226 #echo ' </Target>' >> "${MY_FILE}"
227 echo ' </Menu>' >> "${MY_FILE}"
228
229 #
230 # Include directories.
231 #
232 echo ' <Includes>' >> "${MY_FILE}"
233 while test $# -ge 1 -a "${1}" != "--end-includes";
234 do
235 for f in $1;
236 do
237 my_abs_dir ${f}
238 echo ' <Include Dir="'"${MY_ABS_DIR}/"'"/>' >> "${MY_FILE}"
239 done
240 shift
241 done
242 shift
243 echo ' </Includes>' >> "${MY_FILE}"
244 echo ' </Config>' >> "${MY_FILE}"
245}
246
247
248##
249# Function generating a project.
250#
251# This is called from my_generate_all_projects() in the common code.
252#
253# @param $1 The project file name.
254# @param $2 The project working directory.
255# @param $3 Dummy separator.
256# @param $4+ Include directories.
257# @param $N --end-includes
258# @param $N+1 Directory sub-trees and files to include in the project.
259#
260my_generate_project()
261{
262 MY_FILE="${MY_PRJ_PRF}${1}.vpj";
263 echo "Generating ${MY_FILE}..."
264 MY_WRK_DIR="${2}"
265 shift
266 shift
267 shift
268
269 # Add it to the project list for workspace construction later on.
270 MY_PROJECT_FILES="${MY_PROJECT_FILES} ${MY_FILE}"
271
272
273 #
274 # Generate the head bits.
275 #
276 echo '<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd">' > "${MY_FILE}"
277 echo '<Project' >> "${MY_FILE}"
278 echo ' Version="10.0"' >> "${MY_FILE}"
279 echo ' VendorName="SlickEdit"' >> "${MY_FILE}"
280 echo ' VCSProject="Subversion:"' >> "${MY_FILE}"
281# echo ' Customized="1"' >> "${MY_FILE}"
282# echo ' WorkingDir="."' >> "${MY_FILE}"
283 my_abs_dir "${MY_WRK_DIR}" >> "${MY_FILE}"
284 echo ' WorkingDir="'"${MY_ABS_DIR}"'"' >> "${MY_FILE}"
285 echo ' >' >> "${MY_FILE}"
286 my_generate_project_config "${MY_FILE}" "Default" "" "" "" "" $*
287 my_generate_project_config "${MY_FILE}" "Debug + hardening" "KBUILD_TYPE=debug VBOX_WITH_HARDENING=1" "" "" "" $*
288 my_generate_project_config "${MY_FILE}" "Release + hardening" "KBUILD_TYPE=release VBOX_WITH_HARDENING=1" "" "" "" $*
289 my_generate_project_config "${MY_FILE}" "Debug+Release + hardening" \
290 "KBUILD_TYPE=debug VBOX_WITH_HARDENING=1" \
291 "KBUILD_TYPE=release VBOX_WITH_HARDENING=1" \
292 "" "" $*
293 my_generate_project_config "${MY_FILE}" "Debug w/o hardening" "KBUILD_TYPE=debug VBOX_WITHOUT_HARDENING=1" "" "" $*
294 my_generate_project_config "${MY_FILE}" "Release w/o hardening" "KBUILD_TYPE=release VBOX_WITHOUT_HARDENING=1" "" "" $*
295 my_generate_project_config "${MY_FILE}" "Debug+Release w/o hardening" \
296 "KBUILD_TYPE=debug VBOX_WITHOUT_HARDENING=1" \
297 "KBUILD_TYPE=release VBOX_WITHOUT_HARDENING=1" \
298 "" "" $*
299 my_generate_project_config "${MY_FILE}" "Debug+Release with and without hardening" \
300 "KBUILD_TYPE=debug VBOX_WITH_HARDENING=1" \
301 "KBUILD_TYPE=release VBOX_WITH_HARDENING=1" \
302 "KBUILD_TYPE=debug VBOX_WITHOUT_HARDENING=1" \
303 "KBUILD_TYPE=release VBOX_WITHOUT_HARDENING=1" \
304 $*
305
306 while test $# -ge 1 -a "${1}" != "--end-includes";
307 do
308 shift;
309 done;
310 shift;
311
312 #
313 # Process directories+files and create folders.
314 #
315 echo ' <Files>' >> "${MY_FILE}"
316 my_generate_folder "${MY_FILE}" $*
317 echo ' </Files>' >> "${MY_FILE}"
318
319 #
320 # The tail.
321 #
322 echo '</Project>' >> "${MY_FILE}"
323
324 return 0
325}
326
327
328##
329# Generate the workspace
330#
331my_generate_workspace()
332{
333 MY_FILE="${MY_WS_NAME}"
334 echo "Generating ${MY_FILE}..."
335 echo '<!DOCTYPE Workspace SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpw.dtd">' > "${MY_FILE}"
336 echo '<Workspace Version="10.0" VendorName="SlickEdit">' >> "${MY_FILE}"
337 echo ' <Projects>' >> "${MY_FILE}"
338 for i in ${MY_PROJECT_FILES};
339 do
340 echo ' <Project File="'"${i}"'" />' >> "${MY_FILE}"
341 done
342 echo ' </Projects>' >> "${MY_FILE}"
343 echo '</Workspace>' >> "${MY_FILE}"
344 return 0;
345}
346
347
348##
349# Generate stuff
350#
351my_generate_usercpp_h()
352{
353 #
354 # Probe the slickedit user config, picking the most recent version.
355 #
356 MY_VSLICK_DB_OLD=
357 if test -z "${MY_SLICK_CONFIG}"; then
358 if test -d "${HOME}/Library/Application Support/SlickEdit"; then
359 MY_SLICKDIR_="${HOME}/Library/Application Support/SlickEdit"
360 MY_USERCPP_H="unxcpp.h"
361 MY_VSLICK_DB="vslick.sta" # was .stu earlier, 24 is using .sta.
362 MY_VSLICK_DB_OLD="vslick.stu"
363 elif test -d "${HOMEDRIVE}${HOMEPATH}/AppData/Local/SlickEdit"; then
364 MY_SLICKDIR_="${HOMEDRIVE}${HOMEPATH}/AppData/Local/SlickEdit"
365 MY_USERCPP_H="usercpp.h"
366 MY_VSLICK_DB="vslick.sta"
367 elif test -d "${HOMEDRIVE}${HOMEPATH}/Documents/My SlickEdit Config"; then
368 MY_SLICKDIR_="${HOMEDRIVE}${HOMEPATH}/Documents/My SlickEdit Config"
369 MY_USERCPP_H="usercpp.h"
370 MY_VSLICK_DB="vslick.sta"
371 else
372 MY_SLICKDIR_="${HOME}/.slickedit"
373 MY_USERCPP_H="unxcpp.h"
374 MY_VSLICK_DB="vslick.sta"
375 MY_VSLICK_DB_OLD="vslick.stu"
376 fi
377 else
378 MY_SLICKDIR_="${MY_SLICK_CONFIG}"
379 if test -n "${MY_WINDOWS_HOST}"; then
380 MY_USERCPP_H="usercpp.h"
381 MY_VSLICK_DB="vslick.sta"
382 else
383 MY_USERCPP_H="unxcpp.h"
384 MY_VSLICK_DB="vslick.sta"
385 MY_VSLICK_DB_OLD="vslick.stu"
386 fi
387 # MacOS: Implement me!
388 fi
389
390 MY_VER_NUM="0"
391 MY_VER="0.0.0"
392 for subdir in "${MY_SLICKDIR_}/"*;
393 do
394 if test -f "${subdir}/${MY_USERCPP_H}" \
395 -o -f "${subdir}/${MY_VSLICK_DB}" \
396 -o '(' -n "${MY_VSLICK_DB_OLD}" -a -f "${subdir}/${MY_VSLICK_DB_OLD}" ')'; then
397 MY_CUR_VER_NUM=0
398 MY_CUR_VER=`echo "${subdir}" | ${MY_SED} -e 's,^.*/,,g'`
399
400 # Convert the dotted version number to an integer, checking that
401 # it is all numbers in the process.
402 set `echo "${MY_CUR_VER}" | ${MY_SED} 's/\./ /g' `
403 i=24010000 # == 70*70*70*70; max major version 89.
404 while test $# -gt 0;
405 do
406 if ! ${MY_EXPR} "$1" + 1 > /dev/null 2> /dev/null; then
407 MY_CUR_VER_NUM=0;
408 break
409 fi
410 if test "$i" -gt 0; then
411 MY_CUR_VER_NUM=$((${MY_CUR_VER_NUM} + $1 * $i))
412 i=$(($i / 70))
413 fi
414 shift
415 done
416
417 # More recent that what we have?
418 if test "${MY_CUR_VER_NUM}" -gt "${MY_VER_NUM}"; then
419 MY_VER_NUM="${MY_CUR_VER_NUM}"
420 MY_VER="${MY_CUR_VER}"
421 fi
422 fi
423 done
424
425 MY_SLICKDIR="${MY_SLICKDIR_}/${MY_VER}"
426 MY_USERCPP_H_FULL="${MY_SLICKDIR}/${MY_USERCPP_H}"
427 if test -d "${MY_SLICKDIR}"; then
428 echo "Found SlickEdit v${MY_VER} preprocessor file: ${MY_USERCPP_H_FULL}"
429 else
430 echo "Failed to locate SlickEdit preprocessor file. You need to manually merge ${MY_USERCPP_H}."
431 echo "dbg: MY_SLICKDIR=${MY_SLICKDIR} MY_USERCPP_H_FULL=${MY_USERCPP_H_FULL}"
432 MY_USERCPP_H_FULL=""
433 fi
434
435 # Generate our stuff.
436 MY_FILE="${MY_USERCPP_H}"
437 ${MY_CAT} > ${MY_FILE} <<EOF
438#define IN_SLICKEDIT
439#define RT_C_DECLS_BEGIN
440#define RT_C_DECLS_END
441#define RT_NOTHROW_PROTO
442#define RT_NOTHROW_DEF
443#define RT_NO_THROW_PROTO
444#define RT_NO_THROW_DEF
445#define RT_NOEXCEPT
446#define RT_OVERRIDE
447#define RT_THROW(type) throw(type)
448#define RT_GCC_EXTENSION
449#define RT_COMPILER_GROKS_64BIT_BITFIELDS
450#define RT_COMPILER_WITH_80BIT_LONG_DOUBLE
451#define RT_DECL_NTAPI(type) type
452#define RT_CONCAT(a,b) a##b
453#define RT_CONCAT3(a,b,c) a##b##c
454#define RT_CONCAT4(a,b,c,d) a##b##c##d
455
456#define ATL_NO_VTABLE
457#define BEGIN_COM_MAP(a)
458#define COM_INTERFACE_ENTRY(a)
459#define COM_INTERFACE_ENTRY2(a,b)
460#define COM_INTERFACE_ENTRY3(a,b,c)
461#define COM_INTERFACE_ENTRY4(a,b,c,d)
462#define END_COM_MAP(a)
463
464#define COM_DECL_READONLY_ENUM_AND_COLLECTION(a)
465#define COMGETTER(n) n
466#define COMSETTER(n) n
467#define ComSafeArrayIn(t,a) t a[]
468#define ComSafeArrayOut(t,a) t * a[]
469#define DECLARE_CLASSFACTORY(a)
470#define DECLARE_CLASSFACTORY_SINGLETON(a)
471#define DECLARE_REGISTRY_RESOURCEID(a)
472#define DECLARE_NOT_AGGREGATABLE(a)
473#define DECLARE_PROTECT_FINAL_CONSTRUCT(a)
474#define DECLARE_EMPTY_CTOR_DTOR(a) a(); ~a();
475#define DEFINE_EMPTY_CTOR_DTOR(a) a::a() {} a::~a() {}
476#define DECLARE_TRANSLATE_METHODS(cls) \
477 static inline const char *tr(const char *aSourceText, \
478 const char *aComment = NULL, \
479 const int aNum = -1) \
480 { \
481 return VirtualBoxTranslator::translate(#cls, aSourceText, aComment, aNum); \
482 }
483#define DECLARE_COMMON_CLASS_METHODS(cls) \
484 DECLARE_EMPTY_CTOR_DTOR(cls) \
485 DECLARE_TRANSLATE_METHODS(cls)
486#define NS_DECL_ISUPPORTS
487#define NS_IMETHOD virtual nsresult
488#define NS_IMETHOD_(type) virtual type
489#define NS_IMETHODIMP nsresult
490#define NS_IMETHODIMP_(type) type
491#define PARSERS_EXPORT
492EOF
493 if test -n "${MY_WINDOWS_HOST}"; then
494 ${MY_CAT} >> ${MY_FILE} <<EOF
495#define COM_STRUCT_OR_CLASS(I) struct I
496#define STDMETHOD(m) virtual HRESULT m
497#define STDMETHOD_(type,m) virtual type m
498#define STDMETHODIMP HRESULT
499#define STDMETHODIMP_(type) type
500EOF
501 else
502 ${MY_CAT} >> ${MY_FILE} <<EOF
503#define COM_STRUCT_OR_CLASS(I) class I
504#define STDMETHOD(m) virtual nsresult m
505#define STDMETHOD_(type,m) virtual type m
506#define STDMETHODIMP nsresult
507#define STDMETHODIMP_(type) type
508EOF
509 fi
510 ${MY_CAT} >> ${MY_FILE} <<EOF
511#define VBOX_SCRIPTABLE(a) public a
512#define VBOX_SCRIPTABLE_IMPL(a)
513#define VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(a)
514
515#define CTX_SUFF(var) var##R3
516#define CTXAllSUFF(var) var##R3
517#define CTXSUFF(var) var##HC
518#define OTHERCTXSUFF(var) var##GC
519#define CTXALLMID(first, last) first##R3##last
520#define CTXMID(first, last) first##HC##last
521#define OTHERCTXMID(first, last) first##GC##last
522#define CTXTYPE(GCType, R3Type, R0Type) R3Type
523#define RCTYPE(RCType, HCType) RCType
524#define GCTYPE(GCType, HCType) GCType
525#define RCPTRTYPE(RCType) RCType
526#define GCPTRTYPE(GCType) GCType
527#define HCPTRTYPE(HCType) HCType
528#define R3R0PTRTYPE(HCType) HCType
529#define R0PTRTYPE(R3Type) R3Type
530#define R3PTRTYPE(R0Type) R0Type
531#define RT_SRC_POS __FILE__, __LINE__, __PRETTY_FUNCTION__
532#define RT_SRC_POS_DECL const char *pszFile, unsigned iLine, const char *pszFunction
533#define RT_SRC_POS_ARGS pszFile, iLine, pszFunction
534#define RTCALL
535#define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)
536#define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)
537#define RT_NOCRT(a_Name) a_Name
538#define DECLASM(type) type
539#define DECLINLINE(type) inline type
540#define DECL_INLINE_THROW(type) inline type
541#define DECL_FORCE_INLINE(type) inline type
542#define DECL_FORCE_INLINE_THROW(type) inline type
543#define DECL_INVALID(type) type
544#define DECL_NO_RETURN(a_RetType) a_RetType
545#define DECLCALLBACK(a_RetType) a_RetType
546#define DECLCALLBACKMEMBER(a_RetType, a_Name, a_Args) a_RetType (*a_Name) a_Args
547#define DECLCALLBACKMEMBER_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (*a_Name) a_Args
548#define DECLR0CALLBACKMEMBER(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (*a_Name) a_Args
549#define DECLR3CALLBACKMEMBER(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (*a_Name) a_Args
550#define DECLRCCALLBACKMEMBER(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (*a_Name) a_Args
551#define DECLRGCALLBACKMEMBER(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (*a_Name) a_Args
552#define DECLCALLBACKPTR(a_RetType, a_Name, a_Args) a_RetType (*a_Name) a_Args
553#define DECLCALLBACKPTR_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType (*a_Name) a_Args
554#define DECLCALLBACKTYPE(a_RetType, a_Name, a_Args) a_RetType a_Name a_Args
555#define DECLCALLBACKTYPE_EX(a_RetType, a_CallConv, a_Name, a_Args) a_RetType a_Name a_Args
556#define DECLEXPORT(a_RetType) a_RetType
557#define DECL_EXPORT_NOTHROW(a_RetType) a_RetType
558#define DECLHIDDEN(a_RetType) a_RetType
559#define DECL_HIDDEN_CALLBACK(a_RetType) a_RetType
560#define DECL_HIDDEN_NOTHROW(a_RetType) a_RetType
561#define DECL_HIDDEN_THROW(a_RetType) a_RetType
562#define DECLIMPORT(a_RetType) a_RetType
563#define DECL_IMPORT_NOTHROW(a_RetType) a_RetType
564
565#define DECLVBGL(a_RetType) a_RetType
566
567#define PDMDEVINSINT_DECLARED 1
568#define VBOX_WITH_HGCM 1
569#define VBOXCALL
570
571#define HM_NAMELESS_UNION_TAG(a_Tag)
572#define HM_UNION_NM(a_Nm)
573#define HM_STRUCT_NM(a_Nm)
574
575#define PGM_ALL_CB_DECL(type) type
576#define PGM_ALL_CB2_DECL(type) type
577#define PGM_CTX(a,b) b
578#define PGM_CTX3(a,b,c) c
579#define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name)
580#define PGM_GST_NAME_REAL(name) pgmGstReal##name
581#define PGM_GST_NAME_PROT(name) pgmGstProt##name
582#define PGM_GST_NAME_32BIT(name) pgmGst32Bit##name
583#define PGM_GST_NAME_PAE(name) pgmGstPAE##name
584#define PGM_GST_NAME_AMD64(name) pgmGstAMD64##name
585#define PGM_GST_DECL(type, name) type PGM_GST_NAME(name)
586#define PGM_SHW_NAME(name) PGM_GST_NAME_AMD64(name)
587#define PGM_SHW_NAME_32BIT(name) pgmShw32Bit##name
588#define PGM_SHW_NAME_PAE(name) pgmShwPAE##name
589#define PGM_SHW_NAME_AMD64(name) pgmShwAMD64##name
590#define PGM_SHW_NAME_NESTED(name) pgmShwNested##name
591#define PGM_SHW_NAME_EPT(name) pgmShwEPT##name
592#define PGM_SHW_DECL(type, name) type PGM_SHW_NAME(name)
593#define PGM_BTH_NAME(name) PGM_BTH_NAME_NESTED_AMD64(name)
594#define PGM_BTH_NAME_32BIT_REAL(name) pgmBth##name
595#define PGM_BTH_NAME_32BIT_PROT(name) pgmBth##name
596#define PGM_BTH_NAME_32BIT_32BIT(name) pgmBth##name
597#define PGM_BTH_NAME_PAE_REAL(name) pgmBth##name
598#define PGM_BTH_NAME_PAE_PROT(name) pgmBth##name
599#define PGM_BTH_NAME_PAE_32BIT(name) pgmBth##name
600#define PGM_BTH_NAME_PAE_PAE(name) pgmBth##name
601#define PGM_BTH_NAME_AMD64_PROT(name) pgmBth##name
602#define PGM_BTH_NAME_AMD64_AMD64(name) pgmBth##name
603#define PGM_BTH_NAME_NESTED_REAL(name) pgmBth##name
604#define PGM_BTH_NAME_NESTED_PROT(name) pgmBth##name
605#define PGM_BTH_NAME_NESTED_32BIT(name) pgmBth##name
606#define PGM_BTH_NAME_NESTED_PAE(name) pgmBth##name
607#define PGM_BTH_NAME_NESTED_AMD64(name) pgmBth##name
608#define PGM_BTH_NAME_EPT_REAL(name) pgmBth##name
609#define PGM_BTH_NAME_EPT_PROT(name) pgmBth##name
610#define PGM_BTH_NAME_EPT_32BIT(name) pgmBth##name
611#define PGM_BTH_NAME_EPT_PAE(name) pgmBth##name
612#define PGM_BTH_NAME_EPT_AMD64(name) pgmBth##name
613#define PGM_BTH_DECL(type, name) type PGM_BTH_NAME(name)
614
615#define FNIEMOP_STUB(a_Name) VBOXSTRICTRC a_Name(PIEMCPU pIemCpu) { return VERR_NOT_IMPLEMENTED; }
616#define FNIEMOP_DEF(a_Name) VBOXSTRICTRC a_Name(PIEMCPU pIemCpu)
617#define FNIEMOP_DEF_1(a_Name, a_Type0, a_Name0) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0)
618#define FNIEMOP_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0, a_Type1 a_Name1)
619#define FNIEMOPRM_DEF(a_Name) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, uint8_t bBm)
620#define IEM_CIMPL_DEF_0(a_Name) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu)
621#define IEM_CIMPL_DEF_1(a_Name, a_Type0, a_Name0) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, , a_Type0 a_Name0)
622#define IEM_CIMPL_DEF_2(a_Name, a_Type0, a_Name0, a_Type1, a_Name1) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0, a_Type1 a_Name1)
623#define IEM_CIMPL_DEF_3(a_Name, a_Type0, a_Name0, a_Type1, a_Name1, a_Type2, a_Name2) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0, a_Type1 a_Name1, a_Type2 a_Name2)
624#define IEM_CIMPL_DEF_4(a_Name, a_Type0, a_Name0, a_Type1, a_Name1, a_Type2, a_Name2, a_Type3, a_Name3) static VBOXSTRICTRC a_Name(PIEMCPU pIemCpu, a_Type0 a_Name0, a_Type1 a_Name1, a_Type2 a_Name2, a_Type3 a_Name3)
625#define IEM_DECL_IMPL_DEF(a_RetType, a_Name, a_ArgList) a_RetType a_Name a_ArgList
626#define IEM_DECL_IEMTHREADEDFUNC_DEF(a_Name) VBOXSTRICTRC a_Name(PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2)
627#define IEM_DECL_IEMTHREADEDFUNC_PROTO(a_Name) VBOXSTRICTRC a_Name(PVMCPU pVCpu, uint64_t uParam0, uint64_t uParam1, uint64_t uParam2)
628#define IEM_DECL_NATIVE_HLP_DEF(a_RetType, a_Name, a_ArgList) a_RetType a_Name a_ArgList
629#define IEM_DECL_NATIVE_HLP_PROTO(a_RetType, a_Name, a_ArgList) a_RetType a_Name a_ArgList
630#define IEM_DECL_IEMNATIVERECOMPFUNC_DEF(a_Name) uint32_t a_Name(PIEMRECOMPILERSTATE pReNative, uint32_t off, PCIEMTHRDEDCALLENTRY pCallEntry)
631#define IEM_DECL_IEMNATIVERECOMPFUNC_PROTO(a_Name) FNIEMNATIVERECOMPFUNC a_Name
632#define IEM_MC_LOCAL(a_Type, a_Name) a_Type a_Name
633#define IEM_MC_ARG(a_Type, a_Name, a_iArg) a_Type a_Name
634#define IEM_MC_ARG_CONST(a_Type, a_Name, a_Value, a_iArg) a_Type const a_Name = a_Value
635#define IEM_STATIC
636
637#define RTASN1_IMPL_GEN_SEQ_OF_TYPEDEFS_AND_PROTOS(a_SeqOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) typedef struct a_SeqOfType { RTASN1SEQUENCECORE SeqCore; RTASN1ALLOCATION Allocation; uint32_t cItems; RT_CONCAT(P,a_ItemType) paItems; } a_SeqOfType; typedef a_SeqOfType *P##a_SeqOfType, const *PC##a_SeqOfType; int a_ImplExtNm##_DecodeAsn1(struct RTASN1CURSOR *pCursor, uint32_t fFlags, P##a_SeqOfType pThis, const char *pszErrorTag); int a_ImplExtNm##_Compare(PC##a_SeqOfType pLeft, PC##a_SeqOfType pRight)
638#define RTASN1_IMPL_GEN_SET_OF_TYPEDEFS_AND_PROTOS(a_SetOfType, a_ItemType, a_DeclMacro, a_ImplExtNm) typedef struct a_SetOfType { RTASN1SETCORE SetCore; RTASN1ALLOCATION Allocation; uint32_t cItems; RT_CONCAT(P,a_ItemType) paItems; } a_SetOfType; typedef a_SetOfType *P##a_SetOfType, const *PC##a_SetOfType; int a_ImplExtNm##_DecodeAsn1(struct RTASN1CURSOR *pCursor, uint32_t fFlags, P##a_SetOfType pThis, const char *pszErrorTag); int a_ImplExtNm##_Compare(PC##a_SetOfType pLeft, PC##a_SetOfType pRight)
639#define RTASN1TYPE_STANDARD_PROTOTYPES_NO_GET_CORE(a_TypeNm, a_DeclMacro, a_ImplExtNm) int a_ImplExtNm##_Init(P##a_TypeNm pThis, PCRTASN1ALLOCATORVTABLE pAllocator); int a_ImplExtNm##_Clone(P##a_TypeNm pThis, PC##a_TypeNm) pSrc, PCRTASN1ALLOCATORVTABLE pAllocator); void a_ImplExtNm##_Delete(P##a_TypeNm pThis); int a_ImplExtNm##_Enum(P##a_TypeNm pThis, PFNRTASN1ENUMCALLBACK pfnCallback, uint32_t uDepth, void *pvUser); int a_ImplExtNm##_Compare(PC##a_TypeNm) pLeft, PC##a_TypeNm pRight); int a_ImplExtNm##_DecodeAsn1(PRTASN1CURSOR pCursor, uint32_t fFlags, P##a_TypeNm pThis, const char *pszErrorTag); int a_ImplExtNm##_CheckSanity(PC##a_TypeNm pThis, uint32_t fFlags, PRTERRINFO pErrInfo, const char *pszErrorTag)
640#define RTASN1TYPE_STANDARD_PROTOTYPES(a_TypeNm, a_DeclMacro, a_ImplExtNm, a_Asn1CoreNm) inline PRTASN1CORE a_ImplExtNm##_GetAsn1Core(PC##a_TypeNm pThis) { return (PRTASN1CORE)&pThis->a_Asn1CoreNm; } inline bool a_ImplExtNm##_IsPresent(PC##a_TypeNm pThis) { return pThis && RTASN1CORE_IS_PRESENT(&pThis->a_Asn1CoreNm); } RTASN1TYPE_STANDARD_PROTOTYPES_NO_GET_CORE(a_TypeNm, a_DeclMacro, a_ImplExtNm)
641
642#define RTLDRELF_NAME(name) rtldrELF64##name
643#define RTLDRELF_SUFF(name) name##64
644#define RTLDRELF_MID(pre,suff) pre##64##suff
645
646#define BS3_DECL(type) type
647#define BS3_DECL_CALLBACK(type) type
648#define TMPL_NM(name) name##_mmm
649#define TMPL_FAR_NM(name) name##_mmm_far
650#define BS3_CMN_NM(name) name
651#define BS3_CMN_FAR_NM(name) name
652#define BS3_CMN_FN_NM(name) name
653#define BS3_DATA_NM(name) name
654#define BS3_FAR
655#define BS3_FAR_CODE
656#define BS3_FAR_DATA
657#define BS3_NEAR
658#define BS3_NEAR_CODE
659#define BS3_CMN_PROTO_STUB(a_RetType, a_Name, a_Params) a_RetType a_Name a_Params
660#define BS3_CMN_PROTO_NOSB(a_RetType, a_Name, a_Params) a_RetType a_Name a_Params
661#define BS3_CMN_DEF( a_RetType, a_Name, a_Params) a_RetType a_Name a_Params
662#define BS3_MODE_PROTO_STUB(a_RetType, a_Name, a_Params) \
663 a_RetType a_Name##_mmm a_Params; \
664 a_RetType a_Name##_mmm_far a_Params; \
665 a_RetType a_Name##_rm a_Params; \
666 a_RetType a_Name##_pe16 a_Params; \
667 a_RetType a_Name##_pe16_32 a_Params; \
668 a_RetType a_Name##_pe16_v86 a_Params; \
669 a_RetType a_Name##_pe32 a_Params; \
670 a_RetType a_Name##_pe32_16 a_Params; \
671 a_RetType a_Name##_pev86 a_Params; \
672 a_RetType a_Name##_pp16 a_Params; \
673 a_RetType a_Name##_pp16_32 a_Params; \
674 a_RetType a_Name##_pp16_v86 a_Params; \
675 a_RetType a_Name##_pp32 a_Params; \
676 a_RetType a_Name##_pp32_16 a_Params; \
677 a_RetType a_Name##_ppv86 a_Params; \
678 a_RetType a_Name##_pae16 a_Params; \
679 a_RetType a_Name##_pae16_32 a_Params; \
680 a_RetType a_Name##_pae16_v86 a_Params; \
681 a_RetType a_Name##_pae32 a_Params; \
682 a_RetType a_Name##_pae32_16 a_Params; \
683 a_RetType a_Name##_paev86 a_Params; \
684 a_RetType a_Name##_lm16 a_Params; \
685 a_RetType a_Name##_lm32 a_Params; \
686 a_RetType a_Name##_lm64 a_Params; \
687 a_RetType a_Name##_rm_far a_Params; \
688 a_RetType a_Name##_pe16_far a_Params; \
689 a_RetType a_Name##_pe16_v86_far a_Params; \
690 a_RetType a_Name##_pe32_16_far a_Params; \
691 a_RetType a_Name##_pev86_far a_Params; \
692 a_RetType a_Name##_pp16_far a_Params; \
693 a_RetType a_Name##_pp16_v86_far a_Params; \
694 a_RetType a_Name##_pp32_16_far a_Params; \
695 a_RetType a_Name##_ppv86_far a_Params; \
696 a_RetType a_Name##_pae16_far a_Params; \
697 a_RetType a_Name##_pae16_v86_far a_Params; \
698 a_RetType a_Name##_pae32_16_far a_Params; \
699 a_RetType a_Name##_paev86_far a_Params; \
700 a_RetType a_Name##_lm16_far a_Params
701#define BS3_MODE_PROTO_NOSB(a_RetType, a_Name, a_Params) \
702 a_RetType a_Name##_mmm a_Params; \
703 a_RetType a_Name##_mmm_far a_Params; \
704 a_RetType a_Name##_rm a_Params; \
705 a_RetType a_Name##_pe16 a_Params; \
706 a_RetType a_Name##_pe16_32 a_Params; \
707 a_RetType a_Name##_pe16_v86 a_Params; \
708 a_RetType a_Name##_pe32 a_Params; \
709 a_RetType a_Name##_pe32_16 a_Params; \
710 a_RetType a_Name##_pev86 a_Params; \
711 a_RetType a_Name##_pp16 a_Params; \
712 a_RetType a_Name##_pp16_32 a_Params; \
713 a_RetType a_Name##_pp16_v86 a_Params; \
714 a_RetType a_Name##_pp32 a_Params; \
715 a_RetType a_Name##_pp32_16 a_Params; \
716 a_RetType a_Name##_ppv86 a_Params; \
717 a_RetType a_Name##_pae16 a_Params; \
718 a_RetType a_Name##_pae16_32 a_Params; \
719 a_RetType a_Name##_pae16_v86 a_Params; \
720 a_RetType a_Name##_pae32 a_Params; \
721 a_RetType a_Name##_pae32_16 a_Params; \
722 a_RetType a_Name##_paev86 a_Params; \
723 a_RetType a_Name##_lm16 a_Params; \
724 a_RetType a_Name##_lm32 a_Params; \
725 a_RetType a_Name##_lm64 a_Params; \
726 a_RetType a_Name##_rm_far a_Params; \
727 a_RetType a_Name##_pe16_far a_Params; \
728 a_RetType a_Name##_pe16_v86_far a_Params; \
729 a_RetType a_Name##_pe32_16_far a_Params; \
730 a_RetType a_Name##_pev86_far a_Params; \
731 a_RetType a_Name##_pp16_far a_Params; \
732 a_RetType a_Name##_pp16_v86_far a_Params; \
733 a_RetType a_Name##_pp32_16_far a_Params; \
734 a_RetType a_Name##_ppv86_far a_Params; \
735 a_RetType a_Name##_pae16_far a_Params; \
736 a_RetType a_Name##_pae16_v86_far a_Params; \
737 a_RetType a_Name##_pae32_16_far a_Params; \
738 a_RetType a_Name##_paev86_far a_Params; \
739 a_RetType a_Name##_lm16_far a_Params
740#define BS3_MODE_EXPAND_EXTERN_DATA16(a_VarType, a_VarName, a_Suffix) \
741 extern a_VarType a_VarName##_rm a_Suffix; \
742 extern a_VarType a_VarName##_pe16 a_Suffix; \
743 extern a_VarType a_VarName##_pe16_32 a_Suffix; \
744 extern a_VarType a_VarName##_pe16_v86 a_Suffix; \
745 extern a_VarType a_VarName##_pe32 a_Suffix; \
746 extern a_VarType a_VarName##_pe32_16 a_Suffix; \
747 extern a_VarType a_VarName##_pev86 a_Suffix; \
748 extern a_VarType a_VarName##_pp16 a_Suffix; \
749 extern a_VarType a_VarName##_pp16_32 a_Suffix; \
750 extern a_VarType a_VarName##_pp16_v86 a_Suffix; \
751 extern a_VarType a_VarName##_pp32 a_Suffix; \
752 extern a_VarType a_VarName##_pp32_16 a_Suffix; \
753 extern a_VarType a_VarName##_ppv86 a_Suffix; \
754 extern a_VarType a_VarName##_pae16 a_Suffix; \
755 extern a_VarType a_VarName##_pae16_32 a_Suffix; \
756 extern a_VarType a_VarName##_pae16_v86 a_Suffix; \
757 extern a_VarType a_VarName##_pae32 a_Suffix; \
758 extern a_VarType a_VarName##_pae32_16 a_Suffix; \
759 extern a_VarType a_VarName##_paev86 a_Suffix; \
760 extern a_VarType a_VarName##_lm16 a_Suffix; \
761 extern a_VarType a_VarName##_lm32 a_Suffix; \
762 extern a_VarType a_VarName##_lm64 a_Suffix
763
764EOF
765
766 MY_HDR_FILES=` echo ${MY_ROOT_DIR}/include/VBox/*.h ${MY_ROOT_DIR}/include/VBox/vmm/*.h \
767 | ${MY_SED} -e 's,${MY_ROOT_DIR}/include/VBox/err.h,,' `
768 MY_HDR_FILES="${MY_HDR_FILES} ${MY_ROOT_DIR}/include/iprt/cdefs.h"
769 ${MY_SED} \
770 -e '/__cdecl/d' \
771 -e '/^ *# *define.*DECL/!d' \
772 -e '/DECLS/d' \
773 -e '/DECLINED/d' \
774 -e '/DECLARE_CLS_/d' \
775 -e '/_SRC_POS_DECL/d' \
776 -e '/declspec/d' \
777 -e '/__attribute__/d' \
778 -e 's/# */#/g' \
779 -e 's/ */ /g' \
780 -e '/ DECLEXPORT_CLASS/d' \
781 -e 's/ *VBOXCALL//' \
782 -e 's/ *RTCALL//' \
783 -e '/define *DECLASM(/d' \
784 -e '/define *DECL..CALLBACKMEMBER([^)]*) *RT/d' \
785 -e '/define *DECLINLINE(/d' \
786 -e '/define *DECL_INLINE_THROW(/d' \
787 -e '/define *DECL_FORCE_INLINE(/d' \
788 -e '/define *DECL_FORCE_INLINE_THROW(/d' \
789 -e '/define *DECLCALLBACK(/d' \
790 -e '/define *DECLCALLBACKMEMBER(/d' \
791 -e '/define *DECLCALLBACKMEMBER_EX(/d' \
792 -e '/define *DECLR[03CG]CALLBACKMEMBER(/d' \
793 -e '/define *DECLCALLBACKPTR(/d' \
794 -e '/define *DECLCALLBACKPTR_EX(/d' \
795 -e '/define *DECLCALLBACKTYPE(/d' \
796 -e '/define *DECLCALLBACKTYPE_EX(/d' \
797 -e '/define *DECLEXPORT(/d' \
798 -e '/define *DECL_EXPORT_THROW(/d' \
799 -e '/define *DECLHIDDEN(/d' \
800 -e '/define *DECL_HIDDEN_CALLBACK(/d' \
801 -e '/define *DECL_HIDDEN_NOTHROW(/d' \
802 -e '/define *DECL_HIDDEN_THROW(/d' \
803 -e '/define *DECLIMPORT(/d' \
804 -e '/define *DECL_IMPORT_NOTHROW(/d' \
805 -e '/ DECL_INVALID(/d' \
806 \
807 -e 's/(\([a-zA-Z_]*\)) DECL_NOTHROW(\1)/(\1) \1/' \
808 -e 's/(\([a-zA-Z_]*\)) DECLHIDDEN(DECL_NOTHROW(\1))/(\1) \1/' \
809 -e 's/(\([a-zA-Z_]*\)) DECLHIDDEN(\1)/(\1) \1/' \
810 -e 's/(\([a-zA-Z_]*\)) DECLEXPORT(\([a-zA-Z_]*\))/(\1) \1/' \
811 -e 's/(\([a-zA-Z_]*\)) DECLIMPORT(\([a-zA-Z_]*\))/(\1) \1/' \
812 -e 's/(\([a-zA-Z_]*\)) DECL_HIDDEN_NOTHROW(\([a-zA-Z_]*\))/(\1) \1/' \
813 -e 's/(\([a-zA-Z_]*\)) DECL_EXPORT_NOTHROW(\([a-zA-Z_]*\))/(\1) \1/' \
814 -e 's/(\([a-zA-Z_]*\)) DECL_IMPORT_NOTHROW(\([a-zA-Z_]*\))/(\1) \1/' \
815 \
816 --append "${MY_FILE}" \
817 ${MY_HDR_FILES}
818
819 ${MY_CAT} "${MY_FILE}" \
820 | ${MY_SED} -e 's/_/\x1F/g' -e 's/(/\x1E/g' -e 's/[[:space:]][[:space:]]*/\x1C/g' \
821 | ${MY_SED} -e 's/\x1F/_/g' -e 's/\x1E/(/g' -e 's/\x1C/ /g' \
822 | ${MY_SORT} \
823 | ${MY_SED} -e '/#define/s/$/ \/\/ vbox/' --output "${MY_FILE}.2"
824
825 # Eliminate duplicates.
826 > "${MY_FILE}.3"
827 exec < "${MY_FILE}.2"
828 MY_PREV_DEFINE=""
829 while read MY_LINE;
830 do
831 MY_DEFINE=`echo "${MY_LINE}" | ${MY_SED} -e 's/^#define \([^ ()]*\).*$/\1/' `
832 if test "${MY_DEFINE}" != "${MY_PREV_DEFINE}"; then
833 MY_PREV_DEFINE=${MY_DEFINE}
834 echo "${MY_LINE}" >> "${MY_FILE}.3"
835 fi
836 done
837
838 # Append non-vbox bits from the current user config.
839 if test -n "${MY_USERCPP_H_FULL}" -a -f "${MY_USERCPP_H_FULL}"; then
840 ${MY_SED} -e '/ \/\/ vbox$/d' -e '/^[[:space:]]*$/d' --append "${MY_FILE}.3" "${MY_USERCPP_H_FULL}"
841 fi
842
843 # Finalize the file (sort + blank lines).
844 ${MY_CAT} "${MY_FILE}.3" \
845 | ${MY_SED} -e 's/$/\n/' --output "${MY_FILE}"
846 ${MY_RM} -f "${MY_FILE}.2" "${MY_FILE}.3"
847
848 # Install it.
849 if test -n "${MY_USERCPP_H_FULL}" -a -d "${MY_SLICKDIR}"; then
850 if test -f "${MY_USERCPP_H_FULL}"; then
851 ${MY_MV} -vf "${MY_USERCPP_H_FULL}" "${MY_USERCPP_H_FULL}.bak"
852 ${MY_CP} "${MY_FILE}" "${MY_USERCPP_H_FULL}"
853 echo "Updated the SlickEdit preprocessor file. (Previous version renamed to .bak.)"
854 else
855 ${MY_CP} "${MY_FILE}" "${MY_USERCPP_H_FULL}"
856 echo "Created the SlickEdit preprocessor file."
857 fi
858 fi
859}
860
861###### end of functions ####
862
863
864#
865# Parse arguments.
866#
867while test $# -ge 1;
868do
869 ARG=$1
870 shift
871 case "$ARG" in
872
873 --rootdir)
874 if test $# -eq 0; then
875 echo "error: missing --rootdir argument." 1>&2
876 exit 1;
877 fi
878 MY_ROOT_DIR="$1"
879 shift
880 ;;
881
882 --outdir)
883 if test $# -eq 0; then
884 echo "error: missing --outdir argument." 1>&2
885 exit 1;
886 fi
887 MY_OUT_DIR="$1"
888 shift
889 ;;
890
891 --project-base)
892 if test $# -eq 0; then
893 echo "error: missing --project-base argument." 1>&2
894 exit 1;
895 fi
896 MY_PRJ_PRF="$1"
897 shift
898 ;;
899
900 --workspace)
901 if test $# -eq 0; then
902 echo "error: missing --workspace argument." 1>&2
903 exit 1;
904 fi
905 MY_WS_NAME="$1"
906 shift
907 ;;
908
909 --windows-host)
910 MY_WINDOWS_HOST=1
911 ;;
912
913 --minimal)
914 MY_OPT_MINIMAL=1
915 ;;
916
917 --slickedit-config)
918 MY_SLICK_CONFIG="$1"
919 shift
920 ;;
921
922 --only-usercpp)
923 MY_OPT_ONLY_USERCPP=1
924 ;;
925
926 # usage
927 --h*|-h*|-?|--?)
928 echo "usage: $0 [--rootdir <rootdir>] [--outdir <outdir>] [--project-base <prefix>] [--workspace <name>] [--minimal] [--slickedit-config <DIR>]"
929 echo ""
930 echo "If --outdir is specified, you must specify a --rootdir relative to it as well."
931 exit 1;
932 ;;
933
934 # default
935 *)
936 echo "error: Invalid parameter '$ARG'" 1>&2
937 exit 1;
938
939 esac
940done
941
942
943#
944# From now on everything *MUST* succeed.
945#
946set -e
947
948#
949# Make sure the output directory exists, is valid and clean.
950#
951if test -z "${MY_OPT_ONLY_USERCPP}"; then
952 ${MY_RM} -f \
953 "${MY_OUT_DIR}/${MY_PRJ_PRF}"*.vpj \
954 "${MY_OUT_DIR}/${MY_WS_NAME}" \
955 "${MY_OUT_DIR}/`echo ${MY_WS_NAME} | ${MY_SED} -e 's/\.vpw$/.vtg/'`"
956fi
957${MY_MKDIR} -p "${MY_OUT_DIR}"
958cd "${MY_OUT_DIR}"
959
960
961#
962# Determine the invocation to conjure up kmk.
963#
964my_abs_dir "tools"
965if test -n "${MY_WINDOWS_HOST}"; then
966 MY_KMK_INVOCATION="cscript.exe /Nologo ${MY_ABS_DIR}/envSub.vbs --quiet -- kmk.exe"
967else
968 MY_KMK_INVOCATION="/usr/bin/env LANG=C ${MY_ABS_DIR}/env.sh --quiet --no-wine kmk"
969fi
970
971
972#
973# Generate the projects (common code) and workspace.
974#
975if test -z "${MY_OPT_ONLY_USERCPP}"; then
976 my_generate_all_projects # in common-gen-workspace-projects.inc.sh
977 my_generate_workspace
978fi
979
980#
981# Update the history file if present.
982#
983if test -z "${MY_OPT_ONLY_USERCPP}"; then
984 MY_FILE="${MY_WS_NAME}histu"
985 if test -f "${MY_FILE}"; then
986 echo "Updating ${MY_FILE}..."
987 ${MY_MV} -f "${MY_FILE}" "${MY_FILE}.old"
988 ${MY_SED} -n \
989 -e '/PROJECT_CACHE/d' \
990 -e '/\[TreeExpansion2\]/d' \
991 -e '/^\[/p' \
992 -e '/: /p' \
993 -e '/^CurrentProject/p' \
994 "${MY_FILE}.old" > "${MY_FILE}"
995 fi
996fi
997
998#
999# Generate and update the usercpp.h/unxcpp.h file.
1000#
1001my_generate_usercpp_h
1002
1003
1004echo "done"
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette