Changeset 7

Show
Ignore:
Timestamp:
01/05/06 10:45:52 (3 years ago)
Author:
jvw
Message:

Made O_BINARY default for Linux files (CR/LF in logfiles)
Fixed Radio-repaint bug caused by a (x == TRUE) compare

Location:
trunk/txlib
Files:
18 modified

Legend:

Unmodified
Added
Removed
  • trunk/txlib/include/txlib.h

    r1 r7  
    161161 
    162162#if   defined (WIN32) 
     163   #define  TXFMODE                "" 
    163164   #define  USHORT                 unsigned short int 
    164165   #define  TXINVALID              ((ULONG) -1) 
    165    #define  TXCURTHREAD            ((ULONG) _threadid) 
     166   #define  TXCURTHREAD            ((ULONG)(*(ULONG  *) _threadid)) 
    166167   #define  TXHTHREAD              HANDLE 
    167168   #define  TXHFILE                HANDLE 
     
    199200   #define  FS_ENVP_SEP            ';' 
    200201#elif defined (DOS32) 
     202   #define  TXFMODE                "" 
    201203   #define  TXWORD                 regs.w 
    202204   #define  TXIWRD                 ireg.w 
     
    252254   #define  ERROR_FILE_EXISTS      80 
    253255#elif defined (LINUX)                           // LINUX native        (WATCOM) 
     256   #define  TXFMODE                "b" 
    254257   typedef  unsigned char          BYTE;        // b 
    255258   typedef  unsigned long          BOOL;        // f 
     
    326329   #define  ERROR_INVALID_PATH           253    // INVALID_PATH 
    327330#else 
     331   #define  TXFMODE                "" 
    328332   #define  TXCURTHREAD         ((ULONG)(*(ULONG  *) _threadid)) 
    329333   #define  TxAlloc(num,size)   calloc((size_t) (num), (size_t) (size)) 
     
    474478#pragma pack(1)                                 // byte packing 
    475479typedef struct txfs_ebpb                        // ext. boot parameter block 
    476 { 
     480{                                               // at offset 0x0b in bootsector 
    477481   USHORT              SectSize;                // bytes per sector (BPB start) 
    478482   BYTE                ClustSize;               // sectors per cluster 
     
    487491   ULONG               HiddenSectors;           // Sector-offset from MBR/EBR 
    488492   ULONG               BigSectors;              // nr of sectors if >= 64K 
    489 } TXFS_EBPB;                                    // end of struct "txfs_ebpb" 
     493} TXFS_EBPB;                                    // last byte is at offset 0x23 
    490494 
    491495 
  • trunk/txlib/txafail.c

    r1 r7  
    6969      } 
    7070   } 
    71    else if (fail == TRUE) 
     71   else if (fail) 
    7272   { 
    7373      if (TxAutoFail++ == 0)                    // 0 before increment 
  • trunk/txlib/txcon.c

    r1 r7  
    483483      for (hinfo = txh_raw; hinfo != NULL; hinfo = hinfo->next) 
    484484      { 
    485          if ((size < hinfo->size) && (hinfo->active == TRUE) && 
     485         if ((size < hinfo->size) && (hinfo->active) && 
    486486             ((screen_act == SCREEN_ON) || 
    487487              (hinfo->follow_screen_toggle == FALSE))) 
     
    496496         for (hinfo = txh_clean; hinfo != NULL; hinfo = hinfo->next) 
    497497         { 
    498             if ((size < hinfo->size) && (hinfo->active == TRUE) && 
     498            if ((size < hinfo->size) && (hinfo->active) && 
    499499                ((screen_act == SCREEN_ON) || 
    500500                 (hinfo->follow_screen_toggle == FALSE))) 
  • trunk/txlib/txextcmd.c

    r1 r7  
    225225   rc = (ULONG) system( command);               // execute the command 
    226226 
    227    if ((so = fopen( TXC_TEMP_FILE_NAME, "r")) != NULL) 
     227   if ((so = fopen( TXC_TEMP_FILE_NAME, "r" TXFMODE)) != NULL) 
    228228   { 
    229229      while (!TxAbort() && !feof(so) && !ferror(so)) 
  • trunk/txlib/txfsys.c

    r1 r7  
    297297 
    298298   #if defined (LINUX) 
    299       if ((mnt = fopen( "/proc/mounts", "r")) != NULL) 
     299      if ((mnt = fopen( "/proc/mounts", "rb")) != NULL) 
    300300      { 
    301301         while (!feof(mnt) && !ferror(mnt)) 
     
    441441 
    442442   #if defined (LINUX) 
    443       if ((mnt = fopen( "/proc/mounts", "r")) != NULL) 
     443      if ((mnt = fopen( "/proc/mounts", "rb")) != NULL) 
    444444      { 
    445445         while (!feof(mnt) && !ferror(mnt)) 
     
    724724      } 
    725725   #elif defined (LINUX) 
    726       if ((mnt = fopen( "/proc/mounts", "r")) != NULL) 
     726      if ((mnt = fopen( "/proc/mounts", "rb")) != NULL) 
    727727      { 
    728728         int           length = strlen( drive); 
     
    926926      else 
    927927      { 
    928          if ((fh = fopen( "/etc/fstab", "r")) != NULL) 
     928         if ((fh = fopen( "/etc/fstab", "rb")) != NULL) 
    929929         { 
    930930            while (!feof(fh) && !ferror(fh)) 
  • trunk/txlib/txlib.c

    r1 r7  
    191191      #if   defined (DOS32)                     // but conditionally for DOS 
    192192      if ((TxaExeSwitchUnSet('w')) ||           // when non-windowed to avoid 
    193           (force_ansi_probe == TRUE))           // on-screen garbage strings 
     193          (force_ansi_probe))                   // on-screen garbage strings 
    194194      {                                         // if ANSI.SYS not loaded 
    195195         short         col = TxCursorCol(); 
  • trunk/txlib/txlogfil.c

    r1 r7  
    6565         TxFnameExtension( log_fname, "log"); 
    6666      } 
    67       if ((log_handle = fopen(log_fname, "a")) == 0) 
     67      if ((log_handle = fopen(log_fname, "a" TXFMODE)) == 0) 
    6868      { 
    6969         TxPrint("Error opening log : '%s'\n", log_fname); 
     
    113113   { 
    114114      fclose(log_handle); 
    115       if ((log_handle = fopen(log_fname, "a")) == 0) 
     115      if ((log_handle = fopen(log_fname, "a" TXFMODE)) == 0) 
    116116      { 
    117117         if (warn) 
  • trunk/txlib/txparse2.c

    r1 r7  
    531531            strcat(  options, nextopt); 
    532532         } 
    533          if (cond == TRUE)                 // option(s) AND condition 
     533         if (cond)                              // option(s) AND condition 
    534534         { 
    535535            sprintf( error, "You can't use the %s%s option %s", 
  • trunk/txlib/txvers.h

    r6 r7  
    4040// Originally developed for LPTool/DFSee utilities, open-sourced in 2005 
    4141// 
    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 
    4345//efine TXLIB_V "1.04 12-12-2005" // JvW Fixed ValidateScript desc for 1-liner 
    4446//efine TXLIB_V "1.03 08-12-2005" // JvW Home/End in SBVIEW now PgLeft/PgRight 
  • trunk/txlib/txwdraw.c

    r1 r7  
    448448             (win->class         == TXW_BUTTON))          //- and any buttons 
    449449         { 
    450             if (focus == TRUE)                             lc += TXLP_FOCUS; 
     450            if (focus)                                     lc += TXLP_FOCUS; 
    451451            else if (wnd->us[TXQWS_FLAGS] & TXFF_ACTIVE)   lc += TXLP_ACTIVE; 
    452452            else if (wnd->us[TXQWS_FLAGS] & TXFF_SELECTED) lc += TXLP_SELECTED; 
  • trunk/txlib/txwidget.c

    r6 r7  
    341341      pvsize = position.bottom; 
    342342 
    343       if (position.left  + ww + 8 < phsize) 
     343      if (position.left  + ww + 6 < phsize) 
    344344      { 
    345345         position.right  = ww + 4; 
     
    350350         } 
    351351      } 
    352       if (position.top   + ll + 8 < pvsize) 
     352      if (position.top   + ll + 6 < pvsize) 
    353353      { 
    354354         position.bottom = ll + 4; 
  • trunk/txlib/txwikey.c

    r4 r7  
    788788                    (txwa->insert == FALSE))) 
    789789               { 
    790                   if (txwa->insert == TRUE) 
     790                  if (txwa->insert) 
    791791                  { 
    792792                     memmove( cur +1, cur, strlen(cur) +1); 
  • trunk/txlib/txwind.c

    r1 r7  
    896896   ENTER(); 
    897897 
    898    if ((rc = txwIsWindowVisible( hwnd)) == TRUE) 
     898   if ((rc = txwIsWindowVisible( hwnd)) != FALSE) 
    899899   { 
    900900      TXWINDOW           *win; 
     
    940940             (class == TXW_FRAME )  )           // help uses a simple frame 
    941941         {                                      // rest are likely controls 
    942             if (txwIntersectRect( &(area->window->border), 
    943                             rect, &overlap) == TRUE) 
     942            if (txwIntersectRect( &(area->window->border), rect, &overlap)) 
    944943            { 
    945944               TRECTA( "IsRectShowing :", ( rect                )); 
  • trunk/txlib/txwiop.c

    r1 r7  
    13981398      { 
    13991399         display_chr = virtual->ch;             // un-translated ch value 
    1400          if (alternateChr == TRUE)              // alternate still active 
     1400         if (alternateChr)                      // alternate still active 
    14011401         { 
    14021402            if (txlTermCap_ae[0] != 0)          // use standard charset 
     
    16271627) 
    16281628{ 
    1629    if (cursorInsert == TRUE)                    // to be refined 
     1629   if (cursorInsert)                            // to be refined 
    16301630   { 
    16311631   } 
     
    16741674   int                 rc; 
    16751675 
    1676    if ((rc = TxWntConsoleReady()) == TRUE) 
     1676   if ((rc = TxWntConsoleReady()) != FALSE) 
    16771677   { 
    16781678      if (GetConsoleScreenBufferInfo(buffer, info) == FALSE) 
  • trunk/txlib/txwprint.c

    r1 r7  
    264264      } 
    265265   } 
    266    if (error == TRUE) 
     266   if (error) 
    267267   { 
    268268      txwpWriteCharacter(*keep); 
     
    476476      } 
    477477   } 
    478    if (*syntax == TRUE) 
     478   if (*syntax) 
    479479   { 
    480480      return NULL; 
     
    698698            if (r->skip == FALSE)               // but only when valid 
    699699            { 
    700                if (txwIntersectRect( &parent, &(r->rect), &clip) == TRUE) 
     700               if (txwIntersectRect( &parent, &(r->rect), &clip)) 
    701701               { 
    702702                  txwScrDrawCellString( win->client.top + nr, 
     
    757757   if (txwpScrBuff != NULL) 
    758758   { 
    759       if ((df = fopen( fname, "w")) != NULL)    // create new text file 
     759      if ((df = fopen( fname, "w" TXFMODE)) != NULL) // create new text file 
    760760      { 
    761761         ULONG         used;                    // nr of lines in buffer 
  • trunk/txlib/txwproc.c

    r1 r7  
    253253   { 
    254254      case TXWM_ACTIVATE: 
    255          if ((BOOL) mp1 == TRUE)                // set window active ? 
     255         if ((BOOL) mp1)                        // set window active ? 
    256256         { 
    257257            flags |= TXFF_ACTIVE; 
     
    11621162 
    11631163      case TXWM_SELECTED: 
    1164          if ((BOOL) mp1 == TRUE)                // set window selected ? 
     1164         if ((BOOL) mp1)                        // set window selected ? 
    11651165         { 
    11661166            flags |= TXFF_SELECTED; 
     
    11751175 
    11761176      case TXWM_SETFOCUS: 
    1177          if (((BOOL) mp1 == TRUE) &&            // got focus, will be on top, 
     1177         if (((BOOL) mp1) &&                    // got focus, will be on top, 
    11781178             (win->style & TXWS_FOCUS_PAINT))   // so can be repainted 
    11791179         { 
     
    12031203                  TRACES(("Auto-drop:  %s\n", (win->style & TXLS_AUTO_DROP ) ? "YES" : "NO")); 
    12041204 
    1205                   if ((BOOL) mp1 == TRUE)       // got focus 
     1205                  if ((BOOL) mp1)               // got focus 
    12061206                  { 
    12071207                     TRACES(("LB:%8.8lx L:%8.8lx f:%4.4x t:'%s' F:'%s'\n", 
  • trunk/txlib/txwstdlg.c

    r1 r7  
    19461946 
    19471947         rc = txwStdFileDialog( TXHWND_DESKTOP, fd); 
    1948          if (rc == TRUE) 
     1948         if (rc) 
    19491949         { 
    19501950            if ((fd->fName[0] != FS_PATH_SEP) && // not absolute from root 
     
    20292029 
    20302030         rc = txwStdFileDialog( TXHWND_DESKTOP, fd); 
    2031          if (rc == TRUE) 
     2031         if (rc) 
    20322032         { 
    20332033            if ((fd->fName[0] != FS_PATH_SEP) && // not absolute from root 
     
    20902090 
    20912091         rc = txwStdFileDialog( TXHWND_DESKTOP, fd); 
    2092          if (rc == TRUE) 
     2092         if (rc) 
    20932093         { 
    20942094            strcpy( fullPath, fd->fPath); 
  • trunk/txlib/txwutil.c

    r1 r7  
    365365 
    366366   ENTER(); 
     367   TRACES(( "dialog:%8.8lx  group-nr: %hu\n", hwnd, group)); 
    367368 
    368369   if ((henum = txwBeginEnumWindows( hwnd)) != 0) 
     
    372373         cwin = txwWindowData( child); 
    373374 
    374          if ((cwin->class == TXW_BUTTON) && 
    375              (cwin->style & TXBS_AUTORADIO)) 
     375         if (cwin->class == TXW_BUTTON) 
    376376         { 
    377377            TXWINBASE *wnd = (TXWINBASE *) child; 
    378378 
    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) 
    381383            { 
    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               } 
    386393            } 
    387394         } 
     
    10041011   *xcl2 = *rec1;                               // as exclusion area 1 & 2 
    10051012 
    1006    if (txwOverlappingRect( rec1, rec2) == TRUE) // optimization possible by 
     1013   if (txwOverlappingRect( rec1, rec2))        // optimization possible by 
    10071014   {                                            // using 2 exclusion rects 
    10081015      if (rec2->top  >= rec1->top)              // 2nd is 'below' 1st 
     
    11751182            { 
    11761183               if (txwIntersectRect( &(area->window->border), 
    1177                                      &(reg->rect), &overlap) == TRUE) 
     1184                                     &(reg->rect), &overlap)) 
    11781185               { 
    11791186                  if ((overlap.left  > reg->rect.left) && 
     
    15471554   if ((hb->elem != NULL) && (strlen(value) != 0)) 
    15481555   { 
    1549       if ((hb->current != TXH_NOCURR) && use_current == TRUE) 
     1556      if ((hb->current != TXH_NOCURR) && use_current) 
    15501557      { 
    15511558         i = hb->current +1;                    // start at next one 
     
    15891596   if ((hb->elem != NULL) && (strlen(value) != 0)) 
    15901597   { 
    1591       if ((hb->current != TXH_NOCURR) && use_current == TRUE) 
     1598      if ((hb->current != TXH_NOCURR) && use_current) 
    15921599      { 
    15931600         i = hb->current;