Func.py (10984:a86f453a7caa) Func.py (11029:32604f9e190b)
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;

--- 48 unchanged lines hidden (view full) ---

57 return_type += "*"
58
59 return "%s %s(%s);" % (return_type, self.c_name,
60 ", ".join(self.param_strings))
61
62 def writeCodeFiles(self, path, includes):
63 return
64
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;

--- 48 unchanged lines hidden (view full) ---

57 return_type += "*"
58
59 return "%s %s(%s);" % (return_type, self.c_name,
60 ", ".join(self.param_strings))
61
62 def writeCodeFiles(self, path, includes):
63 return
64
65 def checkArguments(self, args):
66 if len(args) != len(self.param_types):
67 self.error("Wrong number of arguments passed to function : '%s'" +\
68 " Expected %d, got %d", self.c_ident,
69 len(self.param_types), len(args))
70
71 cvec = []
72 type_vec = []
73 for expr,expected_type in zip(args, self.param_types):
74 # Check the types of the parameter
75 actual_type,param_code = expr.inline(True)
76 if str(actual_type) != 'OOD' and \
77 str(actual_type) != str(expected_type) and \
78 str(actual_type["interface"]) != str(expected_type):
79 expr.error("Type mismatch: expected: %s actual: %s" % \
80 (expected_type, actual_type))
81 cvec.append(param_code)
82 type_vec.append(expected_type)
83
84 return cvec, type_vec
85
65 def generateCode(self):
66 '''This write a function of object Chip'''
67 if "external" in self:
68 return ""
69
70 code = self.symtab.codeFormatter()
71
72 # Generate function header

--- 19 unchanged lines hidden ---
86 def generateCode(self):
87 '''This write a function of object Chip'''
88 if "external" in self:
89 return ""
90
91 code = self.symtab.codeFormatter()
92
93 # Generate function header

--- 19 unchanged lines hidden ---