Work around bug in AIX 7.1 awk in report card tool
[dejagnu.git] / lib / targetdb.exp
blob7dfd63f767a9fbac14548191be09b7e744bbd0d7
1 # Copyright (C) 1992-2019, 2020 Free Software Foundation, Inc.
3 # This file is part of DejaGnu.
5 # DejaGnu is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # DejaGnu is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with DejaGnu.  If not, see <http://www.gnu.org/licenses/>.
18 # Searches in the appropriate place (the board_info array) for the specified
19 # information.
21 proc board_info { machine op args } {
22     global target_info
23     global board_info
25     verbose "board_info $machine $op $args" 3
27     if {[info exists target_info($machine,name)]} {
28         set machine $target_info($machine,name)
29     }
30     if { $op eq "exists" } {
31         if { [llength $args] == 0 } {
32             return [info exists board_info($machine,name)]
33         } else {
34             return [info exists board_info($machine,[lindex $args 0])]
35         }
36     }
37     if { [llength $args] == 0 } {
38         verbose "getting $machine $op" 3
39         if {[info exists board_info($machine,$op)]} {
40             return $board_info($machine,$op)
41         } else {
42             return ""
43         }
44     }
45     return ""
48 proc target_info { op args } {
49     return [eval "board_info target \"$op\" $args"]
52 proc host_info { op args } {
53     return [eval "board_info host \"$op\" $args"]
56 # Set ENTRY to VALUE for the current board.
58 proc set_board_info { entry value } {
59     global board_info board
60     if {![info exists board_info($board,$entry)]} {
61         set board_info($board,$entry) $value
62     }
66 # Append VALUE to ENTRY for the current board.
68 proc add_board_info { entry value } {
69     global board_info board
70     lappend board_info($board,$entry) $value
73 # Fill in ENTRY with VALUE for the current target.
75 proc set_currtarget_info { entry value } {
76     global board_info
78     set board [target_info name]
80     if {![info exists board_info($board,$entry)]} {
81         set board_info($board,$entry) $value
82     }
85 # Unset ENTRY for the current board being defined.
87 proc unset_board_info { entry } {
88     global board_info board
90     if {[info exists board_info($board,$entry)]} {
91         unset board_info($board,$entry)
92     }
95 # Unset ENTRY for the current board being defined.
97 proc unset_currtarget_info { entry } {
98     global board_info
100     set board [target_info name]
102     if {[info exists board_info($board,$entry)]} {
103         unset board_info($board,$entry)
104     }