rem
stringlengths
0
274k
add
stringlengths
0
169k
context
stringlengths
9
471k
while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5));
den = gadd(den, zeroser(0, N+1));
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva);
fprintferr(" twistpartialzeta: %ld\%\n", 100*j/lva);
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva);
if(DEBUGMEM>1) err(warnmem, "twistpartialzeta, j = %ld/%ld", j,lva);
twistpartialzeta(GEN p, GEN q, long f, long c, GEN va, GEN cff){ long j, k, lva = lg(va)-1, a, N = lg(cff)-1, N0 = N; pari_sp av, lim; GEN x = polx[0], y = polx[fetch_user_var("y")], eta, one, mon, den; GEN cyc, psm, invden, rep, ser; cyc = gdiv(gsubgs(gpowgs(y, c), 1), gsubgs(y, 1)); psm = polsym(cyc, degpol(cyc) - 1); eta = gmodulcp(y, cyc); one = gmodulsg(1, q); /* Mod(1, q); */ mon = gaddsg(1, x); den = gsubsg(1, gmul(gpowgs(gmul(one,eta), f), gpowgs(gmul(one,mon), f))); /* FIXME: get rid of unnecessary coeffs; should be done in coeff_of_phi_ms? */ while (gcmp0((GEN)cff[N0])) N0--; den = gadd(den, zeroser(0, N0+5)); av = avma; lim = stack_lim(av, 1); invden = ginv(den); rep = zerovec(lva); /* a = 1 is always the first element of va */ ser = gmul(gmul(eta, mon), invden); ser = lift_intern(lift_intern(ser)); /* t_SER of ZY */ /* ser is a unit, convert to POL */ ser[0] = evaltyp(t_POL)| evallg(lg(ser)); ser[1] = evalsigne(1)| evalvarn(0); a = 1; for (j = 1; j <= lva; j++) { GEN p1 = gzero; if (DEBUGLEVEL > 2 && !(j%50)) fprintferr(" twistpartialpowser: %ld\%\n", 100*j/lva); for (k = 1; k <= N; k++) { pari_sp av2 = avma; GEN p2 = quicktrace(polcoeff_i(ser,k,0), psm); p1 = gerepileupto(av2, addii(p1, mulii((GEN)cff[k], p2))); } rep[j] = lmodii(p1, q); if (j < lva) { long e = va[j+1] - a, i; GEN z = eta; for (i = 1; i <= e; i++) /* assume e small */ { ser = addmulXn(ser, ser, 1); /* ser *= 1+x */ setlg(ser, lg(ser)-1); /* truncate highest degree term */ } if (e > 1) z = gpowgs(z, e); z = lift_intern(z); if (!degpol(z)) { z = (GEN)z[2]; /* +/- 1 */ if (signe(z) < 0) ser = gneg(ser); ser = FpXX_red(ser, q); } else { ser = gmul(z, ser); for (i=2; i<lg(ser); i++) ser[i] = (long)FpX_rem((GEN)ser[i], cyc, q); } a = va[j+1]; } if (low_stack(lim, stack_lim(av, 1))) { if(DEBUGMEM>1) err(warnmem, "twistpartialpowser, j = %ld/%ld", j,lva); gerepileall(av, 2, &rep, &ser); } } return rep;}
if (DEBUGLEVEL) fprintferr("unit exponents = %Z",c);
if (DEBUGLEVEL) fprintferr("unit exponents = %Z\n",c);
reducebetanaive(GEN be, GEN b){ long i,k,n,ru,r1, prec = nfgetprec(bnfz); GEN z,p1,p2,nmax,c, nf = checknf(bnfz); if (DEBUGLEVEL) fprintferr("reduce modulo (Z_K^*)^l\n"); r1 = nf_get_r1(nf); if (!b) b = gmul(gmael(nf,5,1), algtobasis(nf,be)); n = max((ell>>1), 3); z = cgetg(n+1, t_VEC); c = gmulgs(greal((GEN)bnfz[3]), ell); c = logarch2arch(c, r1, prec); /* = embeddings of fu^ell */ c = gprec_w(gnorm(c), DEFAULTPREC); b = gprec_w(gnorm(b), DEFAULTPREC); /* need little precision */ z[1] = (long)concatsp(c, vecinv(c)); for (k=2; k<=n; k++) z[k] = (long) vecmul((GEN)z[1], (GEN)z[k-1]); nmax = T2_from_embed_norm(b, r1); ru = lg(c)-1; c = zerovec(ru); for(;;) { GEN B = NULL; long besti = 0, bestk = 0; for (k=1; k<=n; k++) for (i=1; i<=ru; i++) { p1 = vecmul(b, gmael(z,k,i)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk = k; continue; } p1 = vecmul(b, gmael(z,k,i+ru)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk =-k; } } if (!B) break; b = B; c[besti] = laddis((GEN)c[besti], bestk); } if (DEBUGLEVEL) fprintferr("unit exponents = %Z",c); return fix_be(be,c);}
prevPhase = phase; phase = PHASE_INITIALIZE;
prevPhase = pppd_phase; pppd_phase = PHASE_INITIALIZE;
int rtems_pppd_set_option(const char *pOption, const char *pValue){ int iReturn = (int)0; int prevPhase; struct wordlist option; struct wordlist value; if ( pOption != (const char *)0 ) { /* initialize the values */ option.word = (char *)pOption; option.next = (struct wordlist *)0; if ( pValue != (const char *)0 ) { option.next = &value; value.word = (char *)pValue; value.next = (struct wordlist *)0; } /* save current phase value */ prevPhase = phase; phase = PHASE_INITIALIZE; /* process option and reset phase value */ iReturn = options_from_list(&option, 1); phase = prevPhase; } return ( iReturn );}
phase = prevPhase;
pppd_phase = prevPhase;
int rtems_pppd_set_option(const char *pOption, const char *pValue){ int iReturn = (int)0; int prevPhase; struct wordlist option; struct wordlist value; if ( pOption != (const char *)0 ) { /* initialize the values */ option.word = (char *)pOption; option.next = (struct wordlist *)0; if ( pValue != (const char *)0 ) { option.next = &value; value.word = (char *)pValue; value.next = (struct wordlist *)0; } /* save current phase value */ prevPhase = phase; phase = PHASE_INITIALIZE; /* process option and reset phase value */ iReturn = options_from_list(&option, 1); phase = prevPhase; } return ( iReturn );}
Objects_Name name,
rtems_name name,
rtems_status_code rtems_region_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 page_size, rtems_attribute attribute_set, Objects_Id *id){ Region_Control *the_region; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_region->maximum_segment_size = _Heap_Initialize(&the_region->Memory, starting_address, length, page_size); if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); return( RTEMS_INVALID_SIZE ); } the_region->starting_address = starting_address; the_region->length = length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
if ( !_Objects_Is_name_valid( name ) )
if ( !rtems_is_name_valid( name ) )
rtems_status_code rtems_region_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 page_size, rtems_attribute attribute_set, Objects_Id *id){ Region_Control *the_region; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_region->maximum_segment_size = _Heap_Initialize(&the_region->Memory, starting_address, length, page_size); if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); return( RTEMS_INVALID_SIZE ); } the_region->starting_address = starting_address; the_region->length = length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
_Objects_Open( &_Region_Information, &the_region->Object, name );
_Objects_Open( &_Region_Information, &the_region->Object, &name );
rtems_status_code rtems_region_create( Objects_Name name, void *starting_address, unsigned32 length, unsigned32 page_size, rtems_attribute attribute_set, Objects_Id *id){ Region_Control *the_region; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); if ( !_Addresses_Is_aligned( starting_address ) ) return( RTEMS_INVALID_ADDRESS ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_region = _Region_Allocate(); if ( !the_region ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_region->maximum_segment_size = _Heap_Initialize(&the_region->Memory, starting_address, length, page_size); if ( !the_region->maximum_segment_size ) { _Region_Free( the_region ); _Thread_Enable_dispatch(); return( RTEMS_INVALID_SIZE ); } the_region->starting_address = starting_address; the_region->length = length; the_region->page_size = page_size; the_region->attribute_set = attribute_set; the_region->number_of_used_blocks = 0; _Thread_queue_Initialize( &the_region->Wait_queue, attribute_set, STATES_WAITING_FOR_SEGMENT ); _Objects_Open( &_Region_Information, &the_region->Object, name ); *id = the_region->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
Objects_Name name,
rtems_name name,
rtems_status_code rtems_region_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Region_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
name,
&name,
rtems_status_code rtems_region_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Region_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
if ( status == EINVAL ) { if ( !(oflag & O_CREAT) ) { set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; }
if ( !( status == ENOENT && (oflag & O_CREAT) ) ) { _Thread_Enable_dispatch(); set_errno_and_return_minus_one_cast( status, mqd_t );
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
set_errno_and_return_minus_one( status ); return (mqd_t) -1;
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1;
_Thread_Enable_dispatch(); set_errno_and_return_minus_one_cast( EEXIST, mqd_t );
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
the_mq = _POSIX_Message_queue_Get( the_mq_id, &location );
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
return (mqd_t)&the_mq->Object.id;
_Thread_Enable_dispatch(); _Thread_Enable_dispatch(); return (mqd_t)the_mq->Object.id;
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
return (mqd_t) &the_mq->Object.id;
return (mqd_t) the_mq->Object.id;
mqd_t mq_open( const char *name, int oflag, ... /* mode_t mode, */ /* struct mq_attr attr */){ va_list arg; mode_t mode; struct mq_attr *attr; int status; Objects_Id the_mq_id; POSIX_Message_queue_Control *the_mq; if ( oflag & O_CREAT ) { va_start(arg, oflag); mode = (mode_t) va_arg( arg, mode_t ); attr = (struct mq_attr *) va_arg( arg, struct mq_attr * ); va_end(arg); } status = _POSIX_Message_queue_Name_to_id( name, &the_mq_id ); /* * If the name to id translation worked, then the message queue exists * and we can just return a pointer to the id. Otherwise we may * need to check to see if this is a "message queue does not exist" * or some other miscellaneous error on the name. */ if ( status ) { if ( status == EINVAL ) { /* name -> ID translation failed */ if ( !(oflag & O_CREAT) ) { /* willing to create it? */ set_errno_and_return_minus_one( ENOENT ); return (mqd_t) -1; } /* we are willing to create it */ } set_errno_and_return_minus_one( status ); /* some type of error */ return (mqd_t) -1; } else { /* name -> ID translation succeeded */ if ( (oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL) ) { set_errno_and_return_minus_one( EEXIST ); return (mqd_t) -1; } /* * XXX In this case we need to do an ID->pointer conversion to * check the mode. This is probably a good place for a subroutine. */ the_mq->open_count += 1; return (mqd_t)&the_mq->Object.id; } /* XXX verify this comment... * * At this point, the message queue does not exist and everything has been * checked. We should go ahead and create a message queue. */ status = _POSIX_Message_queue_Create_support( name, TRUE, /* shared across processes */ oflag, attr, &the_mq ); if ( status == -1 ) return (mqd_t) -1; return (mqd_t) &the_mq->Object.id;}
if (lx==1) return gzero;
gtrace(GEN x){ long i,l,n,tx=typ(x),lx,tetpil; GEN y,p1,p2; switch(tx) { case t_INT: case t_REAL: case t_FRAC: case t_FRACN: return gmul2n(x,1); case t_COMPLEX: return gmul2n((GEN)x[1],1); case t_QUAD: p1=(GEN)x[1]; if (!gcmp0((GEN) p1[3])) { l=avma; p2=gmul2n((GEN)x[2],1); tetpil=avma; return gerepile(l,tetpil,gadd((GEN)x[3],p2)); } return gmul2n((GEN)x[2],1); case t_POL: lx=lgef(x); y=cgetg(lx,tx); y[1]=x[1]; for (i=2; i<lx; i++) y[i]=ltrace((GEN)x[i]); return y; case t_SER: lx=lg(x); y=cgetg(lx,tx); y[1]=x[1]; for (i=2; i<lx; i++) y[i]=ltrace((GEN)x[i]); return y; case t_POLMOD: l=avma; n=(lgef(x[1])-4); p1=polsym((GEN)x[1],n); p2=gzero; for (i=0; i<=n; i++) p2=gadd(p2,gmul(truecoeff((GEN)x[2],i),(GEN)p1[i+1])); return gerepileupto(l,p2); case t_RFRAC: case t_RFRACN: return gadd(x,gconj(x)); case t_VEC: case t_COL: lx=lg(x); y=cgetg(lx,tx); for (i=1; i<lx; i++) y[i]=ltrace((GEN)x[i]); return y; case t_MAT: lx=lg(x); if (lx!=lg(x[1])) err(mattype1,"gtrace"); l=avma; p1=gcoeff(x,1,1); if (lx==2) return gcopy(p1); for (i=2; i<lx-1; i++) p1=gadd(p1,gcoeff(x,i,i)); tetpil=avma; return gerepile(l,tetpil,gadd(p1,gcoeff(x,i,i))); } err(typeer,"gtrace"); return NULL; /* not reached */}
gscalcol(GEN x, long n) { return gscalcol_proto(gcopy(x),gzero,n); }
gscalcol(GEN x, long n) { GEN y=gscalcol_proto(gzero,gzero,n); if (n) y[1]=lcopy(x); return y; }
gscalcol(GEN x, long n) { return gscalcol_proto(gcopy(x),gzero,n); }
GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy);
GEN dx, dy; dx = denom(x); x = gmul(x, dx); dy = denom(y); y = gmul(y, dy);
gauss_gcd(GEN x, GEN y){ pari_sp av = avma; GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy); while (!gcmp0(y)) { GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y)); x = y; y = z; } x = gauss_normal(x); if (typ(x) == t_COMPLEX) { if (gcmp0((GEN)x[2])) x = (GEN)x[1]; else if (gcmp0((GEN)x[1])) x = (GEN)x[2]; } return gerepileupto(av, gdiv(x, den));}
GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y));
GEN z = gsub(x, gmul(ground(gdiv(x,y)), y));
gauss_gcd(GEN x, GEN y){ pari_sp av = avma; GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy); while (!gcmp0(y)) { GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y)); x = y; y = z; } x = gauss_normal(x); if (typ(x) == t_COMPLEX) { if (gcmp0((GEN)x[2])) x = (GEN)x[1]; else if (gcmp0((GEN)x[1])) x = (GEN)x[2]; } return gerepileupto(av, gdiv(x, den));}
return gerepileupto(av, gdiv(x, den));
return gerepileupto(av, gdiv(x, mpppcm(dx, dy)));
gauss_gcd(GEN x, GEN y){ pari_sp av = avma; GEN dx = denom(x); GEN dy = denom(y); GEN den = mpppcm(dx, dy); x = gmul(x, dx); y = gmul(y, dy); while (!gcmp0(y)) { GEN z = gdiv(x,y); GEN r0 = real_i(z), r = gfloor(r0); GEN i0 = imag_i(z), i = gfloor(i0); if (gcmp(gsub(r0,r), ghalf) > 0) r = addis(r,1); if (gcmp(gsub(i0,i), ghalf) > 0) i = addis(i,1); if (gcmp0(i)) z = r; else { z = cgetg(3, t_COMPLEX); z[1] = (long)r; z[2] = (long)i; } z = gsub(x, gmul(z,y)); x = y; y = z; } x = gauss_normal(x); if (typ(x) == t_COMPLEX) { if (gcmp0((GEN)x[2])) x = (GEN)x[1]; else if (gcmp0((GEN)x[1])) x = (GEN)x[2]; } return gerepileupto(av, gdiv(x, den));}
Fp_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN p)
Fp_gauss_get_col(GEN a, GEN b, GEN invpiv, long li, GEN p)
Fp_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN p){ GEN m, u=cgetg(li+1,t_COL); long i,j; u[li] = lresii(mulii((GEN)b[li], mpinvmod(piv,p)), p); for (i=li-1; i>0; i--) { pari_sp av = avma; m = (GEN)b[i]; for (j=i+1; j<=li; j++) m = subii(m, mulii(gcoeff(a,i,j), (GEN)u[j])); m = resii(m, p); u[i] = lpileuptoint(av, resii(mulii(m, mpinvmod(gcoeff(a,i,i), p)), p)); } return u;}
u[li] = lresii(mulii((GEN)b[li], mpinvmod(piv,p)), p);
u[li] = lresii(mulii((GEN)b[li], invpiv), p);
Fp_gauss_get_col(GEN a, GEN b, GEN piv, long li, GEN p){ GEN m, u=cgetg(li+1,t_COL); long i,j; u[li] = lresii(mulii((GEN)b[li], mpinvmod(piv,p)), p); for (i=li-1; i>0; i--) { pari_sp av = avma; m = (GEN)b[i]; for (j=i+1; j<=li; j++) m = subii(m, mulii(gcoeff(a,i,j), (GEN)u[j])); m = resii(m, p); u[i] = lpileuptoint(av, resii(mulii(m, mpinvmod(gcoeff(a,i,i), p)), p)); } return u;}
gerepile_gauss(GEN x,long m,long n,long k,long t,long av, long j, GEN c)
gerepile_gauss(GEN x,long m,long n,long k,long t,ulong av, long j, GEN c)
gerepile_gauss(GEN x,long m,long n,long k,long t,long av, long j, GEN c){ long tetpil = avma,dec,u,A,i; if (DEBUGMEM > 1) err(warnmem,"gauss_pivot. k=%ld, n=%ld",k,n); for (u=t+1; u<=m; u++) if (u==j || !c[u]) copyifstack(coeff(x,u,k), coeff(x,u,k)); for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) copyifstack(coeff(x,u,i), coeff(x,u,i)); (void)gerepile(av,tetpil,NULL); dec = av-tetpil; for (u=t+1; u<=m; u++) if (u==j || !c[u]) { A=coeff(x,u,k); if (A<av && A>=bot) coeff(x,u,k)+=dec; } for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) { A=coeff(x,u,i); if (A<av && A>=bot) coeff(x,u,i)+=dec; }}
long tetpil = avma,dec,u,A,i;
ulong tetpil = avma,A; long dec,u,i;
gerepile_gauss(GEN x,long m,long n,long k,long t,long av, long j, GEN c){ long tetpil = avma,dec,u,A,i; if (DEBUGMEM > 1) err(warnmem,"gauss_pivot. k=%ld, n=%ld",k,n); for (u=t+1; u<=m; u++) if (u==j || !c[u]) copyifstack(coeff(x,u,k), coeff(x,u,k)); for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) copyifstack(coeff(x,u,i), coeff(x,u,i)); (void)gerepile(av,tetpil,NULL); dec = av-tetpil; for (u=t+1; u<=m; u++) if (u==j || !c[u]) { A=coeff(x,u,k); if (A<av && A>=bot) coeff(x,u,k)+=dec; } for (u=1; u<=m; u++) if (u==j || !c[u]) for (i=k+1; i<=n; i++) { A=coeff(x,u,i); if (A<av && A>=bot) coeff(x,u,i)+=dec; }}
int i = 0;
register int i = 0;
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i];
token[i] = c;
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
if ( !IMFS_is_valid_name_char( token[i] ) )
if ( !IMFS_is_valid_name_char(c) )
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
i++;
c = path [++i];
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
token[i] = path[i];
token[i] = c;
IMFS_token_types IMFS_get_token( const char *path, char *token, int *token_len){ int i = 0; IMFS_token_types type = IMFS_NAME; /* * Copy a name into token. (Remember NULL is a token.) */ while ( !IMFS_is_separator( path[i] ) && (i <= IMFS_NAME_MAX) ) { token[i] = path[i]; if (i == IMFS_NAME_MAX) return IMFS_INVALID_TOKEN; if ( !IMFS_is_valid_name_char( token[i] ) ) type = IMFS_INVALID_TOKEN; i++; } /* * Copy a seperator into token. */ if ( i == 0 ) { token[i] = path[i]; if ( token[i] != '\0' ) { i++; type = IMFS_CURRENT_DIR; } else { type = IMFS_NO_MORE_PATH; } } else if (token[ i-1 ] != '\0') { token[i] = '\0'; } /* * Set token_len to the number of characters copied. */ *token_len = i; /* * If we copied something that was not a seperator see if * it was a special name. */ if ( type == IMFS_NAME ) { if ( strcmp( token, "..") == 0 ) type = IMFS_UP_DIR; else if ( strcmp( token, "." ) == 0 ) type = IMFS_CURRENT_DIR; } return type;}
s = apr_pstrmemdup(pool, data, len); printf("%s", s);
if (len) { s = apr_pstrmemdup(pool, data, len); printf("%s", s); }
static apr_status_t handle_response(serf_bucket_t *response, void *handler_baton, apr_pool_t *pool){ const char *data, *s; apr_size_t len; serf_status_line sl; apr_status_t status; handler_baton_t *ctx = handler_baton; status = serf_bucket_response_status(response, &sl); if (status) { if (APR_STATUS_IS_EAGAIN(status)) { return APR_SUCCESS; } abort(); } status = serf_bucket_read(response, 2048, &data, &len); if (!status || APR_STATUS_IS_EOF(status)) { s = apr_pstrmemdup(pool, data, len); printf("%s", s); } else if (APR_STATUS_IS_EAGAIN(status)) { status = APR_SUCCESS; } if (APR_STATUS_IS_EOF(status)) { apr_atomic_dec32(&ctx->requests_outstanding); } return status;}
serf_bucket_t *hdrs; const char *v; hdrs = serf_bucket_response_get_headers(response); v = serf_bucket_headers_get(hdrs, "Trailer-Test"); if (v) { printf("Trailer-Test: %s\n", v); }
static apr_status_t handle_response(serf_bucket_t *response, void *handler_baton, apr_pool_t *pool){ const char *data, *s; apr_size_t len; serf_status_line sl; apr_status_t status; handler_baton_t *ctx = handler_baton; status = serf_bucket_response_status(response, &sl); if (status) { if (APR_STATUS_IS_EAGAIN(status)) { return APR_SUCCESS; } abort(); } status = serf_bucket_read(response, 2048, &data, &len); if (!status || APR_STATUS_IS_EOF(status)) { s = apr_pstrmemdup(pool, data, len); printf("%s", s); } else if (APR_STATUS_IS_EAGAIN(status)) { status = APR_SUCCESS; } if (APR_STATUS_IS_EOF(status)) { apr_atomic_dec32(&ctx->requests_outstanding); } return status;}
register rtems_unsigned32 chn;
register uint32_t chn;
mcfuart_reset(mcfuart *uart){ register rtems_unsigned32 chn; rtems_status_code rc; if (uart == NULL) return RTEMS_INVALID_ADDRESS; chn = uart->chn; /* Reset the receiver and transmitter */ *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_RX; *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_TX; /* * Program the vector number for a UART module interrupt, or * disable UART interrupts if polled I/O. Enable the desired * interrupt sources. */ if (uart->intvec != 0) { int_driven_uart[chn - 1].uart = uart; int_driven_uart[chn - 1].vec = uart->intvec; rc = rtems_interrupt_catch(mcfuart_interrupt_handler, uart->intvec, &uart->old_handler); if (rc != RTEMS_SUCCESSFUL) return rc; *MCF5206E_UIVR(MBAR,chn) = uart->intvec; *MCF5206E_UIMR(MBAR,chn) = MCF5206E_UIMR_FFULL; *MCF5206E_UACR(MBAR,chn) = MCF5206E_UACR_IEC; *MCF5206E_IMR(MBAR) &= ~MCF5206E_INTR_BIT(uart->chn == 1 ? MCF5206E_INTR_UART_1 : MCF5206E_INTR_UART_2); } else { *MCF5206E_UIMR(MBAR,chn) = 0; } /* Select the receiver and transmitter clock. */ mcfuart_set_baudrate(uart, B19200); /* dBUG defaults (unfortunately, it is differ to termios default */ *MCF5206E_UCSR(MBAR,chn) = MCF5206E_UCSR_RCS_TIMER | MCF5206E_UCSR_TCS_TIMER; /* Mode Registers 1,2 - set termios defaults (8N1) */ *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_MR; *MCF5206E_UMR(MBAR,chn) = /* MCF5206E_UMR1_RXRTS | */ MCF5206E_UMR1_PM_NO_PARITY | MCF5206E_UMR1_BC_8; *MCF5206E_UMR(MBAR,chn) = MCF5206E_UMR2_CM_NORMAL |/* MCF5206E_UMR2_TXCTS | */ MCF5206E_UMR2_SB_1; /* Enable Receiver and Transmitter */ *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_MISC_RESET_ERR; *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_TC_ENABLE; *MCF5206E_UCR(MBAR,chn) = MCF5206E_UCR_RC_ENABLE; return RTEMS_SUCCESSFUL;}
int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2;
const ulong mask = (1<<kglob)-1; int pk,i,j,LE=0; ulong s,e; GEN tabt,taba,m,E=gzero,p1;
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
pk = _pk(p,k);
pk = u_pow(p,k);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]);
for (i=1; i<=pk; i++) p1[i] = lmod(gpowgs(polx[0],i-1), tabcyc[pk]);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
p2=cgetg(3,t_VECSMALL);
GEN p2 = cgetg(3,t_VECSMALL);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++)
for (e=1; e<=ltab && signe(m); e++)
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob;
s = vali(m); m = shifti(m,-s); tabt[e] = e==1? s: s+kglob; taba[e] = signe(m)? ((modBIL(m) & mask)+1)>>1: 0; m = shifti(m, -kglob);
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;
if (e > ltab) err(bugparier,"filltabs"); setlg(taba, e); tabaall[pk] = taba; setlg(tabt, e); tabtall[pk] = tabt;
filltabs(GEN N, int p, int k, ulong ltab){ int pk,efin,i,j,LE=0; ulong s,mask=(1<<kglob)-1,ee,lp1; GEN tabt,taba,m,E=gzero,p1,p2; pk = _pk(p,k); tabcyc[pk] = cyclo(pk,0); p1 = cgetg(pk+1,t_VEC); for (i=1; i<=pk; i++) p1[i] = lmod(gpuigs(polx[0],i-1), tabcyc[pk]); tabeta[pk] = lmul(gmodulcp(gun,N),p1); if (p > 2) { LE = pk-pk/p+1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if (i%p) E[++j]=i; } else if (k >= 3) { LE = (pk>>2) + 1; E = cgetg(LE,t_VECSMALL); for (i=1,j=0; i<pk; i++) if ((i%8)==1 || (i%8)==3) E[++j]=i; } if (p>2 || k>=3) { tabE[pk] = (long)E; p1 = cgetg(LE,t_VEC); for (i=1; i<LE; i++) { p2=cgetg(3,t_VECSMALL); p2[1] = p2[2] = E[i]; p1[i] = (long)p2; } tabTH[pk] = (long)p1; } tabt = cgetg(ltab+1,t_VECSMALL); taba = cgetg(ltab+1,t_VECSMALL); m = divis(N,pk); s = vali(m); tabt[1] = s; efin = ltab+1; for (ee=1; ee<=ltab; ee++) { p1 = shifti(m,-s); lp1 = lgefint(p1); taba[ee] = lp1==2? 0: (((p1[lp1-1])&mask)+1)>>1; m = shifti(m, -(s+kglob)); if (!signe(m)) { efin = ee; break; } s = vali(m); tabt[ee+1] = s+kglob; } if (efin > ltab) err(bugparier,"filltabs"); tabaall[pk] = taba; tabtall[pk] = tabt; tabefin[pk] = efin;}
hash &= ((1<<LD_HASH_SIZE)-1); return (PTE)(((unsigned long)pt->base) | ((hash<<LD_PTEG_SIZE) & (pt->size-1)));
hash &= ((1 << LD_HASH_SIZE) - 1); return (APte) (((unsigned long) pt-> base) | ((hash << LD_PTEG_SIZE) & (pt->size - 1)));
ptegOf(Triv121PgTbl pt, unsigned long hash){ hash &= ((1<<LD_HASH_SIZE)-1); return (PTE)(((unsigned long)pt->base) | ((hash<<LD_PTEG_SIZE) & (pt->size-1)));}
Objects_Name name,
rtems_name name,
rtems_status_code rtems_timer_create( Objects_Name name, Objects_Id *id){ Timer_Control *the_timer; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_timer = _Timer_Allocate(); if ( !the_timer ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_timer->the_class = TIMER_DORMANT; _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
if ( !_Objects_Is_name_valid( name ) )
if ( !rtems_is_name_valid( name ) )
rtems_status_code rtems_timer_create( Objects_Name name, Objects_Id *id){ Timer_Control *the_timer; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_timer = _Timer_Allocate(); if ( !the_timer ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_timer->the_class = TIMER_DORMANT; _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
_Objects_Open( &_Timer_Information, &the_timer->Object, name );
_Objects_Open( &_Timer_Information, &the_timer->Object, &name );
rtems_status_code rtems_timer_create( Objects_Name name, Objects_Id *id){ Timer_Control *the_timer; if ( !_Objects_Is_name_valid( name ) ) return ( RTEMS_INVALID_NAME ); _Thread_Disable_dispatch(); /* to prevent deletion */ the_timer = _Timer_Allocate(); if ( !the_timer ) { _Thread_Enable_dispatch(); return( RTEMS_TOO_MANY ); } the_timer->the_class = TIMER_DORMANT; _Objects_Open( &_Timer_Information, &the_timer->Object, name ); *id = the_timer->Object.id; _Thread_Enable_dispatch(); return( RTEMS_SUCCESSFUL );}
Objects_Name name,
rtems_name name,
rtems_status_code rtems_timer_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Timer_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
name,
&name,
rtems_status_code rtems_timer_ident( Objects_Name name, Objects_Id *id){ return _Objects_Name_to_id( &_Timer_Information, name, RTEMS_SEARCH_LOCAL_NODE, id );}
return 0;
NS16550_STATIC int ns16550_set_attributes( int minor, const struct termios *t){ unsigned32 pNS16550; unsigned32 ulBaudDivisor; unsigned8 ucLineControl; unsigned32 baud_requested; setRegister_f setReg; getRegister_f getReg; unsigned32 Irql; pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; setReg = Console_Port_Tbl[minor].setRegister; getReg = Console_Port_Tbl[minor].getRegister; /* * Calculate the baud rate divisor */ baud_requested = t->c_cflag & CBAUD; if (!baud_requested) baud_requested = B9600; /* default to 9600 baud */ ulBaudDivisor = termios_baud_to_number(baud_requested); ucLineControl = 0; /* * Parity */ if (t->c_cflag & PARENB) { ucLineControl |= SP_LINE_PAR; if (!(t->c_cflag & PARODD)) ucLineControl |= SP_LINE_ODD; } /* * Character Size */ if (t->c_cflag & CSIZE) { switch (t->c_cflag & CSIZE) { case CS5: ucLineControl |= FIVE_BITS; break; case CS6: ucLineControl |= SIX_BITS; break; case CS7: ucLineControl |= SEVEN_BITS; break; case CS8: ucLineControl |= EIGHT_BITS; break; } } else { ucLineControl |= EIGHT_BITS; /* default to 9600,8,N,1 */ } /* * Stop Bits */ if (t->c_cflag & CSTOPB) { ucLineControl |= SP_LINE_STOP; /* 2 stop bits */ } else { ; /* 1 stop bit */ } /* * Now actually set the chip */ rtems_interrupt_disable(Irql); /* * Set the baud rate */ (*setReg)(pNS16550, NS16550_LINE_CONTROL, SP_LINE_DLAB); /* XXX are these registers right? */ (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, ulBaudDivisor&0xff); (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, (ulBaudDivisor>>8)&0xff); /* * Now write the line control */ (*setReg)(pNS16550, NS16550_LINE_CONTROL, ucLineControl ); rtems_interrupt_enable(Irql);}
status = EXIT_OK;
pppd_status = EXIT_OK;
np_up(unit, proto) int unit, proto;{ int tlim; if (num_np_up == 0) { /* * At this point we consider that the link has come up successfully. */ status = EXIT_OK; unsuccess = 0; new_phase(PHASE_RUNNING); if (idle_time_hook != 0) tlim = (*idle_time_hook)(NULL); else tlim = idle_time_limit; if (tlim > 0) TIMEOUT(check_idle, NULL, tlim); /* * Set a timeout to close the connection once the maximum * connect time has expired. */ if (maxconnect > 0) TIMEOUT(connect_time_expired, 0, maxconnect); } ++num_np_up;}
cache->chk = cache->base;
init_rel(RELCACHE_t *cache, FB_t *F, long RU){ const long RELSUP = 5; const long n = F->KC + RU-1 + RELSUP; /* expected # of needed relations */ long i, j, k, p; GEN c, P; REL_t *rel; if (DEBUGLEVEL) fprintferr("KCZ = %ld, KC = %ld, n = %ld\n", F->KCZ,F->KC,n); reallocate(cache, 10*n + 50); /* make room for lots of relations */ cache->end = cache->base + n; for (rel = cache->base + 1, i = 1; i <= F->KCZ; i++) { /* trivial relations (p) = prod P^e */ p = F->FB[i]; P = F->LV[p]; if (!isclone(P)) continue; /* all prime divisors in FB */ c = col_0(F->KC); k = F->iLP[p]; rel->nz = k+1; rel->R = c; c += k; rel->ex = NULL; rel->m = NULL; rel->pow= NULL; /* = F->pow */ for (j = lg(P)-1; j; j--) c[j] = itos(gmael(P,j,3)); rel++; } cache->last = rel - 1; if (DEBUGLEVEL) fprintferr("After trivial relations, cglob = %ld\n", cache->last - cache->base);}
case 0: m860.simask |= M860_SIMASK_IRM3; break; case 1: m860.simask |= M860_SIMASK_IRM4; break; case 2: m860.simask |= M860_SIMASK_IRM2; break;
case 0: m8xx.simask |= M8xx_SIMASK_IRM3; break; case 1: m8xx.simask |= M8xx_SIMASK_IRM4; break; case 2: m8xx.simask |= M8xx_SIMASK_IRM2; break;
rtems_device_driver canbus_open( rtems_device_major_number major, rtems_device_minor_number minor, void * arg){ /* msg is in use, rx interrupts are enabled */ candev[minor]->msg15.ctrl0 = 0xff & (I82527_MSG_CTRL_MSGVAL_SET | I82527_MSG_CTRL_RXIE_SET); candev[minor]->ctrl |= I82527_CTRL_IE; candev[minor]->ctrl &= ~(I82527_CTRL_CCE | I82527_CTRL_INIT); switch (minor) { case 0: m860.simask |= M860_SIMASK_IRM3; break; case 1: m860.simask |= M860_SIMASK_IRM4; break; case 2: m860.simask |= M860_SIMASK_IRM2; break; default: return; } return RTEMS_SUCCESSFUL;}
status = EXIT_HANGUP;
pppd_status = EXIT_HANGUP;
get_input(void){ int len, i; u_char *p; u_short protocol; struct protent *protp; p = inpacket_buf; /* point to beginning of packet buffer */ len = read_packet(inpacket_buf); if (len < 0) return; if (len == 0) { notice("Modem hangup"); hungup = 1; status = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; } if (debug /*&& (debugflags & DBG_INPACKET)*/) dbglog("rcvd %P", p, len); if (len < PPP_HDRLEN) { MAINDEBUG(("io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG(("get_input: Received non-LCP packet when LCP not open.")); return; } /* * Until we get past the authentication phase, toss all packets * except LCP, LQR and authentication packets. */ if (phase <= PHASE_AUTHENTICATE && !(protocol == PPP_LCP || protocol == PPP_LQR || protocol == PPP_PAP || protocol == PPP_CHAP)) { MAINDEBUG(("get_input: discarding proto 0x%x in phase %d", protocol, phase)); return; } /* * Upcall the proper protocol input routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (protp->protocol == protocol && protp->enabled_flag) { (*protp->input)(0, p, len); return; } if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag && protp->datainput != NULL) { (*protp->datainput)(0, p, len); return; } } if (debug) { const char *pname = protocol_name(protocol); if (pname != NULL) warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else warn("Unsupported protocol 0x%x received", protocol); } lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); return;}
if (phase <= PHASE_AUTHENTICATE
if (pppd_phase <= PHASE_AUTHENTICATE
get_input(void){ int len, i; u_char *p; u_short protocol; struct protent *protp; p = inpacket_buf; /* point to beginning of packet buffer */ len = read_packet(inpacket_buf); if (len < 0) return; if (len == 0) { notice("Modem hangup"); hungup = 1; status = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; } if (debug /*&& (debugflags & DBG_INPACKET)*/) dbglog("rcvd %P", p, len); if (len < PPP_HDRLEN) { MAINDEBUG(("io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG(("get_input: Received non-LCP packet when LCP not open.")); return; } /* * Until we get past the authentication phase, toss all packets * except LCP, LQR and authentication packets. */ if (phase <= PHASE_AUTHENTICATE && !(protocol == PPP_LCP || protocol == PPP_LQR || protocol == PPP_PAP || protocol == PPP_CHAP)) { MAINDEBUG(("get_input: discarding proto 0x%x in phase %d", protocol, phase)); return; } /* * Upcall the proper protocol input routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (protp->protocol == protocol && protp->enabled_flag) { (*protp->input)(0, p, len); return; } if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag && protp->datainput != NULL) { (*protp->datainput)(0, p, len); return; } } if (debug) { const char *pname = protocol_name(protocol); if (pname != NULL) warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else warn("Unsupported protocol 0x%x received", protocol); } lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); return;}
protocol, phase));
protocol, pppd_phase));
get_input(void){ int len, i; u_char *p; u_short protocol; struct protent *protp; p = inpacket_buf; /* point to beginning of packet buffer */ len = read_packet(inpacket_buf); if (len < 0) return; if (len == 0) { notice("Modem hangup"); hungup = 1; status = EXIT_HANGUP; lcp_lowerdown(0); /* serial link is no longer available */ link_terminated(0); return; } if (debug /*&& (debugflags & DBG_INPACKET)*/) dbglog("rcvd %P", p, len); if (len < PPP_HDRLEN) { MAINDEBUG(("io(): Received short packet.")); return; } p += 2; /* Skip address and control */ GETSHORT(protocol, p); len -= PPP_HDRLEN; /* * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && lcp_fsm[0].state != OPENED) { MAINDEBUG(("get_input: Received non-LCP packet when LCP not open.")); return; } /* * Until we get past the authentication phase, toss all packets * except LCP, LQR and authentication packets. */ if (phase <= PHASE_AUTHENTICATE && !(protocol == PPP_LCP || protocol == PPP_LQR || protocol == PPP_PAP || protocol == PPP_CHAP)) { MAINDEBUG(("get_input: discarding proto 0x%x in phase %d", protocol, phase)); return; } /* * Upcall the proper protocol input routine. */ for (i = 0; (protp = protocols[i]) != NULL; ++i) { if (protp->protocol == protocol && protp->enabled_flag) { (*protp->input)(0, p, len); return; } if (protocol == (protp->protocol & ~0x8000) && protp->enabled_flag && protp->datainput != NULL) { (*protp->datainput)(0, p, len); return; } } if (debug) { const char *pname = protocol_name(protocol); if (pname != NULL) warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else warn("Unsupported protocol 0x%x received", protocol); } lcp_sprotrej(0, p - PPP_HDRLEN, len + PPP_HDRLEN); return;}
char *s, c;
const char *s; char c;
escape0(char *tch){ char *s, c; if (compatible != NONE) { s = tch; while (*s) if (*s++ == '=') { GEN (*f)(char*, int) = NULL; int len = (s-tch) - 1; if (!strncmp(tch,"precision",len)) f = sd_realprecision; else if (!strncmp(tch,"serieslength",len)) f = sd_seriesprecision; else if (!strncmp(tch,"format",len)) f = sd_format; else if (!strncmp(tch,"prompt",len)) f = sd_prompt; if (f) { f(get_sep(s), d_ACKNOWLEDGE); return; } break; } } s = tch; switch ((c = *s++)) { case 'w': case 'x': case 'a': case 'b': case 'B': case 'm': { /* history things */ long d; GEN x; if (c != 'w' && c != 'x') d = get_int(s,0); else { d = atol(s); if (*s == '-') s++; while (isdigit((int)*s)) s++; } x = gp_history(GP_DATA->hist, d, tch+1,tch-1); switch (c) { case 'B': { /* prettyprinter */ gp_data G = *GP_DATA; /* copy */ gp_hist h = *(G.hist); /* copy */ pariout_t f = *(G.fmt); /* copy */ G.hist = &h; h.total = 0; /* no hist number */ G.fmt = &f; f.prettyp = f_PRETTY; G.flags &= ~(TEST|TEXMACS); G.lim_lines = 0; gp_output(x, &G); break; } case 'a': brute (x, GP_DATA->fmt->format, -1); break; case 'm': matbrute(x, GP_DATA->fmt->format, -1); break; case 'b': sor(x, GP_DATA->fmt->format, -1, GP_DATA->fmt->fieldw); break; case 'x': voir(x, get_int(s, -1)); break; case 'w': s = get_sep_colon_ok(s); if (!*s) s = current_logfile; write0(s, _vec(x)); return; } pariputc('\n'); return; } case 'c': commands(-1); break; case 'd': help_default(); break; case 'e': s = get_sep(s); if (!*s) s = (GP_DATA->flags & ECHO)? "0": "1"; sd_echo(s,d_ACKNOWLEDGE); break; case 'g': switch (*s) { case 'm': sd_debugmem(++s,d_ACKNOWLEDGE); break; case 'f': sd_debugfiles(++s,d_ACKNOWLEDGE); break; default : sd_debug(s,d_ACKNOWLEDGE); break; } break; case 'h': print_hash_list(s); break; case 'l': s = get_sep_colon_ok(s); if (*s) { sd_logfile(s,d_ACKNOWLEDGE); if (logfile) break; } sd_log(logfile?"0":"1",d_ACKNOWLEDGE); break; case 'o': sd_output(s,d_ACKNOWLEDGE); break; case 'p': switch (*s) { case 's': sd_seriesprecision(++s,d_ACKNOWLEDGE); break; default : sd_realprecision(s,d_ACKNOWLEDGE); break; } break; case 'q': gp_quit(); break; case 'r': s = get_sep_colon_ok(s); switchin(s); if (file_is_binary(infile)) { GEN x = gpreadbin(s); if (isclone(x)) /* many BIN_GEN */ { long i, l = lg(x); err(warner,"setting %ld history entries", l-1); for (i=1; i<l; i++) (void)set_hist_entry(GP_DATA->hist, (GEN)x[i]); } } break; case 's': etatpile(0); break; case 't': gentypes(); break; case 'u': switch (*s) { case 'm': user_member(); break; default: user_fun(); } break; case 'v': print_version(); break; case 'y': s = get_sep(s); if (!*s) s = (GP_DATA->flags & SIMPLIFY)? "0": "1"; sd_simplify(s,d_ACKNOWLEDGE); break; default: err(caracer1,tch-1,tch-2); }}
virtual void operator()(T& from,T& to)
void operator()(std::ostream& out) const
virtual void operator()(T& from,T& to) { cout << from << " -> " << to << endl; }
cout << from << " -> " << to << endl;
out << "node [shape=box]" << std::endl;
virtual void operator()(T& from,T& to) { cout << from << " -> " << to << endl; }
k = 1+bfffo(m); m<<=k; k = BITS_IN_LONG-k;
k = 1+bfffo((ulong)m); m<<=k; k = BITS_IN_LONG-k;
rpowsi(ulong a, GEN n, long prec){ long av,*p,m,k,i,lim; GEN y, unr = realun(prec); GEN (*sq)(GEN); GEN (*mulsg)(long,GEN); if (a == 1) return unr; if (a == 2) { setexpo(unr, itos(n)); return unr; } if (is_pm1(n)) { affsr(a, unr); return unr; } /* be paranoid about memory consumption */ av=avma; lim=stack_lim(av,1); y = stoi(a); p = n+2; m = *p; /* normalize, i.e set highest bit to 1 (we know m != 0) */ k = 1+bfffo(m); m<<=k; k = BITS_IN_LONG-k; /* first bit is now implicit */ sq = &sqri; mulsg = &mulsi; for (i=lgefint(n)-2;;) { for (; k; m<<=1,k--) { y = sq(y); if (m < 0) y = mulsg(a,y); if (lgefint(y) >= prec && typ(y) == t_INT) /* switch to t_REAL */ { sq = &gsqr; mulsg = &mulsr; affir(y, unr); y = unr; } if (low_stack(lim, stack_lim(av,1))) { if (DEBUGMEM>1) err(warnmem,"rpuisssi"); y = gerepileuptoleaf(av,y); } } if (--i == 0) break; m = *++p, k = BITS_IN_LONG; } if (typ(y) == t_INT) { affir(y, unr); y = unr ; } return gerepileuptoleaf(av,y);}
pari_sp av, tetpil;
pari_sp av;
gsqrt(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1, p2; switch(typ(x)) { case t_REAL: return sqrtr(x); case t_INTMOD: y = cgetg(3,t_INTMOD); copyifstack(x[1],y[1]); p1 = Fp_sqrt((GEN)x[2],(GEN)y[1]); if (!p1) err(sqrter5); y[2] = (long)p1; return y; case t_COMPLEX: y = cgetg(3,t_COMPLEX); av = avma; if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); } p1 = gsqr((GEN)x[1]); p2 = gsqr((GEN)x[2]); p1 = gsqrt(gadd(p1,p2), prec); if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; } if (gsigne((GEN)x[1]) < 0) { p1 = sqrtr( gmul2n(gsub(p1,(GEN)x[1]), -1) ); if (gsigne((GEN)x[2]) < 0) setsigne(p1, -signe(p1)); y[2] = (long)gerepileuptoleaf(av, p1); av = avma; y[1] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } else { p1 = sqrtr( gmul2n(gadd(p1,(GEN)x[1]), -1) ); y[1] = (long)gerepileuptoleaf(av, p1); av = avma; y[2] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } return y; case t_PADIC: return padic_sqrt(x); default: av = avma; if (!(y = _toser(x))) break; return gerepileupto(av, ser_powfrac(y, ghalf, prec)); } return transc(gsqrt,x,prec);}
if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); }
gsqrt(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1, p2; switch(typ(x)) { case t_REAL: return sqrtr(x); case t_INTMOD: y = cgetg(3,t_INTMOD); copyifstack(x[1],y[1]); p1 = Fp_sqrt((GEN)x[2],(GEN)y[1]); if (!p1) err(sqrter5); y[2] = (long)p1; return y; case t_COMPLEX: y = cgetg(3,t_COMPLEX); av = avma; if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); } p1 = gsqr((GEN)x[1]); p2 = gsqr((GEN)x[2]); p1 = gsqrt(gadd(p1,p2), prec); if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; } if (gsigne((GEN)x[1]) < 0) { p1 = sqrtr( gmul2n(gsub(p1,(GEN)x[1]), -1) ); if (gsigne((GEN)x[2]) < 0) setsigne(p1, -signe(p1)); y[2] = (long)gerepileuptoleaf(av, p1); av = avma; y[1] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } else { p1 = sqrtr( gmul2n(gadd(p1,(GEN)x[1]), -1) ); y[1] = (long)gerepileuptoleaf(av, p1); av = avma; y[2] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } return y; case t_PADIC: return padic_sqrt(x); default: av = avma; if (!(y = _toser(x))) break; return gerepileupto(av, ser_powfrac(y, ghalf, prec)); } return transc(gsqrt,x,prec);}
if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; }
if (gcmp0(p1)) { y[1] = y[2] = (long)sqrtr(p1); return y; }
gsqrt(GEN x, long prec){ pari_sp av, tetpil; GEN y, p1, p2; switch(typ(x)) { case t_REAL: return sqrtr(x); case t_INTMOD: y = cgetg(3,t_INTMOD); copyifstack(x[1],y[1]); p1 = Fp_sqrt((GEN)x[2],(GEN)y[1]); if (!p1) err(sqrter5); y[2] = (long)p1; return y; case t_COMPLEX: y = cgetg(3,t_COMPLEX); av = avma; if (isexactzero((GEN)x[2])) { long tx; x = (GEN)x[1]; tx = typ(x); if ((is_intreal_t(tx) || tx == t_FRAC) && gsigne(x) < 0) { y[1] = zero; tetpil = avma; y[2] = lpileupto(av, gsqrt(gneg_i(x), prec)); return y; } avma = (pari_sp)(y+3); return gsqrt(x, prec); } p1 = gsqr((GEN)x[1]); p2 = gsqr((GEN)x[2]); p1 = gsqrt(gadd(p1,p2), prec); if (gcmp0(p1)) { y[1] = (long)sqrtr(p1); y[2] = lcopy((GEN)y[1]); return y; } if (gsigne((GEN)x[1]) < 0) { p1 = sqrtr( gmul2n(gsub(p1,(GEN)x[1]), -1) ); if (gsigne((GEN)x[2]) < 0) setsigne(p1, -signe(p1)); y[2] = (long)gerepileuptoleaf(av, p1); av = avma; y[1] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } else { p1 = sqrtr( gmul2n(gadd(p1,(GEN)x[1]), -1) ); y[1] = (long)gerepileuptoleaf(av, p1); av = avma; y[2] = (long)gerepileuptoleaf(av, gdiv((GEN)x[2], gmul2n(p1,1))); } return y; case t_PADIC: return padic_sqrt(x); default: av = avma; if (!(y = _toser(x))) break; return gerepileupto(av, ser_powfrac(y, ghalf, prec)); } return transc(gsqrt,x,prec);}
if (!sx) { y=cgetr(3); y[1]=x[1]; y[2]=0; return y; }
if (!sx) return realzero_bit(expo(x));
mpexp1(GEN x){ long l,l1,l2,i,n,m,ex,s,av,av2, sx = signe(x); double a,b,alpha,beta, gama = 2.0 /* optimized for SUN3 */; /* KB: 3.0 is better for UltraSparc */ GEN y,p1,p2,p3,p4,unr; if (typ(x)!=t_REAL) err(typeer,"mpexp1"); if (!sx) { y=cgetr(3); y[1]=x[1]; y[2]=0; return y; } l=lg(x); y=cgetr(l); av=avma; /* room for result */ l2 = l+1; ex = expo(x); if (ex > EXMAX) err(talker,"exponent too large in exp"); alpha = -1-log(2+x[2]/C31)-ex*LOG2; beta = 5 + bit_accuracy(l)*LOG2; a = sqrt(beta/(gama*LOG2)); b = (alpha + 0.5*log(beta*gama/LOG2))/LOG2; if (a>=b) { n=(long)(1+sqrt(beta*gama/LOG2)); m=(long)(1+a-b); l2 += m>>TWOPOTBITS_IN_LONG; } else { n=(long)(1+beta/alpha); m=0; } unr=realun(l2); p2=rcopy(unr); setlg(p2,4); p4=cgetr(l2); affrr(x,p4); setsigne(p4,1); if (m) setexpo(p4,ex-m); s=0; l1=4; av2 = avma; for (i=n; i>=2; i--) { setlg(p4,l1); p3 = divrs(p4,i); s -= expo(p3); p1 = mulrr(p3,p2); setlg(p1,l1); l1 += s>>TWOPOTBITS_IN_LONG; if (l1>l2) l1=l2; s %= BITS_IN_LONG; setlg(unr,l1); p1 = addrr(unr,p1); setlg(p2,l1); affrr(p1,p2); avma = av2; } setlg(p2,l2); setlg(p4,l2); p2 = mulrr(p4,p2); for (i=1; i<=m; i++) { setlg(p2,l2); p2 = mulrr(addsr(2,p2),p2); } if (sx == -1) { setlg(unr,l2); p2 = addrr(unr,p2); setlg(p2,l2); p2 = ginv(p2); p2 = subrr(p2,unr); } affrr(p2,y); avma = av; return y;}
affrr(gmul(v1,u), (GEN)y[1]); affrr(gmul(u1,v), (GEN)y[2]); return y;
affr_fixlg(gmul(v1,u), (GEN)y[1]); affr_fixlg(gmul(u1,v), (GEN)y[2]); return y;
gsin(GEN x, long prec){ pari_sp av; GEN r, u, v, y, v1, u1; long i; switch(typ(x)) { case t_REAL: return mpsin(x); case t_COMPLEX: i = precision(x); if (!i) i = prec; y = cgetc(i); av = avma; r = gexp((GEN)x[2],prec); v1 = gmul2n(addrr(ginv(r),r), -1); /* = cos(I*Im(x)) */ u1 = subrr(r, v1); /* = I*sin(I*Im(x)) */ gsincos((GEN)x[1],&u,&v,prec); affrr(gmul(v1,u), (GEN)y[1]); affrr(gmul(u1,v), (GEN)y[2]); return y; case t_INT: case t_FRAC: y = cgetr(prec); av = avma; /* _not_ afrr: we want to be able to reduce mod Pi */ x = gadd(x, realzero(prec)); affrr(mpsin(x), y); avma = av; return y; case t_INTMOD: case t_PADIC: err(typeer,"gsin"); default: av = avma; if (!(y = _toser(x))) break; if (gcmp0(y)) return gcopy(y); if (valp(y) < 0) err(negexper,"gsin"); gsincos(y,&u,&v,prec); return gerepilecopy(av,u); } return transc(gsin,x,prec);}
affrr(mpsin(x), y); avma = av; return y;
affr_fixlg(mpsin(x), y); avma = av; return y;
gsin(GEN x, long prec){ pari_sp av; GEN r, u, v, y, v1, u1; long i; switch(typ(x)) { case t_REAL: return mpsin(x); case t_COMPLEX: i = precision(x); if (!i) i = prec; y = cgetc(i); av = avma; r = gexp((GEN)x[2],prec); v1 = gmul2n(addrr(ginv(r),r), -1); /* = cos(I*Im(x)) */ u1 = subrr(r, v1); /* = I*sin(I*Im(x)) */ gsincos((GEN)x[1],&u,&v,prec); affrr(gmul(v1,u), (GEN)y[1]); affrr(gmul(u1,v), (GEN)y[2]); return y; case t_INT: case t_FRAC: y = cgetr(prec); av = avma; /* _not_ afrr: we want to be able to reduce mod Pi */ x = gadd(x, realzero(prec)); affrr(mpsin(x), y); avma = av; return y; case t_INTMOD: case t_PADIC: err(typeer,"gsin"); default: av = avma; if (!(y = _toser(x))) break; if (gcmp0(y)) return gcopy(y); if (valp(y) < 0) err(negexper,"gsin"); gsincos(y,&u,&v,prec); return gerepilecopy(av,u); } return transc(gsin,x,prec);}
affrr(a1,y); avma = av; return y;
affr_fixlg(a1,y); avma = av; return y;
agm1r_abs(GEN x){ long l = lg(x), L = 5-bit_accuracy(l); GEN a1, b1, y = cgetr(l); pari_sp av = avma; a1 = addrr(realun(l), x); setexpo(a1, expo(a1)-1); b1 = sqrtr_abs(x); while (expo(subrr(b1,a1)) - expo(b1) >= L) { GEN a = a1; a1 = addrr(a,b1); setexpo(a1, expo(a1)-1); b1 = sqrtr_abs(mulrr(a,b1)); } affrr(a1,y); avma = av; return y;}
GEN V=cgetg(l+2,t_VEC); long i; long v=T[1]; V[1] = (long) Fl_to_Flx(1, v); if (l==0) return V; V[2] = (long) vecsmall_copy(x); if (l==1) return V; V[3] = (long) Flxq_sqr(x,T,p); for(i=4;i<l+2;i++) V[i] = (long) Flxq_mul((GEN) V[i-1],x,T,p); #if 0 TODO: Karim proposes to use squaring: V[i] = (long) ((i&1)?Flxq_sqr((GEN) V[(i+1)>>1],T,p) :Flxq_mul((GEN) V[i-1],x,T,p)); Please profile it. #endif
GEN V = cgetg(l+2,t_VEC); long i, v = T[1]; gel(V,1) = Fl_to_Flx(1, v); if (l==0) return V; gel(V,2) = vecsmall_copy(x); if (l==1) return V; gel(V,3) = Flxq_sqr(x,T,p); if ((degpol(x)<<1) < degpol(T)) { for(i = 4; i < l+2; i++) gel(V,i) = Flxq_mul(gel(V,i-1),x,T,p); } else { for(i = 4; i < l+2; i++) { gel(V,i) = (i&1)? Flxq_sqr(gel(V, (i+1)>>1),T,p) : Flxq_mul(gel(V, i-1),x,T,p); } }
Flxq_powers(GEN x, long l, GEN T, ulong p){ GEN V=cgetg(l+2,t_VEC); long i; long v=T[1]; V[1] = (long) Fl_to_Flx(1, v); if (l==0) return V; V[2] = (long) vecsmall_copy(x); if (l==1) return V; V[3] = (long) Flxq_sqr(x,T,p); for(i=4;i<l+2;i++) V[i] = (long) Flxq_mul((GEN) V[i-1],x,T,p);#if 0 TODO: Karim proposes to use squaring: V[i] = (long) ((i&1)?Flxq_sqr((GEN) V[(i+1)>>1],T,p) :Flxq_mul((GEN) V[i-1],x,T,p)); Please profile it.#endif return V;}
if ((opt->flags & OPT_INITONLY) && phase != PHASE_INITIALIZE) {
if ((opt->flags & OPT_INITONLY) && pppd_phase != PHASE_INITIALIZE) {
process_option(opt, argv) option_t *opt; char **argv;{ u_int32_t v; int iv, a; char *sv; int (*parser) __P((char **)); if ((opt->flags & OPT_PREPASS) == 0 && prepass) return 1; if ((opt->flags & OPT_INITONLY) && phase != PHASE_INITIALIZE) { option_error("it's too late to use the %s option", opt->name); return 0; } if ((opt->flags & OPT_PRIV) && !privileged_option) { option_error("using the %s option requires root privilege", opt->name); return 0; } if ((opt->flags & OPT_ENABLE) && *(bool *)(opt->addr2) == 0) { option_error("%s option is disabled", opt->name); return 0; } if ((opt->flags & OPT_PRIVFIX) && !privileged_option) { struct option_info *ip = (struct option_info *) opt->addr2; if (ip && ip->priv) { option_error("%s option cannot be overridden", opt->name); return 0; } } switch (opt->type) { case o_bool: v = opt->flags & OPT_VALUE; *(bool *)(opt->addr) = v; if (opt->addr2 && (opt->flags & OPT_A2COPY)) *(bool *)(opt->addr2) = v; break; case o_int: iv = 0; if ((opt->flags & OPT_NOARG) == 0) { if (!int_option(*argv, &iv)) return 0; if ((((opt->flags & OPT_LLIMIT) && iv < opt->lower_limit) || ((opt->flags & OPT_ULIMIT) && iv > opt->upper_limit)) && !((opt->flags & OPT_ZEROOK && iv == 0))) { char *zok = (opt->flags & OPT_ZEROOK)? " zero or": ""; switch (opt->flags & OPT_LIMITS) { case OPT_LLIMIT: option_error("%s value must be%s >= %d", opt->name, zok, opt->lower_limit); break; case OPT_ULIMIT: option_error("%s value must be%s <= %d", opt->name, zok, opt->upper_limit); break; case OPT_LIMITS: option_error("%s value must be%s between %d and %d", opt->name, opt->lower_limit, opt->upper_limit); break; } return 0; } } a = opt->flags & OPT_VALUE; if (a >= 128) a -= 256; /* sign extend */ iv += a; if (opt->flags & OPT_INC) iv += *(int *)(opt->addr); if ((opt->flags & OPT_NOINCR) && !privileged_option) { int oldv = *(int *)(opt->addr); if ((opt->flags & OPT_ZEROINF) ? (oldv != 0 && (iv == 0 || iv > oldv)) : (iv > oldv)) { option_error("%s value cannot be increased", opt->name); return 0; } } *(int *)(opt->addr) = iv; if (opt->addr2 && (opt->flags & OPT_A2COPY)) *(int *)(opt->addr2) = iv; break; case o_uint32: if (opt->flags & OPT_NOARG) { v = opt->flags & OPT_VALUE; } else if (!number_option(*argv, &v, 16)) return 0; if (opt->flags & OPT_OR) v |= *(u_int32_t *)(opt->addr); *(u_int32_t *)(opt->addr) = v; if (opt->addr2 && (opt->flags & OPT_A2COPY)) *(u_int32_t *)(opt->addr2) = v; break; case o_string: if (opt->flags & OPT_STATIC) { strlcpy((char *)(opt->addr), *argv, opt->upper_limit); } else { sv = strdup(*argv); if (sv == NULL) novm("option argument"); if ( *(char **)(opt->addr) != NULL ) { free((void *)*(char **)(opt->addr)); *(char **)(opt->addr) = NULL; } *(char **)(opt->addr) = sv; } break; case o_special_noarg: case o_special: parser = (int (*) __P((char **))) opt->addr; if (!(*parser)(argv)) return 0; break; } if (opt->addr2) { if (opt->flags & OPT_A2INFO) { struct option_info *ip = (struct option_info *) opt->addr2; ip->priv = privileged_option; ip->source = option_source; } else if ((opt->flags & (OPT_A2COPY|OPT_ENABLE)) == 0) *(bool *)(opt->addr2) = 1; } return 1;}
_factorback(GEN fa, GEN e, GEN (*_mul)(GEN,GEN), GEN (*_pow)(GEN,GEN))
_factorback(GEN fa, GEN e, GEN (*_mul)(void*,GEN,GEN), GEN (*_pow)(void*,GEN,GEN), void *data)
_factorback(GEN fa, GEN e, GEN (*_mul)(GEN,GEN), GEN (*_pow)(GEN,GEN)){ pari_sp av = avma; long k,l,lx,t = typ(fa); GEN p,x; if (e) /* supplied vector of exponents */ p = fa; else /* genuine factorization */ { if (t == t_MAT) { l = lg(fa); if (l == 1) return gen_1; if (l != 3) err(talker,"not a factorisation in factorback"); } else { if (!is_vec_t(t)) err(talker,"not a factorisation in factorback"); return gerepileupto(av, divide_conquer_prod(fa, _mul)); } p = gel(fa,1); e = gel(fa,2); } lx = lg(p); t = t_INT; /* dummy */ /* check whether e is an integral vector of correct length */ if (is_vec_t(typ(e)) && lx == lg(e)) { for (k=1; k<lx; k++) if (typ(e[k]) != t_INT) break; if (k == lx) t = t_MAT; } if (t != t_MAT) err(talker,"not a factorisation in factorback"); if (lx == 1) return gen_1; x = cgetg(lx,t_VEC); for (l=1,k=1; k<lx; k++) if (signe(e[k])) gel(x,l++) = _pow(gel(p,k),gel(e,k)); setlg(x,l); return gerepileupto(av, divide_conquer_prod(x, _mul));}
return gerepileupto(av, divide_conquer_prod(fa, _mul));
return gerepileupto(av, divide_conquer_assoc(fa, _mul,data));
_factorback(GEN fa, GEN e, GEN (*_mul)(GEN,GEN), GEN (*_pow)(GEN,GEN)){ pari_sp av = avma; long k,l,lx,t = typ(fa); GEN p,x; if (e) /* supplied vector of exponents */ p = fa; else /* genuine factorization */ { if (t == t_MAT) { l = lg(fa); if (l == 1) return gen_1; if (l != 3) err(talker,"not a factorisation in factorback"); } else { if (!is_vec_t(t)) err(talker,"not a factorisation in factorback"); return gerepileupto(av, divide_conquer_prod(fa, _mul)); } p = gel(fa,1); e = gel(fa,2); } lx = lg(p); t = t_INT; /* dummy */ /* check whether e is an integral vector of correct length */ if (is_vec_t(typ(e)) && lx == lg(e)) { for (k=1; k<lx; k++) if (typ(e[k]) != t_INT) break; if (k == lx) t = t_MAT; } if (t != t_MAT) err(talker,"not a factorisation in factorback"); if (lx == 1) return gen_1; x = cgetg(lx,t_VEC); for (l=1,k=1; k<lx; k++) if (signe(e[k])) gel(x,l++) = _pow(gel(p,k),gel(e,k)); setlg(x,l); return gerepileupto(av, divide_conquer_prod(x, _mul));}
gel(x,l++) = _pow(gel(p,k),gel(e,k));
gel(x,l++) = _pow(data,gel(p,k),gel(e,k));
_factorback(GEN fa, GEN e, GEN (*_mul)(GEN,GEN), GEN (*_pow)(GEN,GEN)){ pari_sp av = avma; long k,l,lx,t = typ(fa); GEN p,x; if (e) /* supplied vector of exponents */ p = fa; else /* genuine factorization */ { if (t == t_MAT) { l = lg(fa); if (l == 1) return gen_1; if (l != 3) err(talker,"not a factorisation in factorback"); } else { if (!is_vec_t(t)) err(talker,"not a factorisation in factorback"); return gerepileupto(av, divide_conquer_prod(fa, _mul)); } p = gel(fa,1); e = gel(fa,2); } lx = lg(p); t = t_INT; /* dummy */ /* check whether e is an integral vector of correct length */ if (is_vec_t(typ(e)) && lx == lg(e)) { for (k=1; k<lx; k++) if (typ(e[k]) != t_INT) break; if (k == lx) t = t_MAT; } if (t != t_MAT) err(talker,"not a factorisation in factorback"); if (lx == 1) return gen_1; x = cgetg(lx,t_VEC); for (l=1,k=1; k<lx; k++) if (signe(e[k])) gel(x,l++) = _pow(gel(p,k),gel(e,k)); setlg(x,l); return gerepileupto(av, divide_conquer_prod(x, _mul));}
return gerepileupto(av, divide_conquer_prod(x, _mul));
return gerepileupto(av, divide_conquer_assoc(x, _mul,data));
_factorback(GEN fa, GEN e, GEN (*_mul)(GEN,GEN), GEN (*_pow)(GEN,GEN)){ pari_sp av = avma; long k,l,lx,t = typ(fa); GEN p,x; if (e) /* supplied vector of exponents */ p = fa; else /* genuine factorization */ { if (t == t_MAT) { l = lg(fa); if (l == 1) return gen_1; if (l != 3) err(talker,"not a factorisation in factorback"); } else { if (!is_vec_t(t)) err(talker,"not a factorisation in factorback"); return gerepileupto(av, divide_conquer_prod(fa, _mul)); } p = gel(fa,1); e = gel(fa,2); } lx = lg(p); t = t_INT; /* dummy */ /* check whether e is an integral vector of correct length */ if (is_vec_t(typ(e)) && lx == lg(e)) { for (k=1; k<lx; k++) if (typ(e[k]) != t_INT) break; if (k == lx) t = t_MAT; } if (t != t_MAT) err(talker,"not a factorisation in factorback"); if (lx == 1) return gen_1; x = cgetg(lx,t_VEC); for (l=1,k=1; k<lx; k++) if (signe(e[k])) gel(x,l++) = _pow(gel(p,k),gel(e,k)); setlg(x,l); return gerepileupto(av, divide_conquer_prod(x, _mul));}
buchgenforcefu(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2,long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,nf_UNITS|nf_FORCE,prec); }
buchgenforcefu(B_ARGS) { return B_CALL(nf_UNITS|nf_FORCE); }
buchgenforcefu(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2,long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,nf_UNITS|nf_FORCE,prec);}
buchgen(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2, long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,0,prec); }
buchgen(B_ARGS) { return B_CALL(0); }
buchgen(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2, long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,0,prec);}
buchinitforcefu(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2,long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,nf_INIT|nf_UNITS|nf_FORCE,prec); }
buchinitforcefu(B_ARGS) { return B_CALL(nf_INIT|nf_UNITS|nf_FORCE); }
buchinitforcefu(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2,long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,nf_INIT|nf_UNITS|nf_FORCE,prec);}
buchinit(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2,long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,nf_INIT,prec); }
buchinit(B_ARGS) { return B_CALL(nf_INIT); }
buchinit(GEN g1,GEN g2,GEN g3,GEN g4, GEN g5,long l1,long l2,long prec) { return buchall(g1,gtodouble(g2),gtodouble(g3),l1,nf_INIT,prec);}
mapOverAll(0,disableUniversePort,0);
DFLT_BASE; mapOverAll(base,0,disableUniversePort,0);
vmeUniverseDisableAllSlaves(void){ mapOverAll(0,disableUniversePort,0);}
return cfgUniversePort(1,port,address_space,vme_address,local_address,length);
DFLT_BASE; return cfgUniversePort(base,1,port,address_space,vme_address,local_address,length);
vmeUniverseMasterPortCfg( unsigned long port, unsigned long address_space, unsigned long vme_address, unsigned long local_address, unsigned long length){ return cfgUniversePort(1,port,address_space,vme_address,local_address,length);}
return cfgUniversePort(0,port,address_space,vme_address,local_address,length);
DFLT_BASE; return cfgUniversePort(base,0,port,address_space,vme_address,local_address,length);
vmeUniverseSlavePortCfg( unsigned long port, unsigned long address_space, unsigned long vme_address, unsigned long local_address, unsigned long length){ return cfgUniversePort(0,port,address_space,vme_address,local_address,length);}
if ((rval=vmeUniverseFindPciBase(0,&vmeUniverse0BaseAddr))) {
if ( (rval=vmeUniverseFindPciBase(0,&vmeUniverse0BaseAddr)) < 0 ) {
vmeUniverseInit(void){int rval; if ((rval=vmeUniverseFindPciBase(0,&vmeUniverse0BaseAddr))) { uprintf(stderr,"unable to find the universe in pci config space\n"); } else { uprintf(stderr,"Universe II PCI-VME bridge detected at 0x%08x, IRQ %d\n", (unsigned int)vmeUniverse0BaseAddr, vmeUniverse0PciIrqLine); } return rval;}
vmeUniverse0PciIrqLine = rval; rval = 0;
vmeUniverseInit(void){int rval; if ((rval=vmeUniverseFindPciBase(0,&vmeUniverse0BaseAddr))) { uprintf(stderr,"unable to find the universe in pci config space\n"); } else { uprintf(stderr,"Universe II PCI-VME bridge detected at 0x%08x, IRQ %d\n", (unsigned int)vmeUniverse0BaseAddr, vmeUniverse0PciIrqLine); } return rval;}
mapOverAll(1,disableUniversePort,0);
DFLT_BASE; mapOverAll(base,1,disableUniversePort,0);
vmeUniverseDisableAllMasters(void){ mapOverAll(1,disableUniversePort,0);}
showUniversePorts(0,f);
DFLT_BASE; showUniversePorts(base,0,f);
vmeUniverseSlavePortsShow(FILE *f){ showUniversePorts(0,f);}
showUniversePorts(1,f);
DFLT_BASE; showUniversePorts(base,1,f);
vmeUniverseMasterPortsShow(FILE *f){ showUniversePorts(1,f);}
if (x && isclone(x)) x = forcecopy(x); ep->value = (flag == COPY_VAL)? gclone(x): x;
ep->value = (flag == COPY_VAL)? gclone(x): (x && isclone(x))? forcecopy(x): x;
new_val_cell(entree *ep, GEN x, char flag){ var_cell *v = (var_cell*) gpmalloc(sizeof(var_cell)); v->value = (GEN)ep->value; v->prev = (var_cell*) ep->args; v->flag = flag; /* beware: f(p) = Nv = 0 * Nv = p; f(Nv) --> this call would destroy p [ isclone ] */ if (x && isclone(x)) x = forcecopy(x); ep->value = (flag == COPY_VAL)? gclone(x): x; /* Do this last. In case the clone is <C-C>'ed before completion ! */ ep->args = (void*) v;}
init_graph()
init_graph(void)
init_graph(){ int n; rectgraph = (PariRect**) gpmalloc(sizeof(PariRect*)*NUMRECT); for (n=0; n<NUMRECT; n++) { PariRect *e = (PariRect*) gpmalloc(sizeof(PariRect)); e->head = e->tail = NULL; e->sizex = e->sizey = 0; current_color[n] = DEFAULT_COLOR; rectgraph[n] = e; }}
P[i]=cmpii((GEN)T[i],mod2)<0?licopy((GEN)T[i]):lsubii((GEN)T[i],mod);
P[i]=cmpii((GEN)T[i],mod2)<=0?licopy((GEN)T[i]):lsubii((GEN)T[i],mod);
FpX_center(GEN T,GEN mod){/*OK centermod exists, but is not so clean*/ pari_sp av; long i, l=lg(T); GEN P,mod2; P=cgetg(l,t_POL); P[1]=T[1]; av=avma; mod2=gclone(shifti(mod,-1));/*clone*/ avma=av; for(i=2;i<l;i++) P[i]=cmpii((GEN)T[i],mod2)<0?licopy((GEN)T[i]):lsubii((GEN)T[i],mod); gunclone(mod2);/*unclone*/ return P;}
return gerepileupto(ltop,gcopy(res));
return gerepilecopy(ltop,res);
Fp_factor_irred(GEN P,GEN l, GEN Q){ ulong ltop=avma,av; GEN SP,SQ,MP,MQ,M,MF,E,V,IR,res; long np=degpol(P),nq=degpol(Q); long i,d=cgcd(np,nq); long vp=varn(P),vq=varn(Q); if (d==1) { res=cgetg(2,t_COL); res[1]=lcopy(P); return res; } MF=matrixpow(nq,nq,FpXQ_pow(polx[vq],l,Q,l),Q,l); Fp_intersect(d,P,Q,l,&SP,&SQ,NULL,MF); av=avma; E=Fp_factorgalois(P,l,d,vq); E=polpol_to_mat(E,np); MP = matrixpow(np,d,SP,P,l); IR = (GEN)FpM_sindexrank(MP,l)[1]; E = rowextract_p(E, IR); M = rowextract_p(MP,IR); M = FpM_inv(M,l); MQ = matrixpow(nq,d,SQ,Q,l); M = FpM_mul(MQ,M,l); M = FpM_mul(M,E,l); M = gerepileupto(av,M); V = cgetg(d+1,t_VEC); V[1]=(long)M; for(i=2;i<=d;i++) V[i]=(long)FpM_mul(MF,(GEN)V[i-1],l); res=cgetg(d+1,t_COL); for(i=1;i<=d;i++) res[i]=(long)mat_to_polpol((GEN)V[i],vp,vq); return gerepileupto(ltop,gcopy(res));}
m = *++p1, j = BITS_IN_LONG;
m = *++p1; j = BITS_IN_LONG;
u_FpXQ_pow(GEN x, GEN n, GEN pol, ulong p){ ulong av = avma; GEN p1 = n+2, y = x; long m,i,j; m = *p1; j = 1+bfffo(m); m <<= j; j = BITS_IN_LONG-j; for (i=lgefint(n)-2;;) { for (; j; m<<=1,j--) { y = u_FpXQ_sqr(y,pol,p); if (m<0) y = u_FpXQ_mul(y,x,pol,p); } if (--i == 0) break; m = *++p1, j = BITS_IN_LONG; } return gerepileupto(av, y);}
y=x; j=1+bfffo(m); m<<=j; j = BITS_IN_LONG-j;
y=x; j=1+bfffo((ulong)m); m<<=j; j = BITS_IN_LONG-j;
powgi(GEN x, GEN n){ long i,j,m,tx, sn=signe(n); ulong lim,av; GEN y, p1; if (typ(n) != t_INT) err(talker,"not an integral exponent in powgi"); if (!sn) return puiss0(x); switch(tx=typ(x)) {/* catch some types here, instead of trying gpowgs() first, because of * the simpler call interface to puissii() and powmodulo() -- even though * for integer/rational bases other than 0,+-1 and non-wordsized * exponents the result will be certain to overflow. --GN */ case t_INT: { long sx=signe(x), sr = (sx<0 && mod2(n))? -1: 1; if (sn>0) return puissii(x,n,sr); if (!sx) err(talker, "division by zero in powgi"); if (is_pm1(x)) return (sr < 0)? icopy(x): gun; /* n<0, |x|>1 */ y=cgetg(3,t_FRAC); setsigne(n,1); /* temporarily replace n by abs(n) */ y[1]=(sr>0)? un: lnegi(gun); y[2]=(long)puissii(x,n,1); setsigne(n,-1); return y; } case t_INTMOD: y=cgetg(3,tx); copyifstack(x[1],y[1]); y[2]=(long)powmodulo((GEN)x[2],n,(GEN)x[1]); return y; case t_FRAC: case t_FRACN: { GEN a = (GEN)x[1], b = (GEN)x[2]; long sr = (mod2(n) && (signe(a)!=signe(b))) ? -1 : 1; if (sn > 0) { if (!signe(a)) return gzero; } else { /* n < 0 */ if (!signe(a)) err(talker, "division by zero fraction in powgi"); /* +-1/b inverts to an integer */ if (is_pm1(a)) return puissii(b,n,sr); y = b; b = a; a = y; } /* HACK: puissii disregards the sign of n */ y = cgetg(3,tx); y[1] = (long)puissii(a,n,sr); y[2] = (long)puissii(b,n,1); return y; } case t_PADIC: { long e = itos(n)*valp(x); GEN mod, p = (GEN)x[2]; if (!signe(x[4])) { if (sn < 0) err(talker, "division by 0 p-adic in powgi"); return padiczero(p, e); } y = cgetg(5,t_PADIC); mod = (GEN)x[3]; i = ggval(n, p); if (i == 0) mod = icopy(mod); else { mod = mulii(mod, gpowgs(p,i)); mod = gerepileuptoint((long)y, mod); } y[1] = evalprecp(precp(x)+i) | evalvalp(e); icopyifstack(p, y[2]); y[3] = (long)mod; y[4] = (long)powmodulo((GEN)x[4], n, mod); return y; } case t_QFR: if (signe(x[4])) return powrealform(x,n); case t_POL: if (ismonome(x)) return pow_monome(x,n); default: av=avma; lim=stack_lim(av,1); p1 = n+2; m = *p1; y=x; j=1+bfffo(m); m<<=j; j = BITS_IN_LONG-j; for (i=lgefint(n)-2;;) { for (; j; m<<=1,j--) { y=gsqr(y); if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[1]: powgi"); y = gerepileupto(av, y); } if (m<0) y=gmul(y,x); if (low_stack(lim, stack_lim(av,1))) { if(DEBUGMEM>1) err(warnmem,"[2]: powgi"); y = gerepileupto(av, y); } } if (--i == 0) break; m = *++p1; j = BITS_IN_LONG; } if (sn < 0) y = ginv(y); return av==avma? gcopy(y): gerepileupto(av,y); }}
_u_Fp_addmul_OK(GEN b, long k, long i, ulong m, ulong p)
_u_Fp_addmul_OK(ulong *b, long k, long i, ulong m, ulong p)
_u_Fp_addmul_OK(GEN b, long k, long i, ulong m, ulong p){ b[k] += m * b[i]; if (b[k] & MASK) b[k] %= p;}
else return gerepile(av0,tetpil,FlxX_ZXX(z));
else return gerepile(av0,tetpil,z);
FpXQX_divrem(GEN x, GEN y, GEN T, GEN p, GEN *pr){ long vx, dx, dy, dz, i, j, sx, lrem; pari_sp av0, av, tetpil; GEN z,p1,rem,lead; if (!p) return poldivrem(x,y,pr); if (!T) return FpX_divrem(x,y,p,pr); if (!signe(y)) err(gdiver); vx=varn(x); dy=degpol(y); dx=degpol(x); if (dx < dy) { if (pr) { av0 = avma; x = FpXQX_red(x, T, p); if (pr == ONLY_DIVIDES) { avma=av0; return signe(x)? NULL: zeropol(vx); } if (pr == ONLY_REM) return x; *pr = x; } return zeropol(vx); } lead = leading_term(y); if (!dy) /* y is constant */ { if (pr && pr != ONLY_DIVIDES) { if (pr == ONLY_REM) return zeropol(vx); *pr = zeropol(vx); } av0 = avma; x = FpXQX_normalize(x, T,p); tetpil = avma; return gerepile(av0,tetpil,FpXQX_red(x,T,p)); } av0 = avma; dz = dx-dy; if (OK_ULONG(p)) { /* assume ab != 0 mod p */ { GEN *gptr[2]; ulong pp = (ulong)p[2]; long v = varn(T); GEN a = ZXX_FlxX(x, pp, v); GEN b = ZXX_FlxX(y, pp, v); GEN t = ZX_Flx(T, pp); z = FlxqX_divrem(a,b,t,pp,pr); tetpil=avma; if (pr && pr != ONLY_DIVIDES && pr != ONLY_REM) *pr = FlxX_ZXX(*pr); else return gerepile(av0,tetpil,FlxX_ZXX(z)); gptr[0]=pr; gptr[1]=&z; gerepilemanysp(av0,tetpil,gptr,2); return z; } } lead = gcmp1(lead)? NULL: gclone(Fq_inv(lead,T,p)); avma = av0; z = cgetg(dz+3,t_POL); z[1] = x[1]; x += 2; y += 2; z += 2; p1 = (GEN)x[dx]; av = avma; z[dz] = lead? lpileupto(av, Fq_mul(p1,lead, T, p)): lcopy(p1); for (i=dx-1; i>=dy; i--) { av=avma; p1=(GEN)x[i]; for (j=i-dy+1; j<=i && j<=dz; j++) p1 = Fq_sub(p1, Fq_mul((GEN)z[j],(GEN)y[i-j],NULL,p),NULL,p); if (lead) p1 = Fq_mul(p1, lead, NULL,p); tetpil=avma; z[i-dy] = lpile(av,tetpil,Fq_red(p1,T,p)); } if (!pr) { if (lead) gunclone(lead); return z-2; } rem = (GEN)avma; av = (pari_sp)new_chunk(dx+3); for (sx=0; ; i--) { p1 = (GEN)x[i]; for (j=0; j<=i && j<=dz; j++) p1 = Fq_sub(p1, Fq_mul((GEN)z[j],(GEN)y[i-j],NULL,p),NULL,p); tetpil=avma; p1 = Fq_red(p1, T, p); if (signe(p1)) { sx = 1; break; } if (!i) break; avma=av; } if (pr == ONLY_DIVIDES) { if (lead) gunclone(lead); if (sx) { avma=av0; return NULL; } avma = (pari_sp)rem; return z-2; } lrem=i+3; rem -= lrem; rem[0] = evaltyp(t_POL) | evallg(lrem); rem[1] = z[-1]; p1 = gerepile((pari_sp)rem,tetpil,p1); rem += 2; rem[i]=(long)p1; for (i--; i>=0; i--) { av=avma; p1 = (GEN)x[i]; for (j=0; j<=i && j<=dz; j++) p1 = Fq_sub(p1, Fq_mul((GEN)z[j],(GEN)y[i-j], NULL,p), NULL,p); tetpil=avma; rem[i]=lpile(av,tetpil, Fq_red(p1, T, p)); } rem -= 2; if (lead) gunclone(lead); if (!sx) (void)FpXQX_renormalize(rem, lrem); if (pr == ONLY_REM) return gerepileupto(av0,rem); *pr = rem; return z-2;}
GEN g = mppgcd(lead,p);
GEN g = gcdii(lead,p);
FpX_gcd_check(GEN x, GEN y, GEN p){ GEN a,b,c; pari_sp av=avma; a = FpX_red(x, p); b = FpX_red(y, p); while (signe(b)) { GEN lead = leading_term(b); GEN g = mppgcd(lead,p); if (!is_pm1(g)) return gerepileupto(av,g); c = FpX_rem(a,b,p); a=b; b=c; } avma = av; return gun;}
unsigned8 *buffer; unsigned32 maximum; unsigned32 count = 0;
uint8_t *buffer; uint32_t maximum; uint32_t count = 0;
rtems_device_driver console_read( rtems_device_major_number major, rtems_device_minor_number minor, void * arg){ rtems_libio_rw_args_t *rw_args; unsigned8 *buffer; unsigned32 maximum; unsigned32 count = 0; rw_args = (rtems_libio_rw_args_t *) arg; buffer = rw_args->buffer; maximum = rw_args->count; for (count = 0; count < maximum; count++) { buffer[ count ] = inbyte(minor); if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { buffer[ count++ ] = '\n'; buffer[ count ] = 0; outbyte( minor, '\n' ); /* newline */ break; } else if (buffer[ count ] == '\b' && count > 0 ) { outbyte( minor, '\b' ); /* move back one space */ outbyte( minor, ' ' ); /* erase the character */ outbyte( minor, '\b' ); /* move back one space */ count-=2; } else outbyte( minor, buffer[ count ] ); /* echo the character */ } rw_args->bytes_moved = count; return (count > 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED;}
long i, lx;
long i, j, lx, hx;
centermod_i(GEN x, GEN p, GEN ps2){ long i, lx; gpmem_t av; GEN y,p1; if (!ps2) ps2 = shifti(p,-1); switch(typ(x)) { case t_INT: y=modii(x,p); if (cmpii(y,ps2)>0) return subii(y,p); return y; case t_POL: lx=lgef(x); y=cgetg(lx,t_POL); y[1]=x[1]; for (i=2; i<lx; i++) { av=avma; p1=modii((GEN)x[i],p); if (cmpii(p1,ps2)>0) p1=subii(p1,p); y[i]=lpileupto(av,p1); } return normalizepol_i(y, lx); case t_COL: lx=lg(x); y=cgetg(lx,t_COL); for (i=1; i<lx; i++) { p1=modii((GEN)x[i],p); if (cmpii(p1,ps2)>0) p1=subii(p1,p); y[i]=(long)p1; } return y; } return x;}
case t_MAT: lx=lg(x); y=cgetg(lx,t_MAT); if (lx == 1) return y; hx = lg(x[1]); for (j=1; j<lx; j++) { GEN cx = (GEN)x[j], cy = cgetg(hx,t_COL); y[j] = (long)cy; for (i=1; i<hx; i++) { p1=modii((GEN)cx[i], p); if (cmpii(p1,ps2)>0) p1=subii(p1,p); cy[i]=(long)p1; } } return y;
centermod_i(GEN x, GEN p, GEN ps2){ long i, lx; gpmem_t av; GEN y,p1; if (!ps2) ps2 = shifti(p,-1); switch(typ(x)) { case t_INT: y=modii(x,p); if (cmpii(y,ps2)>0) return subii(y,p); return y; case t_POL: lx=lgef(x); y=cgetg(lx,t_POL); y[1]=x[1]; for (i=2; i<lx; i++) { av=avma; p1=modii((GEN)x[i],p); if (cmpii(p1,ps2)>0) p1=subii(p1,p); y[i]=lpileupto(av,p1); } return normalizepol_i(y, lx); case t_COL: lx=lg(x); y=cgetg(lx,t_COL); for (i=1; i<lx; i++) { p1=modii((GEN)x[i],p); if (cmpii(p1,ps2)>0) p1=subii(p1,p); y[i]=(long)p1; } return y; } return x;}
x = (int)x; while (x>1) { ft *= x; x--; }
x = floor(x); while (x>1) { ft *= x; x--; }
fact(double x){ double ft = 1.0; x = (int)x; while (x>1) { ft *= x; x--; } return ft ;}
PARI_get_psplot()
PARI_get_psplot(void)
PARI_get_psplot(){ pari_psplot.height = JSCR - 60; pari_psplot.width = ISCR - 40; pari_psplot.fheight = 15; pari_psplot.fwidth = 6; pari_psplot.hunit = 5; pari_psplot.vunit = 5;}
return POSIX_NOT_IMPLEMENTED();
return 0;
int sigaction( int sig, const struct sigaction *act, struct sigaction *oact){ if ( !act ) set_errno_and_return_minus_one( EFAULT ); if ( !is_valid_signo(sig) ) set_errno_and_return_minus_one( EINVAL ); if ( oact ) *oact = _POSIX_signals_Vectors[ sig ]; /* XXX need to interpret some stuff here */ /* XXX some signals cannot be ignored */ _POSIX_signals_Vectors[ sig ] = *act; return POSIX_NOT_IMPLEMENTED();}
_Thread_Enable_dispatch();
int pthread_setspecific( pthread_key_t key, const void *value){ register POSIX_Keys_Control *the_key; unsigned32 index; unsigned32 class; Objects_Locations location; the_key = _POSIX_Keys_Get( key, &location ); switch ( location ) { case OBJECTS_ERROR: return EINVAL; case OBJECTS_REMOTE: return EINVAL; /* should never happen */ case OBJECTS_LOCAL: index = _Objects_Get_index( _Thread_Executing->Object.id ); class = _Objects_Get_class( _Thread_Executing->Object.id ); the_key->Values[ class ][ index ] = (void *) value; return 0; } return POSIX_BOTTOM_REACHED();}
_Thread_Enable_dispatch();
int pthread_key_delete( pthread_key_t key){ register POSIX_Keys_Control *the_key; Objects_Locations location; unsigned32 the_class; the_key = _POSIX_Keys_Get( key, &location ); switch ( location ) { case OBJECTS_ERROR: return EINVAL; case OBJECTS_REMOTE: return 0; /* should never happen */ case OBJECTS_LOCAL: _Objects_Close( &_POSIX_Keys_Information, &the_key->Object ); the_key->is_active = FALSE; for ( the_class = OBJECTS_CLASSES_FIRST_THREAD_CLASS; the_class <= OBJECTS_CLASSES_LAST_THREAD_CLASS; the_class++ ) _Workspace_Free( the_key->Values[ the_class ] ); /* * NOTE: The destructor is not called and it is the responsibility * of the application to free the memory. */ _POSIX_Keys_Free( the_key ); return 0; } return POSIX_BOTTOM_REACHED();}