[go: up one dir, main page]

File: ebcdic.h

package info (click to toggle)
s390-tools 2.35.0-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 12,220 kB
  • sloc: ansic: 184,236; sh: 12,152; cpp: 4,954; makefile: 2,763; perl: 2,519; asm: 1,085; python: 697; xml: 29
file content (45 lines) | stat: -rw-r--r-- 915 bytes parent folder | download | duplicates (4)
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
/*
 * EBCDIC specific functions
 *
 * Copyright IBM Corp. 2013, 2020
 *
 * s390-tools is free software; you can redistribute it and/or modify
 * it under the terms of the MIT license. See LICENSE for details.
 *
 */

#ifndef EBCDIC_H
#define EBCDIC_H

#include "lib/zt_common.h"


#ifndef __ASSEMBLER__

unsigned long ebcdic_strtoul(char *, char **, int);

static __always_inline int ecbdic_isspace(char c)
{
	return (c == 0x40) || (c == 0x05) || (c == 0x15) || (c == 0x25) ||
		(c == 0x0b) || (c == 0x0c) || (c == 0x0d);
}

static __always_inline int ebcdic_isdigit(char c)
{
	return (c >= 0xf0) && (c <= 0xf9);
}

static __always_inline int ebcdic_isupper(char c)
{
	return (c >= 0xC1 && c <= 0xC9) || (c >= 0xD1 && c <= 0xD9) ||
		(c >= 0xE2 && c <= 0xE9);
}

static __always_inline char ebcdic_tolower(char c)
{
	if (ebcdic_isupper(c))
		c -= 0x40;
	return c;
}
#endif /* __ASSEMBLER__ */
#endif /* EBCDIC_H */