Difference between revisions of "OOP344 Assignment One"
(Created page with '==Basic Console Input Output Library ==') |
|||
Line 1: | Line 1: | ||
− | == | + | As your first assignment this semester, you are to write a multi-platform direct terminal library and later use that library to create a text editor. |
+ | |||
+ | ==Console Input Output Library == | ||
+ | Due date: October 10, 2009 | ||
+ | ==Specifications== | ||
+ | |||
+ | You are to write a program that places characters at various positions on a screen using a direct terminal library module. Your library module is named '''''ciol''''' and contains the following functions: | ||
+ | |||
+ | ===void ciol_init(void)=== | ||
+ | |||
+ | Initializes the '''ciol''' routines. Your application calls this function before calling any other '''ciol''' function and only once before calling '''ciol_done()'''. | ||
+ | ===void ciol_done(void)=== | ||
+ | |||
+ | Shuts down the '''ciol''' routines and ensures that the cursor is not left in the middle of the screen, which may be partly filled with characters. Any application that has called '''ciol_init()''' should call this function before terminating. | ||
+ | |||
+ | ==='''int ciol_rows(void)'''=== | ||
+ | |||
+ | Returns the number of rows on the screen. | ||
+ | ==='''int ciol_cols(void)'''=== | ||
+ | |||
+ | Returns the number of columns on the screen. | ||
+ | ===void ciol_clrscr(void)=== | ||
+ | |||
+ | Clears the screen and leaves the cursor in the upper left-hand corner of the screen. | ||
+ | ===void ciol_flush(void)=== | ||
+ | |||
+ | Ensures that any output sent to the screen is displayed on the screen (that is, this function flushes the output buffer). | ||
+ | ===int ciol_getch(void)=== returns the virtual key code identifying the key pressed by the user. This function first displays all output that has been sent to the screen (if any is pending to be displayed), waits for a key to be pressed and returns an int value that uniquely identifies the key pressed. To accommodate platform dependency, define the following symbolic names for the non-ASCII keys in each platform: | ||
+ | |||
+ | *'''UP_KEY''' - the up arrow key value, | ||
+ | |||
+ | *'''DOWN_KEY''' - the down arrow key value, | ||
+ | |||
+ | *'''LEFT_KEY''' - the left arrow key value, | ||
+ | |||
+ | *'''RIGHT_KEY''' - the right arrow key value, | ||
+ | |||
+ | *'''PGUP_KEY''' - the Page Up key value, | ||
+ | |||
+ | *'''PGDN_KEY''' - the Page Down key value, | ||
+ | |||
+ | *'''HOME_KEY''' - the Home key value, | ||
+ | |||
+ | *'''END_KEY''' - the End key value, | ||
+ | |||
+ | *'''ENTER_KEY''' - the Enter key value, | ||
+ | |||
+ | *'''TAB_KEY''' - the Tab key value, | ||
+ | |||
+ | *'''BACKSPACE_KEY''' - the Backspace key value, | ||
+ | |||
+ | *'''ESCAPE_KEY''' - the Escape key value, | ||
+ | |||
+ | *'''DEL_KEY''' - the Delete key value, | ||
+ | |||
+ | *'''INSERT_KEY''' - the Insert key value, | ||
+ | |||
+ | *'''F1_KEY''' to '''F12_KEY''' - the function key value, | ||
+ | |||
+ | You must use platform specific and unique non-ASCII values for the keys, and then you must use these specific symbolic names in your definitions. |
Revision as of 22:55, 13 September 2009
As your first assignment this semester, you are to write a multi-platform direct terminal library and later use that library to create a text editor.
Contents
Console Input Output Library
Due date: October 10, 2009
Specifications
You are to write a program that places characters at various positions on a screen using a direct terminal library module. Your library module is named ciol and contains the following functions:
void ciol_init(void)
Initializes the ciol routines. Your application calls this function before calling any other ciol function and only once before calling ciol_done().
void ciol_done(void)
Shuts down the ciol routines and ensures that the cursor is not left in the middle of the screen, which may be partly filled with characters. Any application that has called ciol_init() should call this function before terminating.
int ciol_rows(void)
Returns the number of rows on the screen.
int ciol_cols(void)
Returns the number of columns on the screen.
void ciol_clrscr(void)
Clears the screen and leaves the cursor in the upper left-hand corner of the screen.
void ciol_flush(void)
Ensures that any output sent to the screen is displayed on the screen (that is, this function flushes the output buffer). ===int ciol_getch(void)=== returns the virtual key code identifying the key pressed by the user. This function first displays all output that has been sent to the screen (if any is pending to be displayed), waits for a key to be pressed and returns an int value that uniquely identifies the key pressed. To accommodate platform dependency, define the following symbolic names for the non-ASCII keys in each platform:
- UP_KEY - the up arrow key value,
- DOWN_KEY - the down arrow key value,
- LEFT_KEY - the left arrow key value,
- RIGHT_KEY - the right arrow key value,
- PGUP_KEY - the Page Up key value,
- PGDN_KEY - the Page Down key value,
- HOME_KEY - the Home key value,
- END_KEY - the End key value,
- ENTER_KEY - the Enter key value,
- TAB_KEY - the Tab key value,
- BACKSPACE_KEY - the Backspace key value,
- ESCAPE_KEY - the Escape key value,
- DEL_KEY - the Delete key value,
- INSERT_KEY - the Insert key value,
- F1_KEY to F12_KEY - the function key value,
You must use platform specific and unique non-ASCII values for the keys, and then you must use these specific symbolic names in your definitions.