Changeset 83 for trunk


Ignore:
Timestamp:
Mar 7, 2011, 10:44:02 AM (14 years ago)
Author:
markus
Message:

removed BLDLEVEL_ constants from version.h to get rid of redundant version symbols; fixed bldlevel.cmd signature string creation

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/os2ahci.def

    r82 r83  
    11library os2ahci
    2 Description '$@#thi.guten (www.thiguten.de):1.00.20110302#@OS/2 AHCI Adapter Device Driver'
     2Description '$@#thi.guten (www.thiguten.de):1.09.0#@##1## 03/07/2011 10:41:38      ECSDEVEL::::00::@@OS/2 AHCI Adapter Device Driver'
    33protmode
    44
  • trunk/src/os2ahci/version.h

    r82 r83  
    22
    33  version.h - define version numbers and strings for OS2AHCI.ADD
     4
     5  NOTE: this is kept in a separate file for easier parsing by
     6        bldlvl.cmd (which creates the bldlevel signature)
    47
    58******************************************************************************/
     
    811#define VERSION            109       /* driver version (2 implied decimals) */
    912
    10 /* BLDLEVEL information (in C source modules added via macro
    11    concatenation) for BuildLevel.cmd to generate BLDLEVEL information */
    12 
    13 #define BLDLEVEL_VENDOR         "thi.guten (www.thiguten.de)"
    14 #define BLDLEVEL_VERSION        "1.00"
    15 #define BLDLEVEL_INFO           "OS/2 AHCI Adapter Device Driver"
  • trunk/tools/bldlvl.cmd

    r78 r83  
    1212 *              Syntax: BuildLevel ModuleDefinitionFile Headerfile     *
    1313 *              e.g. BuildLevel PC2.def PC2.h                          *
     14 
     15 
     16 NOTE: this has been heavily modified to better suit the OS2AHCI
     17       environment...
     18 
     19 
    1420 *                                                                     *
    1521\***********************************************************************/
     
    6369Parse Arg DefinitionFile HeaderFile .
    6470Do While (DefinitionFile\="" & HeaderFile\="")
    65                                         /* We have valid commandline arguments, so first see
    66                                            if the Headerfile contents are ok for us */
    67     ReturnCode=ParseHeaderFile()
    68     If ReturnCode\=0 Then Leave
    69                                         /* Parse the definition file (*.DEF) for the module
    70                                            name, to see if we got a valid file */
    71     ReturnCode=ParseDefinitionFile()
    72     If ReturnCode\=0 Then Leave
    73                                         /* Copy the definition file, because we're going to
    74                                            change the original */
    75     Command="@copy "||DefinitionFile||" "||DefinitionCopy||" /v >NUL"
     71  /* We have valid commandline arguments, so first see
     72   if the Headerfile contents are ok for us */
     73  ReturnCode=ParseHeaderFile()
     74  If ReturnCode\=0 Then Leave
     75  /* Parse the definition file (*.DEF) for the module
     76   name, to see if we got a valid file */
     77  ReturnCode=ParseDefinitionFile()
     78  If ReturnCode\=0 Then Leave
     79  /* Copy the definition file, because we're going to
     80   change the original */
     81  Command="@copy "||DefinitionFile||" "||DefinitionCopy||" /v >NUL"
     82  Command
     83  Command="@del "||DefinitionFile||" >NUL 2>&1"
     84  Command
     85  If (rc\=0) Then Do
     86    ReturnCode=2
     87    Leave
     88    End
     89 
     90  /* Build DESCRIPTION statement for *.DEF file */
     91 
     92  /* MT: build date string as expected by bldlevel (26 chars fixed) */
     93  x = date('s')
     94  dat = " " || substr(x, 5, 2) || "/" || substr(x, 7, 2) || "/" || substr(x, 1, 4)
     95  dat = dat || " " || time() || "      "
     96  BldLevel=BldLevel_Header||"thi.guten (www.thiguten.de):"||BldLevel_Version||".0#@##1##"||dat||value('hostname',,'OS2ENVIRONMENT')||"::::00::@@OS/2 AHCI Adapter Device Driver"
     97  Description=Description_Header||BldLevel||Description_Trailer
     98 
     99  /* Copy the module definition file to be able to change
     100   the contents of the original one. In case of an error
     101   copy back the original one */
     102  ReturnCode=ModifyDefinitionFile()
     103  If ReturnCode\=0 Then Do
     104    Command="@copy "||DefinitionCopy||" "||DefinitionFile||" /v >NUL"
    76105    Command
    77     Command="@del "||DefinitionFile||" >NUL 2>&1"
    78     Command
    79     If (rc\=0) Then Do
    80         ReturnCode=2
    81         Leave
    82     End
    83                                         /* Build DESCRIPTION statement for *.DEF file */
    84     dat=DATE('Sorted') /* MT: add date to version */
    85     BldLevel=BldLevel_Header||BldLevel_Vendor||":"||BldLevel_Version||"."||dat||"#@"||BldLevel_Info
    86     Description=Description_Header||BldLevel||Description_Trailer
    87                                         /* Copy the module definition file to be able to change
    88                                            the contents of the original one. In case of an error
    89                                            copy back the original one */
    90     ReturnCode=ModifyDefinitionFile()
    91     If ReturnCode\=0 Then Do
    92         Command="@copy "||DefinitionCopy||" "||DefinitionFile||" /v >NUL"
    93         Command
    94         Command="@del "||DefinitionCopy||" >NUL 2>&1"
    95         Command
    96         Leave
    97     End
    98 
    99                                         /* Exit with success */
    100106    Command="@del "||DefinitionCopy||" >NUL 2>&1"
    101107    Command
    102     ReturnCode=0
    103108    Leave
    104 End
    105                                         /* Exit to commandline */
     109    End
     110
     111  /* Exit with success */
     112  Command="@del "||DefinitionCopy||" >NUL 2>&1"
     113  Command
     114  ReturnCode=0
     115  Leave
     116  End
     117/* Exit to commandline */
    106118If (ReturnCode\=0) Then Do
    107     Say ""
    108     Say "Error "||ReturnCode||" modifying "||DefinitionFile||", no changes made"
    109     Say ""
    110 End
     119  Say ""
     120  Say "Error "||ReturnCode||" modifying "||DefinitionFile||", no changes made"
     121  Say ""
     122  End
    111123Else Do
    112     Say "Module definition file "||DefinitionFile||" successfully modified"
    113 End
     124  Say "Module definition file "||DefinitionFile||" successfully modified"
     125  End
    114126Return ReturnCode
    115127
    116128/*--------------------------------------------------------------------------------------*\
    117  * Parse a C/C++ header file to test that the macros we build the BLDLEVEL information  *
    118  * from (BLDLEVEL_VENDOR, BLDLEVEL_VERSION, BLDLEVEL_INFO) are defined.                 *
    119  * Req:                                                                                 *
    120  *      none                                                                            *
    121  * Returns:                                                                             *
    122  *      ReturnCode .... Error code (0 if no error)                                      *
    123 \*--------------------------------------------------------------------------------------*/
     129 * Parse a C/C++ header file to for a VERSION (#define VERSION xxx)                    *
     130 \*--------------------------------------------------------------------------------------*/
    124131ParseHeaderFile:
    125     LinesLeft=2
    126                                         /* Read ahead 1st line */
    127     CurrentLine=LineIn(HeaderFile, 1, 1)
    128                                         /* Do while there are lines in the file */
    129     Do While(LinesLeft>0)
    130                                         /* Parse for constructs of the form:
    131                                            #define BLDLEVEL_Macro "Value" Comment */
    132                                         /* Kill that ... tabs */
    133         CurrentLine=Translate(CurrentLine, ' ', X2C(9))
    134         Parse Var CurrentLine Define Macro '"' Value '"' .
    135         Parse Upper Var Define Define
    136         Define=Space(Define, 0)
    137         Parse Upper Var Macro Macro
    138         Macro=Space(Macro, 0)
    139                                         /* Test for the macros we expect */
    140         If (Define="#DEFINE") Then Do
    141             Select
    142             When (Macro="BLDLEVEL_VENDOR") Then Do
    143                 BldLevel_Vendor=Value
    144             End
    145             When (Macro="BLDLEVEL_VERSION") Then Do
    146                 BldLevel_Version=Value
    147             End
    148             When (Macro="BLDLEVEL_INFO") Then Do
    149                 BldLevel_Info=Value
    150             End
    151             Otherwise
    152             End
     132  LinesLeft=2
     133/* Read ahead 1st line */
     134  CurrentLine=LineIn(HeaderFile, 1, 1)
     135/* Do while there are lines in the file */
     136  Do While(LinesLeft>0)
     137    /* Parse for constructs of the form:
     138     #define BLDLEVEL_Macro "Value" Comment */
     139    /* Kill that ... tabs */
     140    CurrentLine=Translate(CurrentLine, ' ', X2C(9))
     141    Parse Var CurrentLine Define Macro Value .
     142    Parse Upper Var Define Define
     143    Define=Space(Define, 0)
     144    Parse Upper Var Macro Macro
     145    Macro=Space(Macro, 0)
     146    /* Test for the macros we expect */
     147    /* MT: BLDLEVEL_VERSION is ignored so we do not have to change more than one
     148     *     symbol for each new version */
     149    If (Define="#DEFINE") Then Do
     150      Select
     151        When (Macro="VERSION") Then Do
     152          /* VERSION is a numeric value with 2 implied decimals */
     153          BldLevel_Version = substr(Value, 1, length(Value) - 2) || "." || substr(Value, length(Value) - 1, 2)
     154          End
     155        Otherwise
    153156        End
    154         CurrentLine=LineIn(HeaderFile)
    155                                         /* As Lines() returns 0 after having read the last line
    156                                            we have to ensure that this last line will be processed too */
    157         If (Lines(HeaderFile)=0) Then
    158             LinesLeft=LinesLeft-1
    159     End
    160     If (BldLevel_Vendor\="" & BldLevel_Version\="" & BldLevel_Info\="") Then
    161         Return 0
    162     Else
    163         Return 10
     157      End
     158    CurrentLine=LineIn(HeaderFile)
     159    /* As Lines() returns 0 after having read the last line
     160     we have to ensure that this last line will be processed too */
     161    If (Lines(HeaderFile)=0) Then
     162      LinesLeft=LinesLeft-1
     163    End
     164  If (BldLevel_Version\="") Then
     165    Return 0
     166  Else
     167    Return 10
    164168
    165169/*--------------------------------------------------------------------------------------*\
     
    170174 * Returns:                                                                             *
    171175 *      ReturnCode .... Error code (0 if no error)                                      *
    172 \*--------------------------------------------------------------------------------------*/
     176 \*--------------------------------------------------------------------------------------*/
    173177ParseDefinitionFile:
    174                                         /* Read ahead 1st line */
    175     Command=Stream(DefinitionFile, 'C', 'OPEN READ')
    176     LinesLeft=2
     178/* Read ahead 1st line */
     179  Command=Stream(DefinitionFile, 'C', 'OPEN READ')
     180  LinesLeft=2
     181  CurrentLine=LineIn(DefinitionFile)
     182/* Do while there are lines in the file */
     183  Do While(LinesLeft>0)
     184    /* Parse for constructs of the form:
     185     NAME/LIBRARY ModuleName Options */
     186    /* Kill that ... tabs */
     187    CurrentLine=Translate(CurrentLine, ' ', X2C(9))
     188    Parse Var CurrentLine Statement Module Options
     189    Parse Upper Var Statement Statement
     190    Statement=Space(Statement, 0)
     191    Module=Space(Module, 0)
     192    If (Module\="") Then Do
     193      If (Statement="NAME") Then
     194        ModuleName=Module||".exe"
     195      If (Statement="LIBRARY") Then
     196        ModuleName=Module||".add" /* MT: we're an ADD after all */
     197      End
     198    /* See if there is a DESCRIPTION statement */
     199    Parse Var CurrentLine Statement Options
     200    Parse Upper Var Statement Statement
     201    Statement=Space(Statement, 0)
     202    If (Statement="DESCRIPTION") Then
     203      DescriptionStatement=Options
    177204    CurrentLine=LineIn(DefinitionFile)
    178                                         /* Do while there are lines in the file */
    179     Do While(LinesLeft>0)
    180                                         /* Parse for constructs of the form:
    181                                            NAME/LIBRARY ModuleName Options */
    182                                         /* Kill that ... tabs */
    183         CurrentLine=Translate(CurrentLine, ' ', X2C(9))
    184         Parse Var CurrentLine Statement Module Options
    185         Parse Upper Var Statement Statement
    186         Statement=Space(Statement, 0)
    187         Module=Space(Module, 0)
    188         If (Module\="") Then Do
    189             If (Statement="NAME") Then
    190                 ModuleName=Module||".exe"
    191             If (Statement="LIBRARY") Then
    192                 ModuleName=Module||".add" /* MT: we're an ADD after all */
    193         End
    194                                         /* See if there is a DESCRIPTION statement */
    195         Parse Var CurrentLine Statement Options
    196         Parse Upper Var Statement Statement
    197         Statement=Space(Statement, 0)
    198         If (Statement="DESCRIPTION") Then
    199             DescriptionStatement=Options
    200         CurrentLine=LineIn(DefinitionFile)
    201                                         /* As Lines() returns 0 after having read the last line
    202                                            we have to ensure that this last line will be processed too */
    203         If (Lines(DefinitionFile)=0) Then
    204             LinesLeft=LinesLeft-1
    205     End
    206                                         /* Close the stream */
    207     Command=Stream(DefinitionFile, 'C', 'CLOSE')
    208     If (ModuleName\="" & DescriptionStatement\="") Then
    209         Return 0
    210     Else
    211         Return 20
     205    /* As Lines() returns 0 after having read the last line
     206     we have to ensure that this last line will be processed too */
     207    If (Lines(DefinitionFile)=0) Then
     208      LinesLeft=LinesLeft-1
     209    End
     210/* Close the stream */
     211  Command=Stream(DefinitionFile, 'C', 'CLOSE')
     212  If (ModuleName\="" & DescriptionStatement\="") Then
     213    Return 0
     214  Else
     215    Return 20
    212216
    213217/*--------------------------------------------------------------------------------------*\
     
    218222 * Returns:                                                                             *
    219223 *      ReturnCode .... Error code (0 if no error)                                      *
    220 \*--------------------------------------------------------------------------------------*/
     224 \*--------------------------------------------------------------------------------------*/
    221225ModifyDefinitionFile:
    222                                         /* Read and write ahead 1st line */
    223     Command=Stream(DefinitionFile, 'C', 'OPEN WRITE')
    224     If (Command="ERROR") Then
    225         Return 30
    226     Command=Stream(DefinitionCopy, 'C', 'OPEN READ')
    227     If (Command="ERROR") Then
    228         Return 31
    229     LinesLeft=2
     226/* Read and write ahead 1st line */
     227  Command=Stream(DefinitionFile, 'C', 'OPEN WRITE')
     228  If (Command="ERROR") Then
     229    Return 30
     230  Command=Stream(DefinitionCopy, 'C', 'OPEN READ')
     231  If (Command="ERROR") Then
     232    Return 31
     233  LinesLeft=2
     234  CurrentLine=LineIn(DefinitionCopy)
     235/* Do while there are lines in the file */
     236  Do While(LinesLeft>0)
     237    /* Parse for constructs of the form:
     238     DESCRIPTION Options */
     239    /* Kill that ... tabs */
     240    CurrentLine=Translate(CurrentLine, ' ', X2C(9))
     241    Parse Var CurrentLine Statement Options
     242    Parse Upper Var Statement Statement
     243    Statement=Space(Statement, 0)
     244    If (Statement="DESCRIPTION") Then Do
     245      Command=LineOut(DefinitionFile, Description)
     246      End
     247    Else Do
     248      Command=LineOut(DefinitionFile, CurrentLine)
     249      End
    230250    CurrentLine=LineIn(DefinitionCopy)
    231                                         /* Do while there are lines in the file */
    232     Do While(LinesLeft>0)
    233                                         /* Parse for constructs of the form:
    234                                            DESCRIPTION Options */
    235                                         /* Kill that ... tabs */
    236         CurrentLine=Translate(CurrentLine, ' ', X2C(9))
    237         Parse Var CurrentLine Statement Options
    238         Parse Upper Var Statement Statement
    239         Statement=Space(Statement, 0)
    240         If (Statement="DESCRIPTION") Then Do
    241             Command=LineOut(DefinitionFile, Description)
    242         End
    243         Else Do
    244             Command=LineOut(DefinitionFile, CurrentLine)
    245         End
    246         CurrentLine=LineIn(DefinitionCopy)
    247                                         /* As Lines() returns 0 after having read the last line
    248                                            we have to ensure that this last line will be processed too */
    249         If (Lines(DefinitionCopy)=0) Then
    250             LinesLeft=LinesLeft-1
    251     End
    252                                         /* Close the streams */
    253     Command=Stream(DefinitionFile, 'C', 'CLOSE')
    254     Command=Stream(DefinitionCopy, 'C', 'CLOSE')
    255     Return 0
     251    /* As Lines() returns 0 after having read the last line
     252     we have to ensure that this last line will be processed too */
     253    If (Lines(DefinitionCopy)=0) Then
     254      LinesLeft=LinesLeft-1
     255    End
     256/* Close the streams */
     257  Command=Stream(DefinitionFile, 'C', 'CLOSE')
     258  Command=Stream(DefinitionCopy, 'C', 'CLOSE')
     259Return 0
    256260
    257261/*--------------------------------------------------------------------------------------*\
     
    262266 * Returns:                                                                             *
    263267 *      none                                                                            *
    264 \*--------------------------------------------------------------------------------------*/
     268 \*--------------------------------------------------------------------------------------*/
    265269SignalHandler:
    266     Say "    CTRL+BRK currently disabled"
    267     Return 0
    268 
    269 
     270  Say "    CTRL+BRK currently disabled"
     271Return 0
     272
     273
Note: See TracChangeset for help on using the changeset viewer.