BuildOidHdrs.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/sh
  2. # $XConsortium: BuildOidHdrs.sh /main/3 1996/08/12 18:41:52 cde-hp $
  3. #
  4. # (c) Copyright 1996 Digital Equipment Corporation.
  5. # (c) Copyright 1996 Hewlett-Packard Company.
  6. # (c) Copyright 1996 International Business Machines Corp.
  7. # (c) Copyright 1996 Sun Microsystems, Inc.
  8. # (c) Copyright 1996 Novell, Inc.
  9. # (c) Copyright 1996 FUJITSU LIMITED.
  10. # (c) Copyright 1996 Hitachi.
  11. #
  12. in_file=PdmOidDefs.in
  13. oid_file=PdmOidDefs.h
  14. str_file=PdmOidStrs.h
  15. tmpbase=`basename $0`
  16. oid_tmp=$tmpbase.oid_tmp
  17. str_tmp=$tmpbase.str_tmp
  18. rm -f $oid_tmp > /dev/null 2>&1
  19. rm -f $str_tmp > /dev/null 2>&1
  20. first=1
  21. echo "parsing $in_file \c"
  22. cat $in_file |
  23. (
  24. while read oid str mset mnum defmsg
  25. do
  26. if [ -n "$oid" -a "$oid" != "#" ]
  27. then
  28. if [ $first -eq 1 ]
  29. then
  30. first=0
  31. else
  32. echo "," >> $oid_tmp
  33. echo "," >> $str_tmp
  34. fi
  35. echo " $oid\c" >> $oid_tmp
  36. str_length=`echo "$str\c" | wc -c`
  37. if [ -z "$mset" ] ; then
  38. mset="-1"
  39. fi
  40. if [ -z "$mnum" ] ; then
  41. mnum="-1"
  42. fi
  43. if [ -z "$defmsg" ] ; then
  44. defmsg="(const char*)NULL"
  45. else
  46. defmsg="\"$defmsg\""
  47. fi
  48. echo " { \"$str\", $str_length, $mset, $mnum, $defmsg }\c" \
  49. >> $str_tmp
  50. echo ".\c"
  51. fi
  52. done
  53. echo >> $oid_tmp
  54. echo >> $str_tmp
  55. )
  56. echo "done"
  57. echo "creating $oid_file ...\c"
  58. (
  59. echo '/* $'XConsortium'$ */'
  60. echo '/* This is an automatically-generated file. Do not edit. */'
  61. echo '/*
  62. * (c) Copyright 1996 Digital Equipment Corporation.
  63. * (c) Copyright 1996 Hewlett-Packard Company.
  64. * (c) Copyright 1996 International Business Machines Corp.
  65. * (c) Copyright 1996 Sun Microsystems, Inc.
  66. * (c) Copyright 1996 Novell, Inc.
  67. * (c) Copyright 1996 FUJITSU LIMITED.
  68. * (c) Copyright 1996 Hitachi.
  69. */'
  70. echo
  71. echo 'typedef enum {'
  72. cat $oid_tmp
  73. echo '} PdmOid;'
  74. ) > $oid_file
  75. echo "done"
  76. echo "creating $str_file ...\c"
  77. (
  78. echo '/* $'XConsortium'$ */'
  79. echo '/* This is an automatically-generated file. Do not edit. */'
  80. echo '/*
  81. * (c) Copyright 1996 Digital Equipment Corporation.
  82. * (c) Copyright 1996 Hewlett-Packard Company.
  83. * (c) Copyright 1996 International Business Machines Corp.
  84. * (c) Copyright 1996 Sun Microsystems, Inc.
  85. * (c) Copyright 1996 Novell, Inc.
  86. * (c) Copyright 1996 FUJITSU LIMITED.
  87. * (c) Copyright 1996 Hitachi.
  88. */'
  89. echo
  90. echo "static int PdmOidStringMapCount = `cat $str_tmp | wc -l`;"
  91. echo
  92. echo 'static const PdmOidStringMapEntry PdmOidStringMap[] = {'
  93. cat $str_tmp
  94. echo '};'
  95. ) > $str_file
  96. echo "done"
  97. rm -f $oid_tmp > /dev/null 2>&1
  98. rm -f $str_tmp > /dev/null 2>&1