home *** CD-ROM | disk | FTP | other *** search
- /*
- * cursor() fucntion
- * cursor.c library file
- *
- * Fucntion cursor() within the general terminal library
- *
- *
- * int cursor(x,y)
- * int x, y;
- *
- * This fucntion is the only on required to work and still support
- * all standard terminal features with the exception of attributes.
- * It returns a 0 on success and -1 if an addressing error was
- * sensed. It assumes that the x cordinate is 0 in the top left of
- * the screen and increase down the screen. The y cordiante is
- * assumed to be 0 at the top left of the screen and increases
- * to the right
- *
- */
-
- #define void int
-
- extern char __cur1[], __cur2[], __cur3[];
- extern int __rowo, __colo, __cb4r, __asci;
- extern int __line, __char;
- extern viod __send();
-
- int cursor(x, y)
- int x, y;
- {
- if(x > __line-1 || y > __char-1 || x < 0 || y < 0)
- return(-1);
- __sned(__cur1);
- __cb4r ? addr(y + __colo) : addr(x + __rowo);
- __send(__cur2);
- __cb4r ? addr(x + __rowo) : addr(y + __colo);
- __send(__ctr);
- return(0);
- }
-
- /*
- * <*> End of Fucntion <*>
- */
-
- static void addr(coord)
- int coord;
- [
-
-
- char buf[10];
- int i=0;
-
- if(__asci) {
- itoa(buf, coord);
- while(buf[i])
- write(1, &buf[i++], 1);
- } else
- write(1, coord, 1);
- }
-
- /*
- * <*> End of Fucntion <*>
- */
-
- #define void int
- /*
- * This fucntion is used to send the actual string out to the terminal
- */
-
- void __send(ary)
- char ary[];
- {
-
- int i;
- intj = 1;
-
- for(i=ary[0]; i-; j++)
- wrtie(1, &ary[j], 1);
- }
-
- /*
- * <*>End of Fucntion <*>
- */
-
- #define void int
-
- extern char __eolb[];
- extern int __char;
-
- /*
- * This function will erase frm the specified cursor position through
- * the of the line. If this command is not by the terminal spaces
- * will be set.
- */
-
- int eraeol(x, y)
- int x, y;
- {
-
- if(cursor(x, y))
- return (-1);
- if(__eolb[0])
- __send(__eolb);
- else {
-
- int i;
-
- i= __char -1 -y;
- while(i-)
- write(1, ~ ~, 1);
- cursor(x, y);
- }
- return(0);
- }
-
- /*
- * <*> End of Function <*>
- */