Zbee ZCL se: fix typo found by conflict hf
[metze/wireshark/wip.git] / epan / unit_strings.c
1 /* unit_strings.c
2  * Units to append to field values
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  */
22
23 #include "config.h"
24
25 #include <wsutil/utf8_entities.h>
26 #include <wsutil/str_util.h>
27 #include "unit_strings.h"
28
29 char* unit_name_string_get_value(guint32 value, unit_name_string* units)
30 {
31     if (units->plural == NULL)
32         return units->singular;
33
34     return plurality(value, units->singular, units->plural);
35 }
36
37 char* unit_name_string_get_value64(guint64 value, unit_name_string* units)
38 {
39     if (units->plural == NULL)
40         return units->singular;
41
42     return plurality(value, units->singular, units->plural);
43 }
44
45 char* unit_name_string_get_double(double value, unit_name_string* units)
46 {
47     if (units->plural == NULL)
48         return units->singular;
49
50     return plurality(value, units->singular, units->plural);
51 }
52
53 /*
54  * A default set of unit strings that dissectors can use for
55  * header fields.  Some units intentionally have a space
56  * character in them for spacing between unit and value
57  */
58 const unit_name_string units_foot_feet = { " foot", " feet" };
59 const unit_name_string units_bit_bits = { " bit", " bits" };
60 const unit_name_string units_byte_bytes = { " byte", " bytes" };
61 const unit_name_string units_byte_bytespsecond = { " byte/s", " bytes/s" };
62 const unit_name_string units_octet_octets = { " octet", " octets" };
63 const unit_name_string units_word_words = { " word", " words" };
64 const unit_name_string units_tick_ticks = { " tick", " ticks" };
65 const unit_name_string units_meters = { "m", NULL };
66 const unit_name_string units_meter_meters = { " meter", " meters" };
67 const unit_name_string units_week_weeks = { " week", " weeks" };
68 const unit_name_string units_day_days = { " day", " days" };
69 const unit_name_string units_hour_hours = { " hour", " hours" };
70 const unit_name_string units_hours = { "h", NULL };
71 const unit_name_string units_minute_minutes = { " minute", " minutes" };
72 const unit_name_string units_minutes = { "min", NULL };
73 const unit_name_string units_second_seconds = { " second", " seconds" };
74 const unit_name_string units_seconds = { "s", NULL };
75 const unit_name_string units_millisecond_milliseconds = { " millisecond", " milliseconds" };
76 const unit_name_string units_milliseconds = { "ms", NULL };
77 const unit_name_string units_microsecond_microseconds = { " microsecond", " microseconds" };
78 const unit_name_string units_microseconds = { UTF8_MICRO_SIGN "s", NULL };
79 const unit_name_string units_nanosecond_nanoseconds = { " nanosecond", " nanoseconds" };
80 const unit_name_string units_nanoseconds = { "ns", NULL };
81 const unit_name_string units_nanometers = { "nm", NULL };
82 const unit_name_string units_degree_degrees = { " degree", " degrees" };
83 const unit_name_string units_degree_celsius = { UTF8_DEGREE_SIGN "C", NULL };
84 const unit_name_string units_decibels = { "dB", NULL };
85 const unit_name_string units_dbm = { "dBm", NULL };
86 const unit_name_string units_dbi = { "dBi", NULL };
87 const unit_name_string units_mbm = { "mBm", NULL };
88 const unit_name_string units_percent = { "%", NULL };
89 const unit_name_string units_khz = { "kHz", NULL };
90 const unit_name_string units_mhz = { "MHz", NULL };
91 const unit_name_string units_ghz = { "GHz", NULL };
92 const unit_name_string units_hz = { "Hz", NULL };
93 const unit_name_string units_hz_s = { "Hz/s", NULL };
94 const unit_name_string units_kbit = { "kbit", NULL };
95 const unit_name_string units_kbps = { "Kbps", NULL };
96 const unit_name_string units_kibps = { "KiB/s", NULL };
97 const unit_name_string units_km = { "km", NULL };
98 const unit_name_string units_kmh = { "km/h", NULL };
99 const unit_name_string units_bit_sec = { "bits/s", NULL };
100 const unit_name_string units_milliamps = { "mA", NULL };
101 const unit_name_string units_microwatts = { UTF8_MICRO_SIGN "W", NULL };
102 const unit_name_string units_volt = { "V", NULL };
103 const unit_name_string units_grams_per_second = { "g/s", NULL };
104 const unit_name_string units_meter_sec = { "m/s", NULL };
105 const unit_name_string units_meter_sec_squared = { "m/s" UTF8_SUPERSCRIPT_TWO , NULL };
106 const unit_name_string units_segment_remaining = { " segment remaining", " segments remaining" };
107 const unit_name_string units_frame_frames = { " frame", " frames" };
108 const unit_name_string units_revolutions_per_minute = { "rpm", NULL };
109 const unit_name_string units_kilopascal = { "kPa", NULL };
110 const unit_name_string units_newton_metre = { "Nm", NULL };
111 const unit_name_string units_liter_per_hour = { "L/h", NULL };
112
113
114 /*
115  * Editor modelines
116  *
117  * Local Variables:
118  * c-basic-offset: 4
119  * tab-width: 8
120  * indent-tabs-mode: nil
121  * End:
122  *
123  * ex: set shiftwidth=4 tabstop=8 expandtab:
124  * :indentSize=4:tabSize=8:noTabs=true:
125  */