Annotation of sbbs/src/conio/cterm.h, revision 1.1.1.2

1.1.1.2 ! root        1: /* $Id: cterm.h,v 1.29 2011/09/30 22:05:38 deuce Exp $ */
1.1       root        2: 
                      3: /****************************************************************************
                      4:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
                      5:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
                      6:  *                                                                                                                                                     *
                      7:  * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html         *
                      8:  *                                                                                                                                                     *
                      9:  * This library is free software; you can redistribute it and/or                       *
                     10:  * modify it under the terms of the GNU Lesser General Public License          *
                     11:  * as published by the Free Software Foundation; either version 2                      *
                     12:  * of the License, or (at your option) any later version.                                      *
                     13:  * See the GNU Lesser General Public License for more details: lgpl.txt or     *
                     14:  * http://www.fsf.org/copyleft/lesser.html                                                                     *
                     15:  *                                                                                                                                                     *
                     16:  * Anonymous FTP access to the most recent released source is available at     *
                     17:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
                     18:  *                                                                                                                                                     *
                     19:  * Anonymous CVS access to the development source and modification history     *
                     20:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
                     21:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
                     22:  *     (just hit return, no password is necessary)                                                     *
                     23:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
                     24:  *                                                                                                                                                     *
                     25:  * For Synchronet coding style and modification guidelines, see                                *
                     26:  * http://www.synchro.net/source.html                                                                          *
                     27:  *                                                                                                                                                     *
                     28:  * You are encouraged to submit any modifications (preferably in Unix diff     *
                     29:  * format) via e-mail to [email protected]                                                                      *
                     30:  *                                                                                                                                                     *
                     31:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
                     32:  ****************************************************************************/
                     33: 
                     34: #ifndef _CTERM_H_
                     35: #define _CTERM_H_
                     36: 
                     37: #include <stdio.h>     /* FILE* */
1.1.1.2 ! root       38: #include <link_list.h>
        !            39: #include <semwrap.h>
1.1       root       40: 
1.1.1.2 ! root       41: typedef enum {
1.1       root       42:         CTERM_MUSIC_NORMAL
                     43:        ,CTERM_MUSIC_LEGATO
                     44:        ,CTERM_MUSIC_STACATTO
1.1.1.2 ! root       45: } cterm_noteshape_t;
1.1       root       46: 
1.1.1.2 ! root       47: typedef enum {
1.1       root       48:         CTERM_LOG_NONE
                     49:        ,CTERM_LOG_ASCII
                     50:        ,CTERM_LOG_RAW
1.1.1.2 ! root       51: } cterm_log_t;
        !            52: 
        !            53: typedef enum {
        !            54:         CTERM_EMULATION_ANSI_BBS
        !            55:        ,CTERM_EMULATION_PETASCII
        !            56:        ,CTERM_EMULATION_ATASCII
        !            57: } cterm_emulation_t;
        !            58: 
        !            59: typedef enum {
        !            60:        CTERM_MUSIC_SYNCTERM,
        !            61:        CTERM_MUSIC_BANSI,
        !            62:        CTERM_MUSIC_ENABLED
        !            63: } cterm_music_t;
