1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 hwmon.h - part of lm_sensors, Linux kernel modules for hardware monitoring
4
5 This file declares helper functions for the sysfs class "hwmon",
6 for use by sensors drivers.
7
8 Copyright (C) 2005 Mark M. Hoffman <mhoffman@lightlink.com>
9
10 */
11
12 #ifndef _HWMON_H_
13 #define _HWMON_H_
14
15 #include <linux/bitops.h>
16 #include <linux/cleanup.h>
17
18 struct device;
19 struct attribute_group;
20
21 enum hwmon_sensor_types {
22 hwmon_chip,
23 hwmon_temp,
24 hwmon_in,
25 hwmon_curr,
26 hwmon_power,
27 hwmon_energy,
28 hwmon_energy64,
29 hwmon_humidity,
30 hwmon_fan,
31 hwmon_pwm,
32 hwmon_intrusion,
33 hwmon_max,
34 };
35
36 enum hwmon_chip_attributes {
37 hwmon_chip_temp_reset_history,
38 hwmon_chip_in_reset_history,
39 hwmon_chip_curr_reset_history,
40 hwmon_chip_power_reset_history,
41 hwmon_chip_register_tz,
42 hwmon_chip_update_interval,
43 hwmon_chip_update_interval_us,
44 hwmon_chip_alarms,
45 hwmon_chip_samples,
46 hwmon_chip_curr_samples,
47 hwmon_chip_in_samples,
48 hwmon_chip_power_samples,
49 hwmon_chip_temp_samples,
50 hwmon_chip_beep_enable,
51 hwmon_chip_pec,
52 };
53
54 #define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
55 #define HWMON_C_IN_RESET_HISTORY BIT(hwmon_chip_in_reset_history)
56 #define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
57 #define HWMON_C_POWER_RESET_HISTORY BIT(hwmon_chip_power_reset_history)
58 #define HWMON_C_REGISTER_TZ BIT(hwmon_chip_register_tz)
59 #define HWMON_C_UPDATE_INTERVAL BIT(hwmon_chip_update_interval)
60 #define HWMON_C_UPDATE_INTERVAL_US BIT(hwmon_chip_update_interval_us)
61 #define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
62 #define HWMON_C_SAMPLES BIT(hwmon_chip_samples)
63 #define HWMON_C_CURR_SAMPLES BIT(hwmon_chip_curr_samples)
64 #define HWMON_C_IN_SAMPLES BIT(hwmon_chip_in_samples)
65 #define HWMON_C_POWER_SAMPLES BIT(hwmon_chip_power_samples)
66 #define HWMON_C_TEMP_SAMPLES BIT(hwmon_chip_temp_samples)
67 #define HWMON_C_BEEP_ENABLE BIT(hwmon_chip_beep_enable)
68 #define HWMON_C_PEC BIT(hwmon_chip_pec)
69
70 enum hwmon_temp_attributes {
71 hwmon_temp_enable,
72 hwmon_temp_input,
73 hwmon_temp_type,
74 hwmon_temp_lcrit,
75 hwmon_temp_lcrit_hyst,
76 hwmon_temp_min,
77 hwmon_temp_min_hyst,
78 hwmon_temp_max,
79 hwmon_temp_max_hyst,
80 hwmon_temp_crit,
81 hwmon_temp_crit_hyst,
82 hwmon_temp_emergency,
83 hwmon_temp_emergency_hyst,
84 hwmon_temp_alarm,
85 hwmon_temp_lcrit_alarm,
86 hwmon_temp_min_alarm,
87 hwmon_temp_max_alarm,
88 hwmon_temp_crit_alarm,
89 hwmon_temp_emergency_alarm,
90 hwmon_temp_fault,
91 hwmon_temp_offset,
92 hwmon_temp_label,
93 hwmon_temp_lowest,
94 hwmon_temp_highest,
95 hwmon_temp_reset_history,
96 hwmon_temp_rated_min,
97 hwmon_temp_rated_max,
98 hwmon_temp_beep,
99 };
100
101 #define HWMON_T_ENABLE BIT(hwmon_temp_enable)
102 #define HWMON_T_INPUT BIT(hwmon_temp_input)
103 #define HWMON_T_TYPE BIT(hwmon_temp_type)
104 #define HWMON_T_LCRIT BIT(hwmon_temp_lcrit)
105 #define HWMON_T_LCRIT_HYST BIT(hwmon_temp_lcrit_hyst)
106 #define HWMON_T_MIN BIT(hwmon_temp_min)
107 #define HWMON_T_MIN_HYST BIT(hwmon_temp_min_hyst)
108 #define HWMON_T_MAX BIT(hwmon_temp_max)
109 #define HWMON_T_MAX_HYST BIT(hwmon_temp_max_hyst)
110 #define HWMON_T_CRIT BIT(hwmon_temp_crit)
111 #define HWMON_T_CRIT_HYST BIT(hwmon_temp_crit_hyst)
112 #define HWMON_T_EMERGENCY BIT(hwmon_temp_emergency)
113 #define HWMON_T_EMERGENCY_HYST BIT(hwmon_temp_emergency_hyst)
114 #define HWMON_T_ALARM BIT(hwmon_temp_alarm)
115 #define HWMON_T_MIN_ALARM BIT(hwmon_temp_min_alarm)
116 #define HWMON_T_MAX_ALARM BIT(hwmon_temp_max_alarm)
117 #define HWMON_T_CRIT_ALARM BIT(hwmon_temp_crit_alarm)
118 #define HWMON_T_LCRIT_ALARM BIT(hwmon_temp_lcrit_alarm)
119 #define HWMON_T_EMERGENCY_ALARM BIT(hwmon_temp_emergency_alarm)
120 #define HWMON_T_FAULT BIT(hwmon_temp_fault)
121 #define HWMON_T_OFFSET BIT(hwmon_temp_offset)
122 #define HWMON_T_LABEL BIT(hwmon_temp_label)
123 #define HWMON_T_LOWEST BIT(hwmon_temp_lowest)
124 #define HWMON_T_HIGHEST BIT(hwmon_temp_highest)
125 #define HWMON_T_RESET_HISTORY BIT(hwmon_temp_reset_history)
126 #define HWMON_T_RATED_MIN BIT(hwmon_temp_rated_min)
127 #define HWMON_T_RATED_MAX BIT(hwmon_temp_rated_max)
128 #define HWMON_T_BEEP BIT(hwmon_temp_beep)
129
130 enum hwmon_in_attributes {
131 hwmon_in_enable,
132 hwmon_in_input,
133 hwmon_in_min,
134 hwmon_in_max,
135 hwmon_in_lcrit,
136 hwmon_in_crit,
137 hwmon_in_average,
138 hwmon_in_lowest,
139 hwmon_in_highest,
140 hwmon_in_reset_history,
141 hwmon_in_label,
142 hwmon_in_alarm,
143 hwmon_in_min_alarm,
144 hwmon_in_max_alarm,
145 hwmon_in_lcrit_alarm,
146 hwmon_in_crit_alarm,
147 hwmon_in_rated_min,
148 hwmon_in_rated_max,
149 hwmon_in_beep,
150 hwmon_in_fault,
151 };
152
153 #define HWMON_I_ENABLE BIT(hwmon_in_enable)
154 #define HWMON_I_INPUT BIT(hwmon_in_input)
155 #define HWMON_I_MIN BIT(hwmon_in_min)
156 #define HWMON_I_MAX BIT(hwmon_in_max)
157 #define HWMON_I_LCRIT BIT(hwmon_in_lcrit)
158 #define HWMON_I_CRIT BIT(hwmon_in_crit)
159 #define HWMON_I_AVERAGE BIT(hwmon_in_average)
160 #define HWMON_I_LOWEST BIT(hwmon_in_lowest)
161 #define HWMON_I_HIGHEST BIT(hwmon_in_highest)
162 #define HWMON_I_RESET_HISTORY BIT(hwmon_in_reset_history)
163 #define HWMON_I_LABEL BIT(hwmon_in_label)
164 #define HWMON_I_ALARM BIT(hwmon_in_alarm)
165 #define HWMON_I_MIN_ALARM BIT(hwmon_in_min_alarm)
166 #define HWMON_I_MAX_ALARM BIT(hwmon_in_max_alarm)
167 #define HWMON_I_LCRIT_ALARM BIT(hwmon_in_lcrit_alarm)
168 #define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
169 #define HWMON_I_RATED_MIN BIT(hwmon_in_rated_min)
170 #define HWMON_I_RATED_MAX BIT(hwmon_in_rated_max)
171 #define HWMON_I_BEEP BIT(hwmon_in_beep)
172 #define HWMON_I_FAULT BIT(hwmon_in_fault)
173
174 enum hwmon_curr_attributes {
175 hwmon_curr_enable,
176 hwmon_curr_input,
177 hwmon_curr_min,
178 hwmon_curr_max,
179 hwmon_curr_lcrit,
180 hwmon_curr_crit,
181 hwmon_curr_average,
182 hwmon_curr_lowest,
183 hwmon_curr_highest,
184 hwmon_curr_reset_history,
185 hwmon_curr_label,
186 hwmon_curr_alarm,
187 hwmon_curr_min_alarm,
188 hwmon_curr_max_alarm,
189 hwmon_curr_lcrit_alarm,
190 hwmon_curr_crit_alarm,
191 hwmon_curr_rated_min,
192 hwmon_curr_rated_max,
193 hwmon_curr_beep,
194 };
195
196 #define HWMON_C_ENABLE BIT(hwmon_curr_enable)
197 #define HWMON_C_INPUT BIT(hwmon_curr_input)
198 #define HWMON_C_MIN BIT(hwmon_curr_min)
199 #define HWMON_C_MAX BIT(hwmon_curr_max)
200 #define HWMON_C_LCRIT BIT(hwmon_curr_lcrit)
201 #define HWMON_C_CRIT BIT(hwmon_curr_crit)
202 #define HWMON_C_AVERAGE BIT(hwmon_curr_average)
203 #define HWMON_C_LOWEST BIT(hwmon_curr_lowest)
204 #define HWMON_C_HIGHEST BIT(hwmon_curr_highest)
205 #define HWMON_C_RESET_HISTORY BIT(hwmon_curr_reset_history)
206 #define HWMON_C_LABEL BIT(hwmon_curr_label)
207 #define HWMON_C_ALARM BIT(hwmon_curr_alarm)
208 #define HWMON_C_MIN_ALARM BIT(hwmon_curr_min_alarm)
209 #define HWMON_C_MAX_ALARM BIT(hwmon_curr_max_alarm)
210 #define HWMON_C_LCRIT_ALARM BIT(hwmon_curr_lcrit_alarm)
211 #define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
212 #define HWMON_C_RATED_MIN BIT(hwmon_curr_rated_min)
213 #define HWMON_C_RATED_MAX BIT(hwmon_curr_rated_max)
214 #define HWMON_C_BEEP BIT(hwmon_curr_beep)
215
216 enum hwmon_power_attributes {
217 hwmon_power_enable,
218 hwmon_power_average,
219 hwmon_power_average_interval,
220 hwmon_power_average_interval_max,
221 hwmon_power_average_interval_min,
222 hwmon_power_average_highest,
223 hwmon_power_average_lowest,
224 hwmon_power_average_max,
225 hwmon_power_average_min,
226 hwmon_power_input,
227 hwmon_power_input_highest,
228 hwmon_power_input_lowest,
229 hwmon_power_reset_history,
230 hwmon_power_accuracy,
231 hwmon_power_cap,
232 hwmon_power_cap_hyst,
233 hwmon_power_cap_max,
234 hwmon_power_cap_min,
235 hwmon_power_min,
236 hwmon_power_max,
237 hwmon_power_crit,
238 hwmon_power_lcrit,
239 hwmon_power_label,
240 hwmon_power_alarm,
241 hwmon_power_cap_alarm,
242 hwmon_power_min_alarm,
243 hwmon_power_max_alarm,
244 hwmon_power_lcrit_alarm,
245 hwmon_power_crit_alarm,
246 hwmon_power_rated_min,
247 hwmon_power_rated_max,
248 };
249
250 #define HWMON_P_ENABLE BIT(hwmon_power_enable)
251 #define HWMON_P_AVERAGE BIT(hwmon_power_average)
252 #define HWMON_P_AVERAGE_INTERVAL BIT(hwmon_power_average_interval)
253 #define HWMON_P_AVERAGE_INTERVAL_MAX BIT(hwmon_power_average_interval_max)
254 #define HWMON_P_AVERAGE_INTERVAL_MIN BIT(hwmon_power_average_interval_min)
255 #define HWMON_P_AVERAGE_HIGHEST BIT(hwmon_power_average_highest)
256 #define HWMON_P_AVERAGE_LOWEST BIT(hwmon_power_average_lowest)
257 #define HWMON_P_AVERAGE_MAX BIT(hwmon_power_average_max)
258 #define HWMON_P_AVERAGE_MIN BIT(hwmon_power_average_min)
259 #define HWMON_P_INPUT BIT(hwmon_power_input)
260 #define HWMON_P_INPUT_HIGHEST BIT(hwmon_power_input_highest)
261 #define HWMON_P_INPUT_LOWEST BIT(hwmon_power_input_lowest)
262 #define HWMON_P_RESET_HISTORY BIT(hwmon_power_reset_history)
263 #define HWMON_P_ACCURACY BIT(hwmon_power_accuracy)
264 #define HWMON_P_CAP BIT(hwmon_power_cap)
265 #define HWMON_P_CAP_HYST BIT(hwmon_power_cap_hyst)
266 #define HWMON_P_CAP_MAX BIT(hwmon_power_cap_max)
267 #define HWMON_P_CAP_MIN BIT(hwmon_power_cap_min)
268 #define HWMON_P_MIN BIT(hwmon_power_min)
269 #define HWMON_P_MAX BIT(hwmon_power_max)
270 #define HWMON_P_LCRIT BIT(hwmon_power_lcrit)
271 #define HWMON_P_CRIT BIT(hwmon_power_crit)
272 #define HWMON_P_LABEL BIT(hwmon_power_label)
273 #define HWMON_P_ALARM BIT(hwmon_power_alarm)
274 #define HWMON_P_CAP_ALARM BIT(hwmon_power_cap_alarm)
275 #define HWMON_P_MIN_ALARM BIT(hwmon_power_min_alarm)
276 #define HWMON_P_MAX_ALARM BIT(hwmon_power_max_alarm)
277 #define HWMON_P_LCRIT_ALARM BIT(hwmon_power_lcrit_alarm)
278 #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
279 #define HWMON_P_RATED_MIN BIT(hwmon_power_rated_min)
280 #define HWMON_P_RATED_MAX BIT(hwmon_power_rated_max)
281
282 enum hwmon_energy_attributes {
283 hwmon_energy_enable,
284 hwmon_energy_input,
285 hwmon_energy_label,
286 };
287
288 #define HWMON_E_ENABLE BIT(hwmon_energy_enable)
289 #define HWMON_E_INPUT BIT(hwmon_energy_input)
290 #define HWMON_E_LABEL BIT(hwmon_energy_label)
291
292 enum hwmon_humidity_attributes {
293 hwmon_humidity_enable,
294 hwmon_humidity_input,
295 hwmon_humidity_label,
296 hwmon_humidity_min,
297 hwmon_humidity_min_hyst,
298 hwmon_humidity_max,
299 hwmon_humidity_max_hyst,
300 hwmon_humidity_alarm,
301 hwmon_humidity_fault,
302 hwmon_humidity_rated_min,
303 hwmon_humidity_rated_max,
304 hwmon_humidity_min_alarm,
305 hwmon_humidity_max_alarm,
306 };
307
308 #define HWMON_H_ENABLE BIT(hwmon_humidity_enable)
309 #define HWMON_H_INPUT BIT(hwmon_humidity_input)
310 #define HWMON_H_LABEL BIT(hwmon_humidity_label)
311 #define HWMON_H_MIN BIT(hwmon_humidity_min)
312 #define HWMON_H_MIN_HYST BIT(hwmon_humidity_min_hyst)
313 #define HWMON_H_MAX BIT(hwmon_humidity_max)
314 #define HWMON_H_MAX_HYST BIT(hwmon_humidity_max_hyst)
315 #define HWMON_H_ALARM BIT(hwmon_humidity_alarm)
316 #define HWMON_H_FAULT BIT(hwmon_humidity_fault)
317 #define HWMON_H_RATED_MIN BIT(hwmon_humidity_rated_min)
318 #define HWMON_H_RATED_MAX BIT(hwmon_humidity_rated_max)
319 #define HWMON_H_MIN_ALARM BIT(hwmon_humidity_min_alarm)
320 #define HWMON_H_MAX_ALARM BIT(hwmon_humidity_max_alarm)
321
322 enum hwmon_fan_attributes {
323 hwmon_fan_enable,
324 hwmon_fan_input,
325 hwmon_fan_label,
326 hwmon_fan_min,
327 hwmon_fan_max,
328 hwmon_fan_div,
329 hwmon_fan_pulses,
330 hwmon_fan_target,
331 hwmon_fan_alarm,
332 hwmon_fan_min_alarm,
333 hwmon_fan_max_alarm,
334 hwmon_fan_fault,
335 hwmon_fan_beep,
336 };
337
338 #define HWMON_F_ENABLE BIT(hwmon_fan_enable)
339 #define HWMON_F_INPUT BIT(hwmon_fan_input)
340 #define HWMON_F_LABEL BIT(hwmon_fan_label)
341 #define HWMON_F_MIN BIT(hwmon_fan_min)
342 #define HWMON_F_MAX BIT(hwmon_fan_max)
343 #define HWMON_F_DIV BIT(hwmon_fan_div)
344 #define HWMON_F_PULSES BIT(hwmon_fan_pulses)
345 #define HWMON_F_TARGET BIT(hwmon_fan_target)
346 #define HWMON_F_ALARM BIT(hwmon_fan_alarm)
347 #define HWMON_F_MIN_ALARM BIT(hwmon_fan_min_alarm)
348 #define HWMON_F_MAX_ALARM BIT(hwmon_fan_max_alarm)
349 #define HWMON_F_FAULT BIT(hwmon_fan_fault)
350 #define HWMON_F_BEEP BIT(hwmon_fan_beep)
351
352 enum hwmon_pwm_attributes {
353 hwmon_pwm_input,
354 hwmon_pwm_enable,
355 hwmon_pwm_mode,
356 hwmon_pwm_freq,
357 hwmon_pwm_auto_channels_temp,
358 };
359
360 #define HWMON_PWM_INPUT BIT(hwmon_pwm_input)
361 #define HWMON_PWM_ENABLE BIT(hwmon_pwm_enable)
362 #define HWMON_PWM_MODE BIT(hwmon_pwm_mode)
363 #define HWMON_PWM_FREQ BIT(hwmon_pwm_freq)
364 #define HWMON_PWM_AUTO_CHANNELS_TEMP BIT(hwmon_pwm_auto_channels_temp)
365
366 enum hwmon_intrusion_attributes {
367 hwmon_intrusion_alarm,
368 hwmon_intrusion_beep,
369 };
370 #define HWMON_INTRUSION_ALARM BIT(hwmon_intrusion_alarm)
371 #define HWMON_INTRUSION_BEEP BIT(hwmon_intrusion_beep)
372
373 /**
374 * struct hwmon_ops - hwmon device operations
375 * @visible: Static visibility. If non-zero, 'is_visible' is ignored.
376 * @is_visible: Callback to return attribute visibility. Mandatory unless
377 * 'visible' is non-zero.
378 * Parameters are:
379 * @const void *drvdata:
380 * Pointer to driver-private data structure passed
381 * as argument to hwmon_device_register_with_info().
382 * @type: Sensor type
383 * @attr: Sensor attribute
384 * @channel:
385 * Channel number
386 * The function returns the file permissions.
387 * If the return value is 0, no attribute will be created.
388 * @read: Read callback for data attributes. Mandatory if readable
389 * data attributes are present.
390 * Parameters are:
391 * @dev: Pointer to hardware monitoring device
392 * @type: Sensor type
393 * @attr: Sensor attribute
394 * @channel:
395 * Channel number
396 * @val: Pointer to returned value
397 * The function returns 0 on success or a negative error number.
398 * @read_string:
399 * Read callback for string attributes. Mandatory if string
400 * attributes are present.
401 * Parameters are:
402 * @dev: Pointer to hardware monitoring device
403 * @type: Sensor type
404 * @attr: Sensor attribute
405 * @channel:
406 * Channel number
407 * @str: Pointer to returned string
408 * The function returns 0 on success or a negative error number.
409 * @write: Write callback for data attributes. Mandatory if writeable
410 * data attributes are present.
411 * Parameters are:
412 * @dev: Pointer to hardware monitoring device
413 * @type: Sensor type
414 * @attr: Sensor attribute
415 * @channel:
416 * Channel number
417 * @val: Value to write
418 * The function returns 0 on success or a negative error number.
419 */
420 struct hwmon_ops {
421 umode_t visible;
422 umode_t (*is_visible)(const void *drvdata, enum hwmon_sensor_types type,
423 u32 attr, int channel);
424 int (*read)(struct device *dev, enum hwmon_sensor_types type,
425 u32 attr, int channel, long *val);
426 int (*read_string)(struct device *dev, enum hwmon_sensor_types type,
427 u32 attr, int channel, const char **str);
428 int (*write)(struct device *dev, enum hwmon_sensor_types type,
429 u32 attr, int channel, long val);
430 };
431
432 /**
433 * struct hwmon_channel_info - Channel information
434 * @type: Channel type.
435 * @config: Pointer to NULL-terminated list of channel parameters.
436 * Use for per-channel attributes.
437 */
438 struct hwmon_channel_info {
439 enum hwmon_sensor_types type;
440 const u32 *config;
441 };
442
443 #define HWMON_CHANNEL_INFO(stype, ...) \
444 (&(const struct hwmon_channel_info) { \
445 .type = hwmon_##stype, \
446 .config = (const u32 []) { \
447 __VA_ARGS__, 0 \
448 } \
449 })
450
451 /**
452 * struct hwmon_chip_info - Chip configuration
453 * @ops: Pointer to hwmon operations.
454 * @info: Null-terminated list of channel information.
455 */
456 struct hwmon_chip_info {
457 const struct hwmon_ops *ops;
458 const struct hwmon_channel_info * const *info;
459 };
460
461 /* hwmon_device_register() is deprecated */
462 struct device *hwmon_device_register(struct device *dev);
463
464 /*
465 * hwmon_device_register_with_groups() and
466 * devm_hwmon_device_register_with_groups() are deprecated.
467 */
468 struct device *
469 hwmon_device_register_with_groups(struct device *dev, const char *name,
470 void *drvdata,
471 const struct attribute_group **groups);
472 struct device *
473 devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
474 void *drvdata,
475 const struct attribute_group **groups);
476 struct device *
477 hwmon_device_register_with_info(struct device *dev,
478 const char *name, void *drvdata,
479 const struct hwmon_chip_info *info,
480 const struct attribute_group **extra_groups);
481 struct device *
482 hwmon_device_register_for_thermal(struct device *dev, const char *name,
483 void *drvdata);
484 struct device *
485 devm_hwmon_device_register_with_info(struct device *dev,
486 const char *name, void *drvdata,
487 const struct hwmon_chip_info *info,
488 const struct attribute_group **extra_groups);
489
490 void hwmon_device_unregister(struct device *dev);
491
492 int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type,
493 u32 attr, int channel);
494
495 char *hwmon_sanitize_name(const char *name);
496 char *devm_hwmon_sanitize_name(struct device *dev, const char *name);
497
498 void hwmon_lock(struct device *dev);
499 void hwmon_unlock(struct device *dev);
500
DEFINE_GUARD(hwmon_lock,struct device *,hwmon_lock (_T),hwmon_unlock (_T))501 DEFINE_GUARD(hwmon_lock, struct device *, hwmon_lock(_T), hwmon_unlock(_T))
502
503 /**
504 * hwmon_is_bad_char - Is the char invalid in a hwmon name
505 * @ch: the char to be considered
506 *
507 * hwmon_is_bad_char() can be used to determine if the given character
508 * may not be used in a hwmon name.
509 *
510 * Returns true if the char is invalid, false otherwise.
511 */
512 static inline bool hwmon_is_bad_char(const char ch)
513 {
514 switch (ch) {
515 case '-':
516 case '*':
517 case ' ':
518 case '\t':
519 case '\n':
520 return true;
521 default:
522 return false;
523 }
524 }
525
526 #endif
527