void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, void (*handler)(int)) { unsigned long flags; sigjmp_buf switch_buf, fork_buf; *switch_buf_ptr = &switch_buf; *fork_buf_ptr = &fork_buf; /* Somewhat subtle - siglongjmp restores the signal mask before doing * the longjmp. This means that when jumping from one stack to another * when the target stack has interrupts enabled, an interrupt may occur * on the source stack. This is bad when starting up a process because * it's not supposed to get timer ticks until it has been scheduled. * So, we disable interrupts around the sigsetjmp to ensure that * they can't happen until we get back here where they are safe. */ flags = get_signals(); block_signals(); if(sigsetjmp(fork_buf, 1) == 0) new_thread_proc(stack, handler); remove_sigstack(); set_signals(flags); }
void read_signal ( TWindow *parent ) { int nsigs ; char error[256] ; ReadSignalDialog *rs ; Signal **signals ; nsigs = get_signals ( &signals ) ; rs = new ReadSignalDialog ( parent , nsigs , signals ) ; if (rs->Execute() == IDOK) { if (strlen ( rs->file_name ) && strlen ( rs->dest_name )) { if (process ( ID_PRED_NAME , rs->dest_name , NULL , error , NULL ) < 0) parent->MessageBox ( error , "ERROR" ) ; if (process ( ID_PRED_READSIG , rs->file_name , NULL , error , NULL) < 0) parent->MessageBox ( error , "ERROR" ) ; } if (! strlen ( rs->file_name )) parent->MessageBox ( "No file name specified" , "ERROR" ) ; if (! strlen ( rs->dest_name )) parent->MessageBox ( "No signal name specified" , "ERROR" ) ; } delete rs ; }
std::string get_defs(GType gtype, GTypeIsAPointerFunc is_a_pointer_func) { std::string strObjectName = g_type_name(gtype); std::string strDefs; if (G_TYPE_IS_OBJECT(gtype) || G_TYPE_IS_INTERFACE(gtype)) { strDefs = ";; From " + strObjectName + "\n\n"; strDefs += get_signals(gtype, is_a_pointer_func); strDefs += get_properties(gtype); } else strDefs = ";; " + strObjectName + " is neither a GObject nor a GInterface. Not checked for signals and properties.\n\n"; return strDefs; }
void save_signal ( TWindow *parent ) { int nsigs ; char error[256], rest[256] ; SaveSignalDialog *ss ; Signal **signals ; nsigs = get_signals ( &signals ) ; ss = new SaveSignalDialog ( parent , nsigs , signals ) ; if (ss->Execute() == IDOK) { if (strlen ( ss->file_name ) && strlen ( ss->source_name )) { sprintf ( rest , "%s TO %s", ss->source_name, ss->file_name ) ; if (process ( ID_PRED_SAVESIG , rest , NULL , error , NULL) < 0) parent->MessageBox ( error , "ERROR" ) ; } if (! strlen ( ss->file_name )) parent->MessageBox ( "No file name specified" , "ERROR" ) ; if (! strlen ( ss->source_name )) parent->MessageBox ( "No signal name specified" , "ERROR" ) ; } delete ss ; }
void set_conf_comp ( TWindow *parent ) { int nsigs, type ; char error[256], rest[256] ; ConfCompDialog *ccd ; Signal **signals ; nsigs = get_signals ( &signals ) ; ccd = new ConfCompDialog ( parent , nsigs , signals ) ; if (ccd->Execute() == IDOK) { if (ccd->parm_clear) process ( ID_PRED_CLEAR_CONFIDENCE , NULL , NULL , error , NULL ) ; strcpy ( rest , ccd->parm_sig ) ; if (strlen ( ccd->parm_per)) { strcat ( rest , " PER " ) ; strcat ( rest , ccd->parm_per ) ; } switch (ccd->parm_type) { case CCcenter: type = ID_PRED_CONFIDENCE_CENTER ; break ; case CCdetrend: type = ID_PRED_CONFIDENCE_DETREND ; break ; case CCoffset: type = ID_PRED_CONFIDENCE_OFFSET ; break ; case CCscale: type = ID_PRED_CONFIDENCE_SCALE ; break ; case CCstandardize: type = ID_PRED_CONFIDENCE_STANDARDIZE ; break ; case CClog: type = ID_PRED_CONFIDENCE_LOG ; break ; case CCdifference: type = ID_PRED_CONFIDENCE_DIFFERENCE ; break ; case CCseasonal: type = ID_PRED_CONFIDENCE_SEASONAL ; break ; } if (process ( type , rest , NULL , error , NULL ) < 0) parent->MessageBox ( error , "ERROR" ) ; } delete ccd ; }
void do_modify ( TWindow *parent ) { int nsigs, type ; char error[256], rest[256] ; ModifyDialog *mod ; Signal **signals ; nsigs = get_signals ( &signals ) ; mod = new ModifyDialog ( parent , nsigs , signals ) ; if (mod->Execute() == IDOK) { if (mod->parm_type == ID_PRED_CENTER) { if (mod->parm_undo) type = ID_PRED_UNDO_CENTER ; else if (mod->parm_median) type = ID_PRED_MEDIAN_CENTER ; else type = ID_PRED_CENTER ; strcpy ( rest , mod->source_name ) ; } else if (mod->parm_type == ID_PRED_DETREND) { if (mod->parm_undo) type = ID_PRED_UNDO_DETREND ; else type = ID_PRED_DETREND ; strcpy ( rest , mod->source_name ) ; } else if (mod->parm_type == ID_PRED_OFFSET) { if (mod->parm_undo) { type = ID_PRED_UNDO_OFFSET ; strcpy ( rest , mod->source_name ) ; } else { type = ID_PRED_OFFSET ; sprintf ( rest , "%lf %s", mod->parm_offset, mod->source_name ) ; } } else if (mod->parm_type == ID_PRED_SCALE) { if (mod->parm_undo) { type = ID_PRED_UNDO_SCALE ; strcpy ( rest , mod->source_name ) ; } else { type = ID_PRED_SCALE ; sprintf ( rest , "%lf %s", mod->parm_scale, mod->source_name ) ; } } else if (mod->parm_type == ID_PRED_STANDARDIZE) { if (mod->parm_undo) type = ID_PRED_UNDO_STANDARDIZE ; else type = ID_PRED_STANDARDIZE ; strcpy ( rest , mod->source_name ) ; } else if (mod->parm_type == ID_PRED_DIFFERENCE) { if (mod->parm_undo) { type = ID_PRED_UNDO_DIFFERENCE ; strcpy ( rest , mod->source_name ) ; } else { type = ID_PRED_DIFFERENCE ; sprintf ( rest , "%d %s", mod->parm_diff, mod->source_name ) ; } } else if (mod->parm_type == ID_PRED_SEASONAL_DIFFERENCE) { if (mod->parm_undo) { type = ID_PRED_UNDO_SEASONAL_DIFFERENCE ; strcpy ( rest , mod->source_name ) ; } else { type = ID_PRED_SEASONAL_DIFFERENCE ; sprintf ( rest , "%d %s", mod->parm_seasonal, mod->source_name ) ; } } else if (mod->parm_type == ID_PRED_LOG) { type = ID_PRED_LOG ; strcpy ( rest , mod->source_name ) ; } else if (mod->parm_type == ID_PRED_EXP) { type = ID_PRED_EXP ; strcpy ( rest , mod->source_name ) ; } else if (mod->parm_type == ID_PRED_INTEGRATE) { type = ID_PRED_INTEGRATE ; sprintf ( rest , "%d %s", mod->parm_integrate, mod->source_name ) ; } if (mod->parm_undo && strlen ( mod->per_name )) { strcat ( rest , " PER " ) ; strcat ( rest , mod->per_name ) ; } if (process ( type , rest , NULL , error , NULL ) < 0 ) parent->MessageBox ( error , "ERROR" ) ; } delete mod ; }