module Rucc::Libc

Emulate libc

Public Class Methods

isalnum(c) click to toggle source

same with isalnum in libc @param [Char] c

# File lib/rucc/libc.rb, line 31
def isalnum(c)
  "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze.include?(c)
end
isalpha(c) click to toggle source

same with isalpha in libc @param [Char] c

# File lib/rucc/libc.rb, line 25
def isalpha(c)
  "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze.include?(c)
end
isdigit(c) click to toggle source

same with isdigit in libc @param [Char] c

# File lib/rucc/libc.rb, line 13
def isdigit(c)
  "0123456789".freeze.include?(c)
end
isprint(c) click to toggle source

TODO(south37) Impl same logic with isprint in libc

# File lib/rucc/libc.rb, line 42
def isprint(c)
  isalnum(c) || ispunct(c) || isspace(c)
end
ispunct(c) click to toggle source

TODO(south37) Impl same logic with ispunct in libc @param [Char] c

# File lib/rucc/libc.rb, line 37
def ispunct(c)
  '!"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~'.include?(c)
end
isspace(c) click to toggle source

same with isspace in libc @param [Char] c

# File lib/rucc/libc.rb, line 7
def isspace(c)
  "\x20\x0c\x0a\x0d\x09\x0b".freeze.include?(c)
end
isxdigit(c) click to toggle source

same with isdigit in libc @param [Char] c

# File lib/rucc/libc.rb, line 19
def isxdigit(c)
  "0123456789abcdefABCDEF".freeze.include?(c)
end