int set_video_mode(QSP_ARG_DECL PGR_Cam *pgcp, dc1394video_mode_t mode) { dc1394framerate_t fr; if( pgcp == NULL ) return -1; if( dc1394_video_set_mode( pgcp->pc_cam_p, mode) != DC1394_SUCCESS ){ WARN("unable to set video mode"); return -1; } pgcp->pc_video_mode = mode; fr=pgcp->pc_framerate; if( set_default_framerate(QSP_ARG pgcp) < 0 ){ advise("Unable to set default framerate for new video mode"); } else { if( fr != pgcp->pc_framerate ){ sprintf(ERROR_STRING, "set_video_mode: framerate changed from %s to %s", name_for_framerate(fr), name_for_framerate(pgcp->pc_framerate) ); advise(DEFAULT_ERROR_STRING); } } return 0; }
static void init_buffer_objects(QSP_ARG_DECL PGR_Cam * pgcp ) { int i; dc1394video_frame_t *framep; char fname[TMPSIZE]; Data_Obj *dp; sprintf(ERROR_STRING,"Initializing %d buffer objects...", pgcp->pc_ring_buffer_size); advise(ERROR_STRING); // Cycle once through the ring buffer, // making a data object for each frame for(i=0;i<pgcp->pc_ring_buffer_size;i++){ if ( dc1394_capture_dequeue( pgcp->pc_cam_p, DC1394_CAPTURE_POLICY_WAIT, &framep ) != DC1394_SUCCESS) { error1("init_buffer_objects: error in dc1394_capture_dequeue!?" ); } snprintf(fname,TMPSIZE,"_frame%d",framep->id); assert( i == framep->id ); dp = make_1394frame_obj(QSP_ARG framep); if( dc1394_capture_enqueue(pgcp->pc_cam_p,framep) != DC1394_SUCCESS ){ error1("init_buffer_objects: error enqueueing frame!?"); } // Here we might store dp in a table... } advise("Done setting up buffer objects."); }
static void print_advice(int show_hint, struct replay_opts *opts) { char *msg = getenv("GIT_CHERRY_PICK_HELP"); if (msg) { fprintf(stderr, "%s\n", msg); /* * A conflict has occurred but the porcelain * (typically rebase --interactive) wants to take care * of the commit itself so remove CHERRY_PICK_HEAD */ unlink(git_path_cherry_pick_head()); return; } if (show_hint) { if (opts->no_commit) advise(_("after resolving the conflicts, mark the corrected paths\n" "with 'git add <paths>' or 'git rm <paths>'")); else advise(_("after resolving the conflicts, mark the corrected paths\n" "with 'git add <paths>' or 'git rm <paths>'\n" "and commit the result with 'git commit'")); } }
static void _rgb2rb(QSP_ARG_DECL float *vec) /** returns luminance in vec[2] */ { float totlum; #ifdef CAUTIOUS if( !know_white ) error1("CAUTIOUS: rgb2rb: don't know white!?"); #endif /* CAUTIOUS */ showvec(vec); totlum=rgb_norm(vec); sprintf(ERROR_STRING,"rgb2rb: totlum = %g",totlum); advise(ERROR_STRING); /* vec is now fractional luminances (sum to 1) */ showvec(vec); advise("p2c_mat"); showvec(p2c_mat[0]); showvec(p2c_mat[1]); showvec(p2c_mat[2]); apply_mat3x3(vec,p2c_mat); /* now contains rb and lum */ advise("rgb2rb: after p2c_mat"); showvec(vec); vec[2]=totlum; showvec(vec); }
static COMMAND_FUNC( do_clear_depth ) { if( debug & gl_debug ) advise("glClearDepth 1.0"); glClearDepth(1.0); if( debug & gl_debug ) advise("glClear GL_DEPTH_BUFFER_BIT"); glClear(GL_DEPTH_BUFFER_BIT); }
debug_flag_t _add_debug_module(QSP_ARG_DECL const char *name) { Debug_Module *dmp; dmp = new_debug(name); if( dmp == NULL ) return 0; if( n_debug_modules < 0 ) init_dbm(); if( n_debug_modules >= MAX_DEBUG_MODULES ){ sprintf(ERROR_STRING,"Can't add debug module %s",name); warn(ERROR_STRING); sprintf(ERROR_STRING,"n is %d",n_debug_modules); advise(ERROR_STRING); sprintf(ERROR_STRING,"Max is %ld",(long)MAX_DEBUG_MODULES); advise(ERROR_STRING); advise("Modules:"); list_debugs(tell_errfile()); return(0); } SET_DEBUG_MASK(dmp, 1 << n_debug_modules++ ); SET_DEBUG_FLAGS(dmp, DEBUG_SET); // default return(DEBUG_MASK(dmp)); }
int vt_echo (int echo) { if (!telnet_profile) { advise (LLOG_NOTICE,NULLCP, "not using TELNET profile"); return; } if ((ni_image & ECHO_OBJ) != (nego_state & ECHO_OBJ)) { advise (LLOG_NOTICE,NULLCP, "negotiation in progress, try again later..."); return; } if (echo != ((nego_state & ECHO_OBJ) ? 1 : 0)) { if (echo) ni_image |= ECHO_OBJ; else ni_image &= ~ECHO_OBJ; vt_set_nego(ni_image,ECHO_OBJ);/*Set proper UNIX echo state when reponse is received. */ } else advise (LLOG_NOTICE,NULLCP, "already using %s echoing", echo ? "remote" : "local"); }
void _log_message(QSP_ARG_DECL const char *msg) { const char *log_time; log_time = get_date_string(SINGLE_QSP_ARG); if( HAS_PREV_LOG_MSG(THIS_QSP) ){ if( !strcmp(msg,PREV_LOG_MSG(THIS_QSP)) ){ INCREMENT_LOG_MSG_COUNT(THIS_QSP); return; } else { unsigned long c; if( (c=LOG_MSG_COUNT(THIS_QSP)) > 1 ){ sprintf(ERROR_STRING, "%s: previous message was repeated %ld time%s", log_time,c-1,c==2?"":"s"); advise(ERROR_STRING); } } rls_str(PREV_LOG_MSG(THIS_QSP)); } else { SET_QS_FLAG_BITS(THIS_QSP,QS_HAS_PREV_LOG_MSG); } sprintf(ERROR_STRING,"%s: %s", log_time,msg); advise(ERROR_STRING); SET_PREV_LOG_MSG(THIS_QSP,savestr(msg)); SET_LOG_MSG_COUNT(THIS_QSP,1); }
void _insure_cuda_device(QSP_ARG_DECL Data_Obj *dp ) { Cuda_Device *cdp; if( AREA_FLAGS(OBJ_AREA(dp)) & DA_RAM ){ sprintf(ERROR_STRING, "insure_cuda_device: Object %s is a host RAM object!?",OBJ_NAME(dp)); warn(ERROR_STRING); return; } cdp = (Cuda_Device *) AREA_CUDA_DEV(OBJ_AREA(dp)); assert( cdp != NULL ); if( curr_cdp != cdp ){ sprintf(ERROR_STRING,"insure_cuda_device: curr_cdp = 0x%"PRIxPTR" cdp = 0x%"PRIxPTR, (uintptr_t)curr_cdp,(uintptr_t)cdp); advise(ERROR_STRING); sprintf(ERROR_STRING,"insure_cuda_device: current device is %s, want %s", curr_cdp->cudev_name,cdp->cudev_name); advise(ERROR_STRING); set_cuda_device(cdp); } }
static COMMAND_FUNC( do_fmt7_setposn ) { uint32_t h,v; h=HOW_MANY("horizontal position (left)"); v=HOW_MANY("vertical position (top)"); CHECK_CAM // What are the constraints as to what this can be??? // At least on the flea, the position has to be even... if( h & 1 ){ sprintf(ERROR_STRING,"Horizontal position (%d) should be even, rounding down to %d.",h,h&(~1)); advise(ERROR_STRING); h &= ~1; } if( v & 1 ){ sprintf(ERROR_STRING,"Vertical position (%d) should be even, rounding down to %d.",v,v&(~1)); advise(ERROR_STRING); v &= ~1; } UNIMP_MSG("fmt7_posn"); }
static int op_timeOfDay (int sd, struct RyOperation *ryo, struct RoSAPinvoke *rox, caddr_t in, struct RoSAPindication *roi) { long clock; struct type_IMISC_TimeResult trs; struct type_IMISC_TimeResult *tr = &trs; if (rox -> rox_nolinked == 0) { advise (NULLCP, LOG_INFO, "RO-INVOKE.INDICATION/%d: %s, unknown linkage %d", sd, ryo -> ryo_name, rox -> rox_linkid); return ureject (sd, ROS_IP_LINKED, rox, roi); } if (debug) advise (NULLCP, LOG_DEBUG, "RO-INVOKE.INDICATION/%d: %s", sd, ryo -> ryo_name); if (time (&clock) == NOTOK) return error (sd, error_IMISC_unableToDetermineTime, (caddr_t) NULL, rox, roi); tr -> parm = clock + 2208988800; if (RyDsResult (sd, rox -> rox_id, (caddr_t) tr, ROS_NOPRIO, roi) == NOTOK) ros_adios (&roi -> roi_preject, "RESULT"); return OK; }
static int read_next_record(QSP_ARG_DECL void * raw_pdp, int station ) { char data_string[6][32]; int i; int c, expect_c; fprintf(stderr,"read_next_record 0x%lx\n",(long)raw_pdp); /* read any leading spaces */ do { c=good_polh_char(); } while( isspace(c) ); while( c != '0' ){ sprintf(ERROR_STRING, "read 0x%x, expected '0' in first header position",c); warn(ERROR_STRING); c=good_polh_char(); } c=good_polh_char(); expect_c = '1' + curr_station_idx; while( c != expect_c ){ sprintf(ERROR_STRING, "read '%c' (0x%x), expected '%c' in second header position", c,c,expect_c); warn(ERROR_STRING); c=good_polh_char(); } c=good_polh_char(); if( c != 'D' && c != 'Y' ){ sprintf(ERROR_STRING, "read '%c' (0x%x), expected 'D' or 'Y' in third header position",c,c); //warn(ERROR_STRING); advise(ERROR_STRING); c=good_polh_char(); sprintf(ERROR_STRING, "read '%c' (0x%x) after unexpected character",c,c); //warn(ERROR_STRING); advise(ERROR_STRING); } /* BUG don't assume 6 data - use format? */ for(i=0;i<6;i++){ read_data_string(data_string[i]); // advise(data_string[i]); /* raw_pdp doesn't indicate the format? */ } // BUG how do we know that these are the data that were requested??? assign_var("polh_x_pos",data_string[0]); assign_var("polh_y_pos",data_string[1]); assign_var("polh_z_pos",data_string[2]); assign_var("polh_x_rot",data_string[3]); assign_var("polh_y_rot",data_string[4]); assign_var("polh_z_rot",data_string[5]); return(0); }
static Disp_Obj * default_x_display(SINGLE_QSP_ARG_DECL) { const char *dname; Disp_Obj *dop; int which_depth; char *s; dname = check_display(SINGLE_QSP_ARG); /* these two lines added so this can be called more than once */ dop = disp_obj_of(QSP_ARG dname); if( dop != NO_DISP_OBJ ) return(dop); s=getenv("DESIRED_DEPTH"); if( s != NULL ){ int desired_depth; desired_depth=atoi(s); sprintf(ERROR_STRING,"Desired depth %d obtained from environment",desired_depth); advise(ERROR_STRING); dop = open_display(QSP_ARG dname,desired_depth); if( dop != NO_DISP_OBJ ) return(dop); sprintf(ERROR_STRING,"Unable to open display %s with $DESIRED_DEPTH (%d)", dname,desired_depth); NWARN(ERROR_STRING); } for(which_depth=0;which_depth<MAX_DISPLAY_DEPTHS;which_depth++){ dop = open_display(QSP_ARG dname,possible_depths[which_depth]); if( dop != NO_DISP_OBJ ){ if( verbose ){ sprintf(ERROR_STRING, "Using depth %d on display %s", possible_depths[which_depth],dname); advise(ERROR_STRING); } return(dop); } else { if( verbose && which_depth<(MAX_DISPLAY_DEPTHS-1) ){ sprintf(ERROR_STRING, "Couldn't get %d bit visual on device %s, trying %d", possible_depths[which_depth],dname, possible_depths[which_depth+1]); advise(ERROR_STRING); } } } if( verbose ){ sprintf(ERROR_STRING, "Couldn't get %d bit visual on device %s, giving up", possible_depths[MAX_DISPLAY_DEPTHS-1],dname); advise(ERROR_STRING); } return(dop); } /* end default_x_display */
static dased (int vecp, char **vec) { int sd; struct TSAPstart tss; struct TSAPstart *ts = &tss; struct TSAPdisconnect tds; struct TSAPdisconnect *td = &tds; if (TInit (vecp, vec, ts, td) == NOTOK) ts_adios (td, "T-CONNECT.INDICATION failed"); sd = ts -> ts_sd; advise (LLOG_NOTICE, NULLCP, "T-CONNECT.INDICATION: <%d, %s, %s, %d, %d>", ts -> ts_sd, taddr2str (&ts -> ts_calling), taddr2str (&ts -> ts_called), ts -> ts_expedited, ts -> ts_tsdusize); if (TConnResponse (sd, NULLTA, 0, NULLCP, 0, NULLQOS, td) == NOTOK) ts_adios (td, "T-CONNECT.RESPONSE failed"); if ((ps = ps_alloc (dg_open)) == NULLPS) adios (NULLCP, "ps_alloc: out of memory"); if (dg_setup (ps, sd, MAXDGRAM, ts_read, ts_write, NULLIFP) == NOTOK) adios (NULLCP, "dg_setup: %s", ps_error (ps -> ps_errno)); for (;;) { struct type_DASE_Query__REQ *req; PE pe; if ((pe = ps2pe (ps)) == NULLPE) { if (ps -> ps_errno == PS_ERR_NONE) { advise (LLOG_NOTICE, NULLCP, "T-DISCONNECT.INDICATION"); break; } else adios (NULLCP, "ps2pe: %s", ps_error (ps -> ps_errno)); } if (decode_DASE_Query__REQ (pe, 1, NULLIP, NULLVP, &req) == NOTOK) adios (NULLCP, "decode_DASE_Query__REQ: %s", PY_pepy); PLOGP (pgm_log,DASE_Message, pe, "message", 1); dase_aux (req); free_DASE_Query__REQ (req); pe_free (pe); } if (isbound) { if (debug) advise (LLOG_DEBUG, NULLCP, "unbound from directory"); ds_unbind (); isbound = 0; } exit (0); }
static COMMAND_FUNC( do_cm_imm ) { if( CM_IS_IMMEDIATE ){ if( verbose ) advise("old state was immediate"); } else { if( verbose ) advise("old state was deferred"); } cm_immediate( ASKIF("update colors immediately") ); }
void read_polh_vector(QSP_ARG_DECL Data_Obj *dp) { void *raw_pdp; int records_to_read; int station; static Polh_Read_Info pri1; if( polh_continuous ){ WARN("start_async_read: polhemus is already in continuous mode!?"); } else { //advise("read_polh_vector: starting continuous mode"); start_continuous_mode(); //WARN("read_polh_vector: exiting before reading for debugging purposes!"); //return; } if( ! good_polh_vector(QSP_ARG dp) ) return; raw_pdp = OBJ_DATA_PTR(dp); records_to_read = OBJ_N_MACH_ELTS(dp) / station_info[ curr_station_idx ].sd_multi_prf.rf_n_words; //fprintf(stderr,"Will attempt to read %d records...\n",records_to_read); /* BUG station login assumes max 2 stations as in insidetrak... */ if( n_active_stations == 2 ){ station=0; } else if( n_active_stations == 1 ) station = curr_station_idx; else { sprintf(ERROR_STRING,"read_polh_vector: number of active stations (%d) should be 1 or 2", n_active_stations); WARN(ERROR_STRING); return; } #ifdef THREAD_SAFE_QUERY pri1.pri_qsp = THIS_QSP; #endif // THREAD_SAFE_QUERY pri1.pri_n_requested = records_to_read; pri1.pri_n_obtained = 0; pri1.pri_addr = raw_pdp; pri1.pri_station = station; halting=0; //sprintf(ERROR_STRING,"read_polh_vector: _read_async = %d",_read_async); //advise(ERROR_STRING); if( _read_async ){ advise("read_polh_vector: calling start_data_thread"); start_data_thread(&pri1); } else { advise("read_polh_vector: calling transfer_polh_data"); transfer_polh_data(&pri1); } }
static struct dispatch * getds (char *name) { int longest, nmatches; char *p, *q; char buffer[BUFSIZ]; struct dispatch *ds, *fs; longest = nmatches = 0; for (ds = dispatches; p = ds -> ds_name; ds++) { for (q = name; *q == *p++; q++) if (*q == NULL) return ds; if (*q == NULL) if (q - name > longest) { longest = q - name; nmatches = 1; fs = ds; } else if (q - name == longest) nmatches++; } switch (nmatches) { case 0: if (*(p = name) == '!') p++; for (; *p; p++) if (!isdigit (*p)) break; if (!*p || network) for (ds = dispatches; ds -> ds_name; ds++) if (strcmp (ds -> ds_name, "whois") == 0) return ds; advise (NULLCP, "unknown operation \"%s\"", name); return NULL; case 1: return fs; default: for (ds = dispatches, p = buffer; q = ds -> ds_name; ds++) if (strncmp (q, name, longest) == 0) { sprintf (p, "%s \"%s\"", p != buffer ? "," : "", q); p += strlen (p); } advise (NULLCP, "ambiguous operation, it could be one of:%s", buffer); return NULL; } }
int _which_one(QSP_ARG_DECL const char *prompt, int n, const char** choices) { int i; int nmatches=0; int lastmatch=(-1); /* init to elim warning */ const char *user_response; #ifdef HAVE_HISTORY check_preload(prompt, n, choices); #endif /* HAVE_HISTORY */ user_response = nameof(prompt); for(i=0;i<n;i++){ assert(choices[i]!=NULL); if( !strcmp( user_response, choices[i] ) ){ return(i); } } /* if no exact match check for substring match */ for(i=0;i<n;i++) if( is_a_substring( user_response, choices[i] ) ){ lastmatch=i; nmatches++; } if( nmatches==1 ){ sprintf(ERROR_STRING,"Unambiguous substring match of \"%s\" to \"%s\"", user_response,choices[lastmatch]); //advise(ERROR_STRING); warn(ERROR_STRING); return(lastmatch); } else if( nmatches > 1 ){ sprintf(ERROR_STRING,"ambiguous choice \"%s\"",user_response); warn(ERROR_STRING); return(-1); } sprintf(ERROR_STRING,"invalid choice \"%s\"",user_response); warn(ERROR_STRING); sprintf(ERROR_STRING,"valid selections for %s are:",prompt); advise(ERROR_STRING); for(i=0;i<n;i++){ sprintf(ERROR_STRING,"\t%s",choices[i]); advise(ERROR_STRING); } #ifdef HAVE_HISTORY if( intractive() ) rem_def(prompt,user_response) ; #endif /* HAVE_HISTORY */ return(-1); }
static void show_tmr(struct itimerval *tmrp) { sprintf(ERROR_STRING,"interval: %ld %ld", tmrp->it_interval.tv_sec, tmrp->it_interval.tv_usec); advise(ERROR_STRING); sprintf(ERROR_STRING,"value: %ld %ld", tmrp->it_value.tv_sec, tmrp->it_value.tv_usec); advise(ERROR_STRING); }
static COMMAND_FUNC( show_current_lb ) { #ifdef HAVE_X11 if( DPA_CMAP_OBJ(current_dpyp) == NO_OBJ ) advise("no current colormap"); else { sprintf(ERROR_STRING,"current colormap is \"%s\"", OBJ_NAME(DPA_CMAP_OBJ(current_dpyp))); advise(ERROR_STRING); } #endif }
static int op_genTime (int sd, struct RyOperation *ryo, struct RoSAPinvoke *rox, caddr_t in, struct RoSAPindication *roi) { long clock; char *cp; #if defined(BSD42) || defined (HPUX) struct timeval tvs; #endif struct tm *tm; struct UTCtime uts; struct UTCtime *ut = &uts; struct type_IMISC_GenResult *gr; if (rox -> rox_nolinked == 0) { advise (NULLCP, LOG_INFO, "RO-INVOKE.INDICATION/%d: %s, unknown linkage %d", sd, ryo -> ryo_name, rox -> rox_linkid); return ureject (sd, ROS_IP_LINKED, rox, roi); } if (debug) advise (NULLCP, LOG_DEBUG, "RO-INVOKE.INDICATION/%d: %s", sd, ryo -> ryo_name); #if defined(BSD42) || defined (HPUX) if (gettimeofday (&tvs, (struct timezone *) 0) == NOTOK) return error (sd, error_IMISC_unableToDetermineTime, (caddr_t) NULL, rox, roi); clock = tvs.tv_sec; #else if (time (&clock) == NOTOK) return error (sd, error_IMISC_unableToDetermineTime, (caddr_t) NULL, rox, roi); #endif if ((tm = gmtime (&clock)) == NULL) return error (sd, error_IMISC_unableToDetermineTime, (caddr_t) NULL, rox, roi); tm2ut (tm, ut); #ifdef BSD42 ut -> ut_flags |= UT_USEC; ut -> ut_usec = tvs.tv_usec; #endif if ((cp = gent2str (ut)) == NULLCP || (gr = str2qb (cp, strlen (cp), 1)) == NULL) return error (sd, error_IMISC_congested, (caddr_t) NULL, rox, roi); if (RyDsResult (sd, rox -> rox_id, (caddr_t) gr, ROS_NOPRIO, roi) == NOTOK) ros_adios (&roi -> roi_preject, "RESULT"); free_IMISC_GenResult (gr); return OK; }
static COMMAND_FUNC( do_gl_material ) { int i; float pvec[4]; i=WHICH_ONE("property",N_MATERIAL_PROPERTIES,property_names); if( i < 0 ) return; switch(i){ case 0: { pvec[0] = (float)HOW_MUCH("ambient red"); pvec[1] = (float)HOW_MUCH("ambient green"); pvec[2] = (float)HOW_MUCH("ambient blue"); pvec[3] = (float)HOW_MUCH("ambient alpha"); if( debug & gl_debug ) advise("glMaterialfv GL_FRONT_AND_BACK GL_DIFFUSE (ambient?)"); /* diffuse or ambient??? */ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, pvec); break; } case 1: { pvec[0] = (float)HOW_MUCH("diffuse red"); pvec[1] = (float)HOW_MUCH("diffuse green"); pvec[2] = (float)HOW_MUCH("diffuse blue"); pvec[3] = (float)HOW_MUCH("diffuse alpha"); if( debug & gl_debug ) advise("glMaterialfv GL_FRONT_AND_BACK GL_DUFFUSE"); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, pvec); break; } case 2: { pvec[0] = (float)HOW_MUCH("specular red"); pvec[1] = (float)HOW_MUCH("specular green"); pvec[2] = (float)HOW_MUCH("specular blue"); pvec[3] = (float)HOW_MUCH("specular alpha"); if( debug & gl_debug ) advise("glMaterialfv GL_FRONT_AND_BACK GL_SPECULAR"); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, pvec); break; } case 3: { pvec[0] = (float)HOW_MUCH("shininess"); if( debug & gl_debug ) advise("glMaterialfv GL_FRONT_AND_BACK GL_SHININESS"); glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, pvec); break; } case 4: pvec[0] = (float)HOW_MUCH("emission red"); pvec[1] = (float)HOW_MUCH("emission green"); pvec[2] = (float)HOW_MUCH("emission blue"); pvec[2] = (float)HOW_MUCH("emission alpha"); if( debug & gl_debug ) advise("glMaterialfv GL_FRONT_AND_BACK GL_EMISSION"); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, pvec); break; default: error1("do_gl_material: bad property (shouldn't happen)"); break; } }
int context_foil (char *path) { register struct node *np; /* In fact, nobody examines defpath in code paths where * it's been set by us -- the uses in the source tree are: * 1 sbr/context_read.c uses it only after setting it itself * 2 uip/install_mh.c uses it only after setting it itself * 3 uip/mshcmds.c and uip/mark.c print it if given the -debug switch * A worthwhile piece of code cleanup would be to make 1 and * 2 use a local variable and just delete 3. * * Similarly, context and ctxpath are not really used * outside the context_* routines. It might be worth combining * them into one file so the variables can be made static. */ /* We set context to NULL to indicate that no context file * is to be read. (Using /dev/null doesn't work because we * would try to lock it, which causes timeouts with some * locking methods.) */ defpath = context = NULL; /* * If path is given, create a minimal profile/context list */ if (path) { m_defs = (struct node *) mh_xmalloc (sizeof(*np)); np = m_defs; if (!(np->n_name = strdup ("Path"))) { advise (NULL, "strdup failed"); return -1; } if (!(np->n_field = strdup (path))) { advise (NULL, "strdup failed"); return -1; } np->n_context = 0; np->n_next = NULL; if (mypath == NULL && (mypath = getenv ("HOME")) != NULL) if (!(mypath = strdup (mypath))) { advise (NULL, "strdup failed"); return -1; } } return 0; }
static COMMAND_FUNC( set_poly_mode ) { #ifdef FOOBAR char *face = NAMEOF("face"); char *mode = NAMEOF("polygon mode"); if((strcmp(face,"frontNback"))&&(strcmp(face,"front"))&&(strcmp(face,"back"))){ advise("Valid types of faces are: 'frontNback' 'front' 'back'"); return; } if((strcmp(mode,"point"))&&(strcmp(mode,"line"))&&(strcmp(mode,"fill"))){ advise("Valid types of modes are: 'point' 'line' 'fill'"); return; } if( debug & gl_debug ) advise("glPolygonMode"); /* could be more elegant ... */ if (!((strcmp(face, "frontNback"))||(strcmp(mode, "point")))) glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); if (!((strcmp(face, "frontNback"))||(strcmp(mode, "line")))) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); if (!((strcmp(face, "frontNback"))||(strcmp(mode, "fill")))) glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); if((!strcmp(face, "front"))&&(!strcmp(mode, "point"))) glPolygonMode(GL_FRONT, GL_POINT); if((!strcmp(face, "front"))&&(!strcmp(mode, "line"))) glPolygonMode(GL_FRONT, GL_LINE); if((!strcmp(face, "front"))&&(!strcmp(mode, "fill"))) glPolygonMode(GL_FRONT, GL_FILL); if((!strcmp(face, "back"))&&(!strcmp(mode, "point"))) glPolygonMode(GL_BACK, GL_POINT); if((!strcmp(face, "back"))&&(!strcmp(mode, "line"))) glPolygonMode(GL_BACK, GL_LINE); if((!strcmp(face, "back"))&&(!strcmp(mode, "fill"))) glPolygonMode(GL_BACK, GL_FILL); #endif /* FOOBAR */ GLenum face_dir; GLenum polygon_mode; face_dir = CHOOSE_FACING_DIR("faces to render"); polygon_mode = CHOOSE_POLYGON_MODE("rendering mode for polygons"); if( face_dir == INVALID_CONSTANT || polygon_mode == INVALID_CONSTANT ) return; if( debug & gl_debug ) advise("glPolygonMode"); glPolygonMode(face_dir,polygon_mode); }
static int pick_revisions(struct replay_opts *opts) { struct commit_list *todo_list = NULL; unsigned char sha1[20]; read_and_refresh_cache(opts); /* * Decide what to do depending on the arguments; a fresh * cherry-pick should be handled differently from an existing * one that is being continued */ if (opts->subcommand == REPLAY_RESET) { remove_sequencer_state(1); return 0; } else if (opts->subcommand == REPLAY_CONTINUE) { if (!file_exists(git_path(SEQ_TODO_FILE))) goto error; read_populate_opts(&opts); read_populate_todo(&todo_list, opts); /* Verify that the conflict has been resolved */ if (!index_differs_from("HEAD", 0)) todo_list = todo_list->next; } else { /* * Start a new cherry-pick/ revert sequence; but * first, make sure that an existing one isn't in * progress */ walk_revs_populate_todo(&todo_list, opts); if (create_seq_dir() < 0) { error(_("A cherry-pick or revert is in progress.")); advise(_("Use --continue to continue the operation")); advise(_("or --reset to forget about it")); return -1; } if (get_sha1("HEAD", sha1)) { if (opts->action == REVERT) return error(_("Can't revert as initial commit")); return error(_("Can't cherry-pick into empty head")); } save_head(sha1_to_hex(sha1)); save_opts(opts); } return pick_commits(todo_list, opts); error: return error(_("No %s in progress"), action_name(opts)); }
static struct type_DSE_PSAPaddr * psap2dse (struct PSAPaddr *pa) { int n; struct type_DSE_PSAPaddr *dse; struct SSAPaddr *sa = &pa -> pa_addr; struct TSAPaddr *ta = &sa -> sa_addr; struct NSAPaddr *na; struct member_DSE_0 *nDSE, **oDSE; if ((dse = (struct type_DSE_PSAPaddr *) calloc (1, sizeof *dse)) == NULL) { advise (NULLCP, "psap2dse: out of memory"); return NULL; } if (pa -> pa_selectlen > 0) dse -> pSelector = str2qb (pa -> pa_selector, pa -> pa_selectlen, 1); if (sa -> sa_selectlen > 0) dse -> sSelector = str2qb (sa -> sa_selector, sa -> sa_selectlen, 1); if (ta -> ta_selectlen > 0) dse -> tSelector = str2qb (ta -> ta_selector, ta -> ta_selectlen, 1); oDSE = &dse -> nAddress; for (na = ta -> ta_addrs, n = ta -> ta_naddr; n > 0; na++, n--) { struct NSAPaddr *ca; if ((nDSE = (struct member_DSE_0 *) calloc (1, sizeof *nDSE)) == NULL) { advise (NULLCP, "psap2dse: out of memory"); losing: ; free_DSE_PSAPaddr (dse); return NULL; } *oDSE = nDSE; oDSE = &nDSE -> next; if ((ca = na2norm (na)) == NULLNA) { advise (NULLCP, "unable to normalize address"); goto losing; } nDSE -> member_DSE_1 = str2qb (ca -> na_address, ca -> na_addrlen, 1); } return dse; }
static int parse_polh_reading( QSP_ARG_DECL Data_Obj *dp, char * s ) { char str[32]; float *f_p; #ifdef QUIP_DEBUG if( debug & debug_polhemus ){ sprintf(ERROR_STRING,"parse_polh_reading \"%s\"",show_printable(DEFAULT_QSP_ARG s)); advise(ERROR_STRING); } #endif /* QUIP_DEBUG */ if( OBJ_PREC(dp) != PREC_SP ){ sprintf(ERROR_STRING,"Object %s has %s precision, should be %s", OBJ_NAME(dp), PREC_NAME(OBJ_PREC_PTR(dp)), PREC_NAME(prec_for_code(PREC_SP)) ); warn(ERROR_STRING); return(-1); } if( ! IS_CONTIGUOUS(dp) ){ sprintf(ERROR_STRING,"Object %s should be contiguous",OBJ_NAME(dp)); warn(ERROR_STRING); return(-1); } if( OBJ_N_MACH_ELTS(dp) < 6 ){ sprintf(ERROR_STRING,"Object %s should have at least 6 elements",OBJ_NAME(dp)); warn(ERROR_STRING); return(-1); } f_p = OBJ_DATA_PTR(dp); if( sscanf(s,"%s %f %f %f %f %f %f",str, f_p+0, f_p+1, f_p+2, f_p+3, f_p+4, f_p+5 ) != 7 ){ sprintf(ERROR_STRING,"Error scanning polhemus data string"); warn(ERROR_STRING); sprintf(ERROR_STRING,"String: \"%s\"",show_printable(DEFAULT_QSP_ARG s)); advise(ERROR_STRING); return(-1); } return(0); }
fin_mib () { register OT ot; for (ot = text2obj ("ccitt"); ot; ot = ot -> ot_next) if (ot -> ot_status == OT_MANDATORY && ot -> ot_getfnx == o_generic && ot -> ot_info == NULL) advise (LLOG_EXCEPTIONS, NULLCP, "variable \"%s.0\" has no value (warning)", ot -> ot_text); if (gettimeofday (&my_boottime, (struct timezone *) 0) == NOTOK) { advise (LLOG_EXCEPTIONS, "failed", "gettimeofday"); bzero ((char *) &my_boottime, sizeof my_boottime); } }
int error_resolve_conflict(const char *me) { error("'%s' is not possible because you have unmerged files.", me); if (advice_resolve_conflict) { /* * Message used both when 'git commit' fails and when * other commands doing a merge do. */ advise("Fix them up in the work tree,"); advise("and then use 'git add/rm <file>' as"); advise("appropriate to mark resolution and make a commit,"); advise("or use 'git commit -a'."); } return -1; }
void clrdat(SINGLE_QSP_ARG_DECL) /* just clears data tables */ { List *lp; Node *np; Trial_Class *tcp; Data_Tbl *dtp; int i; lp=class_list(SINGLE_QSP_ARG); if( lp == NO_LIST ) return; np=lp->l_head; while(np!=NO_NODE){ tcp = (Trial_Class *) np->n_data; dtp = CLASS_DATA_TBL(tcp); if( dtp == NULL ){ sprintf(ERROR_STRING, "Stimulus class %s has null data table, initializing...", CLASS_NAME(tcp) ); advise(ERROR_STRING); dtp = alloc_data_tbl(tcp,_nvals); } fprintf(stderr,"clrdat: clearing data table for class %s\n",CLASS_NAME(tcp)); SET_DTBL_N(dtp,0); for(i=0;i<DTBL_SIZE(dtp);i++){ SET_DATUM_NTOTAL(DTBL_ENTRY(dtp,i),0); SET_DATUM_NCORR(DTBL_ENTRY(dtp,i),0); } np=np->n_next; } fprintf(stderr,"clrdat: DONE\n"); }