Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit fe510cd

Browse files
committed
[[ ExternalsApiV5 ]] Added Windows project for lcidlc.
[[ ExternalsApiV5 ]] Tweaks to source encoding script to make the output a const char * array, to workaround 64K string limit in VC++
1 parent 02ac3de commit fe510cd

File tree

6 files changed

+337
-9
lines changed

6 files changed

+337
-9
lines changed

lcidlc/encode_source.rev

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ on generate
1919
local tInput, tOutput, tLength
2020
put url ("file:" & $1) into tInput
2121

22-
put "const char *" & $3 & " =" & return after tOutput
22+
put "const char *" & $3 & "[] =" & return after tOutput
23+
put "{" & return after tOutput
2324
repeat for each line tLine in tInput
2425
replace "\" with "\\" in tLine
2526
replace quote with "\" & quote in tLine
26-
put tab & quote & tLine & "\n" & quote & return after tOutput
27+
put tab & quote & tLine & "\n" & quote & comma & return after tOutput
2728
end repeat
29+
put tab & 0 & return after tOutput
30+
put "}" & return after tOutput
2831
put ";" & return after tOutput
2932

3033
put tOutput into url ("file:" & $2)

lcidlc/lcidlc.vcproj

Lines changed: 314 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,314 @@
1+
<?xml version="1.0" encoding="windows-1250"?>
2+
<VisualStudioProject
3+
ProjectType="Visual C++"
4+
Version="8.00"
5+
Name="lcidlc"
6+
ProjectGUID="{7321A225-FAC4-45D6-BAE4-B0E943102B7E}"
7+
RootNamespace="lcidlc"
8+
Keyword="Win32Proj"
9+
>
10+
<Platforms>
11+
<Platform
12+
Name="Win32"
13+
/>
14+
</Platforms>
15+
<ToolFiles>
16+
</ToolFiles>
17+
<Configurations>
18+
<Configuration
19+
Name="Debug|Win32"
20+
ConfigurationType="1"
21+
InheritedPropertySheets="..\rules\Global.vsprops;..\rules\Debug.vsprops"
22+
CharacterSet="1"
23+
>
24+
<Tool
25+
Name="VCPreBuildEventTool"
26+
/>
27+
<Tool
28+
Name="VCCustomBuildTool"
29+
/>
30+
<Tool
31+
Name="VCXMLDataGeneratorTool"
32+
/>
33+
<Tool
34+
Name="VCWebServiceProxyGeneratorTool"
35+
/>
36+
<Tool
37+
Name="VCMIDLTool"
38+
/>
39+
<Tool
40+
Name="VCCLCompilerTool"
41+
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
42+
MinimalRebuild="true"
43+
BasicRuntimeChecks="3"
44+
UsePrecompiledHeader="0"
45+
DebugInformationFormat="4"
46+
/>
47+
<Tool
48+
Name="VCManagedResourceCompilerTool"
49+
/>
50+
<Tool
51+
Name="VCResourceCompilerTool"
52+
/>
53+
<Tool
54+
Name="VCPreLinkEventTool"
55+
/>
56+
<Tool
57+
Name="VCLinkerTool"
58+
LinkIncremental="2"
59+
GenerateDebugInformation="true"
60+
SubSystem="1"
61+
TargetMachine="1"
62+
/>
63+
<Tool
64+
Name="VCALinkTool"
65+
/>
66+
<Tool
67+
Name="VCManifestTool"
68+
/>
69+
<Tool
70+
Name="VCXDCMakeTool"
71+
/>
72+
<Tool
73+
Name="VCBscMakeTool"
74+
/>
75+
<Tool
76+
Name="VCFxCopTool"
77+
/>
78+
<Tool
79+
Name="VCAppVerifierTool"
80+
/>
81+
<Tool
82+
Name="VCWebDeploymentTool"
83+
/>
84+
<Tool
85+
Name="VCPostBuildEventTool"
86+
/>
87+
</Configuration>
88+
<Configuration
89+
Name="Release|Win32"
90+
ConfigurationType="1"
91+
InheritedPropertySheets="..\rules\Global.vsprops;..\rules\Release.vsprops"
92+
CharacterSet="1"
93+
WholeProgramOptimization="1"
94+
>
95+
<Tool
96+
Name="VCPreBuildEventTool"
97+
/>
98+
<Tool
99+
Name="VCCustomBuildTool"
100+
/>
101+
<Tool
102+
Name="VCXMLDataGeneratorTool"
103+
/>
104+
<Tool
105+
Name="VCWebServiceProxyGeneratorTool"
106+
/>
107+
<Tool
108+
Name="VCMIDLTool"
109+
/>
110+
<Tool
111+
Name="VCCLCompilerTool"
112+
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
113+
UsePrecompiledHeader="0"
114+
DebugInformationFormat="3"
115+
/>
116+
<Tool
117+
Name="VCManagedResourceCompilerTool"
118+
/>
119+
<Tool
120+
Name="VCResourceCompilerTool"
121+
/>
122+
<Tool
123+
Name="VCPreLinkEventTool"
124+
/>
125+
<Tool
126+
Name="VCLinkerTool"
127+
LinkIncremental="1"
128+
GenerateDebugInformation="true"
129+
SubSystem="1"
130+
TargetMachine="1"
131+
/>
132+
<Tool
133+
Name="VCALinkTool"
134+
/>
135+
<Tool
136+
Name="VCManifestTool"
137+
/>
138+
<Tool
139+
Name="VCXDCMakeTool"
140+
/>
141+
<Tool
142+
Name="VCBscMakeTool"
143+
/>
144+
<Tool
145+
Name="VCFxCopTool"
146+
/>
147+
<Tool
148+
Name="VCAppVerifierTool"
149+
/>
150+
<Tool
151+
Name="VCWebDeploymentTool"
152+
/>
153+
<Tool
154+
Name="VCPostBuildEventTool"
155+
/>
156+
</Configuration>
157+
</Configurations>
158+
<References>
159+
<ProjectReference
160+
ReferencedProjectIdentifier="{6899CD7E-BE16-44CE-A28B-27304F42E127}"
161+
RelativePathToProject=".\libcore\libcore.vcproj"
162+
/>
163+
</References>
164+
<Files>
165+
<Filter
166+
Name="Source Files"
167+
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
168+
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
169+
>
170+
<File
171+
RelativePath=".\src\Error.cpp"
172+
>
173+
</File>
174+
<File
175+
RelativePath=".\src\Interface.cpp"
176+
>
177+
</File>
178+
<File
179+
RelativePath=".\src\InterfaceGenerate.cpp"
180+
>
181+
</File>
182+
<File
183+
RelativePath=".\src\Main.cpp"
184+
>
185+
</File>
186+
<File
187+
RelativePath=".\src\NativeType.cpp"
188+
>
189+
</File>
190+
<File
191+
RelativePath=".\src\Parser.cpp"
192+
>
193+
</File>
194+
<File
195+
RelativePath=".\src\Position.cpp"
196+
>
197+
</File>
198+
<File
199+
RelativePath=".\src\Scanner.cpp"
200+
>
201+
</File>
202+
<File
203+
RelativePath=".\src\Value.cpp"
204+
>
205+
</File>
206+
</Filter>
207+
<Filter
208+
Name="Header Files"
209+
Filter="h;hpp;hxx;hm;inl;inc;xsd"
210+
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
211+
>
212+
<File
213+
RelativePath=".\src\Error.h"
214+
>
215+
</File>
216+
<File
217+
RelativePath=".\src\Interface.h"
218+
>
219+
</File>
220+
<File
221+
RelativePath=".\src\InterfacePrivate.h"
222+
>
223+
</File>
224+
<File
225+
RelativePath=".\src\NativeType.h"
226+
>
227+
</File>
228+
<File
229+
RelativePath=".\src\Parser.h"
230+
>
231+
</File>
232+
<File
233+
RelativePath=".\src\Position.h"
234+
>
235+
</File>
236+
<File
237+
RelativePath=".\src\Scanner.h"
238+
>
239+
</File>
240+
<File
241+
RelativePath=".\src\Value.h"
242+
>
243+
</File>
244+
</Filter>
245+
<Filter
246+
Name="Resource Files"
247+
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
248+
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
249+
>
250+
</Filter>
251+
<Filter
252+
Name="Derived Source"
253+
>
254+
<File
255+
RelativePath=".\src\EncodedJavaSupport.c"
256+
>
257+
</File>
258+
<File
259+
RelativePath=".\src\EncodedSupport.c"
260+
>
261+
</File>
262+
</Filter>
263+
<File
264+
RelativePath=".\encode_source.rev"
265+
>
266+
</File>
267+
<File
268+
RelativePath=".\src\Support.java"
269+
>
270+
<FileConfiguration
271+
Name="Debug|Win32"
272+
>
273+
<Tool
274+
Name="VCCustomBuildTool"
275+
CommandLine="&quot;$(SolutionDir)prebuilt\bin\Revolution.exe&quot; &quot;$(ProjectDir)encode_source.rev&quot; &quot;$(InputPath)&quot; &quot;$(InputDir)EncodedJavaSupport.c&quot; &quot;g_java_support_template&quot;"
276+
Outputs="$(InputDir)EncodedJavaSupport.c"
277+
/>
278+
</FileConfiguration>
279+
<FileConfiguration
280+
Name="Release|Win32"
281+
>
282+
<Tool
283+
Name="VCCustomBuildTool"
284+
CommandLine="&quot;$(SolutionDir)prebuilt\bin\Revolution.exe&quot; &quot;$(ProjectDir)encode_source.rev&quot; &quot;$(InputPath)&quot; &quot;$(InputDir)EncodedJavaSupport.c&quot; &quot;g_java_support_template&quot;"
285+
Outputs="$(InputDir)EncodedJavaSupport.c"
286+
/>
287+
</FileConfiguration>
288+
</File>
289+
<File
290+
RelativePath=".\src\Support.mm"
291+
>
292+
<FileConfiguration
293+
Name="Debug|Win32"
294+
>
295+
<Tool
296+
Name="VCCustomBuildTool"
297+
CommandLine="&quot;$(SolutionDir)prebuilt\bin\Revolution.exe&quot; &quot;$(ProjectDir)encode_source.rev&quot; &quot;$(InputPath)&quot; &quot;$(InputDir)EncodedSupport.c&quot; &quot;g_support_template&quot;"
298+
Outputs="$(InputDir)EncodedSupport.c"
299+
/>
300+
</FileConfiguration>
301+
<FileConfiguration
302+
Name="Release|Win32"
303+
>
304+
<Tool
305+
Name="VCCustomBuildTool"
306+
CommandLine="&quot;$(SolutionDir)prebuilt\bin\Revolution.exe&quot; &quot;$(ProjectDir)encode_source.rev&quot; &quot;$(InputPath)&quot; &quot;$(InputDir)EncodedSupport.c&quot; &quot;g_support_template&quot;"
307+
Outputs="$(InputDir)EncodedSupport.c"
308+
/>
309+
</FileConfiguration>
310+
</File>
311+
</Files>
312+
<Globals>
313+
</Globals>
314+
</VisualStudioProject>

