Delphi & Pascal (česká wiki)
/***************************************************************************** * * * Subor UTIL.C * * * *****************************************************************************/ #include <dos.h> #include <conio.h> #include "glob.h" #include "util.h" #include "menu.h" #include "key.h" #include "video.h" #include "okno.h" #include "mbooldif.h" #define len_seg 65535.0 // velkost segmentu //************************************************************************// // PIP // // 30.10.1997 // //************************************************************************// void pip(void) { sound(1000); delay(20); nosound(); } //************************************************************************// // TRC zvuk, ktory upozornuje // // 30.10.1997 // //************************************************************************// void trc(void) { register unsigned int i; for(i=30;i<4000;i+=100) { sound(i); delay(1); } nosound(); } //************************************************************************// // Prevod_na_velke // // 30.10.1997 // //************************************************************************// int prevod_na_velke( int k ) { if( k>='a' && k<='z') k-='a'-'A'; return k; } //************************************************************************// // INFO_OKNO // // 30.10.1997 // //************************************************************************// void info_okno(void) { vypln_okno(3,19,45,21,' ',0x1e); // zakladne info o programe ramcek(2,18,42,4,0x1f,3); tien(2,18,42,4,0x08); window(3,19,45,21); farba(BLUE,WHITE); gotoxy(4,2); cprintf("Generovanie testov Boolovskou"); gotoxy(4,3); cprintf("diferenciou verzia 2.53 (1997)"); vypln_okno(51,19,76,21,' ',0x1e); // ako je program nastaveny ramcek(50,18,26,4,0x1f,3); tien(50,18,26,4,0x08); window(51,19,76,21); gotoxy(4,2); cprintf(" Reim:"); gotoxy(4,3); cprintf("Vstup:"); switch(Rezim) { case AUTO: gotoxy(12,2);cprintf("Automatick"); break; case DEMO: gotoxy(12,2);cprintf("Demon¨tran"); break; case VYUK: gotoxy(12,2);cprintf("Vukov"); break; case PREV: gotoxy(12,2);cprintf("PreverovacĄ"); break; } switch(Vystup) { case OBR: gotoxy(12,3);cprintf("Obrazovka"); break; case SUB: gotoxy(12,3);cprintf("\"%s\"",TmpSubor[4]); break; case TLC: gotoxy(12,3);cprintf("Tlaiare¤"); break; } } //************************************************************************// // GET_TMP_ADR vycita tmp adresar // // 30.10.1997 // //************************************************************************// char *get_tmp_adr( void ) { unsigned char far *segment_; char pom_r[max_ret]; char temp[max_ret]; unsigned int i; union REGS reg; reg.h.ah=0x62; intdos(®,®); segment_=MK_FP (reg.x.bx,0); segment_ = MK_FP( segment_[0x2d]*256 + segment_[0x2c],0 ); strcpy( pom_r,"" ); strcpy( temp,"" ); for( i=0; i<len_seg; i++ ) { // hladam v segmente parafraf = PSP[0x2d]*256 + PSP[0x2c] strcat( pom_r," " ); pom_r[ strlen( pom_r )-1 ] = segment_[i] ; if (( segment_[i] == 0 ) || ( strlen(pom_r) > max_ret )) { // je koniec retazca strlwr( pom_r ); str_delete( pom_r,' ' ); if( strstr( pom_r,"temp=" ) != NULL ) { // ideme tmp adresar strcpy( temp,strtemp( pom_r,"=" ) ); strcat( temp,"\\" ); return( temp ); } strcpy( pom_r,"" ); } } return( temp ); } //************************************************************************// // STR_DELETE odstran medzery a male konvertuj na velke pismena // // 2.11.1997 // //************************************************************************// char *str_delete( char *z_str, char aky_str ) { char pom_r[max_ret]; int i=0; strcpy( pom_r,"" ); while ( strlen(z_str) > i ) { if ( z_str[i] != aky_str ) { strcat( pom_r," " ); pom_r[ strlen( pom_r )-1 ] = z_str[i] ; } i++; } strcpy( z_str, pom_r ); return( z_str ); } //************************************************************************// // STRSPOJ k retazcu pom_r pripoji char znak // // 30.10.1997 // //************************************************************************// char *strspoj( char s1[], char s2[] ) { strcpy( s12,s1 ); strcat( s12,s2 ); return ( s12 ); } //************************************************************************// // STRTEMP odstrani od_ret a ostane len path na TEMP // // 30.10.1997 // //************************************************************************// char *strtemp( char pom_r[], char od_ret[] ) { char temp_path[max_ret]; int i; strcpy( temp_path,"" ); for( i=strcspn( pom_r,od_ret )+1; i<=strlen( pom_r); i++ ) { strcat( temp_path," " ); temp_path[ strlen( temp_path )-1 ] = pom_r[i] ; } return( temp_path ); } //************************************************************************// // Ako pomocka pre spravu pamate vypisuje ako som na tom s volnou pamatou // // nieco nieje OK 10.11.1997 // //************************************************************************// void pamet( void ) { char pom[ 80 ]; sprintf( pom, "[%7lu b]",(unsigned long) coreleft() ); tlac_retazec(_stlpcov - 23 ,0,0x70, pom ); tlac_cas(); } /*----------------------------------END-------------------------------------*/