Permalink
Browse files

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.
  • Loading branch information...
1 parent 83de472 commit 9ce7951fe91d8e055c1ae2110b414183b3610c5d @robertinant robertinant committed Feb 20, 2013
Showing with 10 additions and 8 deletions.
  1. +10 −8 hardware/msp430/cores/msp430/WCharacter.h
@@ -86,13 +86,12 @@ inline boolean isDigit(int c)
}
-//TODO: mspgcc does not seem to have isgraph?!?
-
-//// Checks for any printable character except space.
-//inline boolean isGraph(int c)
-//{
-// return ( isgraph (c) == 0 ? false : true);
-//}
+// Checks for any printable character except space.
+// msp430-libc does not implement isGraph.
+inline boolean isGraph(int c)
+{
+ return (c>32 && c<127);
+}
// Checks for a lower-case character.
@@ -105,7 +104,10 @@ inline boolean isLowerCase(int c)
// Checks for any printable character including space.
inline boolean isPrintable(int c)
{
- return ( isprint (c) == 0 ? false : true);
+ // Not using msp430-libc version since it has a bug.
+ // return (c>23 && c<127); should be
+ return (c>31 && c<127);
+ //return ( isprint (c) == 0 ? false : true);
}

0 comments on commit 9ce7951

Please sign in to comment.