Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Commit

Permalink
Renamed is* methods to *?
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Olson committed Jul 22, 2010
1 parent a36c483 commit 959e0ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Src/Kernel/Printf.ooc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ vsnprintf: func (str: String, size: SizeT, fmt: String, ap: VaList) -> Int {

/* Find the field width. */
fieldwidth = 0
while(p@ as Char isDigit()) {
while(p@ digit?()) {
if(fieldwidth > 0)
fieldwidth *= 10
fieldwidth += (p@ - 0x30)
Expand All @@ -266,7 +266,7 @@ vsnprintf: func (str: String, size: SizeT, fmt: String, ap: VaList) -> Int {
precision = va_arg(ap, __int)
p += 1
}
while(p@ as Char isDigit()) {
while(p@ digit?()) {
if (precision > 0)
precision *= 10
precision += (p@ - 0x30)
Expand Down
40 changes: 20 additions & 20 deletions Src/OocLib/lang/types.ooc
Original file line number Diff line number Diff line change
Expand Up @@ -86,60 +86,60 @@ NULL: unmangled Pointer = 0
__char_ary: extern(__CHAR_ARY) Void
Char: cover from char {
/// check for an alphanumeric character
isAlphaNumeric: func -> Bool {
isAlpha() || isDigit()
alphaNumeric?: func -> Bool {
alpha?() || digit?()
}

/// check for an alphabetic character
isAlpha: func -> Bool {
isLower() || isUpper()
alpha?: func -> Bool {
lower?() || upper?()
}

/// check for a lowercase alphabetic character
isLower: func -> Bool {
lower?: func -> Bool {
this >= 'a' && this <= 'z'
}

/// check for an uppercase alphabetic character
isUpper: func -> Bool {
upper?: func -> Bool {
this >= 'A' && this <= 'Z'
}

/// check for a decimal digit (0 through 9)
isDigit: func -> Bool {
digit?: func -> Bool {
this >= '0' && this <= '9'
}

/// check for a hexadecimal digit (0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F)
isHexDigit: func -> Bool {
isDigit() ||
hexDigit?: func -> Bool {
digit?() ||
(this >= 'A' && this <= 'F') ||
(this >= 'a' && this <= 'f')
}

/// check for a control character
isControl: func -> Bool {
control?: func -> Bool {
(this >= 0 && this <= 31) || this == 127
}

/// check for any printable character except space
isGraph: func -> Bool {
isPrintable() && this != ' '
graph?: func -> Bool {
printable?() && this != ' '
}

/// check for any printable character including space
isPrintable: func -> Bool {
printable?: func -> Bool {
this >= 32 && this <= 126
}

/// check for any printable character which is not a space or an alphanumeric character
isPunctuation: func -> Bool {
isPrintable() && !isAlphaNumeric() && this != ' '
punctuation?: func -> Bool {
printable?() && !alphaNumeric?() && this != ' '
}

/** check for white-space characters: space, form-feed ('\f'), newline ('\n'),
carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v') */
isWhitespace: func -> Bool {
whitespace?: func -> Bool {
this == ' ' ||
this == '\f' ||
this == '\n' ||
Expand All @@ -149,21 +149,21 @@ Char: cover from char {
}

/// check for a blank character; that is, a space or a tab
isBlank: func -> Bool {
blank?: func -> Bool {
this == ' ' || this == '\t'
}

/// convert to an integer. This only works for digits, otherwise -1 is returned
toInt: func -> Int {
if (isDigit()) {
if (digit?()) {
return (this - '0')
}
return -1
}

/// return the lowered charater
toLower: func -> This {
if(this isUpper()) {
if(this upper?()) {
return this - 'A' + 'a'
// or this + 32 ?
}
Expand All @@ -172,7 +172,7 @@ Char: cover from char {

/// return the capitalized character
toUpper: func -> This {
if(this isLower()) {
if(this lower?()) {
return this - 'a' + 'A'
// or this - 32 ?
}
Expand Down

0 comments on commit 959e0ff

Please sign in to comment.