Beispiel #1
0
void Ge::activate_export_javabean_as()
{
    char name[80];
    char default_name[80];

    if ( !(graph->is_javaapplication() || graph->is_javaapplet())) {
        message( 'I', "This graph is not java frame or applet");
        return;
    }

    if ( !graph->get_java_name( name)) {
        graph->get_name( name);
        if ( strcmp( name, "") != 0) {
            if ( strncmp( name, "pwr_", 4) == 0) {
                strcpy( default_name, "Jop");
                strcat( default_name, &name[4]);
                default_name[3] = _toupper( default_name[3]);
            }
            else {
                strcpy( default_name, name);
                default_name[0] = _toupper( default_name[0]);
            }
        }
        else
            strcpy( default_name, "");
    }
    else
        strcpy( default_name, name);
    open_input_dialog( "JavaBean name", "Export JavaBean",
                       default_name, Ge::export_javabean);
}
Beispiel #2
0
void Ge::activate_export_javabean()
{
    char name[80];
    char default_name[80];

    if ( ! graph->get_java_name( name)) {
        graph->get_name( name);
        if ( strcmp( name, "") != 0) {
            if ( strncmp( name, "pwr_", 4) == 0) {
                strcpy( default_name, "Jop");
                strcat( default_name, &name[4]);
                default_name[3] = _toupper( default_name[3]);
            }
            else {
                strcpy( default_name, name);
                default_name[0] = _toupper( default_name[0]);
            }
        }
        else
            strcpy( default_name, "");
        open_input_dialog( "JavaBean name", "Export JavaBean",
                           default_name, Ge::export_javabean);
    }
    else
        Ge::export_javabean( this, name);
}
Beispiel #3
0
void Ge::activate_export_gejava_as()
{
    char name[80];
    char default_name[80];

    if ( !graph->get_java_name( name)) {
        graph->get_name( name);
        if ( strcmp( name, "") != 0) {
            if ( strncmp( name, "pwr_c_", 6) == 0) {
                strcpy( default_name, "Jopc");
                strcat( default_name, &name[6]);
                default_name[4] = _toupper( default_name[4]);
            }
            else if ( strncmp( name, "pwr_", 4) == 0) {
                strcpy( default_name, "Jop");
                strcat( default_name, &name[4]);
                default_name[3] = _toupper( default_name[3]);
            }
            else {
                strcpy( default_name, name);
                default_name[0] = _toupper( default_name[0]);
            }
        }
        else
            strcpy( default_name, "");
    }
    else
        strcpy( default_name, name);
    open_input_dialog( "Java name", "Export GeJava",
                       default_name, Ge::export_gejava);
}
void ForeignToUpper(_TCHAR *buffer)
	{
	int i = 0;
	while (buffer[i])
		{
		if (gLangIDNum != F4LANG_ENGLISH)
			{
			// Check for special characters
			if ((uchar)(buffer[i]) >= 224 && (uchar)(buffer[i]) <=253)
				buffer[i] -= 32;
			else if (_istlower(buffer[i]))
				buffer[i] = _toupper(buffer[i]);
/*
			switch (buffer[i])
				{
				case 'è':
				case 'é':
				case 'ë':
				case 'ê':
					buffer[i] = 'E';
					break;
				case 'â':
				case 'à':
				case 'á':
				case 'ä':
					buffer[i] = 'A';
					break;
				case 'ì':
				case 'í':
				case 'î':
				case 'ï':
					buffer[i] = 'I';
					break;
				case 'û':
				case 'ú':
				case 'ù':
				case 'ü':
					buffer[i] = 'U';
					break;
				case 'ç':
					buffer[i] = 'C';
					break;
				case 'ñ':
					buffer[i] = 'N';
					break;
				case 'ô':
				case 'ö':
					buffer[i] = 'O';
					break;
				default:
					if (_istlower(buffer[i]))
						buffer[i] = _toupper(buffer[i]);
				}
*/
			}
		else if (_istlower(buffer[i]))
			buffer[i] = _toupper(buffer[i]);
		i++;
		}
	}
Beispiel #5
0
static long generateRegistrationCode(const char* name,
									 const char* organization, const char* key)
{
	static char buf[4096];
	static unsigned char outbuf[4096];

	char* p = 0;
	char* q = 0;
	int length = 0;
	long* longs = 0;
	long sum = 0;
	int numLongs = 0;
	int i = 0;

	p = (char*)name;
	q = buf;
	while (*p)
	{
		if (isalnum(*p))
		{
			if (islower(*p))
				*q = _toupper(*p);
			else
				*q = *p;
			q++;
		}
		p++;
	}
	p = (char*)organization;
	while (*p)
	{
		if (isalnum(*p))
		{
			if (islower(*p))
				*q = _toupper(*p);
			else
				*q = *p;
			q++;
		}
		p++;
	}
	*q = 0;

	length = (int)(q - buf);

	des.encrypt(key, (unsigned char*)buf, length);
	des.exportBinary(outbuf);
	longs = (long*)outbuf;

	numLongs = length / 4;
	for (i = 0; i < numLongs; i++)
		sum += longs[i];
	if (sum < 0)
		sum = -sum;
	return sum;
}
Beispiel #6
0
void F_CastPrint (char* text)
{
    char*	ch;
    int		c;
    int		cx;
    int		w;
    int		width;
    
    // find width
    ch = text;
    width = 0;
	
    while (ch)
    {
	c = *ch++;
	if (!c)
	    break;
	c = _toupper(c) - HU_FONTSTART;
	if (c < 0 || c> HU_FONTSIZE)
	{
	    width += 4;
	    continue;
	}
		
	w = SHORT (hu_font[c]->width);
	width += w;
    }
    
    // draw it
    cx = 160-width/2;
    ch = text;
    while (ch)
    {
	c = *ch++;
	if (!c)
	    break;
	c = _toupper(c) - HU_FONTSTART;
	if (c < 0 || c> HU_FONTSIZE)
	{
	    cx += 4;
	    continue;
	}
		
	w = SHORT (hu_font[c]->width);
	V_DrawPatch(cx, 180, 0, hu_font[c]);
	cx+=w;
    }
	
}
Beispiel #7
0
int main (void)
{
    char c;

    printf ("Enter the character to test: ");
    scanf ("%c", &c);

    printf ("isalpha ('%c') is %s\n", c, isalpha ((int) c) ? "True" : "False");
    printf ("isalnum ('%c') is %s\n", c, isalnum ((int) c) ? "True" : "False");
    printf ("isascii ('%c') is %s\n", c, isascii ((int) c) ? "True" : "False");
    printf ("iscntrl ('%c') is %s\n", c, iscntrl ((int) c) ? "True" : "False");
    printf ("isdigit ('%c') is %s\n", c, isdigit ((int) c) ? "True" : "False");
    printf ("isgraph ('%c') is %s\n", c, isgraph ((int) c) ? "True" : "False");
    printf ("islower ('%c') is %s\n", c, islower ((int) c) ? "True" : "False");
    printf ("isprint ('%c') is %s\n", c, isprint ((int) c) ? "True" : "False");
    printf ("ispunct ('%c') is %s\n", c, ispunct ((int) c) ? "True" : "False");
    printf ("isspace ('%c') is %s\n", c, isspace ((int) c) ? "True" : "False");
    printf ("isupper ('%c') is %s\n", c, isupper ((int) c) ? "True" : "False");
    printf ("isxdigit ('%c') is %s\n\n", c,
            isxdigit ((int) c) ? "True" : "False");

    printf ("tolower ('%c') gives %c\n", c, tolower ((int) c));
    printf ("_tolower ('%c') gives %c\n", c, _tolower ((int) c));
    printf ("toupper ('%c') gives %c\n", c, toupper ((int) c));
    printf ("_toupper ('%c') gives %c\n", c, _toupper ((int) c));
    printf ("toascii ('%c') gives %c\n", c, toascii ((int) c));

    return (0);
}
Beispiel #8
0
void RBench::InitTrace()
{   char c;

    printf("Trace (y/n)? ");
    c = getchar();
    tracing = (_toupper(c) == 'Y');
}
Beispiel #9
0
int toupper(int c) {
#if !CAM_DRYOS
	return _toupper(c);
#else
	return islower(c) ? c - 'a' + 'A' : c;
#endif
}
Beispiel #10
0
void
ExtractFileBase
( char*		path,
  char*		dest )
{
    char*	src;
    int		length;

    src = path + strlen(path) - 1;
    
    // back up until a \ or the start
    while (src != path
	   && *(src-1) != '\\'
	   && *(src-1) != '/')
    {
	src--;
    }
    
    // copy up to eight characters
    memset (dest,0,8);
    length = 0;
    
    while (*src && *src != '.')
    {
	if (++length == 9)
	    I_Error ("Filename base of %s >8 chars",path);

	*dest++ = _toupper((int)*src++);
    }
}
Beispiel #11
0
static void
test__toupper (void)
{
	int i, j;
	for (i = -127; i < 256; )
		j = i, printf ("%s: %d -> %d\n", __FUNCTION__, j, _toupper (i++));
}
Beispiel #12
0
static int hex2bin( int c )
{
     /* Convert the hex digit represented by 'c' to an int. 'c'
      * must be one of: 0123456789abcdefABCDEF
      */
     return (_istdigit(c) ? (c)-_T('0') : ((_toupper(c))-_T('A'))+10)  & 0xf;
}
Beispiel #13
0
int
nt_sync(int cdrive)
{
    FD_t drive_fd;
    char sdrive[32];
    int n;

    n = cdrive;
    if (n <= 26) {
	cdrive = 'A' + (n - 1);
    }

    cdrive = _toupper(cdrive);

    (void)sprintf(sdrive, "\\\\.\\%c:", cdrive);
    drive_fd = nt_open(sdrive, O_RDWR, 0666);
    if (drive_fd == INVALID_FD) {
	return -1;
    }

    if (!FlushFileBuffers((HANDLE) drive_fd)) {
	errno = nterr_nt2unix(GetLastError(), EBADF);
	nt_close(drive_fd);
	return -1;
    }
    nt_close(drive_fd);
    return 0;
}
void ShiftAnd::compile(const String &pattern, bool ignoreCase) {
  m_patternLen = (int)pattern.length();
  if(m_patternLen >= 64) {
    throwException(_T("<%s> too long for shiftand-search. max length is 63"), pattern.cstr());
  }
  memset(m_mask, -1, sizeof(m_mask));
  for(int i = 0; i < m_patternLen; i++) {
    const _TUCHAR ch = pattern[i];
    m_mask[ch] &= ~((UINT64)1 << i);
    if (ignoreCase) {
      if (_istlower(ch)) {
        m_mask[_toupper(ch)] &= ~((UINT64)1 << i);
      } else if(_istupper(ch)) {
        m_mask[_tolower(ch)] &= ~((UINT64)1 << i);
      }
    }
  }
  m_s = (UINT64)1 << m_patternLen;
#ifdef _TEST_CLASS
  for(int i = 0; i < ARRAYSIZE(m_mask); i++) {
    const UINT64 mask = m_mask[i];
    if(mask != -1) {
      _tprintf(_T("mask[%c]:%s\n"), i, sprintbin(mask).cstr());
    }
  }
#endif
}
BOOL STDAPICALLTYPE wildcmp(const std::wstring & str, const std::wstring & w )
{
    const WCHAR *string = str.c_str();
    const WCHAR *wild = w.c_str();

    const WCHAR *cp, *mp;
    cp = mp = NULL;

    while ((*string) && (*wild != _T('*')))
    {
        if ((_toupper(*wild) != _toupper(*string)) && (*wild != _T('?')))
        {
            return FALSE;
        }
        wild++;
        string++;
    }

    while (*string)
    {
        if (*wild == _T('*'))
        {
            if (!*++wild)
            {
                return TRUE;
            }
            mp = wild;
            cp = string+1;
        }
        else if ((_toupper(*wild) == _toupper(*string)) || (*wild == _T('?')))
        {
            wild++;
            string++;
        }
        else
        {
            wild = mp;
            string = cp++;
        }
    }

    while (*wild == _T('*'))
    {
        wild++;
    }
    return (!*wild)? TRUE : FALSE;
}
Beispiel #16
0
void SentenceCase (CString& str)
{
	if (str.GetLength () == 0)
		return;

	str.MakeLower ();	
	str.SetAt (0, _toupper (str[0]));
}
Beispiel #17
0
// calculate the drive letter value for _chdrive().  ascii in, int out 
int wfe_MapAsciiToDriveNum(char cAsciiNum)
{
    int iDriveLetter = cAsciiNum;
    if(islower(cAsciiNum))
        iDriveLetter = _toupper(cAsciiNum);
    // plus one because for _chdrive(),  A = 1, B = 2, etc
    return iDriveLetter - 'A' + 1;
}
Beispiel #18
0
int
strabbr (
	char	*tst_,
	char	*ref_,
	int	cmplen,
	int	abbr)
{
	while (*tst_ && *ref_ && (cmplen > 0))
	{
		if (_toupper(*tst_) != _toupper(*ref_))	break;
		tst_++;
		ref_++;
		cmplen--;
		abbr--;
	}
	return ((abbr <= 0) && (cmplen <= 0));
}
Beispiel #19
0
static void tokencat ( char c ) {
  if ( is_lower ( c ) ) {
    c = _toupper ( c );
  }
  char *eot = strchr ( g_sb_token, '\0' );
  *eot = c;
  *(eot + 1) = '\0';
}
Beispiel #20
0
void upper_case( std::string &str )
{
	for ( unsigned int i = 0; i<str.length(); i++ ) {
		if ( str[i] >= 'a' && str[i] <= 'z' ) {
			str[i] = _toupper( str[i] );
		}
	}
}
BOOL STDAPICALLTYPE wildcmp(LPCTSTR string, LPCTSTR wild ) 
{
	const TCHAR *cp, *mp;
	cp = mp = NULL;
	
	while ((*string) && (*wild != _T('*'))) 
	{
		if ((_toupper(*wild) != _toupper(*string)) && (*wild != _T('?'))) 
		{
			return FALSE;
		}
		wild++;
		string++;
	}
		
	while (*string) 
	{
		if (*wild == _T('*')) 
		{
			if (!*++wild) 
			{
				return TRUE;
			}
			mp = wild;
			cp = string+1;
		} 
		else 
		if ((_toupper(*wild) == _toupper(*string)) || (*wild == _T('?'))) 
		{
			wild++;
			string++;
		} 
		else 
		{
			wild = mp;
			string = cp++;
		}
	}
		
	while (*wild == _T('*')) 
	{
		wild++;
	}
	return (!*wild)? TRUE : FALSE;
}
void main (void)
{
    char string [] = "Biblia do Programador C/C++, do Jamsa";
    int i;

    for (i = 0; string [i]; i++)
        putchar (toupper (string [i]));
    putchar ('\n');
    for (i = 0; string [i]; i++)
        putchar (_toupper (string [i]));
    putchar ('\n');

}
LPTSTR strToUpper(LPTSTR dest, LPCTSTR src)
{
	LPTSTR start = dest;

	while (*dest = *src) {
		if (_istlower(*dest))
			*dest = _toupper(*dest);
		dest++;
		src++;
	}

	return start;
}
Beispiel #24
0
static void unsignedHexadecimal(void)
{
  /* FORM: integer-number = decimal-integer | hexadecimal-integer |
   *       binary-integer
   * FORM: hexadecimal-integer = '$' hex-digit-sequence
   * FORM: hex-digit-sequence = hex-digit { hex-digit }
   * FORM: hex-digit = digit | 'a' | 'b' | 'c' | 'd' | 'e' | 'f'
   *
   * On entry, inChar is '$'
   */

  /* This is another representation for an integer */

  token = tINT_CONST;

  /* Loop to process each hex 'digit' */

  for (;;)
    {
      /* Get the next character */

      getCharacter();

      /* Is it a decimal digit? */

      if (isdigit(inChar))
        *stringSP++ = inChar;

      /* Is it a hex 'digit'? */

      else if ((inChar >= 'A') && (inChar <= 'F'))
        *stringSP++ = inChar;

      else if ((inChar >= 'a') && (inChar <= 'f'))
        *stringSP++ = _toupper(inChar);

      /* Otherwise, that must be the end of the hex value */

      else break;
    }

  /* Terminate the hex string and convert to binary using sscanf */

  *stringSP++ = '\0';
  (void)sscanf(tkn_strt, "%lx", &tknInt);

  /* Remove the hex string from the character identifer stack */

  stringSP = tkn_strt;
}
Beispiel #25
0
char * strupr (char *s)
{
	char c;
	char *old = s;
	
	while ((c = *s) != 0)
	{
		if (islower (c))
			*s = _toupper(c);
		
		s++;
	}
	
	return old;
}
Beispiel #26
0
char *
strucpy (
	char	*optr,			/* => output string		*/
	char	*iptr)			/* => input string		*/
{
	if (!iptr)	iptr = optr;

	while (*iptr)
	{
		*optr++ = _toupper(*iptr);
		iptr++;
	}
	*optr = '\0';			/* Copy a trailing null		*/
	return (optr);
}
Beispiel #27
0
void title_case( std::string &str )
{
	bool upper = true;
	for ( unsigned int i = 0; i<str.length(); i++ ) {
		if (upper) {
			if ( str[i] >= 'a' && str[i] <= 'z' ) {
				str[i] = _toupper( str[i] );
			}
		} else {
			if ( str[i] >= 'A' && str[i] <= 'Z' ) {
				str[i] = _tolower( str[i] );
			}
		}
		upper = isspace(str[i]);
	}
}
Beispiel #28
0
/* <dclarg_text>:
 * Allocate (or re-allocate) a 'DCLARG' entry, given the text-buffer to load.
 * This procedure can be used to allocate a new entry (if 'this_' is null), or
 * to reallocate an entry when the text buffer's size has altered.  The status
 * and field indices are unaltered.
 */
