home *** CD-ROM | disk | FTP | other *** search
- VBMS: VERTICAL BAR MENU SCHEMATA;
- BASIC UNIT; V 1.oo (c) 1993
- by Ali KOCATURK
-
- ==============================================================================
- The following files should be included in this package;
- BASIC.TPU Basic Unit
- BASIC.DOC Unit Documentation
- ==============================================================================
-
- BASIC.TPU contains a library of string functions/procedures as
- well as some screen design tools. The objective is to approach
- to the well_known 'basic' programing techniques.The following
- functions/procedures are defined in Unit.
- ==============================================================================
-
- FUNCTION len(xstr: string): integer;
- FUNCTION midstr(xstr: string; first, number: integer): string;
- FUNCTION leftstr(xstr: string; number: integer): string;
- FUNCTION rightstr(xstr: string; number: integer): string;
- FUNCTION instr(xstr, ystr: string): integer;
- FUNCTION charpos(tstr: char; xstr: string): byte;
- FUNCTION ucasestr(xstr: string): string;
- FUNCTION lowercase(tstr: char): char;
- FUNCTION lcasestr(xstr: string): string;
- FUNCTION ltrimstr(xstr: string): string;
- FUNCTION rtrimstr(xstr: string): string;
- FUNCTION lrtrimstr(xstr: string): string;
- FUNCTION getstr; string;
- FUNCTION formatstr(xstr: string; lgth: byte): string;
- FUNCTION centerstr(xstr: string; width: byte): string;
- FUNCTION spacestr(x: integer): string;
- FUNCTION blankstr(x: integer): string;
- FUNCTION designstr(var space: integer; var design: char): string;
- FUNCTION yesno: char;
- PROCEDURE swap(xstr, ystr: string);
- PROCEDURE set_color(x, y: integer);
- PROCEDURE save_screen;
- PROCEDURE restore_screen;
- PROCEDURE setcursor(top, bottom: integer);
- PROCEDURE move_cursor;
- PROCEDURE box(wd_colm, wd_row, wd+lgth, wd_hgth: integer;
- shadow, line: boolean);
- PROCEDURE border(wd_colm, wd_row, wd_lgth, wd_hgth: integer;
- shadow: boolean);
- PROCEDURE draw(wd_colm, wd_row, n, m: integer; design: char);
- PROCEDURE screensetup;
- PROCEDURE clearkey;
- PROCEDURE beeper(freq, time: integer);
- PROCEDURE keycode(var code: byte; var status: boolean);
- ==============================================================================
-
- FUNCTION len(xstr: string): integer;
- Returns the number of characters with leading and trailing spaces from
- the string. If max_lgth:= len, then the string is called constant string.
- If len= zero then the string has no characters, therefore, null. A string
- has one character, it can be called character_string. A character is simply
- one character of string; but it differs from a character_string. The one has
- a char type, the other string type. Subsequently, a string is an ordered po
- sitions of the number of characters with zero, one or more than one characters
- within a length. The length in general is called space. Operates similarly
- to the kength function.
-
- Example: xstr:= ' Vertical Menu.Schemata ';
- writeln(length(xstr));
- will display: 22;
- writeln(len(xstr));
- will display: 24;
- ------------------------------------------------------------------------------
- FUNCTION midstr(xstr: string; first, number: integer): string;
- Every character has a position in a given string. The ordered positions
- of the characters between two character positions is called substring of
- the string.
- Returns a string containing 'number' characters starting at first.
- Operates similarly to the copy function.
- Example: writeln(copy(xstr, 1, 3));
- will display: Ve;
- writeln(midstr(xstr, 1, 3));
- will display: Ve;
- ------------------------------------------------------------------------------
- FUNCTION leftstr(xstr: string; number: integer): string;
- Returns a string containing 'number' characters starting from
- 'number'--left. Operates similarly to the copy function.
- Example: writeln(copy(xstr, 1, 1));
- will display: V;
- writeln(leftstr(xstr, 1));
- will display: V;
- ------------------------------------------------------------------------------
- FUNCTION rightstr(xstr: string; number: integer): string;
- Returns a string containing 'number' characters starting from
- 'number'--right. Operates similarly to the copy function, but
- string length is not required.
- Example: writeln(copy(xstr, 21, 2));
- will display: at;
- writeln(rightstr(xstr, 2));
- will display: a;
- ------------------------------------------------------------------------------
- FUNCTION instr(xstr, ystr: string): integer;
- Operates similarly to the pos function.
- ystr:='.';
- Example: writeln(pos(xstr, ystr));
- will display: 0;
- writeln(instr(xstr, ystr));
- will display: 0;
- ------------------------------------------------------------------------------
- FUNCTION charpos(tstr: char; xstr: string): byte;
- Returns a counted position of the character from a given string.
- tstr:= 'M';
- Example: writeln(charpos(tstr, xstr));
- will display: 11;
- ------------------------------------------------------------------------------
- FUNCTION ucasestr(xstr: string): string;
- Returns a string in upper case with leading and trailing spaces.
- Example: writeln('xstr');
- will display: VERTICAL MENU.SCHEMATA;
- ------------------------------------------------------------------------------
- FUNCTION lowercase(tstr: char): char;
- Returns character in lowercase; opposite of the upcase function.
- Example: writeln(upcase('a'));
- will display: A;
- writeln(lowercase('A'));
- will display: a;
- ------------------------------------------------------------------------------
- FUNCTION lcasestr(xstr: string): string;
- Returns a string in lower case with leading and trailing spaces.
- Example: writeln(lcasestr(xstr));
- will display: Vertical Menu.Schemata;
- ------------------------------------------------------------------------------
- FUNCTION ltrimstr(xstr: string): string;
- Removes leading spaces from a string.
- Example: writeln(ltrimstr(xstr));
- will display: Vertical Menu.Schemata;
- ------------------------------------------------------------------------------
- FUNCTION rtrimstr(xstr: string): string;
- Removes trailing spaces from a string.
- Example: writeln(rtrimstr(xstr));
- will display: Vertical Menu.Schemata;
- ------------------------------------------------------------------------------
- FUNCTION rltrimstr(xstr: string): string;
- Removes both leading and trailing spaces from a string.
- Example: writeln(lrtrimstr(xstr));
- will display: Vertical Menu.Schemata;
- ------------------------------------------------------------------------------
- FUNCTION getstr: string;
- Reads a string that has a saved value; operates similarly to the readln func-
- tion.
- -------------------------------------------------------------------------------
- FUNCTION formatstr(xstr: string; lgth: byte): string;
- Formats a string for a given spaces.
- Example: write(xstr: 10);
- write(formatstr(xstr, 32));
- will display: string at the same occupation.
- ------------------------------------------------------------------------------
- FUNCTION centerstr(xstr: string; width: byte): string;
- Returns a string centered on a specified space with len.
- Example: write(centerstr(xstr, 32));
- will display: at starting space_four.
- -------------------------------------------------------------------------------
- FUNCTION spacestr(x: integer): string;
- Returns a string of 'x' spaces
- Example: set_color(0,0);
- write(spacestr(5));
- will display: five_space colored bar.
- ------------------------------------------------------------------------------
- FUNCTION blankstr(x: integer): string;
- Operates similarly to spacestr; but it has length one_space more.
- Writes #255 for a specified space.
- Example: gotoxy(8,18);
- write(blankstr(27));
- will display: starting from cursor position
- erases twentyseven_spaces.
- ------------------------------------------------------------------------------
- FUNCTION designstr(var space: integer; var design: char):string;
- Draws high_ascii characters for a specified space.
- space:=12;
- design:=#178;
- Example: writeln(designstr(space, design));
- will display: #178 at twelve_spaces length.
- ------------------------------------------------------------------------------
- FUNCTION yesno: char;
- Asks input from the user.
- ------------------------------------------------------------------------------
- PROCEDURE swap(xstr, ystr: string);
- Swaps xstr by ystr.
- ystr:= 'VBMS'
- Example: swap(xstr, ystr);
- write(xstr);
- will display: VBMS;
- write(ystr);
- will display: Vertical Menu.Schemata
- ------------------------------------------------------------------------------
- PROCEDURE set_color(x, y: integer);
- Sets the specified colors for back and fore.
- Example: set_color(1,1);
- ------------------------------------------------------------------------------
- PROCEDURE save_screen;
- PROCEDURE restore_screen;
- Saves and restores the screen contents. With window call, if
- two windows have the same coordinates, the second window erases
- the first one, if not, the second is restored along with the
- first one.
- ------------------------------------------------------------------------------
- PROCEDURE set_cursor(top, bottom: integer);
- PROCEDURE movecursor;
- Sets and moves cursor for a specific location.
- ------------------------------------------------------------------------------
- PROCEDURE box(wd_colm, wd_row, wd_lgth, wd_hgth: integer;
- shadow, line: boolean);
- Draws a box at specified coordinates; fills with #177 or
- draws lines under the top and above bottom line.
- ------------------------------------------------------------------------------
- PROCEDURE border(wd_colm, wd_row, wd_lgth, wd_hgth: integer;
- shadow: boolean);
- Draws a box at specified coordinates and puts shadow for right
- and bottom sides.
- ------------------------------------------------------------------------------
- PROCEDURE draw(wd_colm, wd_row, n, m:integer; design: char);
- PROCEDURE screensetup;
- Designs screen with high_ascii characters for specified locátions.
- Screensetup is used as a shortcut routine.
- ------------------------------------------------------------------------------
- PROCEDURE clearkey;
- Clears the key buffer.
- ------------------------------------------------------------------------------
- PROCEDURE beeper(freq, time: integer);
- Writes #7 with some delay.
- ------------------------------------------------------------------------------
- PROCEDURE keycode(var code: byte; var status: boolean);
- Establishes ord value of any key with true or false setup.
- ==============================================================================
- ==============================================================================
-
-