Esempio n. 1
0
 def __make__statement(self, useClasses):
     m = self.mMethod
     if (useClasses is not None):
         for c in useClasses:
             self.__push__statement(JOcMixHelper.callClass(c, m))
     else:
         self.__push__statement(JOcMixHelper.makeStatement(m))
Esempio n. 2
0
 def _make_macros_simple(self, macros_name, left=1, right=16, indent=1):
     s = ''
     classes = self._rand_lnk_classes(left, right)
     for cls in classes:
         s += ST(indent) + JOcMixHelper.callClass(cls) + ' \\' + SN
     s += ST(indent) + 'NSLog(@"perform ' + macros_name + ' done");' + SN
     self.add_interface_macros(macros_name, s)
Esempio n. 3
0
 def _make_macros_catalogs(self, macros_name, indent=1):
     s = ''
     s += ST(indent) + 'dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{' + ' \\' + SN
     for cls in self._lnk_classes:
         s += ST(indent+1) + JOcMixHelper.callClass(cls) + ' \\' + SN
     s += ST(indent+1) + 'NSLog(@"perform ' + macros_name + ' done");' + ' \\' + SN
     s += ST(indent) + '});' + SN
     self.add_interface_macros(macros_name, s)
Esempio n. 4
0
 def _make_macros_resource(self, macros_name, indent=1):
     classes = self._rand_lnk_classes(2)
     pos = JRand.rand_int(0, len(classes)-2)
     s = ''
     for i in range(len(classes)):
         cls = classes[i]
         s += ST(indent) + JOcMixHelper.callClass(cls) + ' \\' + SN
         if i == pos:
             s += ST(indent) + self._cheater_cls.className + '::' + JCheatMaker.get_assets_func() + '();' + ' \\' + SN
     s += ST(indent) + 'NSLog(@"perform ' + macros_name + ' done");' + SN
     self.add_interface_macros(macros_name, s)
Esempio n. 5
0
 def _make_macros_disk_cheat(self, macros_name, indent=1):
     classes = self._rand_lnk_classes(2)
     pos = JRand.rand_int(0, len(classes) - 2)
     s = ''
     for i in range(len(classes)):
         cls = classes[i]
         s += ST(indent + 1) + JOcMixHelper.callClass(cls) + ' \\' + SN
         if i == pos:
             s += ST(indent) + 'dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{' + ' \\' + SN
             s += ST(indent+1) + self._cheater_cls.className + '::' + JCheatMaker.get_disk_i_func() + '();' + ' \\' + SN
             s += ST(indent+1) + self._cheater_cls.className + '::' + JCheatMaker.get_disk_o_func() + '();' + ' \\' + SN
             s += ST(indent) + '});' + ' \\' + SN
     s += ST(indent + 1) + 'NSLog(@"perform ' + macros_name + ' done");' + SN
     self.add_interface_macros(macros_name, s)
Esempio n. 6
0
 def makeClsDeclare(self, radix):
     methods = self.methods
     if (methods is None):
         methods = []
         self.methods = methods
     flag = False  # 是否有静态函数的标记
     size = radix - JRand.rand_nearest(radix) + 1
     for i in range(size):
         m = JOcMixMethod(self)
         m.index = i
         methods.append(m)
         scope = None
         if (i == size - 1) and (not flag):
             scope = '+'  # 强制添加一个静态函数
         else:
             scope = random.choice(OC_METH)
             if (JOcMixHelper.isClassMethod(scope)):
                 flag = True
         m.makeDeclare(scope)
Esempio n. 7
0
 def makeReturn(self):
     if (self.mMethod.ret != 'void'):
         r = JOcMixHelper.makeRet(self.mMethod)
         self.__push__statement('return ' + r + ';')
     else:
         self.__push__statement('return;')
Esempio n. 8
0
 def useOtherClass(self, fromMeth):
     uses = self._include_classes
     if (uses is None):
         return None
     c = random.choice(uses)
     return JOcMixHelper.callClass(c, fromMeth)