void metafont_start_output (string output_name, bzr_preamble_type pre, tfm_global_info_type info) { unsigned this_param; string current_time = now (); mf_filename = make_output_filename (output_name, "mf"); mf_file = xfopen (mf_filename, "w"); /* Output some identification. */ OUT1 ("%% This file defines the Metafont font %s.\n", mf_filename); OUT1 ("%% {%s}\n", BZR_COMMENT (pre)); OUT1 ("%% Generated %s.\n", current_time); OUT_LINE ("% This font is in the public domain."); /* Output the size that our original data is based on. The font can be generated at sizes different than this. */ OUT_PT_ASSIGNMENT ("true_design_size#", BZR_DESIGN_SIZE (pre)); /* Output the fontwide information given in INFO. */ OUT1 ("font_coding_scheme := \"%s\";\n", TFM_CODING_SCHEME (info)); /* The real work is done in an auxiliary file. */ OUT_STATEMENT ("input bzrsetup"); for (this_param = 1; this_param <= TFM_FONT_PARAMETER_COUNT (info); this_param++) OUT2 ("fontdimen %u: %.2fpt# * u#;\n", this_param, TFM_FONT_PARAMETER (info, this_param)); }
/* print out the current cost to the user */ void prnt_cost( char * out_string ) { INT xspan ; INT yspan ; funccostG = findcost() ; OUT2("%s", out_string ) ; OUT2(" routing cost :%d\n", funccostG ) ; OUT2(" overlap penalty :%d\n", binpenalG); OUT2(" lapFactor * overlap :%d\n", penaltyG); OUT2(" timing penalty :%d\n", timingpenalG ); OUT2("+ timeFactor * timepen:%d\n", timingcostG ); OUT1("-------------------------------------\n" ) ; OUT2(" total cost :%d\n", (funccostG + penaltyG + timingcostG) ) ; wirecosts() ; find_core_boundary( &blocklG, &blockrG, &blockbG, &blocktG ) ; OUT5("\n\nCORE Bounding Box: l:%d r:%d b:%d t:%d\n", blocklG , blockrG , blockbG , blocktG ) ; xspan = blockrG - blocklG ; yspan = blocktG - blockbG ; OUT2( " xspan = %d\n", xspan ) ; OUT2( " yspan = %d\n", yspan ) ; OUT2( " core area = %4.2le\n\n", (DOUBLE) xspan * (DOUBLE) yspan ); OUT1("-------------------------------------\n" ) ; Ymessage_flush() ; }/* end print_current_cost */
int receive() { int flagid = 0; int master_receiver = is_receiver(&flagid); if (!master_receiver) exit(EXIT_SUCCESS); int semid = get_sems( FILE_NAME_SHMEM_ATTACH, 5); CHECK(semid != -1, "Failed to get semaphors id"); int cond = rcv_protect_connection(semid); CHECK(cond == 0, "Failed to set up protected connection"); int shmemid = 0; void* smbuf = get_memptr( FILE_NAME_SHMEM_ATTACH, BUF_SIZE + sizeof(long), &shmemid); CHECK(smbuf != (void*)-1, "Failed to get shared memory pointer"); struct sembuf activate = {RCV_CONNECT, -1, 0}; cond = semop(semid, &activate, 1); OUT("# Activated\n"); struct sembuf mutexes[3] = { {SND_MUTEX, -1, 0}, {RCV_MUTEX, 1, 0}, {RCV_MUTEX, 0, 0} }; long* nbytes_to_save = smbuf + BUF_SIZE; cond = semop(semid, &mutexes[2], 1); CHECK(cond == 0, "Failed to set semaphors"); while (*nbytes_to_save != -1) { OUT1("# Printing %ld bytes\n", *nbytes_to_save); cond = write(STDOUT_FILENO, smbuf, *nbytes_to_save); if (cond != *nbytes_to_save) fprintf(stderr, "Printed = %d\nExpected = %ld\n", cond, *nbytes_to_save); CHECK(cond == *nbytes_to_save, "Printed ammount of bytes isn't valid"); OUT("# Getting...\n"); cond = semop(semid, &mutexes[1], 1); cond = semop(semid, &mutexes[0], 1); OUT1("# Current SND_MUTEX is %d\n", semctl(semid, SND_MUTEX, GETVAL)); OUT1("# Current RCV_MUTEX is %d\n", semctl(semid, RCV_MUTEX, GETVAL)); cond = semop(semid, &mutexes[2], 1); OUT("# Got package\n"); CHECK(cond == 0, "Failed to set semaphors"); }; OUT("# Finishing receiving\n"); semop(semid, &mutexes[0], 1); unlink(RCV_FLAG); semctl(flagid, 0, IPC_RMID); exit(EXIT_SUCCESS); }
void MMSDWrite(hotCtx g) { int i; MMSDCtx h = g->ctx.MMSD; /* Write header */ OUT4(h->tbl.version); OUT2(h->tbl.flags); OUT2(h->tbl.axis); OUT2(h->tbl.instance); OUT2(h->tbl.style); /* Write axis table */ OUT2(h->tbl.axis_.nAxes); OUT2(h->tbl.axis_.axisSize); for (i = 0; i < h->tbl.axis_.nAxes; i++) { AxisRec *axis = &h->tbl.axis_.axis_[i]; OUT2(axis->longLabel); OUT2(axis->shortLabel); } if (h->tbl.instance != 0) { /* Write instance table */ OUT2(h->tbl.instance_.nInstances); OUT2(h->tbl.instance_.instanceSize); for (i = 0; i < h->tbl.instance_.nInstances; i++) { OUT2(h->tbl.instance_.instance_[i].nameSuffix); } } if (h->tbl.style != 0) { /* Write style table */ OUT2(h->tbl.style_.nStyles); OUT2(h->tbl.style_.styleSize); for (i = 0; i < h->tbl.style_.nStyles; i++) { StyleRec *style = &h->tbl.style_.style_[i]; OUT1(style->axis); OUT1(style->flags); OUT4(style->action[0].point); OUT4(style->action[0].delta); OUT4(style->action[1].point); OUT4(style->action[1].delta); } } /* Write string table */ for (i = 0; i < h->tbl.axis_.nAxes; i++) { AxisRec *axis = &h->tbl.axis_.axis_[i]; hotWritePString(g, axis->longLabel_); hotWritePString(g, axis->shortLabel_); } if (h->tbl.instance != 0) { for (i = 0; i < h->tbl.instance_.nInstances; i++) { hotWritePString(g, h->tbl.instance_.instance_[i].nameSuffix_); } } }
/* Write encodings */ void encodingWrite(tcCtx g) { encodingCtx h = g->ctx.encoding; int i; /* Write non-standard encodings */ for (i = 0; i < h->encodings.cnt; i++) { int j; Encoding *encoding = &h->encodings.array[i]; OUT1(encoding->format); switch (encoding->format & 0x7f) { case 0: /* Write format 0 */ OUT1(encoding->nCodes); for (j = 0; j < encoding->nCodes; j++) OUT1(encoding->code[j]); break; case 1: { /* Write format 1 */ unsigned nLeft = 0; OUT1(encoding->nRanges); OUT1(encoding->code[0]); for (j = 1; j < encoding->nCodes; j++) if (encoding->code[j - 1] + 1 != encoding->code[j] || nLeft == 255) { OUT1(nLeft); OUT1(encoding->code[j]); nLeft = 0; } else nLeft++; OUT1(nLeft); } break; } if (encoding->format & 0x80) { OUT1(encoding->nSups); for (j = 0; j < encoding->nSups; j++) { CodeMap *supplement = &encoding->supplement[j]; OUT1(supplement->code); OUT2(supplement->sid); } } } reuseInit(g, h); }
/****************************************************************************** * DXF output function. */ int output_dxf12_writer(FILE* dxf_file, gchar* name, int llx, int lly, int urx, int ury, at_output_opts_type * opts, spline_list_array_type shape, at_msg_func msg_func, gpointer msg_data, gpointer user_data) { OUT_LINE (" 0"); OUT_LINE ("SECTION"); OUT_LINE (" 2"); OUT_LINE ("HEADER"); OUT_LINE (" 9"); OUT_LINE ("$ACADVER"); OUT_LINE (" 1"); OUT_LINE ("AC1009"); OUT_LINE (" 9"); OUT_LINE ("$EXTMIN"); OUT_LINE (" 10"); OUT1 (" %f\n", (double)llx); OUT_LINE (" 20"); OUT1 (" %f\n", (double)lly); OUT_LINE (" 30"); OUT_LINE (" 0.000000"); OUT_LINE (" 9"); OUT_LINE ("$EXTMAX"); OUT_LINE (" 10"); OUT1 (" %f\n", (double)urx); OUT_LINE (" 20"); OUT1 (" %f\n", (double)ury); OUT_LINE (" 30"); OUT_LINE (" 0.000000"); OUT_LINE (" 0"); OUT_LINE ("ENDSEC"); output_layer(dxf_file, shape); OUT_LINE (" 0"); OUT_LINE ("SECTION"); OUT_LINE (" 2"); OUT_LINE ("ENTITIES"); out_splines(dxf_file, shape); OUT_LINE (" 0"); OUT_LINE ("ENDSEC"); OUT_LINE (" 0"); OUT_LINE ("EOF"); return 0; }
static int output_epd_header(FILE* epd_file, gchar* name, int llx, int lly, int urx, int ury) { gchar* time; OUT_LINE ("%EPD-1.0"); OUT1 ("%% Created by %s\n", at_version(TRUE)); OUT1 ("%% Title: %s\n", name); OUT1 ("%% CreationDate: %s\n", time = at_time_string ()); OUT4 ("%%BBox(%d,%d,%d,%d)\n", llx, lly, urx, ury); g_free (time); return 0; }
/* * ��גמה םא ךנאם םאסענמיךט "����������� ����������� �������" */ void print_level3_tuning_heat_long(void){ unsigned char temp[LEN]; ClearDisplay(); OUT1(prod_nagrev); itoa(tuned_heat_long, temp); OUT2_mod(temp); }
/* * ��גמה םא ךנאם םאסענמיךט "����������� ����������� �������" */ void print_level3_tuning_heat_transv(void){ unsigned char temp[LEN]; ClearDisplay(); OUT1(pop_nagrev); itoa(tuned_heat_transv, temp); OUT2_mod(temp); }
int snd_protect_connection(int semid) { struct sembuf snd_ifdie = { SND_DIED, 1, SEM_UNDO}; struct sembuf rcv_ifdie = { RCV_DIED, 1, 0}; struct sembuf rcv_connect = { RCV_CONNECT, 1, 0}; int cond = semop(semid, &snd_ifdie, 1); CHECK(cond == 0, "Failed to set SND_IFDIE semaphor"); cond = semop(semid, &rcv_ifdie, 1); CHECK(cond == 0, "Failed to set RCV_IFDIE semaphor"); pthread_t wait_for_rcv_death; struct Wait_for* rcv = calloc(1, sizeof(struct Wait_for)); assert(rcv); rcv -> semid = semid; rcv -> num = RCV_DIED; rcv -> msg = "\n# Receiver died\n"; OUT1("Thrown %p\n", rcv); cond = pthread_create( &wait_for_rcv_death, NULL, kill_if_died, (void*)(rcv)); CHECK(cond == 0, "Failed to create waiting thread"); cond = semop(semid, &rcv_connect, 1); CHECK(cond == 0, "Failed to set connection semaphor"); return 0; }
/* * ��גמה םא ךנאם םאסענמיךט "���������� �������" */ void print_level3_tuning_packages(void){ unsigned char temp[LEN]; ClearDisplay(); OUT1(kolvo_pkts); itoa(tuned_packages, temp); OUT2_mod(temp); }
/************************************************************** Инициализация дисплея void InitDisplay(void) ***************************************************************/ void InitDisplay(void) { InitDataPortsOut(); RES_out; E_WR_out; K_out; RES_0; RD_WR_out; K_0; FunctionSet(1,1,0); ClearDisplay(); EntryModeSet(1,0); DisplayONOFControlBit(1,0,0); ClearDisplay(); CursorOrDisplayShift(0,1); OUT1("ПРОШИВКА"); OUT2("ЗАПУЩЕНА..."); /* SetDDRAMAddress(0x00);//В начало первой строки WriteDataToRam('0'); WriteDataToRam('1'); WriteDataToRam('2'); WriteDataToRam('3'); WriteDataToRam('4'); WriteDataToRam('5'); WriteDataToRam('6'); WriteDataToRam('7'); WriteDataToRam('8'); WriteDataToRam('9'); WriteDataToRam('A'); WriteDataToRam('B'); WriteDataToRam('C'); WriteDataToRam('D'); WriteDataToRam('E'); WriteDataToRam('F'); SetDDRAMAddress(0x40);//В начало второй строки WriteDataToRam('0'); WriteDataToRam('1'); WriteDataToRam('2'); WriteDataToRam('3'); WriteDataToRam('4'); WriteDataToRam('5'); WriteDataToRam('6'); WriteDataToRam('7'); WriteDataToRam('8'); WriteDataToRam('9'); WriteDataToRam('A'); WriteDataToRam('B'); WriteDataToRam('C'); WriteDataToRam('D'); WriteDataToRam('E'); WriteDataToRam('F');*/ }
/* * ��גמה םא ךנאם ןונגמדמ ןףםךעא לום */ void print_level3_menu() { ClearDisplay(); OUT1( blokirovka ); if ( settingsState.stateword.a0 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } }
void wilson_dslash_spproj(double *out0, double *out1, double *out2, double *out3, double *inf, double sign) { int c; for(c=0;c<3;c++){ /* spin project with [1 + sign * gamma_0] */ OUT0(0,c,0) = INF(0,c,0) + sign * ( -INF(1,c,3) ); OUT0(1,c,0) = INF(1,c,0) + sign * ( INF(0,c,3) ); OUT0(0,c,1) = INF(0,c,1) + sign * ( -INF(1,c,2) ); OUT0(1,c,1) = INF(1,c,1) + sign * ( INF(0,c,2) ); /* spin project with [1 + sign * gamma_1] */ OUT1(0,c,0) = INF(0,c,0) + sign * ( -INF(0,c,3) ); OUT1(1,c,0) = INF(1,c,0) + sign * ( -INF(1,c,3) ); OUT1(0,c,1) = INF(0,c,1) + sign * ( INF(0,c,2) ); OUT1(1,c,1) = INF(1,c,1) + sign * ( INF(1,c,2) ); /* spin project with [1 + sign * gamma_2] */ OUT2(0,c,0) = INF(0,c,0) + sign * ( -INF(1,c,2) ); OUT2(1,c,0) = INF(1,c,0) + sign * ( INF(0,c,2) ); OUT2(0,c,1) = INF(0,c,1) + sign * ( INF(1,c,3) ); OUT2(1,c,1) = INF(1,c,1) + sign * ( -INF(0,c,3) ); /* spin project with [1 + sign * gamma_3] */ OUT3(0,c,0) = INF(0,c,0) + sign * ( INF(0,c,2) ); OUT3(1,c,0) = INF(1,c,0) + sign * ( INF(1,c,2) ); OUT3(0,c,1) = INF(0,c,1) + sign * ( INF(0,c,3) ); OUT3(1,c,1) = INF(1,c,1) + sign * ( INF(1,c,3) ); } }
void* kill_if_died(void* ptr) { struct Wait_for* waiting_sem = (struct Wait_for*)ptr; // printf("Caught %p\n", ptr); assert(waiting_sem); int semid = waiting_sem -> semid; // printf("Caught again%p\n", ptr); struct sembuf s = { waiting_sem -> num, 0, 0}; semop(semid, &s, 1); OUT1("%s\n", waiting_sem -> msg); last_cleaner(); exit(EXIT_FAILURE); }
void MX_GPIO_Init(void) { SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN | RCC_AHBENR_GPIOFEN); SET_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN); READ_BIT(RCC->AHBENR, 1); //Delay OUT1(OneWire_GPIO_Port, ePin::P0); OUT0(REL2_GPIO_Port, ePin::P0); OUT0(REL1_GPIO_Port, ePin::P1); OUT0(P_GPIO_Port, ePin::P6); /*Configure GPIO pin : OneWire_Pin */ //GPIOF->AFR[0] = GPIOF->AFR[1]=0; GPIOF->MODER = GPIO_MODER_MODER0_0; //00=Input, 01=Output, 10=AF, 11=Analog //GPIOF->OSPEEDR=GPIO_SPEED_LOW; GPIOF->OTYPER=GPIO_OTYPER_OT_0; //0=PuPu, 1=OpenDrain //GPIOF->PUPDR = GPIO_PUPDR_PUPDR0_0; //00=no, 01=Up, 10=downPullup wird zentral gemacht SYSCFG->EXTICR[0]=SYSCFG_EXTICR1_EXTI0_PF; EXTI->IMR=EXTI_IMR_MR0; EXTI->RTSR=EXTI_RTSR_TR0; EXTI->FTSR=EXTI_FTSR_TR0; /*Configure GPIO A*/ GPIOA->MODER= BMODE(REL2_Pin, ePinMode::OUT) | BMODE(REL1_Pin, ePinMode::OUT) | BMODE(ePin::P2, ePinMode::ALT) | BMODE(ePin::P3, ePinMode::ALT) | BMODE(IO1_Pin, ePinMode::OUT) | BMODE(I1_Pin, ePinMode::INP) | BMODE(P_Pin, ePinMode::OUT) | BMODE(I2_Pin, ePinMode::INP) | BMODE(ePin::P9, ePinMode::ALT) | BMODE(ePin::P10, ePinMode::ALT) | BMODE(ePin::P13, ePinMode::ALT) | BMODE(ePin::P14, ePinMode::ALT) ; GPIOA->PUPDR=0x24000000 | BPULL(I1_Pin, ePull::PULLUP) | BPULL(I2_Pin, ePull::PULLUP); GPIOB->MODER=BMODE(ePin::P1, ePinMode::INP); /* EXTI interrupt init*/ HAL_NVIC_SetPriority(EXTI0_1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(EXTI0_1_IRQn); }
void MPEGaudio::computebuffer(REAL *fraction,REAL buffer[2][CALCBUFFERSIZE]) { REAL p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,pa,pb,pc,pd,pe,pf; REAL q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,qa,qb,qc,qd,qe,qf; REAL *out1,*out2; out1=buffer[currentcalcbuffer]+calcbufferoffset; out2=buffer[currentcalcbuffer^1]+calcbufferoffset; #define OUT1(v,t) out1[(32-(v))*16] =(-(out1[(v)*16]=t)) #define OUT2(v) out2[(96-(v)-32)*16]=out2[((v)-32)*16] // compute new values via a fast cosine transform: { register REAL *x=fraction; p0=x[ 0]+x[31];p1=x[ 1]+x[30];p2=x[ 2]+x[29];p3=x[ 3]+x[28]; p4=x[ 4]+x[27];p5=x[ 5]+x[26];p6=x[ 6]+x[25];p7=x[ 7]+x[24]; p8=x[ 8]+x[23];p9=x[ 9]+x[22];pa=x[10]+x[21];pb=x[11]+x[20]; pc=x[12]+x[19];pd=x[13]+x[18];pe=x[14]+x[17];pf=x[15]+x[16]; } // q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); p0=q0+q1;p1=hcos_4*(q0-q1);p2=q2+q3;p3=hcos_4*(q2-q3); p4=q4+q5;p5=hcos_4*(q4-q5);p6=q6+q7;p7=hcos_4*(q6-q7); p8=q8+q9;p9=hcos_4*(q8-q9);pa=qa+qb;pb=hcos_4*(qa-qb); pc=qc+qd;pd=hcos_4*(qc-qd);pe=qe+qf;pf=hcos_4*(qe-qf); // { register REAL tmp; tmp=p6+p7; OUT2(36)=-(p5+tmp); OUT2(44)=-(p4+tmp); tmp=pb+pf; OUT1(10,tmp); OUT1(6,pd+tmp); tmp=pe+pf; OUT2(46)=-(p8+pc+tmp); OUT2(34)=-(p9+pd+tmp); tmp+=pa+pb; OUT2(38)=-(pd+tmp); OUT2(42)=-(pc+tmp); OUT1(2,p9+pd+pf); OUT1(4,p5+p7); OUT2(48)=-p0; out2[0]=-(out1[0]=p1); OUT1( 8,p3); OUT1(12,p7); OUT1(14,pf); OUT2(40)=-(p2+p3); } { register REAL *x=fraction; p0=hcos_64[ 0]*(x[ 0]-x[31]);p1=hcos_64[ 1]*(x[ 1]-x[30]); p2=hcos_64[ 2]*(x[ 2]-x[29]);p3=hcos_64[ 3]*(x[ 3]-x[28]); p4=hcos_64[ 4]*(x[ 4]-x[27]);p5=hcos_64[ 5]*(x[ 5]-x[26]); p6=hcos_64[ 6]*(x[ 6]-x[25]);p7=hcos_64[ 7]*(x[ 7]-x[24]); p8=hcos_64[ 8]*(x[ 8]-x[23]);p9=hcos_64[ 9]*(x[ 9]-x[22]); pa=hcos_64[10]*(x[10]-x[21]);pb=hcos_64[11]*(x[11]-x[20]); pc=hcos_64[12]*(x[12]-x[19]);pd=hcos_64[13]*(x[13]-x[18]); pe=hcos_64[14]*(x[14]-x[17]);pf=hcos_64[15]*(x[15]-x[16]); } q0=p0+pf;q1=p1+pe;q2=p2+pd;q3=p3+pc; q4=p4+pb;q5=p5+pa;q6=p6+p9;q7=p7+p8; q8=hcos_32[0]*(p0-pf);q9=hcos_32[1]*(p1-pe); qa=hcos_32[2]*(p2-pd);qb=hcos_32[3]*(p3-pc); qc=hcos_32[4]*(p4-pb);qd=hcos_32[5]*(p5-pa); qe=hcos_32[6]*(p6-p9);qf=hcos_32[7]*(p7-p8); p0=q0+q7;p1=q1+q6;p2=q2+q5;p3=q3+q4; p4=hcos_16[0]*(q0-q7);p5=hcos_16[1]*(q1-q6); p6=hcos_16[2]*(q2-q5);p7=hcos_16[3]*(q3-q4); p8=q8+qf;p9=q9+qe;pa=qa+qd;pb=qb+qc; pc=hcos_16[0]*(q8-qf);pd=hcos_16[1]*(q9-qe); pe=hcos_16[2]*(qa-qd);pf=hcos_16[3]*(qb-qc); q0=p0+p3;q1=p1+p2;q2=hcos_8[0]*(p0-p3);q3=hcos_8[1]*(p1-p2); q4=p4+p7;q5=p5+p6;q6=hcos_8[0]*(p4-p7);q7=hcos_8[1]*(p5-p6); q8=p8+pb;q9=p9+pa;qa=hcos_8[0]*(p8-pb);qb=hcos_8[1]*(p9-pa); qc=pc+pf;qd=pd+pe;qe=hcos_8[0]*(pc-pf);qf=hcos_8[1]*(pd-pe); p0=q0+q1;p1=hcos_4*(q0-q1); p2=q2+q3;p3=hcos_4*(q2-q3); p4=q4+q5;p5=hcos_4*(q4-q5); p6=q6+q7;p7=hcos_4*(q6-q7); p8=q8+q9;p9=hcos_4*(q8-q9); pa=qa+qb;pb=hcos_4*(qa-qb); pc=qc+qd;pd=hcos_4*(qc-qd); pe=qe+qf;pf=hcos_4*(qe-qf); { REAL tmp; tmp=pd+pf; OUT1(5,p5+p7+pb+tmp); tmp+=p9; OUT1(1,p1+tmp); OUT2(33)=-(p1+pe+tmp); tmp+=p5+p7; OUT1(3,tmp); OUT2(35)=-(p6+pe+tmp); tmp=pa+pb+pc+pd+pe+pf; OUT2(39)=-(p2+p3+tmp-pc); OUT2(43)=-(p4+p6+p7+tmp-pd); OUT2(37)=-(p5+p6+p7+tmp-pc); OUT2(41)=-(p2+p3+tmp-pd); tmp=p8+pc+pe+pf; OUT2(47)=-(p0+tmp); OUT2(45)=-(p4+p6+p7+tmp); tmp=pb+pf; OUT1(11,p7+tmp); tmp+=p3; OUT1( 9,tmp); OUT1( 7,pd+tmp); OUT1(13,p7+pf); OUT1(15,pf); } }
/* perform a low temperature anneal on pins */ final_pin_place() { INT i ; /* counter */ INT attempts ; /* number of moves made */ INT nummoves ; /* number of moves to do on a cell */ INT selection ; /* select a cell with softpins */ INT nsoftpin_cells ; /* number of cells with softpins */ CELLBOXPTR acellptr; /* current cell with softpins */ /* don't perform if cost only is specified in input file */ /* scale data variable is necessary for recursive TimberWolfMC call */ if( /* cost_onlyG || */ scale_dataG > 1 ){ return ; } /* now check to see if we have any soft pins if not return */ if( (nsoftpin_cells = (int) softPinArrayG[HOWMANY] ) == 0 ){ return ; } /* make new site arrays for pins */ for( i = 1; i <= nsoftpin_cells; i++ ){ update_sites( softPinArrayG[i] ) ; } findcost() ; /* continue with a low Temp anneal */ TG = 10.0 ; attempts = 0 ; if( overpenalG ){ /* make pinFactor 1 order more important than wirelength */ pinFactorG = 10.0 * (DOUBLE) funccostG / (DOUBLE) overpenalG ; /* also set softPinArrayG to look at cells with overlap */ } else { /* otherwise use previous pinFactorG */ /* make 1 order more important */ pinFactorG *= 10.0 ; } while( attempts < attmaxG ) { /* to make pin moves more efficient, use softPinArrayG */ /* which keeps track of all softcells which have pins */ /* which can move. softPinArrayG[0] holds size of array */ selection = PICK_INT( 1, (int) softPinArrayG[HOWMANY] ); /* now get cellptr */ acellptr = softPinArrayG[selection] ; /* pick number of pins moves to be attempted */ /* PIN_MOVE is beginning of sequence. */ if( overpenalG && !(doPartitionG) ){ /* if a penalty exists do many moves */ nummoves = acellptr->numsoftpins ; } else { nummoves = 1 ; /* no penalty try to reduce wirelen */ } /* *********** NOW EVALUATE THE PROPOSED MOVE ********* */ /* now try softpin moves */ for( i=1; i<= nummoves; i++ ){ selectpin( acellptr ) ; } /* *********** END OF PROPOSED MOVE EVALUATION ********* */ attempts++ ; D( "finalpin", checkcost() ) ; /* if debug on check cost after each move */ } /* ****** END OF ANNEALING LOOP **************** */ /* verify incremental and current costs after each iteration */ D( "finalpin", checkcost() ) ; /* ----------------------------------------------------------------- now output statistics for this temperature. */ OUT1("\n\nPin place optimizer\n"); OUT1("\nI T funccost overpen x pinFact = overfill pinflips\n"); OUT2("%3d ",iterationG ); OUT2("%4.2le ",TG ); OUT2("%4.2le ",(DOUBLE) funccostG ); OUT2("%4.2le ",(DOUBLE) overpenalG ); OUT2("%4.2le ",(DOUBLE) pinFactorG ); OUT2("%4.2le ",(DOUBLE) overfillG ); OUT3("%3d/%3d\n\n",flippG,attpG ); FLUSHOUT() ; return ; } /* end final_pin_place */
/* Write CID font dicts */ static void writeCIDDicts(tcCtx g, Font *font) { OffSize offSize; unsigned count; Offset offset; int i; long sizeFDs; /* Only output fd's which contained a character. */ /* The FDSelect which is written syncs with this. See cidAddChars. */ count = 0; sizeFDs = 0; for (i = 0; i < font->fdCount; i++) { FDInfo *info = &font->fdInfo[i]; if (info->seenChar) { sizeFDs += info->FD.cnt; count++; } } /* Font dict index */ OUT2(count); offSize = INDEX_OFF_SIZE(sizeFDs); OUT1(offSize); offset = 1; OUTOFF(offSize, offset); for (i = 0; i < font->fdCount; i++) { FDInfo *info = &font->fdInfo[i]; if (info->seenChar) { offset += info->FD.cnt; OUTOFF(offSize, offset); } } for (i = 0; i < font->fdCount; i++) { FDInfo *info = &font->fdInfo[i]; if (info->seenChar) { OUTN(info->FD.cnt, info->FD.array); } } /* Private dicts */ for (i = 0; i < font->fdCount; i++) { FDInfo *info = &font->fdInfo[i]; if (info->seenChar) { OUTN(info->Private.cnt, info->Private.array); } } #if TC_SUBR_SUPPORT /* Subrs */ for (i = 0; i < font->fdCount; i++) { FDInfo *info = &font->fdInfo[i]; if (info->seenChar && info->size.Subrs != 0) { subrWriteLocal(g, &info->subrs); } } #endif /* TC_SUBR_SUPPORT */ #if 0 for (i = 0; i < font->fdCount; i++) { printf("--- FD/PD[%d]\n", i); dictDump(g, &font->fdInfo[i].FD); dictDump(g, &font->fdInfo[i].Private); } #endif }
/* Write font set file */ static void writeSet(tcCtx g) { tcprivCtx h = g->ctx.tcpriv; int i; int nSynthetics; Offset offset; struct { char header[1024]; char trailer[128]; } wrap; if (h->FontSet.name != NULL) { /* Create wrappers */ fillWrapHeader(g, wrap.header); fillWrapTrailer(g, wrap.trailer); h->FontSet.size += strlen(wrap.header) + strlen(wrap.trailer); } if (g->cb.cffSize != NULL) { /* Report FontSet size to client */ g->cb.cffSize(g->cb.ctx, h->FontSet.size, (g->status & TC_EURO_ADDED) != 0); } if (h->FontSet.name != NULL) { OUTN(strlen(wrap.header), wrap.header); } /* Write header */ OUT1(h->cffHdr.major); OUT1(h->cffHdr.minor); OUT1(h->cffHdr.hdrSize); OUT1(h->cffHdr.offSize); /* Write name index */ OUT2(h->nameHdr.count); OUT1(h->nameHdr.offSize); offset = 1; OUTOFF(h->nameHdr.offSize, offset); for (i = 0; i < h->set.cnt; i++) { offset += h->set.array[i].size.FontName; OUTOFF(h->nameHdr.offSize, offset); } for (i = 0; i < h->set.cnt; i++) { OUTN(h->set.array[i].size.FontName, h->set.array[i].FontName); } /* Write top dict index */ OUT2(h->dictHdr.count); OUT1(h->dictHdr.offSize); offset = 1; OUTOFF(h->dictHdr.offSize, offset); for (i = 0; i < h->set.cnt; i++) { offset += h->set.array[i].size.dict; OUTOFF(h->dictHdr.offSize, offset); } for (i = 0; i < h->set.cnt; i++) { OUTN(h->set.array[i].dict.cnt, h->set.array[i].dict.array); } #if 0 for (i = 0; i < h->set.cnt; i++) { dictDump(g, &h->set.array[i].dict); } #endif sindexWrite(g); /* Write string table */ subrWriteGlobal(g); /* Write global subrs */ /* Write charsets, encodings, and fdIndexes */ encodingWrite(g); charsetWrite(g); fdselectWrite(g); /* Write remainder of font data */ nSynthetics = 0; for (i = 0; i < h->set.cnt; i++) { Font *font = &h->set.array[i]; if (font->flags & FONT_SYNTHETIC) { nSynthetics++; } else if (font->flags & FONT_CHAMELEON) { OUTN(font->size.Private, font->chameleon.data); } else { DICT *Private = &font->Private; csWriteChars(g, font); /* Write CharsStrings */ if (font->flags & FONT_CID) { /* Write font and Private dict indexes */ writeCIDDicts(g, font); } else { /* Write Private dict */ OUTN(Private->cnt, Private->array); } #if TC_SUBR_SUPPORT subrWriteLocal(g, &font->subrs); /* Write Subrs */ #endif /* TC_SUBR_SUPPORT */ } } /* Write legal text */ if (h->copyright != NULL) { OUTN(strlen(h->copyright), h->copyright); } else if (g->flags & TC_NONOTICE && h->set.cnt > 1) { tcWarning(g, "no copyright notice specified"); } if (h->FontSet.name != NULL) { OUTN(strlen(wrap.trailer), wrap.trailer); } #if TC_STATISTICS if (g->stats.gather) { showStats(h); } else { fprintf(stderr, "Created: %s (fonts=%ld+%d=%ld, size=%ld, %ld/font)\n", (g->cb.cffId == NULL) ? "?" : g->cb.cffId(g->cb.ctx), h->set.cnt - nSynthetics, nSynthetics, h->set.cnt, h->FontSet.size, h->FontSet.size / h->set.cnt); } #endif /* TC_STATISTICS */ }
/****************************************************************************** * This function outputs a complete layer table for all 255 colors. */ void output_layer(FILE *dxf_file, spline_list_array_type shape) { int i, idx; char layerlist[256]; unsigned this_list; at_color last_color = {0,0,0}; memset(layerlist, 0, sizeof(layerlist)); for (this_list = 0; this_list < SPLINE_LIST_ARRAY_LENGTH (shape); this_list++) { spline_list_type list = SPLINE_LIST_ARRAY_ELT (shape, this_list); at_color curr_color = (list.clockwise && shape.background_color != NULL) ? *(shape.background_color) : list.color; if (&this_list == 0 || !at_color_equal(&curr_color, &last_color)) { if (!(curr_color.r==0 && curr_color.g==0 && curr_color.b==0) || !color_check) { idx = GetIndexByRGBValue(curr_color.r, curr_color.g, curr_color.b); layerlist[idx-1] = 1; last_color = curr_color; } } } OUT_LINE(" 0"); OUT_LINE("SECTION"); OUT_LINE(" 2"); OUT_LINE("TABLES"); OUT_LINE(" 0"); OUT_LINE("TABLE"); OUT_LINE(" 2"); OUT_LINE("LAYER"); OUT_LINE(" 70"); OUT_LINE(" 2048"); OUT_LINE(" 0"); OUT_LINE("LAYER"); OUT_LINE(" 2"); OUT_LINE("0"); OUT_LINE(" 70"); OUT_LINE(" 0"); OUT_LINE(" 62"); OUT_LINE(" 7"); OUT_LINE(" 6"); OUT_LINE("CONTINUOUS"); for (i=1; i<256; i++) { if (layerlist[i-1]) { OUT_LINE(" 0"); OUT_LINE("LAYER"); OUT_LINE(" 2"); OUT1 ("C%d\n", i); OUT_LINE(" 70"); OUT_LINE(" 64"); OUT_LINE(" 62"); OUT1 ("%d\n", i); OUT_LINE(" 6"); OUT_LINE("CONTINUOUS"); } } OUT_LINE(" 0"); OUT_LINE("ENDTAB"); OUT_LINE (" 0"); OUT_LINE ("ENDSEC"); }
void wirecosts() { NETBOXPTR dimptr ; PINBOXPTR pinptr ; INT limitNets, withPads , withOutPads ; INT x , y , xmin , xmax , ymin , ymax , net ; INT cell, celltype, bbox ; withPads = 0 ; withOutPads = 0 ; limitNets = 0 ; for( net = 1 ; net <= numnetsG ; net++ ) { dimptr = netarrayG[net] ; xmin = 0 ; xmax = 0 ; ymin = 0 ; ymax = 0 ; for( pinptr = dimptr->pins ;pinptr;pinptr = pinptr->next ) { cell = pinptr->cell ; celltype = cellarrayG[cell]->celltype ; if( celltype == PADCELLTYPE || celltype == PADGROUPTYPE ){ continue ; } xmin = xmax = pinptr->xpos ; ymin = ymax = pinptr->ypos ; pinptr = pinptr->next ; break ; } for( ; pinptr ; pinptr = pinptr->next ) { cell = pinptr->cell ; celltype = cellarrayG[cell]->celltype ; if( celltype == PADCELLTYPE || celltype == PADGROUPTYPE ){ continue ; } x = pinptr->xpos ; y = pinptr->ypos ; if( x < xmin ) { xmin = x ; } else if( x > xmax ) { xmax = x ; } if( y < ymin ) { ymin = y ; } else if( y > ymax ) { ymax = y ; } } withOutPads += (xmax - xmin) + (ymax - ymin) ; dimptr = netarrayG[net] ; pinptr = dimptr->pins ; xmin = 0 ; xmax = 0 ; ymin = 0 ; ymax = 0 ; if( pinptr ) { xmin = xmax = pinptr->xpos ; ymin = ymax = pinptr->ypos ; pinptr = pinptr->next ; } for( ; pinptr ; pinptr = pinptr->next ) { x = pinptr->xpos ; y = pinptr->ypos ; if( x < xmin ) { xmin = x ; } else if( x > xmax ) { xmax = x ; } if( y < ymin ) { ymin = y ; } else if( y > ymax ) { ymax = y ; } } withPads += bbox = (xmax - xmin) + (ymax - ymin) ; if(!(dimptr->skip)){ limitNets += bbox ; } } OUT1("Wirelength:\n") ; OUT2("\tAll nets :%d\n", withPads ) ; OUT2("\tLimited nets :%d\n", limitNets ) ; OUT2("\tAll nets without pads:%d\n", withOutPads ) ; return ; }
DOUBLE analyze() { INT **number , i , net , net1 , net2 , num , cell ; INT *count , different , cnum , c2num , *arraynet ; INT num_nets , tot_cels ; DOUBLE C , C1 , C2 , C3 , wireRatio ; PINBOXPTR pinptr ; INT comparex() ; DOUBLE weight_past_runs( /* wireRatio */ ) ; count = (INT *) Ysafe_malloc( (1 + numcellsG) * sizeof( INT ) ) ; number = (INT **) Ysafe_malloc( (1 + numnetsG) * sizeof( INT *) ) ; howmanyS = (INT *) Ysafe_malloc( (1 + numnetsG) * sizeof( INT ) ) ; arraynet = (INT *) Ysafe_malloc( (1 + numnetsG) * sizeof( INT ) ) ; for( net = 0 ; net <= numnetsG ; net++ ) { number[net] = (INT *) Ysafe_malloc( (1 + numcellsG) * sizeof(INT) ) ; } for( net = 1 ; net <= numnetsG ; net++ ) { for( cell = 0 ; cell <= numcellsG ; cell++ ) { count[cell] = 0 ; number[net][cell] = 0 ; } for( pinptr=netarrayG[net]->pins;pinptr; pinptr = pinptr->next ){ if( pinptr->cell <= numcellsG ) { count[pinptr->cell] = 1 ; } } /* * I would like to find the number of distinct nets */ for( cell = 1 ; cell <= numcellsG ; cell++ ) { if( count[cell] == 1 ) { number[net][ ++number[net][0] ] = cell ; } } } /* ********************************************************** */ num_nets = 0 ; tot_cels = 0 ; for( net1 = 1 ; net1 <= numnetsG ; net1++ ) { if( number[net1][0] <= 1 ) { continue ; } num_nets++ ; tot_cels += number[net1][0] ; } OUT1("\n\n*************************************\n"); OUT2("AVERAGE NUMBER OF CELLS PER NET: %f\n", ( (DOUBLE) tot_cels / (DOUBLE) num_nets ) ) ; OUT1("*************************************\n\n\n"); /* ********************************************************** */ for( net1 = 1 ; net1 <= numnetsG ; net1++ ) { if( number[net1][0] == 0 ) { howmanyS[net1] = 0 ; continue ; } if( number[net1][0] == 1 ) { number[net1][0] = 0 ; howmanyS[net1] = 0 ; continue ; } howmanyS[net1] = 1 ; for( net2 = net1 + 1 ; net2 <= numnetsG ; net2++ ) { if( number[net2][0] != number[net1][0] ) { continue ; } different = 0 ; for( i = 1 ; i <= numcellsG ; i++ ) { if( number[net2][i] != number[net1][i] ) { different = 1 ; break ; } } if( ! different ) { number[net2][0] = 0 ; howmanyS[net1]++ ; } } } arraynet[0] = 0 ; for( net = 1 ; net <= numnetsG ; net++ ) { if( howmanyS[net] <= 0 ) { continue ; } arraynet[ ++arraynet[0] ] = net ; } num = arraynet[0] ; arraynet[0] = arraynet[ arraynet[0] ] ; Yquicksort( (char *) arraynet , num , sizeof( INT ), comparex ) ; /* sorted: most occurrences first */ num = 0 ; cnum = 0 ; c2num = 0 ; for( net = 1 ; net <= numnetsG ; net++ ) { if( number[net][0] > 0 ) { cnum += number[net][0] - 1 ; c2num += number[net][0] ; num++ ; } } C = (DOUBLE) num / (DOUBLE) numcellsG ; C1 = (DOUBLE) cnum / (DOUBLE) num ; C2 = (DOUBLE) c2num / (DOUBLE) num ; C3 = (DOUBLE) cnum / (DOUBLE)(numcellsG - 1) ; OUT1("\n\n\n**********************************************\n\n"); OUT1("The average number of distinct nets per cell is\n"); OUT2("given by: %6.2f\n\n", C ); OUT1("The average number of cells per net is\n"); OUT2("given by: %6.2f\n\n", C2 ); OUT1("The average number of other cells per net is\n"); OUT2("given by: %6.2f\n\n", C1 ); OUT1("The ratio of total cells specified per net to\n"); OUT2("numcells is given by: %6.2f\n\n", C3 ); OUT1("The average number of cells connected to a cell is\n"); OUT2("given by: %6.2f\n\n", C * C1 ); OUT1("**********************************************\n\n\n"); wireRatio = EXPECTEDWIRERATIO ; OUT2("Expected Wire Reduction Relative to Random:%6.2f\n\n",wireRatio); FLUSHOUT(); wireRatio = weight_past_runs( wireRatio ) ; sprintf( YmsgG,"\n\nWire ratio updated to:%4.2f\n\n", wireRatio ) ; M( MSG, "analyze", YmsgG ) ; return( wireRatio ); }
/* * ��גמה םא ךנאם pos םמלונ ןףםךעא לום */ void print_level3_text_menu_by_position(unsigned char pos) { ClearDisplay(); switch (pos) { case 1: OUT1( blokirovka ); if ( settingsState.stateword.a0 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 2: OUT1( product ); if ( settingsState.stateword.a1 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 3: OUT1( sirena ); if ( settingsState.stateword.a2 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 4: OUT1( naladka ); if ( settingsState.stateword.a3 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 5: OUT1( dozator ); if ( settingsState.stateword.a4 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 6: OUT1( vverh ); if ( settingsState.stateword.a5 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 7: OUT1( vakuum ); if ( settingsState.stateword.a6 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 8: OUT1( obduv ); if ( settingsState.stateword.a7 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 9: OUT1( transporter ); if ( settingsState.stateword.a8 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 10: OUT1( prijim_pop ); if ( settingsState.stateword.a9 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 11: OUT1( prijim_prod ); if ( settingsState.stateword.a10 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 12: OUT1( nagrev_pop ); if ( settingsState.stateword.a11 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; case 13: OUT1( nagrev_prod ); if ( settingsState.stateword.a12 == 1 ) { OUT2( "[���.] ����." ); } else { OUT2( "���. [����.]" ); } break; } }
void ps_start_font (FILE *f, ps_font_info_type ps_info, string comment) { OUT1 ("%%%%Creator: %s\n", version_string); OUT1 ("%%%%CreationDate: %s\n", now ()); OUT_LINE ("%%DocumentData: Clean7Bit"); OUT_LINE ("%%EndComments"); OUT1 ("%% {%s}\n", comment); OUT_LINE ("% This font is in the public domain."); OUT1 ("/%s 11 dict begin\n", ps_info.font_name); /* The FontInfo dictionary, which has additional (supposedly optional) information. */ OUT_LINE ("/FontInfo 8 dict begin"); OUT1 (" /version (%s) readonly def\n", ps_info.version); OUT1 (" /FullName (%s) readonly def\n", ps_info.font_name); OUT1 (" /FamilyName (%s) readonly def\n", ps_info.family_name); OUT1 (" /Weight (%s) readonly def\n", ps_info.weight); OUT1 (" /ItalicAngle %d def\n", ps_info.italic_angle); OUT1 (" /isFixedPitch %s def\n", ps_info.monospace_p ? "true" : "false"); OUT1 (" /underlinePosition %d def\n", ps_info.underline_position); OUT1 (" /underlineThickness %d def\n", ps_info.underline_thickness); OUT_LINE ("currentdict end readonly def"); /* Other constant top-level elements of the font dictionary. Assume that the font name is the only thing on the stack at this point (which is true). This saves us from having to write the name twice. */ OUT_LINE ("/FontName 1 index def"); OUT_LINE ("/PaintType 0 def"); /* All our fonts are filled. */ if (ps_info.unique_id) OUT1 ("/UniqueID %d\n", ps_info.unique_id); }