HEADER_DIRECT = []
CPP_DIRECT = []
-QUIETLY = 0
+QUIETLY = False
+
def declare(s):
if not QUIETLY:
self._name = name
self._tag = int(tag)
self._ctype = type
- self._optional = 0
- self._can_be_array = 0
- self._array = 0
+ self._optional = False
+ self._can_be_array = False
+ self._array = False
self._line_count = -1
self._struct = None
self._refname = None
def Type(self):
return self._type
- def MakeArray(self, yes=1):
- self._array = yes
+ def MakeArray(self):
+ self._array = True
def MakeOptional(self):
- self._optional = 1
+ self._optional = True
def Verify(self):
if self.Array() and not self._can_be_array:
# Init base class
Entry.__init__(self, type, name, tag)
- self._can_be_array = 1
+ self._can_be_array = True
if bits == 32:
self._ctype = 'ev_uint32_t'
self._marshal_type = 'int'
# Init base class
Entry.__init__(self, type, name, tag)
- self._can_be_array = 1
+ self._can_be_array = True
self._ctype = 'char *'
def GetInitializer(self):
Entry.__init__(self, type, name, tag)
self._optpointer = False
- self._can_be_array = 1
+ self._can_be_array = True
self._refname = refname
self._ctype = 'struct %s*' % refname
self._optaddarg = False
def ProcessOneEntry(factory, newstruct, entry):
- optional = 0
- array = 0
+ optional = False
+ array = False
entry_type = ''
name = ''
tag = ''
for token in entry.split(" "):
if not entry_type:
if not optional and token == 'optional':
- optional = 1
+ optional = True
continue
if not array and token == 'array':
- array = 1
+ array = True
continue
if not entry_type:
global CPP_DIRECT
global LINE_COUNT
- got_struct = 0
-
- processed_lines = []
+ got_struct = False
+ have_c_comment = False
- have_c_comment = 0
data = ''
- while 1:
+
+ while True:
line = filep.readline()
if not line:
break
line = re.sub(r'/\*.*?\*/', '', line)
else:
line = re.sub(r'/\*.*$', '', line)
- have_c_comment = 1
+ have_c_comment = True
if have_c_comment:
if not re.search(r'\*/', line):
continue
- have_c_comment = 0
+ have_c_comment = False
line = re.sub(r'^.*\*/', '', line)
line = NormalizeLine(line)
raise RpcGenError('Missing struct on line %d: %s'
% (LINE_COUNT, line))
else:
- got_struct = 1
+ got_struct = True
data += line
continue
if len(argv) >= 2 and argv[1] == '--quiet':
global QUIETLY
- QUIETLY = 1
+ QUIETLY = True
del argv[1]
if len(argv) < 2 or len(argv) > 4: