Esempio n. 1
0
static void eforinst(Tobj co, int ci)
{
    volatile jmp_buf *opljbufp;
    volatile jmp_buf pljbuf;
    volatile Tobj tblo, c1o;
    volatile Tkvindex_t tkvi;
    volatile tnk_t tnk;
    volatile long km, t;
    volatile int ei1, ei2, si;

    c1o = (volatile Tobj) co;	/* protect argument from longjmp */
    ei1 = TCgetfp(c1o, ci);
    ei2 = TCgetnext(c1o, ei1);
    si = TCgetnext(c1o, ei2);
    if (getvar((Tobj) c1o, ei1, (tnk_t *) & tnk) == -1) {
	err(ERRNOLHS, ERR3, c1o, ei1);
	return;
    }
    if (tnk.type == TNK_O)
	km = Mpushmark(tnk.u.tnko.ko);
    if (!(tblo = (volatile Tobj) eeval((Tobj) c1o, ei2))) {
	if (tnk.type == TNK_O)
	    Mpopmark(km);
	err(ERRNORHS, ERR4, c1o, ei2);
	return;
    }
    if (Tgettype(tblo) != T_TABLE) {
	err(ERRNOTATABLE, ERR1, c1o, ei2);
	return;
    }
    PUSHJMP(opljbufp, pljbufp1, pljbuf);
    t = Tgettime(tblo);
    for (Tgetfirst((Tobj) tblo, (Tkvindex_t *) & tkvi); tkvi.kvp;
	 Tgetnext((Tkvindex_t *) & tkvi)) {
	setvar(tnk, tkvi.kvp->ko);
	if (setjmp(*pljbufp1) != 0) {
	    if (pljtype == PLJ_CONTINUE)
		continue;
	    else if (pljtype == PLJ_BREAK)
		break;
	}
	eeval((Tobj) c1o, si);
	if (t != Tgettime(tblo)) {
	    err(ERRTABLECHANGED, ERR1, c1o, ei2);
	    break;
	}
    }
    POPJMP(opljbufp, pljbufp1);
    if (tnk.type == TNK_O)
	Mpopmark(km);
}
Esempio n. 2
0
/* --------------------- */
void get_time(char *s_adr)
{
timeinfo t_info;

strcpy(s_adr, "9999");

t_info.realtime = Tgettime();

make_asc((long)t_info.part.hours, 10L, s_adr);
make_asc((long)t_info.part.minutes, 10L, s_adr + 2);
}
Esempio n. 3
0
/* update is called only for TXT_FULL tables */
static void update (txtnode_t *pnode, long ptim) {
    txtnode_t *cnode, *seennode;
    long ctim;
    int i;

    Gawsetmode (&Gwidgets[pnode->u.f.t.mwi], TRUE);
    if (!pnode->u.f.t.list)
        buildlist (pnode);
    else if (ptim < Tgettime (pnode->vo))
        rebuildlist (pnode);
    for (
        i = 0, cnode = &pnode->u.f.t.list[0]; i < pnode->u.f.t.n;
        i++, cnode++
    ) {
        ctim = cnode->time;
        if (txtvo2toggle == cnode->vo) {
            switch (cnode->mode) {
            case TXT_SEEN:
                break;
            case TXT_ABSTRACT:
                unfillnode (cnode);
                cnode->mode = TXT_FULL;
                fillnode (pnode, cnode);
                break;
            case TXT_FULL:
                unfillnode (cnode);
                cnode->mode = TXT_ABSTRACT;
                fillnode (pnode, cnode);
                break;
            }
        }
        if (!(seennode = findseen (cnode)))
            add2seen (cnode);
        if (
            seennode && cnode->mode == TXT_SEEN && seennode->ko != cnode->u.s.ko
        ) {
            unfillnode (cnode);
            cnode->u.s.txtnode = seennode;
            cnode->u.s.ko = seennode->ko;
            fillnode (pnode, cnode);
        } else if (seennode && cnode->mode != TXT_SEEN) {
            unfillnode (cnode);
            cnode->mode = TXT_SEEN;
            cnode->u.s.txtnode = seennode;
            cnode->u.s.ko = seennode->ko;
            fillnode (pnode, cnode);
        } else if (!seennode && cnode->mode == TXT_SEEN) {
            unfillnode (cnode);
            cnode->mode = TXT_ABSTRACT;
            fillnode (pnode, cnode);
        } else if (cnode->time == -1) {
            unfillnode (cnode);
            if (seennode)
                cnode->u.s.txtnode = seennode;
            fillnode (pnode, cnode);
        }
        if (cnode->ttype == T_TABLE && cnode->mode == TXT_FULL)
            update (cnode, ctim);
    }
    Gaworder (&Gwidgets[pnode->u.f.t.mwi], pnode, orderfunc);
    Gawsetmode (&Gwidgets[pnode->u.f.t.mwi], FALSE);
}
Esempio n. 4
0
void main_loop(void)
{
	EVENT	ev;
	bool	menu_chg;
	long	as_timer = 0, t;
	
	/* Message-Handler f�r Fenster-Dialoge und -Alerts */
	set_mdial_wincb(handle_msg);
	
	update_menu();
	menu_chg = FALSE;
	onblink_edit();
	do
	{
		quick_close = FALSE; 						/* Sichern der Texte ohne Nachfrage */
		next_action (&ev);
/*
		get_realtop();
*/
		if (ev.which == MU_TIMER) 					/* Zeit (nur wenn nichts anderes anliegt) */
		{
			timer_se();
			if (blinking_cursor)
				blink_edit();
			if (clip_on_disk)
				save_clip();

			if (as_text || as_prj)
			{
				/*
				 * Weil der do_all_icon() recht viel Rechenzeit verheizt, und
				 * AutoSave min. 1 min wartet, wird er nur jede Minute aufgerufen.
				*/
				t = Tgettime();
				if ((t - as_timer) >= 32)
				{
					do_all_icon(ALL_TYPES, DO_AUTOSAVE);
					as_timer = t;
				}
			}
		}
		if (ev.which & MU_KEYBD)					/* Taste */
		{
			offblink_edit();
			handle_keybd(ev.kstate, ev.kreturn);
			menu_chg = TRUE;
			onblink_edit();
			while (idle()) 							/*	Auch f�r Makro-Play-Abbruch */
				;
		}
		if (ev.which & MU_BUTTON)					/* Mausknopf */
		{
			offblink_edit();
			handle_button(ev.m_x, ev.m_y, ev.bstate, ev.kstate, ev.breturn);
			menu_chg = TRUE;
			onblink_edit();
		}
		if (ev.which & MU_MESAG)					/* Meldung */
		{
			if (ev.msg[0] == MN_SELECTED)
				menu_ctrl = (ev.kstate & K_CTRL);
			offblink_edit();
			handle_msg(ev.msg);
			menu_chg = TRUE;
			onblink_edit();
		}
		if (ev.which & MU_M1)						/* Maus bewegt */
			wake_mouse();

		if (menu_chg && !is_event())				/* Wenn Zeit */
		{
			update_menu();								/* Eine Aktion kann Men�s ver�ndern */
			menu_chg = FALSE;
		}
		end_undo_seq();
		if (abort_prog)
		{
			int	msg[] = {0,0,0,0,0,0,0,0};

			msg[0] = AP_TERM;
			msg[1] = gl_apid;
			appl_write(gl_apid, 16, msg);
		}
	} while (! done);
}
Esempio n. 5
0
WORD
wrfile( char *fstr )
{
	REG int 	ret, retmsg;
	int 		inhand,outhand;
	int		time[2];
	DMABUFFER 	*mydta, *saved;
	char 		*buffer;
	long 		copysiz, bufsiz, wrsiz, tmpsiz; 
	int 		crted,sttime;
	char		buf[2];

	crted = 0;
	sttime = 1;
	retmsg = TRUE;
	rename = 0;
open:					/* open the source file	*/
	if ( ( inhand = (WORD)Fopen(fixsrc, 0) ) < 0 )		
	{				/* seek error or drive not ready */	
/*	  if ( (inhand == E_SEEK) || (inhand == EDRVNR) )
	    return( FALSE );
*/					/* skip	*/
	  if ( ( ret = fill_string( fixsrc, CNTOPEN ) ) == 1 )
	  {
	    updatnum(NUMFILE, --numfiles);
	    return SKIP;
	  }
	  else if (ret == 2)			/* retry */
		  goto open;
		else 				/* abort */
		  goto ww_3;
	}

	if ( !ch_undo() || f_cancel )		/* user want to stop */
	{
	  Fclose( inhand );
ww_3:	  f_abort = 1;
	  return( FALSE );
	}		  

	saved = (DMABUFFER *)Fgetdta();
	Fsetdta(mydta=(DMABUFFER *)malloc( (long)sizeof(DMABUFFER)));

	if ( Fsfirst( fixsrc, 0x37 ) )	
	{
	   retmsg = SKIP;
	   if ( do1_alert( RDERROR ) == 2 )	/* abort */
	   {
	     f_abort = 1;
	     retmsg = FALSE;
	   }
	   goto y2;
	}

	copysiz = mydta->d_fsize;
	buffer = (char *)malloc( copysiz );
	if ( buffer )
	{
	  bufsiz = copysiz;
	}
	else
	{
	  for (bufsiz = 128*1024L; bufsiz >= 1024L; bufsiz /= 2)
	  {
	    if ((buffer = (char *)malloc( bufsiz )) != 0)
	      break;
	  }
	  if (!buffer)
	    goto y2;
	}
  
	Fdatime( &time, inhand, 0 );	/* read the time and date */

rechkd:
	switch(chkdf(fstr, CPFILE))
	{
	    case CHECK:	
	      goto rechkd;

	    case SKIP:	
	      retmsg = SKIP;	
	      goto y1;

	    case QUIT:	
	      f_abort = 1;
	      retmsg = FALSE;
	      goto y1;

	    case FALSE:	
              retmsg = FALSE;
	      goto y1;
	}


	/* if it is move operation, then try rename first	*/

	if ( opcode == OP_MOVE )
	{			/* if same name and path, don't do it */
	  if ( strcmp( fixsrc, fixdst ) )
	    goto y22;
	
	  Fclose( inhand );

	  if ( Frename(0, fixsrc, fixdst) >= 0 )
   	  {	
	    inhand = (WORD)Fopen( fixdst, 0 );
	    if ( !p_timedate )		/* get the new time and date */
	    {
	      time[0] = Tgettime();
	      time[1] = Tgetdate();
	      Fdatime( &time, inhand, 1 ); 	
	    }
y22:	    
	    rename = 1;
	    goto y1;
	  }
	  else
	    inhand = (WORD)Fopen( fixsrc, 0 );		
	}


	while ( copysiz >= 0 ) 	/* let it passes through for zero file */
	{
	  tmpsiz = (copysiz > bufsiz) ? bufsiz : copysiz;
	  if (Fread(inhand, tmpsiz, buffer) < 0)	
	  {
	    retmsg = SKIP;
	    if ( crted )	
	      Fdelete( fixdst );

	    if (do1_alert( RDERROR ) == 2)	
	    {					/* abort */
	      f_abort = 1;
	      retmsg = FALSE;
	    }
	    goto y1;			/* skip */
	  }




create:
	  if ( sttime )
	  {
	    sttime = 0;

	    if ((outhand = (WORD)Fcreate(fixdst, mydta->d_fattr&7)) < 0)	
	    {
	      if ( ( ret = fill_string( fixdst, CNTCRTFL ) ) == 2 )
		goto create;

	      else if (ret == 3)				/* abort */
	      {
		 f_abort = 1;
		 retmsg = FALSE;
	      }
	      else	
		retmsg = SKIP;

	      goto y1;
	    }

	    crted = 1;
	  }

	  if ((wrsiz = Fwrite(outhand, tmpsiz, buffer)) < 0)	
	  {
	     retmsg = SKIP;
	     Fclose(outhand);
	     Fdelete(fixdst);

	    if (do1_alert( WRERROR ) == 2)	
	    {					/* abort */
	      f_abort = 1;
	      retmsg = FALSE;
	    }

	    goto y1;
	   }
				/* check if there are sufficent memory */
	   if (wrsiz != tmpsiz)		
	   { 			/* not sufficent memory ??*/
	      f_abort = 1;
	      retmsg = FALSE;
	      Fclose(outhand);	
	      Fdelete(fixdst);
	      buf[0] = *fixdst;
	      buf[1] = 0;
	      fill_string( buf, STDISKFU );
	      goto y1;
	   }

	   copysiz -= tmpsiz;
	   if ( !copysiz )
	     break;
	}

	if ( p_timedate )
	  Fdatime( &time, outhand, 1 );	

y0:
	Fclose(outhand);
y1:
	free(buffer);
y2:
	updatnum(NUMFILE, --numfiles);
	Fsetdta(saved);
y3:
	Fclose(inhand);
	free(mydta);

	if ( ( opcode == OP_MOVE ) && ( retmsg == TRUE ) )
	  upfdesk( fixsrc, fixdst );
	
	return(retmsg);
}