void AdobeReaderAction::_enumVersions(vector <wstring>& versions)
{
	bool bKeys = true;
	DWORD dwIndex = 0;

	if (m_registry->OpenKey(HKEY_LOCAL_MACHINE, ACROBAT_REGKEY, false))
	{
		while (bKeys)
		{
			wstring key;

			bKeys = m_registry->RegEnumKey(dwIndex, key);
			dwIndex++;

			if (bKeys)
			{
				// Sometimes there are keys like WSZXSGANXFJVAYSXYQGNXKQY. May be broken installers.
				if (iswdigit(key[0]))
				{
					versions.push_back(key);
				}
			}
		}
		m_registry->Close();
	}
}
Esempio n. 2
0
File: parsing.c Progetto: 8l/eight
closure *parse_null(FILE *file, closure *accum)
{
    //printf("parse null\n");
    wchar_t c = fgetwc(file);
    if(iswspace(c)){
	return parse_null(file, nil());
    } else if(c == L'$'){
	return parse_character(file, nil());
    } else if(c == L'#'){
	parse_comment(file, nil());
	return parse_null(file, accum);
    } else if(c == L'\"'){
	return parse_string(file, nil());
    } else if(c == L'\''){
	wchar_t c = fgetwc(file);
	if (!iswspace(c)){
	    ungetwc(c, file);
	    closure *boo = parse_null(file, nil());
	    if (boo != NULL) return quote(boo);
	}
	return symbol(QUOTE);
    } else if(c == L'@'){
	wchar_t c = fgetwc(file);
	if (!iswspace(c)){
	    ungetwc(c, file);
	    closure *boo = parse_null(file, nil());
	    if (boo != NULL) return list(2, symbol(ATPEND), boo);
	}
	return symbol(ATPEND);
    } else if(c == L','){
	wchar_t c = fgetwc(file);
	if (!iswspace(c)){
	    ungetwc(c, file);
	    closure *boo = parse_null(file, nil());
	    if (boo != NULL) return list(2, symbol(COMMA), boo);
	}
	return symbol(COMMA);
    } else if(c == L'*'){
	wchar_t c = fgetwc(file);
	if (!iswspace(c)){
	    ungetwc(c, file);
	    closure *boo = parse_null(file, nil());
	    if (boo != NULL) return list(2, symbol(ASTERIX), boo);
	}
	return symbol(ASTERIX);
    } else if(iswdigit(c)){
	ungetwc(c, file);
	return parse_number(file, nil());
    } else if(c == L'('){
	return parse_list(file, nil());
    } else if(c == L')'){
	ungetwc(c, file);
	return NULL;
    } else if(c == WEOF || c == EOF){
	return NULL;
    } else {
	return parse_symbol(file, cons(character(c), nil()));
    }
}
Esempio n. 3
0
uint64_t
compat_wcstoui64(const wchar_t *nptr, wchar_t **endptr, int base)
{
    BOOL negative = FALSE;
    uint64_t ret = 0;

    if(nptr == NULL || (base < 2 && base != 0) || base > 36) {
        errno = EINVAL;
        return 0;
    }

    while(iswspace(*nptr)) nptr++;

    if(*nptr == '-') {
        negative = TRUE;
        nptr++;
    } else if(*nptr == '+')
        nptr++;

    if((base==0 || base==16) && *nptr=='0' && tolowerW(*(nptr+1))=='x') {
        base = 16;
        nptr += 2;
    }

    if(base == 0) {
        if(*nptr=='0')
            base = 8;
        else
            base = 10;
    }

    while(*nptr) {
        wchar_t cur = tolowerW(*nptr);
        int v;

        if(iswdigit(cur)) {
            if(cur >= '0'+base)
                break;
            v = *nptr-'0';
        } else {
            if(cur<L'a' || cur>=L'a'+base-10)
                break;
            v = cur-L'a'+10;
        }

        nptr++;

        if(ret>UINT64_MAX/base || ret*base>UINT64_MAX-v) {
            ret = UINT64_MAX;
            errno = ERANGE;
        } else
            ret = ret*base + v;
    }

    if(endptr)
        *endptr = (wchar_t*)nptr;

    return negative ? (uint64_t)(-(int64_t)ret) : ret;
}
Esempio n. 4
0
void unifiedWstringfromWstring(std::wstring& uniWstr, const std::wstring& /*sourceWStr*/, std::wstring::iterator begin, std::wstring::iterator end) { //avoid warning C4100
	for (auto iter = begin; iter != end; iter++) {
		if (iswalpha(*iter))
			uniWstr += towupper(*iter);
		else if (iswdigit(*iter))
			uniWstr += *iter;
	}
};
Esempio n. 5
0
//*****************************************************************************
inline BYTE getXdigit(const WCHAR xc)
//Returns: hex char converted into byte value
{
	ASSERT(iswxdigit(xc));
	if (iswdigit(xc))
		return WCv(xc) - '0';
	return 10 + (WCv(towlower(xc)) - 'a');
}
Esempio n. 6
0
int __cdecl main(int argc, char **argv)
{
  
    int result;  
    int i;
  
    wchar_t passTestCases[] = {'1','2','3','4','5','6','7','8','9'};
    wchar_t failTestCases[] = {'a','b','p','$','?',234};
  
    if ((PAL_Initialize(argc, argv)) != 0)
    {
        return (FAIL);
    }
  
    /* Loop through each case. Testing if each is a digit. */
    for(i = 0; i < sizeof(passTestCases) / sizeof(wchar_t); i++)
    {
        result = iswdigit(passTestCases[i]);
     
        /* The return value is 'non-zero' indicates digit*/
        if (result == 0)
        {
            Fail("ERROR: iswdigit returned \"%d\" instead indicating"
                    " \"%c\" is not a digit\n",
                    result,
                    passTestCases[i]);
        }
    }      

    /* Loop through each case. Testing if each is a not a digit. */
    for(i = 0; i < sizeof(failTestCases) / sizeof(wchar_t); i++)
    {
        result = iswdigit(failTestCases[i]);
             
        /* The return value is 'zero' indicates non-digit*/
        if (result != 0)
        {
            Fail("ERROR: iswdigit returned \"%d\", indicating"
                    " \"%c\" is a digit\n",
                    result,
                    failTestCases[i]);
        }
    }      
    PAL_Terminate();
    return (PASS);
} 
Esempio n. 7
0
static
BOOL
ReadNumber(
    PWSTR *s,
    PWORD pwValue)
{
    if (!iswdigit(**s))
        return FALSE;

    while (iswdigit(**s))
    {
        *pwValue = *pwValue * 10 + **s - L'0';
        (*s)++;
    }

    return TRUE;
}
Esempio n. 8
0
bool is_digit(char_t c)
{
#ifdef _UTF16_STRINGS
	return iswdigit(c) != 0;
#else
	return isdigit(c) != 0;
#endif
}
Esempio n. 9
0
int is_number(wchar_t *s) {
    /* return TRUE if the string s is a sequence of digits. */
    while(*s != L'\0') {
	if (!iswdigit((wint_t)*s)) return FALSE;
	s++;
    }
    return TRUE;
}
Esempio n. 10
0
void unifiedWstringfromWstring(std::wstring& uniWstr, const std::wstring& sourceWStr, size_t begin, size_t end) {
	for (size_t idx = begin; idx < end; idx++){
		if (iswalpha(sourceWStr[idx]))
			uniWstr += towupper(sourceWStr[idx]);
		else if (iswdigit(sourceWStr[idx]))
			uniWstr += sourceWStr[idx];
	}
};
Esempio n. 11
0
int
main ()
{
  /* Check that the isw* functions exist as functions or as macros.  */
  (void) iswalnum (0);
  (void) iswalpha (0);
#if 0 /* not portable: missing on mingw */
  (void) iswblank (0);
#endif
  (void) iswcntrl (0);
  (void) iswdigit (0);
  (void) iswgraph (0);
  (void) iswlower (0);
  (void) iswprint (0);
  (void) iswpunct (0);
  (void) iswspace (0);
  (void) iswupper (0);
  (void) iswxdigit (0);

  /* Check that the isw* functions map WEOF to 0.  */
  ASSERT (!iswalnum (e));
  ASSERT (!iswalpha (e));
#if 0 /* not portable: missing on mingw */
  ASSERT (!iswblank (e));
#endif
  ASSERT (!iswcntrl (e));
  ASSERT (!iswdigit (e));
  ASSERT (!iswgraph (e));
  ASSERT (!iswlower (e));
  ASSERT (!iswprint (e));
  ASSERT (!iswpunct (e));
  ASSERT (!iswspace (e));
  ASSERT (!iswupper (e));
  ASSERT (!iswxdigit (e));

  /* Check that the tow* functions exist as functions or as macros.  */
  (void) towlower (0);
  (void) towupper (0);

  /* Check that the tow* functions map WEOF to WEOF.  */
  ASSERT (towlower (e) == e);
  ASSERT (towupper (e) == e);

  return 0;
}
Esempio n. 12
0
int iswxdigit(wint_t c)
{
	if ( iswdigit(c) )
		return 1;
	if ( L'a' <= c && c <= L'f' )
		return 1;
	if ( L'A' <= c && c <= L'F' )
		return 1;
	return 0;
}
Esempio n. 13
0
	void File::ParseName(InputStream& s, CStringW& name)
	{
		name.Empty();

		for(int c = s.SkipWhiteSpace(); iswcsym(c); c = s.PeekChar())
		{
			if(name.IsEmpty() && iswdigit(c)) s.ThrowError(_T("'name' cannot start with a number"));
			name += (WCHAR)s.GetChar();
		}
	}
