Lines Matching refs:model
23 def valid(self, model): argument
25 if i not in model.decls:
28 if i in model.decls:
32 def apply(self, model, name): argument
34 model.decls[i] = True
35 model.source += self.text % {'name': name}
91 model = CodeModel()
95 for d in mutations(model):
96 d(model)
98 if not model.fails():
117 model = m2
123 model.fails()
124 return model
133 def mutations(model): argument
136 yield opt(model, options)
138 def create_module(model, options): argument
139 n = model.make_name()
140 def go(model): argument
141 model.modules[n] = (model.source, model.decls)
142 (model.source, model.decls) = ('', {})
143 options += [lambda model, options: add_import(model, options, n)]
146 def add_top_level_decl(model, options): argument
147 n = model.make_name()
148 d = random.choice([decl for decl in decls if decl.valid(model)])
149 def go(model): argument
150 if not d.valid(model):
152 d.apply(model, n)
155 def add_import(model, options, module_name): argument
156 def go(model): argument
157 if module_name in model.modules:
158 model.source += '#include "%s.h"\n' % module_name
159 model.decls.update(model.modules[module_name][1])