1.1       root       64: 
                     65: #define CTERM_LOG_MASK 0x7f
                     66: #define CTERM_LOG_PAUSED       0x80
                     67: 
                     68: struct cterminal {
1.1.1.2 ! root       69:        /* conio stuff */
        !            70:        int     x;              // X position of the left side on the screen
        !            71:        int     y;              // Y position of the top pn the screen
        !            72: 
        !            73:        /* emulation mode */
        !            74:        cterm_emulation_t       emulation;
        !            75:        int                                     height;                 // Height of the terminal buffer
        !            76:        int                                     width;                  // Width of the terminal buffer
        !            77:        int                                     quiet;                  // No sounds are made
        !            78:        char                            *scrollback;
        !            79:        int                                     backlines;              // Number of lines in scrollback
        !            80:        char                            DA[1024];               // Device Attributes
        !            81: 
        !            82:        /* emulation state */
        !            83:        int                                     started;                // Indicates that conio functions are being called
        !            84:        int                                     c64reversemode; // Commodore 64 reverse mode state
        !            85:        unsigned char           attr;                   // Current attribute
        !            86:        int                                     save_xpos;              // Saved position (for later restore)
        !            87:        int                                     save_ypos;
        !            88:        int                                     sequence;               // An escape sequence is being parsed
        !            89:        char                            escbuf[1024];
        !            90:        cterm_music_t           music_enable;   // The remotely/locally controled music state
        !            91:        char                            musicbuf[1024];
        !            92:        int                                     music;                  // ANSI music is being parsed
        !            93:        int                                     tempo;
        !            94:        int                                     octave;
        !            95:        int                                     notelen;
        !            96:        cterm_noteshape_t       noteshape;
        !            97:        int                                     musicfore;
        !            98:        int                                     playnote_thread_running;
        !            99:        link_list_t                     notes;
        !           100:        sem_t                           playnote_thread_terminated;
        !           101:        sem_t                           note_completed_sem;
        !           102:        int                                     backpos;
        !           103:        int                                     xpos;
        !           104:        int                                     ypos;
        !           105:        cterm_log_t                     log;
        !           106:        FILE*                           logfile;
        !           107:        char                            fontbuf[4096];  // Remote font
        !           108:        int                                     font_read;              // Current position in fontbuf
        !           109:        int                                     font_slot;
        !           110:        int                                     font_size;              // Bytes
        !           111:        int                                     doorway_mode;
        !           112:        int                                     doorway_char;   // Indicates next char is a "doorway" mode char
        !           113:        int                                     cursor;                 // Current cursor mode (Normal or None)
        !           114: 
        !           115:        /* conio function pointers */
        !           116: #ifdef CTERM_WITHOUT_CONIO
        !           117:        void    (*ciolib_gotoxy)                (struct cterminal *,int,int);
        !           118:        int             (*ciolib_wherex)                (struct cterminal *);
        !           119:        int             (*ciolib_wherey)                (struct cterminal *);
        !           120:        int             (*ciolib_gettext)               (struct cterminal *,int,int,int,int,unsigned char *);
        !           121:        void    (*ciolib_gettextinfo)   (struct cterminal *,struct text_info *);
        !           122:        void    (*ciolib_textattr)              (struct cterminal *,int);
        !           123:        void    (*ciolib_setcursortype) (struct cterminal *,int);
        !           124:        int             (*ciolib_movetext)              (struct cterminal *,int,int,int,int,int,int);
        !           125:        void    (*ciolib_clreol)                (struct cterminal *);
        !           126:        void    (*ciolib_clrscr)                (struct cterminal *);
        !           127:        void    (*ciolib_setvideoflags) (struct cterminal *,int flags);
        !           128:        int             (*ciolib_getvideoflags) (struct cterminal *);
        !           129:        int             (*ciolib_putch)                 (struct cterminal *,int);
        !           130:        int             (*ciolib_puttext)               (struct cterminal *,int,int,int,int,unsigned char *);
        !           131:        void    (*ciolib_window)                (struct cterminal *,int,int,int,int);
        !           132:        int             (*ciolib_cputs)                 (struct cterminal *,char *);
        !           133:        int             (*ciolib_setfont)               (struct cterminal *,int font, int force, int font_num);
        !           134: #else
        !           135:        void    CIOLIBCALL (*ciolib_gotoxy)             (int,int);
        !           136:        int             CIOLIBCALL (*ciolib_wherex)             (void);
        !           137:        int             CIOLIBCALL (*ciolib_wherey)             (void);
        !           138:        int             CIOLIBCALL (*ciolib_gettext)            (int,int,int,int,unsigned char *);
        !           139:        void    CIOLIBCALL (*ciolib_gettextinfo)        (struct text_info *);
        !           140:        void    CIOLIBCALL (*ciolib_textattr)           (int);
        !           141:        void    CIOLIBCALL (*ciolib_setcursortype)      (int);
        !           142:        int             CIOLIBCALL (*ciolib_movetext)           (int,int,int,int,int,int);
        !           143:        void    CIOLIBCALL (*ciolib_clreol)             (void);
        !           144:        void    CIOLIBCALL (*ciolib_clrscr)             (void);
        !           145:        void    CIOLIBCALL (*ciolib_setvideoflags)      (int flags);
        !           146:        int             CIOLIBCALL (*ciolib_getvideoflags)      (void);
        !           147:        int             CIOLIBCALL (*ciolib_putch)                      (int);
        !           148:        int             CIOLIBCALL (*ciolib_puttext)            (int,int,int,int,unsigned char *);
        !           149:        void    CIOLIBCALL (*ciolib_window)             (int,int,int,int);
        !           150:        int             CIOLIBCALL (*ciolib_cputs)                      (char *);
        !           151:        int             CIOLIBCALL (*ciolib_setfont)            (int font, int force, int font_num);
        !           152: #endif
        !           153:        int     *_wscroll;
        !           154:        int             *puttext_can_move;
        !           155:        int             *hold_update;
        !           156:        void    *extra;
1.1       root      157: };
                    158: 
                    159: #ifdef __cplusplus
                    160: extern "C" {
                    161: #endif
                    162: 
1.1.1.2 ! root      163: struct cterminal *cterm_init(int height, int width, int xpos, int ypos, int backlines, unsigned char *scrollback, int emulation);
        !           164: char *cterm_write(struct cterminal *cterm, const unsigned char *buf, int buflen, char *retbuf, size_t retsize, int *speed);
        !           165: int cterm_openlog(struct cterminal *cterm, char *logfile, int logtype);
        !           166: void cterm_closelog(struct cterminal *cterm);
        !           167: void cterm_end(struct cterminal *cterm);
        !           168: void cterm_clearscreen(struct cterminal *cterm, char attr);
        !           169: void cterm_start(struct cterminal *cterm);
1.1       root      170: #ifdef __cplusplus
                    171: }
                    172: #endif
                    173: 
                    174: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.