Skip to content

Commit

Permalink
Update conio header file definitions for array encapsulation
Browse files Browse the repository at this point in the history
  • Loading branch information
mesheets committed Jul 20, 2024
1 parent 577b0aa commit 0d410fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
10 changes: 2 additions & 8 deletions include/conio.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,14 @@ extern "C" {
//! Table lookup: list of native patterns, one for each HEX character
/*! \param nibble HEX char value (0-9, a-f)
*/
extern inline char get_hex_display_code(unsigned nibble)
{
return hex_display_codes[(nibble) & 0x0f];
}
extern inline char get_hex_display_code(unsigned nibble);

#ifdef CONF_ASCII

//! Table lookup: list of native patterns, one for each ASCII character
/*! \param c ASCII char value (least significant 7 bits ONLY)
*/
extern inline char get_ascii_display_code(unsigned c)
{
return ascii_display_codes[(c) & 0x7f];
}
extern inline char get_ascii_display_code(unsigned c);

#endif // CONF_ASCII

Expand Down
17 changes: 17 additions & 0 deletions kernel/conio.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ const char ascii_display_codes[] =
0x00 // 127 "" 127 empty
};

//! Table lookup: list of native patterns, one for each ASCII character
/*! \param c ASCII char value (least significant 7 bits ONLY)
*/
char get_ascii_display_code(unsigned c)
{
return ascii_display_codes[(c) & 0x7f];
}

#endif // CONF_ASCII

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -409,6 +417,15 @@ void cputc_native_user(char mask_left, char mask_lcenter, char mask_rcenter, cha
#endif
}

//! Table lookup: list of native patterns, one for each HEX character
/*! \param nibble HEX char value (0-9, a-f)
*/
char get_hex_display_code(unsigned nibble)
{
return hex_display_codes[(nibble) & 0x0f];
}


//! display a hexword in the four leftmost positions.
/*! \param word the hexword
Expand Down

0 comments on commit 0d410fa

Please sign in to comment.