Changeset 7 for trunk/txlib
- Timestamp:
- 01/05/06 10:45:52 (3 years ago)
- Location:
- trunk/txlib
- Files:
-
- 18 modified
-
include/txlib.h (modified) (6 diffs)
-
txafail.c (modified) (1 diff)
-
txcon.c (modified) (2 diffs)
-
txextcmd.c (modified) (1 diff)
-
txfsys.c (modified) (4 diffs)
-
txlib.c (modified) (1 diff)
-
txlogfil.c (modified) (2 diffs)
-
txparse2.c (modified) (1 diff)
-
txvers.h (modified) (1 diff)
-
txwdraw.c (modified) (1 diff)
-
txwidget.c (modified) (2 diffs)
-
txwikey.c (modified) (1 diff)
-
txwind.c (modified) (2 diffs)
-
txwiop.c (modified) (3 diffs)
-
txwprint.c (modified) (4 diffs)
-
txwproc.c (modified) (4 diffs)
-
txwstdlg.c (modified) (3 diffs)
-
txwutil.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/txlib/include/txlib.h
r1 r7 161 161 162 162 #if defined (WIN32) 163 #define TXFMODE "" 163 164 #define USHORT unsigned short int 164 165 #define TXINVALID ((ULONG) -1) 165 #define TXCURTHREAD ((ULONG) _threadid)166 #define TXCURTHREAD ((ULONG)(*(ULONG *) _threadid)) 166 167 #define TXHTHREAD HANDLE 167 168 #define TXHFILE HANDLE … … 199 200 #define FS_ENVP_SEP ';' 200 201 #elif defined (DOS32) 202 #define TXFMODE "" 201 203 #define TXWORD regs.w 202 204 #define TXIWRD ireg.w … … 252 254 #define ERROR_FILE_EXISTS 80 253 255 #elif defined (LINUX) // LINUX native (WATCOM) 256 #define TXFMODE "b" 254 257 typedef unsigned char BYTE; // b 255 258 typedef unsigned long BOOL; // f … … 326 329 #define ERROR_INVALID_PATH 253 // INVALID_PATH 327 330 #else 331 #define TXFMODE "" 328 332 #define TXCURTHREAD ((ULONG)(*(ULONG *) _threadid)) 329 333 #define TxAlloc(num,size) calloc((size_t) (num), (size_t) (size)) … … 474 478 #pragma pack(1) // byte packing 475 479 typedef struct txfs_ebpb // ext. boot parameter block 476 { 480 { // at offset 0x0b in bootsector 477 481 USHORT SectSize; // bytes per sector (BPB start) 478 482 BYTE ClustSize; // sectors per cluster … … 487 491 ULONG HiddenSectors; // Sector-offset from MBR/EBR 488 492 ULONG BigSectors; // nr of sectors if >= 64K 489 } TXFS_EBPB; // end of struct "txfs_ebpb"493 } TXFS_EBPB; // last byte is at offset 0x23 490 494 491 495 -
trunk/txlib/txafail.c
r1 r7 69 69 } 70 70 } 71 else if (fail == TRUE)71 else if (fail) 72 72 { 73 73 if (TxAutoFail++ == 0) // 0 before increment -
trunk/txlib/txcon.c
r1 r7 483 483 for (hinfo = txh_raw; hinfo != NULL; hinfo = hinfo->next) 484 484 { 485 if ((size < hinfo->size) && (hinfo->active == TRUE) &&485 if ((size < hinfo->size) && (hinfo->active) && 486 486 ((screen_act == SCREEN_ON) || 487 487 (hinfo->follow_screen_toggle == FALSE))) … … 496 496 for (hinfo = txh_clean; hinfo != NULL; hinfo = hinfo->next) 497 497 { 498 if ((size < hinfo->size) && (hinfo->active == TRUE) &&498 if ((size < hinfo->size) && (hinfo->active) && 499 499 ((screen_act == SCREEN_ON) || 500 500 (hinfo->follow_screen_toggle == FALSE))) -
trunk/txlib/txextcmd.c
r1 r7 225 225 rc = (ULONG) system( command); // execute the command 226 226 227 if ((so = fopen( TXC_TEMP_FILE_NAME, "r" )) != NULL)227 if ((so = fopen( TXC_TEMP_FILE_NAME, "r" TXFMODE)) != NULL) 228 228 { 229 229 while (!TxAbort() && !feof(so) && !ferror(so)) -
trunk/txlib/txfsys.c
r1 r7 297 297 298 298 #if defined (LINUX) 299 if ((mnt = fopen( "/proc/mounts", "r ")) != NULL)299 if ((mnt = fopen( "/proc/mounts", "rb")) != NULL) 300 300 { 301 301 while (!feof(mnt) && !ferror(mnt)) … … 441 441 442 442 #if defined (LINUX) 443 if ((mnt = fopen( "/proc/mounts", "r ")) != NULL)443 if ((mnt = fopen( "/proc/mounts", "rb")) != NULL) 444 444 { 445 445 while (!feof(mnt) && !ferror(mnt)) … … 724 724 } 725 725 #elif defined (LINUX) 726 if ((mnt = fopen( "/proc/mounts", "r ")) != NULL)726 if ((mnt = fopen( "/proc/mounts", "rb")) != NULL) 727 727 { 728 728 int length = strlen( drive); … … 926 926 else 927 927 { 928 if ((fh = fopen( "/etc/fstab", "r ")) != NULL)928 if ((fh = fopen( "/etc/fstab", "rb")) != NULL) 929 929 { 930 930 while (!feof(fh) && !ferror(fh)) -
trunk/txlib/txlib.c
r1 r7 191 191 #if defined (DOS32) // but conditionally for DOS 192 192 if ((TxaExeSwitchUnSet('w')) || // when non-windowed to avoid 193 (force_ansi_probe == TRUE))// on-screen garbage strings193 (force_ansi_probe)) // on-screen garbage strings 194 194 { // if ANSI.SYS not loaded 195 195 short col = TxCursorCol(); -
trunk/txlib/txlogfil.c
r1 r7 65 65 TxFnameExtension( log_fname, "log"); 66 66 } 67 if ((log_handle = fopen(log_fname, "a" )) == 0)67 if ((log_handle = fopen(log_fname, "a" TXFMODE)) == 0) 68 68 { 69 69 TxPrint("Error opening log : '%s'\n", log_fname); … … 113 113 { 114 114 fclose(log_handle); 115 if ((log_handle = fopen(log_fname, "a" )) == 0)115 if ((log_handle = fopen(log_fname, "a" TXFMODE)) == 0) 116 116 { 117 117 if (warn) -
trunk/txlib/txparse2.c
r1 r7 531 531 strcat( options, nextopt); 532 532 } 533 if (cond == TRUE)// option(s) AND condition533 if (cond) // option(s) AND condition 534 534 { 535 535 sprintf( error, "You can't use the %s%s option %s", -
trunk/txlib/txvers.h
r6 r7 40 40 // Originally developed for LPTool/DFSee utilities, open-sourced in 2005 41 41 // 42 #define TXLIB_V "1.05 13-12-2005" // JvW Fix set focus on [OK] in WidgetDialog 42 #define TXLIB_V "1.05 29-12-2005" // JvW Fixed Radio-repaint bug on (x == TRUE) 43 //efine TXLIB_V "1.05 27-12-2005" // JvW Made O_BINARY default for Linux files 44 //efine TXLIB_V "1.05 13-12-2005" // JvW Fix set focus on [OK] in WidgetDialog 43 45 //efine TXLIB_V "1.04 12-12-2005" // JvW Fixed ValidateScript desc for 1-liner 44 46 //efine TXLIB_V "1.03 08-12-2005" // JvW Home/End in SBVIEW now PgLeft/PgRight -
trunk/txlib/txwdraw.c
r1 r7 448 448 (win->class == TXW_BUTTON)) //- and any buttons 449 449 { 450 if (focus == TRUE)lc += TXLP_FOCUS;450 if (focus) lc += TXLP_FOCUS; 451 451 else if (wnd->us[TXQWS_FLAGS] & TXFF_ACTIVE) lc += TXLP_ACTIVE; 452 452 else if (wnd->us[TXQWS_FLAGS] & TXFF_SELECTED) lc += TXLP_SELECTED; -
trunk/txlib/txwidget.c
r6 r7 341 341 pvsize = position.bottom; 342 342 343 if (position.left + ww + 8< phsize)343 if (position.left + ww + 6 < phsize) 344 344 { 345 345 position.right = ww + 4; … … 350 350 } 351 351 } 352 if (position.top + ll + 8< pvsize)352 if (position.top + ll + 6 < pvsize) 353 353 { 354 354 position.bottom = ll + 4; -
trunk/txlib/txwikey.c
r4 r7 788 788 (txwa->insert == FALSE))) 789 789 { 790 if (txwa->insert == TRUE)790 if (txwa->insert) 791 791 { 792 792 memmove( cur +1, cur, strlen(cur) +1); -
trunk/txlib/txwind.c
r1 r7 896 896 ENTER(); 897 897 898 if ((rc = txwIsWindowVisible( hwnd)) == TRUE)898 if ((rc = txwIsWindowVisible( hwnd)) != FALSE) 899 899 { 900 900 TXWINDOW *win; … … 940 940 (class == TXW_FRAME ) ) // help uses a simple frame 941 941 { // rest are likely controls 942 if (txwIntersectRect( &(area->window->border), 943 rect, &overlap) == TRUE) 942 if (txwIntersectRect( &(area->window->border), rect, &overlap)) 944 943 { 945 944 TRECTA( "IsRectShowing :", ( rect )); -
trunk/txlib/txwiop.c
r1 r7 1398 1398 { 1399 1399 display_chr = virtual->ch; // un-translated ch value 1400 if (alternateChr == TRUE)// alternate still active1400 if (alternateChr) // alternate still active 1401 1401 { 1402 1402 if (txlTermCap_ae[0] != 0) // use standard charset … … 1627 1627 ) 1628 1628 { 1629 if (cursorInsert == TRUE)// to be refined1629 if (cursorInsert) // to be refined 1630 1630 { 1631 1631 } … … 1674 1674 int rc; 1675 1675 1676 if ((rc = TxWntConsoleReady()) == TRUE)1676 if ((rc = TxWntConsoleReady()) != FALSE) 1677 1677 { 1678 1678 if (GetConsoleScreenBufferInfo(buffer, info) == FALSE) -
trunk/txlib/txwprint.c
r1 r7 264 264 } 265 265 } 266 if (error == TRUE)266 if (error) 267 267 { 268 268 txwpWriteCharacter(*keep); … … 476 476 } 477 477 } 478 if (*syntax == TRUE)478 if (*syntax) 479 479 { 480 480 return NULL; … … 698 698 if (r->skip == FALSE) // but only when valid 699 699 { 700 if (txwIntersectRect( &parent, &(r->rect), &clip) == TRUE)700 if (txwIntersectRect( &parent, &(r->rect), &clip)) 701 701 { 702 702 txwScrDrawCellString( win->client.top + nr, … … 757 757 if (txwpScrBuff != NULL) 758 758 { 759 if ((df = fopen( fname, "w" )) != NULL)// create new text file759 if ((df = fopen( fname, "w" TXFMODE)) != NULL) // create new text file 760 760 { 761 761 ULONG used; // nr of lines in buffer -
trunk/txlib/txwproc.c
r1 r7 253 253 { 254 254 case TXWM_ACTIVATE: 255 if ((BOOL) mp1 == TRUE)// set window active ?255 if ((BOOL) mp1) // set window active ? 256 256 { 257 257 flags |= TXFF_ACTIVE; … … 1162 1162 1163 1163 case TXWM_SELECTED: 1164 if ((BOOL) mp1 == TRUE)// set window selected ?1164 if ((BOOL) mp1) // set window selected ? 1165 1165 { 1166 1166 flags |= TXFF_SELECTED; … … 1175 1175 1176 1176 case TXWM_SETFOCUS: 1177 if (((BOOL) mp1 == TRUE) &&// got focus, will be on top,1177 if (((BOOL) mp1) && // got focus, will be on top, 1178 1178 (win->style & TXWS_FOCUS_PAINT)) // so can be repainted 1179 1179 { … … 1203 1203 TRACES(("Auto-drop: %s\n", (win->style & TXLS_AUTO_DROP ) ? "YES" : "NO")); 1204 1204 1205 if ((BOOL) mp1 == TRUE)// got focus1205 if ((BOOL) mp1) // got focus 1206 1206 { 1207 1207 TRACES(("LB:%8.8lx L:%8.8lx f:%4.4x t:'%s' F:'%s'\n", -
trunk/txlib/txwstdlg.c
r1 r7 1946 1946 1947 1947 rc = txwStdFileDialog( TXHWND_DESKTOP, fd); 1948 if (rc == TRUE)1948 if (rc) 1949 1949 { 1950 1950 if ((fd->fName[0] != FS_PATH_SEP) && // not absolute from root … … 2029 2029 2030 2030 rc = txwStdFileDialog( TXHWND_DESKTOP, fd); 2031 if (rc == TRUE)2031 if (rc) 2032 2032 { 2033 2033 if ((fd->fName[0] != FS_PATH_SEP) && // not absolute from root … … 2090 2090 2091 2091 rc = txwStdFileDialog( TXHWND_DESKTOP, fd); 2092 if (rc == TRUE)2092 if (rc) 2093 2093 { 2094 2094 strcpy( fullPath, fd->fPath); -
trunk/txlib/txwutil.c
r1 r7 365 365 366 366 ENTER(); 367 TRACES(( "dialog:%8.8lx group-nr: %hu\n", hwnd, group)); 367 368 368 369 if ((henum = txwBeginEnumWindows( hwnd)) != 0) … … 372 373 cwin = txwWindowData( child); 373 374 374 if ((cwin->class == TXW_BUTTON) && 375 (cwin->style & TXBS_AUTORADIO)) 375 if (cwin->class == TXW_BUTTON) 376 376 { 377 377 TXWINBASE *wnd = (TXWINBASE *) child; 378 378 379 if ((*(cwin->bu.checked) == TRUE) && // only reset the set one(s) 380 (wnd->us[TXQWS_GROUP] == group)) 379 TRACES(( "Button %8.8lx: group:%hu '%s'\n", 380 child, wnd->us[TXQWS_GROUP], cwin->bu.text)); 381 382 if ((cwin->style & TXBS_PRIMARYSTYLES) == TXBS_AUTORADIO) 381 383 { 382 TRACES(( "Reset autoradio button %8.8lx: '%s'\n", 383 child, cwin->bu.text)); 384 *(cwin->bu.checked) = FALSE; 385 txwInvalidateWindow( child, FALSE, FALSE); 384 TRACES(("AutoRadio: %s\n", (*(cwin->bu.checked)) ? "ON" : "OFF")); 385 if ((*(cwin->bu.checked)) && // only reset the set one(s) 386 (wnd->us[TXQWS_GROUP] == group)) 387 { 388 TRACES(( "Reset autoradio button %8.8lx: '%s'\n", 389 child, cwin->bu.text)); 390 *(cwin->bu.checked) = FALSE; 391 txwInvalidateWindow( child, FALSE, FALSE); 392 } 386 393 } 387 394 } … … 1004 1011 *xcl2 = *rec1; // as exclusion area 1 & 2 1005 1012 1006 if (txwOverlappingRect( rec1, rec2) == TRUE)// optimization possible by1013 if (txwOverlappingRect( rec1, rec2)) // optimization possible by 1007 1014 { // using 2 exclusion rects 1008 1015 if (rec2->top >= rec1->top) // 2nd is 'below' 1st … … 1175 1182 { 1176 1183 if (txwIntersectRect( &(area->window->border), 1177 &(reg->rect), &overlap) == TRUE)1184 &(reg->rect), &overlap)) 1178 1185 { 1179 1186 if ((overlap.left > reg->rect.left) && … … 1547 1554 if ((hb->elem != NULL) && (strlen(value) != 0)) 1548 1555 { 1549 if ((hb->current != TXH_NOCURR) && use_current == TRUE)1556 if ((hb->current != TXH_NOCURR) && use_current) 1550 1557 { 1551 1558 i = hb->current +1; // start at next one … … 1589 1596 if ((hb->elem != NULL) && (strlen(value) != 0)) 1590 1597 { 1591 if ((hb->current != TXH_NOCURR) && use_current == TRUE)1598 if ((hb->current != TXH_NOCURR) && use_current) 1592 1599 { 1593 1600 i = hb->current;