def initialize(self, force=False):
     xnode = UF.get_cfile_dictionary_xnode(self.cfile.capp.path,
                                           self.cfile.name)
     if xnode is None:
         raise Exception("UF.get_cfile_dictionary_xnode returned None")
     xnode = xnode.find("c-dictionary")
     if xnode is None:
         raise Exception("Missing node `c-dictionary`")
     CDictionary.initialize(self, xnode, force)
Beispiel #2
0
 def index_exp(self, e, subst={}, fid=-1):
     if e.is_lval():
         lhost = e.get_lval().get_lhost()
         if lhost.is_var() and lhost.get_vid() in subst:
             if e.get_lval().get_offset().has_offset():
                 if e.get_lval().get_offset().is_field():
                     paroffset = e.get_lval().get_offset()
                     newsubst = subst.copy()
                     newsubst.pop(lhost.get_vid())
                     iargexp = self.index_exp(subst[lhost.get_vid()],
                                              newsubst, fid)
                     argexp = self.get_exp(iargexp)
                     if argexp.is_lval():
                         arghost = argexp.get_lval().get_lhost()
                         if argexp.get_lval().get_offset().has_offset():
                             argoffset = argexp.get_lval().get_offset()
                             raise Exception(
                                 'Unexpected offset in substitution argument: '
                                 + str(argexp) + '; offset: ' +
                                 str(argoffset))
                         iarghost = self.index_lhost(arghost, newsubst, fid)
                         iargoffset = self.index_offset(paroffset, fid)
                         iarglval = self.index_lhost_offset(
                             iarghost, iargoffset)
                         return self.mk_lval_exp(iarglval)
                     else:
                         raise Exception(
                             'Unexpected type in substition argument (not an lval): '
                             + str(callarg))
                 else:
                     raise Exception(
                         'Unexpected offset in exp to be substituted: ' +
                         str(e))
             # avoid re-substitution for recursive functions
             newsubst = subst.copy()
             newsubst.pop(lhost.get_vid())
             return self.index_exp(subst[lhost.get_vid()], newsubst, fid)
     return CDictionary.index_exp(self, e, subst, fid)
Beispiel #3
0
 def initialize(self, force=False):
     xnode = UF.get_cfile_dictionary_xnode(self.cfile.capp.path,
                                           self.cfile.name)
     xnode = xnode.find('c-dictionary')
     CDictionary.initialize(self, xnode, force)
Beispiel #4
0
 def __init__(self, decls):
     CDictionary.__init__(self)
     self.decls = decls
     self.cfile = self.decls.cfile
     self.initialize()
 def __init__(self, decls: "CFileDeclarations") -> None:
     CDictionary.__init__(self)
     self.decls = decls
     self.cfile = self.decls.cfile
     self.initialize()
Beispiel #6
0
 def _initialize(self):
     xnode = UF.get_global_dictionary_xnode(self.capp.path)
     CDictionary.initialize(self,xnode)
Beispiel #7
0
 def __init__(self,decls):
     CDictionary.__init__(self)
     self.decls = decls
     self.capp = decls.capp
     self._initialize()
 def _initialize(self) -> None:
     xnode = UF.get_global_dictionary_xnode(self.capp.path)
     if xnode is None:
         raise Exception("UF.get_global_dictionary_xnode returned None")
     CDictionary.initialize(self, xnode)
 def __init__(self, decls: "CGlobalDeclarations") -> None:
     CDictionary.__init__(self)
     self.decls = decls
     self.capp = decls.capp
     self._initialize()