int NSISCALL popint_or() { char buf[128]; if (popstringn(buf,sizeof(buf))) return 0; return myatoi_or(buf); }
int NSISCALL popint_or() { TCHAR buf[128]; if (popstringn(buf,sizeof(buf)/sizeof(TCHAR))) return 0; return myatoi_or(buf); }
int NSISCALL myatoi_or(const char *s) { int v=0; if (*s == '0' && (s[1] == 'x' || s[1] == 'X')) { s++; for (;;) { int c=*(++s); if (c >= '0' && c <= '9') c-='0'; else if (c >= 'a' && c <= 'f') c-='a'-10; else if (c >= 'A' && c <= 'F') c-='A'-10; else break; v<<=4; v+=c; } } else if (*s == '0' && s[1] <= '7' && s[1] >= '0') { for (;;) { int c=*(++s); if (c >= '0' && c <= '7') c-='0'; else break; v<<=3; v+=c; } } else { int sign=0; if (*s == '-') sign++; else s--; for (;;) { int c=*(++s) - '0'; if (c < 0 || c > 9) break; v*=10; v+=c; } if (sign) v = -v; } // Support for simple ORed expressions if (*s == '|') { v |= myatoi_or(s+1); } return v; }
int NSISCALL myatoi_or(const TCHAR *s) { int v=0; if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X'))) { s++; for (;;) { int c=*(++s); if (c >= _T('0') && c <= _T('9')) c-=_T('0'); else if (c >= _T('a') && c <= _T('f')) c-=_T('a')-10; else if (c >= _T('A') && c <= _T('F')) c-=_T('A')-10; else break; v<<=4; v+=c; } } else if (*s == _T('0') && s[1] <= _T('7') && s[1] >= _T('0')) { for (;;) { int c=*(++s); if (c >= _T('0') && c <= _T('7')) c-=_T('0'); else break; v<<=3; v+=c; } } else { int sign=0; if (*s == _T('-')) sign++; else s--; for (;;) { int c=*(++s) - _T('0'); if (c < 0 || c > 9) break; v*=10; v+=c; } if (sign) v = -v; } // Support for simple ORed expressions if (*s == _T('|')) { v |= myatoi_or(s+1); } return v; }