Changeset 14 for trunk/src


Ignore:
Timestamp:
Dec 9, 2000, 8:19:42 PM (25 years ago)
Author:
umoeller
Message:

Major updates; timers, LVM, miscellaneous.

Location:
trunk/src/helpers
Files:
1 added
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/animate.c

    r8 r14  
    2222/*
    2323 *      Copyright (C) 1997-2000 Ulrich M”ller.
    24  *      This file is part of the XWorkplace source package.
    25  *      XWorkplace is free software; you can redistribute it and/or modify
     24 *      This file is part of the "XWorkplace helpers" source package.
     25 *      This is free software; you can redistribute it and/or modify
    2626 *      it under the terms of the GNU General Public License as published
    2727 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838    // as unsigned char
    3939
    40 #define INCL_DOS
    41 #define INCL_DOSERRORS
     40#define INCL_DOSPROCESS
    4241#define INCL_DOSDEVICES
    4342#define INCL_DOSDEVIOCTL
    44 
    45 #define INCL_WIN
     43#define INCL_DOSERRORS
     44
     45#define INCL_WINPOINTERS
    4646#define INCL_WINSYS
    4747
     
    164164
    165165/* ******************************************************************
    166  *                                                                  *
    167  *   Other animations                                               *
    168  *                                                                  *
     166 *
     167 *   Other animations
     168 *
    169169 ********************************************************************/
    170170
  • trunk/src/helpers/cctl_chart.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Chart Control                                                  *
    88  *                                                                  *
     86 *
     87 *   Chart Control
     88 *
    8989 ********************************************************************/
    9090
  • trunk/src/helpers/cctl_checkcnr.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Global variables                                               *
    88  *                                                                  *
     86 *
     87 *   Global variables
     88 *
    8989 ********************************************************************/
    9090
     
    9494
    9595/* ******************************************************************
    96  *                                                                  *
    97  *   Checkbox container record cores                                *
    98  *                                                                  *
     96 *
     97 *   Checkbox container record cores
     98 *
    9999 ********************************************************************/
    100100
  • trunk/src/helpers/cctl_progbar.c

    r13 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Progress bars                                                  *
    88  *                                                                  *
     86 *
     87 *   Progress bars
     88 *
    8989 ********************************************************************/
    9090
  • trunk/src/helpers/cctl_splitwin.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Split windows                                                  *
    88  *                                                                  *
     86 *
     87 *   Split windows
     88 *
    8989 ********************************************************************/
    9090
  • trunk/src/helpers/cctl_tooltip.c

    r8 r14  
    1616/*
    1717 *      Copyright (C) 1997-2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8484
    8585/* ******************************************************************
    86  *                                                                  *
    87  *   Global variables                                               *
    88  *                                                                  *
     86 *
     87 *   Global variables
     88 *
    8989 ********************************************************************/
    9090
     
    9898
    9999/* ******************************************************************
    100  *                                                                  *
    101  *   "Tooltip" control                                              *
    102  *                                                                  *
     100 *
     101 *   "Tooltip" control
     102 *
    103103 ********************************************************************/
    104104
     
    724724    PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    725725
    726     TRY_LOUD(excpt1, NULL)
     726    TRY_LOUD(excpt1)
    727727    {
    728728        switch (msg)
  • trunk/src/helpers/cnrh.c

    r8 r14  
    2222/*
    2323 *      Copyright (C) 1997-2000 Ulrich M”ller.
    24  *      This file is part of the XWorkplace source package.
    25  *      XWorkplace is free software; you can redistribute it and/or modify
     24 *      This file is part of the "XWorkplace helpers" source package.
     25 *      This is free software; you can redistribute it and/or modify
    2626 *      it under the terms of the GNU General Public License as published
    2727 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838    // as unsigned char
    3939
    40 #define INCL_WIN
     40#define INCL_WINWINDOWMGR
     41#define INCL_WINRECTANGLES
     42#define INCL_WININPUT
     43#define INCL_WINPOINTERS
     44#define INCL_WINMENUS
     45#define INCL_WINSYS
     46#define INCL_WINSTDDRAG
     47#define INCL_WINSTDCNR
     48
    4149#define INCL_GPILOGCOLORTABLE
    4250#define INCL_GPIPRIMITIVES
     
    5967
    6068/* ******************************************************************
    61  *                                                                  *
    62  *   Details view field infos                                       *
    63  *                                                                  *
     69 *
     70 *   Details view field infos
     71 *
    6472 ********************************************************************/
    6573
     
    338346
    339347/* ******************************************************************
    340  *                                                                  *
    341  *   Record core management                                         *
    342  *                                                                  *
     348 *
     349 *   Record core management
     350 *
    343351 ********************************************************************/
    344352
     
    353361 *      by following the RECORDCORE.preccNextRecord pointers
    354362 *      (i.e. we have a linked list here).
     363 *
     364 *      Returns NULL on errors (what CM_ALLOCRECORD returns).
    355365 *
    356366 *      The record cores returned by the container are
     
    735745
    736746/* ******************************************************************
    737  *                                                                  *
    738  *   View management                                                *
    739  *                                                                  *
     747 *
     748 *   View management
     749 *
    740750 ********************************************************************/
    741751
     
    11191129                // convert this to screen coordinates
    11201130                WinMapWindowPoints(hwndCnr,
    1121                            HWND_DESKTOP,
    1122                            &ptl,
    1123                            1);
     1131                                   HWND_DESKTOP,
     1132                                   &ptl,
     1133                                   1);
    11241134                fQueried = TRUE;
    11251135            }
     
    13031313
    13041314/* ******************************************************************
    1305  *                                                                  *
    1306  *   Record relations/iteration                                     *
    1307  *                                                                  *
     1315 *
     1316 *   Record relations/iteration
     1317 *
    13081318 ********************************************************************/
    13091319
     
    15801590
    15811591/* ******************************************************************
    1582  *                                                                  *
    1583  *   Miscellaneous                                                  *
    1584  *                                                                  *
     1592 *
     1593 *   Miscellaneous
     1594 *
    15851595 ********************************************************************/
    15861596
  • trunk/src/helpers/comctl.c

    r8 r14  
    5353/*
    5454 *      Copyright (C) 1997-2000 Ulrich M”ller.
    55  *      This file is part of the XWorkplace source package.
    56  *      XWorkplace is free software; you can redistribute it and/or modify
     55 *      This file is part of the "XWorkplace helpers" source package.
     56 *      This is free software; you can redistribute it and/or modify
    5757 *      it under the terms of the GNU General Public License as published
    5858 *      by the Free Software Foundation, in version 2 as it comes in the
     
    117117
    118118/* ******************************************************************
    119  *                                                                  *
    120  *   Global variables                                               *
    121  *                                                                  *
     119 *
     120 *   Global variables
     121 *
    122122 ********************************************************************/
    123123
     
    127127
    128128/* ******************************************************************
    129  *                                                                  *
    130  *   "Menu button" control                                          *
    131  *                                                                  *
     129 *
     130 *   "Menu button" control
     131 *
    132132 ********************************************************************/
    133133
     
    149149    HWND        hwndMenu;
    150150} MENUBUTTONDATA, *PMENUBUTTONDATA;
     151
     152/*
     153 *@@ ctlDisplayButtonMenu:
     154 *      displays the specified menu above the button.
     155 *
     156 *@@added V0.9.7 (2000-11-29) [umoeller]
     157 */
     158
     159VOID ctlDisplayButtonMenu(HWND hwndButton,
     160                          HWND hwndMenu)
     161{
     162    SWP     swpButton;
     163    POINTL  ptlMenu;
     164    WinQueryWindowPos(hwndButton, &swpButton);
     165    ptlMenu.x = swpButton.x;
     166    ptlMenu.y = swpButton.y;
     167
     168    // ptlMenu now has button coordinates
     169    // relative to the button's parent;
     170    // convert this to screen coordinates:
     171    WinMapWindowPoints(WinQueryWindow(hwndButton, QW_PARENT),
     172                       HWND_DESKTOP,
     173                       &ptlMenu,
     174                       1);
     175
     176    // now show the menu on top of the button
     177    WinPopupMenu(HWND_DESKTOP,               // menu parent
     178                 hwndButton,                 // owner
     179                 hwndMenu,
     180                 (SHORT)(ptlMenu.x),
     181                 (SHORT)(ptlMenu.y + swpButton.cy - 1),
     182                 0,                          // ID
     183                 PU_NONE
     184                     | PU_MOUSEBUTTON1
     185                     | PU_KEYBOARD
     186                     | PU_HCONSTRAIN
     187                     | PU_VCONSTRAIN);
     188}
    151189
    152190/*
     
    288326                        // menu successfully loaded:
    289327                        // find out where to put it
    290                         SWP     swpButton;
    291                         POINTL  ptlMenu;
    292                         WinQueryWindowPos(hwndButton, &swpButton);
    293                         ptlMenu.x = swpButton.x;
    294                         ptlMenu.y = swpButton.y;
    295 
    296                         // ptlMenu now has button coordinates
    297                         // relative to the button's parent;
    298                         // convert this to screen coordinates:
    299                         WinMapWindowPoints(WinQueryWindow(hwndButton, QW_PARENT),
    300                                            HWND_DESKTOP,
    301                                            &ptlMenu,
    302                                            1);
    303 
    304                         // now show the menu on top of the button
    305                         WinPopupMenu(HWND_DESKTOP,               // menu parent
    306                                      hwndButton,                 // owner
    307                                      pmbd->hwndMenu,
    308                                      (SHORT)(ptlMenu.x),
    309                                      (SHORT)(ptlMenu.y + swpButton.cy - 1),
    310                                      0,                          // ID
    311                                       PU_NONE
    312                                          | PU_MOUSEBUTTON1
    313                                          | PU_KEYBOARD
    314                                          | PU_HCONSTRAIN
    315                                          | PU_VCONSTRAIN);
     328                        ctlDisplayButtonMenu(hwndButton,
     329                                             pmbd->hwndMenu);
    316330                    } // end if (pmbd->hwndMenu)
    317331                    else
     
    484498
    485499/* ******************************************************************
    486  *                                                                  *
    487  *   Subclassed Static Bitmap Control                               *
    488  *                                                                  *
     500 *
     501 *   Subclassed Static Bitmap Control
     502 *
    489503 ********************************************************************/
    490504
     
    788802
    789803/* ******************************************************************
    790  *                                                                  *
    791  *   Icon animation                                                 *
    792  *                                                                  *
     804 *
     805 *   Icon animation
     806 *
    793807 ********************************************************************/
    794808
     
    967981
    968982/* ******************************************************************
    969  *                                                                  *
    970  *   Bitmap functions                                               *
    971  *                                                                  *
     983 *
     984 *   Bitmap functions
     985 *
    972986 ********************************************************************/
    973987
     
    10501064
    10511065/* ******************************************************************
    1052  *                                                                  *
    1053  *   Hotkey entry field                                             *
    1054  *                                                                  *
     1066 *
     1067 *   Hotkey entry field
     1068 *
    10551069 ********************************************************************/
    10561070
  • trunk/src/helpers/datetime.c

    r8 r14  
    2525/*
    2626 *      This file Copyright (C) 1997-2000 Ulrich M”ller.
    27  *      This file is part of the XWorkplace source package.
    28  *      XWorkplace is free software; you can redistribute it and/or modify
     27 *      This file is part of the "XWorkplace helpers" source package.
     28 *      This is free software; you can redistribute it and/or modify
    2929 *      it under the terms of the GNU General Public License as published
    3030 *      by the Free Software Foundation, in version 2 as it comes in the
     
    6363const char  *pcszFormatTimestamp = "%4u%02u%02u%02u%02u%02u%";
    6464
     65ULONG G_ulDateScalarFirstCalled = 0;
     66
    6567/*
    6668 *@@ dtGetULongTime:
     
    7173 *      time in milliseconds.
    7274 *
    73  *      Warning: this does not handle day information. When called twice
    74  *      in between day changes, this returns incorrect information.
     75 *      Even though this does handle date information (i.e.
     76 *      will still return an increasing number when the
     77 *      clock switches from 23:59:59:9999 to 0:00:00:0000),
     78 *      this will not work forver after the first call.
     79 *      Here's the calculation:
     80 *
     81 +          1000 ms per second
     82 +            * 60 secs per minute
     83 +                * 60 minutes per hour
     84 +                    * 24 hours per day
     85 +                      = 86'400'000       after 23:59:59:9999
     86 *
     87 *      A ULONG can hold a max value of 4'294'967'295.
     88 *      So this overflows after 49.71... days.
     89 *
     90 *@@changed V0.9.7 (2000-12-05) [umoeller]: now handling date also
    7591 */
    7692
     
    7894{
    7995    DATETIME    dt;
     96    ULONG       ulTime,
     97                ulDateScalarPassed = 1;
    8098    DosGetDateTime(&dt);
    81     return (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(dt.hours)))));
     99    ulTime = (10*(dt.hundredths + 100*(dt.seconds + 60*(dt.minutes + 60*(dt.hours)))));
     100
     101    if (G_ulDateScalarFirstCalled == 0)
     102    {
     103        // first call:
     104        G_ulDateScalarFirstCalled = dtDate2Scalar(dt.year,
     105                                                  dt.month,
     106                                                  dt.day);
     107    }
     108    else
     109    {
     110        // not first call:
     111        ULONG ulDateScalarNow = dtDate2Scalar(dt.year,
     112                                              dt.month,
     113                                              dt.day);
     114        // calculate days passed since first call;
     115        // this should be 1 if the date hasn't changed
     116        ulDateScalarPassed = (G_ulDateScalarFirstCalled - ulDateScalarNow) + 1;
     117    }
     118
     119    return (ulTime * ulDateScalarPassed);
    82120}
    83121
     
    147185
    148186/*
     187**
     188**
     189**   day:    day of month
     190**   mon:    month (1-12)
     191**   yr:     year
     192**
     193**
     194*/
     195
     196/*
     197 *@@ dtDayOfWeek:
     198 *      returns an integer that represents the day of
     199 *      the week for the date passed as parameters.
     200 *
     201 *      Returns 0-6 where 0 is sunday.
     202 *
     203 *@@added V0.9.7 (2000-12-05) [umoeller]
     204 */
     205
     206ULONG dtDayOfWeek(ULONG day,
     207                  ULONG mon,    // 1-12
     208                  ULONG yr)
     209{
     210    int dow;
     211
     212    if (mon <= 2)
     213    {
     214          mon += 12;
     215          yr -= 1;
     216    }
     217    dow = (   day
     218            + mon * 2
     219            + ((mon + 1) * 6) / 10
     220            + yr
     221            + yr / 4
     222            - yr / 100
     223            + yr / 400
     224            + 2);
     225    dow = dow % 7;
     226    return ((dow ? dow : 7) - 1);
     227}
     228
     229/*
    149230 *@@ dtIsLeapYear:
    150231 *      returns TRUE if yr is a leap year.
     
    164245/*
    165246 *@@ dtMonths2Days:
    166  *      returns the no. of days for month.
     247 *      returns the no. of days for the beginning
     248 *      of "month" (starting from 1).
     249 *
     250 *      For example, if you pass 1 (for january),
     251 *      you get 0 because there's no days at jan 1st
     252 *      yet.
     253 *
     254 *      If you pass 2 (for february), you get 31.
     255 *
     256 *      If you pass 3 (for march), you get 61.
     257 *
     258 *      This is useful for computing a day index
     259 *      for a given month/day pair. Pass the month
     260 *      in here and add (day-1); for march 3rd,
     261 *      you then get 63.
    167262 *
    168263 *      (c) Ray Gardner.
     
    171266unsigned dtMonths2Days(unsigned month)
    172267{
    173    return (month * 3057 - 3007) / 100;
     268    return (month * 3057 - 3007) / 100;
    174269}
    175270
     
    228323   *pyr = n;
    229324   n = (unsigned)(scalar - dtYears2Days(n-1));
    230    if ( n > 59 ) {                       /* adjust if past February */
     325   if ( n > 59 )    /* adjust if past February */
     326   {
    231327      n += 2;
    232328      if ( dtIsLeapYear(*pyr) )
     
    237333}
    238334
    239 
     335/*
     336 *@@ dtIsValidDate:
     337 *      returns TRUE if the given date is valid.
     338 *
     339 *@@added V0.9.7 (2000-12-05) [umoeller]
     340 */
     341
     342BOOL dtIsValidDate(LONG day,      // in: day (1-31)
     343                   LONG month,    // in: month (1-12)
     344                   ULONG year)    // in: year (e.g. 1999)
     345{
     346    BOOL brc = FALSE;
     347    if (day > 0)
     348    {
     349        switch( month )
     350        {
     351            case 1  :
     352            case 3  :
     353            case 5  :
     354            case 7  :
     355            case 8  :
     356            case 10 :
     357            case 12 :
     358                if (day <= 31)
     359                    brc = TRUE;
     360            break;
     361
     362            case 4  :
     363            case 6  :
     364            case 9  :
     365            case 11 :
     366                if (day <= 30)
     367                    brc = TRUE;
     368            break;
     369
     370            case 2 :
     371                if (day < 29)
     372                    brc = TRUE;
     373                else
     374                    if (day == 29)
     375                        if (dtIsLeapYear(year))
     376                            return 1 ;
     377        }
     378    }
     379    return (brc);
     380}
     381
  • trunk/src/helpers/debug.c

    r13 r14  
    3434 *                                      John Currier,
    3535 *                                      Anthony Cruise.
    36  *      This file is part of the XWorkplace source package.
    37  *      XWorkplace is free software; you can redistribute it and/or modify
     36 *      This file is part of the "XWorkplace helpers" source package.
     37 *      This is free software; you can redistribute it and/or modify
    3838 *      it under the terms of the GNU General Public License as published
    3939 *      by the Free Software Foundation, in version 2 as it comes in the
     
    5050    // as unsigned char
    5151
    52 #define INCL_BASE
     52#define INCL_DOSPROCESS
     53#define INCL_DOSMODULEMGR
     54#define INCL_DOSMISC
     55#define INCL_DOSERRORS
    5356#include <os2.h>
    5457
     
    8891
    8992/* ******************************************************************
    90  *                                                                  *
    91  *   Global variables                                               *
    92  *                                                                  *
     93 *
     94 *   Global variables
     95 *
    9396 ********************************************************************/
    9497
     
    353356
    354357/* ******************************************************************
    355  *                                                                  *
    356  *   PART 1: ANALYZE DEBUG CODE                                     *
    357  *                                                                  *
     358 *
     359 *   PART 1: ANALYZE DEBUG CODE
     360 *
    358361 ********************************************************************/
    359362
     
    11291132
    11301133/* ******************************************************************
    1131  *                                                                  *
    1132  *   PART 2: ANALYZE VARIABLES                                      *
    1133  *                                                                  *
     1134 *
     1135 *   PART 2: ANALYZE VARIABLES
     1136 *
    11341137 ********************************************************************/
    11351138
     
    14211424
    14221425/* ******************************************************************
    1423  *                                                                  *
    1424  *   PART 3: ANALYZE SYMBOL (.SYM) FILE                             *
    1425  *                                                                  *
     1426 *
     1427 *   PART 3: ANALYZE SYMBOL (.SYM) FILE
     1428 *
    14261429 ********************************************************************/
    14271430
     
    15661569
    15671570/* ******************************************************************
    1568  *                                                                  *
    1569  *   PART 4: dbgPrintStack                                          *
    1570  *                                                                  *
     1571 *
     1572 *   PART 4: dbgPrintStack
     1573 *
    15711574 ********************************************************************/
    15721575
  • trunk/src/helpers/dosh.c

    r13 r14  
    3131/*
    3232 *      This file Copyright (C) 1997-2000 Ulrich M”ller.
    33  *      This file is part of the XWorkplace source package.
    34  *      XWorkplace is free software; you can redistribute it and/or modify
     33 *      This file is part of the "XWorkplace helpers" source package.
     34 *      This is free software; you can redistribute it and/or modify
    3535 *      it under the terms of the GNU General Public License as published
    3636 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4747    // as unsigned char
    4848
    49 #define INCL_DOS
     49#define INCL_DOSMODULEMGR
     50#define INCL_DOSPROCESS
     51#define INCL_DOSSESMGR
     52#define INCL_DOSQUEUES
     53#define INCL_DOSMISC
     54#define INCL_DOSDEVICES
    5055#define INCL_DOSDEVIOCTL
    5156#define INCL_DOSERRORS
     57
    5258#define INCL_KBD
    5359#include <os2.h>
     60
    5461#include <stdlib.h>
    5562#include <string.h>
    5663#include <stdio.h>
    57 // #include <ctype.h>
    5864
    5965#include "setup.h"                      // code generation and debugging options
     
    7076
    7177/* ******************************************************************
    72  *                                                                  *
    73  *   Miscellaneous                                                  *
    74  *                                                                  *
     78 *
     79 *   Miscellaneous
     80 *
    7581 ********************************************************************/
    7682
     
    172178
    173179    return (s_brc);
     180}
     181
     182/*
     183 *@@ doshQueryAvailPhysMem:
     184 *      returns the amount of physical memory which
     185 *      is presently available (before the swapper
     186 *      would have to be expanded).
     187 *
     188 *      This number is calculated by getting the
     189 *      total available memory (QSV_TOTRESMEM)
     190 *      and subtracting the free space on the
     191 *      drive with the swap file from it.
     192 *
     193 *      As a result, you also need to specify
     194 *      the logical drive on which the swapper
     195 *      resides (3 = C, 4 = D, and so on).
     196 *
     197 *@@added V0.9.7 (2000-12-01) [umoeller]
     198 */
     199
     200APIRET doshQueryAvailPhysMem(PULONG pulMem,
     201                             ULONG ulLogicalSwapDrive)
     202{
     203    APIRET arc = DosQuerySysInfo(QSV_TOTAVAILMEM,
     204                                 QSV_TOTAVAILMEM,
     205                                 pulMem,
     206                                 sizeof(*pulMem));
     207    if (arc == NO_ERROR)
     208    {
     209        double dFree = 0;
     210        arc = doshQueryDiskFree(ulLogicalSwapDrive,
     211                                &dFree);
     212        *pulMem -= (ULONG)dFree;
     213    }
     214
     215    return (arc);
    174216}
    175217
     
    213255
    214256/* ******************************************************************
    215  *                                                                  *
    216  *   Memory helpers                                                 *
    217  *                                                                  *
     257 *
     258 *   Memory helpers
     259 *
    218260 ********************************************************************/
    219261
     
    283325
    284326/* ******************************************************************
    285  *                                                                  *
    286  *   Drive helpers                                                  *
    287  *                                                                  *
     327 *
     328 *   Drive helpers
     329 *
    288330 ********************************************************************/
    289331
     
    417459{
    418460    ULONG ulBootDrive;
    419     DosQuerySysInfo(5, 5, &ulBootDrive, sizeof(ulBootDrive));
     461    DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE,
     462                    &ulBootDrive,
     463                    sizeof(ulBootDrive));
    420464    return (G_acDriveLetters[ulBootDrive]);
    421465}
     
    461505                  OPEN_FLAGS_DASD
    462506                         | OPEN_FLAGS_FAIL_ON_ERROR
     507                         | OPEN_FLAGS_NOINHERIT     // V0.9.6 (2000-11-25) [pr]
    463508                         | OPEN_ACCESS_READONLY
    464509                         | OPEN_SHARE_DENYNONE,
     
    523568
    524569/*
     570 *@@ doshSetLogicalMap:
     571 *       sets the mapping of logical floppy drives onto a single
     572 *       physical floppy drive.
     573 *       This means selecting either drive A: or drive B: to refer
     574 *       to the physical drive.
     575 *
     576 *@@added V0.9.6 (2000-11-24) [pr]
     577 */
     578
     579APIRET doshSetLogicalMap(ULONG ulLogicalDrive)
     580{
     581    CHAR    name[3] = "?:";
     582    ULONG   fd = 0,
     583            action = 0,
     584            paramsize = 0,
     585            datasize = 0;
     586    APIRET    rc = NO_ERROR;
     587    USHORT    data,
     588              param;
     589
     590    name[0] = doshQueryBootDrive();
     591    rc = DosOpen(name,
     592                 &fd,
     593                 &action,
     594                 0,
     595                 0,
     596                 OPEN_ACTION_FAIL_IF_NEW
     597                          | OPEN_ACTION_OPEN_IF_EXISTS,
     598                 OPEN_FLAGS_DASD
     599                       | OPEN_FLAGS_FAIL_ON_ERROR
     600                       | OPEN_FLAGS_NOINHERIT
     601                       | OPEN_ACCESS_READONLY
     602                       | OPEN_SHARE_DENYNONE,
     603                 0);
     604    if (rc == NO_ERROR)
     605    {
     606        param = 0;
     607        data = (USHORT)ulLogicalDrive;
     608        paramsize = sizeof(param);
     609        datasize = sizeof(data);
     610        rc = DosDevIOCtl(fd,
     611                         IOCTL_DISK, DSK_SETLOGICALMAP,
     612                         &param, paramsize, &paramsize,
     613                         &data, datasize, &datasize);
     614        DosClose(fd);
     615    }
     616
     617    return(rc);
     618}
     619
     620/*
    525621 *@@ doshQueryDiskFree:
    526622 *       returns the number of bytes remaining on the disk
    527  *       specified by the given logical drive, or -1 upon errors.
     623 *       specified by the given logical drive.
    528624 *
    529625 *       Note: This returns a "double" value, because a ULONG
     
    532628 *
    533629 *@@changed V0.9.0 [umoeller]: fixed another > 4 GB bug (thanks to Rdiger Ihle)
    534  */
    535 
    536 double doshQueryDiskFree(ULONG ulLogicalDrive) // in: 1 for A:, 2 for B:, 3 for C:, ...
    537 {
     630 *@@changed V0.9.7 (2000-12-01) [umoeller]: changed prototype
     631 */
     632
     633APIRET doshQueryDiskFree(ULONG ulLogicalDrive, // in: 1 for A:, 2 for B:, 3 for C:, ...
     634                         double *pdFree)
     635{
     636    APIRET      arc = NO_ERROR;
    538637    FSALLOCATE  fsa;
    539638    double      dbl = -1;
    540639
    541     if (ulLogicalDrive)
    542         if (DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa))
    543                 == NO_ERROR)
    544             dbl = ((double)fsa.cSectorUnit * fsa.cbSector * fsa.cUnitAvail);
     640    arc = DosQueryFSInfo(ulLogicalDrive, FSIL_ALLOC, &fsa, sizeof(fsa));
     641    if (arc == NO_ERROR)
     642        *pdFree = ((double)fsa.cSectorUnit * fsa.cbSector * fsa.cUnitAvail);
    545643                   // ^ fixed V0.9.0
    546644
    547     return (dbl);
     645    return (arc);
    548646}
    549647
     
    779877
    780878/* ******************************************************************
    781  *                                                                  *
    782  *   File helpers                                                   *
    783  *                                                                  *
     879 *
     880 *   File helpers
     881 *
    784882 ********************************************************************/
    785883
     
    12261324
    12271325/* ******************************************************************
    1228  *                                                                  *
    1229  *   Directory helpers                                              *
    1230  *                                                                  *
     1326 *
     1327 *   Directory helpers
     1328 *
    12311329 ********************************************************************/
    12321330
     
    14591557
    14601558/*
     1559 *@@category: Helpers\Control program helpers\Performance (CPU load) helpers
     1560 */
     1561
     1562/* ******************************************************************
     1563 *
     1564 *   Performance Counters (CPU Load)
     1565 *
     1566 ********************************************************************/
     1567
     1568/*
     1569 *@@ doshPerfOpen:
     1570 *      initializes the OS/2 DosPerfSysCall API for
     1571 *      the calling thread.
     1572 *
     1573 *      Note: This API is not supported on all OS/2
     1574 *      versions. I believe it came up with some Warp 4
     1575 *      fixpak. The API is resolved dynamically by
     1576 *      this function (using DosQueryProcAddr). Only
     1577 *      if NO_ERROR is returned, you may call doshPerfGet
     1578 *      afterwards.
     1579 *
     1580 *      This properly initializes the internal counters
     1581 *      which the OS/2 kernel uses for this API. Apparently,
     1582 *      with newer kernels (FP13/14), IBM has chosen to no
     1583 *      longer do this automatically, which is the reason
     1584 *      why many "pulse" utilities display garbage with these
     1585 *      fixpaks.
     1586 *
     1587 *      After NO_ERROR is returned, DOSHPERFSYS.cProcessors
     1588 *      contains the no. of processors found on the system.
     1589 *      All pointers in DOSHPERFSYS then point to arrays
     1590 *      which have exactly cProcessors array items.
     1591 *
     1592 *      Call doshPerfClose to clean up resources allocated
     1593 *      by this function.
     1594 *
     1595 *      Example code:
     1596 *
     1597 +      PDOSHPERFSYS pPerf = NULL;
     1598 +      APIRET arc = doshPerfOpen(&pPerf);
     1599 +      if (arc == NO_ERROR)
     1600 +      {
     1601 +          // this should really be in a timer
     1602 +          ULONG   ulCPU;
     1603 +          arc = doshPerfGet(&pPerf);
     1604 +          // go thru all CPUs
     1605 +          for (ulCPU = 0; ulCPU < pPerf->cProcessors; ulCPU++)
     1606 +          {
     1607 +              LONG lLoadThis = pPerf->palLoads[ulCPU];
     1608 +              ...
     1609 +          }
     1610 +
     1611 +          ...
     1612 +
     1613 +          // clean up
     1614 +          doshPerfClose(&pPerf);
     1615 +      }
     1616 +
     1617 *
     1618 *@@added V0.9.7 (2000-12-02) [umoeller]
     1619 */
     1620
     1621APIRET doshPerfOpen(PDOSHPERFSYS *ppPerfSys)  // out: new DOSHPERFSYS structure
     1622{
     1623    APIRET  arc = NO_ERROR;
     1624
     1625    // allocate DOSHPERFSYS structure
     1626    *ppPerfSys = (PDOSHPERFSYS)malloc(sizeof(DOSHPERFSYS));
     1627    if (!*ppPerfSys)
     1628        arc = ERROR_NOT_ENOUGH_MEMORY;
     1629    else
     1630    {
     1631        // initialize structure
     1632        PDOSHPERFSYS pPerfSys = *ppPerfSys;
     1633        memset(pPerfSys, 0, sizeof(*pPerfSys));
     1634
     1635        // resolve DosPerfSysCall API entry
     1636        arc = DosLoadModule(NULL, 0, "DOSCALLS", &pPerfSys->hmod);
     1637        if (arc == NO_ERROR)
     1638        {
     1639            arc = DosQueryProcAddr(pPerfSys->hmod,
     1640                                   976,
     1641                                   "DosPerfSysCall",
     1642                                   (PFN*)(&pPerfSys->pDosPerfSysCall));
     1643            if (arc == NO_ERROR)
     1644            {
     1645                // OK, we got the API: initialize!
     1646                arc = pPerfSys->pDosPerfSysCall(CMD_KI_ENABLE, 0, 0, 0);
     1647                if (arc == NO_ERROR)
     1648                {
     1649                    pPerfSys->fInitialized = TRUE;
     1650                            // call CMD_KI_DISABLE later
     1651
     1652                    arc = pPerfSys->pDosPerfSysCall(CMD_PERF_INFO,
     1653                                                    0,
     1654                                                    (ULONG)(&pPerfSys->cProcessors),
     1655                                                    0);
     1656                    if (arc == NO_ERROR)
     1657                    {
     1658                        ULONG   ul = 0;
     1659
     1660                        // allocate arrays
     1661                        pPerfSys->paCPUUtils = (PCPUUTIL)calloc(pPerfSys->cProcessors,
     1662                                                                sizeof(CPUUTIL));
     1663                        if (!pPerfSys->paCPUUtils)
     1664                            arc = ERROR_NOT_ENOUGH_MEMORY;
     1665                        else
     1666                        {
     1667                            pPerfSys->padBusyPrev = (double*)malloc(pPerfSys->cProcessors * sizeof(double));
     1668                            if (!pPerfSys->padBusyPrev)
     1669                                arc = ERROR_NOT_ENOUGH_MEMORY;
     1670                            else
     1671                            {
     1672                                pPerfSys->padTimePrev
     1673                                    = (double*)malloc(pPerfSys->cProcessors * sizeof(double));
     1674                                if (!pPerfSys->padTimePrev)
     1675                                    arc = ERROR_NOT_ENOUGH_MEMORY;
     1676                                else
     1677                                {
     1678                                    pPerfSys->palLoads = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG));
     1679                                    if (!pPerfSys->palLoads)
     1680                                        arc = ERROR_NOT_ENOUGH_MEMORY;
     1681                                    else
     1682                                    {
     1683                                        for (ul = 0; ul < pPerfSys->cProcessors; ul++)
     1684                                        {
     1685                                            pPerfSys->padBusyPrev[ul] = 0.0;
     1686                                            pPerfSys->padTimePrev[ul] = 0.0;
     1687                                            pPerfSys->palLoads[ul] = 0;
     1688                                        }
     1689                                    }
     1690                                }
     1691                            }
     1692                        }
     1693                    }
     1694                }
     1695            } // end if (arc == NO_ERROR)
     1696        } // end if (arc == NO_ERROR)
     1697
     1698        if (arc != NO_ERROR)
     1699        {
     1700            doshPerfClose(ppPerfSys);
     1701        }
     1702    } // end else if (!*ppPerfSys)
     1703
     1704    return (arc);
     1705}
     1706
     1707/*
     1708 *@@ doshPerfGet:
     1709 *      calculates a current snapshot of the system load,
     1710 *      compared with the load which was calculated on
     1711 *      the previous call.
     1712 *
     1713 *      If you want to continually measure the system CPU
     1714 *      load, this is the function you will want to call
     1715 *      regularly -- e.g. with a timer once per second.
     1716 *
     1717 *      Call this ONLY if doshPerfOpen returned NO_ERROR,
     1718 *      or you'll get crashes.
     1719 *
     1720 *      If this call returns NO_ERROR, you get a LONG
     1721 *      CPU load for each CPU in the system in the
     1722 *      DOSHPERFSYS.palLoads array (in per-mille, 0-1000).
     1723 *
     1724 *      For example, if there are two CPUs, after this call,
     1725 *
     1726 *      -- DOSHPERFSYS.palLoads[0] contains the load of
     1727 *         the first CPU,
     1728 *
     1729 *      -- DOSHPERFSYS.palLoads[1] contains the load of
     1730 *         the second CPU.
     1731 *
     1732 *      See doshPerfOpen for example code.
     1733 *
     1734 *@@added V0.9.7 (2000-12-02) [umoeller]
     1735 */
     1736
     1737APIRET doshPerfGet(PDOSHPERFSYS pPerfSys)
     1738{
     1739    APIRET arc = NO_ERROR;
     1740    if (!pPerfSys->pDosPerfSysCall)
     1741        arc = ERROR_INVALID_PARAMETER;
     1742    else
     1743    {
     1744        arc = pPerfSys->pDosPerfSysCall(CMD_KI_RDCNT,
     1745                                        (ULONG)pPerfSys->paCPUUtils,
     1746                                        0, 0);
     1747        if (arc == NO_ERROR)
     1748        {
     1749            // go thru all processors
     1750            ULONG ul = 0;
     1751            for (; ul < pPerfSys->cProcessors; ul++)
     1752            {
     1753                PCPUUTIL    pCPUUtilThis = &pPerfSys->paCPUUtils[ul];
     1754
     1755                double      dTime = LL2F(pCPUUtilThis->ulTimeHigh,
     1756                                         pCPUUtilThis->ulTimeLow);
     1757                double      dBusy = LL2F(pCPUUtilThis->ulBusyHigh,
     1758                                         pCPUUtilThis->ulBusyLow);
     1759
     1760                double      *pdBusyPrevThis = &pPerfSys->padBusyPrev[ul];
     1761                double      *pdTimePrevThis = &pPerfSys->padTimePrev[ul];
     1762
     1763                // avoid division by zero
     1764                double      dTimeDelta = (dTime - *pdTimePrevThis);
     1765                if (dTimeDelta)
     1766                    pPerfSys->palLoads[ul]
     1767                        = (LONG)( (double)(   (dBusy - *pdBusyPrevThis)
     1768                                            / dTimeDelta
     1769                                            * 1000.0
     1770                                          )
     1771                                );
     1772                else
     1773                    pPerfSys->palLoads[ul] = 0;
     1774
     1775                *pdTimePrevThis = dTime;
     1776                *pdBusyPrevThis = dBusy;
     1777            }
     1778        }
     1779    }
     1780
     1781    return (arc);
     1782}
     1783
     1784/*
     1785 *@@ doshPerfClose:
     1786 *      frees all resources allocated by doshPerfOpen.
     1787 *
     1788 *@@added V0.9.7 (2000-12-02) [umoeller]
     1789 */
     1790
     1791APIRET doshPerfClose(PDOSHPERFSYS *ppPerfSys)
     1792{
     1793    APIRET arc = NO_ERROR;
     1794    PDOSHPERFSYS pPerfSys = *ppPerfSys;
     1795    if (!pPerfSys)
     1796        arc = ERROR_INVALID_PARAMETER;
     1797    else
     1798    {
     1799        if (pPerfSys->fInitialized)
     1800            pPerfSys->pDosPerfSysCall(CMD_KI_DISABLE,
     1801                                      0, 0, 0);
     1802
     1803        if (pPerfSys->paCPUUtils)
     1804            free(pPerfSys->paCPUUtils);
     1805        if (pPerfSys->padBusyPrev)
     1806            free(pPerfSys->padBusyPrev);
     1807        if (pPerfSys->padTimePrev)
     1808            free(pPerfSys->padTimePrev);
     1809
     1810        if (pPerfSys->hmod)
     1811            DosFreeModule(pPerfSys->hmod);
     1812        free(pPerfSys);
     1813        *ppPerfSys = NULL;
     1814    }
     1815
     1816    return (arc);
     1817}
     1818
     1819/*
    14611820 *@@category: Helpers\Control program helpers\Process management
    14621821 */
    14631822
    14641823/* ******************************************************************
    1465  *                                                                  *
    1466  *   Process helpers                                                *
    1467  *                                                                  *
     1824 *
     1825 *   Process helpers
     1826 *
    14681827 ********************************************************************/
    14691828
  • trunk/src/helpers/dosh2.c

    r8 r14  
    3030 *      This file Copyright (C) 1997-2000 Ulrich M”ller,
    3131 *                                        Dmitry A. Steklenev.
    32  *      This file is part of the XWorkplace source package.
    33  *      XWorkplace is free software; you can redistribute it and/or modify
     32 *      This file is part of the "XWorkplace helpers" source package.
     33 *      This is free software; you can redistribute it and/or modify
    3434 *      it under the terms of the GNU General Public License as published
    3535 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4646    // as unsigned char
    4747
     48#define INCL_DOSMODULEMGR
     49#define INCL_DOSPROCESS
     50#define INCL_DOSSESMGR
     51#define INCL_DOSQUEUES
     52#define INCL_DOSMISC
     53#define INCL_DOSDEVICES
    4854#define INCL_DOSDEVIOCTL
    49 #define INCL_DOS
    5055#define INCL_DOSERRORS
    51 // #define INCL_GPI
    5256#include <os2.h>
     57
    5358#include <stdlib.h>
    5459#include <string.h>
     
    6873
    6974/* ******************************************************************
    70  *                                                                  *
    71  *   Miscellaneous                                                  *
    72  *                                                                  *
     75 *
     76 *   Miscellaneous
     77 *
    7378 ********************************************************************/
    7479
     
    109114                           BOOL fFullyQualified)    // in: if TRUE, pcszFile must be fully q'fied
    110115{
     116    APIRET  arc = NO_ERROR;
    111117    CHAR    szPath[CCHMAXPATH+4] = " :";
    112118    CHAR    szComponent[CCHMAXPATH];
     
    120126             || (*(pcszFile + 2) != '\\')
    121127           )
    122             return (ERROR_CURRENT_DIRECTORY);
     128            arc = ERROR_CURRENT_DIRECTORY;
    123129    }
    124130
     
    127133    {
    128134        CHAR cDrive = toupper(*pcszFile);
     135        double d;
    129136        // drive specified:
    130137        strcpy(szPath, pcszFile);
    131138        szPath[0] = toupper(*pcszFile);
    132         if (doshQueryDiskFree(cDrive - 'A' + 1) == -1)
    133             return (ERROR_INVALID_DRIVE);
     139        arc = doshQueryDiskFree(cDrive - 'A' + 1, &d);
    134140    }
    135141    else
     
    138144        ULONG   ulDriveNum = 0,
    139145                ulDriveMap = 0;
    140         DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
     146        arc = DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
    141147        szPath[0] = ((UCHAR)ulDriveNum) + 'A' - 1;
    142148        szPath[1] = ':';
     
    144150    }
    145151
    146     fIsFAT = doshIsFileOnFAT(szPath);
    147 
    148     pszInvalid = (fIsFAT)
    149                     ? "<>|+=:;,\"/[] "  // invalid characters in FAT
    150                     : "<>|:\"/";        // invalid characters in IFS's
    151 
    152     // now separate path components
    153     p1 = &szPath[2];       // advance past ':'
    154 
    155     do {
    156 
    157         if (*p1 == '\\')
    158             p1++;
    159 
    160         p2 = strchr(p1, '\\');
    161         if (p2 == NULL)
    162             p2 = p1 + strlen(p1);
    163 
    164         if (p1 != p2)
    165         {
    166             LONG    lDotOfs = -1,
    167                     lAfterDot = -1;
    168             ULONG   cbFile,
    169                     ul;
    170             PSZ     pSource = szComponent;
    171 
    172             strncpy(szComponent, p1, p2-p1);
    173             szComponent[p2-p1] = 0;
    174             cbFile = strlen(szComponent);
    175 
    176             // now check each path component
    177             for (ul = 0; ul < cbFile; ul++)
     152    if (arc == NO_ERROR)
     153    {
     154        fIsFAT = doshIsFileOnFAT(szPath);
     155
     156        pszInvalid = (fIsFAT)
     157                        ? "<>|+=:;,\"/[] "  // invalid characters in FAT
     158                        : "<>|:\"/";        // invalid characters in IFS's
     159
     160        // now separate path components
     161        p1 = &szPath[2];       // advance past ':'
     162
     163        do {
     164
     165            if (*p1 == '\\')
     166                p1++;
     167
     168            p2 = strchr(p1, '\\');
     169            if (p2 == NULL)
     170                p2 = p1 + strlen(p1);
     171
     172            if (p1 != p2)
    178173            {
     174                LONG    lDotOfs = -1,
     175                        lAfterDot = -1;
     176                ULONG   cbFile,
     177                        ul;
     178                PSZ     pSource = szComponent;
     179
     180                strncpy(szComponent, p1, p2-p1);
     181                szComponent[p2-p1] = 0;
     182                cbFile = strlen(szComponent);
     183
     184                // now check each path component
     185                for (ul = 0; ul < cbFile; ul++)
     186                {
     187                    if (fIsFAT)
     188                    {
     189                        // on FAT: only 8 characters allowed before dot
     190                        if (*pSource == '.')
     191                        {
     192                            lDotOfs = ul;
     193                            lAfterDot = 0;
     194                            if (ul > 7)
     195                                return (ERROR_FILENAME_EXCED_RANGE);
     196                        }
     197                    }
     198                    // and check for invalid characters
     199                    if (strchr(pszInvalid, *pSource) != NULL)
     200                        return (ERROR_INVALID_NAME);
     201
     202                    pSource++;
     203
     204                    // on FAT, allow only three chars after dot
     205                    if (fIsFAT)
     206                        if (lAfterDot != -1)
     207                        {
     208                            lAfterDot++;
     209                            if (lAfterDot > 3)
     210                                return (ERROR_FILENAME_EXCED_RANGE);
     211                        }
     212                }
     213
     214                // we are still missing the case of a FAT file
     215                // name without extension; if so, check whether
     216                // the file stem is <= 8 chars
    179217                if (fIsFAT)
    180                 {
    181                     // on FAT: only 8 characters allowed before dot
    182                     if (*pSource == '.')
    183                     {
    184                         lDotOfs = ul;
    185                         lAfterDot = 0;
    186                         if (ul > 7)
     218                    if (lDotOfs == -1)  // dot not found:
     219                        if (cbFile > 8)
    187220                            return (ERROR_FILENAME_EXCED_RANGE);
    188                     }
    189                 }
    190                 // and check for invalid characters
    191                 if (strchr(pszInvalid, *pSource) != NULL)
    192                     return (ERROR_INVALID_NAME);
    193 
    194                 pSource++;
    195 
    196                 // on FAT, allow only three chars after dot
    197                 if (fIsFAT)
    198                     if (lAfterDot != -1)
    199                     {
    200                         lAfterDot++;
    201                         if (lAfterDot > 3)
    202                             return(ERROR_FILENAME_EXCED_RANGE);
    203                     }
    204221            }
    205222
    206             // we are still missing the case of a FAT file
    207             // name without extension; if so, check whether
    208             // the file stem is <= 8 chars
    209             if (fIsFAT)
    210                 if (lDotOfs == -1)  // dot not found:
    211                     if (cbFile > 8)
    212                         return (ERROR_FILENAME_EXCED_RANGE);
    213         }
    214 
    215         // go for next component
    216         p1 = p2+1;
    217     } while (*p2);
    218 
    219     return (NO_ERROR);
     223            // go for next component
     224            p1 = p2+1;
     225        } while (*p2);
     226    }
     227
     228    return (arc);
    220229}
    221230
     
    340349
    341350/* ******************************************************************
    342  *                                                                  *
    343  *   Environment helpers                                            *
    344  *                                                                  *
     351 *
     352 *   Environment helpers
     353 *
    345354 ********************************************************************/
    346355
     
    716725
    717726/* ******************************************************************
    718  *                                                                  *
    719  *   Module handling helpers                                        *
    720  *                                                                  *
     727 *
     728 *   Module handling helpers
     729 *
    721730 ********************************************************************/
    722731
     
    773782
    774783/********************************************************************
    775  *                                                                  *
    776  *   Executable functions                                           *
    777  *                                                                  *
     784 *
     785 *   Executable functions
     786 *
    778787 ********************************************************************/
    779788
     
    12191228
    12201229/********************************************************************
    1221  *                                                                  *
    1222  *   Partition functions                                            *
    1223  *                                                                  *
     1230 *
     1231 *   Partition functions
     1232 *
    12241233 ********************************************************************/
    12251234
  • trunk/src/helpers/eah.c

    r8 r14  
    6767 *      Copyright (C) 1995 Massachusetts Institute of Technology.
    6868 *      Copyright (C) 1997-2000 Ulrich M”ller.
    69  *      This file is part of the XWorkplace source package.
    70  *      XWorkplace is free software; you can redistribute it and/or modify
     69 *      This file is part of the "XWorkplace helpers" source package.
     70 *      This is free software; you can redistribute it and/or modify
    7171 *      it under the terms of the GNU General Public License as published
    7272 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8383    // as unsigned char
    8484
    85 #define INCL_DOS
     85#define INCL_DOSFILEMGR
    8686#define INCL_DOSERRORS
    8787#include <os2.h>
     
    101101
    102102/********************************************************************
    103  *                                                                  *
    104  *   Extended Attribute handling                                    *
    105  *                                                                  *
     103 *
     104 *   Extended Attribute handling
     105 *
    106106 ********************************************************************/
    107107
     
    173173
    174174/* ******************************************************************
    175  *                                                                  *
    176  *   Read-EA functions                                              *
    177  *                                                                  *
     175 *
     176 *   Read-EA functions
     177 *
    178178 ********************************************************************/
    179179
     
    196196 */
    197197
    198 ULONG eaPathQueryTotalSize(PSZ pszPath)
     198ULONG eaPathQueryTotalSize(const char *pcszPath)
    199199{
    200200    APIRET  arc;
     
    202202    FILEFINDBUF4   ffb4;
    203203
    204     _Pmpf(("eaPathQueryTotalSize %s", pszPath));
    205 
    206     arc = DosQueryPathInfo(pszPath,
     204    arc = DosQueryPathInfo((PSZ)pcszPath,
    207205                           FIL_QUERYEASIZE,
    208206                           &ffb4,
     
    220218
    221219        arc = DosEnumAttribute(ENUMEA_REFTYPE_PATH,
    222                                pszPath,
     220                               (PSZ)pcszPath,
    223221                               1,
    224222                               abBuf,
     
    230228        pdena2 = (PDENA2)abBuf;
    231229
    232         _Pmpf(("  %s: arc = %d, count = %d", pszPath, arc, lCount));
    233 
    234230        if (lCount > 0)
    235231        {
     
    247243    }
    248244
    249     _Pmpf(("    %s: total %d", pszPath, ulTotalEASize));
    250 
    251245    return (ulTotalEASize);
    252246}
     
    259253 */
    260254
    261 PEALIST eaPathReadAll(PSZ path)
    262 {
    263     return (ReadEAList(ENUMEA_REFTYPE_PATH, path));
     255PEALIST eaPathReadAll(const char *pcszPath)
     256{
     257    return (ReadEAList(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath));
    264258}
    265259
     
    283277 */
    284278
    285 PEABINDING eaPathReadOneByIndex(PSZ path, ULONG index)
    286 {
    287     return (ReadEAByIndex(ENUMEA_REFTYPE_PATH, path, index));
     279PEABINDING eaPathReadOneByIndex(const char *pcszPath, ULONG index)
     280{
     281    return (ReadEAByIndex(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, index));
    288282}
    289283
     
    305299 */
    306300
    307 PEABINDING eaPathReadOneByName(PSZ path, PSZ name)
    308 {
    309     return (ReadEAByName(ENUMEA_REFTYPE_PATH, path, name));
     301PEABINDING eaPathReadOneByName(const char *pcszPath, const char *pcszEAName)
     302{
     303    return (ReadEAByName(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, (PSZ)pcszEAName));
    310304}
    311305
     
    315309 */
    316310
    317 PEABINDING eaHFileReadOneByName(HFILE hfile, PSZ name)
    318 {
    319     return (ReadEAByName(ENUMEA_REFTYPE_FHANDLE, (&hfile), name));
     311PEABINDING eaHFileReadOneByName(HFILE hfile, const char *pcszEAName)
     312{
     313    return (ReadEAByName(ENUMEA_REFTYPE_FHANDLE, (&hfile), (PSZ)pcszEAName));
    320314}
    321315
    322316/* ******************************************************************
    323  *                                                                  *
    324  *   Write-EA functions                                             *
    325  *                                                                  *
     317 *
     318 *   Write-EA functions
     319 *
    326320 ********************************************************************/
    327321
     
    335329 *      field is 0; only in that case, the EABINDING.value
    336330 *      field may also be NULL.
    337  */
    338 
    339 void eaPathWriteAll(PSZ path, PEALIST list)
    340 {
    341     WriteEAList(ENUMEA_REFTYPE_PATH, path, list);
     331 *
     332 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     333 */
     334
     335APIRET eaPathWriteAll(const char *pcszPath, PEALIST list)
     336{
     337    return (WriteEAList(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, list));
    342338}
    343339
     
    345341 *@@ eaHFileWriteAll:
    346342 *      like eaPathWriteAll, but for an open file handle.
    347  */
    348 
    349 void eaHFileWriteAll(HFILE hfile, PEALIST list)
    350 {
    351     WriteEAList(ENUMEA_REFTYPE_FHANDLE, (&hfile), list);
     343 *
     344 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     345 */
     346
     347APIRET eaHFileWriteAll(HFILE hfile, PEALIST list)
     348{
     349    return (WriteEAList(ENUMEA_REFTYPE_FHANDLE, (&hfile), list));
    352350}
    353351
     
    362360 *
    363361 *      To delete an EA, you may also use eaPathDeleteOne.
    364  */
    365 
    366 void eaPathWriteOne(PSZ path, PEABINDING peab)
    367 {
    368     WriteEA(ENUMEA_REFTYPE_PATH, path, peab);
     362 *
     363 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     364 */
     365
     366APIRET eaPathWriteOne(const char *pcszPath, PEABINDING peab)
     367{
     368    return (WriteEA(ENUMEA_REFTYPE_PATH, (PSZ)pcszPath, peab));
    369369}
    370370
     
    372372 *@@ eaHFileWriteOne:
    373373 *      like eaPathWriteOne, but for an open file handle.
    374  */
    375 
    376 void eaHFileWriteOne(HFILE hfile, PEABINDING peab)
    377 {
    378     WriteEA(ENUMEA_REFTYPE_FHANDLE, (&hfile), peab);
     374 *
     375 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     376 */
     377
     378APIRET eaHFileWriteOne(HFILE hfile, PEABINDING peab)
     379{
     380    return (WriteEA(ENUMEA_REFTYPE_FHANDLE, (&hfile), peab));
    379381}
    380382
     
    386388 *
    387389 *@@added V0.9.0 [umoeller]
    388  */
    389 
    390 void eaPathDeleteOne(PSZ path, PSZ pszEAName)
     390 *@@changed V0.9.7 (2000-11-30) [umoeller]: now returning APIRET
     391 */
     392
     393APIRET eaPathDeleteOne(const char *pcszPath, const char *pcszEAName)
    391394{
    392395    EABINDING eab;
    393396    eab.bFlags = 0;
    394     eab.bNameLength = strlen(pszEAName);
    395     eab.pszName = pszEAName;
     397    eab.bNameLength = strlen(pcszEAName);
     398    eab.pszName = (PSZ)pcszEAName;
    396399    eab.usValueLength = 0;
    397400    eab.pszValue = 0;
    398     eaPathWriteOne(path, &eab);
     401    return (eaPathWriteOne(pcszPath, &eab));
    399402}
    400403
     
    404407
    405408/********************************************************************
    406  *                                                                  *
    407  *   Translation funcs                                              *
    408  *                                                                  *
     409 *
     410 *   Translation funcs
     411 *
    409412 ********************************************************************/
    410413
     
    484487 */
    485488
    486 PEABINDING eaCreateBindingFromPSZ(PSZ pszEAName,    // in: EA name (e.g. ".LONGNAME")
    487                                   PSZ pszString)     // in: string for EAT_ASCII EA
     489PEABINDING eaCreateBindingFromPSZ(const char *pcszEAName, // in: EA name (e.g. ".LONGNAME")
     490                                  const char *pcszInput)  // in: string for EAT_ASCII EA
    488491{
    489492    PEABINDING peab = (PEABINDING)malloc(sizeof(EABINDING));
     
    491494    {
    492495        SHORT cbString = 0;
    493         if (pszString)
    494             cbString = strlen(pszString);
     496        if (pcszInput)
     497            cbString = strlen(pcszInput);
    495498
    496499        peab->bFlags = 0;
    497         peab->bNameLength = strlen(pszEAName);
    498         peab->pszName = strdup(pszEAName);
     500        peab->bNameLength = strlen(pcszEAName);
     501        peab->pszName = strdup(pcszEAName);
    499502
    500503        if (cbString)
     
    510513                *((PUSHORT)(peab->pszValue + 2)) = cbString;
    511514                // copy string to byte 4 (no null-terminator)
    512                 memcpy(peab->pszValue + 4, pszString, cbString);
     515                memcpy(peab->pszValue + 4, pcszInput, cbString);
    513516            }
    514517            else
     
    743746
    744747PSZ eaCreatePSZFromMVBinding(PEABINDING peab,       // in: EAT_MVMT binding
    745                              PSZ     pszSeparator,  // in: null-terminated string used as separator
     748                             const char *pcszSeparator,  // in: null-terminated string used as separator
    746749                             PUSHORT pusCodepage)   // out: codepage found in binding (ptr can be NULL)
    747750{
     
    765768            USHORT  us = 0;
    766769            USHORT  cbComment = 0;
    767             USHORT  cbSeparator = strlen(pszSeparator);
     770            USHORT  cbSeparator = strlen(pcszSeparator);
    768771            while (us < usMVCount)
    769772            {
     
    794797                            // append separator
    795798                            memcpy(pszTotal + cbCommentOld,
    796                                    pszSeparator,
     799                                   pcszSeparator,
    797800                                   cbSeparator);
    798801                            // copy the rest after the separator (below)
     
    846849 */
    847850
    848 PEABINDING eaCreateMVBindingFromPSZ(PSZ pszEAName,      // in: EA name (e.g. ".KEYPHRASES")
    849                                     PSZ pszInput,       // in: string to parse
    850                                     PSZ pszSeparator,   // in: separator used in pszInput
     851PEABINDING eaCreateMVBindingFromPSZ(const char *pcszEAName,      // in: EA name (e.g. ".KEYPHRASES")
     852                                    const char *pcszInput,       // in: string to parse
     853                                    const char *pcszSeparator,   // in: separator used in pszInput
    851854                                    USHORT usCodepage)  // in: codepage to set in EAT_MVMT
    852855{
    853856    PEABINDING peab;
    854     if (pszInput)
     857    if (pcszInput)
    855858    {
    856859        peab = (PEABINDING)malloc(sizeof(EABINDING));
    857860        if (peab)
    858861        {
    859             PSZ     p = pszInput,
    860                     pSource,
    861                     pTarget;
    862             USHORT  cbInput = strlen(pszInput),
    863                     cbSep = strlen(pszSeparator),
     862            const char *p = pcszInput,
     863                    *pSource;
     864            PSZ     pTarget;
     865            USHORT  cbInput = strlen(pcszInput),
     866                    cbSep = strlen(pcszSeparator),
    864867                    usSepCount = 0,
    865868                    cbToAlloc = 0,
     
    868871
    869872            peab->bFlags = 0;
    870             peab->bNameLength = strlen(pszEAName);
    871             peab->pszName = strdup(pszEAName);
     873            peab->bNameLength = strlen(pcszEAName);
     874            peab->pszName = strdup(pcszEAName);
    872875
    873876            // now count the number of pszSeparators in pszInput
    874             while ((p = strstr(p, pszSeparator)))
     877            while ((p = strstr(p, pcszSeparator)))
    875878            {
    876879                usSepCount++;
     
    898901
    899902            // set pointer to first field
    900             pSource = pszInput;
     903            pSource = pcszInput;
    901904            pTarget = peab->pszValue + 6;
    902905
     
    907910            {
    908911                // find the next separator
    909                 PSZ     pNextSep = strstr(pSource, pszSeparator);
     912                PSZ     pNextSep = strstr(pSource, pcszSeparator);
    910913                // calculate the length of the substring
    911914                cbThis = pNextSep - pSource;
     
    934937
    935938/********************************************************************
    936  *                                                                  *
    937  *   EA helper funcs                                                *
    938  *                                                                  *
     939 *
     940 *   EA helper funcs
     941 *
    939942 ********************************************************************/
    940943
     
    12171220
    12181221/* ******************************************************************
    1219  *                                                                  *
    1220  *   Direct plain-string EA handling                                *
    1221  *                                                                  *
     1222 *
     1223 *   Direct plain-string EA handling
     1224 *
    12221225 ********************************************************************/
    12231226
  • trunk/src/helpers/except.c

    r13 r14  
    33 *@@sourcefile except.c:
    44 *      this file contains powerful exception handlers.
     5 *      except.h also defines easy-to-use macros for them.
    56 *
    67 *      Usage: All OS/2 programs, PM or text mode.
    78 *
    8  *      <B>except.h macros</B>
    9  *
    10  *      except.h declares a few handy macros to easily install
    11  *      exception handling for a section of code.
    12  *
    13  *      These macros automatically insert code for properly
    14  *      registering and deregistering the handlers. You should
    15  *      ALWAYS use these macros instead of directly registering
     9 *      <B>Introduction</B>
     10 *
     11 *      OS/2 exception handlers are a mess to program and,
     12 *      if installed wrongly, almost impossible to debug.
     13 *      The problem is that for any program that does a bit
     14 *      more than showing a message box, using exception
     15 *      handlers is a must to avoid system hangs. This
     16 *      especially applies to multi-thread programs using
     17 *      mutex semaphores (more on that below). The functions
     18 *      and macros in here are designed to make that more simple.
     19 *
     20 *      The macros in except.h automatically insert code for properly
     21 *      registering and deregistering the handlers in except.c. You
     22 *      should ALWAYS use these macros instead of directly registering
    1623 *      the handlers to avoid accidentally forgetting to deregister
    1724 *      them. If you forget to deregister an exception handler, this
     
    2027 *      might get completely messed up.
    2128 *
    22  *      The general idea of these macros is to define
    23  *      TRY / CATCH blocks similar to C++. If an exception
    24  *      occurs in the TRY block, execution is transferred
    25  *      to the CATCH block. (This works in both C and C++,
    26  *      by the way.)
    27  *
    28  *      In addition, with the TRY statement, you may specify
    29  *      an optional "OnKill" function which gets called if
    30  *      the thread gets killed while code in the TRY block is
    31  *      executed (new with V0.9.0). If you need no such
    32  *      function, specify NULL. Details follow.
     29 *      The general idea of these macros is to define TRY / CATCH
     30 *      blocks similar to C++. If an exception occurs in the TRY block,
     31 *      execution is transferred to the CATCH block. (This works in both
     32 *      C and C++, by the way.)
     33 *
     34 *      The "OnKill" function that was added with V0.9.0 has been
     35 *      removed again with V0.9.7. Use DosEnterMustComplete instead.
     36 *      Details follow.
    3337 *
    3438 *      The general usage is like this:
     
    3640 +          int your_protected_func(int ...)
    3741 +          {
    38  +              TRY_LOUD(excptid, OnKillFunc)
    39  +              // or: TRY_QUIET(excptid, OnKillFunc)
    40  +              // OnKillFunc can be NULL
     42 +              TRY_LOUD(excptid)         // or: TRY_QUIET(excptid)
    4143 +              {
    4244 +                  ....        // the stuff in here is protected by
     
    5052 +          } // end of your_func
    5153 *
    52  *      TRY_LOUD  is for excHandlerLoud (see below).
    53  *      TRY_QUIET is for excHandlerQuiet (see below).
     54 *      TRY_LOUD  is for installing excHandlerLoud.
     55 *      TRY_QUIET is for installing excHandlerQuiet.
    5456 *      CATCH / END_CATCH are the same for the two. This
    5557 *      is where the exception handler jumps to if an
     
    5860 *      in there.
    5961 *
    60  *      "excptid" can be any identifier which is not used in
     62 *      "excptid" can be any C identifier which is not used in
    6163 *      your current variable scope, e.g. "excpt1". This
    6264 *      is used for creating an EXCEPTSTRUCT variable of
     
    6567 *      store the exception handler data.
    6668 *
    67  *      It is possible to nest these handlers though. You
    68  *      must use different "excptid"'s only if more than one
    69  *      TRY_* block exists in the same variable scope. Avoid
    70  *      using gotos to jump between the different CATCH blocks,
    71  *      because this might not properly deregister the handlers.
     69 *      These macros may be nested if you use different
     70 *      "excptid"'s for sub-macros.
     71 *
     72 *      Inside the TRY and CATCH blocks, you must not use
     73 *      "goto" (to a location outside the block) or "return",
     74 *      because this will not deregister the handler.
    7275 *
    7376 *      Keep in mind that all the code in the TRY_* block is
     
    7679 *      TRY_* block, your entire application is protected.
    7780 *
    78  *      Your "OnKillFunc" must be declared as
    79  +          VOID APIENTRY YourOnKillFunc(VOID) {...}.
    80  *      This gets called when the thread gets terminated
    81  *      while being executed in the TRY block (that is,
    82  *      if either the thread gets killed explicitly or
    83  *      the entire process ends for some reason). After
    84  *      that function got executed, the thread will _always_
    85  *      be terminated; the CATCH block will not be executed
    86  *      then. You can specify NULL for the "OnKillFunc", if
    87  *      you don't need one.
    88  *
    89  *      To summarize: If an exception occurs in the TRY
    90  *      block,
    91  *
    92  *      a) "OnKillFunc" gets called if the thread got
    93  *         killed, and the thread then terminates;
    94  *
    95  *      b) the CATCH block is executed for other exceptions
    96  *         and execution continues.
     81 *      <B>Asynchronous exceptions</B>
     82 *
     83 *      The exception handlers in this file (which are installed
     84 *      with the TRY/CATCH mechanism) only intercept synchronous
     85 *      exceptions (see excHandlerLoud for a list). They do not
     86 *      protect your code against asynchronous exceptions.
     87 *
     88 *      OS/2 defines asynchronous exceptions to be those that
     89 *      can be delayed. With OS/2, there are only three of these:
     90 *
     91 *      -- XCPT_PROCESS_TERMINATE
     92 *      -- XCPT_ASYNC_PROCESS_TERMINATE
     93 *      -- XCPT_SIGNAL (thread 1 only)
     94 *
     95 *      To protect yourself against these also, put the section
     96 *      in question in a DosEnterMustComplete/DosExitMustComplete
     97 *      block as well.
    9798 *
    9899 *      <B>Mutex semaphores</B>
    99100 *
    100  *      Here's how to deal with mutex semaphores: WHENEVER
    101  *      you request a mutex semaphore, enclose the block
    102  *      with TRY/CATCH in case an error occurs, like this:
     101 *      The problem with OS/2 mutex semaphores is that they are
     102 *      not automatically released when a thread terminates.
     103 *      If the thread owning the mutex died without releasing
     104 *      the mutex, other threads which are blocked on that mutex
     105 *      will wait forever and become zombie threads. Even worse,
     106 *      if this happens to a PM thread, this will hang the system.
     107 *
     108 *      Here's the typical scenario with two threads:
     109 *
     110 *      1)  Thread 2 requests a mutex and does lots of processing.
     111 *
     112 *      2)  Thread 1 requests the mutex. Since it's still owned
     113 *          by thread 2, thread 1 blocks.
     114 *
     115 *      3)  Thread 2 crashes in its processing. Without an
     116 *          exception handler, OS/2 will terminate the process.
     117 *          It will first kill thread 2 and then attempt to
     118 *          kill thread 1. This fails because it is still
     119 *          blocking on the semaphore that thread 2 never
     120 *          released. Boom.
     121 *
     122 *      The same scenario happens when a process gets killed.
     123 *      Since OS/2 will kill secondary threads before thread 1,
     124 *      the same situation can arise.
     125 *
     126 *      As a result, you must protect any section of code which
     127 *      requests a semaphore _both_ against crashes _and_
     128 *      termination.
     129 *
     130 *      So _whenever_ you request a mutex semaphore, enclose
     131 *      the block with TRY/CATCH in case the code crashes.
     132 *      Besides, enclose the TRY/CATCH block in a must-complete
     133 *      section, like this:
    103134 *
    104135 +          HMTX hmtx = ...
    105  +
    106  +          VOID APIENTRY OnKillYourFunc(VOID)
    107  +          {
    108  +              DosReleaseMutexSem(hmtx);
    109  +          }
    110136 +
    111137 +          int your_func(int)
    112138 +          {
    113  +              BOOL fSemOwned = FALSE;
     139 +              BOOL    fSemOwned = FALSE;
     140 +              ULONG   ulNesting = 0;
     141 +
     142 +              DosEnterMustComplete(&ulNesting);
    114143 +              TRY_QUIET(excpt1, OnKillYourFunc) // or TRY_LOUD
    115144 +              {
     
    126155 +                  fSemOwned = FALSE;
    127156 +              }
     157 +              DosExitMustComplete(&ulNesting);
    128158 +          } // end of your_func
    129159 *
    130  *      This way your mutex semaphore gets released even if
    131  *      exceptions occur in your code. If you don't do this,
    132  *      threads waiting for that semaphore will be blocked
    133  *      forever when exceptions occur. As a result, depending
    134  *      on the thread, PM will hang, or the application will
    135  *      never terminate.
     160 *      This way your mutex semaphore gets released in every
     161 *      possible condition.
    136162 *
    137163 *      <B>Customizing</B>
    138164 *
    139  *      Note: As opposed to versions < 0.9.0, this is now
     165 *      As opposed to versions before 0.9.0, this code is now
    140166 *      completely independent of XWorkplace. This file now
    141167 *      contains "pure" exception handlers only.
     
    146172 *      If excRegisterHooks is not called, the following safe
    147173 *      defaults are used:
     174 *
    148175 *          --  the trap log file is TRAP.LOG in the root
    149176 *              directory of your boot drive.
     
    182209 *                                      John Currier,
    183210 *                                      Anthony Cruise.
    184  *      This file is part of the XWorkplace source package.
    185  *      XWorkplace is free software; you can redistribute it and/or modify
     211 *      This file is part of the "XWorkplace helpers" source package.
     212 *      This is free software; you can redistribute it and/or modify
    186213 *      it under the terms of the GNU General Public License as published
    187214 *      by the Free Software Foundation, in version 2 as it comes in the
     
    223250
    224251/* ******************************************************************
    225  *                                                                  *
    226  *   Global variables                                               *
    227  *                                                                  *
     252 *
     253 *   Global variables
     254 *
    228255 ********************************************************************/
    229256
     
    240267
    241268/* ******************************************************************
    242  *                                                                  *
    243  *   Exception helper routines                                      *
    244  *                                                                  *
     269 *
     270 *   Exception helper routines
     271 *
    245272 ********************************************************************/
    246273
     
    490517        case XCPT_ACCESS_VIOLATION:
    491518        {
    492             fprintf(file, "\nAccess violation: ");
     519            fprintf(file, "\nXCPT_ACCESS_VIOLATION: ");
    493520            if (pReportRec->ExceptionInfo[0] & XCPT_READ_ACCESS)
    494521                fprintf(file, "Invalid read access from 0x%04lX:%08lX.\n",
     
    516543        case XCPT_INTEGER_DIVIDE_BY_ZERO:
    517544        {
    518             fprintf(file, "\nInteger division by zero.\n");
     545            fprintf(file, "\nXCPT_INTEGER_DIVIDE_BY_ZERO.\n");
    519546            fprintf(file,
    520547                    "Explanation: An attempt was made to divide an integer value by zero,\n"
     
    525552        case XCPT_ILLEGAL_INSTRUCTION:
    526553        {
    527             fprintf(file, "\nIllegal instruction found.\n");
     554            fprintf(file, "\nXCPT_ILLEGAL_INSTRUCTION.\n");
    528555            fprintf(file,
    529556                    "Explanation: An attempt was made to execute an instruction that\n"
     
    534561        case XCPT_PRIVILEGED_INSTRUCTION:
    535562        {
    536             fprintf(file, "\nPrivileged instruction found.\n");
     563            fprintf(file, "\nXCPT_PRIVILEGED_INSTRUCTION.\n");
    537564            fprintf(file,
    538565                    "Explanation: An attempt was made to execute an instruction that\n"
     
    543570
    544571        case XCPT_INTEGER_OVERFLOW:
    545             fprintf(file, "\nInteger overflow.\n");
     572            fprintf(file, "\nXCPT_INTEGER_OVERFLOW.\n");
    546573            fprintf(file,
    547574                    "Explanation: An integer operation generated a carry-out of the most\n"
    548575                    "             significant bit. This is a sign of an attempt to store\n"
    549576                    "             a value which does not fit into an integer variable.\n");
     577
     578        default:
     579            fprintf(file, "\nUnknown OS/2 exception number %d.\n", pReportRec->ExceptionNum);
     580            fprintf(file, "Look this up in the OS/2 header files.\n");
    550581    }
    551582
     
    700731
    701732/* ******************************************************************
    702  *                                                                  *
    703  *   Exported routines                                              *
    704  *                                                                  *
     733 *
     734 *   Exported routines
     735 *
    705736 ********************************************************************/
    706737
     
    722753 *      The hooks are as follows:
    723754 *
    724  *      pfnExcOpenFileNew gets called to open
     755 *      --  pfnExcOpenFileNew gets called to open
    725756 *          the trap log file. This must return a FILE*
    726757 *          pointer from fopen(). If this is not defined,
     
    729760 *          into it before the actual exception info.
    730761 *
    731  *      pfnExcHookNew gets called while the trap log
     762 *      --  pfnExcHookNew gets called while the trap log
    732763 *          is being written. At this point,
    733764 *          the following info has been written into
     
    743774 *          Use this hook to write additional application
    744775 *          info into the trap log, such as the state
    745  *          of your threads.
    746  *
    747  *      pfnExcHookError gets called when the TRY_* macros
     776 *          of your own threads and mutexes.
     777 *
     778 *      --  pfnExcHookError gets called when the TRY_* macros
    748779 *          fail to install an exception handler (when
    749  *          DosSetExceptionHandler fails).
     780 *          DosSetExceptionHandler fails). I've never seen
     781 *          this happen.
    750782 *
    751783 *@@added V0.9.0 [umoeller]
     
    772804 *      to the thread to continue execution, i.e. the
    773805 *      default OS/2 exception handler will never get
    774  *      called. This requires a setjmp() call on
     806 *      called.
     807 *
     808 *      This requires a setjmp() call on
    775809 *      EXCEPTIONREGISTRATIONRECORD2.jmpThread before
    776  *      being installed.
    777  *
    778  *      This is best registered thru the TRY_LOUD macro
    779  *      (new with V0.84, described in except.c), which
    780  *      does the necessary setup.
    781  *
    782  *      Depending on the type of exception, the following
    783  *      happens:
    784  *
    785  *      <B>a) "real" exceptions</B>
     810 *      being installed. The TRY_LOUD macro will take
     811 *      care of this for you (see except.c).
     812 *
     813 *      This intercepts the following exceptions (see
     814 *      the OS/2 Control Program Reference for details):
    786815 *
    787816 *      --  XCPT_ACCESS_VIOLATION         (traps 0x0d, 0x0e)
     
    795824 *      what source code corresponds to the error.
    796825 *
     826 *      See excRegisterHooks for the default setup of this.
     827 *
    797828 *      Note that to get meaningful debugging information
    798829 *      in this handler's traplog, you need the following:
     830 *
    799831 *      a)  have a MAP file created at link time (/MAP)
     832 *
    800833 *      b)  convert the MAP to a SYM file using MAPSYM
     834 *
    801835 *      c)  put the SYM file in the same directory of
    802  *          the executable. This must have the same
    803  *          filestem as the executable.
    804  *
    805  *      See the "Control Programming Guide and Reference"
    806  *      for details.
     836 *          the module (EXE or DLL). This must have the
     837 *          same filestem as the module.
     838 *
    807839 *      All other exceptions are passed to the next handler
    808840 *      in the exception handler chain. This might be the
    809841 *      C/C++ compiler handler or the default OS/2 handler,
    810842 *      which will probably terminate the process.
    811  *
    812  *      <B>b) thread kills</B>
    813  *
    814  *      -- XCPT_PROCESS_TERMINATE
    815  *      -- XCPT_ASYNC_PROCESS_TERMINATE:
    816  *
    817  *      If EXCEPTIONREGISTRATIONRECORD2.pfnOnKill is != NULL,
    818  *      that function gets called to allow for thread cleanup
    819  *      before the thread really terminates. This should be
    820  *      used for releasing mutex semaphores.
    821843 *
    822844 *@@changed V0.9.0 [umoeller]: added support for thread termination
     
    852874    switch (pReportRec->ExceptionNum)
    853875    {
    854         case XCPT_PROCESS_TERMINATE:
     876        /* case XCPT_PROCESS_TERMINATE:
    855877        case XCPT_ASYNC_PROCESS_TERMINATE:
    856878            // thread terminated:
     
    859881            if (pRegRec2->pfnOnKill)
    860882                // call the "OnKill" function
    861                 pRegRec2->pfnOnKill();
     883                pRegRec2->pfnOnKill(pRegRec2);
    862884            // get outta here, which will kill the thread
    863         break;
     885        break; */
    864886
    865887        case XCPT_ACCESS_VIOLATION:
     
    867889        case XCPT_ILLEGAL_INSTRUCTION:
    868890        case XCPT_PRIVILEGED_INSTRUCTION:
     891        case XCPT_INVALID_LOCK_SEQUENCE:
    869892        case XCPT_INTEGER_OVERFLOW:
    870893        {
     
    924947 *      this is useful for certain error-prone functions, where
    925948 *      exceptions are likely to appear, for example used by
    926  *      cmnCheckObject to implement a fail-safe SOM object check.
     949 *      wpshCheckObject to implement a fail-safe SOM object check.
    927950 *
    928951 *      This does _not_ write an error log and makes _no_ sound.
     
    953976    switch (pReportRec->ExceptionNum)
    954977    {
    955         case XCPT_PROCESS_TERMINATE:
     978        /* case XCPT_PROCESS_TERMINATE:
    956979        case XCPT_ASYNC_PROCESS_TERMINATE:
    957980            // thread terminated:
     
    960983            if (pRegRec2->pfnOnKill)
    961984                // call the "OnKill" function
    962                 pRegRec2->pfnOnKill();
     985                pRegRec2->pfnOnKill(pRegRec2);
    963986            // get outta here, which will kill the thread
    964         break;
     987        break; */
    965988
    966989        case XCPT_ACCESS_VIOLATION:
     
    968991        case XCPT_ILLEGAL_INSTRUCTION:
    969992        case XCPT_PRIVILEGED_INSTRUCTION:
     993        case XCPT_INVALID_LOCK_SEQUENCE:
    970994        case XCPT_INTEGER_OVERFLOW:
    971995            // write excpt explanation only if the
    972             // resp. debugging #define is set (common.h)
     996            // resp. debugging #define is set (setup.h)
    973997            #ifdef DEBUG_WRITEQUIETEXCPT
    974998            {
  • trunk/src/helpers/gpih.c

    r13 r14  
    66 *      Usage: All PM programs.
    77 *
    8  *      A word about GPI rectangles: In general, graphics operations involving
    9  *      device coordinates (such as regions, bit maps and bit blts, and window
    10  *      management) use inclusive-exclusive rectangles.  All other graphics
    11  *      operations, such as GPI functions that define paths, use inclusive-inclusive
    12  *      rectangles.
     8 *      A word about GPI rectangles: In general, graphics operations
     9 *      involving device coordinates (such as regions, bit maps and
     10 *      bit blts, and window management) use inclusive-exclusive
     11 *      rectangles.  All other graphics operations, such as GPI
     12 *      functions that define paths, use inclusive-inclusive rectangles.
     13 *
     14 *      This can be a problem with mixing Win and Gpi functions. For
     15 *      example, WinQueryWindowRect returns an inclusive-exclusive
     16 *      rectangle (so that the xRight value is the same as the window
     17 *      width). However, GpiBox expects an inclusive-inclusive rectangle.
    1318 *
    1419 *      Function prefixes (new with V0.81):
     
    2328/*
    2429 *      Copyright (C) 1997-2000 Ulrich M”ller.
    25  *      This file is part of the XWorkplace source package.
    26  *      XWorkplace is free software; you can redistribute it and/or modify
     30 *      This file is part of the "XWorkplace helpers" source package.
     31 *      This is free software; you can redistribute it and/or modify
    2732 *      it under the terms of the GNU General Public License as published
    2833 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3944    // as unsigned char
    4045
    41 #define INCL_DOSDEVIOCTL
    42 #define INCL_DOS
    4346#define INCL_DOSERRORS
    44 #define INCL_WIN
    45 #define INCL_GPI
     47
     48#define INCL_WINWINDOWMGR
     49#define INCL_WINPOINTERS
     50#define INCL_WINSYS
     51
     52#define INCL_GPIPRIMITIVES
     53#define INCL_GPIBITMAPS
     54#define INCL_GPILOGCOLORTABLE
     55#define INCL_GPILCIDS
    4656#include <os2.h>
    4757
     
    6878
    6979/* ******************************************************************
    70  *                                                                  *
    71  *   Device helpers                                                 *
    72  *                                                                  *
     80 *
     81 *   Device helpers
     82 *
    7383 ********************************************************************/
    7484
     
    100110
    101111/* ******************************************************************
    102  *                                                                  *
    103  *   Color helpers                                                  *
    104  *                                                                  *
     112 *
     113 *   Color helpers
     114 *
    105115 ********************************************************************/
    106116
     
    139149
    140150/* ******************************************************************
    141  *                                                                  *
    142  *   Drawing primitives helpers                                     *
    143  *                                                                  *
     151 *
     152 *   Drawing primitives helpers
     153 *
    144154 ********************************************************************/
    145155
     
    187197 *      the top right point lies _outside_ the rectangle
    188198 *      which is actually drawn. This is the same as with
    189  *      WinFillRect.
     199 *      WinFillRect. ### I don't think so any more... GpiBox
     200 *      uses inclusive-inclusive rectangles...
    190201 *
    191202 *      Changes to the HPS:
     
    252263    GpiMove(hps, &ptlSave);
    253264    GpiSetColor(hps, lColorSave);
     265}
     266
     267/*
     268 *@@ gpihThickBox:
     269 *      draws a box from the specified rectangle with the
     270 *      specified width.
     271 *
     272 *      The specified rectangle is inclusive, that is, the top
     273 *      right corner specifies the top right pixel to be drawn.
     274 *
     275 *      If usWidth > 1, the additional pixels will be drawn towards
     276 *      the _center_ of the rectangle. prcl thus always specifies
     277 *      the bottom left and top right pixels to be drawn.
     278 *
     279 *      This is different from using GpiSetLineWidth, with which
     280 *      I was unable to find out in which direction lines are
     281 *      extended.
     282 *
     283 *      This is similar to gpihDraw3DFrame, except that everything
     284 *      is painted in the current color.
     285 *
     286 *@@added V0.9.7 (2000-12-06) [umoeller]
     287 */
     288
     289VOID gpihDrawThickFrame(HPS hps,              // in: presentation space for output
     290                        PRECTL prcl,          // in: rectangle to draw (exclusive)
     291                        ULONG ulWidth)       // in: line width (>= 1)
     292{
     293    ULONG ul = 0;
     294    for (;
     295         ul < ulWidth;
     296         ul++)
     297    {
     298        GpiMove(hps, (PPOINTL)prcl);
     299        GpiBox(hps,
     300               DRO_OUTLINE,
     301               (PPOINTL)&(prcl->xRight),
     302               0,
     303               0);
     304
     305        // and one more to the outside
     306        prcl->xLeft++;
     307        prcl->yBottom++;
     308        prcl->xRight--;
     309        prcl->yTop--;
     310    }
    254311}
    255312
     
    355412
    356413/* ******************************************************************
    357  *                                                                  *
    358  *   Font helpers                                                   *
    359  *                                                                  *
     414 *
     415 *   Font helpers
     416 *
    360417 ********************************************************************/
    361418
     
    10301087
    10311088/* ******************************************************************
    1032  *                                                                  *
    1033  *   Bitmap helpers                                                 *
    1034  *                                                                  *
     1089 *
     1090 *   Bitmap helpers
     1091 *
    10351092 ********************************************************************/
    10361093
  • trunk/src/helpers/helpers_post.in

    r13 r14  
    153153               $(PROJECTINC)\setup.h
    154154
     155$(OUTPUTDIR)\timer.obj:   $(@B).c $(HLPINC)\$(@B).h \
     156               $(HLPINC)\datetime.h $(HLPINC)\except.h $(HLPINC)\linklist.h $(HLPINC)\threads.h \
     157               $(PROJECTINC)\setup.h
     158
    155159$(OUTPUTDIR)\tmsgfile.obj:  $(@B).c $(HLPINC)\$(@B).h \
    156160               $(PROJECTINC)\setup.h \
  • trunk/src/helpers/helpers_pre.in

    r13 r14  
    8080$(OUTPUTDIR)\textview.obj \
    8181$(OUTPUTDIR)\textv_html.obj \
     82$(OUTPUTDIR)\timer.obj \
    8283$(OUTPUTDIR)\winh.obj
    8384
  • trunk/src/helpers/level.c

    r8 r14  
    1616 *      Copyright (C) 1994 Martin Lafaix (EDM/2 2-05).
    1717 *      Copyright (C) 2000 Ulrich M”ller.
    18  *      This file is part of the XWorkplace source package.
    19  *      XWorkplace is free software; you can redistribute it and/or modify
     18 *      This file is part of the "XWorkplace helpers" source package.
     19 *      This is free software; you can redistribute it and/or modify
    2020 *      it under the terms of the GNU General Public License as published
    2121 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3333
    3434#define INCL_DOSFILEMGR
    35 #define INCL_NOPMAPI
    3635#include <os2.h>
    3736
     
    5453
    5554/* ******************************************************************
    56  *                                                                  *
    57  *   Interface                                                      *
    58  *                                                                  *
     55 *
     56 *   Interface
     57 *
    5958 ********************************************************************/
    6059
     
    473472
    474473/* ******************************************************************
    475  *                                                                  *
    476  *   Local helper functions                                         *
    477  *                                                                  *
     474 *
     475 *   Local helper functions
     476 *
    478477 ********************************************************************/
    479478
  • trunk/src/helpers/linklist.c

    r8 r14  
    5757/*
    5858 *      Copyright (C) 1997-2000 Ulrich M”ller.
    59  *      This file is part of the XWorkplace source package.
    60  *      XWorkplace is free software; you can redistribute it and/or modify
     59 *      This file is part of the "XWorkplace helpers" source package.
     60 *      This is free software; you can redistribute it and/or modify
    6161 *      it under the terms of the GNU General Public License as published
    6262 *      by the Free Software Foundation, in version 2 as it comes in the
     
    8282
    8383/* ******************************************************************
    84  *                                                                  *
    85  *   List base functions                                            *
    86  *                                                                  *
     84 *
     85 *   List base functions
     86 *
    8787 ********************************************************************/
     88
     89/*
     90 *@@ lstMalloc:
     91 *      wrapper around malloc() to make sure memory is
     92 *      allocated from the C runtime the helpers were
     93 *      compiled with. This is useful for auto-free
     94 *      lists.
     95 *
     96 *@@added V0.9.7 (2000-12-07) [umoeller]
     97 */
     98
     99void* lstMalloc(size_t size)
     100{
     101    return (malloc(size));
     102}
     103
     104/*
     105 *@@ lstStrDup:
     106 *      wrapper around strdup() to make sure memory is
     107 *      allocated from the C runtime the helpers were
     108 *      compiled with. This is useful for auto-free
     109 *      lists.
     110 *
     111 *@@added V0.9.7 (2000-12-07) [umoeller]
     112 */
     113
     114void* lstStrDup(const char *pcsz)
     115{
     116    return (strdup(pcsz));
     117}
    88118
    89119/*
     
    111141 *      you're storing other objects, such as numbers
    112142 *      or other static items.
     143 *
     144 *      This of course will be a "flat" free(). If
     145 *      you store structures in the list using other
     146 *      heap pointers, auto-free would cause memory leaks.
     147 *
     148 *      Also, auto-free only works if the malloc() that
     149 *      has been used on the list item is in the same C
     150 *      runtime as with the linklist functions. If the
     151 *      caller uses a different runtime (e.g. from a DLL),
     152 *      it can use lstMalloc() for allocating the list
     153 *      item and still use auto-free.
    113154 *
    114155 *      Note: You better call lstInit only once per list,
     
    758799
    759800/* ******************************************************************
    760  *                                                                  *
    761  *   List sorting                                                   *
    762  *                                                                  *
     801 *
     802 *   List sorting
     803 *
    763804 ********************************************************************/
    764805
     
    933974
    934975/* ******************************************************************
    935  *                                                                  *
    936  *   List pseudo-stacks                                             *
    937  *                                                                  *
     976 *
     977 *   List pseudo-stacks
     978 *
    938979 ********************************************************************/
    939980
  • trunk/src/helpers/memdebug.c

    r13 r14  
    134134
    135135/* ******************************************************************
    136  *                                                                  *
    137  *   Global variables                                               *
    138  *                                                                  *
     136 *
     137 *   Global variables
     138 *
    139139 ********************************************************************/
    140140
     
    156156
    157157/* ******************************************************************
    158  *                                                                  *
    159  *   Debug heap management                                          *
    160  *                                                                  *
     158 *
     159 *   Debug heap management
     160 *
    161161 ********************************************************************/
    162162
     
    660660
    661661/* ******************************************************************
    662  *                                                                  *
    663  *   XFolder debugging helpers                                      *
    664  *                                                                  *
     662 *
     663 *   XFolder debugging helpers
     664 *
    665665 ********************************************************************/
    666666
  • trunk/src/helpers/prfh.c

    r13 r14  
    1919/*
    2020 *      Copyright (C) 1997-2000 Ulrich M”ller.
    21  *      This file is part of the XWorkplace source package.
    22  *      XWorkplace is free software; you can redistribute it and/or modify
     21 *      This file is part of the "XWorkplace helpers" source package.
     22 *      This is free software; you can redistribute it and/or modify
    2323 *      it under the terms of the GNU General Public License as published
    2424 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3535    // as unsigned char
    3636
    37 #define INCL_DOS
    3837#define INCL_DOSERRORS
    39 #define INCL_WIN
     38#define INCL_WINSHELLDATA
    4039#include <os2.h>
    4140
     
    170169
    171170PSZ prfhQueryProfileData(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    172                         PSZ pszApp,      // in: application to query
    173                         PSZ pszKey,      // in: key to query
    174                         PULONG pcbBuf)   // out: size of the returned buffer
     171                         PSZ pszApp,     // in: application to query
     172                         PSZ pszKey,     // in: key to query
     173                         PULONG pcbBuf)  // out: size of the returned buffer; ptr can be NULL
    175174{
    176175    PSZ     pData = NULL;
     
    238237 *      --  cDateSep = '/' (date separator);
    239238 *      --  cTimeSep = ':' (time separator);
     239 *      --  cDecimal = '.' (decimal separator).
    240240 *      --  cThousands = ',' (thousands separator).
    241241 *
    242242 *@@added V0.9.0 [umoeller]
     243 *@@changed V0.9.7 (2000-12-02) [umoeller]: added cDecimal
    243244 */
    244245
     
    247248    if (pcs)
    248249    {
    249         pcs->ulDateFormat = PrfQueryProfileInt(HINI_USER, "PM_National", "iDate", 0);
    250         pcs->ulTimeFormat = PrfQueryProfileInt(HINI_USER, "PM_National", "iTime", 0);
    251         pcs->cDateSep = prfhQueryProfileChar(HINI_USER, "PM_National", "sDate", '/');
    252         pcs->cTimeSep = prfhQueryProfileChar(HINI_USER, "PM_National", "sTime", ':');
    253         pcs->cThousands = prfhQueryProfileChar(HINI_USER, "PM_National", "sThousand", ',');
     250        const char *pcszApp = "PM_National";
     251        pcs->ulDateFormat = PrfQueryProfileInt(HINI_USER, (PSZ)pcszApp, "iDate", 0);
     252        pcs->ulTimeFormat = PrfQueryProfileInt(HINI_USER, (PSZ)pcszApp, "iTime", 0);
     253        pcs->cDateSep = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sDate", '/');
     254        pcs->cTimeSep = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sTime", ':');
     255        pcs->cDecimal = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sDecimal", '.');
     256        pcs->cThousands = prfhQueryProfileChar(HINI_USER, (PSZ)pcszApp, "sThousand", ',');
    254257    }
    255258}
  • trunk/src/helpers/prfh2.c

    r13 r14  
    2424/*
    2525 *      Copyright (C) 1997-2000 Ulrich M”ller.
    26  *      This file is part of the XWorkplace source package.
    27  *      XWorkplace is free software; you can redistribute it and/or modify
     26 *      This file is part of the "XWorkplace helpers" source package.
     27 *      This is free software; you can redistribute it and/or modify
    2828 *      it under the terms of the GNU General Public License as published
    2929 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4040    // as unsigned char
    4141
    42 #define INCL_DOS
    4342#define INCL_DOSERRORS
    44 #define INCL_WIN
     43#define INCL_WINSHELLDATA
    4544#include <os2.h>
    4645
  • trunk/src/helpers/procstat.c

    r13 r14  
    3434 *      Copyright (C) 1992-1994 Kai Uwe Rommel.
    3535 *      Copyright (C) 1998-2000 Ulrich M”ller.
    36  *      This file is part of the XWorkplace source package.
    37  *      XWorkplace is free software; you can redistribute it and/or modify
     36 *      This file is part of the "XWorkplace helpers" source package.
     37 *      This is free software; you can redistribute it and/or modify
    3838 *      it under the terms of the GNU General Public License as published
    3939 *      by the Free Software Foundation, in version 2 as it comes in the
     
    5050    // as unsigned char
    5151
    52 #define INCL_DOS
     52#define INCL_DOSMODULEMGR
    5353#define INCL_DOSERRORS
    54 #define INCL_DOSMODULEMGR
    5554#include <os2.h>
    5655
     
    7069
    7170/********************************************************************
    72  *                                                                  *
    73  *   DosQProcStat (16-bit) interface                                *
    74  *                                                                  *
     71 *
     72 *   DosQProcStat (16-bit) interface
     73 *
    7574 ********************************************************************/
    7675
     
    196195
    197196/********************************************************************
    198  *                                                                  *
    199  *   DosQProcStat (16-bit) helpers                                  *
    200  *                                                                  *
     197 *
     198 *   DosQProcStat (16-bit) helpers
     199 *
    201200 ********************************************************************/
    202201
     
    439438
    440439/********************************************************************
    441  *                                                                  *
    442  *   DosQuerySysState (32-bit) interface                            *
    443  *                                                                  *
     440 *
     441 *   DosQuerySysState (32-bit) interface
     442 *
    444443 ********************************************************************/
    445444
  • trunk/src/helpers/resh.c

    r8 r14  
    3434    // as unsigned char
    3535
     36#define INCL_DOSMODULEMGR
     37#define INCL_DOSRESOURCES
    3638#define INCL_DOSERRORS
    37 #define INCL_DOS
    38 #define INCL_DOS
    3939#include <os2.h>
    4040
  • trunk/src/helpers/shapewin.c

    r8 r14  
    167167 *                  Akira Hatakeyama,
    168168 *                  Takayuki Suwa.
    169  *      This file is part of the XWorkplace source package.
    170  *      XWorkplace is free software; you can redistribute it and/or modify
     169 *      This file is part of the "XWorkplace helpers" source package.
     170 *      This is free software; you can redistribute it and/or modify
    171171 *      it under the terms of the GNU General Public License as published
    172172 *      by the Free Software Foundation, in version 2 as it comes in the
     
    184184    // as unsigned char
    185185
    186 #define INCL_DOS
    187186#define INCL_DOSERRORS
    188 #define INCL_WIN
     187
     188#define INCL_WINWINDOWMGR
     189#define INCL_WINFRAMEMGR
     190#define INCL_WINDIALOGS
     191#define INCL_WININPUT
     192#define INCL_WINPOINTERS
    189193#define INCL_WINSYS
     194#define INCL_WINRECTANGLES
     195#define INCL_WINTRACKRECT
     196
    190197#define INCL_GPILOGCOLORTABLE
    191198#define INCL_GPIPRIMITIVES
     
    209216
    210217/* ******************************************************************
    211  *                                                                  *
    212  *   Global variables                                               *
    213  *                                                                  *
     218 *
     219 *   Global variables
     220 *
    214221 ********************************************************************/
    215222
     
    217224
    218225/* ******************************************************************
    219  *                                                                  *
    220  *   Part 1: Shape window functions                                 *
    221  *                                                                  *
     226 *
     227 *   Part 1: Shape window functions
     228 *
    222229 ********************************************************************/
    223230
     
    515522    HPS         hps ;
    516523
    517     pRgn = (PSHPREGION) WinQueryWindowPtr(hwnd, 0);
     524    pRgn = (PSHPREGION)WinQueryWindowPtr(hwnd, 0);
    518525
    519526    switch (msg)
     
    12161223        case WM_QUERYDLGCODE:
    12171224            // TRACE("WM_QUERYDLGCODE\n");
    1218             return (MRESULT) DLGC_STATIC;
     1225            return (MRESULT)DLGC_STATIC;
    12191226
    12201227        /*
     
    12951302
    12961303/* ******************************************************************
    1297  *                                                                  *
    1298  *   Part 2: Shape frame functions                                  *
    1299  *                                                                  *
     1304 *
     1305 *   Part 2: Shape frame functions
     1306 *
    13001307 ********************************************************************/
    13011308
  • trunk/src/helpers/stringh.c

    r13 r14  
    2525 *      Copyright (C) 1997-2000 Ulrich M”ller.
    2626 *      Parts Copyright (C) 1991-1999 iMatix Corporation.
    27  *      This file is part of the XWorkplace source package.
    28  *      XWorkplace is free software; you can redistribute it and/or modify
     27 *      This file is part of the "XWorkplace helpers" source package.
     28 *      This is free software; you can redistribute it and/or modify
    2929 *      it under the terms of the GNU General Public License as published
    3030 *      by the Free Software Foundation, in version 2 as it comes in the
     
    17091709
    17101710/* ******************************************************************
    1711  *                                                                  *
    1712  *   Miscellaneous                                                  *
    1713  *                                                                  *
     1711 *
     1712 *   Miscellaneous
     1713 *
    17141714 ********************************************************************/
    17151715
     
    17421742
    17431743VOID strhArrayAppend(PSZ *ppszRoot,         // in: root of array
    1744                      PSZ pszNew,            // in: string to append
     1744                     const char *pcszNew,   // in: string to append
    17451745                     PULONG pcbRoot)        // in/out: size of array
    17461746{
    1747     ULONG cbNew = strlen(pszNew);
     1747    ULONG cbNew = strlen(pcszNew);
    17481748    PSZ pszTemp = (PSZ)malloc(*pcbRoot
    17491749                              + cbNew
     
    17591759    // append new string
    17601760    strcpy(pszTemp + *pcbRoot,
    1761            pszNew);
     1761           pcszNew);
    17621762    // update root
    17631763    *ppszRoot = pszTemp;
     
    18591859
    18601860/* ******************************************************************
    1861  *                                                                  *
    1862  *   Wildcard matching                                              *
    1863  *                                                                  *
     1861 *
     1862 *   Wildcard matching
     1863 *
    18641864 ********************************************************************/
    18651865
     
    24572457
    24582458/* ******************************************************************
    2459  *                                                                  *
    2460  *   Fast string searches                                           *
    2461  *                                                                  *
     2459 *
     2460 *   Fast string searches
     2461 *
    24622462 ********************************************************************/
    24632463
  • trunk/src/helpers/textv_html.c

    r13 r14  
    5959
    6060/* ******************************************************************
    61  *                                                                  *
    62  *   Declarations                                                   *
    63  *                                                                  *
     61 *
     62 *   Declarations
     63 *
    6464 ********************************************************************/
    6565
     
    150150
    151151/* ******************************************************************
    152  *                                                                  *
    153  *   Global variables                                               *
    154  *                                                                  *
     152 *
     153 *   Global variables
     154 *
    155155 ********************************************************************/
    156156
    157157/* ******************************************************************
    158  *                                                                  *
    159  *   Append-char helpers                                            *
    160  *                                                                  *
     158 *
     159 *   Append-char helpers
     160 *
    161161 ********************************************************************/
    162162
     
    299299
    300300/* ******************************************************************
    301  *                                                                  *
    302  *   Tag converter functions                                        *
    303  *                                                                  *
     301 *
     302 *   Tag converter functions
     303 *
    304304 ********************************************************************/
    305305
     
    885885
    886886/* ******************************************************************
    887  *                                                                  *
    888  *   Tag helpers                                                    *
    889  *                                                                  *
     887 *
     888 *   Tag helpers
     889 *
    890890 ********************************************************************/
    891891
     
    19721972
    19731973/* ******************************************************************
    1974  *                                                                  *
    1975  *   Entry points                                                   *
    1976  *                                                                  *
     1974 *
     1975 *   Entry points
     1976 *
    19771977 ********************************************************************/
    19781978
  • trunk/src/helpers/textview.c

    r13 r14  
    252252
    253253/* ******************************************************************
    254  *                                                                  *
    255  *   Device-independent functions                                   *
    256  *                                                                  *
     254 *
     255 *   Device-independent functions
     256 *
    257257 ********************************************************************/
    258258
     
    466466
    467467/* ******************************************************************
    468  *                                                                  *
    469  *   Device-independent text formatting                             *
    470  *                                                                  *
     468 *
     469 *   Device-independent text formatting
     470 *
    471471 ********************************************************************/
    472472
     
    14001400
    14011401/* ******************************************************************
    1402  *                                                                  *
    1403  *   Device-independent text painting                               *
    1404  *                                                                  *
     1402 *
     1403 *   Device-independent text painting
     1404 *
    14051405 ********************************************************************/
    14061406
     
    18061806
    18071807/* ******************************************************************
    1808  *                                                                  *
    1809  *   Window-dependent functions                                     *
    1810  *                                                                  *
     1808 *
     1809 *   Window-dependent functions
     1810 *
    18111811 ********************************************************************/
    18121812
     
    31803180
    31813181/* ******************************************************************
    3182  *                                                                  *
    3183  *   Printer-dependent functions                                    *
    3184  *                                                                  *
     3182 *
     3183 *   Printer-dependent functions
     3184 *
    31853185 ********************************************************************/
    31863186
  • trunk/src/helpers/threads.c

    r8 r14  
    2424/*
    2525 *      Copyright (C) 1997-2000 Ulrich M”ller.
    26  *      This file is part of the XWorkplace source package.
    27  *      XWorkplace is free software; you can redistribute it and/or modify
     26 *      This file is part of the "XWorkplace helpers" source package.
     27 *      This is free software; you can redistribute it and/or modify
    2828 *      it under the terms of the GNU General Public License as published
    2929 *      by the Free Software Foundation, in version 2 as it comes in the
     
    102102            ((PTHREADFUNC)pti->pThreadFunc)(pti);
    103103
     104        if (pti->flFlags & THRF_WAIT)
     105            // "Wait" flag set: delete semaphore
     106            DosCloseEventSem(pti->hevRunning);
     107
    104108        // thread func returns:
    105109        pti->fExitComplete = TRUE;
    106110        pti->tid = NULLHANDLE;
    107 
    108         if (pti->flFlags & THRF_WAIT)
    109             // "Wait" flag set: delete semaphore
    110             DosCloseEventSem(pti->hevRunning);
    111111
    112112        if (pti->pfRunning)
  • trunk/src/helpers/tmsgfile.c

    r13 r14  
    5050 *      Copyright (C) 1999 Christian Langanke.
    5151 *      Copyright (C) 1999-2000 Ulrich M”ller.
    52  *      This file is part of the XWorkplace source package.
    53  *      XWorkplace is free software; you can redistribute it and/or modify
     52 *      This file is part of the "XWorkplace helpers" source package.
     53 *      This is free software; you can redistribute it and/or modify
    5454 *      it under the terms of the GNU General Public License as published
    5555 *      by the Free Software Foundation, in version 2 as it comes in the
     
    6666    // as unsigned char
    6767
    68 #define INCL_DOS
    69 #define INCL_ERRORS
     68#define INCL_DOSFILEMGR
     69#define INCL_DOSMISC
     70#define INCL_DOSNLS
     71#define INCL_DOSERRORS
    7072#include <os2.h>
    7173
     
    8587
    8688/* ******************************************************************
    87  *                                                                  *
    88  *   Declarations                                                   *
    89  *                                                                  *
     89 *
     90 *   Declarations
     91 *
    9092 ********************************************************************/
    9193
     
    111113
    112114/* ******************************************************************
    113  *                                                                  *
    114  *   Text Message File Code                                         *
    115  *                                                                  *
     115 *
     116 *   Text Message File Code
     117 *
    116118 ********************************************************************/
    117119
  • trunk/src/helpers/tree.c

    r13 r14  
    8989 *      Copyright (C) 1991-99 iMatix Corporation.
    9090 *      Copyright (C) 2000 Ulrich M”ller.
    91  *      This file is part of the XWorkplace source package.
    92  *      XWorkplace is free software; you can redistribute it and/or modify
     91 *      This file is part of the "XWorkplace helpers" source package.
     92 *      This is free software; you can redistribute it and/or modify
    9393 *      it under the terms of the GNU General Public License as published
    9494 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/src/helpers/winh.c

    r13 r14  
    2020/*
    2121 *      Copyright (C) 1997-2000 Ulrich M”ller.
    22  *      This file is part of the XWorkplace source package.
    23  *      XWorkplace is free software; you can redistribute it and/or modify
     22 *      This file is part of the "XWorkplace helpers" source package.
     23 *      This is free software; you can redistribute it and/or modify
    2424 *      it under the terms of the GNU General Public License as published
    2525 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3636    // as unsigned char
    3737
     38#define INCL_DOSPROCESS
     39#define INCL_DOSMODULEMGR
     40#define INCL_DOSSEMAPHORES
     41#define INCL_DOSDEVICES
    3842#define INCL_DOSDEVIOCTL
    39 #define INCL_DOS
    4043#define INCL_DOSERRORS
    41 #define INCL_WIN
    42 #define INCL_GPI
    43 
    44 // spooler #include's
    45 #define INCL_BASE
     44
     45#define INCL_WINWINDOWMGR
     46#define INCL_WINMESSAGEMGR
     47#define INCL_WINFRAMEMGR
     48#define INCL_WININPUT
     49#define INCL_WINDIALOGS
     50#define INCL_WINPOINTERS
     51#define INCL_WINRECTANGLES
     52#define INCL_WINSHELLDATA
     53#define INCL_WINSYS
     54#define INCL_WINHELP
     55#define INCL_WINPROGRAMLIST
     56#define INCL_WINSWITCHLIST
     57#define INCL_WINMENUS
     58#define INCL_WINSCROLLBARS
     59#define INCL_WINLISTBOXES
     60#define INCL_WINSTDSPIN
     61#define INCL_WINSTDSLIDER
     62#define INCL_WINCIRCULARSLIDER
     63#define INCL_WINSTDFILE
     64
    4665#define INCL_SPL
    4766#define INCL_SPLDOSPRINT
    4867#define INCL_SPLERRORS
    4968
     69#define INCL_GPIBITMAPS
     70#define INCL_GPIPRIMITIVES
    5071#include <os2.h>
    5172
     
    6990
    7091/* ******************************************************************
    71  *                                                                  *
    72  *   Menu helpers                                                   *
    73  *                                                                  *
     92 *
     93 *   Menu helpers
     94 *
    7495 ********************************************************************/
    7596
     
    255276 *      not found.
    256277 *
    257  *      If something != NULL is returned, you
    258  *      should free() the buffer afterwards.
     278 *      Returns NULL on error. Use winhFree()
     279 *      to free the return value.
    259280 *
    260281 *      Use the WinSetMenuItemText macro to
     
    387408
    388409/* ******************************************************************
    389  *                                                                  *
    390  *   Slider helpers                                                 *
    391  *                                                                  *
     410 *
     411 *   Slider helpers
     412 *
    392413 ********************************************************************/
    393414
     
    791812
    792813/* ******************************************************************
    793  *                                                                  *
    794  *   Spin button helpers                                            *
    795  *                                                                  *
     814 *
     815 *   Spin button helpers
     816 *
    796817 ********************************************************************/
    797818
     
    896917
    897918/* ******************************************************************
    898  *                                                                  *
    899  *   List box helpers                                               *
    900  *                                                                  *
     919 *
     920 *   List box helpers
     921 *
    901922 ********************************************************************/
    902923
     
    905926 *      returns the text of the specified
    906927 *      list box item in a newly allocated
    907  *      buffer, which you should free() afterwards,
    908  *      or NULL upon errors.
     928 *      buffer.
     929 *
     930 *      Returns NULL on error. Use winhFree()
     931 *      to free the return value.
    909932 *
    910933 *@@added V0.9.1 (99-12-14) [umoeller]
     
    10251048
    10261049/* ******************************************************************
    1027  *                                                                  *
    1028  *   Scroll bar helpers                                             *
    1029  *                                                                  *
     1050 *
     1051 *   Scroll bar helpers
     1052 *
    10301053 ********************************************************************/
    10311054
     
    15031526
    15041527/* ******************************************************************
    1505  *                                                                  *
    1506  *   Window positioning helpers                                     *
    1507  *                                                                  *
     1528 *
     1529 *   Window positioning helpers
     1530 *
    15081531 ********************************************************************/
    15091532
     
    19161939
    19171940/*
     1941 *@@ winhFindWindowBelow:
     1942 *      finds the window with the same parent
     1943 *      which sits right below hwndFind in the
     1944 *      window Z-order.
     1945 *
     1946 *@@added V0.9.7 (2000-12-04) [umoeller]
     1947 */
     1948
     1949HWND winhFindWindowBelow(HWND hwndFind)
     1950{
     1951    HWND hwnd = NULLHANDLE,
     1952         hwndParent = WinQueryWindow(hwndFind, QW_PARENT);
     1953
     1954    if (hwndParent)
     1955    {
     1956        HENUM   henum = WinBeginEnumWindows(hwndParent);
     1957        HWND    hwndThis;
     1958        while (hwndThis = WinGetNextWindow(henum))
     1959        {
     1960            SWP swp;
     1961            WinQueryWindowPos(hwndThis, &swp);
     1962            if (swp.hwndInsertBehind == hwndFind)
     1963            {
     1964                hwnd = hwndThis;
     1965                break;
     1966            }
     1967        }
     1968        WinEndEnumWindows(henum);
     1969    }
     1970
     1971    return (hwnd);
     1972}
     1973
     1974/*
    19181975 *@@category: Helpers\PM helpers\Presentation parameters
    19191976 */
    19201977
    19211978/* ******************************************************************
    1922  *                                                                  *
    1923  *   Presparams helpers                                             *
    1924  *                                                                  *
     1979 *
     1980 *   Presparams helpers
     1981 *
    19251982 ********************************************************************/
    19261983
     
    19281985 *@@ winhQueryWindowFont:
    19291986 *      returns the window font presentation parameter
    1930  *      in a newly allocated buffer, which you must
    1931  *      free() afterwards. Returns NULL if not found.
     1987 *      in a newly allocated buffer.
     1988 *
     1989 *      Returns NULL on error. Use winhFree()
     1990 *      to free the return value.
    19321991 *
    19331992 *@@added V0.9.1 (2000-02-14) [umoeller]
     
    19662025
    19672026BOOL winhSetWindowFont(HWND hwnd,
    1968                        PSZ pszFont)
     2027                       const char *pcszFont)
    19692028{
    19702029    CHAR    szFont[256];
    19712030
    1972     if (pszFont == NULL)
     2031    if (pcszFont == NULL)
    19732032    {
    19742033        if (doshIsWarp4())
     
    19782037    }
    19792038    else
    1980         strhncpy0(szFont, pszFont, sizeof(szFont));
     2039        strhncpy0(szFont, pcszFont, sizeof(szFont));
    19812040
    19822041    return (WinSetPresParam(hwnd,
     
    20602119 *      Use free() on your PPRESPARAMS pointer (whose
    20612120 *      address was passed) after WinCreateWindow.
     2121 *
     2122 *      See winhQueryPresColor for typical presparams
     2123 *      used in OS/2.
    20622124 *
    20632125 *      Example:
     
    21392201 *      3)  if this fails or (fInherit == FALSE), WinQuerySysColor
    21402202 *          is called to get lSysColor (which should be a SYSCLR_*
    2141  *          index).
     2203 *          index), if lSysColor != -1;
     2204 *      4)  if (lSysColor == -1), -1 is returned.
    21422205 *
    21432206 *      The return value is always an RGB LONG, _not_ a color index.
     
    22052268 *@@changed V0.9.0 [umoeller]: removed INI key query, using SYSCLR_* instead; function prototype changed
    22062269 *@@changed V0.9.0 [umoeller]: added fInherit parameter
     2270 *@@changed V0.9.7 (2000-12-02) [umoeller]: added lSysColor == -1 support
    22072271 */
    22082272
     
    22292293
    22302294    // not found: get system color
    2231     return (WinQuerySysColor(HWND_DESKTOP, lSysColor, 0));
     2295    if (lSysColor != -1)
     2296        return (WinQuerySysColor(HWND_DESKTOP, lSysColor, 0));
     2297
     2298    return -1;
    22322299}
    22332300
     
    22372304
    22382305/* ******************************************************************
    2239  *                                                                  *
    2240  *   Help instance helpers                                          *
    2241  *                                                                  *
     2306 *
     2307 *   Help instance helpers
     2308 *
    22422309 ********************************************************************/
    22432310
     
    27602827
    27612828/* ******************************************************************
    2762  *                                                                  *
    2763  *   Miscellaneous                                                  *
    2764  *                                                                  *
     2829 *
     2830 *   Miscellaneous
     2831 *
    27652832 ********************************************************************/
     2833
     2834/*
     2835 *@@ winhFree:
     2836 *      frees a block of memory allocated by the
     2837 *      winh* functions.
     2838 *
     2839 *      Since the winh* functions use malloc(),
     2840 *      you can also use free() directly on such
     2841 *      blocks. However, you must use winhFree
     2842 *      if the winh* functions are in a module
     2843 *      with a different C runtime.
     2844 *
     2845 *@@added V0.9.7 (2000-12-06) [umoeller]
     2846 */
     2847
     2848VOID winhFree(PVOID p)
     2849{
     2850    if (p)
     2851        free(p);
     2852}
    27662853
    27672854/*
     
    29303017 *@@ winhQueryWindowText:
    29313018 *      this returns the window text of the specified
    2932  *      HWND in a newly allocated buffer, which has
    2933  *      the exact size of the window text.
    2934  *
    2935  *      This buffer must be free()'d later.
     3019 *      HWND in a newly allocated buffer.
     3020 *
     3021 *      Returns NULL on error. Use winhFree()
     3022 *      to free the return value.
    29363023 */
    29373024
     
    30583145 *@@added V0.9.0 [umoeller]
    30593146 *@@changed V0.9.5 (2000-08-13) [umoeller]: flStyleClient never worked, fixed
     3147 *@@changed V0.9.7 (2000-12-08) [umoeller]: fixed client calc for invisible window
    30603148 */
    30613149
     
    31193207
    31203208            // position client
    3121             WinQueryWindowRect(hwndFrame, &rclClient);
    3122             WinCalcFrameRect(hwndFrame, &rclClient,
     3209            // WinQueryWindowRect(hwndFrame, &rclClient);
     3210            // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller]
     3211            rclClient.xLeft = 0;
     3212            rclClient.yBottom = 0;
     3213            rclClient.xRight = pswpFrame->cx;
     3214            rclClient.yTop = pswpFrame->cy;
     3215            WinCalcFrameRect(hwndFrame,
     3216                             &rclClient,
    31233217                             TRUE);     // calc client from frame
    31243218            WinSetWindowPos(*phwndClient,
     
    35153609
    35163610/*
     3611 *@@ winhQuerySwitchList:
     3612 *      returns the switch list in a newly
     3613 *      allocated buffer. This does the
     3614 *      regular double WinQuerySwitchList
     3615 *      call to first get the no. of items
     3616 *      and then get the items.
     3617 *
     3618 *      The no. of items can be found in
     3619 *      the returned SWBLOCK.cwsentry.
     3620 *
     3621 *      Returns NULL on errors. Use
     3622 *      winhFree to free the return value.
     3623 *
     3624 *@@added V0.9.7 (2000-12-06) [umoeller]
     3625 */
     3626
     3627PSWBLOCK winhQuerySwitchList(HAB hab)
     3628{
     3629    ULONG   cItems = WinQuerySwitchList(hab, NULL, 0);
     3630    ULONG   ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH);
     3631    PSWBLOCK pSwBlock = (PSWBLOCK)malloc(ulBufSize);
     3632    if (pSwBlock)
     3633    {
     3634        cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize);
     3635        if (!cItems)
     3636        {
     3637            free(pSwBlock);
     3638            pSwBlock = NULL;
     3639        }
     3640    }
     3641
     3642    return (pSwBlock);
     3643}
     3644
     3645/*
     3646 *@@ winhQueryTasklistWindow:
     3647 *      returns the window handle of the PM task list.
     3648 *
     3649 *@@added V0.9.7 (2000-12-07) [umoeller]
     3650 */
     3651
     3652HWND winhQueryTasklistWindow(VOID)
     3653{
     3654    SWBLOCK  swblock;
     3655    HWND     hwndTasklist = winhQueryTasklistWindow();
     3656    // the tasklist has entry #0 in the SWBLOCK
     3657    WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK));
     3658    return (swblock.aswentry[0].swctl.hwnd);
     3659}
     3660
     3661/*
    35173662 *@@ winhKillTasklist:
    35183663 *      this will destroy the Tasklist (window list) window.
     
    35253670VOID winhKillTasklist(VOID)
    35263671{
    3527     SWBLOCK  swblock;
    3528     HWND     hwndTasklist;
    3529     // the tasklist has entry #0 in the SWBLOCK
    3530     WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK));
    3531     hwndTasklist = swblock.aswentry[0].swctl.hwnd;
     3672    HWND     hwndTasklist = winhQueryTasklistWindow();
    35323673    WinPostMsg(hwndTasklist,
    35333674               0x0454,     // undocumented msg for killing tasklist
     
    36953836
    36963837/* ******************************************************************
    3697  *                                                                  *
    3698  *   WPS Class List helpers                                         *
    3699  *                                                                  *
     3838 *
     3839 *   WPS Class List helpers
     3840 *
    37003841 ********************************************************************/
    37013842
     
    37123853 *      See WinEnumObjectClasses() for details.
    37133854 *
    3714  *      The buffer is allocated using malloc(), so
    3715  *      you should free() it when it is no longer
    3716  *      needed.
    3717  *
    3718  *      This returns NULL if an error occured.
     3855 *      Returns NULL on error. Use winhFree()
     3856 *      to free the return value.
    37193857 *
    37203858 *@@added V0.9.0 [umoeller]
  • trunk/src/helpers/wphandle.c

    r8 r14  
    2424 *      This file Copyright (C) 1997-2000 Ulrich M”ller,
    2525 *                                        Henk Kelder.
    26  *      This file is part of the XWorkplace source package.
    27  *      XWorkplace is free software; you can redistribute it and/or modify
     26 *      This file is part of the "XWorkplace helpers" source package.
     27 *      This is free software; you can redistribute it and/or modify
    2828 *      it under the terms of the GNU General Public License as published
    2929 *      by the Free Software Foundation, in version 2 as it comes in the
     
    4040    // as unsigned char
    4141
    42 #define INCL_DOS
    4342#define INCL_WINSHELLDATA
    4443#include <os2.h>
     
    7372
    7473/* ******************************************************************
    75  *                                                                  *
    76  *   Helper functions                                               *
    77  *                                                                  *
     74 *
     75 *   Helper functions
     76 *
    7877 ********************************************************************/
    7978
     
    281280
    282281/* ******************************************************************
    283  *                                                                  *
    284  *   Get HOBJECT from filename                                      *
    285  *                                                                  *
     282 *
     283 *   Get HOBJECT from filename
     284 *
    286285 ********************************************************************/
    287286
     
    521520
    522521/* ******************************************************************
    523  *                                                                  *
    524  *   Get filename from HOBJECT                                      *
    525  *                                                                  *
     522 *
     523 *   Get filename from HOBJECT
     524 *
    526525 ********************************************************************/
    527526
     
    640639
    641640/* ******************************************************************
    642  *                                                                  *
    643  *   Manipulation functions                                         *
    644  *                                                                  *
     641 *
     642 *   Manipulation functions
     643 *
    645644 ********************************************************************/
    646645
  • trunk/src/helpers/xml.c

    r13 r14  
    4646/*
    4747 *      Copyright (C) 2000 Ulrich M”ller.
    48  *      This file is part of the XWorkplace source package.
    49  *      XWorkplace is free software; you can redistribute it and/or modify
     48 *      This file is part of the "XWorkplace helpers" source package.
     49 *      This is free software; you can redistribute it and/or modify
    5050 *      it under the terms of the GNU General Public License as published
    5151 *      by the Free Software Foundation, in version 2 as it comes in the
  • trunk/src/helpers/xprf.c

    r8 r14  
    7575/*
    7676 *      Copyright (C) 2000 Ulrich M”ller.
    77  *      This file is part of the XWorkplace source package.
    78  *      XWorkplace is free software; you can redistribute it and/or modify
     77 *      This file is part of the "XWorkplace helpers" source package.
     78 *      This is free software; you can redistribute it and/or modify
    7979 *      it under the terms of the GNU General Public License as published
    8080 *      by the Free Software Foundation, in version 2 as it comes in the
     
    9191    // as unsigned char
    9292
    93 #define INCL_DOS
    9493#define INCL_DOSERRORS
    9594#define INCL_WINSHELLDATA
     
    113112
    114113/* ******************************************************************
    115  *                                                                  *
    116  *   Declarations                                                   *
    117  *                                                                  *
     114 *
     115 *   Declarations
     116 *
    118117 ********************************************************************/
    119118
     
    143142
    144143/* ******************************************************************
    145  *                                                                  *
    146  *   Helpers                                                        *
    147  *                                                                  *
     144 *
     145 *   Helpers
     146 *
    148147 ********************************************************************/
    149148
     
    352351
    353352/* ******************************************************************
    354  *                                                                  *
    355  *   Read/write data                                                *
    356  *                                                                  *
     353 *
     354 *   Read/write data
     355 *
    357356 ********************************************************************/
    358357
     
    670669
    671670/* ******************************************************************
    672  *                                                                  *
    673  *   API Functions                                                  *
    674  *                                                                  *
     671 *
     672 *   API Functions
     673 *
    675674 ********************************************************************/
    676675
  • trunk/src/helpers/xprf2.c

    r12 r14  
    2222/*
    2323 *      Copyright (C) 2000 Ulrich M”ller.
    24  *      This file is part of the XWorkplace source package.
    25  *      XWorkplace is free software; you can redistribute it and/or modify
     24 *      This file is part of the "XWorkplace helpers" source package.
     25 *      This is free software; you can redistribute it and/or modify
    2626 *      it under the terms of the GNU General Public License as published
    2727 *      by the Free Software Foundation, in version 2 as it comes in the
     
    3838    // as unsigned char
    3939
    40 #define INCL_DOS
    4140#define INCL_DOSERRORS
    4241#define INCL_WINSHELLDATA
     
    6160
    6261/* ******************************************************************
    63  *                                                                  *
    64  *   Copy API Functions                                             *
    65  *                                                                  *
     62 *
     63 *   Copy API Functions
     64 *
    6665 ********************************************************************/
    6766
  • trunk/src/helpers/xstring.c

    r13 r14  
    8585/*
    8686 *      Copyright (C) 1999-2000 Ulrich M”ller.
    87  *      This file is part of the XWorkplace source package.
    88  *      XWorkplace is free software; you can redistribute it and/or modify
     87 *      This file is part of the "XWorkplace helpers" source package.
     88 *      This is free software; you can redistribute it and/or modify
    8989 *      it under the terms of the GNU General Public License as published
    9090 *      by the Free Software Foundation, in version 2 as it comes in the
Note: See TracChangeset for help on using the changeset viewer.