aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/tst/init.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-04 15:18:22 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-10-04 15:18:22 +0000
commit1c7864f6d4380797b07c7149111066b61f69f689 (patch)
tree59057c26f97fdf846b0193e852eeea7e707a9e20 /code/tools/lcc/tst/init.c
parent91db83f0cc7c564ff6c853eeb4e790732dae81cd (diff)
downloadioquake3-aero-1c7864f6d4380797b07c7149111066b61f69f689.tar.gz
ioquake3-aero-1c7864f6d4380797b07c7149111066b61f69f689.zip
* Moved lcc and q3asm into code/tools
git-svn-id: svn://svn.icculus.org/quake3/trunk@134 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/tools/lcc/tst/init.c')
-rw-r--r--code/tools/lcc/tst/init.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/code/tools/lcc/tst/init.c b/code/tools/lcc/tst/init.c
new file mode 100644
index 0000000..55cece3
--- /dev/null
+++ b/code/tools/lcc/tst/init.c
@@ -0,0 +1,59 @@
+
+typedef struct { int codes[3]; char name[6]; } Word;
+
+Word words[] = {
+ 1, 2, 3, "if",
+ { { 4, 5 }, { 'f', 'o', 'r' } },
+ 6, 7, 8, {"else"},
+ { { 9, 10, 11,}, 'w', 'h', 'i', 'l', 'e', },
+ { 0 },
+}, *wordlist = words;
+
+int x[][5] = { 1, 2, 3, 4, 0, { 5, 6 }, { 7 } };
+int *y[] = { x[0], x[1], x[2], 0 };
+
+
+main()
+{
+ int i, j;
+
+ for (i = 0; y[i]; i++) {
+ for (j = 0; y[i][j]; j++)
+ printf(" %d", y[i][j]);
+ printf("\n");
+ }
+ f();
+ g(wordlist);
+ return 0;
+}
+
+f() {
+ static char *keywords[] = {"if", "for", "else", "while", 0, };
+ char **p;
+
+ for (p = keywords; *p; p++)
+ printf("%s\n", *p);
+}
+
+g(p)
+Word *p;
+{
+ int i;
+
+ for ( ; p->codes[0]; p++) {
+ for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++)
+ printf("%d ", p->codes[i]);
+ printf("%s\n", p->name);
+ }
+ h();
+}
+
+h()
+{
+ int i;
+
+ for (i = 0; i < sizeof(words)/sizeof(Word); i++)
+ printf("%d %d %d %s\n", words[i].codes[0],
+ words[i].codes[1], words[i].codes[2],
+ &words[i].name[0]);
+}