home *** CD-ROM | disk | FTP | other *** search
- // ┌───────┐
- // ─────────>│ AVNER │
- // ─────────>│ BEN │──────> Software Engineering Method
- // └───────┘
- // 10 Dov-Hoz st. Tel-Aviv 63416 Israel tel. 972-3-221535
-
- // The Screen NAVigator, ver 1.10 April 1990
- // Copyright (c) 1989 by Avner Ben
- // Snav is not, and never was, free software.
- // for conditions for use refer to file "copyrigh.txt"
-
- // The Screen Navigator is an object-oriented device-independent
- // character-graphics driver package, written in the C++ language,
- // distributed in the form of C++ source code.
- // For further information refer to the documentation files.
-
- // The user may not omit this text, from the beginning of the file, to
- // the line of asterisks below.
-
- /***************************************************************************/
-
- // package nucleus part 2 - headers
- // This file defines the "computer-alphabet" object, and offers an
- // extended-ASCII implementation, as on the IBM-PC.
- // for data-structure logic, refer to file "article".
-
- // History:
- // 28.7.89 avner ben coded.
- /////// snav v1.0
- // 25.10.89 avner ben classified.
- /////// snav v1.1
- // 5.3.90 avner ben - C++ v2.0 upgrade.
-
- // Site history (of this copy):
- // __.__.__ ____________ : __________________.
-
- #ifndef SNAV1_H
- #define SNAV1_H
-
- #ifndef SNAV0_H
- #include "snav0.hpp"
- #endif
-
- class computer_alphabet
- {
- private :
- char *name;
- int numchars; // including zero
- int *grafc; // array of [numchars][2]
- int index[16][16]; // access by weight:intersection
-
- public :
- computer_alphabet(char *name, int bufsize, int *data);
- // bufsize: number of characters supported, including bin zero
- // data: ptr to zero-terminated integer array, arranged in
- // successions of four integers corresponding to:
- // unsigned character (possibly ascii) num,
- // character's intersection(),
- // character's weight_d.y(),
- // character's weight_d.x();
- ~computer_alphabet(void);
- // free internal character storage
- void poke_c(char c, const intersection &avdir, const weight_d &wgt);
- // modify default character attributes, updating index
-
- // access method services:
- intersection cdir(char inc)
- // retrieve direction set defined for character (temporary result)
- // cdir('|')==>[Up,Down]
- { return intersection(*(grafc+(unsigned char)inc*2)); }
- weight_d cweight(char inc)
- // retrieve width of char in dimension (temporary result)
- // cweight('│')==>0:1
- { return weight_d(*(grafc+(unsigned char)inc*2+1)); }
- char get_c(const intersection &avdir, weight_d wgt);
- // retrieve character by attributes, or a close match
- // get_c(RTDIR+LTDIR+UPDIR,1:1)==>'┴'
- char translate(char c, weight_d wgt);
- // translate character to target width, as close as possible
- // translate('┴',2:1)==>'╧'
-
- // character connectivity
- boolean ccont(char cfrom, char cto, const direction &dirfrom);
- // test if two characters connect in a direction.
- // ccont('├','-',RTDIR)==>TRUE
- // ccont('├','-',LTDIR)==>FALSE
- char carrw(char *env, direction dir, weight_d wgt, int len,
- int pos, boolean directed=FALSE);
- // draw one character within an arc.
- // env: "environment" sorrownding current page position,
- // ordered: current char, then neighbours, arranged
- // in (direction++ order)
- // dir: direction of arc being charted.
- // wgt: arc width.
- // len: total arc length planned.
- // pos: current position from arc start (starting at 1).
- // directed: if true, last char (pos==len) is an arrowhead.
- char *cearrw(char *env, direction dir, weight_d wgt, int len,
- int pos, boolean directed);
- // version of carrw that trims exess from the environment
- // to make some procedures use this instead, #define ENV_MODIFY
- char ctrim(char c, const direction &extradir);
- // trim char in protruding direction, if present
- // ctrim('├',RTDIR)==>'│'
- char celong(char c, const direction &elongdir);
- // elongate char in this direction, if not already present
- // celong('│',RTDIR)==>'├'
-
- //miscelanous:
- int list(FILE *outf);
- // print the index (originally intended for debugging)
- void inverse(const axis &dim);
- // invert the semigraphic alphabet on axis (e.g. latin=>semitic)
- };
-
- #ifndef SNAV_C
- extern computer_alphabet *alph;
- // system defined default alphabet (ascii_pc).
- // all your inquiries to the current alphabet object must
- // be of the type: alph->function(args);
- // if you overload your own alphabet, make sure to preserve this address!
- extern int ascii_pc_data[];
- // in-memory file to pass to the constructor of an ascii_pc type alphabet.
- // Used by system to initialize the default alphabet.
- #endif
-
- #endif
-