Esempio n. 14
0
int csmember(wchar_t c, const charset *cset)
{
  return
    appearsin(c, cset->inlist) ||
    ( !appearsin(c, cset->outlist) &&
        ( (cset->flags & CS_LCASE && iswlower(*(wint_t *)&c)) ||
          (cset->flags & CS_UCASE && iswupper(*(wint_t *)&c)) ||
          (cset->flags & CS_DIGIT && iswdigit(*(wint_t *)&c)) ||
        (cset->flags & CS_NUL   && !c                           )   ) );
}
Esempio n. 15
0
// Get digits from input stream.
// This outputs characters to buffer with range checking, but no NULL termination.
// TODO: range checking
wchar_t* GisLexAwkt::getdigits(wchar_t* pstr)
{
    while (iswdigit(m_ch))
    {
        *pstr = m_ch;
        pstr++;
        m_ch = if_getch();
    }
    return pstr;
}
Esempio n. 16
0
/**
 * Determines whether the param only contains digits.
 *
 * @param str     The string to check
 * @param boolean True if the param only contains digits
 */
static bool
IsDigits(WCHAR *str)
{
  while (*str) {
    if (!iswdigit(*str++)) {
      return FALSE;
    }
  }
  return TRUE;
}
Esempio n. 17
0
void VDInputFileImages::Init(const wchar_t *szFile) {
	// Attempt to discern path format.
	//
	// First, find the start of the filename.  Then skip
	// backwards until the first period is found, then to the
	// beginning of the first number.

	mBaseName = szFile;
	const wchar_t *pszBaseFormat = mBaseName.c_str();

	const wchar_t *pszFileBase = VDFileSplitPath(pszBaseFormat);
	const wchar_t *s = pszFileBase;

	mLastDigitPos = -1;

	while(*s)
		++s;

	while(s > pszFileBase && s[-1] != L'.')
		--s;

	while(s > pszFileBase) {
		--s;

		if (iswdigit(*s)) {
			mLastDigitPos = s - pszBaseFormat;
			break;
		}
	}

	mFrames = 1;

	// Make sure the first file exists.
	vdfastvector<wchar_t> namebuf;
	if (!VDDoesPathExist(ComputeFilename(namebuf, 0)))
		throw MyError("File \"%ls\" does not exist.", namebuf.data());

	// Stat as many files as we can until we get an error.
	if (mLastDigitPos >= 0) {
		vdfastvector<wchar_t> namebuf;

		ProgressDialog pd(g_hWnd, "Image import filter", "Scanning for images", 0x3FFFFFFF, true);

		pd.setValueFormat("Scanning frame %lu");

		while(VDDoesPathExist(ComputeFilename(namebuf, mFrames))) {
			++mFrames;
			pd.advance((long)mFrames);
		}
	}

	// make sure the first frame is valid
	vdrefptr<IVDVideoSource> vs;
	GetVideoSource(0, ~vs);
}
Esempio n. 18
0
// PCA for term256 support, let's just detect the escape codes directly
static int is_term256_escape(const wchar_t *str) {
    // An escape code looks like this: \x1b[38;5;<num>m 
    // or like this: \x1b[48;5;<num>m 
    
    // parse out the required prefix
    int len = try_sequence("\x1b[38;5;", str);
    if (! len) len = try_sequence("\x1b[48;5;", str);
    if (! len) return 0;
    
    // now try parsing out a string of digits
    // we need at least one
    if (! iswdigit(str[len])) return 0;
    while (iswdigit(str[len])) len++;
    
    // look for the terminating m
    if (str[len++] != L'm') return 0;
    
    // success
    return len;
}
Esempio n. 19
0
static const lua_WChar *wscanformat (lua_State *L, const lua_WChar *strfrmt, lua_WChar *form) {
    const lua_WChar *p = strfrmt;
    while (*p != '\0' && lua_WChar_chr(wFLAGS, *p) != NULL) p++;  /* skip flags */
    if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
        luaL_error(L, "invalid format (repeated flags)");
    if (iswdigit(*p)) p++;  /* skip width */
    if (iswdigit(*p)) p++;  /* (2 digits at most) */
    if (*p == '.') {
        p++;
        if (iswdigit(*p)) p++;  /* skip precision */
        if (iswdigit(*p)) p++;  /* (2 digits at most) */
    }
    if (iswdigit(*p))
        luaL_error(L, "invalid format (width or precision too long)");
    *(form++) = '%';
    lua_WChar_ncpy(form, strfrmt, p - strfrmt + 1);
    form += p - strfrmt + 1;
    *form = '\0';
    return p;
}
Esempio n. 20
0
File: rcl.c Progetto: mingpen/OpenNT
LONG GetDNum()

