str *joinl(list<str *> *l) { /** Join two or more pathname components, inserting '/' as needed */ list<str *> *__1, *__2, *p; list<str *>::for_in_loop __123; str *__0, *b, *path; __ss_int __4, __5; __0 = l->__getfast__(0); __1 = l->__slice__(1, 1, 0, 0); path = __0; p = __1; FOR_IN(b,p,2,4,123) if (b->startswith(const_4)) { path = b; } else if (__OR(__eq(path, const_0), path->endswith(const_4), 5)) { path = path->__iadd__(b); } else { path = __add_strs(3, path, const_4, b); } END_FOR return path; }
str *joinl(list<str *> *l) { /** Join two or more pathname components, inserting "\" as needed */ list<str *> *__3, *__4, *p; list<str *>::for_in_loop __123; __iter<str *> *__5; str *__2, *b, *path; __ss_int __10, __11, __12, __13, __14, __6, __7, __8, __9, b_wins; __2 = l->__getfast__(0); __3 = l->__slice__(1, 1, 0, 0); path = __2; p = __3; FOR_IN(b,p,4,6,123) b_wins = 0; if (__eq(path, const_1)) { b_wins = 1; } else if (isabs(b)) { if (__OR(__ne(path->__slice__(3, 1, 2, 0), const_19), __eq(b->__slice__(3, 1, 2, 0), const_19), 7)) { b_wins = 1; } else if (__OR((len(path)>3), __AND((len(path)==3), (!(const_18)->__contains__(path->__getitem__(-1))), 10), 9)) { b_wins = 1; } } if (b_wins) { path = b; } else { ASSERT((len(path)>0), 0); if ((const_18)->__contains__(path->__getitem__(-1))) { if ((___bool(b) && (const_18)->__contains__(b->__getitem__(0)))) { path = path->__iadd__(b->__slice__(1, 1, 0, 0)); } else { path = path->__iadd__(b); } } else if (__eq(path->__getitem__(-1), const_19)) { path = path->__iadd__(b); } else if (___bool(b)) { if ((const_18)->__contains__(b->__getitem__(0))) { path = path->__iadd__(b); } else { path = __add_strs(3, path, const_4, b); } } else { path = path->__iadd__(const_4); } } END_FOR return path; }
str *DynamInt::__mul__(DynamInt *num) { /** Overloaded add function Adds an existing DynamInt to this one @param num reference to an existing DynamInt @return added DynamInt */ str *bottom, *product, *top; int __2, __3, carry, i, j, k, n, resultSize, tempProduct; if (__gt(this, num)) { top = this->data; bottom = num->data; } else { top = num->data; bottom = this->data; } tempProduct = 0; product = const_0; resultSize = (this->size+num->size); FAST_FOR(n,0,resultSize,1,2,3) product = (const_1)->__add__(product); END_FOR i = (len(bottom)-1); while ((i>=0)) { carry = 0; j = (len(top)-1); while ((j>=0)) { k = (i+j); tempProduct = __int((((__int(top->__getitem__(j))*__int(bottom->__getitem__(i)))+__int(product->__getitem__(k)))+carry)); product = __add_strs(3, product->__slice__(2, 0, (k+1), 0), __str(__mods(tempProduct, 10)), product->__slice__(1, (k+2), 0, 0)); carry = __int(__divs(tempProduct, 10)); j = (j-1); } if ((carry!=0)) { product = __add_strs(3, product->__slice__(2, 0, i, 0), __str(carry), product->__slice__(1, (i+1), 0, 0)); } i = (i-1); } return product; return 0; }
str *DynamInt::__div__(DynamInt *num) { /** Overloaded == function Checks if this DynamInt is equal to this one @param num reference to an existing DynamInt @return added DynamInt */ str *remainderString, *result, *xString; int __0, __1, i, j, m, n; DynamInt *cur, *remainder, *temp, *x; j = 0; result = const_0; xString = const_0; remainderString = const_0; temp = (new DynamInt(((int )(0)))); n = 0; while ((n<len(this->data))) { result = result->__add__(const_1); xString = xString->__add__(const_1); n = (n+1); } m = 0; while ((m<len(num->data))) { remainderString = remainderString->__add__(const_1); } cur = (new DynamInt(((int )(0)))); cur->setData((this->data)->__getitem__(0)); remainder = (new DynamInt(((int )(0)))); remainder->setData(remainderString); while ((j<len(this->data))) { x = (new DynamInt(((int )(0)))); x->setData(xString); FAST_FOR(i,0,(len(num->data)-1),1,0,1) temp->setData(x->data); x->setData(x->__add__(num)); if (__gt(x, cur)) { result = __add_strs(3, result->__slice__(2, 0, (j+1), 0), __str(i), result->__slice__(1, (j+2), 0, 0)); break; } END_FOR j = (j+1); remainder->setData(cur->__sub__(temp)); if ((j==len(this->data))) { cur->setData(__str(remainder)); } cur->setData((remainder->data)->__add__((this->data)->__getitem__(j))); } return result; }
str *complex::__repr__() { str *left, *middle, *right; if(real==0) return __modct(new str("%gj"), 1, ___box(imag)); left = __modct(new str("(%g"), 1, ___box(real)); if(imag<0) middle = new str(""); else middle = new str("+"); right = __modct(new str("%gj)"), 1, ___box(imag)); return __add_strs(3, left, middle, right); }
void __init() { const_0 = new str(" "); lowercase = ascii_lowercase = __ctype_str(islower); uppercase = ascii_uppercase = __ctype_str(isupper); letters = ascii_letters = lowercase->__add__(uppercase); digits = new str("0123456789"); hexdigits = new str("0123456789abcdefABCDEF"); octdigits = new str("01234567"); punctuation = __ctype_str(ispunct); whitespace = __ctype_str(isspace); printable = __add_strs(5, digits, lowercase, uppercase, punctuation, new str(" \t\n\r\x0b\x0c")); for(__ss_int i=0; i<256; i++) trans_table[i] = i; }
str *pyobj::__repr__() { return __add_strs(3, new str("<"), __class__->__name__, new str(" instance>")); }