Changeset 249


Ignore:
Timestamp:
Feb 8, 2003, 9:57:38 PM (23 years ago)
Author:
umoeller
Message:

Build updates, moved files from warpin.

Location:
trunk
Files:
18 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/dosh.h

    r243 r249  
    703703                            PSZ pszFileOut,
    704704                            ULONG cbFileOut);
     705
     706    typedef APIRET XWPENTRY FNCBFORALLFILES(const FILEFINDBUF3 *pfb3,
     707                                            PVOID pvCallback);
     708
     709    APIRET doshForAllFiles(PCSZ pcszSearchMask,
     710                           ULONG flFile,
     711                           FNCBFORALLFILES *pfncb,
     712                           PVOID pvCallback);
    705713
    706714    /* ******************************************************************
  • trunk/include/helpers/nls.h

    r242 r249  
    4444    #define TYPE_DBCS_1ST       0x0001
    4545    #define TYPE_DBCS_2ND       0x0002
     46
     47    ULONG XWPENTRY nlsQueryCodepage(VOID);
    4648
    4749    BOOL XWPENTRY nlsDBCS(VOID);
  • trunk/include/helpers/xml.h

    r187 r249  
    359359                                  const char *pcszName,
    360360                                  const char *pcszValue,
     361                                  ULONG lenValue,
    361362                                  PDOMNODE *ppNew);
    362363
    363364    APIRET xmlCreateTextNode(PDOMNODE pParent,
    364365                             const char *pcszText,
    365                              ULONG ulLength,
     366                             ULONG lenText,
    366367                             PDOMNODE *ppNew);
    367368
  • trunk/include/helpers/xstring.h

    r171 r249  
    225225    typedef XSTRENCODE *PXSTRENCODE;
    226226
     227    ULONG XWPENTRY xstrEncodeASCII(PXSTRING pxstr);
     228
    227229    ULONG XWPENTRY xstrDecode2(PXSTRING pxstr,
    228230                               CHAR cKey);
  • trunk/make/_sub_compile.in

    r243 r249  
    4545!endif
    4646
     47.asm.{$(OUTPUTDIR)}.obj:
     48    @echo   ### [$@]: Assembling $(@B).asm
     49    alp -Sv:ALP -Fdo:$(OUTPUTDIR) $(@B).asm
     50
     51
     52
  • trunk/make/compile_dll_mt.in

    r243 r249  
    1313#
    1414
     15!ifndef CC_DLL_MT
     16!error CC_DLL_MT is not defined.
     17!endif
     18
    1519CC = $(CC_DLL_MT)
    1620
    17 OUTPUTDIR = $(PROJECT_OUTPUT_DIR)
     21OUTPUTDIR = $(PROJECT_OUTPUT_DIR)\dll_mt
    1822
    1923!include $(MAKE_INCLUDE_DIR)\_sub_compile.in
  • trunk/make/helpers.in

    r243 r249  
    99!endif
    1010
    11 !if [@echo     $(MAKEDIR)\makefile: PROJECT_BASE_DIR is: $(PROJECT_BASE_DIR)]
    12 !endif
     11# !if [@echo     $(MAKEDIR)\makefile: PROJECT_BASE_DIR is: $(PROJECT_BASE_DIR)]
     12# !endif
    1313
    1414# include setup (compiler options etc.)
     
    3030OUTPUTDIR = $(HELPERS_OUTPUT_DIR)
    3131
    32 !if [@echo     $(MAKEDIR)\makefile: helpers OBJs will be written to $(OUTPUTDIR)]
    33 !endif
     32# !if [@echo     $(MAKEDIR)\makefile: helpers OBJs will be written to $(OUTPUTDIR)]
     33# !endif
    3434
    3535!if [@md $(OUTPUTDIR) 2> NUL]
     
    6969!endif
    7070
    71 .asm.{$(OUTPUTDIR)}.obj:
    72     @echo $(MAKEDIR)\makefile: Assembling $(@B).asm
    73     alp -Sv:ALP -Fdo:$(OUTPUTDIR) $(@B).asm
    7471
    75 
    76 
  • trunk/make/link_exe.in

    r245 r249  
    6363!endif
    6464
     65!ifndef LINKCMD
     66LINKCMD = $(LINK)
     67!endif
     68
    6569$(MODULESDIR)\$(MODULESTEM).exe: $(LINKOBJS) $(MODULEDEF) $(DEPEND_RES)
    6670    @echo   ### [$@]: Linking $(@F)
    67     $(LINK) @<<
     71    $(LINKCMD) @<<
    6872/OUT:$@ $(MODULEDEF) $(LINKOBJS) $(PMPRINTF_LIB)
    6973<<KEEP
     
    7680!endif
    7781    @cd $(MODULESDIR)
    78     $(RUN_MAPSYM) $(@B).map
     82    $(RUN_MAPSYM) $(MAPDIR)\$(@B).map
    7983!ifdef CVS_WORK_ROOT_DRIVE
    8084    @$(CVS_WORK_ROOT_DRIVE)
  • trunk/src/helpers/dosh.c

    r244 r249  
    38933893}
    38943894
     3895#define FINDBUFSIZE             0x10000     // 64K
     3896#define FINDCOUNT               500
     3897
     3898/*
     3899 *@@ doshForAllFiles:
     3900 *      this calles pfncb for all files in a directory matching
     3901 *      the given file mask.
     3902 *
     3903 *      This is to avoid having to recode the typical but
     3904 *      easy-to-get-wrong DosFindFirst/Next loop.
     3905 *
     3906 *      pfncb must be prototyped as follows:
     3907 *
     3908 +          APIRET XWPENTRY fnMyCallback(const FILEFINDBUF3 *pfb3,
     3909 +                                       PVOID pvCallback)
     3910 *
     3911 *      On each iteration, it receives the current file-find
     3912 *      buffer in pfb3. pvCallback is constantly set to what
     3913 *      was passed in to this function.
     3914 *
     3915 *      The callback will get called for every file returned
     3916 *      from the loop. This function will automatically
     3917 *      filter out the stupid "." and ".." directory entries
     3918 *      that DosFindFirst/Next always return, so the callback
     3919 *      will never see those.
     3920 *
     3921 *      If the callback returns any value other than NO_ERROR,
     3922 *      this function aborts and returns that error. The
     3923 *      exception is that if the callback returns
     3924 *      ERROR_NO_MORE_FILES, this function will abort also,
     3925 *      but return NO_ERROR still. This is useful if you are
     3926 *      looking for a specific file and want to cancel the
     3927 *      search early without provoking an error.
     3928 *
     3929 *@@added V1.0.2 (2003-02-03) [umoeller]
     3930 */
     3931
     3932APIRET doshForAllFiles(PCSZ pcszSearchMask,         // in: search mask (e.g. "C:\dir\*.txt")
     3933                       ULONG flFile,                // in: any of FILE_ARCHIVED | FILE_HIDDEN | FILE_SYSTEM | FILE_READONLY | FILE_DIRECTORY
     3934                       FNCBFORALLFILES *pfncb,      // in: address of callback function
     3935                       PVOID pvCallback)            // in: parameter passed to callback
     3936{
     3937    APIRET  arc = NO_ERROR;
     3938    HDIR    hdirFindHandle = HDIR_CREATE;
     3939    ULONG   ulFindCount = FINDCOUNT;
     3940
     3941    PBYTE   pbFindBuf;
     3942
     3943    if (arc = DosAllocMem((PVOID*)&pbFindBuf,
     3944                          FINDBUFSIZE,
     3945                          PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_TILE))
     3946        return arc;
     3947
     3948    arc = DosFindFirst((PSZ)pcszSearchMask,
     3949                       &hdirFindHandle,
     3950                       flFile,
     3951                       pbFindBuf,
     3952                       FINDBUFSIZE,
     3953                       &ulFindCount,
     3954                       FIL_STANDARD);
     3955
     3956    while (    (arc == NO_ERROR)
     3957            || (arc == ERROR_BUFFER_OVERFLOW)
     3958          )
     3959    {
     3960        ULONG           ul;
     3961        PFILEFINDBUF3   pfb3 = (PFILEFINDBUF3)pbFindBuf;
     3962
     3963        for (ul = 0;
     3964             ul < ulFindCount;
     3965             ul++)
     3966        {
     3967            // filter out the "." and ".." entries
     3968            if (!(    (pfb3->attrFile & FILE_DIRECTORY)
     3969                   && (pfb3->achName[0] == '.')
     3970                   && (    (pfb3->achName[1] == '\0')
     3971                        || (    (pfb3->achName[1] == '.')
     3972                             && (pfb3->achName[2] == '\0')
     3973                           )
     3974                      )
     3975               ))
     3976            {
     3977                // call callback
     3978                if (arc = pfncb(pfb3, pvCallback))
     3979                    // callback returned error:
     3980                    break;
     3981            }
     3982
     3983            // next item in buffer
     3984            if (pfb3->oNextEntryOffset)
     3985                pfb3 = (PFILEFINDBUF3)(   (PBYTE)pfb3
     3986                                        + pfb3->oNextEntryOffset
     3987                                      );
     3988        }
     3989
     3990        if (!arc)
     3991        {
     3992            ulFindCount = FINDCOUNT;
     3993            arc = DosFindNext(hdirFindHandle,
     3994                              pbFindBuf,
     3995                              FINDBUFSIZE,
     3996                              &ulFindCount);
     3997        }
     3998    }
     3999
     4000    // no more files is not an error
     4001    if (arc == ERROR_NO_MORE_FILES)
     4002        arc = NO_ERROR;
     4003
     4004    DosFindClose(hdirFindHandle);
     4005
     4006    DosFreeMem(pbFindBuf);
     4007
     4008    return arc;
     4009}
     4010
    38954011/*
    38964012 *@@category: Helpers\Control program helpers\Module handling
  • trunk/src/helpers/helpers_pre.in

    r243 r249  
    1010# These will be put into BIN\.
    1111
    12 PLAINCOBJS = \
    13 $(OUTPUTDIR)\encodings.obj\
     12PLAINCOBJS = $(OUTPUTDIR)\encodings.obj\
    1413$(OUTPUTDIR)\linklist.obj\
    1514$(OUTPUTDIR)\math.obj\
     
    1817$(OUTPUTDIR)\xml.obj\
    1918
    20 XMLOBJS = \
    21 $(OUTPUTDIR)\xmlparse.obj\
     19XMLOBJS = $(OUTPUTDIR)\xmlparse.obj\
    2220$(OUTPUTDIR)\xmlrole.obj\
    2321$(OUTPUTDIR)\xmltok.obj\
  • trunk/src/helpers/makefile

    r245 r249  
    11#
    2 # makefile:
    3 #       makefile for src/helpers directory.
    4 #       For use with IBM NMAKE, which comes with the IBM compilers,
    5 #       the Developer's Toolkit, and the DDK.
     2# See make\readme.txt about an introduction to the make system introduced
     3# in the CVS trunk on 2003-01-28.
    64#
    7 #       This makefile is even more complicated than the other makefiles
    8 #       because the helpers code has been designed to be independent
    9 #       of any single project. Presently the helpers code is used in
    10 #       XWorkplace and WarpIN. As a result, I had to design a way so that
    11 #       this makefile can produce output in a variable directory, with
    12 #       variable compiler flags, and so on. This is done via environment
    13 #       variables passed in from the "parent" makefile of a specific
    14 #       project.
    15 #
    16 #       Even worse, with V0.9.5, I chose to create a shared runtime DLL
    17 #       for the various WarpIN executables. For that, I chose to use
    18 #       a separate makefile (makefile_dll). In order to share make
    19 #       definitions, these have been put into separate .in files in
    20 #       this directory, which are included via nmake !include.
    21 #
    22 #       Called from:    main makefile
    23 #
    24 #       Required environment variables:
    25 #
    26 #               -- PROJECT_BASE_DIR: where to find setup.in; this should
    27 #                   be the root directory of the project, e.g. "C:\cvs\warpin"
    28 #                   or "C:\cvs\xworkplace"
    29 #
    30 #               -- HELPERS_OUTPUT_DIR: where to create output files (*.obj, helpers.lib)
    31 #                   this should be a "bin" directory (e.g. "C:\cvs\warpin\bin"
    32 #
    33 #               -- CC_HELPERS: compiler command line for compiling C files.
    34 #                   With VAC++, this should include the /Ge+ (compile to EXE)
    35 #                   option to allow linking the library to both EXE and DLL
    36 #                   files.
    37 #                   If you're using the "dll" target, specify /Ge- instead.
    38 #
    39 #               -- MAINMAKERUNNING: if this is NOT defined, this makefile
    40 #                   will recurse to the makefile in $(PROJECT_BASE_DIR).
    41 #                   So to have this makefile run successfully, define this
    42 #                   variable to something.
    43 #
    44 #                   This variable was introduced to be able to start a build
    45 #                   process from src\helpers as well. However, when your own
    46 #                   project makefile calls src\helpers\makefile, you must set
    47 #                   this to something.
    48 #
    49 #       Input:          ./*.c
    50 #
    51 #       Targets:        specify the target(s) to be made, which can be:
    52 #
    53 #                       --  "all" (default): create helpers.lib in addition
    54 #                           to all the output .obj files in $(HELPERS_OUTPUT_DIR).
    55 #
    56 #                           This contains all helpers (plain C, control program,
    57 #                           and PM).
    58 #
    59 #                           This makes linking a bit easier since you don't have to
    60 #                           keep in mind the millions of object files. Still, you
    61 #                           should be sure to include the proper headers in your
    62 #                           code.
    63 #
    64 #                           Alternatively, you can call this makefile with certain
    65 #                           targets explicitly specified. However, you must then
    66 #                           make sure that the resulted object files are linked
    67 #                           properly, because some of the more advanced helpers
    68 #                           require other helpers.
    69 #
    70 #                       --  "plainc": create "plainc.lib", which contains
    71 #                           platform-independent helpers code only (no control
    72 #                           program helpers, no PM helpers).
    73 #
    74 #                           This is included if you specify "all". Use this if
    75 #                           you want a subset of the helpers only.
    76 #
    77 #                       --  "cp": create "cp.lib", which contains "plainc" plus
    78 #                           control program helpers.
    79 #
    80 #                           This is included if you specify "all". Use this if
    81 #                           you want a subset of the helpers only.
    82 #
    83 #       Edit "setup.in" to set up the make process.
     5#       Copyright (C) 1998-2003 Ulrich M”ller.
     6#       This file is part of the XWorkplace source package.
     7#       XWorkplace is free software; you can redistribute it and/or modify
     8#       it under the terms of the GNU General Public License as published
     9#       by the Free Software Foundation, in version 2 as it comes in the
     10#       "COPYING" file of the XWorkplace main distribution.
     11#       This program is distributed in the hope that it will be useful,
     12#       but WITHOUT ANY WARRANTY; without even the implied warranty of
     13#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14#       GNU General Public License for more details.
    8415#
    8516
    86 # set up shared environment variables
    87 !include ..\..\make\helpers.in
    88 # define $(OBJ), which contains all object targets
     17# ***************************************************************************
     18# *
     19# *     1) include generic setup definitions (compiler options etc.)
     20# *
     21# ***************************************************************************
     22
     23!include $(PROJECT_BASE_DIR)\config.in
     24!include $(PROJECT_BASE_DIR)\make\setup.in
     25
     26# ***************************************************************************
     27# *
     28# *     2) include mode-specific compiler inference rules
     29# *
     30# ***************************************************************************
     31
     32!ifndef CC_HELPERS
     33CC_HELPERS = error!
     34!endif
     35
     36!ifndef NOINCLUDEDEPEND
     37!ifndef OUTPUTDIR_HELPERS
     38!error OUTPUTDIR_HELPERS is not defined.
     39!endif
     40!endif
     41
     42CC = $(CC_HELPERS)
     43OUTPUTDIR = $(OUTPUTDIR_HELPERS)
     44
     45!include $(MAKE_INCLUDE_DIR)\_sub_compile.in
     46
     47# ***************************************************************************
     48# *
     49# *     3) list objects to be built
     50# *
     51# ***************************************************************************
     52
    8953!include helpers_pre.in
    9054
    91 plainc:   \
    92 !ifndef MAINMAKERUNNING
    93     callmainmake
    94     @echo ----- Leaving $(MAKEDIR)
    95 !else
    96     $(OUTPUTDIR)\plainc.lib
    97 #$(OBJS)
    98     @echo ----- Leaving $(MAKEDIR)
    99 !endif
     55# ***************************************************************************
     56# *
     57# *     4) define specific stuff for linker include
     58# *
     59# ***************************************************************************
    10060
    101 cp:   \
    102 !ifndef MAINMAKERUNNING
    103     callmainmake
    104     @echo ----- Leaving $(MAKEDIR)
    105 !else
    106     $(OUTPUTDIR)\cp.lib
    107 #$(OBJS)
    108     @echo ----- Leaving $(MAKEDIR)
    109 !endif
     61# ***************************************************************************
     62# *
     63# *     5) link executable
     64# *
     65# ***************************************************************************
    11066
    111 # Define the main dependency between the output HELPERS.LIB and
    112 # all the object files.
    113 # $? represents the names of all dependent files that are
    114 # out-of-date with respect to the target file.
    115 # The exclamation point ( ! ) preceding the LIB command causes NMAKE
    116 # to execute the LIB command once for each dependent file in the list.
     67ALLTARGET = $(OUTPUTDIR)\helpers.lib
    11768
    118 $(OUTPUTDIR)\helpers.lib: $(OBJS) makefile
    119 !ifdef EMX
    120     !emxomfar cr $* $?
    121 !else
     69# ***************************************************************************
     70# *
     71# *     6) define main target
     72# *
     73# ***************************************************************************
     74
     75!include $(MAKE_INCLUDE_DIR)\targets.in
     76
     77$(OUTPUTDIR)\helpers.lib: $(OBJS)
    12278    - del $@
    12379    ilib /nol /nob $@ @<<$(TEMP)\ilib.lnk
     
    12581);
    12682<<KEEP
    127 !endif
    12883
    129 # same thing for cp.lib
    130 $(OUTPUTDIR)\cp.lib: $(CPOBJS) makefile
    131 !ifdef EMX
    132     !emxomfar cr $* $?
    133 !else
     84# ***************************************************************************
     85# *
     86# *     explicit targets
     87# *
     88# ***************************************************************************
     89
     90cp: $(OUTPUTDIR)\helpers_cp.lib
     91
     92$(OUTPUTDIR)\helpers_cp.lib: $(CPOBJS)
    13493    - del $@
    135     ilib /nol /nob $@ @<<
     94    ilib /nol /nob $@ @<<$(TEMP)\ilib.lnk
    13695+$(CPOBJS: =&^
    13796);
    13897<<KEEP
    139 !endif
    140 
    141 # same thing for plainc.lib
    142 $(OUTPUTDIR)\plainc.lib: $(PLAINCOBJS) makefile
    143 !ifdef EMX
    144     !emxomfar cr $* $?
    145 !else
    146     - del $@
    147     ilib /nol /nob $@ @<<
    148 +$(PLAINCOBJS: =&^
    149 );
    150 <<KEEP
    151 !endif
    152 
    153 !include helpers_post.in
    154 
    155 ALLTARGET = $(OUTPUTDIR)\helpers.lib
    156 
    157 !include ..\..\make\targets.in
    158 
    159 ###################################################
    160 #
    161 # "test" target: for test cases
    162 #
    163 ###################################################
    164 
    165 TESTCASE_DIR = testcase
    166 
    167 !undef DEBUGDIALOG
    168 !ifdef DBGDLG
    169 DEBUGDIALOG = /DDEBUG_DIALOG_WINDOWS=1
    170 !endif
    171 
    172 TESTCASE_CC_BASE = icc /c /ti+ /w2 /ss /se /D__DEBUG__=1 $(DEBUGDIALOG) /i..\..\include
    173 
    174 TESTCASE_CC = $(TESTCASE_CC_BASE) /Fo$(TESTCASE_DIR)\$(@B).obj  $(@B).c
    175 
    176 .c.{$(TESTCASE_DIR)}.obj:
    177     @echo $(MAKEDIR)\makefile: Compiling $(@B).c
    178     @echo INCLUDE is $(INCLUDE)
    179     $(TESTCASE_CC)
    180 
    181 # testcase executables
    182 TESTCASE_TARGETS = \
    183     dosh.exe \
    184     dialog.exe \
    185     exeh.exe \
    186     fdlg.exe \
    187     fdlg_pm.exe \
    188     xmap.exe \
    189     vcard.exe
    190 
    191 # dialog.exe
    192 DIALOG_TEST_OBJS = \
    193     $(TESTCASE_DIR)\dialog.obj \
    194     $(TESTCASE_DIR)\_test_dialog.obj \
    195     $(TESTCASE_DIR)\winh.obj \
    196     $(TESTCASE_DIR)\xstring.obj \
    197     $(TESTCASE_DIR)\linklist.obj \
    198     $(TESTCASE_DIR)\cctl_checkcnr.obj \
    199     $(TESTCASE_DIR)\cnrh.obj \
    200     $(TESTCASE_DIR)\comctl.obj \
    201     $(TESTCASE_DIR)\stringh.obj \
    202     $(TESTCASE_DIR)\dosh.obj \
    203     $(TESTCASE_DIR)\except.obj \
    204     $(TESTCASE_DIR)\debug.obj \
    205     $(TESTCASE_DIR)\textview.obj \
    206     $(TESTCASE_DIR)\textv_html.obj \
    207     $(TESTCASE_DIR)\tmsgfile.obj \
    208     $(TESTCASE_DIR)\datetime.obj \
    209     $(TESTCASE_DIR)\tree.obj \
    210     $(TESTCASE_DIR)\gpih.obj \
    211     $(TESTCASE_DIR)\prfh.obj \
    212     $(TESTCASE_DIR)\nls.obj \
    213     $(TESTCASE_DIR)\nlscache.obj
    214 
    215 $(TESTCASE_DIR)\dialog.obj: ..\..\include\helpers\dialog.h
    216 $(TESTCASE_DIR)\_test_dialog.obj: ..\..\include\helpers\dialog.h
    217 
    218 dialog.exe: $(DIALOG_TEST_OBJS)
    219     ilink /debug /optfunc /pmtype:pm $(DIALOG_TEST_OBJS) pmprintf.lib /o:$@
    220 
    221 # dosh.exe
    222 DOSH_TEST_OBJS = \
    223     $(TESTCASE_DIR)\dosh.obj \
    224     $(TESTCASE_DIR)\_test_dosh.obj
    225 
    226 dosh.exe: $(DOSH_TEST_OBJS)
    227     ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) pmprintf.lib /o:$@
    228 
    229 # exeh.exe
    230 EXEH_TEST_OBJS = \
    231     $(TESTCASE_DIR)\dosh.obj \
    232     $(TESTCASE_DIR)\exeh.obj \
    233     $(TESTCASE_DIR)\stringh.obj \
    234     $(TESTCASE_DIR)\xstring.obj \
    235     $(TESTCASE_DIR)\_test_exeh.obj
    236 
    237 exeh.exe: $(EXEH_TEST_OBJS)
    238     ilink /debug /optfunc /pmtype:vio $(EXEH_TEST_OBJS) pmprintf.lib /o:$@
    239 
    240 # fdlg.exe
    241 FDLG_TEST_OBJS_SHARED = \
    242     $(TESTCASE_DIR)\comctl.obj \
    243     $(TESTCASE_DIR)\cctl_cnr.obj \
    244     $(TESTCASE_DIR)\cctl_cnr_dtls.obj \
    245     $(TESTCASE_DIR)\cctl_toolbar.obj \
    246     $(TESTCASE_DIR)\cctl_tooltip.obj \
    247     $(TESTCASE_DIR)\cctl_xframe.obj \
    248     $(TESTCASE_DIR)\cnrh.obj \
    249     $(TESTCASE_DIR)\dosh.obj \
    250     $(TESTCASE_DIR)\gpih.obj \
    251     $(TESTCASE_DIR)\linklist.obj \
    252     $(TESTCASE_DIR)\winh.obj \
    253     $(TESTCASE_DIR)\stringh.obj \
    254     $(TESTCASE_DIR)\xstring.obj \
    255     $(TESTCASE_DIR)\prfh.obj \
    256     $(TESTCASE_DIR)\tree.obj \
    257     $(TESTCASE_DIR)\nls.obj \
    258     $(TESTCASE_DIR)\nlscache.obj
    259 
    260 FDLG_TEST_OBJS = \
    261     $(FDLG_TEST_OBJS_SHARED) \
    262     $(TESTCASE_DIR)\_call_filedlg.obj
    263 
    264 $(TESTCASE_DIR)\_call_filedlg_pm.obj: _call_filedlg.c
    265     @echo $(MAKEDIR)\makefile: Compiling $(@B).c (PM version)
    266     @echo INCLUDE is $(INCLUDE)
    267     $(TESTCASE_CC_BASE) /D__USE_PM_CNR__=1 /Fo$(TESTCASE_DIR)\_call_filedlg_pm.obj _call_filedlg.c
    268 
    269 FDLG_TEST_OBJS_PM = \
    270     $(FDLG_TEST_OBJS_SHARED) \
    271     $(TESTCASE_DIR)\_call_filedlg_pm.obj
    272 
    273 fdlg.exe: $(FDLG_TEST_OBJS) makefile
    274     @echo $(MAKEDIR)\makefile: Linking $@
    275     ilink /nologo /debug /pmtype:pm $(FDLG_TEST_OBJS) pmprintf.lib /o:$@
    276 
    277 fdlg_pm.exe: $(FDLG_TEST_OBJS_PM) makefile
    278     @echo $(MAKEDIR)\makefile: Linking $@ (PM version)
    279     ilink /nologo /debug /pmtype:pm $(FDLG_TEST_OBJS_PM) pmprintf.lib /o:$@
    280 
    281 # xmap.exe
    282 MAP_TEST_OBJS = \
    283     $(TESTCASE_DIR)\map_vac.obj \
    284     $(TESTCASE_DIR)\linklist.obj \
    285     $(TESTCASE_DIR)\stringh.obj \
    286     $(TESTCASE_DIR)\xstring.obj \
    287     $(TESTCASE_DIR)\_test_map.obj
    288 
    289 xmap.exe: $(MAP_TEST_OBJS)
    290     ilink /debug /optfunc /pmtype:vio $(MAP_TEST_OBJS) pmprintf.lib /o:$@
    291 
    292 # vcard.exe
    293 VCARD_TEST_OBJS = \
    294     $(TESTCASE_DIR)\vcard.obj \
    295     $(TESTCASE_DIR)\_test_vcard.obj \
    296     $(TESTCASE_DIR)\xstring.obj \
    297     $(TESTCASE_DIR)\stringh.obj \
    298     $(TESTCASE_DIR)\linklist.obj \
    299     $(TESTCASE_DIR)\dosh.obj \
    300     $(TESTCASE_DIR)\prfh.obj \
    301     $(TESTCASE_DIR)\nls.obj \
    302     $(TESTCASE_DIR)\except.obj \
    303     $(TESTCASE_DIR)\debug.obj \
    304     $(TESTCASE_DIR)\tree.obj
    305 
    306 vcard.exe: $(VCARD_TEST_OBJS)
    307     ilink /debug /pmtype:vio $(VCARD_TEST_OBJS) /o:$@
    308 
    309 test: $(TESTCASE_TARGETS)
    31098
    31199
  • trunk/src/helpers/nls.c

    r243 r249  
    8888COUNTRYCODE G_cc = { 0, 0 };
    8989DBCSVECTOR  G_aDBCSVector[8];
     90
     91/*
     92 *@@ nlsQueryCodepage:
     93 *      returns the current process codepage as a ULONG.
     94 *
     95 *@@added V1.0.2 (2003-02-07) [umoeller]
     96 */
     97
     98ULONG nlsQueryCodepage(VOID)
     99{
     100    ULONG   acp[8];
     101    ULONG   cb = 0;
     102    if (DosQueryCp(sizeof(acp),
     103                   acp,
     104                   &cb))
     105        return 437;         // I think this is still the system default
     106
     107    return acp[0];
     108}
    90109
    91110/*
  • trunk/src/helpers/xml.c

    r238 r249  
    714714 *
    715715 *@@added V0.9.9 (2001-02-14) [umoeller]
     716 *@@changed V1.0.2 (2003-02-07) [umoeller]: added lenValue param
    716717 */
    717718
     
    719720                              const char *pcszName,     // in: attribute name (null-terminated)
    720721                              const char *pcszValue,    // in: attribute value (null-terminated)
     722                              ULONG lenValue,           // in: length of value (must be specified)
    721723                              PDOMNODE *ppNew)
    722724{
    723     APIRET arc = NO_ERROR;
     725    APIRET      arc;
     726    PDOMNODE    pNew = NULL;
    724727
    725728    if (    (!pElement)
    726729         || (pElement->NodeBase.ulNodeType != DOMNODE_ELEMENT)
    727730       )
    728         arc = ERROR_DOM_NO_ELEMENT;
    729     else
    730     {
    731         PDOMNODE pNew = NULL;
    732         if (!(arc = xmlCreateDomNode(pElement,          // this takes care of adding to the list
    733                                      DOMNODE_ATTRIBUTE,
    734                                      pcszName,
    735                                      0,
    736                                      &pNew)))
    737         {
    738             pNew->pstrNodeValue = xstrCreate(0);
    739             xstrcpy(pNew->pstrNodeValue, pcszValue, 0);
    740 
    741             *ppNew = pNew;
    742         }
     731        return ERROR_DOM_NO_ELEMENT;
     732
     733    if (!(arc = xmlCreateDomNode(pElement,          // this takes care of adding to the list
     734                                 DOMNODE_ATTRIBUTE,
     735                                 pcszName,
     736                                 0,
     737                                 &pNew)))
     738    {
     739        pNew->pstrNodeValue = xstrCreate(lenValue + 1);
     740        xstrcpy(pNew->pstrNodeValue, pcszValue, lenValue);
     741
     742        *ppNew = pNew;
    743743    }
    744744
     
    759759APIRET xmlCreateTextNode(PDOMNODE pParent,         // in: parent element node
    760760                         const char *pcszText,     // in: ptr to start of text
    761                          ULONG ulLength,           // in: length of *pcszText
     761                         ULONG lenText,            // in: length of *pcszText
    762762                         PDOMNODE *ppNew)
    763763{
     
    772772    {
    773773        PSZ pszNodeValue;
    774         if (pszNodeValue = (PSZ)malloc(ulLength + 1))
     774        if (pszNodeValue = (PSZ)malloc(lenText + 1))
    775775        {
    776             memcpy(pszNodeValue, pcszText, ulLength);
    777             pszNodeValue[ulLength] = '\0';
     776            memcpy(pszNodeValue, pcszText, lenText);
     777            pszNodeValue[lenText] = '\0';
    778778            pNew->pstrNodeValue = xstrCreate(0);
    779779            xstrset(pNew->pstrNodeValue, pszNodeValue);
     
    15521552                {
    15531553                    PDOMNODE pAttrib;
     1554                    PCSZ    pcszValue = papcszAttribs[i + 1];  // attr value
    15541555                    if (!(pDom->arcDOM = xmlCreateAttributeNode(pNew,                  // element,
    15551556                                                                papcszAttribs[i],      // attr name
    1556                                                                 papcszAttribs[i + 1],  // attr value
     1557                                                                pcszValue,
     1558                                                                strlen(pcszValue),
    15571559                                                                &pAttrib)))
    15581560                    {
     
    24282430 *              the int at index 0x94 to 0x00f6.
    24292431 *
     2432 *      --  pfnExternalHandler should be specified if you want the
     2433 *          parser to be able to handle @external_entities. Since
     2434 *          the parser has no concept of storage whatsoever, it is
     2435 *          the responsibility of this callback to supply the parser
     2436 *          with additional XML data when an external entity reference
     2437 *          is encountered.
     2438 *
     2439 *          This callback must have the following prototype:
     2440 *
     2441 +              APIRET APIENTRY ParseExternal(PXMLDOM pDom,
     2442 +                                            XML_Parser pSubParser,
     2443 +                                            const char *pcszSystemID,
     2444 +                                            const char *pcszPublicID)
     2445 +
     2446 *
     2447 *          The callback will be called for each reference that refers
     2448 *          to an external entity. pSubParser is a sub-parser created
     2449 *          by the DOM engine, and pcszSystemID and pcszPublicID
     2450 *          reference the external entity by means of a URI. As always
     2451 *          with XML, the system ID is required, while the public ID is
     2452 *          optional.
     2453 *
     2454 *          In the simplest case, this code could look as follows:
     2455 *
     2456 +              APIRET arc = ERROR_FILE_NOT_FOUND;
     2457 +
     2458 +              if (pcszSystemID)
     2459 +              {
     2460 +                  PSZ pszContents = NULL;
     2461 +                  if (!(arc = doshLoadTextFile(pcszSystemID,
     2462 +                                               &pszContents,
     2463 +                                               NULL)))
     2464 +                  {
     2465 +                      if (!XML_Parse(pSubParser,
     2466 +                                     pszContents,
     2467 +                                     strlen(pszContents),
     2468 +                                     TRUE))
     2469 +                          arc = -1;
     2470 +
     2471 +                      free(pszContents);
     2472 +                  }
     2473 +              }
     2474 +
     2475 +              return arc;
     2476 *
    24302477 *      --  pvCallbackUser is a user parameter which is simply stored
    24312478 *          in the XMLDOM struct which is returned. Since the XMLDOM
     
    24352482 *@@added V0.9.9 (2001-02-14) [umoeller]
    24362483 *@@changed V0.9.14 (2001-08-09) [umoeller]: added DF_DROP_WHITESPACE support
     2484 *@@changed V0.9.20 (2002-07-06) [umoeller]: added static system IDs
    24372485 */
    24382486
     
    24452493                    PXMLDOM *ppDom)                 // out: XMLDOM struct created
    24462494{
    2447     APIRET  arc = NO_ERROR;
    2448 
    2449     PXMLDOM pDom = (PXMLDOM)malloc(sizeof(*pDom));
    2450     if (!pDom)
    2451         arc = ERROR_NOT_ENOUGH_MEMORY;
    2452     else
    2453     {
    2454         PDOMNODE pDocument = NULL;
    2455 
    2456         memset(pDom, 0, sizeof(XMLDOM));
    2457 
    2458         pDom->flParserFlags = flParserFlags;
    2459         pDom->pfnGetCPData = pfnGetCPData;
    2460         pDom->pfnExternalHandler = pfnExternalHandler;
    2461         pDom->pvCallbackUser = pvCallbackUser;
    2462 
    2463         // these added with V0.9.20 (2002-07-06) [umoeller]
    2464         pDom->paSystemIds = paSystemIds;
    2465         pDom->cSystemIds = cSystemIds;
    2466 
    2467         lstInit(&pDom->llElementStack,
    2468                 TRUE);                 // auto-free
    2469 
    2470         // create the document node
    2471         if (!(arc = xmlCreateDomNode(NULL, // no parent
    2472                                      DOMNODE_DOCUMENT,
    2473                                      NULL,
    2474                                      0,
    2475                                      &pDocument)))
     2495    APIRET      arc = NO_ERROR;
     2496    PXMLDOM     pDom;
     2497    PDOMNODE    pDocument = NULL;
     2498
     2499    if (!(pDom = (PXMLDOM)malloc(sizeof(*pDom))))
     2500        return ERROR_NOT_ENOUGH_MEMORY;
     2501
     2502    memset(pDom, 0, sizeof(XMLDOM));
     2503
     2504    pDom->flParserFlags = flParserFlags;
     2505    pDom->pfnGetCPData = pfnGetCPData;
     2506    pDom->pfnExternalHandler = pfnExternalHandler;
     2507    pDom->pvCallbackUser = pvCallbackUser;
     2508
     2509    // these added with V0.9.20 (2002-07-06) [umoeller]
     2510    pDom->paSystemIds = paSystemIds;
     2511    pDom->cSystemIds = cSystemIds;
     2512
     2513    lstInit(&pDom->llElementStack,
     2514            TRUE);                 // auto-free
     2515
     2516    // create the document node
     2517    if (!(arc = xmlCreateDomNode(NULL, // no parent
     2518                                 DOMNODE_DOCUMENT,
     2519                                 NULL,
     2520                                 0,
     2521                                 &pDocument)))
     2522    {
     2523        // store the document in the DOM
     2524        pDom->pDocumentNode = (PDOMDOCUMENTNODE)pDocument;
     2525
     2526        // push the document on the stack so the handlers
     2527        // will append to that
     2528        PushElementStack(pDom,
     2529                         pDocument);
     2530
     2531        pDom->pParser = XML_ParserCreate(NULL);
     2532
     2533        if (!pDom->pParser)
     2534            arc = ERROR_NOT_ENOUGH_MEMORY;
     2535        else
    24762536        {
    2477             // store the document in the DOM
    2478             pDom->pDocumentNode = (PDOMDOCUMENTNODE)pDocument;
    2479 
    2480             // push the document on the stack so the handlers
    2481             // will append to that
    2482             PushElementStack(pDom,
    2483                              pDocument);
    2484 
    2485             pDom->pParser = XML_ParserCreate(NULL);
    2486 
    2487             if (!pDom->pParser)
    2488                 arc = ERROR_NOT_ENOUGH_MEMORY;
    2489             else
     2537            if (pfnGetCPData)
     2538                XML_SetUnknownEncodingHandler(pDom->pParser,
     2539                                              UnknownEncodingHandler,
     2540                                              pDom);        // user data
     2541
     2542            XML_SetParamEntityParsing(pDom->pParser,
     2543                                      XML_PARAM_ENTITY_PARSING_ALWAYS);
     2544
     2545            XML_SetElementHandler(pDom->pParser,
     2546                                  StartElementHandler,
     2547                                  EndElementHandler);
     2548
     2549            XML_SetCharacterDataHandler(pDom->pParser,
     2550                                        CharacterDataHandler);
     2551
     2552            // XML_SetProcessingInstructionHandler(XML_Parser parser,
     2553            //                          XML_ProcessingInstructionHandler handler);
     2554
     2555
     2556            if (flParserFlags & DF_PARSECOMMENTS)
     2557                XML_SetCommentHandler(pDom->pParser,
     2558                                      CommentHandler);
     2559
     2560            if (    (pfnExternalHandler)
     2561                 || (cSystemIds)     // V0.9.20 (2002-07-06) [umoeller]
     2562               )
     2563                XML_SetExternalEntityRefHandler(pDom->pParser,
     2564                                                ExternalEntityRefHandler);
     2565
     2566            if (flParserFlags & DF_PARSEDTD)
    24902567            {
    2491                 if (pfnGetCPData)
    2492                     XML_SetUnknownEncodingHandler(pDom->pParser,
    2493                                                   UnknownEncodingHandler,
    2494                                                   pDom);        // user data
     2568                XML_SetDoctypeDeclHandler(pDom->pParser,
     2569                                          StartDoctypeDeclHandler,
     2570                                          EndDoctypeDeclHandler);
     2571
     2572                XML_SetNotationDeclHandler(pDom->pParser,
     2573                                           NotationDeclHandler);
     2574
     2575                XML_SetElementDeclHandler(pDom->pParser,
     2576                                          ElementDeclHandler);
     2577
     2578                XML_SetAttlistDeclHandler(pDom->pParser,
     2579                                          AttlistDeclHandler);
     2580
     2581                XML_SetEntityDeclHandler(pDom->pParser,
     2582                                         EntityDeclHandler);
    24952583
    24962584                XML_SetParamEntityParsing(pDom->pParser,
    24972585                                          XML_PARAM_ENTITY_PARSING_ALWAYS);
    2498 
    2499                 XML_SetElementHandler(pDom->pParser,
    2500                                       StartElementHandler,
    2501                                       EndElementHandler);
    2502 
    2503                 XML_SetCharacterDataHandler(pDom->pParser,
    2504                                             CharacterDataHandler);
    2505 
    2506                 // XML_SetProcessingInstructionHandler(XML_Parser parser,
    2507                 //                          XML_ProcessingInstructionHandler handler);
    2508 
    2509 
    2510                 if (flParserFlags & DF_PARSECOMMENTS)
    2511                     XML_SetCommentHandler(pDom->pParser,
    2512                                           CommentHandler);
    2513 
    2514                 if (    (pfnExternalHandler)
    2515                      || (cSystemIds)     // V0.9.20 (2002-07-06) [umoeller]
    2516                    )
    2517                     XML_SetExternalEntityRefHandler(pDom->pParser,
    2518                                                     ExternalEntityRefHandler);
    2519 
    2520                 if (flParserFlags & DF_PARSEDTD)
    2521                 {
    2522                     XML_SetDoctypeDeclHandler(pDom->pParser,
    2523                                               StartDoctypeDeclHandler,
    2524                                               EndDoctypeDeclHandler);
    2525 
    2526                     XML_SetNotationDeclHandler(pDom->pParser,
    2527                                                NotationDeclHandler);
    2528 
    2529                     XML_SetElementDeclHandler(pDom->pParser,
    2530                                               ElementDeclHandler);
    2531 
    2532                     XML_SetAttlistDeclHandler(pDom->pParser,
    2533                                               AttlistDeclHandler);
    2534 
    2535                     XML_SetEntityDeclHandler(pDom->pParser,
    2536                                              EntityDeclHandler);
    2537 
    2538                     XML_SetParamEntityParsing(pDom->pParser,
    2539                                               XML_PARAM_ENTITY_PARSING_ALWAYS);
    2540                 }
    2541 
    2542                 // XML_SetXmlDeclHandler ... do we care for this? I guess not
    2543 
    2544                 // pass the XMLDOM as user data to the handlers
    2545                 XML_SetUserData(pDom->pParser,
    2546                                 pDom);
    25472586            }
     2587
     2588            // XML_SetXmlDeclHandler ... do we care for this? I guess not
     2589
     2590            // pass the XMLDOM as user data to the handlers
     2591            XML_SetUserData(pDom->pParser,
     2592                            pDom);
    25482593        }
    25492594    }
  • trunk/src/helpers/xmldefs.c

    r97 r249  
    222222 *      use a different encoding for its characters.
    223223 *
    224  *      In the document entity, the encoding declaration is part of the XML
    225  *      @text_declaration.
     224 *      In the document entity, the encoding declaration is part of the
     225 *      XML @text_declaration.
    226226 *
    227227 *      Also see @entities.
  • trunk/src/helpers/xstring.c

    r245 r249  
    12581258
    12591259// static encoding table for xstrEncode
    1260 STATIC PSZ apszEncoding[] =
     1260static PSZ apszEncoding[] =
    12611261{
    12621262    "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07",
     
    13651365                        // use the static encoding table for speed
    13661366                        memcpy(pszDestCurr,
    1367                                apszEncoding[(unsigned char)pcszEncode[ulEncode]],
     1367                               apszEncoding[(UCHAR)pcszEncode[ulEncode]],
    13681368                               3);
    13691369                        pszDestCurr += 3;
     
    13851385            *pszDestCurr = 0;
    13861386
    1387             xstrcpy(pxstr, pszDest, pszDestCurr-pszDest);
     1387            xstrcpy(pxstr, pszDest, pszDestCurr - pszDest);
     1388        }
     1389
     1390        free(pszDest);
     1391    }
     1392
     1393    return ulrc;
     1394}
     1395
     1396/*
     1397 *@@ xstrEncodeASCII:
     1398 *      like xstrEncode, but instead of encoding characters
     1399 *      from an array given by the caller, this encodes all
     1400 *      non-ASCII characters (i.e. >= 128) plus the '%' char.
     1401 *
     1402 *@@added V1.0.2 (2003-02-07) [umoeller]
     1403 */
     1404
     1405ULONG xstrEncodeASCII(PXSTRING pxstr)     // in/out: string to convert
     1406{
     1407    ULONG ulrc = 0,
     1408          ul,
     1409          ulEncodeLength;
     1410
     1411    if (    (pxstr)
     1412         && (pxstr->ulLength)
     1413       )
     1414    {
     1415        PSZ pszDest = (PSZ)malloc(pxstr->ulLength * 3
     1416                                  + 1),
     1417            pszDestCurr = pszDest;
     1418
     1419        if (pszDest)
     1420        {
     1421            for (ul = 0;
     1422                 ul < pxstr->ulLength;
     1423                 ul++)
     1424            {
     1425                if (    ((UCHAR)pxstr->psz[ul] >= 128)
     1426                     || (pxstr->psz[ul] == '%')
     1427                   )
     1428                {
     1429                    memcpy(pszDestCurr,
     1430                           apszEncoding[(UCHAR)pxstr->psz[ul]],
     1431                           3);
     1432                    pszDestCurr += 3;
     1433                    ulrc++;
     1434                    goto iterate;
     1435                }
     1436
     1437                *pszDestCurr++ = pxstr->psz[ul];
     1438
     1439                iterate:
     1440                    ;
     1441            }
     1442        }
     1443
     1444        // something was encoded; update pxstr
     1445        if (ulrc)
     1446        {
     1447            *pszDestCurr = 0;
     1448
     1449            xstrcpy(pxstr, pszDest, pszDestCurr - pszDest);
    13881450        }
    13891451
Note: See TracChangeset for help on using the changeset viewer.