{
    LONG n = 0;

    while (iswdigit(curCharFTB)) {
        n = n * 10 + (curCharFTB - L'0');
        GetCharFTB();
    }
    return (n);
}
Esempio n. 21
0
static const lua_WChar *scanformat (lua_State *L, const lua_WChar *strfrmt,
                                 lua_WChar *form, int *hasprecision) {
  const lua_WChar *p = strfrmt;
  while (lua_WChar_chr(L"-+ #0", *p)) p++;  /* skip flags */
  if (iswdigit(*p)) p++;  /* skip width */
  if (iswdigit(*p)) p++;  /* (2 digits at most) */
  if (*p == '.') {
    p++;
    *hasprecision = 1;
    if (iswdigit(*p)) p++;  /* skip precision */
    if (iswdigit(*p)) p++;  /* (2 digits at most) */
  }
  if (iswdigit(*p))
    luaL_error(L, "invalid format (width or precision too long)");
  if (p-strfrmt+2 > MAX_FORMAT)  /* +2 to include `%' and the specifier */
    luaL_error(L, "invalid format (too long)");
  form[0] = '%';
  lua_WChar_ncpy(form+1, strfrmt, p-strfrmt+1);
  form[p-strfrmt+2] = 0;
  return p;
}
Esempio n. 22
0
void ticksize_command(wchar_t *arg)
{
  if(*arg!='\0') {
    if(iswdigit(*arg)) {
      tick_size=_wtoi(arg);
      dwTime0=GetTickCount()/1000;
      tintin_puts2(rs::rs(1180));        
    }
  }
  else
    tintin_puts2(rs::rs(1181));
}     
Esempio n. 23
0
//---------------------------------------------------------------------------
//  IFXString::IsDigit
//
//  This method returns a bool based on if the specified character is a digit
//  or not
//---------------------------------------------------------------------------
IFXRESULT IFXString::IsDigit(U32 uIndex)
{
	IFXRESULT iResult=IFX_TRUE;
	if(uIndex > m_BufferLength)
		iResult=IFX_E_INVALID_RANGE;

	if(IFXSUCCESS(iResult))
	{
		iResult = iswdigit((wint_t)m_Buffer[uIndex]) != 0;
	}
	return iResult;
}
Esempio n. 24
0
static int
pg_wc_isdigit(pg_wchar c)
{
#ifdef USE_WIDE_UPPER_LOWER
	if (GetDatabaseEncoding() == PG_UTF8)
	{
		if (sizeof(wchar_t) >= 4 || c <= (pg_wchar) 0xFFFF)
			return iswdigit((wint_t) c);
	}
#endif
	return (c <= (pg_wchar) UCHAR_MAX && isdigit((unsigned char) c));
}
Esempio n. 25
0
bool iswdigit(wstring _String)
{
	for (wstring::const_iterator iter = _String.begin(); iter != _String.end(); iter++)
	{
		if (!iswdigit(*iter))
		{
			return false;
		}
	}

	return true;
}
Esempio n. 26
0
LONGLONG WcsToLLDec( _In_z_ const wchar_t* pNumber, _In_ wchar_t* endChar ) {
	LONGLONG temp = 0;
	while ( iswdigit( *pNumber ) ) {
		temp *= 10;
		temp += ( *pNumber - L'0' );
		++pNumber;
		}
	if ( endChar ) {
		*endChar = *pNumber;
		}
	return temp;
	}
