Lines Matching refs:model
22 def valid(self, model): argument
24 if i not in model.decls:
27 if i in model.decls:
31 def apply(self, model, name): argument
33 model.decls[i] = True
34 model.source += self.text % {'name': name}
90 model = CodeModel()
94 for d in mutations(model):
95 d(model)
97 if not model.fails():
116 model = m2
122 model.fails()
123 return model
132 def mutations(model): argument
135 yield opt(model, options)
137 def create_module(model, options): argument
138 n = model.make_name()
139 def go(model): argument
140 model.modules[n] = (model.source, model.decls)
141 (model.source, model.decls) = ('', {})
142 options += [lambda model, options: add_import(model, options, n)]
145 def add_top_level_decl(model, options): argument
146 n = model.make_name()
147 d = random.choice([decl for decl in decls if decl.valid(model)])
148 def go(model): argument
149 if not d.valid(model):
151 d.apply(model, n)
154 def add_import(model, options, module_name): argument
155 def go(model): argument
156 if module_name in model.modules:
157 model.source += '#include "%s.h"\n' % module_name
158 model.decls.update(model.modules[module_name][1])