Rmeoving useless width and height from terminal.h

This commit is contained in:
Julien Palard 2011-09-23 09:05:09 +02:00
parent 3bec025ea1
commit e51334013c
3 changed files with 40 additions and 34 deletions

View File

@ -5,36 +5,6 @@
#include "terminal.h"
/*
** Terminal implement a terminal, (vt100 like)
** Basically it parses escape sequences to call
** appropriated callbacks.
**
** It expose a simple API to implement a specific terminal.
** Actually I implement vt100 in terminal_vt100.c
**
** terminal.c parses escape sequences like
** \033[4;2H
** It allows control chars to be inside the sequence like :
** \033[4\n;2H
** and accept variations like :
** \033#...
** \033(...
**
** The API is simple, it consists of a structure term_callbacks (see
** terminal.h) where 4 members points to an ascii_callbacks structure.
** Ascii callbacks is only a struct with some ascii chars where you
** can plug your callbacks functions. see terminal_vt100.c as an example.
**
** Typically when terminal parses \033[42;43m
** it calls callbacks->csi->m();
**
** Parameters (here 42;43) are stored in terminal->argc and terminal->argv
** argv is an array of integers of length argc.
**
*/
static void terminal_push(struct terminal *this, char c)
{
if (this->stack_ptr >= TERM_STACK_SIZE)

View File

@ -1,6 +1,46 @@
#ifndef __TERMINAL_H__
#define __TERMINAL_H__
/*
**
** Introduction
** ============
**
** terminal.c is a basic level that parses escape sequences to call
** appropriated callbacks permiting you to implement a specific terminal.
**
** Callbacks
** =========
**
** terminal.c maps sequences to callbacks in this way :
** \033... maps to terminal->callbacks->esc
** \033[... maps to terminal->callbacks->csi
** \033#... maps to terminal->callbacks->hash
** and \033( and \033) maps to terminal->callbacks->scs
**
** In 'callbacks', esc, csi, hash and scs are structs ascii_callbacks
** where you can bind your callbacks.
**
** Typically when terminal parses \033[42;43m
** it calls terminal->callbacks->csi->m(terminal);
**
** Parameters (here 42;43) are stored in terminal->argc and terminal->argv
** argv is an array of integers of length argc.
**
** Public members
** ==============
**
** terminal->user_data :
** A (void *) where your implementation can store whatever you want
** to get it back on your callabks.
**
** terminal->write = vt100_write;
** terminal->callbacks.csi.f = HVP;
**
**
**
*/
#define TERM_STACK_SIZE 1024
enum term_state
@ -110,8 +150,6 @@ struct term_callbacks
struct terminal
{
unsigned int width;
unsigned int height;
unsigned int cursor_pos_x;
unsigned int cursor_pos_y;
enum term_state state;

View File

@ -921,8 +921,6 @@ struct terminal_vt100 *vt100_init(void (*unimplemented)(struct terminal* term_em
vt100->top_line = 0;
vt100->terminal = terminal_init();
vt100->terminal->user_data = vt100;
vt100->terminal->width = 80;
vt100->terminal->height = 24;
vt100->terminal->write = vt100_write;
vt100->terminal->callbacks.csi.f = HVP;
vt100->terminal->callbacks.csi.K = EL;