News:

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

Script Engine BETA 11

Started by hutch--, March 13, 2006, 04:51:34 AM

Previous topic - Next topic

hutch--

I have added two function that should be useful for general purpose work, the function that Tim suggested "ftimecmp" and a file exist function "exist". The return values for the time stamp compare are as follows.

                Return Values
                -------------
                1   =   1st file is later than the second
                0   =   both files have the same time stamp
                -1  =   2nd file is later than the first
                -2  =   1st file does not exist
                -3  =   2nd file does not exist


The "exist" function has the following return values.


                Return Values
                -1  =   File exists
                0   =   File does not exist


This is the test piece I used. The two file names will have to be changed to something local on your own machine but it tests fine here.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    INTEGER frv
    INTEGER ex

    STRING file1
    STRING file2
    STRING tmp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    file1 = "h:\masm32\qeditor.exe"
    file2 = "f:\masm32\qeditor.exe"

    frv = ftimecmp file1 file2          ; compare file times
    num2str frv tmp
    msgbox tmp "Result" MB_OK

    ex = exist file1                    ; test if file exists
    num2str ex tmp
    msgbox tmp "Result" MB_OK

    end

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

hutch--

Here is a quick example of the idea that Tim suggested, the attached zip file is a simple console exe that has a MAKE.SE script with it to perform the build operation. I think I would prefer to write this stuff rather than an NMAKE script. Always hated them.


; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    INTEGER frv
    INTEGER ex

    STRING file1
    STRING file2
    STRING tmp

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    file1 = "bldtst.asm"
    file2 = "bldtst.exe"

    frv = ftimecmp file1 file2      ; compare file times

    if frv = -1                     ; if the EXE is later than the source
    goto uptodate                   ; display that its up to date
    goto rebuild                    ; else rebuild it.

  uptodate:
    msgbox "File is up to date" "Make" MB_OK
    goto next

  rebuild:
    run "\masm32\bin\ml.exe /c /coff bldtst.asm"
    run "\masm32\bin\link.exe /SUBSYSTEM:CONSOLE bldtst.obj"
    msgbox "File has been rebuilt" "Make" MB_OK

  next:
    msgbox "Test File ?" "Run" MB_YESNO
    if #0 = IDNO
    goto quit

    run "bldtst.exe"

  quit:
    end

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Timbo

Hutch,

Thanks.  I think anyone who uses specialized builds (interactive or automated) will enjoy your script engine.  In this era of IDEs, it is possible to do much of this through the graphical user interface, but nothing beats a well written and flexible build script IMO.  Such is certainly the case when mixing languages such as c/c++ and asm. Again, all IMO.

Right now, with my bowl being filled with the latest update, I am empty for suggestions for new features but I am sure I will come up with something. :green2

Kudos! :U

Tim