This thesis contains program coding module for generation logics test by Boolean gap
Delphi & Pascal (česká wiki)
Category: Programs in C, C++
Program: Prac_ndf.c, Booldif.zip
File exe: Booldif.exe
need: Adresar.c, Color.c, Derivac.c, Error.c, Funkcie.c, Help.c, Key.c, Line_edi.c, Main.c, Menu.c, Obsluha.c, Okno.c, Prac_ndf.c, Slovnik.c, Slov_fon.c, Statist.c, Util.c, Video.c, Vystupy.c, Adresar.h, Color.h, Define.h, Error.h, Funkcie.h, Glob.h, Key.h, Line_edi.h, Mbooldif.h, Menu.h, Okno.h, Slov_fon.h, Util.h, Video.h
Example: Example.zip, Bin_10_o.ndf, Bin_10_o.ndf, Bin_1and.ndf, Bin_2rad.ndf, Bin_3rad.ndf, Bin_4rad.ndf, Hard.ndf, I_reg_lo.ndf, Reg_jk.ndf, Scitac_s.ndf, Scp_1rad.ndf, Scp_2rad.ndf, Scp_2r_1.ndf, Scp_3rad.ndf, Scp_4r_2.ndf, Scp_6r_3.ndf, Scp_8r_4.ndf, Sc_1r_pj.ndf, Sc_1r_sj.ndf, Sc_1_aoi.ndf, Sc_2r_4.ndf, Sc_3r_6.ndf, Sc_7400n.ndf, Sc_aon.ndf, Simp3_a.ndf, Simp3_b.ndf, Simp4_a.ndf, Simp4_b.ndf, Simp4_c.ndf, Simp6_a.ndf, Test_vod.ndf, Zle.ndf
Manual: Prirucky.zip
Program: Prac_ndf.c, Booldif.zip
File exe: Booldif.exe
need: Adresar.c, Color.c, Derivac.c, Error.c, Funkcie.c, Help.c, Key.c, Line_edi.c, Main.c, Menu.c, Obsluha.c, Okno.c, Prac_ndf.c, Slovnik.c, Slov_fon.c, Statist.c, Util.c, Video.c, Vystupy.c, Adresar.h, Color.h, Define.h, Error.h, Funkcie.h, Glob.h, Key.h, Line_edi.h, Mbooldif.h, Menu.h, Okno.h, Slov_fon.h, Util.h, Video.h
Example: Example.zip, Bin_10_o.ndf, Bin_10_o.ndf, Bin_1and.ndf, Bin_2rad.ndf, Bin_3rad.ndf, Bin_4rad.ndf, Hard.ndf, I_reg_lo.ndf, Reg_jk.ndf, Scitac_s.ndf, Scp_1rad.ndf, Scp_2rad.ndf, Scp_2r_1.ndf, Scp_3rad.ndf, Scp_4r_2.ndf, Scp_6r_3.ndf, Scp_8r_4.ndf, Sc_1r_pj.ndf, Sc_1r_sj.ndf, Sc_1_aoi.ndf, Sc_2r_4.ndf, Sc_3r_6.ndf, Sc_7400n.ndf, Sc_aon.ndf, Simp3_a.ndf, Simp3_b.ndf, Simp4_a.ndf, Simp4_b.ndf, Simp4_c.ndf, Simp6_a.ndf, Test_vod.ndf, Zle.ndf
Manual: Prirucky.zip
This thesis contains program coding module for generation logics test by Boolean gap. Compile vector of fault for existent circuit, forth about all boughs herself chauffeur. Results is absolute gauge. Program application enables four modes It is implemented in the C programming language for the operating system MS-DOS, or another compatible with it. The program is suitable for an interactive way to communicate with the user, allowing a comfortable working environment are similar to Turbo Vision.
//************************************************************************// // VYSTUPY.C // // Tuto su rutiny ktore vykonavaju neake vystupy na obrazovku // // 27.8.1997 // //************************************************************************// #include "mbooldif.h" #include "glob.h" #include "key.h" #include "video.h" #include "error.h" #include "okno.h" #include "menu.h" #include "util.h" #include "funkcie.h" //************************************************************************// // nastavi farbu podkladu, pisma // // 25.8.1997 // //************************************************************************// void farba(int cback,int ccolor) { if (cback>=0) textbackground(cback); if (ccolor>=0) textcolor(ccolor); } //************************************************************************// // rozculi sa z uzivatelom // // 25.8.1997 // //************************************************************************// void ukonc(void) { window(1,1,80,25); farba(BLACK,LIGHTGRAY); clrscr(); farba(BLUE,YELLOW); cprintf("Diplomova praca: Boolovske diferencie 1997, Copyright Zdenko Sekerak (c) 1997"); farba(BLACK,LIGHTGRAY); } //************************************************************************// // zobrazi upraveny format NDF na obrazovku // // i: zapis_NDF 27.8.1997 // //************************************************************************// void uloz_NDF( zapis_NDF *NDFka, char nadpis[], char meno[] ) { FILE *tmp,*fopen(); char vystup[ max_ret ]; tmp=fopen( strspoj( temp,meno) ,"a+t" );// tmp subor NDF.TMP BOOL.TMP if ( tmp == NULL ) { chybove_okno(chyba[17]); // disk chraneny proti zapisu, alebo tak neako return; } fprintf(tmp,"\n%s",nadpis); if( NDF_do_ret( NDFka, vystup ) == TRUE ) fprintf( tmp,"%s", vystup ); else if( NDFka->poc_NDF == 0 ) fprintf( tmp,"%s", ziaden ); else fprintf( tmp,"%s", vstup_1 ); fclose(tmp); } //************************************************************************// // NDF_do_ret zapis z mojej vnutornej struktury do retazca // // i:NDF zapis, vetviaci sa vodic o:retazec 9.11.1997 // //************************************************************************// int NDF_do_ret( zapis_NDF *NDFka, char retazec[] ) { int x,y; // devky strcpy( retazec, "" ); for ( x=1; x<=NDFka->poc_NDF; x++ ) { if ( NDFka->adept[x] == 1 ) strcat( retazec,"Ź" ); for ( y=0; y<NDFka->pv_NDF; y++ ) { // tu budu tie ktore chcem mat vypisane if (( y >= (zac_subst-1) ) && ( zac_subst != 0 )) { if ( NDFka->pNDF[x][y] == jclen ) strchar( retazec, subst_NDF.adept[ y-zac_subst+2 ] ); if ( NDFka->pNDF[x][y] == nclen ) strchar( retazec, 224-'a'+subst_NDF.adept[ y-zac_subst+2 ] ); } else { if ( NDFka->pNDF[x][y] == jclen ) strchar( retazec, 'a'+ y ); if ( NDFka->pNDF[x][y] == nclen ) strchar( retazec, 224+ y ); } if ((( NDFka->pNDF[x][y] == jclen ) || ( NDFka->pNDF[x][y] == nclen )) && ( y >= (zac_subst-1) ) && ( index[1] != ' ') ) strchar( retazec, index[1] ); } if ( x != NDFka->poc_NDF ) strcat( retazec," + " ); } // ma len logicku I if(( NDFka->poc_NDF > 0 ) && ( NDFka->pv_NDF == 0 )) strcat( retazec, vstup_1 ); // mam vobec neaky retazec if(( strlen( retazec ) == 0 ) || ( NDFka->poc_NDF == 0 )) return( FALSE ); else return( TRUE ); } //************************************************************************// // Ulozi to vsetko do suboru VYSTUP.BOL // // 8.10.1997 // //************************************************************************// void ukladaj_cinnost( char zariadenie[] ) { char DOSprik[256]; ret_do_NDF( ret_f, &h_fnc, TmpSubor[0] ); // upravi retazec, vyhodi zatvorky zbytocnosti sprintf( DOSprik,"if exist %s type %s >> %s" ,strspoj(temp,TmpSubor[5]), strspoj(temp,TmpSubor[5]), zariadenie ); anti_ascii( TmpSubor[0], TmpSubor[5] ); // vstupna funkcia system( DOSprik ); anti_ascii( TmpSubor[1], TmpSubor[5] ); // jednotlive derivacie system( DOSprik ); anti_ascii( TmpSubor[2], TmpSubor[5] ); // slovnik system( DOSprik ); } //************************************************************************// // Na spodny riadok aktualneho okna vykreslije suradnice // // x,y ake suradnice vypisovat 26.9.1997 // //************************************************************************// void suradnice( int x,int y ) { struct text_info ti; gettextinfo(&ti); // zistim suradnice window( ti.winleft,ti.wintop,ti.winright,ti.winbottom+1 ); // zvacsim okno gotoxy( 3,ti.winbottom-ti.wintop+2 ); cprintf(" Stpec=%2d Riadok=%2d ",x,y ); // zobrazim window( ti.winleft,ti.wintop,ti.winright,ti.winbottom ); // spat okno gotoxy( ti.curx,ti.cury ); // spat suradnice } //************************************************************************// // Zobrazi text od kolko na aktualnu suradnicu // // 26.9.1997 // //************************************************************************// void zob_ria( Riadok tex, int riad, int od, int kolko ) { int i; if ( tex.riadok == NULL ) return; if ( (od+kolko) > tex.dlzka ) kolko=tex.dlzka-od; gotoxy(1,riad); // odkial zacat pisat ! for ( i=od; i<od+kolko; i++ ) cprintf( "%c", tex.riadok[i] ); clreol(); } //************************************************************************// // Otvori okno napise nadpis vyhradi window // // i:ako otvor_okno o:True/False 28.9.1997 // //************************************************************************// int view_okno(int xl, int yl, int xp, int yp, int atr1, int atr2, int typ_o, char m_okna[] ) { if ( otvor_okno(xl,yl,xp,yp,atr1,atr2,typ_o)==FALSE ) return FALSE; tlac_riadok_help(" ~F1 Pomoc ł ~Enter Pokrauj ~ESC Koniec ~TAB pohyb TAB ~¨Ąpky pohyb v okne ~F7 tla",atributy[4],atributy[5]); window(xl+2,yl+1,xp-2,yp-2); gotoxy( (xp-xl-strlen(m_okna))/2 ,1 ); cprintf("%s",m_okna); farba( atr2>>4, atr2 & 15); window(xl+2,yl+2,xp-1,yp-1); return TRUE; } //************************************************************************// // Tu take namotavky, lebo nemozem volat zobraz_tmp s parametrom // // z MENU.DEF 28.9.1997 // //************************************************************************// zobraz_tmp0 ( void ) { int zx,zy; char pom[ max_ret ]; del_tmp( TmpSubor[0] ); // zmazeme, lebo inde ho pouzivam ako temporari strcpy( pom, ret_f ); ret_do_NDF( pom, &h_fnc, TmpSubor[0] ); // upravi retazec, vyhodi zatvorky zbytocnosti // a vsetko to naperie do NDF struktury zx=_stlpcov/2-38; zy=_riadkov/2-11; if( view_okno(zx,zy,zx+76,zy+14,atributy[42],atributy[43],3," Vstupn funkcia ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); zobraz_tmp ( TmpSubor[0],0 ); vypni_kurzor(); zatvor_okno(); return(0); } //************************************************************************// // ZOBRAZ_TMP1 zobrazi temp subor evidovany ako prvy // // 30.10.1997 // //************************************************************************// zobraz_tmp1 ( void ) { int zx,zy; zx=_stlpcov/2-38; zy=_riadkov/2-10; if( view_okno(zx,zy,zx+76,zy+20,atributy[42],atributy[43],3," Jednotliv Boolovsk diferencie ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); zobraz_tmp ( TmpSubor[1],0 ); vypni_kurzor(); zatvor_okno(); return(0); } //************************************************************************// // ZOBRAZ_TMP2 zobrazi temp subor evidovany ako druhy // // 30.10.1997 // //************************************************************************// zobraz_tmp2 ( void ) { int zx,zy; if(( slovnik.pv_NDF == 0 ) && ( slovnik.poc_NDF == 0 )) { chybove_okno( chyba[20] ); return(0); } zx=_stlpcov/2-38; zy=_riadkov/2-10; if( view_okno(zx,zy,zx+76,zy+20,atributy[42],atributy[43],3," pln test s diagnostickm pokrytĄm ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); zobraz_tmp ( TmpSubor[2],0 ); vypni_kurzor(); zatvor_okno(); return(0); } //************************************************************************// // ZOBRAZ_TMP3 // // 30.10.1997 // //************************************************************************// zobraz_tmp3 ( void ) { int zx,zy; zx=_stlpcov/2-38; zy=_riadkov/2-10; if( view_okno(zx,zy,zx+76,zy+20,atributy[42],atributy[43],3," Vektory porŁch ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); zobraz_tmp ( TmpSubor[3],0 ); vypni_kurzor(); zatvor_okno(); return(0); } //************************************************************************// // Zobrazi vysledok // // o: opustil ESC takze uz dalej automaticky rezim 20.10.1997 // //************************************************************************// zobraz_tmp4 ( void ) { int zx,zy,escape; zx=_stlpcov/2-38; zy=_riadkov/2-11; if( view_okno(zx,zy,zx+76,zy+23,atributy[42],atributy[43],3," Medzivsledok Boolovskej diferencie ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); escape=zobraz_tmp ( TmpSubor[3],0 ); vypni_kurzor(); zatvor_okno(); return(escape); } //************************************************************************// // Zobrazi vysledok a nezavrie okno, aby mohol skusat uzivatela // // o: opustil ESC takze uz dalej automaticky rezim 20.10.1997 // //************************************************************************// zobraz_tmp5 ( void ) { int zx,zy; zx=_stlpcov/2-38; zy=_riadkov/2-10; if( view_okno(zx,zy,zx+76,zy+14,atributy[42],atributy[43],3," Medzivsledok Boolovskej diferencie ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); zobraz_tmp ( TmpSubor[3],1 ); return(0); } //************************************************************************// // Zobrazi vysledok vsetkych boolovskych vektorov poruch // // 12.11.1997 // //************************************************************************// zobraz_tmp6 ( void ) { int zx,zy; zx=_stlpcov/2-38; zy=_riadkov/2-10; if( view_okno(zx,zy,zx+76,zy+20,atributy[42],atributy[43],3," Kroky testu pre jednotliv poruchy ")==FALSE) { chybove_okno( chyba[1] ); return(1); } zapni_kurzor(); zobraz_tmp ( TmpSubor[6],0 ); vypni_kurzor(); zatvor_okno(); return(0); } //************************************************************************// // Zobrazi hocaky subor do vymedzeneho okna // // siroky MAX_RET s poctom riadkov MAX_RIA 26.9.1997 // //************************************************************************// int zobraz_tmp ( char meno[], int iba_view ) { FILE *tmp,*fopen(); char riadok[max_ret],ch[1]; Riadok riadky[max_ria]; int x,y,i,kl; // devky int xo,yo; // velkost okna int xr,yr; // relativne suradnice v okne struct text_info ti; tmp=fopen( strspoj( temp,meno) , "r" ); if ( tmp==NULL ) //error { chybove_okno(chyba[18]); // disk chraneny proti zapisu, alebo tak neako return(0); } for ( y=0; y<max_ria; y++ ) { riadky[y].riadok=NULL; // znulujeme riadky[y].dlzka=1; } clrscr(); y=1; // nacitame a zaroven alokujeme pamat do { strcpy(riadok,""); strcpy(ch," "); x=0; do { i=fscanf(tmp,"%c",&ch[0]); // najprv riadok if ( (ch[0]!='\r') && (ch[0]!='\n') && ( i==1 ) ) strcat( riadok,ch ); else strcat( riadok," "); x++; } while ( (!feof(tmp)) && (ch[0]!='\r') && (ch[0]!='\n') && ( i== 1 ) ); if (( ( (char*) riadky[y].riadok ) = (char*) farmalloc( strlen(riadok)+1 )) == NULL ) { chybove_okno(chyba[1]); return(0); } min_mem = min_mem + strlen(riadok) +8; pamet(); // ukaz ako si na tom z pametou strcpy( riadky[y].riadok, riadok ); riadky[y].dlzka=x; y++; } while ( !feof(tmp) ); fclose(tmp); // uff uz mame nacitane !!! if ( Vystup == SUB ) { // ukladaj do vystupu subor VYSTUP.VYS anti_ascii( meno, TmpSubor[5] );// zapisujeme, tak odstranime diakritiku sprintf( riadok, "type %s%s >> %s", temp, meno, TmpSubor[4] ); system( riadok ); } // kreslime gettextinfo(&ti); // zistim suradnice xo=ti.winright-ti.winleft; // velkost okna to -1 je taka finta yo=ti.winbottom-ti.wintop+1; // aby na poslednom riadku neroloval obrazovku for( y=1; y<=yo; y++ ) if (riadky[y].riadok != NULL ) zob_ria( riadky[y],y,0,xo ); x=1; y=1; xr=1; yr=1; suradnice(x,y); gotoxy(xr,yr); // len zobraz a necakaj na stlacenie kl if (!iba_view) // dalej uz to zariadim do { // ActiveX move s tym mojim textom kl=key(); switch ( kl ) { case F7: // tlac toto okno anti_ascii( meno, TmpSubor[5] ); sprintf( riadok, "type %s%s >> PRN", temp, TmpSubor[5] ); system( riadok ); break; case LEFT: xr--;x--; if ( xr<1 ) { if ( x>0 ) { for ( i=1; i<=yo; i++ ) zob_ria( riadky[i+y-yr],i,x-xr-1,xo ); } else x++; xr++; } break; case RIGHT: xr++;x++; if ( xr>xo ) { if ( x<max_ret ) { for ( i=1; i<=yo; i++ ) zob_ria( riadky[i+y-yr],i,x-xr+1,xo ); } else x--; xr--; } break; case UP: yr--;y--; if ( yr<1 ) { if ( y>0 ) { gotoxy(1,1); insline(); zob_ria( riadky[y],1,x-xr,xo ); } else y++; yr++; } break; case DOWN: yr++;y++; if ( yr>yo ) { if ( riadky[y].riadok != NULL ) { gotoxy(1,1); delline(); zob_ria( riadky[y],yr-1,x-xr,xo ); } else y--; yr--; } break; case PGUP: for( i=0; i <= yo; i++ ) { yr--;y--; if ( yr<1 ) { if ( y>0 ) { gotoxy(1,1); insline(); zob_ria( riadky[y],1,x-xr,xo ); } else y++; yr++; } } break; case PGDOWN: for( i=0; i <= yo; i++ ) { yr++;y++; if ( yr>yo ) { if ( riadky[y].riadok != NULL ) { gotoxy(1,1); delline(); zob_ria( riadky[y],yr-1,x-xr,xo ); } else y--; yr--; } } break; case HOME: xr=x=1; for ( i=1; i<=yo; i++ ) zob_ria( riadky[i+y-yr],i,0,xo ); break; case END: xr=x=riadky[y].dlzka; if ( xr>xo ) xr=xo; for ( i=1; i<=yo; i++ ) zob_ria( riadky[i+y-yr],i,x-xr,xo ); break; case TAB: for ( kl=0; kl<8; kl++ ) // nechce sa midefinovat novu premennu { xr++;x++; if ( xr>xo ) { if ( x<max_ret ) { for ( i=1; i<=yo; i++ ) zob_ria( riadky[i+y-yr],i,x-xr+1,xo ); } else x--; xr--; } } kl=0; break; } // end of switch suradnice( x,y ); gotoxy(xr,yr); } while ( (kl != ENTER) && (kl != ESC) ); // milosi koncime // nech ma v pamati poriadok for ( y=max_ria-1;y>=0; y-- ) if ( riadky[y].riadok !=NULL ) farfree( riadky[y].riadok ); pamet(); return (kl) ; } //************************************************************************// // Prevedie negovany tvar pismena na pekne a s "dlznom" // // i retazec o:upraveny retazec 18.10.1997 // //************************************************************************// void moje_ascii( char ret_asc[] ) { int i; strcpy( ret_asc, ret_asc ); for (i=0; i<strlen(ret_asc); i++ ) if (( ret_asc[i] >= 'A') && ( ret_asc[i] <= 'Z' )) ret_asc[i] = ret_asc[i]+( 224 - 'A' ); } //************************************************************************// // NORM_SUBOR vyrovna prave okraje v subore WORDovske CTRL+J // // i:meno suboru o:upraveny subor 30.10.1997 // //************************************************************************// void norm_subor( char meno[] ) { FILE *f,*fopen(); // jasne ? FILE *g,*fopen(); // jasne ? int i; // devka char ch; // devka 2 int ci_x; // kolko znakov na riadok ? int sirka=0; // sirka riadku char riadok[ max_ret ]; // do toho budem nacitavat char pom[ 256 ]; // smola char pznak,ppznak; // posledny znak, predposledny znak f=fopen( strspoj( temp,meno ) ,"r+t" );// tmp subor SLOVNIK.TMP if ( f == NULL ) { chybove_okno(chyba[17]); // disk chraneny proti zapisu, alebo tak neako return; } // aky je najsirsi riadok ??? do { riadok[0]='\0'; ci_x=0; do { i=fscanf(f,"%c",&ch); // najprv riadok if ( (ch!='\r') && (ch!='\n') && ( i==1 ) ) strchar( riadok,ch ); ci_x++; } while ( (!feof(f)) && (ch!='\r') && (ch!='\n') && ( i== 1 ) ); // je sirsi ako som si myslel if( strlen( riadok ) > sirka ) sirka = strlen( riadok ); } while ( !feof(f) ); // zotvorime, otvorime, a citame odznova, ale uz budeme opravovat fclose(f); f=fopen( strspoj( temp,meno ) ,"r+t" ); // tmp subor SLOVNIK.TMP g=fopen( strspoj( temp,TmpSubor[5] ) ,"w+t" ); // tmp subor do { // precitame riadok[0]='\0'; ci_x=0; do { i=fscanf(f,"%c",&ch); // najprv riadok if ( (ch!='\r') && (ch!='\n') && ( i==1 ) ) strchar( riadok,ch ); ci_x++; } while ( (!feof(f)) && (ch!='\r') && (ch!='\n') && ( i== 1 ) ); // upravime if( strlen( riadok ) > 2 ) { pznak = riadok[ strlen( riadok ) -1 ]; ppznak = riadok[ strlen( riadok ) -2 ]; riadok[ strlen( riadok ) -1 ] = '\0'; // doplnime az do konca predposlednym znakom for( i= strlen( riadok ); i < sirka; i++ ) strchar( riadok, ppznak ); // naspat sem buchneme posledny znak strchar( riadok, pznak ); } // end if( strlen( riadok ) > 2 // zapiseme fprintf( g, "%s\n", riadok ); } while ( !feof(f) ); // zatvarame, skoncilo sa carovanie fclose(f); fclose(g); // premenujeme // a co ja viem preco najprv strcpy ??? strcpy( pom, strspoj( temp,TmpSubor[5] )); sprintf( riadok, "type %s > %s", pom , strspoj( temp,meno ) ); system( riadok ); } /*---------------------------------END--------------------------------------*/