Esempio n. 27
0
File: keys.c Progetto: jubalh/vifm
/* Checks keys for a count.  Returns non-zero if there is count in the current
 * position. */
static int
is_at_count(const wchar_t keys[])
{
	if((mode_flags[vle_mode_get()] & MF_USES_COUNT) != 0)
	{
		if(keys[0] != L'0' && iswdigit(keys[0]))
		{
			return 1;
		}
	}
	return 0;
}
Esempio n. 28
0
int w_numcmp(const void *a, const void *b)
{
	wchar_t *pa = ((const kw_t*)a)->w->s, *pb = ((const kw_t*)b)->w->s;
	int sa, sb, ea, eb;
	while (*pa && *pb) {
		if (iswdigit(*pa) && iswdigit(*pb)) {
			/* skip leading zeros */
			sa = sb = 0;
			while (pa[sa] == L'0') sa++;
			while (pb[sb] == L'0') sb++;
			/* find end of numbers */
			ea = sa; eb = sb;
			while (iswdigit(pa[ea])) ea++;
			while (iswdigit(pb[eb])) eb++;
			if (eb - sb > ea - sa) return -1;
			if (eb - sb < ea - sa) return 1;
			while (sb < eb) {
				if (pa[sa] > pb[sb]) return 1;
				if (pa[sa] < pb[sb]) return -1;
				sa++; sb++;
			}

			pa += ea; pb += eb;
		}
		else if (iswdigit(*pa)) return 1;
		else if (iswdigit(*pb)) return -1;
		else {
			if (*pa > *pb) return 1;
			if (*pa < *pb) return -1;
			pa++; pb++;
		}
	}
	return (!*pa && !*pb) ? 0 : *pa ?  1 : -1;
}
Esempio n. 29
0
File: wcstoui.c Progetto: mgya/xClib
unsigned int string_wcstoui(const xwchar_t * nptr, xwchar_t ** endptr, int base)
{
    register const xwchar_t * s = nptr;
    register unsigned int acc;
    register xwchar_t c;
    register unsigned int cutoff;
    register int neg = 0, any, cutlim;

    do {
    	c = *s++;
    } while (iswspace(c));
    if (c == L'-') {
    	neg = 1;
    	c = *s++;
    } else if (c == L'+')
    	c = *s++;
    if ((base == 0 || base == 16) &&
    	c == L'0' && (*s == L'x' || *s == L'X')) {
    	    c = s[1];
    	    s += 2;
    	    base = 16;
    }
    if (base == 0)
    	base = c == L'0' ? 8 : 10;

    cutoff = (unsigned int)XUINT32_MAX / (unsigned int)base;
    cutlim = (int)((unsigned int)XUINT32_MAX % (unsigned int)base);
    for (acc = 0, any = 0;; c = *s++) {
    	if (iswdigit(c))
    	    c -= L'0';
    	else if (iswalpha(c))
    	    c -= iswupper(c) ? L'A' - 10 : L'a' - 10;
    	else
    	    break;
    	if (c >= base)
    	    break;
    	if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
    	    any = -1;
    	else {
    	    any = 1;
    	    acc *= base;
    	    acc += c;
    	}
    }
    if (any < 0) {
    	acc = XUINT32_MAX;
    } else if (neg)
    	acc = (unsigned int)(-(xint64_t)acc);
    if (endptr != 0)
    	*endptr = (xwchar_t *) (any ? s - 1 : nptr);
    return (acc);
}
Esempio n. 30
0
int
main (void)
{
  /* Check that the isw* functions exist as functions or as macros.  */
  (void) iswalnum (0);
  (void) iswalpha (0);
  (void) iswcntrl (0);
  (void) iswdigit (0);
  (void) iswgraph (0);
  (void) iswlower (0);
  (void) iswprint (0);
  (void) iswpunct (0);
  (void) iswspace (0);
  (void) iswupper (0);
  (void) iswxdigit (0);

  /* Check that the isw* functions map WEOF to 0.  */
  ASSERT (!iswalnum (e));
  ASSERT (!iswalpha (e));
  ASSERT (!iswcntrl (e));
  ASSERT (!iswdigit (e));
  ASSERT (!iswgraph (e));
  ASSERT (!iswlower (e));
  ASSERT (!iswprint (e));
  ASSERT (!iswpunct (e));
  ASSERT (!iswspace (e));
  ASSERT (!iswupper (e));
  ASSERT (!iswxdigit (e));

  /* Check that the tow* functions exist as functions or as macros.  */
  (void) towlower (0);
  (void) towupper (0);

  /* Check that the tow* functions map WEOF to WEOF.  */
  ASSERT (towlower (e) == e);
  ASSERT (towupper (e) == e);

  return 0;
}