git » libfiu » commit dfa720f

preload/posix: Allow modules to include verbatim code

author Alberto Bertogli
2009-06-17 01:07:25 UTC
committer Alberto Bertogli
2009-06-17 01:11:01 UTC
parent fbcf1e5e13780ad8f80c18319f04dfabcee217de

preload/posix: Allow modules to include verbatim code

It will be used in following commits to put some wrapper functions inside
#ifdefs.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

preload/posix/generate +12 -0

diff --git a/preload/posix/generate b/preload/posix/generate
index be51c49..792878f 100755
--- a/preload/posix/generate
+++ b/preload/posix/generate
@@ -136,6 +136,16 @@ class Include:
 	def generate_to(self, f):
 		f.write("#include %s\n" % self.path)
 
+class Verbatim:
+	"Represent a verbatim directive"
+	def __init__(self, line):
+		self.line = line
+
+	def __repr__(self):
+		return '<V %s>' % self.line
+
+	def generate_to(self, f):
+		f.write(self.line + '\n')
 
 class EmptyLine:
 	"Represents an empty line"
@@ -205,6 +215,8 @@ def parse_module(path):
 					ctx.fiu_name_base = v
 				elif k == 'include':
 					directives.append(Include(v))
+				elif k == 'v':
+					directives.append(Verbatim(v))
 				else:
 					raise SyntaxError, \
 						("Unknown directive", l)