Populated Bestine Capitol Building with missing NPCs. Also spawns several other missi...
[swg-src.git] / tools / BuildIncludeHeaderFiles.btm
blob62d0a5e471f6d5fb4620dfd83f13220b5ebcb745
1 @echo off
3 set includesub=%@word["\",-0,%@lfn[.]]
5 if NOT ISDIR include mkdir include
6 if NOT ISDIR include\public mkdir include\public
7 if NOT ISDIR include\private mkdir include\private
8 if NOT ISDIR include\public\%includesub mkdir include\public\%includesub
9 if NOT ISDIR include\private\%includesub mkdir include\private\%includesub
10 del /e /y /q include\public\%includesub
11 del /e /y /q include\private\%includesub
13 dir /sbfa:-d src\shared\*.h src\shared\*.def > shared.txt
14 for %header in (@shared.txt) gosub header
16 dir /sbfa:-d src\win32\*.h src\win32\*.def > win32.txt
17 for %header in (@win32.txt) gosub win32
19 dir /sbfa:-d src\linux\*.h src\linux\*.def > linux.txt
20 for %header in (@linux.txt) gosub linux
22 dir /sbfa:-a-d include\public\%dirname > platform.txt
23 dir /sbfa:-a-d include\private\%dirname >> platform.txt
24 for %header in (@platform.txt) gosub platform
26 del /q shared.txt
27 del /q win32.txt
28 del /q linux.txt
29 del /q platform.txt
31 quit 0
33 :setup
34 set filename=include\%export\%includesub\%@filename[%header]
35 set relative=%@replace[%@lfn[.]\,..\..\,%header]
36 set relative=%@replace[\,/,%relative]
37 return
39 :header
40 gosub export
41 gosub setup
42 echo #include "%relative" >> %filename
43 return
45 :win32
46 gosub export
47 gosub setup
48 echo #if defined(PLATFORM_WIN32) >> %filename
49 echo #include "%relative" >> %filename
50 attrib /q -a %filename
51 return
53 :linux
54 gosub export
55 gosub setup
56 set iftest=if
57 if EXIST %filename set iftest=elif
58 echo #%iftest defined(PLATFORM_LINUX) >> %filename
59 echo #include "%relative" >> %filename
60 attrib /q -a %filename
61 return
63 :platform
64 echo #else >> %header
65 echo #error unsupported platform >> %header
66 echo #endif >> %header
67 attrib /q +a %header
68 return
70 :export
71 set export=public
72 set exportHandle=%@fileopen[%header, read, t]
73 set exportRead="%@fileread[%exportHandle]"
74 if %@index[%exportRead,PRIVATE] != -1 set export=private
75 set exportClose=%@fileclose[%exportHandle]
76 return