Ejemplo n.º 1
0
/* YYLEX -- Return the next token from the input stream.  Two separate lexical
 * analyzers are provided, the "command mode" lexical analyzer for interactive
 * command entry, and the "compute mode" analyzer for more sophisticated
 * applications.  The nesting level of parentheses and braces is used to switch
 * between the two modes.  When the paren level is nonzero compute mode is in
 * effect.  Mode switching may be defeated by setting the external variable
 * _lexmodes to zero.  A single parser accepts input from both lexical
 * analyzers.
 */
int 
yylex (void)
{
	register int	token;

	if (_lexmodes && parenlevel == 0 && bracelevel < PBRACE) {
	    while (!(token = lexicon()))
		if (yywrap())
		    break;
	} else
	    token = lex_yylex();

	if (!lexdebug)
	    return (token);

#if LEXDEBUG
	switch (token) {
	case Y_CONSTANT:
	    eprintf ("CONSTANT ");
	    fprop (stderr, reference (operand, yylval));
	    eprintf ("\n");
	    break;
	case Y_IDENT:
	    eprintf ("IDENT ");
	    fprop (stderr, reference (operand, yylval));
	    eprintf ("\n");
	    break;
	case Y_OSESC:
	    eprintf ("Y_OSESC ");
	    fprop (stderr, reference (operand, yylval));
	    eprintf ("\n");
	    break;
	case Y_APPEND:
	    eprintf ("Y_APPEND\n");
	    break;
	case Y_ALLAPPEND:
	    eprintf ("Y_ALLAPPEND\n");
	    break;
	case Y_ALLREDIR:
	    eprintf ("Y_ALLREDIR\n");
	    break;
	case Y_GSREDIR:
	    eprintf ("Y_GSREDIR\n");
	    break;
	case Y_ALLPIPE:
	    eprintf ("Y_ALLPIPE\n");
	    break;
	case Y_NEWLINE:
	    eprintf ("NEWLINE\n");
	    break;
	default:
	    eprintf ("`%c'\n", token);
	    break;
	}
#endif

	return (token);
}
Ejemplo n.º 2
0
void
PlotCanvas::setCaption() 
{
  switch ( mode ) {
    case MODE_PLAN:
      setWindowTitle( plot_name );
      break;
    case MODE_EXT:
      setWindowTitle( plot_name );
      break;
    case MODE_CROSS:
    case MODE_HCROSS:
      setWindowTitle( lexicon("qtopo_x_select") );
      break;
    case MODE_3D:
      setWindowTitle( lexicon("qtopo_3d") );
      break;
    default:
      setWindowTitle( lexicon("qtopo_select") );
  }
}
Ejemplo n.º 3
0
void 
PlotCanvas::setMode( int input_mode, const char * item_name ) 
{
  DBG_CHECK( "PlotCanvas::setMode() %d %s\n", input_mode, item_name );
  switch (input_mode) {
    case INPUT_POINT:
      if ( mode == MODE_PLAN ) {
        setWindowTitle( plot_name +  lexicon("qtopo_p_point") + QString(item_name) );
      } else if ( mode == MODE_EXT ) {
        setWindowTitle( plot_name + lexicon("qtopo_e_point") + QString(item_name) );
      } else if ( mode == MODE_CROSS ) {
        setWindowTitle( QString(lexicon("qtopo_x_point")) + QString(item_name) );
      }
      setCursor( QCursor(Qt::CrossCursor) );
      break;
    case INPUT_LINE:
      if ( mode == MODE_PLAN ) {
        setWindowTitle( plot_name + lexicon("qtopo_p_line") + QString(item_name) );
      } else if ( mode == MODE_EXT ) {
        setWindowTitle( plot_name + lexicon("qtopo_e_line") + QString(item_name) );
      } else if ( mode == MODE_CROSS ) {
        setWindowTitle( QString(lexicon("qtopo_x_line")) + QString(item_name) );
      }
      // setCursor( getCursorPen() );
      setCursor( icon->PenUp() );
      break;
    case INPUT_AREA:
      if ( mode == MODE_PLAN ) {
        setWindowTitle( plot_name + lexicon("qtopo_p_area") + QString(item_name) );
      } else if ( mode == MODE_EXT ) {
        setWindowTitle( plot_name + lexicon("qtopo_e_area") + QString(item_name) );
      } else if ( mode == MODE_CROSS ) {
        setWindowTitle( QString(lexicon("qtopo_x_area")) + QString(item_name) );
      }
      // setCursor( getCursorPen() );
      setCursor( icon->PenUp() );
      break;
    default:
      if ( mode == MODE_PLAN ) {
        setWindowTitle( plot_name + lexicon("qtopo_p_select"));
      } else if ( mode == MODE_EXT ) {
        setWindowTitle( plot_name + lexicon("qtopo_e_select"));
      } else if ( mode == MODE_CROSS ) {
        setWindowTitle(lexicon("qtopo_x_select"));
      } else if ( mode == MODE_3D ) {
        setWindowTitle(lexicon("qtopo_select"));
      }
      setCursor( QCursor(Qt::ArrowCursor) );
  }
}