Changeset 1389


Ignore:
Timestamp:
Jan 7, 2009, 1:19:01 AM (17 years ago)
Author:
John Small
Message:

ReleaseEdit.cmd: will set VER_REALMINOR in dll\version.h to the
value of the FM2_VERREALMINOR environment variable if set. (If
the env. var is not set then a default is used: " "DATE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseEdit.cmd

    r1388 r1389  
    4444 *    23 Nov 08 JBS Improved handling of invalid or missing <trace-option>
    4545 *       and a 'NOTREADY' condition when closing the repository.
    46  *    05 Jan 09 JBS Added code to set VERREALMINOR to default in dll\version.h
     46 *    06 Jan 09 JBS Added code to set VERREALMINOR in dll\version.h
     47 *       a) to value of FM2_VERREALMINOR environment variable, if set
     48 *       b) to " "__DATE__ if FM2_VERREALMINOR environment variable is not set
     49 *       NOTE: FM2_VERREALMINOR, if set, must have an even number (including 0)
     50 *       of double quotes. SED seems to choke on an odd number, even if they are
     51 *       propoerly escaped.
    4752 *
    4853*/
     
    198203            do /* change below to delete and then update version.h only if version is different? */
    199204               say 'Processing file:' file
     205               fm2_verrealminor = value('FM2_VERREALMINOR',, 'OS2ENVIRONMENT')
     206               if fm2_verrealminor = '' then
     207                  fm2_verrealminor = '\" \"__DATE__'
     208               else
     209                  fm2_verrealminor = EscapeSEDString(fm2_verrealminor)
    200210               '@del' file '1>nul 2>nul'
    201                'sed -r -e "/#define[ \t]+VERMAJOR/s/(#define[ \t]+VERMAJOR[ \t]+)[^ \t]+/\1' || major || '/g" -e "/#define[ \t]+VERMINOR/s/(#define[ \t]+VERMINOR[ \t]+)[^ \t]+/\1' || minor || '/g" -e "/^[ \t]*#define[ \t]+VERREALMINOR/s/(#define[ \t]+VERREALMINOR).*/\1 \" \"__DATE__/g" ' || tmpfile || ' >' file
     211               'sed -r -e "/#define[ \t]+VERMAJOR/s/(#define[ \t]+VERMAJOR[ \t]+)[^ \t]+/\1' || major || '/g" -e "/#define[ \t]+VERMINOR/s/(#define[ \t]+VERMINOR[ \t]+)[^ \t]+/\1' || minor || '/g" -e "/^[ \t]*#define[ \t]+VERREALMINOR/s/(#define[ \t]+VERREALMINOR).*/\1 ' || fm2_verrealminor || '/g" ' || tmpfile || ' >' file
    202212            end
    203213      end
     
    283293   end
    284294
     295EscapeSEDString: procedure
     296  parse arg SEDString
     297  SEDString = SEDString || '00'x
     298  escape_chars = '\/"'
     299  escape_char  = '\'
     300  escaped_string = ''
     301  next_char = left(SEDString, 1)
     302  do i = 1 to length(SEDString)
     303     this_char = substr(SEDString, i, 1)
     304     if this_char = escape_char then
     305        do
     306           next_char = substr(SEDString, i + 1, 1)
     307           if pos(next_char, escape_chars) > 0 then
     308              do
     309                 escaped_string = escaped_string || this_char || next_char
     310                 i = i + 1
     311              end
     312           else
     313              escaped_string = escaped_string || escape_char || this_char
     314        end
     315     else
     316        if pos(this_char, escape_chars) > 0 then
     317           escaped_string = escaped_string || escape_char || this_char
     318        else
     319           if this_char \= '00'x then
     320              escaped_string = escaped_string || this_char
     321  end
     322return escaped_string
     323
    285324/*=== Error() Report ERROR, FAILURE etc. and exit ===*/
    286325
Note: See TracChangeset for help on using the changeset viewer.