FreeCalypso > hg > freecalypso-tools
annotate uptools/libcoding/hexdecode2.c @ 988:5a6019ed7e72
pln-ppb-test: implement read-id
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 03 Dec 2023 00:04:18 +0000 |
parents | ec7e23d5151f |
children |
rev | line source |
---|---|
966
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module is a subset of hexdigits.c from fc-sim-tools/libutil. |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 decode_hex_digit(c) |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 { |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 if (c >= '0' && c <= '9') |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 return(c - '0'); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 if (c >= 'A' && c <= 'F') |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 return(c - 'A' + 10); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 if (c >= 'a' && c <= 'f') |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 return(c - 'a' + 10); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 return(-1); |
ec7e23d5151f
fcup-smsend: add support for backslash escapes, new -e option
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 } |