lcidlc/src/Interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ bool InterfaceBeginHandler(InterfaceRef self, Position p_where, HandlerType p_ty
346346
// RULE: Variants of handlers must all have the same type.
347347
if (t_handler != nil &&
348348
t_handler -> type != p_type &&
349-
t_handler -> is_java == (p_attr & kHandlerAttributeIsJava) != 0 &&
350-
t_handler -> is_tail == (p_attr & kHandlerAttributeIsTail) != 0)
349+
t_handler -> is_java == ((p_attr & kHandlerAttributeIsJava) != 0) &&
350+
t_handler -> is_tail == ((p_attr & kHandlerAttributeIsTail) != 0))
351351
InterfaceReport(self, p_where, kInterfaceErrorCannotMixHandlerTypes, p_name);
352352

353353
// RULE: Methods must specify 'java'.

lcidlc/src/InterfaceGenerate.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,15 @@ static const char *InterfaceGetReferenceSuffix(InterfaceRef self)
131131

132132
////////////////////////////////////////////////////////////////////////////////
133133

134-
extern const char *g_support_template;
134+
extern "C" const char *g_support_template[];
135135

136136
static bool InterfaceGenerateSupport(InterfaceRef self, CoderRef p_coder)
137137
{
138138
if (self -> use_cpp_exceptions)
139139
CoderWriteLine(p_coder, "#include <exception>");
140140

141-
CoderWrite(p_coder, "%s", g_support_template);
141+
for(int i = 0; g_support_template[i] != nil; i++)
142+
CoderWrite(p_coder, "%s", g_support_template[i]);
142143

143144
return true;
144145
}
@@ -1154,7 +1155,7 @@ static bool InterfaceGenerateExports(InterfaceRef self, CoderRef p_coder)
11541155

11551156
////////////////////////////////////////////////////////////////////////////////
11561157

1157-
extern const char *g_java_support_template;
1158+
extern "C" const char *g_java_support_template[];
11581159

11591160
/*static struct { const char *tag; void (*generator)(InterfaceRef self, CoderRef coder); } s_sections[] =
11601161
{
@@ -1165,7 +1166,7 @@ static bool InterfaceGenerateJava(InterfaceRef self, CoderRef p_coder)
11651166
{
11661167
CoderWriteLine(p_coder, "package %s;", NameGetCString(self -> qualified_name));
11671168

1168-
CoderWrite(p_coder, "%s", strchr(g_java_support_template, '\n') + 1);
1169+
// CoderWrite(p_coder, "%s", strchr(g_java_support_template, '\n') + 1);
11691170

11701171
return true;
11711172
}

0 commit comments

Comments
 (0)