1#!/bin/sh - 2# $Id$ 3# 4# Build the C# files. 5 6msgcsharp="/* DO NOT EDIT: automatically built by dist/s_csharp_const. */" 7 8. ./RELEASE 9 10t=/tmp/__csharp 11trap 'rm -f $t; exit 0' 0 1 2 3 13 15 12 13(echo "$msgcsharp" && 14 echo && 15 echo 'namespace BerkeleyDB.Internal {' && 16 echo && 17 echo ' internal class DbConstants {' && 18 19 for i in `egrep '^DB_.*C$' pubdef.in | awk '{print $1}'`; do \ 20 sed -e ':a' -e '/\\$/N;s/\\\n[ ]*/ /;ta' \ 21 ../dbinc_auto/api_flags.in ../dbinc/db.in | \ 22 egrep -w "^#define[ ]$i|^[ ][ ]*$i" ; 23 done | 24 sed -e "s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/" \ 25 -e "s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/" \ 26 -e "s/@DB_VERSION_PATCH@/$DB_VERSION_PATCH/" \ 27 -e "s/@DB_VERSION_STRING@/\"$DB_VERSION_STRING\"/" \ 28 -e 's/^#define[ ][ ]*//' \ 29 -e 's/[()=,]/ /g' \ 30 -e 's/\/\*.*$//' \ 31 -e 's/^[ ]*//' \ 32 -e 's/[ ]*$//g' \ 33 -e 's/[ ][ ]*/ /g' \ 34 -e 's/ / = /' | \ 35 awk '{ print " internal const uint " $0 ";" }' | 36 # Change negative values from uint to int 37 # Change replication timeout constants from uint to int 38 # Change replication manager ack policies to int 39 # Change the version from uint to string 40 sed -e 's/\(.*\)uint\(.*= -.*\)/\1int\2/' \ 41 -e 's/uint DB_REP_ACK_TIMEOUT/int DB_REP_ACK_TIMEOUT/' \ 42 -e 's/uint DB_REP_CHECKPOINT_DELAY/int DB_REP_CHECKPOINT_DELAY/' \ 43 -e 's/uint DB_REP_CONNECTION_RETRY/int DB_REP_CONNECTION_RETRY/' \ 44 -e 's/uint DB_REP_ELECTION_TIMEOUT/int DB_REP_ELECTION_TIMEOUT/' \ 45 -e 's/uint DB_REP_ELECTION_RETRY/int DB_REP_ELECTION_RETRY/' \ 46 -e 's/uint DB_REP_FULL_ELECTION_TIMEOUT/int DB_REP_FULL_ELECTION_TIMEOUT/' \ 47 -e 's/uint DB_REP_HEARTBEAT_MONITOR/int DB_REP_HEARTBEAT_MONITOR/' \ 48 -e 's/uint DB_REP_HEARTBEAT_SEND/int DB_REP_HEARTBEAT_SEND/' \ 49 -e 's/uint DB_REP_LEASE_TIMEOUT/int DB_REP_LEASE_TIMEOUT/' \ 50 -e 's/uint DB_REPMGR_ACKS_ALL/int DB_REPMGR_ACKS_ALL/' \ 51 -e 's/uint DB_REPMGR_ACKS_ALL_PEERS/int DB_REPMGR_ACKS_ALL_PEERS/' \ 52 -e 's/uint DB_REPMGR_ACKS_NONE/int DB_REPMGR_ACKS_NONE/' \ 53 -e 's/uint DB_REPMGR_ACKS_ONE/int DB_REPMGR_ACKS_ONE/' \ 54 -e 's/uint DB_REPMGR_ACKS_ONE_PEER/int DB_REPMGR_ACKS_ONE_PEER/' \ 55 -e 's/uint DB_REPMGR_ACKS_QUORUM/int DB_REPMGR_ACKS_QUORUM/' \ 56 -e 's/uint DB_VERSION_STRING/string DB_VERSION_STRING/' \ 57 -e 's/\(.*\)uint \(DB_VERSION_[A-Z]*\)\([ =]*\)\([0-9][0-9]*\);/\1uint \2\3\4;\n\1string \2_STR\3\"\4\";/' && 58 echo ' internal const uint DB_USERCOPY_GETDATA = 0x00000001;' && 59 echo ' internal const uint DB_USERCOPY_SETDATA = 0x00000002;' && 60 echo ' }' && 61 echo '}' && 62 echo && 63 echo '// end of DbConstants.cs') > $t 64 65f=../csharp/Internal/DbConstants.cs 66cmp $t $f > /dev/null 2>&1 || 67 (echo "Building $f" && rm -f $f && cp $t $f && chmod 444 $f) 68