Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. if (scriptTable.Variables != null)
  2. {
  3. generator.WriteComment("VARIABLES", code);
  4. foreach (ScriptGlobal variable in scriptTable.Variables)
  5. {
  6. code.Write("(variable {0} {1} ", opcodes.GetTypeInfo((ushort)variable.Type).Name, variable.Name);
  7. generator.WriteExpression(variable.ExpressionIndex, code);
  8. if (_showInfo)
  9. code.WriteLine(")\t\t; Index: {0}, EXP: {1}", counter.ToString(), variable.ExpressionIndex.Index.ToString());
  10. else
  11. code.WriteLine(")");
  12. counter++;
  13. }
  14. code.WriteLine();
  15. counter = 0;
  16. }
  17.  
  18. generator.WriteComment("GLOBALS", code);
  19. foreach (ScriptGlobal global in scriptTable.Globals)
  20. {
  21. code.Write("(global {0} {1} ", opcodes.GetTypeInfo((ushort) global.Type).Name, global.Name);
  22. generator.WriteExpression(global.ExpressionIndex, code);
  23. if (_showInfo)
  24. code.WriteLine(")\t\t; Index: {0}, EXP: {1}", counter.ToString(), global.ExpressionIndex.Index.ToString());
  25. else
  26. code.WriteLine(")");
  27. counter++;
  28. }
  29. code.WriteLine();
  30. counter = 0;
  31.  
  32. generator.WriteComment("SCRIPTS", code);
  33. foreach (Script script in scriptTable.Scripts)
  34. {
  35. if (_showInfo)
  36. {
  37. generator.WriteComment(string.Format("Index: {0}, EXP: {1}", counter.ToString(), script.RootExpressionIndex.Index.ToString()), code);
  38. }
  39.  
  40. code.Write("(script {0} {1} ", opcodes.GetScriptTypeName((ushort) script.ExecutionType),
  41. opcodes.GetTypeInfo((ushort) script.ReturnType).Name);
  42.  
  43. if (script.Parameters.Count > 0)
  44. {
  45. code.Write("({0} (", script.Name);
  46.  
  47. bool firstParam = true;
  48. foreach (ScriptParameter param in script.Parameters)
  49. {
  50. if (!firstParam)
  51. code.Write(", ");
  52. code.Write("{1} {0}", param.Name, opcodes.GetTypeInfo((ushort) param.Type).Name);
  53. firstParam = false;
  54. }
  55.  
  56. code.Write("))");
  57. }
  58. else
  59. {
  60. code.Write(script.Name);
  61. }
  62.  
  63. code.Indent++;
  64. code.WriteLine();
  65. generator.WriteExpression(script.RootExpressionIndex, code, _buildInfo.HeaderSize == 0x1E000);
  66. code.Indent--;
  67.  
  68. code.WriteLine();
  69. code.WriteLine(")");
  70. code.WriteLine();
  71. counter++;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement