コード例 #1
0
ファイル: robocompiler.c プロジェクト: stevely/New-Robowar
static int build_token_list_s( char *s, size_t size ) {
    char curr_char;
    size_t index;
    int ident_pos;
    int current_line;
    if( !s ) {
        return -1;
    }
    index = 0;
    curr_char = s[index];
    current_line = 1;
    while( index <= size ) {
        /* Ident builder */
        if( isalpha(curr_char) ) {
            ident_pos = 0;
            do {
                ident_buf[ident_pos] = curr_char;
                ident_pos++;
                index++;
                curr_char = s[index];
            } while( index <= size && isalphanum(curr_char) && ident_pos < IDENTBUF_SIZE );
            build_token_ident(ident_pos, current_line);
            continue;
        }
        /* Number builder */
        else if( isnum(curr_char) || curr_char == '-' ) {
            ident_pos = 0;
            do {
                ident_buf[ident_pos] = curr_char;
                ident_pos++;
                index++;
                curr_char = s[index];
            } while( index <= size && isnum(curr_char)  && ident_pos < IDENTBUF_SIZE );
            build_token_num(ident_pos, current_line);
            continue;
        }
        /* Grab commas */
        else if( curr_char == ',' ) {
            build_token_comma(current_line);
        }
        /* Grab semicolons */
        else if( curr_char == ':' ) {
            build_token_colon(current_line);
        }
        /* Handle comments */
        else if( curr_char == '#' ) {
            /* Eat everything until EOL */
            do {
                index++;
                curr_char = s[index];
            } while( index <= size && curr_char != '\n' && curr_char != '\r' );
        }
        if( curr_char == '\n' ) {
            current_line++;
        }
        index++;
        curr_char = s[index];
    }
    return 0;
}
コード例 #2
0
ファイル: api.c プロジェクト: axcoto-lab/Sparkling
static int numeric_compare(const SpnValue *lhs, const SpnValue *rhs)
{
	assert(isnum(lhs) && isnum(rhs));

	if (isfloat(lhs)) {
		if (isfloat(rhs)) {
			return floatvalue(lhs) < floatvalue(rhs) ? -1
			     : floatvalue(lhs) > floatvalue(rhs) ? +1
			     :                                      0;
		} else {
			return floatvalue(lhs) < intvalue(rhs) ? -1
			     : floatvalue(lhs) > intvalue(rhs) ? +1
			     :                                    0;
		}
	} else {
		if (isfloat(rhs)) {
			return intvalue(lhs) < floatvalue(rhs) ? -1
			     : intvalue(lhs) > floatvalue(rhs) ? +1
			     :                                    0;
		} else {
			return intvalue(lhs) < intvalue(rhs) ? -1
			     : intvalue(lhs) > intvalue(rhs) ? +1
			     :                                  0;
		}
	}
}
コード例 #3
0
ファイル: nanosvg.c プロジェクト: DINKIN/omim
static int parseTransformArgs(const char* str, float* args, int maxNa, int* na)
{
	const char* end;
	const char* ptr;

	*na = 0;
	ptr = str;
	while (*ptr && *ptr != '(') ++ptr;
	if (*ptr == 0)
		return 1;
	end = ptr;
	while (*end && *end != ')') ++end;
	if (*end == 0)
		return 1;

	while (ptr < end)
	{
		if (isnum(*ptr))
		{
			if (*na >= maxNa) return 0;
			args[(*na)++] = (float)atof(ptr);
			while (ptr < end && isnum(*ptr)) ++ptr;
		}
		else
		{
			++ptr;
		}
	}
	return (int)(end - str);
}
コード例 #4
0
ファイル: file.c プロジェクト: smiley22/myPS2
int IsPartitionRoot( const char *path )
{
	char 	*p;

	if( (p = strstr( path, "pfs" )) == NULL )
		return 0;

	p += 3;

	if( !isnum(*p) )
		return 0;

	while( isnum(*p) )
		p++;

	if( *p != ':' )
		return 0;

	p++;

	if( *p == 0 )
		return 1;

	if( *p != '/' )
		return 0;

	p++;

	if( *p != 0 )
		return 0;

	return 1;
}
コード例 #5
0
void ofxSVGPathParser::getNextPathItem(string::iterator &s, char* it)
{
	int i = 0;
	it[0] = '\0';
	// Skip white spaces and commas
	while (*s && (isspace(*s) || *s == ',')) ++s;
	if (!*s) return;
	if (*s == '-' || *s == '+' || isnum(*s))
	{
		while (*s == '-' || *s == '+')
		{
			if (i < 63) it[i++] = *s;
			++s;
		}
		while (*s && *s != '-' && *s != '+' && isnum(*s))
		{
			if (i < 63) it[i++] = *s;
			++s;
		}
		it[i] = '\0';
	}
	else
	{
		it[0] = *s;
		it[1] = '\0';
		++s;
		return;
	}
	return;
}
コード例 #6
0
ファイル: nanosvg.c プロジェクト: DINKIN/omim
static const char* getNextPathItem(const char* s, char* it)
{
	int i = 0;
	it[0] = '\0';
	// Skip white spaces and commas
	while (*s && (isspace(*s) || *s == ',')) s++;
	if (!*s) return s;
	if (*s == '-' || *s == '+' || isnum(*s))
	{
		while (*s == '-' || *s == '+')
		{
			if (i < 63) it[i++] = *s;
			s++;
		}
		while (*s && *s != '-' && *s != '+' && isnum(*s))
		{
			if (i < 63) it[i++] = *s;
			s++;
		}
		it[i] = '\0';
	}
	else
	{
		it[0] = *s++;
		it[1] = '\0';
		return s;
	}
	return s;
}
コード例 #7
0
ファイル: get_calc.c プロジェクト: Frozenhorns/project
void            get_calc(t_list **list, char *ref_num, char *ref_op)
{
  char		op;
  t_list	*nb1;
  t_list	*nb2;

  *list = (*list)->befo;
  while ((*list)->befo != NULL && isnum((*list)->cha, ref_num) == 1)
    *list = (*list)->befo;
  if ((*list)->next != NULL && isop((*list)->cha, ref_op) == 2)
    {
      *list = (*list)->next;
      op = ((*list)->befo)->cha;
    }
  else
    op = (*list)->cha;
  nb2 = take_nb(*list, ref_num);
  *list = (*list)->befo;
  while ((*list) != NULL && isnum((*list)->cha, ref_num) == 0)
    *list = (*list)->befo;
  while ((*list)->befo != NULL && isnum(((*list)->befo)->cha, ref_num) == 1)
    *list = (*list)->befo;
  if ((*list)->befo != NULL && isop(((*list)->befo)->cha, ref_op) == 2)
    *list = (*list)->befo;
  nb1 = take_nb(*list, ref_num);
  *list = replace(list, calc(nb1, isop(op, ref_op), nb2, NUM_OP), NUM_OP);
  del_par(list, ref_num, ref_op);
}
コード例 #8
0
ファイル: api.c プロジェクト: axcoto-lab/Sparkling
int spn_value_compare(const SpnValue *lhs, const SpnValue *rhs)
{
	if (isnum(lhs) && isnum(rhs)) {
		return numeric_compare(lhs, rhs);
	}

	/* else assume comparable objects */
	return spn_object_cmp(objvalue(lhs), objvalue(rhs));
}
コード例 #9
0
ファイル: robocompiler.c プロジェクト: stevely/New-Robowar
static int build_token_list_f( FILE *fp ) {
    int curr_char;
    int ident_pos;
    int current_line;
    if( !fp ) {
        return -1;
    }
    curr_char = get_next_char(fp);
    current_line = 1;
    while( curr_char != EOF ) {
        /* Ident builder */
        if( isalpha(curr_char) ) {
            ident_pos = 0;
            do {
                ident_buf[ident_pos] = curr_char;
                ident_pos++;
                curr_char = get_next_char(fp);
            } while( curr_char != EOF && isalphanum(curr_char) && ident_pos < IDENTBUF_SIZE );
            build_token_ident(ident_pos, current_line);
            continue;
        }
        /* Number builder */
        else if( isnum(curr_char) || curr_char == '-' ) {
            ident_pos = 0;
            do {
                ident_buf[ident_pos] = curr_char;
                ident_pos++;
                curr_char = get_next_char(fp);
            } while( curr_char != EOF && isnum(curr_char)  && ident_pos < IDENTBUF_SIZE );
            build_token_num(ident_pos, current_line);
            continue;
        }
        /* Grab commas */
        else if( curr_char == ',' ) {
            build_token_comma(current_line);
        }
        /* Grab semicolons */
        else if( curr_char == ':' ) {
            build_token_colon(current_line);
        }
        /* Handle comments */
        else if( curr_char == '#' ) {
            /* Eat everything until EOL */
            do {
                curr_char = get_next_char(fp);
            } while( curr_char != EOF && curr_char != '\n' && curr_char != '\r' );
        }
        if( curr_char == '\n' ) {
            current_line++;
        }
        curr_char = get_next_char(fp);
    }
    return 0;
}
コード例 #10
0
ファイル: api.c プロジェクト: axcoto-lab/Sparkling
static int numeric_equal(const SpnValue *lhs, const SpnValue *rhs)
{
	assert(isnum(lhs) && isnum(rhs));

	if (isfloat(lhs)) {
		return isfloat(rhs) ? floatvalue(lhs) == floatvalue(rhs)
		                    : floatvalue(lhs) == intvalue(rhs);
	} else {
		return isfloat(rhs) ? intvalue(lhs) == floatvalue(rhs)
		                    : intvalue(lhs) == intvalue(rhs);
	}
}
コード例 #11
0
static int
check_args(void)
{
	if (isnum(N) && lessp(N, zero))
		return 0;
	else if (isnum(K) && lessp(K, zero))
		return 0;
	else if (isnum(N) && isnum(K) && lessp(N, K))
		return 0;
	else
		return 1;
}
コード例 #12
0
ファイル: expression_working.cpp プロジェクト: tdrhq/openmath
/**convert to components in stack. FIFO*/
void convert_to_components(COMPONENTAR &component, const char *str)
{
        String s;
	s=str;
        const char *ps= s;

        const char *p=ps;
	String cur;
        while(*p!='\0')
        {
	        //assert(*p!=' ');
		
	        cur="";

                while(*p==' ') p++;
                if(!*p) break;
		
                if(*p=='%'){
                        cur="%";
                        p++;
                        while(isnum(*p)){
                                cur+=*p;
                                if(isalpha(*p)) cout<<*p
					<<":invalid alphabet\n" ;
                                p++;
                        }
                }
                else if(isliteralchar(*p)) {
                        while(isalpha(*p) || isnum(*p)){
                                cur+=*p;
                                p++;
                        }
                }
                else if(isnum(*p)){
			
			while(isnum(*p) || *p=='.'){
				cur+=*p;
				p++;
			}
		}
		else{
                        //oper or brack or
                        cur=*p;
                        p++;
		}
		component.add(cur);
                        
                
        }
	component.debug_dump("str_to_cpt");
                        
        
}
コード例 #13
0
ファイル: 102chiffrement.c プロジェクト: k6s/tek1
char		get_key(char *c1, char *c2, char *c3, char *c4, int *key)
{
  if (isnum(c1) && isnum(c2) && isnum(c3) && isnum(c4))
    {
      key[0] = atoi(c1);
      key[2] = atoi(c2);
      key[1] = atoi(c3);
      key[3] = atoi(c4);
      if ((key[0] * key[3] - key[1] * key[2]))
	return (1);
    }
  return (0);
}
コード例 #14
0
ファイル: metadata_str.c プロジェクト: Overx/showtime
void
metadata_filename_to_title(const char *filename, int *yearp, rstr_t **titlep)
{
  int year = 0;

  char *s = mystrdupa(filename);

  url_deescape(s);

  int i = strlen(s);

  while(i > 0) {
    
    if(i > 5 && s[i-5] == '.' &&
       isnum(s[i-4]) && isnum(s[i-3]) && isnum(s[i-2]) && isnum(s[i-1])) {
      year = atoi(s + i - 4);
      i -= 5;
      s[i] = 0;
      continue;
    }

    if(i > 7 && s[i-7] == ' ' && s[i-6] == '(' && 
       isnum(s[i-5]) && isnum(s[i-4]) && isnum(s[i-3]) && isnum(s[i-2]) &&
       s[i-1] == ')') {
      year = atoi(s + i - 5);
      i -= 7;
      s[i] = 0;
      continue;
    }

    int j;
    for(j = 0; stopstrings[j] != NULL; j++) {
      int len = strlen(stopstrings[j]);
      if(i > len+1 && (s[i-len-1] == '.' || s[i-len-1] == ' ') &&
	 !strncasecmp(s+i-len, stopstrings[j], len) &&
	 (s[i] == '.' || s[i] == ' ' || s[i] == '-' || s[i] == 0)) {
	i -= len+1;
	s[i] = 0;
	break;
      }
    }
    
    if(stopstrings[j] != NULL)
      continue;

    i--;
  }

  for(i = 0; s[i]; i++) {
    if(s[i] == '.') {
      s[i] = ' ';
    }
  }
 
  if(yearp != NULL)
    *yearp = year;

  if(titlep != NULL)
    *titlep = rstr_alloc(s);
}
コード例 #15
0
ファイル: placas.cpp プロジェクト: jccarvalhosa/maratona
long long val(char *p)
{
    long long pos, total;
    int i;
    if(isnum(p[3]))
    {
        pos = 0;
        total = 1;
        for(i=6;i>=3;i--)
        {
            pos += (p[i] - '0') * total;
            if(isalpha(p[i])) return -1;
            total *= 10;
        }
        for(i=2;i>=0;i--)
        {
            if(isnum(p[i])) return -1;
            pos += (p[i] - 'A') * total;
            total *= 26;
        }
    }
    else
    {
        pos = 175760000;
        total = 1;
        for(i=6;i>=5;i--)
        {
            if(isalpha(p[i])) return -1;
            pos += (p[i] - '0') * total;
            total *= 10;
        }
        for(i=4;i>=0;i--)
        {
            if(isnum(p[i])) return -1;
            else if(p[i] == 'A') return -1;
            else if(p[i] < 'C') pos += (p[i] - 'A' - 1) * total;
            else if(p[i] == 'C') return -1;
            else if(p[i] < 'I') pos += (p[i] - 'A' - 2) * total;
            else if(p[i] == 'I') return -1;
            else if(p[i] < 'M') pos += (p[i] - 'A' - 3) * total;
            else if(p[i] == 'M') return -1;
            else if(p[i] < 'P') pos += (p[i] - 'A' - 4) * total;
            else if(p[i] == 'P') return -1;
            else pos += (p[i] - 'A' - 5) * total;
            total *= 21;
        }
    }
    return pos;
}
コード例 #16
0
ファイル: a.c プロジェクト: noodles-v6/ACM
int main()
{
   int n,a,b,c;

   scanf("%d",&n);
   while(n--) {
      scanf("%s + %s = %s",s,t,u);
      a=strtol(s,NULL,10);
      b=strtol(t,NULL,10);
      c=strtol(u,NULL,10);
      if(!isnum(s)) printf("%d + %d = %d\n",c-b,b,c);
      else if(!isnum(t)) printf("%d + %d = %d\n",a,c-a,c);
      else if(!isnum(u)) printf("%d + %d = %d\n",a,b,a+b);
   }
}
コード例 #17
0
ファイル: metadata_str.c プロジェクト: Overx/showtime
int
metadata_filename_to_episode(const char *s,
			     int *seasonp, int *episodep,
			     rstr_t **titlep)
{
  int i, j;
  int len = strlen(s);
  int season = -1;
  int episode = -1;
  for(i = 0; i < len; i++) {
    if((s[i] == 's' || s[i] == 'S') && isnum(s[i+1]) && isnum(s[i+2])) {
      int o = 3+i;
      if(s[o] == '.')
	o++;
  
      if((s[o] == 'e' || s[o] == 'E') && isnum(s[o+1]) && isnum(s[o+2])) {
	season = atoi(s+i+1);
	episode = atoi(s+o+1);
	break;
      }
    }
  }
  

  if(season == -1 || episode == -1)
    return -1;

  *seasonp = season;
  *episodep = episode;

  char *t = mystrdupa(s);
  url_deescape(t);

  for(j= 0; j < i; j++) {
    if(t[j] == '.') {
      t[j] = ' ';
    }
  }
  t[j] = 0;

  if(titlep != NULL) {
    if(j)
      *titlep = rstr_alloc(t);
    else
      *titlep = NULL;
  }
  return 0;
}
コード例 #18
0
int main()
{
    char ch='\0';
    int N=0, state=0, answer=0, first_num=0, second_num=0, is_negative=0;
    // state = 0 --> no number is being scanned
    // state = 1 --> a number is being scanned
    for(; ch!=EOF;)
    {
        // going to the start of number
        for(ch=getchar(); !isnum(ch); ch=getchar());
        if(ch == '-')
            is_negative = 1;
        ch = getchar();
        N = (ch-'0');
        for(ch=getchar(); isnum(ch); N = N*10 + (ch-'0'), ch=getchar());
        first_num = N;
        if( is_negative == 1)
            first_num = -1 * N;

        // going to the start of number
        for(ch=getchar(); !isnum(ch); ch=getchar());
        if(ch == '-')
            is_negative = 1;
        ch = getchar();
        N = (ch-'0');
        for(ch=getchar(); isnum(ch); N = N*10 + (ch-'0'), ch=getchar());

        printf("%d\n",N);
    }
    /*for(ch=getchar(); ch != EOF; ch=getchar())
    {
    	if(ch == '\n')
    		printf("Answer = %d\n", answer);
    	if( isnum(ch) )
    	{
    		if(state == 0)
    		{
    			N = int(ch-'0');
    			state = 1;
    		}
    		else
    		{
    			N = N*10 + int(ch-'0');
    		}
    	}
    }*/
    return 0;
}
コード例 #19
0
double stod(string s)
{
    double fmp = 1;
    double msg = 0.0;
    bool hasDec = false;
    bool hasN = false;
    uint16 i = 0;
    if (s[0] == '-') {
        hasN = true;
        i++;
    }
    while(s[i]) {
        if (isnum(s[i])) {
            if (hasDec) {
                fmp *= 0.1;
                msg += ntoi(s[i]) * fmp;
            } else
                msg = msg * 10 + ntoi(s[i]);
        } else if (s[i] == '.') {
            if (hasDec) break;
            hasDec = true;
        } else break;
        i++;
    }
    if (hasN) msg = -msg;
    return msg;
}
コード例 #20
0
vector<int> diffWaysToCompute_1(string input) {
    int n = input.length();
    vector<int> nums;
    vector<char> ops;
    
    for(int i = 0; i < n; i ++) {
        char ch = input[i];
        if(isop(ch)) {
            ops.push_back(ch);
        }
        else {
            nums.push_back(atoi(input.c_str()+i));
            while(isnum(input[i]) && i < n) i++;
            i--;
        }
    }
    //note: n changed
    n = nums.size();

    vector<int> ans;
    ans = solve(nums, ops, 0, n-1);
    printVector(ans);


    return ans;
}
コード例 #21
0
void evaluate(opmap_t *ops, const char *s, stack_t *stack)
{
	while(*s)
	{
		if(isws(*s))
		{
			/* skip whitespace */
			++s;
		}
		else if(isnum(*s))
		{
			/* lese eine zahl ein (siehe io.c)
			   und pushe sie auf den stack (siehe stack.c)
			*/
			if(stack_push(stack, read_number(&s)))
			{
				error(ERR_STACKFULL);
			}
		}
		else
		{
			/* eine buchstabengebunde funktion ist gefragt (siehe opmap.c) */
			op_fn cb = opmap_get(ops, *s++);

			if(!cb)
			{
				error(ERR_UNKNOWN);
			}

			cb(stack);
		}
	}
}
コード例 #22
0
ファイル: ARITH2.cpp プロジェクト: nxphuc/SPOJ
int main(){
	char token[30], op;
	int n;
	ll ans, num;
	scanf("%d", &n);
	while(n--){
		ans = 0;
		op = '+';
		while(scanf("%s", token) == 1){
			if(isnum(token, num, op)){
				switch(op){
					case '+': ans += num; break;
					case '-': ans -= num; break;
					case '*': ans *= num; break;
					case '/': ans /= num; break;
				}
			}
			else
				if(op == '='){
					printf("%lld\n", ans);
					break;
				}
		}
	}
	return 0;
}
コード例 #23
0
double gop(char **a){
  char *v=*a;
  if(isnum(*v))
	  return gnum(a);
  else
	  return gfun(a);
  return 0.0;
}
コード例 #24
0
ファイル: parser.cpp プロジェクト: ToToL/NabazTag-Sources
// test si un mot est un nombre décimal (que des chiffres)
int isdecimal(char* src)
{
	while(*src)
	{
		if (!isnum(*src++)) return 0;
	}
	return 1;
}
コード例 #25
0
ファイル: api.c プロジェクト: axcoto-lab/Sparkling
int spn_values_comparable(const SpnValue *lhs, const SpnValue *rhs)
{
	if (isnum(lhs) && isnum(rhs)) {
		return 1;
	}

	if (isobject(lhs) && isobject(rhs)) {
		SpnObject *obl = objvalue(lhs), *obr = objvalue(rhs);
		if (!class_equal(obl->isa, obr->isa)) {
			return 0;
		}

		return obl->isa->compare != NULL;
	}

	return 0;
}
コード例 #26
0
ファイル: draw.cpp プロジェクト: ComputerNerd/eigenmath
void
setup_yrange_f(void)
{
	// default range is (-10,10)

	ymin = -10.0;

	ymax = 10.0;

	p1 = usr_symbol("yrange");

	if (!issymbol(p1))
		return;

	p1 = get_binding(p1);

	// must be two element vector

	if (!istensor(p1) || p1->u.tensor->ndim != 1 || p1->u.tensor->nelem != 2)
		return;

	push(p1->u.tensor->elem[0]);
	eval();
	yyfloat();
	eval();
	p2 = pop();

	push(p1->u.tensor->elem[1]);
	eval();
	yyfloat();
	eval();
	p3 = pop();

	if (!isnum(p2) || !isnum(p3))
		return;

	push(p2);
	ymin = pop_double();

	push(p3);
	ymax = pop_double();

	if (ymin == ymax)
		stop("draw: yrange is zero");
}
コード例 #27
0
ファイル: draw.cpp プロジェクト: ComputerNerd/eigenmath
void
setup_trange_f(void)
{
	// default range is (-pi, pi)

	tmin = -M_PI;

	tmax = M_PI;

	p1 = usr_symbol("trange");

	if (!issymbol(p1))
		return;

	p1 = get_binding(p1);

	// must be two element vector

	if (!istensor(p1) || p1->u.tensor->ndim != 1 || p1->u.tensor->nelem != 2)
		return;

	push(p1->u.tensor->elem[0]);
	eval();
	yyfloat();
	eval();
	p2 = pop();

	push(p1->u.tensor->elem[1]);
	eval();
	yyfloat();
	eval();
	p3 = pop();

	if (!isnum(p2) || !isnum(p3))
		return;

	push(p2);
	tmin = pop_double();

	push(p3);
	tmax = pop_double();

	if (tmin == tmax)
		stop("draw: trange is zero");
}
コード例 #28
0
ファイル: iomanX.c プロジェクト: AzagraMac/PS2_SDK
static char * find_iop_device(const char *dev, int *unit, iop_device_t **device)
{
	char canon[16];
	char *filename, *tail, *d = (char *)dev;
	int i, len, num = 0;

	if (*d == ' ') {
		while (*d == ' ')
			d++;
		d--;
	}

	if ((tail = index(d, ':')) == NULL)
		return (char *)-1;

	len = (int)(tail - d);
	strncpy(canon, d, len);
	canon[len] = '\0';

	/* This is the name passed to the device op.  */
	filename = d + len + 1;

	/* Search backward for the unit number.  */
	if (isnum(canon[len - 1])) {
		while (isnum(canon[len - 1]))
			len--;

		num = strtol(canon + len, 0, 10);
	}
	if (unit)
		*unit = num;

	/* Find the actual device.  */
	canon[len] = '\0';
	for (i = 0; i < MAX_DEVICES; i++) {
		if (dev_list[i] != NULL && !strcmp(canon, dev_list[i]->name)) {
			if (device)
				*device = dev_list[i];

			return filename;
		}
	}

	return (char *)-1;
}
コード例 #29
0
ファイル: primitives.c プロジェクト: spacemanaki/lisp-in-c
object_t primitive_eq(object_t argl) {
  object_t a1 = car(argl);
  object_t a2 = car(cdr(argl));

  int result;

  if(issymbol(a1) && issymbol(a2))
    result = obj_symbol_cmp(a1, a2);
  else if(isnum(a1) && isnum(a2))
    result = (obj_get_number(a1) == obj_get_number(a2));
  else
    result = 0;

  if(result)
    return obj_new_symbol("#t");
  else
    return obj_new_symbol("#f");
}
コード例 #30
0
//---------------------------------------------------------------------------
void __fastcall TFSSettings::ModeListChange(TObject *Sender)
{
        AnsiString Txt;

        Txt = ModeList->Items->Strings[ModeList->ItemIndex];

        FScreen.Width = atoi(Txt.c_str());
        while (isnum(Txt[1])) Txt = Txt.SubString(2,Txt.Length()-1);
        while (!isnum(Txt[1])) Txt = Txt.SubString(2,Txt.Length()-1);
        FScreen.Height = atoi(Txt.c_str());
        while (isnum(Txt[1])) Txt = Txt.SubString(2,Txt.Length()-1);
        while (!isnum(Txt[1])) Txt = Txt.SubString(2,Txt.Length()-1);
        FScreen.Bpp = atoi(Txt.c_str());
        FScreen.Stretch = Stretch->Checked;
        FScreen.WhiteLetterbox = White->Checked;

        White->Enabled=Letterbox->Checked;
}