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.
/***************************************************************************** * * * Subor FUNKCIE.C * * * *****************************************************************************/ #include <stdlib.h> #include <dos.h> #include <process.h> #include <string.h> #include <conio.h> #include <math.h> #include <stdio.h> #include <io.h> #include <sys\stat.h> #include <sys\types.h> #include "glob.h" #include "menu.h" #include "key.h" #include "video.h" #include "okno.h" #include "error.h" #include "adresar.h" #include "slov_fon.h" //************************************************************************// // Funkcie pouzivane priamo pri volani z MENU.DEF // // 30.10.1997 // //************************************************************************// #include "funkcie.h" #include "util.h" #include "line_edi.h" #include "mbooldif.h" //************************************************************************// // POPIS popis k programu // // 12.11.1997 // //************************************************************************// int popis1( void ) { help( Help[0] ); return; } //************************************************************************// // POPIS popis k programu // // 12.11.1997 // //************************************************************************// int popis2( void ) { help( Help[30] ); return; } //************************************************************************// // POPIS popis k programu // // 12.11.1997 // //************************************************************************// int popis3( void ) { help( Help[31] ); return; } //************************************************************************// // POPIS popis k programu // // 12.11.1997 // //************************************************************************// int popis4( void ) { help( Help[32] ); return; } //************************************************************************// // POPIS popis k programu // // 12.11.1997 // //************************************************************************// int popis5( void ) { help( Help[33] ); return; } //************************************************************************// // POMOC k programu // // 1.11.1997 // //************************************************************************// int pomoc( void ) { help( Help[0] ); return; } //************************************************************************// // DOS vola command.com (emulacia dos prompt) // // 30.10.1997 // //************************************************************************// int dos(void) { if( otvor_okno(0,0,_stlpcov-2,_riadkov-2,0x70,0x70,0)==FALSE) chybove_okno(chyba[3]); else { vypln_okno(0,0,_stlpcov,_riadkov,' ',0x07); tlac_retazec(0,0,0x07,"Pre n vrat zadaj exit."); presun_kurzor(0,1); zapni_kurzor(); system(""); vypni_kurzor(); zatvor_okno(); } return 0; } //************************************************************************// // NORTON zavola norton ak je v path nadefinovany // // 30.10.1997 // //************************************************************************// int norton(void) { if( otvor_okno(0,0,_stlpcov-2,_riadkov-2,0x70,0x70,0)==FALSE) chybove_okno(chyba[3]); else { vypln_okno(0,0,_stlpcov,_riadkov,' ',0x07); tlac_retazec(0,1,0x07,"Pre n vrat stla F10."); presun_kurzor(0,2); zapni_kurzor(); system("nc"); vypni_kurzor(); zatvor_okno(); } return 0; } //************************************************************************// // KONIEC rozculi sa z uzivatelom // // 30.10.1997 // //************************************************************************// int koniec(void) { povodny_font(); vrat_jadro(); del_tmp("*.tmp"); // aby neboli ziadne tmp subory k citaniu ukonc(); exit(1); return 0; } //************************************************************************// // RESET uvolni pamat, v mojom pripade aj zmaze TMP subori // // 30.10.1997 // //************************************************************************// int reset(void) { init_jadro(); del_tmp("*.tmp"); del_tmp( TmpSubor[4] ); hlasky(chyba[25]); return ENTER; } //************************************************************************// // RESET uvolni pamat so statistickymi udajmi // // 20.11.1997 // //************************************************************************// int reset_s(void) { int i; for( i=0; i < max_stat; i++ ) { s_stat->s_text[0]='\0'; // aka operacia s_stat->cas=0; // cas pri vzniku udalosti s_stat->pamet=0; // kolko zozralo pamete } p_stat=0; return ENTER; } //************************************************************************// // NIE neukoncime program // // 30.10.1997 // //************************************************************************// int nie(void) { return ENTER; } //************************************************************************// // NASTAV REZIM aky rezim sa nastavuje DEMO,VYUK, ... // // 30.10.1997 // //************************************************************************// int nastav_rezim(void) { Rezim=podmenu[6].posledna_volba; return ENTER; } //************************************************************************// // INIT_JADRO nadefinuje a alokuje mem pre premenne // // 30.10.1997 // //************************************************************************// void init_jadro(void) { pamet(); // ukaz ako si na tom z pametou znuluj(&h_fnc,1); znuluj(&deriv_f,1); // tu bude hlavna funkcia, a derivovana znuluj(&subst_NDF,1); // slovnik substitucii znuluj(&slovnik,1); // aj slovnik poruch strcpy( index, " " ); // aky index ma subst premenna pamet(); // ukaz ako si na tom z pametou return; } //************************************************************************// // CITAJ_DISK cita bool. dif zo suboru // // 30.10.1997 // //************************************************************************// int citaj_disk(void) { char meno[256]="*."; int prip=0; strcat(meno,Pripony[prip]); znuluj(&slovnik,1); // slovnik znulovany if( citaj_meno_suboru(meno,1)==TRUE) if( citaj_subor_z_disku(meno,prip)==FALSE) { chybove_okno(chyba[7]); return ESC; } else { strcpy(Meno_suboru,meno); return ENTER; } return ENTER; } //************************************************************************// // CITAJ_SUBOR_Z_DISKU // // 30.10.1997 // //************************************************************************// citaj_subor_z_disku(char *meno,int prip) { FILE *f; char pom[1]; int i; if((f=fopen(meno,"r"))==NULL) { chybove_okno(chyba[3]); return (FALSE); } init_jadro(); // odznova del_tmp("*.tmp"); // zmazem aj TMP subory v ktorych su odlozene vysledky switch(prip) { case 0 : { strcpy( ret_f,"" ); strcpy( pom," "); while ( !feof(f) && ( pom[0]!='\n' ) && ( pom[0]!='\r' )) { i=fscanf(f,"%c",&pom[0]); // precitam znak if (( pom[0]!='\n' ) && ( pom[0]!='\r' ) && ( i== 1 ) ) strcat( ret_f, pom); // taka finta } break; } } moje_ascii(ret_f); fclose(f); return(0); } //************************************************************************// // Zapise moje vysledky do suboru na disku // // 8.10.1997 // //************************************************************************// zapis_disk(void) { int zx,zy; struct ffblk ffblk; char meno[256]="*."; char DOSprik[max_ret]; int prip=2; strcat(meno,Pripony[prip]); if (citaj_meno_suboru(meno,0)==TRUE) { // opytame sa ci chce prepisat, ak existuje if( findfirst(meno,&ffblk,0) == 0 ) { sprintf( DOSprik," SŁbor %s existuje.", meno ); zx=_stlpcov/2-strlen(DOSprik)/2 - 1; zy=_riadkov/2-3; view_okno(zx,zy,zx+40,zy+6,atributy[20],atributy[21],2,""); tlac_retazec(zx+1,zy+1,atributy[20],DOSprik ); tlac_retazec(zx+strlen(DOSprik)/2-7,zy+2,atributy[20],"PrepĄsa ho novm ?" ); // polozime otazku prepisat subor ??? if( anonie( zx+ strlen(DOSprik)/2 -4, zy+4 ) == FALSE ) return(0); zatvor_okno(); } // zmazeme ak existuje sprintf( DOSprik,"if exist %s del %s >nul", meno, meno ); system( DOSprik ); ukladaj_cinnost( meno ); } return(0); } //************************************************************************// // ANONIE otazka na nieco // // TRUE-odpovedal ano FALSE odpovedal nie 30.10.1997 // //************************************************************************// int anonie( int x, int y ) { char *odp[]={" Ano "," Nie "}; int odpoved=1; int kl=0; tlac_retazec(x,y,atributy[20],odp[0]); tlac_retazec(x+7,y,atributy[17],odp[1] ); do { kl=key(); if( kl == LEFT ) if( odpoved == 0 ) odpoved=1; else odpoved=0; if( kl == RIGHT ) if( odpoved == 1 ) odpoved=0; else odpoved=1; if(( kl == LEFT ) || ( kl == RIGHT )) { if( odpoved == 1 ) { tlac_retazec(x,y,atributy[20],odp[0]); tlac_retazec(x+7,y,atributy[17],odp[1]); } else { tlac_retazec(x,y,atributy[17],odp[0]); tlac_retazec(x+7,y,atributy[20],odp[1]); } } // end if( odpoved == 0 ) } while(( kl != ENTER ) && ( kl != ESC )); if(( kl == ESC ) || ( odpoved == 1 )) return( FALSE ); return( TRUE ); } //************************************************************************// // NASTAV_VYSTUP kam ma ukladat vysledky vypoctu // // 30.10.1997 // //************************************************************************// int nastav_vystup(void) { Vystup=podmenu[8].posledna_volba; return ENTER; } //************************************************************************// // CITAJ_SUB malo by vystupovat ako neaky SETUP subor // // nacitanie vstupnych udajov so suboru 30.10.1997 // //************************************************************************// int cit_sub( void ) { return (TRUE); } //************************************************************************// // VRAT_JADRO vratenie pamate vyhradenej pre jadro // // 30.10.1997 // //************************************************************************// void vrat_jadro() { znuluj(&h_fnc,1); znuluj(&subst_NDF,1); znuluj(&deriv_f,1); return; } //************************************************************************// // DEL_TMP maze TMP subori z disku // // 30.10.1997 // //************************************************************************// void del_tmp( char subor[] ) { char del_ret[128]; sprintf( del_ret," if exist %s del %s >nul", strspoj(temp,subor),strspoj(temp,subor) ); system( del_ret ); } //************************************************************************// // Boolovska diferencia podla premennych bez medzivodicov // // i:upravena funkcia o:diferencie podla premennych 22.11.1997 // //************************************************************************// int dif_bez_mv( void ) { diferencie( 0 ); return( 0 ); } //************************************************************************// // Boolovska diferencia podla premennych aj s medzivodicami // // i:upravena funkcia o:diferencie podla premennych 22.11.1997 // //************************************************************************// int dif_s_mv( void ) { diferencie( 1 ); return( 0 ); } //************************************************************************// // ZATVORKY_A algebraicky odstrani zatvorky // // 24.11.1997 // //************************************************************************// int zatvorky_a( void ) { char pom[ max_ret ]; int zx,zy; FILE *f,*fopen(); zx=_stlpcov/2-38; zy=_riadkov/2-2; otvor_okno(zx,zy,zx+76,zy+7,atributy[39],atributy[40],1); tlac_retazec(zx+2,zy+1,atributy[39],"T to funkcia algebraicky odstr ni z tvorki a zobrazĄ.(Doplnkov funkcia)"); tlac_retazec(zx+2,zy+2,atributy[39],"Zadaj funkciu f= a-priamy z pis <shift>+a-invertovan napr.(ŕbc+aáâ)"); tlac_retazec(zx+2,zy+4,atributy[39],"f="); pom[0]='\0'; riadkovy_editor(zx+5,zy+4,65,max_ret-1,atributy[13],atributy[12],pom); zatvor_okno(); f=fopen( strspoj(temp, TmpSubor[5] ), "w" ); fprintf(f,"\n Pvodn funkcia :\n %s\n\n Po algebraickom odstr nenĄ z tvoriek:\n ", pom ); if( view_okno(zx,zy,zx+46,zy+5,atributy[20],atributy[21],2,"")==FALSE) { chybove_okno( chyba[1] ); return(0); } tlac_retazec(zx+1,zy+2,atributy[20]," Odstra¤ujem z tvorky "); odstran_zatvorky( pom, 1 ); fprintf(f,"%s\n", pom ); fclose(f); zatvor_okno(); zx=_stlpcov/2-38; zy=_riadkov/2-7; if( view_okno(zx,zy,zx+76,zy+10,atributy[42],atributy[43],3," Doplnkov funkcia ")==FALSE) { chybove_okno( chyba[1] ); return(0); } zapni_kurzor(); zobraz_tmp ( TmpSubor[5],0 ); vypni_kurzor(); zatvor_okno(); return(0); } //************************************************************************// // ZATVORKY_M matemeticky odstrani zatvorky // // 24.11.1997 // //************************************************************************// int zatvorky_m( void ) { char pom[ max_ret ]; int zx,zy; FILE *f,*fopen(); zx=_stlpcov/2-38; zy=_riadkov/2-2; otvor_okno(zx,zy,zx+76,zy+7,atributy[39],atributy[40],1); tlac_retazec(zx+2,zy+1,atributy[39],"T to funkcia matemeticky odstr ni z tvorki a zobrazĄ.(Doplnkov funkcia)"); tlac_retazec(zx+2,zy+2,atributy[39],"Zadaj funkciu f= a-priamy z pis <shift>+a-invertovan napr.(ŕbc+aáâ)"); tlac_retazec(zx+2,zy+4,atributy[39],"f="); pom[0]='\0'; riadkovy_editor(zx+5,zy+4,65,max_ret-1,atributy[13],atributy[12],pom); zatvor_okno(); f=fopen( strspoj(temp, TmpSubor[5] ), "w" ); fprintf(f,"\n Pvodn funkcia :\n %s\n\n Po matemetickom odstr nenĄ z tvoriek:\n ", pom ); if( view_okno(zx,zy,zx+46,zy+5,atributy[20],atributy[21],2,"")==FALSE) { chybove_okno( chyba[1] ); return(0); } tlac_retazec(zx+1,zy+2,atributy[20]," Odstra¤ujem z tvorky "); odstran_zatvorky( pom , 0 ); fprintf(f,"%s\n", pom ); fclose(f); zatvor_okno(); zx=_stlpcov/2-38; zy=_riadkov/2-7; if( view_okno(zx,zy,zx+76,zy+10,atributy[42],atributy[43],3," Doplnkov funkcia ")==FALSE) { chybove_okno( chyba[1] ); return(0); } zapni_kurzor(); zobraz_tmp ( TmpSubor[5],0 ); vypni_kurzor(); zatvor_okno(); return(0); } /*---------------------------------END--------------------------------------*/