示例#1
0
void analyzer::drop_garbage()
{
    if( peek_char() == EOF )return ;
    while(true){
        char c = read_char();
        if( !isspace(c) ){
            if( c == '/' ){
                if( peek_char() == EOF ){
                    restore_char();
                    return ;
                }
                char cc = read_char();
                if( cc == '/' ){//drop until new line is found
                    while(true){
                        cc = read_char();
                        if( cc == EOF )return ;
                        if( cc == '\n' ){
                            drop_garbage();//maybe the new line has garbage
                            return ;//return from this method
                        }
                    }
                }
                else if( cc == '*' ){//drop until */ is found
                    c = read_char();
                    while( true ){
                        if( c != EOF ){
                            cc = read_char();
                            if( cc == EOF )return ;
                            if( c == '*' && cc == '/' ){
                                drop_garbage();
                                return ;
                            }
                            c = cc ;
                        }
                        else{
                            return ;
                        }
                    }
                }
                else{//we're in good case
                    restore_char(2);
                    break ;
                }
            }
            else{
                restore_char();
                break ;/* means we start at character that is not a begin of comment */
            }
        }
        else{
            drop_garbage();
            break ;
        }
    }
}
示例#2
0
HEADER *
mutt_hcache_restore(const unsigned char *d, HEADER ** oh)
{
  int off = 0;
  HEADER *h = mutt_new_header();
  int convert = !Charset_is_utf8;

  /* skip validate */
  off += sizeof (validate);

  /* skip crc */
  off += sizeof (unsigned int);

  memcpy(h, d + off, sizeof (HEADER));
  off += sizeof (HEADER);

  h->env = mutt_new_envelope();
  restore_envelope(h->env, d, &off, convert);

  h->content = mutt_new_body();
  restore_body(h->content, d, &off, convert);

  restore_char(&h->maildir_flags, d, &off, convert);

  /* this is needed for maildir style mailboxes */
  if (oh)
  {
    h->old = (*oh)->old;
    h->path = safe_strdup((*oh)->path);
    mutt_free_header(oh);
  }

  return h;
}
示例#3
0
static void
restore_parameter(PARAMETER ** p, const unsigned char *d, int *off, int convert)
{
  unsigned int counter;

  restore_int(&counter, d, off);

  while (counter)
  {
    *p = safe_malloc(sizeof (PARAMETER));
    restore_char(&(*p)->attribute, d, off, 0);
    restore_char(&(*p)->value, d, off, convert);
    p = &(*p)->next;
    counter--;
  }

  *p = NULL;
}
示例#4
0
static void
restore_envelope(ENVELOPE * e, const unsigned char *d, int *off, int convert)
{
  int real_subj_off;

  restore_address(&e->return_path, d, off, convert);
  restore_address(&e->from, d, off, convert);
  restore_address(&e->to, d, off, convert);
  restore_address(&e->cc, d, off, convert);
  restore_address(&e->bcc, d, off, convert);
  restore_address(&e->sender, d, off, convert);
  restore_address(&e->reply_to, d, off, convert);
  restore_address(&e->mail_followup_to, d, off, convert);

  restore_char(&e->list_post, d, off, convert);
  restore_char(&e->subject, d, off, convert);
  restore_int((unsigned int *) (&real_subj_off), d, off);

  if (0 <= real_subj_off)
    e->real_subj = e->subject + real_subj_off;
  else
    e->real_subj = NULL;

  restore_char(&e->message_id, d, off, 0);
  restore_char(&e->supersedes, d, off, 0);
  restore_char(&e->date, d, off, 0);
  restore_char(&e->x_label, d, off, convert);

  restore_buffer(&e->spam, d, off, convert);

  restore_list(&e->references, d, off, 0);
  restore_list(&e->in_reply_to, d, off, 0);
  restore_list(&e->userhdrs, d, off, convert);
}
示例#5
0
static void
restore_address(ADDRESS ** a, const unsigned char *d, int *off, int convert)
{
  unsigned int counter;

  restore_int(&counter, d, off);

  while (counter)
  {
    *a = rfc822_new_address();
#ifdef EXACT_ADDRESS
    restore_char(&(*a)->val, d, off, convert);
#endif
    restore_char(&(*a)->personal, d, off, convert);
    restore_char(&(*a)->mailbox, d, off, 0);
    restore_int((unsigned int *) &(*a)->group, d, off);
    a = &(*a)->next;
    counter--;
  }

  *a = NULL;
}
示例#6
0
static void
restore_list(LIST ** l, const unsigned char *d, int *off, int convert)
{
  unsigned int counter;

  restore_int(&counter, d, off);

  while (counter)
  {
    *l = safe_malloc(sizeof (LIST));
    restore_char(&(*l)->data, d, off, convert);
    l = &(*l)->next;
    counter--;
  }

  *l = NULL;
}
示例#7
0
static void
restore_buffer(BUFFER ** b, const unsigned char *d, int *off, int convert)
{
  unsigned int used;
  unsigned int offset;
  restore_int(&used, d, off);
  if (!used)
  {
    return;
  }

  *b = safe_malloc(sizeof (BUFFER));

  restore_char(&(*b)->data, d, off, convert);
  restore_int(&offset, d, off);
  (*b)->dptr = (*b)->data + offset;
  restore_int (&used, d, off);
  (*b)->dsize = used;
  restore_int (&used, d, off);
  (*b)->destroy = used;
}
示例#8
0
static void
restore_body(BODY * c, const unsigned char *d, int *off, int convert)
{
  memcpy(c, d + *off, sizeof (BODY));
  *off += sizeof (BODY);

  restore_char(&c->xtype, d, off, 0);
  restore_char(&c->subtype, d, off, 0);

  restore_parameter(&c->parameter, d, off, convert);

  restore_char(&c->description, d, off, convert);
  restore_char(&c->form_name, d, off, convert);
  restore_char(&c->filename, d, off, convert);
  restore_char(&c->d_filename, d, off, convert);
}
示例#9
0
void advance_class_level( CHAR_DATA *ch )
{                                                      /* ONLY called for multiclasses */
    int                     level = 0;

    if ( ch->firstexp >= exp_class_level( ch, ch->firstlevel + 1, ch->Class ) ) {   /* Levelled 
                                                                                     */
        ch_printf( ch, "\r\n&WYou have now obtained %s level %d!&D\r\n",
                   class_table[ch->Class]->who_name, ++ch->firstlevel );
        ch->firstexp =
            URANGE( 0, ( ch->firstexp - exp_class_level( ch, ch->firstlevel, ch->Class ) ),
                    ch->firstexp );
        advance_level( ch );
    }

    if ( IS_SECONDCLASS( ch ) && ch->secondexp >= exp_class_level( ch, ch->secondlevel + 1, ch->secondclass ) ) {   /* Again 
                                                                                                                     */
        ch_printf( ch, "\r\n&WYou have now obtained %s level %d!&D\r\n",
                   class_table[ch->secondclass]->who_name, ++ch->secondlevel );
        ch->secondexp =
            URANGE( 0, ( ch->secondexp - exp_class_level( ch, ch->secondlevel, ch->secondclass ) ),
                    ch->secondexp );
        advance_level( ch );
    }

    if ( IS_THIRDCLASS( ch ) && ch->thirdexp >= exp_class_level( ch, ch->thirdlevel + 1, ch->thirdclass ) ) {   /* Made 
                                                                                                                 * a 
                                                                                                                 * level! 
                                                                                                                 */
        ch_printf( ch, "\r\n&WYou have now obtained %s level %d!&D\r\n",
                   class_table[ch->thirdclass]->who_name, ++ch->thirdlevel );
        ch->thirdexp =
            URANGE( 0, ( ch->thirdexp - exp_class_level( ch, ch->thirdlevel, ch->thirdclass ) ),
                    ch->thirdexp );
        advance_level( ch );
    }

    if ( IS_THIRDCLASS( ch ) )
        level = ( ( ch->firstlevel + 1 + ch->secondlevel + ch->thirdlevel ) / 3 );
    else if ( IS_SECONDCLASS( ch ) )
        level = ( ( ch->firstlevel + 1 + ch->secondlevel ) / 2 );
    else
        level = ( ch->firstlevel + 1 );

    if ( level > ch->level ) {                         /* Should have gained! */
        char                    buf[MSL];

        if ( xIS_SET( ch->act, PLR_EXTREME ) ) {
            ch_printf( ch, "&GPlaying 6D EXTREME you gain 5 glory!&D\r\n" );
            ch->quest_curr += 5;
        }

        ch_printf( ch, "\r\n&WYou have now obtained an overall experience level %d!&D\r\n",
                   ++ch->level );
        restore_char( ch );
        send_to_char_color( "&YYou have gained insight in the realms, and have been restored!\r\n",
                            ch );
        snprintf( buf, MSL, "The realms rejoice as %s has just achieved level %d!&D", ch->name,
                  ch->level );
        announce( buf );
        snprintf( buf, MSL, "%24.24s: %s obtained level %d!%s%s&D", ctime( &current_time ),
                  ch->name, ch->level, ( doubleexp ? " (Double)" : "" ),
                  ( happyhouron ? " (HappyHour)" : "" ) );
        append_to_file( PLEVEL_FILE, buf );
    }
}
示例#10
0
void analyzer::restore_pos()
{
    restore_char(comp_f_stream.tellg()-acceptace_pos);
}
示例#11
0
void analyzer::restore_char()
{
    restore_char(1);
}
示例#12
0
/* ------------ */
main()
{
register int which; 										/* Ausgel�ste Aktion */
register int i; 												/* Schleifenindex */
int msg[8]; 														/* Message-Buffer */
int dummy;															/* f�r unwichtige Werte */

appl_init();
open_vwork();

fnt_path[0] = Dgetdrv() + 'A';					/* Aktuellen Pfad ermitteln*/
fnt_path[1] = ':';
Dgetpath(fnt_path + 2, 0);
strcat(fnt_path, "\\*.FNT");

rsrc_load("VDI_FONT.RSC");							/* RSC laden */

graf_mouse(ARROW, 0L);									/* Mauspfeil */

set_workarea(); 												/* Hintergrund anlegen */
count_defined();
set_marker(); 													/* Marker positionieren */
restore_char(); 												/* Erstes Zeichen holen */
show_ccharacter();

do
	{
	which = evnt_multi(MU_BUTTON|MU_KEYBD|MU_MESAG,
										 2, 1, 1,
										 0, 0, 0, 0, 0,
										 0, 0, 0, 0, 0,
										 msg,
										 0, 0,
										 &mousex, &mousey, &dummy,
										 &dummy, &key, &clicks);


	switch(which)
		{
		case MU_KEYBD:											/* Tastendruck ? */
			if ((char)key >= 'a' && (char)key <= 'z')
				key &= 0xDF;
				
			if (!(char)key) 									/* Kontrolltaste ?*/
				{
				key >>= 8;
				key |= 0x80;
				}

			for (i = 0; i < KEY_NUM; i++)					/* Passenden Men�eintrag suchen */
				if (m_keys[i] == (char)key)
					{
					which = MU_MESAG;
					msg[0] = MN_SELECTED;
					msg[4] = m_entry[i];
					menu_action(msg); 						/* Men�eintrag ausf�hren */
					break;
					}
			break;

		case MU_MESAG:
			if (msg[0] == MN_SELECTED)				/* Men�eintrag ? */
				{
				menu_action(msg);
				menu_tnormal(menu_adr, msg[3], TRUE);
				}
			break;

		case MU_BUTTON:
			button_click(); 									/* Mausklick */
			break;
		}

	}while(which != MU_MESAG || msg[0] != MN_SELECTED || msg[4] != F_OK);

cls_vwork();
appl_exit();
}