mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-protocol
synced 2025-12-26 14:18:31 +00:00
add ifdef/endif methods to spice code generator
These methods will be needed to be able to make some fields optional in spice.proto
This commit is contained in:
parent
7f23ab54aa
commit
d8975877c6
@ -322,6 +322,18 @@ class CodeWriter:
|
||||
def macro(self, name, args, define):
|
||||
self.write("#define %s(%s) %s" % (name, args, define)).newline()
|
||||
|
||||
def ifdef(self, name):
|
||||
indentation = self.indentation
|
||||
self.indentation = 0;
|
||||
self.write("#ifdef %s" % (name)).newline()
|
||||
self.indentation = indentation
|
||||
|
||||
def endif(self, name):
|
||||
indentation = self.indentation
|
||||
self.indentation = 0;
|
||||
self.write("#endif /* %s */" % (name)).newline()
|
||||
self.indentation = indentation
|
||||
|
||||
def add_function_variable(self, ctype, name):
|
||||
if self.function_variables.has_key(name):
|
||||
assert(self.function_variables[name] == ctype)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user