コード例 #1
0
ファイル: functionDeps.py プロジェクト: JayThomason/Waldo
    def jsonize(self,funcDepsDict):
        '''
        @param {dictionary} funcDepsDict --- a dictionary from
        name of each functionDep to FunctionDep object.
        '''
        returner = {};
        returner['funcName'] = self.funcName;
        
        returner['readSet'] =[];
        for ider in sorted(self.mReadSet.keys()):
            returner['readSet'].append(self.mReadSet[ider].varName);

        # write read set list
        varReadSetList = [];
        for itemKey in sorted(self.varReadSet.keys()):
            varReadSetItem = self.varReadSet[itemKey];
            jsonString = varReadSetItem.jsonize();
            varReadSetList.append(
                util.fromJsonPretty(jsonString));

        # definite global/shared reads
        globSharedReads = [];
        for ntt in self.definiteSharedGlobalReads(funcDepsDict):
            jsoned = ntt.jsonize();
            globSharedReads.append(
                util.fromJsonPretty(jsoned));

        returner['definiteGlobalSharedReads'] = globSharedReads;

        #definite global/shared writes
        globSharedWrites = [];
        for ntt in self.definiteSharedGlobalWrites(funcDepsDict):
            jsoned = ntt.jsonize();
            globSharedWrites.append(
                util.fromJsonPretty(jsoned));

        returner['definiteGlobalSharedWrites'] = globSharedWrites;

        # conditional global/shared reads
        conditionalGlobSharedReads = [];
        for ntt in self.conditionalSharedGlobalReads(funcDepsDict):
            jsoned = ntt.jsonize();
            conditionalGlobSharedReads.append(
                util.fromJsonPretty(jsoned));

        returner['conditionalGlobalSharedReads'] = conditionalGlobSharedReads;

        # conditional global shared writes
        conditionalGlobSharedWrites = [];
        for ntt in self.conditionalSharedGlobalWrites(funcDepsDict):
            jsoned = ntt.jsonize();
            conditionalGlobSharedWrites.append(
                util.fromJsonPretty(jsoned));

        returner['conditionalGlobalSharedWrites'] = conditionalGlobSharedWrites;
        
        # return the json
        return util.toJsonPretty(returner);
コード例 #2
0
ファイル: typeStack.py プロジェクト: bmistree/Waldo
 def jsonize(self):
     returner = {};
     returner['id'] = self.id;
     returner['varName'] = self.varName;
     returner['varType'] = self.varType;
     returner['mutable'] = 1 if self.mutable else 0;
     returner['argPosition'] = -1 if self.argPosition == None else self.argPosition;
     
     return util.toJsonPretty(returner);
コード例 #3
0
ファイル: functionDeps.py プロジェクト: JayThomason/Waldo
    def jsonize(self):
        returner = {};
        jsoned = self.ntt.jsonize();
        returner['readSetNtt'] = util.fromJsonPretty(jsoned);

        readArray = [];
        for readKey in sorted(self.mReads.keys()):
            readItem = self.mReads[readKey];
            jsoned = readItem.jsonize();
            readArray.append(
                util.fromJsonPretty(jsoned));

        returner['reads'] = readArray;
        return util.toJsonPretty(returner);