forked from microsoft/TSS.MSR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeGenBase.cs
639 lines (552 loc) · 26.7 KB
/
CodeGenBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See the LICENSE file in the project root for full license information.
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace CodeGen
{
/// <summary> Target language independent base class for code generators </summary>
public abstract class CodeGenBase
{
protected string RootDir;
string AutogenBeginTag = null;
// Code is built in TpmDefs, and then merged/written out when complete
protected StringBuilder GeneratedCode = new StringBuilder();
Dictionary<string, List<string>> Snips = new Dictionary<string, List<string>>();
public static string eol => "\n";
public static string This => TargetLang.This;
public static string ThisMember => TargetLang.ThisMember;
public static readonly string[] ForceJustOneReturnParm = new string[] { "Load", "LoadExternal" };
protected CodeGenBase(string rootDir, string snipsFileName = null)
{
RootDir = rootDir;
// Load snippets - custom additions (usually helper methods) to the TPM types
if (snipsFileName != null)
LoadSnips(rootDir + snipsFileName);
}
internal abstract void Generate();
static void AddBitfieldElt(List<TpmNamedConstant> elements, string name, int val,
string comment = null, string oldStyleName = null, bool custom = false)
{
// Comment is null only for custom enumerators "XXX_BIT_OFFSET" and "XXX_BIT_LENGTH"
var nc = new TpmNamedConstant(null, custom ? null : name, null, comment);
nc.Name = name;
nc.Value = comment == null ? val.ToString() : ToHex(val);
nc.OldStyleName = oldStyleName ?? name;
elements.Add(nc);
}
public static List<TpmNamedConstant> GetBifieldElements(TpmBitfield bf)
{
var elements = new List<TpmNamedConstant>();
foreach (var b in bf.Elements)
{
if (b.StartBit == b.EndBit)
{
AddBitfieldElt(elements, b.TranslatedName, 1 << b.StartBit, b.Comment, b.OldStyleName);
}
else // multibit members of a bitfield
{
string typeName = b.Name;
if (TpmTypes.Contains(typeName))
{
// Type typeName defines allowed values for this multi-bit field
var e = TpmTypes.Lookup(typeName) as TpmEnum;
if (e != null)
{
foreach (var v in e.Members)
{
AddBitfieldElt(elements, v.Name, v.NumericValue << b.EndBit, v.Comment);
}
}
}
// Multi-bit bitfield 'name' is additionally represented by several enumerators:
// name_BIT_MASK - bit mask selecting all bits of the field
// name_BIT_OFFSET - offset of the field's low order bit
// name_BIT_LENGTH - number of bits in the field
string nameBase = b.Name.Contains("_") ? TargetLang.NameToDotNet(b.Name) : b.Name;
int len = b.StartBit - b.EndBit + 1;
var suff = TargetLang.DotNet ? new string[] { "BitMask", "BitOffset", "BitLength" }
: new string[] { "_BIT_MASK" , "_BIT_OFFSET", "_BIT_LENGTH" };
AddBitfieldElt(elements, nameBase + suff[0], ((1 << len) - 1) << b.EndBit, b.Comment, null, true);
AddBitfieldElt(elements, nameBase + suff[1], b.EndBit, null, null, true);
AddBitfieldElt(elements, nameBase + suff[2], len, null, null, true);
if (TargetLang.DotNet && bf.Name == "LocalityAttr")
{
// For backward compatibility
for (int i = 0; i < len; ++i)
AddBitfieldElt(elements, $"{nameBase}Bit{i}", 1 << (b.EndBit + i), "", null, true);
}
} // multibit members of a bitfield
}
return elements;
}
public static List<string> GetToTpmFieldsMarshalOps(StructField[] fields)
{
var marshalOps = new List<string>();
foreach (StructField f in fields)
{
int size = f.Type.GetSize();
string fieldName = ThisMember + f.Name;
switch (f.MarshalType)
{
case MarshalType.Normal:
if (f.IsValueType())
marshalOps.Add($"buf.write{WireNameForInt(size)}({fieldName})");
else
marshalOps.Add($"{fieldName}.toTpm(buf)");
if (f.Attrs.HasFlag(StructFieldAttr.TermOnNull))
marshalOps.Add(TargetLang.If($"{fieldName} == {TpmTypes.AlgNull}") + " return");
break;
case MarshalType.ConstantValue:
marshalOps.Add($"buf.write{WireNameForInt(size)}({ConstTag(f)})");
break;
case MarshalType.SizedStruct:
Debug.Assert(f.SizeTagField != null);
marshalOps.Add($"buf.writeSizedObj({fieldName})");
break;
case MarshalType.EncryptedVariableLengthArray:
case MarshalType.SpecialVariableLengthArray:
// TPMT_HA size is tagged by its hash alg (the first field)
marshalOps.Add($"buf.writeByteBuf({fieldName})");
break;
case MarshalType.VariableLengthArray:
var sizeTagLen = f.SizeTagField.Type.GetSize();
if (f.IsByteBuffer())
marshalOps.Add($"buf.writeSizedByteBuf({fieldName}" + (sizeTagLen == 2 ? ")" : $", {sizeTagLen})"));
else if (f.IsValueType())
marshalOps.Add($"buf.writeValArr({fieldName}, {size})");
else
marshalOps.Add($"buf.writeObjArr({fieldName})");
break;
case MarshalType.UnionSelector:
// A trick to allow using default-constructed TPMT_SENSITIVE as an empty (non-marshaling) object
string unionField = ThisMember + f.RelatedUnion.Name;
if (f == fields.First())
marshalOps.Add(TargetLang.If($"{unionField} == {TargetLang.Null}") + " return");
marshalOps.Add($"buf.write{WireNameForInt(size)}({unionField}{TargetLang.Member}GetUnionSelector())");
break;
case MarshalType.UnionObject:
marshalOps.Add($"{fieldName}{TargetLang.Member}toTpm(buf)");
break;
default:
Debug.Assert(false);
break;
}
}
return marshalOps;
} // GetToTpmFieldsMarshalOps()
public static List<string> GetFromTpmFieldsMarshalOps(StructField[] fields)
{
var marshalOps = new List<string>();
foreach (StructField f in fields)
{
int size = f.Type.GetSize();
string fieldName = ThisMember + f.Name;
switch (f.MarshalType)
{
case MarshalType.Normal:
if (f.IsValueType())
marshalOps.Add($"{fieldName} = buf.read{WireNameForInt(size)}()");
else
marshalOps.Add(TargetLang.Cpp ? $"{fieldName}.initFromTpm(buf)"
: $"{fieldName} = {f.TypeName}.fromTpm(buf)");
if (f.Attrs.HasFlag(StructFieldAttr.TermOnNull))
marshalOps.Add(TargetLang.If($"{fieldName} == {TpmTypes.AlgNull}") + " return");
break;
case MarshalType.ConstantValue:
// TODO: Add assertion by comparing with the expected constant
marshalOps.Add($"buf.read{WireNameForInt(size)}()");
break;
case MarshalType.SizedStruct:
Debug.Assert(f.SizeTagField != null);
marshalOps.Add(TargetLang.Cpp ? $"buf.readSizedObj({fieldName})"
: $"{fieldName} = buf.createSizedObj({TargetLang.TypeInfo(f.TypeName)})");
break;
case MarshalType.EncryptedVariableLengthArray:
marshalOps.Add($"{fieldName} = buf.readByteBuf(buf.getCurStuctRemainingSize())");
break;
case MarshalType.SpecialVariableLengthArray:
// TPMT_HA size is inferred from the hash algorithm
Debug.Assert(f.IsByteBuffer() && f.SizeTagField.Type.GetSize() == 2);
marshalOps.Add($"{fieldName} = buf.readByteBuf({TargetLang.DigestSize(f.SizeTagField.Name)})");
break;
case MarshalType.VariableLengthArray:
var sizeTagLen = f.SizeTagField.Type.GetSize();
if (f.IsByteBuffer())
marshalOps.Add($"{fieldName} = buf.readSizedByteBuf(" + (sizeTagLen == 2 ? ")" : $"{sizeTagLen})"));
else if (f.IsValueType())
marshalOps.Add(TargetLang.Cpp ? $"buf.readValArr({fieldName}, {f.Type.GetSize()})"
: $"{fieldName} = buf.readValArr({f.Type.GetSize()})");
else
marshalOps.Add(TargetLang.Cpp ? $"buf.readObjArr({fieldName})"
: $"{fieldName} = buf.readObjArr({TargetLang.TypeInfo(f.TypeName.TrimEnd('[', ']'))})");
break;
case MarshalType.UnionSelector:
var localVar = TargetLang.LocalVar(f.Name, f.TypeName);
marshalOps.Add($"{localVar} = " +
(f.IsValueType() ? $"buf.read{WireNameForInt(size)}()" : $"{f.TypeName}.fromTpm(buf)"));
break;
case MarshalType.UnionObject:
var selector = (f as UnionField).UnionSelector.Name;
marshalOps.Add(TargetLang.Cpp ? $"UnionFactory::Create({fieldName}, {selector})"
: $"{fieldName} = UnionFactory.create({TargetLang.Quote(f.TypeName)}, {selector})");
marshalOps.Add($"{fieldName}{TargetLang.Member}initFromTpm(buf)");
break;
default:
break;
}
}
return marshalOps;
} // GetFromTpmFieldsMarshalOps()
void AddSnip(string type, List<string> snipLines)
{
if (snipLines.Count == 0)
return;
// trim trailing empty lines
for (int i = snipLines.Count - 1; i > 0 && snipLines[i] == ""; --i)
{
snipLines.RemoveAt(i);
}
if (snipLines.Count() != 0)
Snips.Add(type, snipLines);
}
/// <summary>
/// The file snipsPath contains snippets of code to be added to the auto-generated types
/// </summary>
internal void LoadSnips(string snipsPath)
{
var lines = File.ReadAllLines(snipsPath);
string curType = "";
List<string> snipLines = new List<string>();
foreach (string line in lines)
{
if (line.StartsWith(">>"))
{
AddSnip(curType, snipLines);
snipLines = new List<string>();
var bits = line.Split(new char[] { ' ' });
curType = bits[bits.Length - 1];
if (Snips.ContainsKey(curType))
throw new Exception("Only one snips-section per-type");
continue;
}
snipLines.Add(line);
}
AddSnip(curType, snipLines);
}
protected void InsertSnip(string typeName)
{
// Insert the custom snippets if there are any
if (!Snips.ContainsKey(typeName))
return;
Write("");
var snip = Snips[typeName];
foreach (var l in snip)
Write(l);
}
internal void UpdateExistingSource(string fileName)
{
var filePath = RootDir + fileName;
// First, make sure that the source files to be updated by the code generator
// both are writable and have the correct format.
FileAttributes attr = File.GetAttributes(filePath);
if (attr.HasFlag(FileAttributes.ReadOnly))
{
Console.WriteLine($"File '{fileName}' must be writable.");
return;
}
string commentToken = TargetLang.LineComment;
string autogenTag = $"{commentToken} <<AUTOGEN_BEGIN>>";
string existingCode = File.ReadAllText(filePath);
int autogenStart = existingCode.IndexOf(autogenTag);
if (autogenStart == -1)
{
Console.WriteLine($"File '{fileName}' must begin with a warning about autogenerated code and '{autogenTag}' comment.");
return;
}
autogenStart = existingCode.IndexOf(autogenTag, autogenStart + autogenTag.Length);
if (autogenStart == -1)
{
Console.WriteLine($"File '{fileName}' must contain the '{autogenTag}' marker.");
return;
}
string generatedCode = GeneratedCode.ToString();
GeneratedCode.Clear();
if (AutogenBeginTag == null)
{
Write(autogenTag);
Write($"{commentToken} ------------------------------------------------------------------------------------------------");
Write($"{commentToken} DO NOT REMOVE the <<AUTOGEN_BEGIN>> comment!");
Write($"{commentToken} DO NOT MODIFY any code below this point - all manual changes will be lost!");
Write($"{commentToken} ------------------------------------------------------------------------------------------------");
Write("");
AutogenBeginTag = GeneratedCode.ToString();
GeneratedCode.Clear();
}
File.WriteAllText(filePath, existingCode.Substring(0, autogenStart) + AutogenBeginTag + generatedCode);
}
internal static string GetCommandName(TpmStruct req)
{
return req.SpecName.Replace("TPM2_", "").Replace("_REQUEST", "");
}
internal static TpmStruct GetRespStruct(TpmStruct req)
{
return (TpmStruct)TpmTypes.Lookup(req.SpecName.Replace("_REQUEST", "Response").Substring(5));
}
internal static string Separator<T>(T elem, IEnumerable<T> list, string sep = ",", string term = "")
{
return Object.ReferenceEquals(list.Last(), elem) ? term : sep;
}
internal static string ToHex(int value)
{
return "0x" + Convert.ToString(value, 16).ToUpper();
}
internal static string ToHex(uint value) { return ToHex((int)value); }
internal static string WireNameForInt(int size)
{
switch(size){
case 1: return "Byte";
case 2: return "Short";
case 4: return "Int";
case 8: return "Int64";
}
Debug.Assert("WireNameForInt(): unsupported size" == null);
return null;
}
internal static string ConstTag(StructField f)
{
string rawName = f.Domain[0, Constraint.Type.Single].Expr;
return TpmTypes.LookupConstant(rawName).QualifiedName;
}
protected string NsQualifiedType(StructField f, string nameSpace)
{
return (f.Type.IsElementary() ? "" : nameSpace) + f.TypeName;
}
/// <param name="unionField"> Name of the filed of a union interface type associated with the returned tag </param>
/// <returns> Name of the union selector (tag) fieled or null </returns>
public static string GetUnionSelectorFieldInfo(TpmStruct s, out string unionField)
{
unionField = null;
var selectors = s.Fields.Where(f => f.MarshalType == MarshalType.UnionSelector);
if (selectors.Count() == 0)
return null;
// If a struct is a member of multiple unions, all of them are expected to use the same selector value
unionField = selectors.First().Name;
return selectors.First().RelatedUnion.Name;
}
/// <param name="selVal"> Upon return set to the value (qualified enum memeber) of the selector (or null). </param>
/// <returns> Union selector type name if 's' is a member of a tagged union. Otherwise null. </returns>
public static string GetUnionSelectorType(TpmUnion u)
{
return u.Members[0].SelectorValue.EnclosingEnum.Name;
}
/// <param name="selVal"> Upon return set to the value (qualified enum memeber) of the selector (or null). </param>
/// <returns> Union selector type name if 's' is a member of a tagged union. Otherwise null. </returns>
public static string GetUnionMemberSelectorInfo(TpmStruct s, out string selVal)
{
selVal = null;
if (s.IsCmdStruct() || s.ContainingUnions.Count == 0)
return null;
// If a struct is a member of multiple unions, all of them are expected to use the same selector value
TpmUnion u = s.ContainingUnions.ElementAt(0);
selVal = s.SpecName == TpmTypes.EmptyUnionBaseName ? TpmTypes.AlgNull
: u.GetMemberOfType(s).SelectorValue.QualifiedName;
return GetUnionSelectorType(u);
}
public static string GetUnionChoicesList(TpmType t)
{
if (!(t is TpmUnion))
return "";
var uniqueFields = (t as TpmUnion).Members.Distinct().ToList();
string unionList = string.Join(", ", uniqueFields.ConvertAll(f => f.Type.Name).Distinct());
return $"One of: {unionList}.";
}
public static string AsSummary(string comment)
{
return string.IsNullOrEmpty(comment) ? comment
: (TargetLang.Cpp || TargetLang.DotNet)
? "<summary> " + comment + " </summary>" : comment;
}
public static string AsRemark(string comment)
{
if (comment == "")
return comment;
return eol + (TargetLang.Cpp || TargetLang.DotNet
? "<remarks> " + comment + " </remarks>" : comment);
}
// Javadoc does not allow empty comments for @param and similar tags
public static string MandatoryComment(string comment)
{
return string.IsNullOrWhiteSpace(comment) ? "TBD" : comment;
}
public static string GetParamComment(StructField f, string prefix = "", string indent = " ")
{
string beg = TargetLang.DotNet || TargetLang.Cpp ? "<param name = \""
: TargetLang.Java || TargetLang.Node ? "@param " : "";
string med = TargetLang.DotNet || TargetLang.Cpp ? "\"> "
: TargetLang.Java || TargetLang.Node ? " " : ": ";
string end = TargetLang.DotNet || TargetLang.Cpp ? " </param>"
: TargetLang.Java || TargetLang.Node ? "" : "";
string unionList = GetUnionChoicesList(f.Type);
string comment = f.Comment + (unionList == "" ? "" : eol + unionList);
string fieldType = TargetLang.Py ? $" ({f.TypeName})" : "";
return Helpers.WrapText(beg + prefix + f.Name + fieldType + med + MandatoryComment(comment) + end, indent);
}
public static string GetReturnComment(StructField[] respFields)
{
string beg = TargetLang.DotNet || TargetLang.Cpp ? "<returns> "
: TargetLang.Java || TargetLang.Node ? "@return " : " ";
string end = TargetLang.DotNet || TargetLang.Cpp ? " </returns>"
: TargetLang.Java || TargetLang.Node ? "" : "";
string lbr = (TargetLang.Java || TargetLang.Node ? "<br>" : "") + "\n";
string nlp = new string(' ', beg.Length);
if (respFields.Length == 0)
return "";
string comment = "";
string returnComment = respFields[0].Comment;
if (returnComment == "")
returnComment = respFields[0].Type.Comment;
string intro = $"{beg}{respFields[0].Name} - ",
indent = new string(' ', intro.Length);
comment += Helpers.WrapText(intro + MandatoryComment(returnComment), indent);
for (int i = 1; i < respFields.Length; ++i)
{
intro = $"{nlp}{respFields[i].Name} - ";
indent = new string(' ', intro.Length);
comment += lbr + Helpers.WrapText(intro + MandatoryComment(respFields[i].Comment), indent);
}
return comment + end;
}
/// <summary> Writes multi- or single-line comment for a class, method, or field (depending
/// on the new line characters presence. </summary>
/// <remarks> Add '\n' to the beginning of `end` to make it go on a separate line. </remarks>
protected void WriteComment(string comment, string beg, string mid, string end = "", bool wrap = true)
{
// Unconditionally insert an empty line in the case of DotNet, as even if the comment is empty,
// the commented field or enumerator will be prepended with one or more attribute clauses
// that need separation.
if (TargetLang.DotNet)
Write("");
if (string.IsNullOrWhiteSpace(comment))
return;
// Prepend the comment with an empty line, unless it's python
if (!TargetLang.Py)
Write("");
bool inlineEnd = end == "" || end[0] != '\n';
comment = comment.TrimEnd(new char[] { ' ', '\n' }).Replace("\r", "");
comment = beg + comment + (inlineEnd ? end : "");
if (wrap)
comment = Helpers.WrapText(comment, mid);
else
comment = comment.Replace("\n", "\n" + mid);
if (!inlineEnd)
{
if (!comment.Contains('\n'))
{
if (end.StartsWith("\n"))
end = end.Substring(1);
end = " " + end.TrimStart(' ');
}
comment += end;
}
var lines = comment.Split(new char[] {'\n'});
for (int i = 0; i < lines.Length; ++i)
Write(lines[i]);
CommentWritten = true;
}
protected abstract void WriteComment(string comment, bool wrap = true);
private void WriteComment(string comment, TpmType t)
{
WriteComment(AsSummary(comment) + AsRemark(GetUnionChoicesList(t)));
}
protected void WriteComment(TpmType t)
{
WriteComment(t.Comment, t);
}
protected void WriteComment(TpmField f)
{
WriteComment(f.Comment, f.Type);
}
protected void WriteComment(TpmNamedConstant nc)
{
WriteComment(AsSummary(nc.Comment));
}
protected bool NewLine = true,
EmptyLineWritten = false,
CommentWritten = false;
protected const int SpacesPerTab = 4;
protected int IndentLevel;
protected string CurIndent()
{
return new string(' ', IndentLevel * SpacesPerTab);
}
protected void Write(string str, bool newLine = true)
{
if (newLine && str == "")
{
if (EmptyLineWritten)
{
// No double empty lines in the output
Debug.Assert(NewLine);
}
else
{
GeneratedCode.AppendLine();
EmptyLineWritten = NewLine = true;
}
return;
}
if (TargetLang.Java && str.StartsWith("@") && !EmptyLineWritten && !CommentWritten)
{
GeneratedCode.AppendLine();
NewLine = true;
}
string curIndent = CurIndent(),
indent = NewLine ? curIndent : "";
var lines = str.Replace("\r", "").Split(new char[] {'\n'});
for (int i = 0; i < lines.Length; ++i)
{
GeneratedCode.Append(indent + lines[i]);
indent = "\r\n" + curIndent;
}
if (newLine)
GeneratedCode.AppendLine();
EmptyLineWritten = (NewLine && str == "")
|| (newLine && str.EndsWith(eol));
NewLine = newLine || str.EndsWith(eol);
CommentWritten = false;
}
protected void WriteLine(string fmt, params object[] args)
{
Write(string.Format(fmt, args), true);
}
protected void TabIn()
{
EmptyLineWritten = true;
IndentLevel++;
}
protected void TabOut()
{
IndentLevel--;
}
protected void TabIn(string openingToken)
{
if (!NewLine)
Write("");
Write(openingToken);
TabIn();
}
protected void TabOut(string closingToken, bool extraNewLine = true)
{
TabOut();
Write(closingToken);
if (extraNewLine && closingToken.StartsWith(TargetLang.Py ? "#" : "}"))
Write("");
}
} // class CodeGenBase
}