Ejemplo n.º 1
0
Archivo: param.c Proyecto: juddy/edcde
/* Add a keyword to the list of possible values of a keyword parameter for
   the current element
*/
void addkeyword(M_NOPAR)
{
int length ;
PARAMETER *par ;
PTYPE *kw ;

/* Check if duplicate keyword for this parameter */
for (kw = newpar->ptypep ; kw ; kw = kw->nextptr)
    if (w_strcmp(kw->keyword, name) == 0)
	{
	warning3("Warning: Repeated keyword %s in parameter %s of %s",
		 name,
		 newpar->paramname,
		 thisrule) ;
	return ;
	}

/* Check if duplicate keyword within parameters of this element */
for (par = plist ; par != newpar ; par = par->next)
    for (kw = par->ptypep ; kw ; kw = kw->nextptr)
	{
	if (w_strcmp(kw->keyword, name) == 0)
	    warning4("Keyword %s used in parameters %s and %s of %s",
	             name,
		     par->paramname,
		     newpar->paramname,
		     thisrule) ;
	if (! kw->next) break ;
	}
   
*nextptype = (PTYPE *) m_malloc(sizeof(PTYPE), "ptype") ;
if (newpar->kwlist) thisptype->next = ptypelen + 1 ;
else
    {
    newpar->kwlist = ptypelen + 1 ;
    newpar->ptypep = *nextptype ;
    }
thisptype = *nextptype ;
thisptype->next = M_NULLVAL ;
thisptype->nextptr = NULL ;
nextptype = &(thisptype->nextptr) ;
length = w_strlen(name) + 1 ;
thisptype->keyword = (M_WCHAR *) m_malloc(length, "keyword") ;
w_strcpy(thisptype->keyword, name) ;
kwlen += length ;
ptypelen++ ;
}
Ejemplo n.º 2
0
void IntervalTimerTick(int sig, self_code_info_t *info, self_sig_context_t *scp) {
  // A Mac OS X application, ApplicationEnhancer, causes the VM to receive nested
  // SIGALRM/SIGVTALRM signals.
  // We don't know why this is happening, since our call to sigaction (where
  // the SIGALRM/SIGVTALRM handlers are installed) specified that we don't want
  // recursive timer signals.
  // As a workaround to this funny behaviour induced by ApplicationEnhancer, we
  // check if we're in a recursive SIGALRM/SIGVTALRM handler.  If we receive a
  // recursive SIGALRM/SIGVTALRM signal, then we immediately return from the
  // signal handler.  This is OK since it's not a catastrophe if we ignore a
  // timer signal. -mabdelmalek 10/02
  
  // Now we are getting SIGIO's while in the SIGVTALRM handler, maybe
  // caused by ApplicationEnhancer--argh! -- dmu 6/03
  
  if (InterruptedContext::the_interrupted_context->forwarded_to_self_thread(sig))
    return;
  
  if (SignalInterface::currentNonTimerSignal || SignalInterface::currentTimerSignal) {
    static bool haveWarned = false;
    if (!haveWarned) {
# if TARGET_OS_VERSION == LINUX_VERSION
      warning3("IntervalTimerTick: signal_handler cannot nest (only one interrupted context).\n"
               "Received timer sig %d while in sig %d or timer sig %d.\n"
               "MacOSX ApplicationEnhancer causes apps to get signals that should be blocked.",
               sig, 
               SignalInterface::currentNonTimerSignal,
               SignalInterface::currentTimerSignal);
# else
      warning6("IntervalTimerTick: signal_handler cannot nest (only one interrupted context).\n"
               "Received timer sig %d (sig%s) while in sig %d (sig%s) or timer sig %d (sig%s).\n"
               "MacOSX ApplicationEnhancer causes apps to get signals that should be blocked.",
               sig, sys_signame[sig],
               SignalInterface::currentNonTimerSignal, sys_signame[SignalInterface::currentNonTimerSignal],
               SignalInterface::currentTimerSignal, sys_signame[SignalInterface::currentTimerSignal]);
# endif
      haveWarned = true;
    }
    return;
  }           
  SignalInterface::currentTimerSignal = sig;       

  // this is called at every tick of our timer
  if (processSemaphore || IntervalTimer::dont_use_any_timer) {
    // We're in a critical region, so return from the timer interrupt 
    // without overwriting InterruptedContext::the_interrupted_context.
    // The check for dont_use_any_timer is for better debugging with gdb.

    SignalInterface::currentTimerSignal = 0;
    return;
  }
  
# if TARGET_OS_VERSION != MACOSX_VERSION
  // The following assertion fails on Mac OS X when ApplicationEnhancer is running.
  // Since it's not critical that we execute on a signal stack, we can skip
  // the assertion.  -mabdelmalek 10/02
  assert(SignalInterface::is_on_signal_stack(), "should be on interrupt stack");
# endif
  assert(!IntervalTimer::dont_use_any_timer, "should not have timer interrupts");
  
  InterruptedContext::the_interrupted_context->set(scp);

  IntervalTimer* t =  sig == SIGALRM ? IntervalTimer::Real_timer() 
                                     : IntervalTimer:: CPU_timer();
  t->do_async_tasks();
  
  if ( PendingSelfSignals::keyboard_signals() != 0 ) 
    preemptor();
        
  InterruptedContext::the_interrupted_context->invalidate();

  SignalInterface::currentTimerSignal = 0;

  if (IntervalTimer::dont_use_any_timer  && sig == SIGVTALRM)
    IntervalTimerTick(SIGALRM, info, scp);  // simulate real timer
  }