News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Alternate include style

Started by stanhebben, December 04, 2006, 10:26:13 AM

Previous topic - Next topic

ToutEnMasm

Hello,
Hello,
I become red with all this compliments,But i am not the only one that wrote it.
It's a work that had be done here in a post.Hutch made a good work to solve a bug with it.
After some tests on all the many macros that were posted,I only find the good one that accept the multiline statements and improve it in my code.
If my memorie is good,seems you have contributed also.
The macro can be shorter .... with a bug
If you use FOR ... ,these products an internal error when the include file have macros in it.

To include in windows.inc and save backword compatibility a IFNDEF  argcount made the JOB
                                        ToutEnMasm

ToutEnMasm


There is also the uselib macro in the macros.inc (masm32 package)
Improvements can made a choice
                           ToutEnmasm


Quote
comment * -------------------------------------------------

        The "uselib" macro allows names that are used for
        both include files and library file to be used in a
        list without extensions. Note the following order
        of include files where WINDOWS.INC should be
        included first then the main macro file BEFORE this
        macro is called.

        include \masm32\include\windows.inc
        include \masm32\macros\macros.asm
        uselib masm32,gdi32,user32,kernel32,Comctl32,comdlg32,shell32,oleaut32,msvcrt

        ------------------------------------------------- *

    uselib MACRO args:VARARG
      LOCAL acnt,buffer,var,lbl,libb,incc,buf1,buf2
      acnt = argcount(args)
      incc equ <include \masm32\include\>
      libb equ <includelib \masm32\lib\>
      var = 1
    :lbl
      buffer equ getarg(var,args)

      buf1 equ <>
      buf1 CATSTR buf1,incc,buffer,<.inc>
      buf1
      ;; % echo buf1

      buf2 equ <>
      buf2 CATSTR buf2,libb,buffer,<.lib>
      buf2
      ;; % echo buf2

      var = var + 1
      IF var LE acnt
        goto lbl
      ENDIF
    ENDM

  ; -----------------------------------------------






Jimg

Quote from: ToutEnMasm on December 08, 2006, 03:05:39 PM
If you use FOR ... ,these products an internal error when the include file have macros in it.
I'm afraid I don't understand.  Can you give an example please?

PBrennick

Since that is so similar to the one in GeneSys, I will post ours, also.

In Macros.asm:


      uselib MACRO namelist:VARARG
        FOR item, <namelist>
          include \GeneSys\include\item.inc
          includelib \GeneSys\lib\item.lib
        ENDM
      ENDM


In Windows.inc:


use_std_SDK MACRO
include \GeneSys\macros\macros.asm
uselib kernel32,user32,gdi32,shell32,comctl32,comdlg32,msvcrt,shlwapi,advapi32,GeneSys
ENDM


In a project:


    include \GeneSys\include\windows.inc
    use_std_SDK


ToutenMasm,
Quote
To include in windows.inc and save backword compatibility a IFNDEF  argcount made the JOB
Hutch already has an IFNDEF test to ensure there will be no duplicates. Just make sue you put the new macro into windows.inc ahead of the ELSE statement near the end of the file. I have tested this for myself, also. I am no genious when it comes to macros (just get by, barely) but if the tests are okay then I am satisfied.
Thank you for this great idea.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

ToutEnMasm

For the "internal Error" with FOR ,follow this link
http://www.masm32.com/board/index.php?topic=2370.msg23924#msg23924
It's a message from ML.
This message is not generated with all the macros included in an include file.
Perhaps if someone is a best searcher than me ?.
                                       ToutEnMasm


PBrennick

ToutenMasm,
I have searched all of the include files in the GeneSys Project. None of them contain any for loops, okay?

Paul
The GeneSys Project is available from:
The Repository or My crappy website

ToutEnMasm

Okay Paul,
The link is only to remenber the problem and to take care of it.
I have pass some times before find it!.
                                          ToutEnMasm

PBrennick

ToutenMasm,
Thank you for everything. You are a very thorough man and quite helpful.
Paul
The GeneSys Project is available from:
The Repository or My crappy website

Jimg

Wow.  I had some vague recollection of looking at this before but couldn't find anything.  It's tough getting old :(

hutch--

From memory the "uselib" macro in the macros file in masm32 was one of Paul's ideas. I think it works OK and it is useful for people who want to use it but I would still warn anyone against modifying the WINDOWS.INC file as the method I have for its maintainance has the entire file split up into about 30 seperate file which are joined in sequence for each modification. Its a particularly piggish file to modify and can come down around your ears with the "error count exceeds 100" message very easily.

What I would suggest if anyone needs to run a macro before the WINDOWS.INC file is to make an include file that has the macros first THEN call WINDOWS.INC and any libraries that are required after it. The simplified include file for masm32 "masm32rt.inc" is a reasonable model here and it allows a programming system designer to have a unique file that performs any specific customisation without interfering with the content of WINDOWS.INC.

It is not stubbornness that I will not change WINDOWS.INC but part of the original design of the MASM32 Project which intentionally countered the trend of calling a single include file that then called a whole range of file with buried include files that were very hard to find and even harder to edit. I am referring to the C/C++ model here of calling WINDOWS.H and leaving the rest to a set of conditional includes driven by varous IFDEF and similar statements.

By design the MASM32 Project requires symetrical include files and library files so that the programmer ALWAYS knows what is necesasary and what will work. When I first started the MASM32 project include files from a variety of different sources were all over the place like a mad women's **** (sewerage) and no-one could build anyone elses programs because of this incompatibility. Rejecting the C/C++ model and designing the symetrical include and library file system solved all of these problems and made assembler code written in MASM very reliable.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php