Exemple #1
0
  bool is_fat_call()                 const {
    return
#ifdef COMPILER2
      (is_blr() && next_raw()->is_b()) ||
#endif
      (is_adr_aligned_lr() && next_raw()->is_br());
  }
Exemple #2
0
Fichier : cfg.c Projet : a2o/lilo
static char *cfg_get_token(void)
{
    char buf[MAX_TOKEN+1];
    char *here;
    int ch,escaped;

    if (last_token) {
	here = last_token;
	last_token = NULL;
	return here;
    }
    while (1) {
	while ((ch = next()), ch == ' ' || ch == '\t' || ch == '\n')
	    if (ch == '\n') line_num++;
	if (ch == EOF) return NULL;
	if (ch != '#') break;
	while ((ch = next_raw()), ch != '\n')
	    if (ch == EOF) return NULL;
	line_num++;
    }
    if (ch == '=') return stralloc("=");
    if (ch == '"') {
	here = buf;
	while (here-buf < MAX_TOKEN) {
	    if ((ch = next()) == EOF) cfg_error("EOF in quoted string");
	    if (ch == '"') {
		*here = 0;
		return stralloc(buf);
	    }
	    if (ch == '\\') {
		ch = next();
		if (ch != '"' && ch != '\\' && ch != '\n')
		    cfg_error("Bad use of \\ in quoted string");
		if (ch == '\n') {
		    while ((ch = next()), ch == ' ' || ch == '\t');
		    if (!ch) continue;
		    again(ch);
		    ch = ' ';
		}
	    }
	    if (ch == '\n' || ch == '\t')
		cfg_error("\\n and \\t are not allowed in quoted strings");
	    *here++ = ch;
	}
	cfg_error("Quoted string is too long");
	return 0; /* not reached */
    }
    here = buf;
    escaped = 0;
    while (here-buf < MAX_TOKEN) {
	if (escaped) {
	    if (ch == EOF) cfg_error("\\ precedes EOF");
	    if (ch == '\n') line_num++;
	    else *here++ = ch == '\t' ? ' ' : ch;
	    escaped = 0;
	}
	else {
	    if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '#' ||
	      ch == '=' || ch == EOF) {
		again(ch);
		*here = 0;
		return stralloc(buf);
	    }
#if !__MSDOS__
	    if (!(escaped = (ch == '\\')))
#endif /* !__MSDOS__ */
		*here++ = ch;
	}
	ch = next();
    }
    cfg_error("Token is too long");
    return 0; /* not reached */
}
Exemple #3
0
static char *cfg_get_token (void)
{
     char buf[MAX_TOKEN + 1];
     char *here;
     int ch, escaped;

     if (last_token) {
	  here = last_token;
	  last_token = NULL;
	  return here;
     }
     while (1) {
	  while (ch = next (), ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r')
	       if (ch == '\n' || ch == '\r')
		    line_num++;
	  if (ch == EOF || ch == (int)NULL)
	       return NULL;
	  if (ch != '#')
	       break;
	  while (ch = next_raw (), (ch != '\n' && ch != '\r'))
	       if (ch == EOF)
		    return NULL;
	  line_num++;
     }
     if (ch == '=')
	  return strdup ("=");
     if (ch == '"') {
	  here = buf;
	  while (here - buf < MAX_TOKEN) {
	       if ((ch = next ()) == EOF)
		    cfg_error ("EOF in quoted string");
	       if (ch == '"') {
		    *here = 0;
		    return strdup (buf);
	       }
	       if (ch == '\\') {
		    ch = next ();
		    switch (ch) {
		    case '"':
		    case '\\':
			 break;
		    case '\n':
		    case '\r':
			 while ((ch = next ()), ch == ' ' || ch == '\t');
			 if (!ch)
			      continue;
			 again (ch);
			 ch = ' ';
			 break;
		    case 'n':
			 ch = '\n';
			 break;
		    default:
			 cfg_error ("Bad use of \\ in quoted string");
		    }
	       } else if ((ch == '\n') || (ch == '\r'))
		    cfg_error ("newline is not allowed in quoted strings");
	       *here++ = ch;
	  }
	  cfg_error ("Quoted string is too long");
	  return 0;		/* not reached */
     }
     here = buf;
     escaped = 0;
     while (here - buf < MAX_TOKEN) {
	  if (escaped) {
	       if (ch == EOF)
		    cfg_error ("\\ precedes EOF");
	       if (ch == '\n')
		    line_num++;
	       else
		    *here++ = ch == '\t' ? ' ' : ch;
	       escaped = 0;
	  } else {
	       if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '#' ||
		   ch == '=' || ch == EOF) {
		    again (ch);
		    *here = 0;
		    return strdup (buf);
	       }
	       if (!(escaped = (ch == '\\')))
		    *here++ = ch;
	  }
	  ch = next ();
     }
     cfg_error ("Token is too long");
     return 0;			/* not reached */
}
Exemple #4
0
 bool is_ic_far_call()              const { return is_adr_aligned_lr() && next_raw()->is_ldr_literal() && next_raw()->next_raw()->is_br(); }
Exemple #5
0
 bool is_ic_near_call()             const { return is_adr_aligned_lr() && next_raw()->is_b(); }
Exemple #6
0
 bool is_far_call()                 const {
   return is_ldr_literal() && next_raw()->is_fat_call();
 }
Exemple #7
0
 bool is_far_jump()                 const { return is_ldr_literal() && next_raw()->is_br(); }