Skip to content

Commit 9ce7951

Browse files
committed
Fix isGraph and isPrintable
- isGraph was commented out due to isgraph not being available in libc this patch implements an alternative isgraph. - isprint in msp430-libc called by isPrintable was erroneously checking if the character was larger than 23. This has to be 31.
1 parent 83de472 commit 9ce7951

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

hardware/msp430/cores/msp430/WCharacter.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ inline boolean isDigit(int c)
8686
}
8787

8888

89-
//TODO: mspgcc does not seem to have isgraph?!?
90-
91-
//// Checks for any printable character except space.
92-
//inline boolean isGraph(int c)
93-
//{
94-
// return ( isgraph (c) == 0 ? false : true);
95-
//}
89+
// Checks for any printable character except space.
90+
// msp430-libc does not implement isGraph.
91+
inline boolean isGraph(int c)
92+
{
93+
return (c>32 && c<127);
94+
}
9695

9796

9897
// Checks for a lower-case character.
@@ -105,7 +104,10 @@ inline boolean isLowerCase(int c)
105104
// Checks for any printable character including space.
106105
inline boolean isPrintable(int c)
107106
{
108-
return ( isprint (c) == 0 ? false : true);
107+
// Not using msp430-libc version since it has a bug.
108+
// return (c>23 && c<127); should be
109+
return (c>31 && c<127);
110+
//return ( isprint (c) == 0 ? false : true);
109111
}
110112

111113

0 commit comments

Comments
 (0)