File: check_op_code.sh

package info (click to toggle)
cppad 2026.00.00.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,584 kB
  • sloc: cpp: 112,960; sh: 6,146; ansic: 179; python: 71; sed: 12; makefile: 10
file content (67 lines) | stat: -rwxr-xr-x 2,066 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/bash -e
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
if [ ! -e "bin/check_op_code.sh" ]
then
   echo "bin/check_op_code.sh: must be executed from its parent directory"
   exit 1
fi
file='include/cppad/local/op_code_var.hpp'
# ---------------------------------------------------------------------------
# order in enum list
sed -n -e '/^enum/,/NumberOp/p' $file | sed \
   -e '/^enum/d' \
   -e '/NumberOp/d' \
   -e 's/^[ ]*//' \
   -e 's/,.*//' > temp.1
# -----------------------------------------------------------------------------
# check NumArgTable
sed -n -e '/NumArgTable\[\]/,/NumberOp/p' $file | \
   sed \
      -e '/NumArgTable\[\]/d' \
      -e '/NumberOp/d' \
      -e 's|^ */[*] ||' \
      -e 's| *[*]/.*||' > temp.2
#
if ! diff temp.1 temp.2
then
   echo 'check_op_code.sh: NumArgTable list is different from enum list'
   exit 1
fi
# -----------------------------------------------------------------------------
# check NumResTable
sed -n -e '/NumResTable\[\]/,/NumberOp/p' $file | \
   sed \
      -e '/NumResTable\[\]/d' \
      -e '/NumberOp/d' \
      -e 's|^ */[*] ||' \
      -e 's| *[*]/.*||' > temp.2
#
if ! diff temp.1 temp.2
then
   echo 'check_op_code.sh: NumResTable list is different from enum list'
   exit 1
fi
# -----------------------------------------------------------------------------
# check OpNameTable
sed -n -e '/const char \*OpNameTable\[\]/,/"Number"/p' $file | \
   sed \
      -e '/OpNameTable\[\]/d' \
      -e '/"Number"/d' \
      -e 's|^ *"||' \
      -e 's|".*||' \
      > temp.2
#
if ! diff temp.1 temp.2
then
   echo 'check_op_code.sh: OpNameTable list is different from enum list'
   exit 1
fi
# -----------------------------------------------------------------------------
# clean up
rm temp.1 temp.2
# ----------------------------------------------------------------------------
echo "$0: OK"
exit 0