DCLARG	*dclarg_text(
	DCLARG	*this_,		/* Entry to (re)allocate	*/
	DCLARG	*last_,		/* Entry containing link to it	*/
	char	*s_,		/* Text-buffer (mustn't be null)*/
	int	uc)		/* TRUE if uppercase		*/
{
	size_t	size	= sizeof(DCLARG) + strlen(s_) + 2;
	char	*text_;

	if (this_)	this_	= realloc (this_, size);
	else		this_	= calloc (1, size);

	this_->dcl_size	= strlen(s_);
	text_	= (char *) this_ + sizeof(DCLARG);

	/*
	 * Strip out blanks from the string as I load it.  (patch: Should look
	 * for quoted strings here.)
	 */
	for (this_->dcl_text = text_; *s_; s_++)
	{
		if (!uc || !isspace(*s_))	*text_++ = *s_;
	}
	*text_ = EOS;

	/*
	 * Do uppercase conversion if needed.  This is used for all filenames
	 * and option strings.  Error messages are left alone.
	 */
	if (uc)
	{
		for (text_ = this_->dcl_text; *text_; text_++)
			*text_ = _toupper(*text_);
	}
	if (last_ != 0)
		last_->dcl_next = (DCLARG *)this_;
	/*
	 * Don't allow empty name ".;" -- trim it off
	 */
	if ((size = strlen(text_ = this_->dcl_text)) > 2)
	{
		if (!strcmp(text_ + size - 2, ".;"))
			text_[size-2] = EOS;
	}
	return (this_);
}
Beispiel #29
0
char* to_c(char *token, char *c_token, int toupper)
{
	char *c_t = c_token;
	char *t = token;
	if (isdigit(*t)) {
		*c_t++ = '_';
	}
	for (; *t; ++t, ++c_t) {
		if (!isalnum(*t)) {
			*c_t = '_';
		} else {
			*c_t = toupper ? _toupper(*t) : *t;
		}
	}
	*c_t = 0;

	return c_token;
}
Beispiel #30
0
int CTriangleObj::LoadFile(const char *fname)
{
	FILE *fp;
	char filename[512];
	char * strExtensions[] = {".PLT", ".PLY", ".TXT", ".STL", ".OFF", ""};
	char * ftype = NULL;
	int i, flag;

	fp = fopen(fname, _RA_);
	if (fp==NULL) return 0;

	int len = strlen(fname);
	assert(len<512);
	filename[0]= fname[len-4];
	for (i=1; i<4; i++){
		int j = len-4+i;
#ifdef WIN32
		filename[i] = _toupper(fname[j]);
#else
		filename[i] = toupper(fname[j]);
#endif

	}
	filename[4]=0;

	for (i=0; strExtensions[i][0]!=0; i++){
		if (strcmp(filename, strExtensions[i])==0){
			ftype = strExtensions[i];
			break;
		}
	}

	flag = 0;	
	if (ftype)
		flag = LoadFile(fp, ftype);

	fclose(fp);
	return flag;
}