-
Notifications
You must be signed in to change notification settings - Fork 75
training notes
twiglet edited this page Sep 14, 2010
·
1 revision
- When adding a translation for a static method that requires a support routine need to add to the translation to add an import to the support library. For example:
{code}
System.Int32
Compare
arg1
System.String
arg2
System.String
StringSupport.Compare(${arg1}, ${arg2})
RusticiSoftware.System.StringSupport
{code}
- Arguments to cs2j
{code}
if (args[i].ToLower().Equals(“-showtree”))
{
showTree = true;
}
else if (args[i].ToLower().Equals(“-showcsharp”))
{
showCSharp = true;
}
else if (args[i].ToLower().Equals(“-showjava”))
{
showJava = true;
}
else if (args[i].ToLower().Equals(“-showjavasyntax”))
{
showJavaSyntax = true;
}
else if (args[i].ToLower().Equals(“-tokens”))
{
displayTokens = true;
}
else if (args[i].ToLower().Equals(“-dumpxml”))
{
dumpXMLs = true;
}
else if (args[i].ToLower().Equals(“-v”))
{
verbosity++;
}
else if (args[i].ToLower().Equals(“-help”))
{
showUsage();
}
else if (args[i].ToLower().Equals(“-version”))
{
showVersion();
}
else if (args[i].ToLower().Equals(“-odir”) && i < (args.Length – 1))
{
i++;
outDir = args[i];
}
else if (args[i].ToLower().Equals(“-dumpenums”) && i < (args.Length – 1))
{
i++;
enumXmlWriter = new XmlTextWriter(args[i], System.Text.Encoding.UTF8);
enumXmlWriter.WriteStartElement(“enums”);
}
else if (args[i].ToLower().Equals(“-cheatdir”) && i < (args.Length – 1))
{
i++;
cheatDir = args[i];
}
else if (args[i].ToLower().Equals(“-netdir”) && i < (args.Length – 1))
{
i++;
string[] argDirs = args[i].Split(‘;’);
for (int j = 0; j < argDirs.Length; j++)
argDirs[j] = Path.GetFullPath(argDirs[j]).ToLower();
netRoot.AddRange(argDirs);
}
else if (args[i].ToLower().Equals(“-exnetdir”) && i < (args.Length – 1))
{
i++;
string[] argDirs = args[i].Split(‘;’);
for (int j = 0; j < argDirs.Length; j++)
argDirs[j] = Path.GetFullPath(argDirs[j]).ToLower();
exNetRoot.AddRange(argDirs);
}
else if (args[i].ToLower().Equals(“-appdir”) && i < (args.Length – 1))
{
i++;
string[] argDirs = args[i].Split(‘;’);
for (int j = 0; j < argDirs.Length; j++)
argDirs[j] = Path.GetFullPath(argDirs[j]).ToLower();
appRoot.AddRange(argDirs);
}
else if (args[i].ToLower().Equals(“-exappdir”) && i < (args.Length – 1))
{
i++;
string[] argDirs = args[i].Split(‘;’);
for (int j = 0; j < argDirs.Length; j++)
argDirs[j] = Path.GetFullPath(argDirs[j]).ToLower();
exAppRoot.AddRange(argDirs);
}
else if (args[i].ToLower().Equals(“-exclude”) && i < (args.Length – 1))
{
i++;
string[] argDirs = args[i].Split(‘;’);
for (int j = 0; j < argDirs.Length; j++)
argDirs[j] = Path.GetFullPath(argDirs[j]).ToLower();
exclude.AddRange(argDirs);
}
else if (args[i].ToLower().Equals(“-xmldir”) && i < (args.Length – 1))
{
i++;
xmldumpDir = args[i];
}
else
{
// Final argument is translation target
{code}
- Phase 1: Build appEnv, a dictionary from qualified type names to a type representation. appEnv is built from two places:
- addNetTranslation scans every .xml file under netDir roots, use built in XML persistance to create type reps
- addAppSigTranslation scans every .cs file under appDir, uses csparser and csEnvBuilder to parse and generate a typerep
—dumpXMLs will dump all these typereps back to XML files.