main.bf 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. // Starting comment
  2. // This is another comment
  3. using System;
  4. using System.Collections;
  5. using System.Threading;
  6. using System.Diagnostics;
  7. using System.Collections;
  8. namespace Hey.Dude.Bro
  9. {
  10. struct StructA
  11. {
  12. //public int mVal;
  13. public int mVal;
  14. }
  15. abstract class TestClassBase
  16. {
  17. int mTCBaseVal = 9;
  18. //public int mMemberVal;
  19. //public abstract int VirtFunc();
  20. /*public virtual int Val
  21. {
  22. get
  23. {
  24. return 0;
  25. }
  26. } */
  27. public virtual int Val
  28. {
  29. get
  30. {
  31. return 0;
  32. }
  33. }
  34. }
  35. class TClass<T>
  36. {
  37. public const int sVal = 1;
  38. public class TClass2<T2, T3>
  39. {
  40. public int mVal;
  41. public const int sVal2 = 9;
  42. }
  43. }
  44. class TestClass : TestClassBase
  45. {
  46. this() : this(123)
  47. {
  48. PrintF("TestClass.this()\n");
  49. mMemberVal2 = 345;
  50. }
  51. this(int iVal)
  52. {
  53. PrintF("TestClass.this(%d)\n", iVal);
  54. }
  55. public override int Val
  56. {
  57. get
  58. {
  59. return 0;
  60. }
  61. }
  62. enum TestEnum2
  63. {
  64. EnumA,
  65. EnumB
  66. }
  67. double d = 123L;
  68. //var eVal = TestEnum2.EnumB;
  69. //var iVal = 123;
  70. //var tcVal = TestClass.ConstThing;
  71. int mMemberVal = 234;
  72. int mMemberVal2;
  73. //int Val;
  74. TestClass mNext;
  75. //int mNext;
  76. const int ConstThing = (int)0xe0434f4d;
  77. const float FloatThing = 123.45f;
  78. static int sStaticVal = 23;
  79. //static int sHeyCalls = Hey.Dude.Bro.TClass<float>.sVal;
  80. static int sHeyCalls = Hey.Dude.Bro.TestClass.ConstThing;
  81. public static int Hey(int inVal, int inVal2)
  82. {
  83. sHeyCalls++;
  84. PrintF("Hey %d %d\n", inVal, inVal2);
  85. if (inVal == 123)
  86. {
  87. int* ptr = null;
  88. *ptr = inVal;
  89. }
  90. return 123;
  91. }
  92. static void Method1(int val)
  93. {
  94. }
  95. public int Hey2(int heyInVal, int inVal2)
  96. {
  97. mMemberVal++;
  98. //PrintF("Hey2 %d %d\n", inVal, inVal2);
  99. return 234;
  100. }
  101. public static explicit operator int(TestClass pg)
  102. {
  103. return 12;
  104. }
  105. public TestClass GetSelf()
  106. {
  107. PrintF("Called GetSelf %08X\n", this);
  108. mMemberVal++;
  109. return this;
  110. }
  111. public int[] GetIntArray()
  112. {
  113. int size = 1000;
  114. int[] iArr = new int[size];
  115. for (int i = 0; i < size; i++)
  116. iArr[i] = i * 10 + 1;
  117. return iArr;
  118. }
  119. static int sCount = 0;
  120. public static void ThreadProc()
  121. {
  122. PrintF("Inside ThreadProc\n");
  123. int j = 0;
  124. int j2 = 0;
  125. while (true)
  126. {
  127. sCount++;
  128. j++;
  129. j2++;
  130. }
  131. /*while (true)
  132. {
  133. //Thread.Sleep(1000);
  134. CTest2();
  135. j++;
  136. j++;
  137. j++;
  138. j++;
  139. j++;
  140. }*/
  141. }
  142. public void StackOverflow(int i)
  143. {
  144. if ((i % 10000) == 0)
  145. {
  146. PrintF("StackOverflow: %d", i);
  147. }
  148. StackOverflow(i + 1);
  149. }
  150. /*public static StructA GetStructA()
  151. {
  152. return StructA();
  153. } */
  154. class DoTestClass
  155. {
  156. public int mX;
  157. public int mY;
  158. }
  159. public static void DoTest()
  160. {
  161. DoTestClass dtc = new DoTestClass();
  162. for (int i = 0; i < 200000000; i++)
  163. {
  164. dtc.mX += i;
  165. dtc.mY += dtc.mX;
  166. }
  167. delete dtc;
  168. }
  169. /*public static int Main()
  170. {
  171. return 123;
  172. } */
  173. public static int Main(string[] args)
  174. {
  175. //Stopwatch sw = new Stopwatch();
  176. //Console.WriteLine("Yo");
  177. //Console.WriteLine("What's up?");
  178. List<int> intList = new List<int>();
  179. intList.Add(2);
  180. intList.Add(3);
  181. intList.Add(4);
  182. intList.RemoveAt(1);
  183. intList.RemoveAt(5);
  184. char* strPtr = "WhoooooooooooooooooooooosieWhoooooooooooooooooooooosie";
  185. string str = scope string(strPtr);
  186. string[] splitStrs = scope { scope string(), scope string(), scope string() };
  187. //splitStrs = "Hey, man, wassap!".Split(splitStrs, ',');
  188. //string[] splitStrs = "Hey, man, wassap!".Split(splitStrs, ',');
  189. //string subtr = "What!".Substring(stack String(), 1, 2);
  190. return 0;
  191. }
  192. }
  193. }