forest-net
an overlay networks for large-scale virtual worlds
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
cpscript1.py
1 """
2 cpscript TYP name count1 type name ... count2 type name
3 """
4 
5 import sys
6 from socket import *
7 
8 cmdType = sys.argv[1]
9 cmdName = sys.argv[2]
10 count1 = int(sys.argv[3])
11 i = 4; j = 0
12 reqType = [""] * 100
13 reqName = [""] * 100
14 reqDesc = [""] * 100
15 while (j < count1) :
16  reqType[j] = sys.argv[i];
17  i += 1; j += 1;
18 count2 = int(sys.argv[i])
19 i += 1; j = 0;
20 repType = [""] * 100
21 repName = [""] * 100
22 repDesc = [""] * 100
23 while (j < count2) :
24  repType[j] = sys.argv[i];
25  i += 1; j += 1;
26 
27 sys.stdout.write("\tvoid CtlPkt::fmt" + cmdName + "(")
28 for i in range(count1) :
29  if i != 0 : sys.stdout.write(", ")
30  sys.stdout.write(reqType[i])
31 sys.stdout.write(", int64_t);\n")
32 
33 sys.stdout.write("\tbool CtlPkt::xtr" + cmdName + "(")
34 for i in range(count1) :
35  if i != 0 : sys.stdout.write(", ")
36  sys.stdout.write(reqType[i] + "&")
37 sys.stdout.write(");\n");
38 
39 sys.stdout.write("\tvoid CtlPkt::fmt" + cmdName + "Reply(")
40 for i in range(count2) :
41  if i != 0 : sys.stdout.write(", ")
42  sys.stdout.write(repType[i])
43 if count2 > 0 : sys.stdout.write(", ")
44 sys.stdout.write("int64_t=0);\n")
45 
46 sys.stdout.write("\tbool CtlPkt::xtr" + cmdName + "Reply(")
47 for i in range(count2) :
48  if i != 0 : sys.stdout.write(", ")
49  sys.stdout.write(repType[i] + "&")
50 sys.stdout.write(");\n\n")