1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 46 unchanged lines hidden (view full) --- 55 def prototype(self): 56 if "external" in self: 57 return "" 58 59 return_type = self.return_type.c_ident 60 void_type = self.symtab.find("void", Type) 61 if "return_by_ref" in self and self.return_type != void_type: 62 return_type += "&" |
63 elif "return_by_pointer" in self and self.return_type != void_type: 64 return_type += "*" |
65 66 return "%s %s(%s);" % (return_type, self.c_ident, 67 ", ".join(self.param_strings)) 68 69 def writeCodeFiles(self, path): 70 '''This write a function of object Chip''' 71 if "external" in self: 72 return --- 11 unchanged lines hidden (view full) --- 84 code('#include "mem/protocol/${{self.machineStr}}_Controller.hh"') 85 86 code('using namespace std;') 87 # Generate function header 88 void_type = self.symtab.find("void", Type) 89 return_type = self.return_type.c_ident 90 if "return_by_ref" in self and self.return_type != void_type: 91 return_type += "&" |
92 if "return_by_pointer" in self and self.return_type != void_type: 93 return_type += "*" |
94 95 if self.isInternalMachineFunc: 96 klass = "%s_Controller" % self.machineStr 97 else: 98 klass = "Chip" 99 100 params = ', '.join(self.param_strings) 101 102 code(''' 103$return_type 104${klass}::${{self.c_ident}}($params) 105{ 106${{self.body}} 107} 108''') 109 code.write(path, "%s.cc" % self.c_ident) 110 111__all__ = [ "Func" ] |