Below are various snippets of code that demonstrate implementation of the IBM/OEM
code page 437 extended characters as per the FANSI 2.0 specifications. Specification
information can be found on the
Specifications
page.
Array Of Unicode Characters
Converting all characters based upon their ascii value into the character present
in the below array will allow client developers to display the Unicode equivalent
of FANSI extended characters in non-IBM/non-Terminal fonts. The blank characters
are characters not used by FANSI.
String[] Characters = new String[] { "", "☺", "", "♥", "♦", "♣", "♠", "", "", "", "", "", "", "", "♫", "☼", "►",
"◄", "↕", "‼", "¶", "§", "‗", "↨", "↑", "↓", "→", " ", "∟", "↔", "▲", "▼" ," ", "!","\"", "#","$","%","&","'","(",")","*",
"+",",","-",".","/","0","1","2",
"3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q",
"R","S","T","U","V","W","X","Y","Z","[","\\",@"]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p",
"q","r","s","t","u","v","w","x","y","z", "{",
"|", "}", "~", "⌂", "Ç", "ü", "é", "â", "ä", "à", "å", "ç", "ê", "ë", "è", "ï", "î", "ì", "Ä", "Å", "É", "æ", "Æ", "ô", "ö",
"ò", "û", "ù", "ÿ", "Ö", "Ü", "¢", "£", "¥", "₧", "ƒ", "á", "í", "ó", "ú", "ñ", "Ñ", "ª", "º", "¿", "⌐", "¬", "½", "¼", "¡",
"«", "»", "░", "▒", "▓", "│", "┤", "╡", "╢", "╖", "╕", "╣", "║", "╗", "╝", "╜", "╛", "┐", "└", "┴", "┬", "├", "─", "┼", "╞",
"╟", "╚", "╔", "╩", "╦", "╠", "═", "╬", "╧", "╨", "╤", "╥", "╙", "╘", "╒", "╓", "╫", "╪", "┘", "┌", "█", "▄", "▌", "▐", "▀",
"α", "β", "Γ", "π", "Σ", "δ", "μ", "τ", "Ф", "θ", "Ω", "δ", "∞", "ø", "Є", "∩", "≡", "±", "≥", "≤", "⌠", "⌡", "÷", "≈", "º",
"•", "·", "√", "ⁿ", "²", "■", "" };
C() function for PennMUSH
This is a simple version of a C() function for PennMUSH. It accepts either one or
two arguments, the first being the ascii value of the character to display, the
second optional argument being the number of times to repeat it.
void
local_functions()
{
function_add("C", local_fun_c, 1, 2, FN_REG);
}
FUNCTION(local_fun_c)
{
int times, c;
int result = 0;
if (!is_integer(args[1]) || (is_integer(args[1]) && parse_integer(args[1]) < 1)) {
times = 1;
} else {
times = parse_integer(args[1]);
}
while(times--) {
if(result) break;
if (is_integer(args[0]) && parse_integer(args[0]) > 0) {
c = parse_integer(args[0]);
if (!((c == 1 || (c >= 3 && c <= 6) || (c >= 14 && c <= 254 && c != 27)))) {
result = 1;
safe_str(T("No such FANSI character!"), buff, bp);
}
else
{
result = safe_chr(c, buff, bp);
}
}
}
}