Program rieši problém generovania testov prostredníctvom Boolovskej diferencie
Delphi & Pascal (česká wiki)
Kategorija: Programy zos C, C++
Program: Prac_ndf.c, Booldif.zip
Subor exe: Booldif.exe
Mušiš mac: 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
Ukažka: 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
Subor exe: Booldif.exe
Mušiš mac: 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
Ukažka: 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 rieši problém generovania testov prostredníctvom Boolovskej diferencie. Riešenie vyplýva z metódy matematicej derivácie logických zápisov funkcie v tvare Boolovského zápisu. Vytvára vektory porúch pre daný obvod, pričom zohľadňuje všetky vetviace sa vodiče. Výsledkom je úplný test.
Je implementovaný v programovacom jazyku C pre operačný systém MS-DOS, alebo iný s ním kompatibilným. Program je vhodný pre interaktívny spôsob komunikácie s užívateľom, čo umožňuje pohodlné pracovné prostredie podobné systémom Turbo Vision.
Ako príklad skúste nasledovné.
POZNÁMKA: Zdrojové kódy ktoré simulujú prostredie Turbo Vision niesu dielom autora.
Je implementovaný v programovacom jazyku C pre operačný systém MS-DOS, alebo iný s ním kompatibilným. Program je vhodný pre interaktívny spôsob komunikácie s užívateľom, čo umožňuje pohodlné pracovné prostredie podobné systémom Turbo Vision.
Ako príklad skúste nasledovné.
- Menu->Voľby->Vstup->Zo Súboru. Vyberte si niektorý z ukážkových súborov.
- Menu->Činnosť->Boolovské diferencie->Primárne vodiče
- Menu->Činnosť->Boolovské diferencie->Vnútorné vodiče
- Menu->Výsledky - môžete si pozrieť výsledky práce programu
POZNÁMKA: Zdrojové kódy ktoré simulujú prostredie Turbo Vision niesu dielom autora.
/***************************************************************************** * * * Subor OKNO.C * * * *****************************************************************************/ #include <dos.h> #include <stdlib.h> #include <alloc.h> #include "glob.h" #include "menu.h" #include "video.h" #include "okno.h" #include "util.h" struct Okno far * _okno=NULL; struct Rmenu Rmenu={0,{NULL}}; char far *_ramcek[]={ " ", "ÚÄżłŮÄŔł", "Ő͸łžÍÔł", "ÉÍťşźÍČş"}; //************************************************************************// // ZISTI_SURADNICE // // 30.10.1997 // //************************************************************************// void zisti_suradnice(struct Menu *menu,int *zx,int *zy,int *rx,int *ry) { *zx=menu->lavy; *zy=menu->horny; *rx=zisti_sirku_okna(menu->polozky); *ry=zisti_vysku_okna(menu->polozky); if(*rx>=_stlpcov) *rx=_stlpcov-2; if(*ry>=_riadkov) *rx=_riadkov; if(*zx+*rx>=_stlpcov) *zx-=(*zx+*rx)-_stlpcov; if(*zy+*ry>=_riadkov) *zy-=(*zy+*ry)-_riadkov; } //************************************************************************// // ZARAD_MENU // // 30.10.1997 // //************************************************************************// void zarad_menu(Menu *menu) { if(Rmenu.pocet <MAXRMENU) Rmenu.menu[Rmenu.pocet++]=menu; } //************************************************************************// // ZRUS_MENU // // 30.10.1997 // //************************************************************************// void zrus_menu(void) { if(Rmenu.pocet >0) Rmenu.pocet--; } //************************************************************************// // REDRAW_MENU // // 30.10.1997 // //************************************************************************// void redraw_menu(void) { int i; tlac_vodorovne_menu(&hlavne_menu); zvyrazni_vodorovne_menu(&hlavne_menu); tlac_riadok_help(hlavne_menu.polozky[hlavne_menu.posledna_volba].spodny_riadok,hlavne_menu.attr_spodneho_riadku,hlavne_menu.attr_hot_key); for(i=0;i<Rmenu.pocet;++i) redraw_podmenu(Rmenu.menu[i]); } //************************************************************************// // REDRAW_PODMENU // // 30.10.1997 // //************************************************************************// void redraw_podmenu(Menu *menu) { register int i; int zx,zy,rx,ry; if(menu == NULL) return; zisti_suradnice(menu,&zx,&zy,&rx,&ry); nakresli_okno(zx,zy,zx+rx,zy+ry,menu->attr_okna,menu->attr_okraja,menu->typ_okraja); i=0; while(menu->polozky[i].text!=NULL) tlac_riadok_menu(menu->lavy,menu->horny,i++,menu,rx-2); } //************************************************************************// // NAKRESLI_OKNO // // 30.10.1997 // //************************************************************************// void nakresli_okno(unsigned int lavy,unsigned int horny, unsigned int pravy,unsigned int dolny, unsigned char attr_okna,unsigned char attr_okraja, unsigned char typ_okraja) { vypln_okno(lavy+1,horny+1,pravy-1,dolny-1,' ',attr_okna); ramcek(lavy,horny,pravy-lavy,dolny-horny,attr_okraja,typ_okraja); tien(lavy,horny,pravy-lavy,dolny-horny,0x08); } //************************************************************************// // OTVOR_OKNO // // 30.10.1997 // //************************************************************************// int otvor_okno(unsigned int lavy,unsigned int horny, unsigned int pravy,unsigned int dolny, unsigned char attr_okna,unsigned char attr_okraja, unsigned char typ_okraja) { if(zarad_okno(lavy,horny,pravy-lavy+2,dolny-horny+1)!=TRUE)return FALSE; nakresli_okno(lavy,horny,pravy,dolny,attr_okna,attr_okraja,typ_okraja); return TRUE; } //************************************************************************// // ZARAD_OKNO // // 30.10.1997 // //************************************************************************// int zarad_okno(unsigned int lavy,unsigned int horny,unsigned int sirka,unsigned int vyska) { struct Okno far *p; if((p=(struct Okno far *)farmalloc(sizeof(Okno)))==NULL)return FALSE; if((p->data=(unsigned int far *)farmalloc(sirka*vyska*sizeof(int)))==NULL) { farfree(p); pamet(); return FALSE; } pamet(); p->lavy=lavy; p->horny=horny; p->sirka=sirka; p->vyska=vyska; uloz_okno(lavy,horny,sirka,vyska,p->data); p->prev=_okno; _okno=p; return TRUE; } //************************************************************************// // ZATVOR_OKNO // // 30.10.1997 // //************************************************************************// int zatvor_okno(void) { struct Okno far * p; if(_okno!=NULL) { obnov_okno(_okno->lavy,_okno->horny,_okno->sirka,_okno->vyska,_okno->data); p=_okno; _okno=_okno->prev; farfree(p->data); farfree(p); pamet(); return TRUE; } return FALSE; } //************************************************************************// // ZATVOR_OKNO1 // // // 30.10.1997 // //************************************************************************// int zatvor_okno1(void) { struct Okno far * p; if(_okno!=NULL) { obnov_okno1(_okno->lavy,_okno->horny,_okno->sirka,_okno->vyska,_okno->data); p=_okno; _okno=_okno->prev; farfree(p->data); farfree(p); pamet(); return TRUE; } return FALSE; } //************************************************************************// // ULOZ_OKNO // // 30.10.1997 // //************************************************************************// void uloz_okno(unsigned int lavy,unsigned int horny,unsigned int sirka,unsigned int vyska,unsigned int far *mem) { _BX=2*(_stlpcov*horny+lavy); _CH=sirka; _CL=(_stlpcov-sirka)*2; _DL=vyska; _DH=_CH; _SI=FP_OFF(mem); asm push es asm push ds _ES=VIDEOSEGMENT; _DS=FP_SEG(mem); n1: asm mov ch,dh n2: asm mov ax,es:[bx] asm mov ds:[si],ax asm inc si asm inc si asm inc bx asm inc bx asm dec ch asm jnz n2 asm add bx,cx asm dec dl asm jnz n1 asm pop ds asm pop es return; } //************************************************************************// // OBNOV_OKNO // // // 30.10.1997 // //************************************************************************// void obnov_okno(unsigned int lavy,unsigned int horny,unsigned int sirka,unsigned int vyska,unsigned int far *mem) { _BX=2*(_stlpcov*horny+lavy); _CH=sirka; _CL=(_stlpcov-sirka)*2; _DL=vyska; _DH=_CH; _SI=FP_OFF(mem); asm push es asm push ds _ES=VIDEOSEGMENT; _DS=FP_SEG(mem); n1: asm mov ch,dh n2: asm mov ax,ds:[si] asm mov es:[bx],ax asm inc si asm inc si asm inc bx asm inc bx asm dec ch asm jnz n2 asm add bx,cx asm dec dl asm jnz n1 asm pop ds asm pop es return; } //************************************************************************// // OBNOV_OKNO1 // // 30.10.1997 // //************************************************************************// void obnov_okno1(unsigned int lavy,unsigned int horny,unsigned int sirka,unsigned int vyska,unsigned int far *mem) { register unsigned int r; register unsigned int s; while(1) { _BX=2*(_stlpcov*horny+lavy); _CH=sirka; _CL=(_stlpcov-sirka)*2; _DL=vyska; _DH=_CH; _SI=FP_OFF(mem); asm push es asm push ds _ES=VIDEOSEGMENT; _DS=FP_SEG(mem); n1: asm mov ch,dh n2: asm mov ax,ds:[si] asm cmp ax,es:[bx] asm jnz n3 asm inc si asm inc si asm inc bx asm inc bx asm dec ch asm jnz n2 asm add bx,cx asm dec dl asm jnz n1 asm pop ds asm pop es return; n3: asm pop ds asm pop es n4: s=rand()%sirka; r=rand()%vyska; if(peek(VIDEOSEGMENT,2*(_stlpcov*(horny+r)+lavy+s))!=peek(FP_SEG(mem),FP_OFF(mem)+2*(sirka*r+s))) poke(VIDEOSEGMENT,2*(_stlpcov*(horny+r)+lavy+s),peek(FP_SEG(mem),FP_OFF(mem)+2*(sirka*r+s))); else goto n4; delay(1); } } //************************************************************************// // RAMCEK // // 30.10.1997 // //************************************************************************// void ramcek(unsigned int lavy,unsigned int horny,unsigned int sirka,unsigned int vyska,unsigned char attr,unsigned char typ_ramceka) { _SI=FP_OFF(_ramcek[typ_ramceka]); _DI=FP_SEG(_ramcek[typ_ramceka]); _BX=2*(_stlpcov*horny+lavy); _CL=sirka-2; _DX=(_stlpcov-sirka+1)*2; _CH=vyska-2; asm push es asm push ds _ES=VIDEOSEGMENT; _AH=attr; asm mov ds,di asm push cx asm mov ch,0 asm inc cl asm shl cx,1 asm mov di,cx asm pop cx asm mov al,ds:[si] asm mov es:[bx],ax asm inc bx asm inc bx asm mov al,ds:1[si] asm push cx n1: asm mov es:[bx],ax asm inc bx asm inc bx asm dec cl asm jnz n1 asm pop cx asm mov al,ds:2[si] asm mov es:[bx],ax asm add bx,dx asm mov al,ds:3[si] n2: asm mov es:[bx],ax asm add bx,di asm mov es:[bx],ax asm add bx,dx asm dec ch asm jnz n2 asm mov al,ds:6[si] asm mov es:[bx],ax asm inc bx asm inc bx asm mov al,ds:5[si] n3: asm mov es:[bx],ax asm inc bx asm inc bx asm dec cl asm jnz n3 asm mov al,ds:4[si] asm mov es:[bx],ax asm add bx,dx asm mov al,ds:7[si] asm pop ds asm pop es } //************************************************************************// // TIEN // // 30.10.1997 // //************************************************************************// void tien(unsigned int lavy,unsigned int horny,unsigned int sirka,unsigned int vyska,unsigned char attr) { _DI=sirka*2-2; _BX=2*(_stlpcov*(horny+1)+lavy+sirka)+1; _DX=(_stlpcov-2)*2; _CH=vyska-1; _CL=sirka+1; asm push es _ES=VIDEOSEGMENT; _AL=attr; n1: asm mov es:[bx],al asm inc bx asm inc bx asm mov es:[bx],al asm inc bx asm inc bx asm add bx,dx asm dec ch asm jnz n1 asm sub bx,di n2: asm mov es:[bx],al asm inc bx asm inc bx asm dec cl asm jnz n2 asm pop es } /*---------------------------------END--------------------------------------*/