Beispiel #1
0
static void	cursor_rel(	dcli_sChannel *chn,
			 	int	x,
				int	y)
{
  char	cursor_f[]={27, 91, 0, 0, 67, 0};
  char	cursor_b[]={27, 91, 0, 0, 68, 0};
  char	cursor_u[]={27, 91, 0, 0, 65, 0};
  char	cursor_d[]={27, 91, 0, 0, 66, 0};
	
  if ( y > 0 )
  {
    cursor_f[2] = y / 10 + 48;
    cursor_f[3] = y - (y / 10) * 10 + 48;
    r_print( chn,"%s", cursor_f);
  }
  else if ( y < 0 )
  {
    cursor_b[2] = - y / 10 + 48;
    cursor_b[3] = - y + (y / 10) * 10 + 48;
    r_print( chn,"%s", cursor_b);
  }
  if ( x > 0 )
  {
    cursor_u[2] = x / 10 + 48;
    cursor_u[3] = x - (x / 10) * 10 + 48;
    r_print( chn,"%s", cursor_u);
  }
  else if ( x < 0 )
  {
    cursor_d[2] = - x / 10 + 48;
    cursor_d[3] = - x + (x / 10) * 10 + 48;
    r_print( chn,"%s", cursor_d);
  }
}
Beispiel #2
0
int
main (int argc, char ** argv)
{
  RBitset * cpuset;

  (void) argc;
  (void) argv;

  if (!r_bitset_init_stack (cpuset, 256)) {
    r_printerr ("r_bitset_init_stack failed\n");
    return 1;
  }

  if (!r_thread_get_affinity (r_thread_current (), cpuset)) {
    r_printerr ("r_thread_get_affinity failed\n");
    return 1;
  }

  r_print ("Running thread may be scheduled on %"RSIZE_FMT" different cores\nCores:",
      r_bitset_popcount (cpuset));
  r_bitset_foreach (cpuset, TRUE, _print_core_id, NULL);

  r_print ("\n");
  return 0;
}
Beispiel #3
0
static void	char_delete( dcli_sChannel *chn, int	n)
{
  char	char_del[5]={27, 91, 0, 80, 0};
	
  char_del[2] = n;
  r_print( chn,"%s", char_del);
}
Beispiel #4
0
int
main (int argc, char ** argv)
{
    int i;
    rauint counter = 0;
    RThread * thrs[THRS];

    (void)argc;
    (void)argv;

    for (i = 0; i < THRS; i++) {
        thrs[i] = r_thread_new (NULL,
                                getenv("NOATOMICS") ? thr_add : thr_add_atomic,
                                (rpointer)&counter);
    }

    for (i = 0; i < THRS; i++) {
        r_thread_join (thrs[i]);
    }

    r_print ("Ran %d threads each of %d iterations yielding: %u\n",
             THRS, ITERS, counter);

    return 0;
}
Beispiel #5
0
static void	rtt_scroll_down( int nr)
{
	char	scroll[]={27, 91, 0, 0, 'T', 0};
	scroll[2] = nr / 10 + 48;
	scroll[3] = nr - (nr / 10) * 10 + 48;
	r_print("%s", scroll);
}
int main()
{

    std::vector<std::string> v = {"aa", "bb", "cc"};

    //! test for 10.34
    r_print(v);
    std::cout << "\n";

    //! test for 10.35
    r_withOrdinary_print(v);
    std::cout << "\n";

    //! test for 10.36
    std::list<int> l = {1, 2, 3, 4, 0, 5, 6};
    auto it = find_last_0(l);
    std::cout << *it << "\n";

    //! test for 10.37
    std::vector<int> vi = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    std::list<int> lst;
    vec2list_3_7_reverse(vi, lst);
    for (auto e : lst) std::cout << e << " ";
    std::cout << std::endl;

    return 0;
}
Beispiel #7
0
static void	char_insert_nob( dcli_sChannel *chn, int	n)
{
	char	char_ins[]={27, 91, 0, 0, 64, 0};
	
	char_ins[2] = n / 10 + 48;
	char_ins[3] = n - (n / 10) * 10 + 48;
	r_print( chn,"%s", char_ins);
}
Beispiel #8
0
Datei: rfile.c Projekt: ieei/rlib
int
main (int argc, char ** argv)
{
  int ret = 0;
  ROptionParser * parser = r_option_parser_new (NULL, "1.0");
  ROptionParseResult res;
  rboolean hr;
  const ROptionArgument args[] = {
    R_OPT_ARG ("hr", 0, R_OPTION_TYPE_NONE, &hr, R_OPTION_FLAG_NONE, "Human readable format", NULL),
  };

  r_option_parser_add_arguments (parser, args, R_N_ELEMENTS (args));
  res = r_option_parser_parse (parser, &argc, &argv);

  switch (res) {
    case R_OPTION_PARSE_VERSION:
      {
        rchar * output = r_option_parser_get_version_output (parser);
        r_print ("%s", output);
        r_free (output);
      }
      break;
    case R_OPTION_PARSE_OK:
      if (argc == 1) {
        if (hr) {
          RBitset * bitset;
          rsize bits;
          if (!r_bitset_init_stack (bitset, 256))
            break;

          if (r_bitset_set_from_human_readable_file (bitset, argv[0], &bits)) {
            ruint i;
            r_print ("Read %"RSIZE_FMT" from '%s'\n", bits, argv[0]);
            for (i = 0; i < 256; i += 32)
              r_print ("%.8"RINT32_MODIFIER"x\n", r_bitset_get_u32_at (bitset, i));
          } else {
            r_print ("Unable to read bitset from '%s'\n", argv[0]);
          }
        } else {
          RFile * f;
          if ((f = r_file_open (argv[0], "r")) != NULL) {
            ruint32 val;
            rsize tokens;

            while (r_file_scanf (f, "%"RINT32_MODIFIER"x,", &tokens, &val) == R_FILE_ERROR_OK &&
                tokens == 1) {
              r_print ("%.8"RINT32_MODIFIER"x\n", val);
            }

            r_file_unref (f);
          } else {
            r_print ("'%s' not found\n", argv[0]);
          }
        }
        break;
      } else {
        r_print ("Missing file\n");
      }
      /* else fallthrough */
    case R_OPTION_PARSE_HELP:
    default:
      {
        rchar * output = r_option_parser_get_help_output (parser);
        r_print ("%s", output);
        r_free (output);
      }
      break;
  }

  r_option_parser_free (parser);

  return ret;
}
Beispiel #9
0
int	dcli_get_input_string( 	dcli_sChannel	*chn,
				char		*out_string,
				unsigned long	*out_terminator,
				int		out_maxlen,
				dcli_sRecall 	*recall,
				unsigned long	option,
				int		timeout,
				int		(* timeout_func) (),
				void		*timeout_arg,
				const char     	*prompt)
{
	char		input_str[200];
	char		out_str[200];
	char		dum_str[200];
	int		maxlen = 199;
	unsigned long	terminator;
	int		index;
	int		recall_index = 0;
	
	if ( prompt != NULL)
#if defined OS_VMS
	  r_print( chn, "\n%s", prompt);
#else
	  r_print( chn, "%s", prompt);
#endif

	terminator = 0;
	index = 0;
	out_str[0] = 0;
	while ( 1)
	{	
	  dcli_get_input( chn, input_str, &terminator, maxlen, option, timeout);

	  if (terminator == DCLI_K_RETURN)
	    break;
	  if ((terminator == DCLI_K_ARROW_LEFT) && ((option & DCLI_OPT_NOEDIT) != 0))
	    break;
	  if ((terminator == DCLI_K_ARROW_RIGHT) && ((option & DCLI_OPT_NOEDIT) != 0))
	    break;
	  if ((terminator == DCLI_K_DELETE) && ((option & DCLI_OPT_NOEDIT) != 0))
	    break;
	  if ((terminator == DCLI_K_BACKSPACE) && ((option & DCLI_OPT_NOEDIT) != 0))
	    break;
	  if ((terminator == DCLI_K_ARROW_UP) && ((option & DCLI_OPT_NORECALL) != 0))
	    break;
	  if ((terminator == DCLI_K_ARROW_DOWN) && ((option & DCLI_OPT_NORECALL) != 0))
	    break;
	  if ((terminator == DCLI_K_TIMEOUT) && ((option & DCLI_OPT_NOEDIT) != 0))
	  {
	    if ( timeout_func != NULL)
	      (timeout_func) ( timeout_arg);
	    else
	      break;
	  }

	  if ( (option & DCLI_OPT_NOEDIT) == 0)
	  {
	    switch ( terminator) 
	    {
	      case DCLI_K_TIMEOUT:
	        strcpy( dum_str, (char *) &out_str[index]);
	        strcpy( (char *) &out_str[index], input_str);
	        index += strlen(input_str);
	        strcpy( (char *) &out_str[index], dum_str);
	        if ( timeout_func != NULL)
	        {
	 	  store_cursorpos( chn);
	          (timeout_func) ( timeout_arg);
		  restore_cursorpos( chn);
	        }
	        break;
	      case DCLI_K_ARROW_LEFT:
	        strcpy( dum_str, (char *) &out_str[index]);
	        strcpy( &out_str[index], input_str);
	        index += strlen(input_str);
	        strcpy( &out_str[index], dum_str);
	        if ( index > 0)
	        {
	          index--;
	          cursor_rel( chn, 0, -1);
	        }
	        break;
	      case DCLI_K_ARROW_RIGHT:
	        strcpy( dum_str, (char *) &out_str[index]);
	        strncpy( (char *) &out_str[index], input_str, strlen(input_str));
	        index += strlen(input_str);
	        strcpy( (char *) &out_str[index], dum_str);
	        if ( index < (int)strlen( out_str))
	        {
	          index++;
	          cursor_rel( chn, 0, 1);
	        }
	        break;
	      case DCLI_K_BACKSPACE:
	        strcpy( dum_str, (char *) &out_str[index]);
	        strncpy( &out_str[index], input_str, strlen(input_str));
	        index += strlen(input_str);
	        strcpy( &out_str[index], dum_str);
	        if ( index > 0)
	        {
	          cursor_rel( chn, 0, - index);
	          index = 0;
	        }
	        break;
	      case DCLI_K_DELETE:
	        strcpy( dum_str, (char *) &out_str[index]);
	        strncpy( &out_str[index], input_str, strlen(input_str));
	        index += strlen(input_str);
	        strcpy( &out_str[index], dum_str);
	        if ( index > 0)
	        {
	          strcpy( dum_str, &out_str[index]);
	          index--;
	          cursor_rel( chn,  0, -1);
	          strcpy( &out_str[index], dum_str);
	          char_delete( chn, 1);

  	        }
	        break;
	    }
	  }
	  if ( (option & DCLI_OPT_NORECALL) == 0)
	  {
	    switch ( terminator) 
	    {
	      case DCLI_K_ARROW_UP:
	        if ( !recall)
                  break;
	        index += strlen(input_str);
	        recall_index++;
	        if ( recall_index > DCLI_RECALL_MAX)
	          recall_index = DCLI_RECALL_MAX + 1;
	        dcli_recall_getcommand( recall, recall_index - 1, out_str);
	        cursor_rel( chn, 0, -index);
	        eofline_erase( chn);
	        index = strlen(out_str);
	        r_print( chn,"%s", out_str);
	        break;
	      case DCLI_K_ARROW_DOWN:
	        if ( !recall)
                  break;
	        index += strlen(input_str);
	        recall_index--;
	        if ( recall_index < 0)
	          recall_index = 0;
	        dcli_recall_getcommand( recall, recall_index - 1, out_str);
	        cursor_rel( chn, 0, -index);
	        eofline_erase( chn);
	        index = strlen( out_str);
	        r_print( chn,"%s", out_str);
	        break;
	    }
	  }
	}
	strcpy( dum_str, (char *) &out_str[index]);
	strncpy( &out_str[index], input_str, strlen(input_str));
	index += strlen(input_str);
	strcpy( &out_str[index], dum_str);
	strcpy( out_string, out_str);
	if ( (option & DCLI_OPT_NORECALL) == 0)
	{	
	  /* Save in recall buffer */
	  recall_index = 0;
	  dcli_recall_insert( recall, out_string);
	}
	*out_terminator = terminator;
	return DCLI__SUCCESS;
}
Beispiel #10
0
int	dcli_get_input( dcli_sChannel	*chn,
			char		*input_str,
			unsigned long	*terminator,
			int		maxlen,
			unsigned long	option,
			int		timeout)
{
  unsigned char	c;
  char	*input_ptr;
  int	i;
  int	sts;
  int	state;

	  
  input_ptr = input_str;

  for ( i = 0; i < maxlen; i++)
  {
    if ( (option & DCLI_OPT_TIMEOUT) == 0)
      dcli_qio_readw( chn, (char *) &c, 1);
    else
    {
      sts = dcli_qio_read( chn, timeout, (char *) &c, 1);
      if ( !sts)
      {
        /* Timeout */
        *terminator = DCLI_K_TIMEOUT;
        *input_ptr = '\0';
        return 1;
      }
    }	   
 
    state = DCLI_TERM;
    while ( state > 0 )
    {
      if ( state == DCLI_TERM)
        /* first time */
        state = 0;

      state = state_table[ state ][ c ];	  
      if ( state > DCLI_TERM )
      {
        *terminator = state - DCLI_TERM;
        switch ( *terminator)
        {
          case DCLI_K_RETURN:
          case DCLI_K_CTRLC:
          {
            *input_ptr = '\0';
            if ( ((option & DCLI_OPT_NOECHO) == 0) &&
  	         ((option & DCLI_OPT_NOSCROLL) == 0)) 
              r_print( chn,"\n\r");
            return 1;
          }	        
          default:
          {
            *input_ptr = '\0';
            return 1;
          }	        
        }
      }
      else if ( state > 0)
        dcli_qio_readw( chn, (char *) &c, 1);
    }

    if ( c > 31)
    {
      /* Some ordinary charachter */
      *input_ptr = c;
      input_ptr++;
      if ( (option & DCLI_OPT_NOECHO) == 0)
      {
        char_insert_nob( chn, 1);
        r_print( chn, "%c", c);
      }
    }
  }
  *terminator = DCLI_K_MAXLEN;
  *input_ptr = '\0';
  if ( (option & DCLI_OPT_NOECHO) == 0)
    r_print( chn,"\n\r");
  return 1;
}
Beispiel #11
0
static void	eofline_erase(dcli_sChannel *chn)
{
	char	char_ins[]={27, 91, 48, 75, 0};

	r_print( chn,"%s", char_ins);
}
Beispiel #12
0
static void	restore_cursorpos( dcli_sChannel *chn)
{
  char	char_ins[]={27, 56, 0};
	
  r_print( chn,"%s", char_ins);
}
Beispiel #13
0
static void
_print_core_id (rsize bit, rpointer user)
{
  (void) user;
  r_print (" %"RSIZE_FMT, bit);
}
Beispiel #14
0
int	rtt_view(	menu_ctx	parent_ctx,
			char		*filename, 
			char		*inbuff,
			char		*intitle,
			int		type)
{
	view_ctx	ctx;
	unsigned long	terminator;
	char		input_str[80];
	int		maxlen = 30;
	unsigned long	option;
	int		sts;
	int	i, start_i, end_i;
	int	size, offset;
	int	left_marg;
	int	page_size = 21;
	int	row_change;
	int	redraw = 1;
	char	str[100];
	char	title[80];
	FILE	*infile;
	char	last_char;
	char	pagestr[80];

	
	if ( type == RTT_VIEWTYPE_FILE)
	{
	  infile = fopen( filename, "r");
	  if ( !infile)
	  {
	    rtt_message('E',"Unable to open file");
	    return RTT__NOPICTURE;
	  }
	  rtt_fgetname( infile, title, filename);
	}
	else
	{
	  strcpy( title, intitle);
	}

	ctx = calloc( 1, sizeof( *ctx));
	if ( !ctx)
	{
	  rtt_message('E',"Unable to allocate memory");
	  return RTT__NOPICTURE;
	}
	rtt_ctx_push( (menu_ctx) ctx);
	ctx->ctx_type = RTT_CTXTYPE_VIEW;
	strcpy( ctx->title, title); 
	ctx->parent_ctx = parent_ctx;
	ctx->first = 1;
	if ( type == RTT_VIEWTYPE_FILE)
	  ctx->infile = infile;
	else
	  ctx->inbuff = inbuff;
	ctx->read_sts = (char *) 1;
	ctx->buff = calloc( 1, RTTVIEW_BUFF_SIZE);
	if ( !ctx->buff)
	{
	  rtt_ctx_pop();
	  rtt_message('E',"Unable to allocate memory");
	  return RTT__NOPICTURE;
	}
	ctx->buffrow = calloc( RTTVIEW_BUFFROW_SIZE, sizeof(*ctx->buffrow));
	if ( !ctx->buffrow)
	{
	  rtt_ctx_pop();
	  rtt_message('E',"Unable to allocate memory");
	  return RTT__NOPICTURE;
	}
	ctx->buffrow_count = 0;
	ctx->start_row = 0;
	left_marg = 0;
	row_change = 0;

	if ( type == RTT_VIEWTYPE_FILE)
	  rtt_read_file( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		0, page_size, &ctx->start_row);
	else
	  rtt_read_buff( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		0, page_size, &ctx->start_row);

	option = RTT_OPT_NORECALL | RTT_OPT_NOEDIT | RTT_OPT_NOECHO | 
		RTT_OPT_TIMEOUT;

	while (1)
	{

	  if ( ctx->start_row + page_size > ctx->buffrow_count )
	  {
	    if ( type == RTT_VIEWTYPE_FILE)
	      rtt_read_file( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		0, page_size, &ctx->start_row);
	    else
	      ctx->start_row = max( 0, ctx->buffrow_count - page_size);
/*
	      rtt_read_buff( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		0, page_size, &ctx->start_row);
*/
	    redraw = 1;
	  }
	  else if ( ctx->start_row < 0)
	  {
	    if ( type == RTT_VIEWTYPE_FILE)
	      rtt_read_file( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		1, page_size, &ctx->start_row);
	    else
	      ctx->start_row = 0;
/*
	      rtt_read_buff( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		1, page_size, &ctx->start_row);
*/
	    redraw = 1;
	  }
	  if ( redraw || row_change != 0)
	  {
	    redraw = 0;
	    rtt_display_erase();
	    start_i = ctx->start_row;
	    end_i = min(ctx->start_row+page_size, ctx->buffrow_count);
	    rtt_cursor_abs( 1, 22-page_size);
	    for ( i = ctx->start_row; i < end_i; i++)
	    {
	      if ( i == ctx->buffrow_count - 1)
	      {
	        offset = ctx->buffrow[i] + left_marg;
		rtt_view_get_row_size( &ctx->buff[offset], 80, &size, &last_char);
	        size = min( size, 80);
	        if ( last_char != 10)
	          r_print("%.*s\n\r", size,  &ctx->buff[offset]);
	        else
	          r_print("%.*s\r", size,  &ctx->buff[offset]);
/*
	        str[80] = 0;
	        r_print("%80s\n", str);
*/
	      }
	      else
	      {
	        offset = min( ctx->buffrow[i+1] - 1, ctx->buffrow[i] + left_marg);
	        size = min( ctx->buffrow[i+1] - offset, 80);
		rtt_view_get_row_size( &ctx->buff[offset], 80, &size, &last_char);
	        size = min( size, 80);
	        if ( last_char != 10)
	          r_print("%.*s\n\r", size,  &ctx->buff[offset]);
	        else
	          r_print("%.*s\r", size,  &ctx->buff[offset]);
	      }
	    }
	    rtt_cursor_abs( 1, 22);
	    rtt_char_inverse_start();
	    if ( end_i == ctx->buffrow_count)
	      sprintf( pagestr, "%d-EOF(%d)", start_i+1, ctx->buffrow_count);
	    else
	      sprintf( pagestr, "%d-%d(%d)", start_i+1, end_i, ctx->buffrow_count);
	    sprintf( str, 
"                                                 |%12s | Ctrl/R back", pagestr);
	    strncpy( &str[1], title, min( strlen( title), 49));
	    r_print( "%80s", str);
	    rtt_char_inverse_end();
	    
	    rtt_cursor_abs( 1, 23);
	    rtt_eofline_erase();
	    rtt_cursor_abs( 1, 24);
	    rtt_eofline_erase();
	  }

	  row_change = 0;
	  r_print_buffer();


	  rtt_command_get_input_string( (char *) &rtt_chn, 
		input_str, &terminator, maxlen, 
		rtt_recallbuff, option, rtt_scantime, &rtt_scan, ctx, 
		NULL, RTT_COMMAND_PICTURE);
	  rtt_message('S',"");

	  switch ( terminator)
	  {
	    case RTT_K_ARROW_UP:
	      if ( type == RTT_VIEWTYPE_BUF)
	      {
	        if ( ctx->start_row - RTTVIEW_ARROW_INC < 0) 
	        {
		  ctx->start_row = 0;
	          row_change = RTTVIEW_ARROW_INC - ctx->start_row;
	        }
	        else
	        {
	          ctx->start_row -= RTTVIEW_ARROW_INC;
	          row_change = -RTTVIEW_ARROW_INC;
	        }
	        redraw = 0;
	      }
	      else
	      {
	        ctx->start_row -= RTTVIEW_ARROW_INC;
	        row_change = -RTTVIEW_ARROW_INC;
	        redraw = 0;
	      }
	      break;
	    case RTT_K_ARROW_DOWN:
	      ctx->start_row += RTTVIEW_ARROW_INC;
	      row_change = RTTVIEW_ARROW_INC;
	      redraw = 0;
	      break;
	    case RTT_K_ARROW_RIGHT:
	      left_marg += 8;
	      redraw = 1;
	      break;
	    case RTT_K_ARROW_LEFT:
	      redraw = 1;
	      left_marg -= 8;
	      if ( left_marg < 0)
	        left_marg = 0;
	      break;
	    case RTT_K_NEXTPAGE:
	      /* Next page */
	      ctx->start_row += RTTVIEW_PAGE_INC;
	      row_change = RTTVIEW_PAGE_INC;
	      redraw = 0;
	      break;
	    case RTT_K_PREVPAGE:
	      /* Previous page */
	      ctx->start_row -= RTTVIEW_PAGE_INC;
	      row_change = -RTTVIEW_PAGE_INC;
	      redraw = 0;
	      break;
	    case RTT_K_RETURN:
	      break;
	    case RTT_K_PF1:
	      /* Top */
	      ctx->buffstart_row = 0;
	      ctx->start_row = 0;
	      rtt_read_buff( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		  RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		  1, page_size, &ctx->start_row);
	      redraw = 1;
	      break;
	    case RTT_K_PF2:
	      /* Bottom */
	      ctx->start_row = max( 0, ctx->buffrow_count - page_size);
	      if ( type == RTT_VIEWTYPE_FILE)
	      {
	        while( ctx->read_sts != NULL)
	        {
	          rtt_read_buff( ctx, ctx->buff, RTTVIEW_BUFF_SIZE, ctx->buffrow,
		    RTTVIEW_BUFFROW_SIZE, &ctx->buffrow_count,
		    0, page_size, &ctx->start_row);
	          ctx->start_row = ctx->buffrow_count - page_size + 1;
	        }
	      }
	      redraw = 1;
	      break;
	    case RTT_K_PF3:
	      rtt_message('E', "Function not defined");
	      break;
	    case RTT_K_PF4:
	      if ( type == RTT_VIEWTYPE_FILE)
	        fclose( ctx->infile);
	      free( ctx->buff);
	      free( ctx->buffrow);
	      free( ctx);
	      rtt_ctx_pop();
	      return RTT__SUCCESS;
	    case RTT_K_FAST_1:
	    case RTT_K_FAST_2:
	    case RTT_K_FAST_3:
	    case RTT_K_FAST_4:
	    case RTT_K_FAST_5:
	    case RTT_K_FAST_6:
	    case RTT_K_FAST_7:
	    case RTT_K_FAST_8:
	    case RTT_K_FAST_9:
	    case RTT_K_FAST_10:
	    case RTT_K_FAST_11:
	    case RTT_K_FAST_12:
	    case RTT_K_FAST_13:
	    case RTT_K_FAST_14:
	    case RTT_K_FAST_15:
	      rtt_fastkey = terminator - RTT_K_FAST;
	      sts = rtt_get_fastkey_type();
	      if ( sts == RTT__NOPICTURE)
	      {
	        sts = rtt_get_fastkey_picture( (menu_ctx) ctx);
	        if ( EVEN(sts)) return sts;
	        break;
	      }
	    case RTT_K_CTRLZ:
	      if ( type == RTT_VIEWTYPE_FILE)
	        fclose( ctx->infile);
	      free( ctx->buff);
	      free( ctx->buffrow);
	      free( ctx);
	      rtt_ctx_pop();
	      return RTT__FASTBACK;
	    case RTT_K_CTRLW:
	      redraw = 1;
	      break;
	    case RTT_K_CTRLK:
	      /* Acknowledge last alarm */
	      sts = rtt_alarm_ack_last();
	      break;
	    case RTT_K_CTRLL:
	      /* Change description mode */
	      if ( !rtt_description_on)
	        sts = rtt_cli( rtt_command_table, "SET DESCRIPTION", (void *) ctx, 0);
	      else
	        sts = rtt_cli( rtt_command_table, "SET NODESCRIPTION", (void *) ctx, 0);
	      break;
	    case RTT_K_CTRLV:
	      break;
	    case RTT_K_CTRLN:
	      break;
	    case RTT_K_DELETE:
	      break;
	    case RTT_K_COMMAND:
	      sts = rtt_get_command( (menu_ctx) ctx, (char *) &rtt_chn, 
		rtt_recallbuff,  
		0, 0, ctx, 
	    	"pwr_rtt> ", 0, RTT_ROW_COMMAND, rtt_command_table);
	      /* menu_ptr might have been changed */
	      if ( EVEN(sts)) return sts;
	      if ( sts == RTT__FASTBACK)
	      {
	        if ( type == RTT_VIEWTYPE_FILE)
	          fclose( ctx->infile);
	        free( ctx->buff);
	        free( ctx->buffrow);
	        free( ctx);
	        rtt_ctx_pop();
	        return RTT__FASTBACK;
	      }
	      if ( sts == RTT__BACK)
	      {
	        if ( type == RTT_VIEWTYPE_FILE)
	          fclose( ctx->infile);
	        free( ctx->buff);
	        free( ctx->buffrow);
	        free( ctx);
	        rtt_ctx_pop();
	        return RTT__SUCCESS;
	      }
	      if ( sts == RTT__BACKTOCOLLECT)
	      {
	        if ( type == RTT_VIEWTYPE_FILE)
	          fclose( ctx->infile);
	        free( ctx->buff);
	        free( ctx->buffrow);
	        free( ctx);
	        rtt_ctx_pop();
	        return RTT__BACKTOCOLLECT;
	      }
	      if ( sts != RTT__NOPICTURE)
	      {
	        redraw = 1;
	      } 
	      break;
	    case RTT_K_HELP:
	      /* Try to find subject in application help */
	      sts = rtt_help( parent_ctx, "VIEW WINDOW", rtt_appl_helptext);
	      if ( sts == RTT__NOHELPSUBJ)
	          rtt_help( parent_ctx, "OBJECT MENU", 
			(rtt_t_helptext *) rtt_command_helptext);
	      redraw = 1;
	      break;
	  } 
	}

	return RTT__SUCCESS;
}
Beispiel #15
0
int main ( int argc, char **argv ) {
  r_print("%m%g%c", "It ", "Works", "!!!\n");

  return 0;
}