1
0

Grunddaten

This commit is contained in:
2018-06-01 10:49:06 +02:00
parent 7034fec407
commit a5987b00cb
76 changed files with 20446 additions and 2 deletions

62
pc-software/btxasm/88.btx Normal file
View File

@@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="10*fernbl#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
10<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
<sp><sp><sp><sp>23.05.84<sp>23:23:23<sp>012345678901-0001<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zum<sp><ss2>HOffnen<sp>der<sp>Mitteilung<sp>nebenstehende<apd><apr>
zweistellige<sp>Zahl<sp>eingeben.
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,16 @@
all: main.o cept.o
gcc -Wall ./*.o -o btxasm -lcodebananas
main.o: main.c
gcc -Wall -c main.c
cept.o: cept.c
gcc -Wall -c cept.c
clean:
rm ./*.o
rm ./btxasm
install:
cp ./btxasm /usr/local/bin

View File

@@ -0,0 +1,9 @@
<0C>0@# S(@<40><>(c `ppppppp0 z_?////o?///_///_} _7 "o4 _% "_4 _ "ot _uppp{uppppp p0t j_ k|ps{____ssss{?mv_;}jt j_ bsssss{________~__{u_x _ `~?'sssssssssssss___}___t _0 `~' ~'###s3######+___o___u0 _5 h_! _ _% (__/g_w_! k_tpppp_qppp_pppz_ ||~?c_' "////////////////! !l~oi} z_4k}ppp0 x?k5"_+//! h_!j5 _ j5 ~5j7 ppp_x/ ##k? j_ "ot # (@ Chaos Computer Club
#=ZurHuck zum
HauptmenHu

View File

@@ -0,0 +1,67 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a Brown/Yellow ambient -->
<cs> <!-- Clear screen -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<esc><0x23><0x20><fylb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<trb><bkf> <!-- Select Transparent background with white foreground -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp>`ppppppp0<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>z_?////o?///_///_}<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_7<sp><sp><sp><sp><sp>"o4<sp><sp>_%<sp><sp>"_4<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp>"ot<sp>_uppp{uppppp<sp><sp>p0t<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp>k|ps{____ssss{?mv_;}jt<sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>bsssss{________~__{u_x<sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp><sp>`~?'sssssssssssss___}___t<sp><sp><sp><sp><sp>
<sp>_0<sp><sp><sp><sp><sp><sp>`~'<sp>~'###s3######+___o___u0<sp><sp><sp><sp>
<sp>_5<sp><sp><sp><sp><sp>h_!<sp><sp>_<sp><sp><sp><sp>_%<sp><sp><sp><sp><sp><sp><sp>(__/g_w_!<sp><sp><sp><sp>
<sp>k_tpppp_qppp_pppz_<sp><sp><sp><sp><sp><sp><sp><sp><sp>||~?c_'<sp><sp><sp><sp><sp>
<sp>"////////////////!<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>!l~oi}<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>z_4k}ppp0
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>x?k5"_+//!
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>h_!j5<sp>_<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j5<sp>~5j7<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>ppp_x/<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>##k?<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j_<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>"ot<sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>#<sp><sp><sp><sp><sp><sp>
<!-- Text and input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apu>
<apu>
<apu>
<apu>
<apu>
<apu>
Chaos<sp>Computer<sp>Club<apd><apr>
<apd><apr>
<apd><apr>
#=Zur<ss2>Huck<sp>zum<apd><apr>
Hauptmen<ss2>Hu<apd><apr>
<apd><apr>
<apd><apr>
Kabelsalat<sp>ist<sp>gesund.<apd><apr>
Eingabe==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

635
pc-software/btxasm/cept.c Normal file
View File

@@ -0,0 +1,635 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# http client layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h" /* Include btx configuration */
#include "cept.h" /* include own header file */
#define HEAD_PARSER_MODE 1 /* Parser control constants */
#define HYPERTEXT_PARSER_MODE 2
/* #################################################################################### */
/* ## CEPT PARSER ##################################################################### */
/* Trigger on a specified tag (Note: tag should be null terminated e.g. "<body>\0" ) */
static int applicationBtxCeptTriggerTag(char *data, char *tag)
{
char *dataPointer = data;
char *tagPointer = tag;
while(*tagPointer != '\0')
{
if((*tagPointer != *dataPointer)||(*dataPointer == '\0'))
return -1; /* Not that tag what we are looking for */
dataPointer++;
tagPointer++;
}
return 0; /* All chars match, this is the tag what we ar looking for */
}
/* Translate a cept tag to its binary pendant */
static int applicationBtxCeptTranslateTag(char *data, char *code, int *size)
{
*size = 1;
int sizecount = 0;
char *dataPointer = data;
char *tagPointer = data;
char hexCode = 0;
if(*dataPointer == '<')
{
dataPointer++;
/* Calculate tag size */
while(*dataPointer != '>')
{
if((sizecount >= BTX_CEPT_TAG_MAXSIZE)||(*dataPointer == '\0'))
{
*code = *data;
*size = 1;
return -1; /* Invalid tag */
}
dataPointer++;
sizecount++;
}
*size = sizecount + 2; /* Tag + 2 chars for <> */
/* Examine tag */
if(applicationBtxCeptTriggerTag(tagPointer,"<0x\0") == 0)
{
tagPointer++;
tagPointer++;
tagPointer++;
/* Note: I know this is not very witty but i was tired to code a
more sophisticated piece of code... */
if(*tagPointer == '0')
hexCode = 0;
else if(*tagPointer == '1')
hexCode = 16;
else if(*tagPointer == '2')
hexCode = 32;
else if(*tagPointer == '3')
hexCode = 48;
else if(*tagPointer == '4')
hexCode = 64;
else if(*tagPointer == '5')
hexCode = 80;
else if(*tagPointer == '6')
hexCode = 96;
else if(*tagPointer == '7')
hexCode = 112;
else if(*tagPointer == '8')
hexCode = 128;
else if(*tagPointer == '9')
hexCode = 144;
else if(*tagPointer == 'a')
hexCode = 160;
else if(*tagPointer == 'b')
hexCode = 176;
else if(*tagPointer == 'c')
hexCode = 192;
else if(*tagPointer == 'd')
hexCode = 208;
else if(*tagPointer == 'e')
hexCode = 224;
else if(*tagPointer == 'f')
hexCode = 240;
tagPointer++;
if(*tagPointer == '1')
hexCode += 1;
else if(*tagPointer == '2')
hexCode += 2;
else if(*tagPointer == '3')
hexCode += 3;
else if(*tagPointer == '4')
hexCode += 4;
else if(*tagPointer == '5')
hexCode += 5;
else if(*tagPointer == '6')
hexCode += 6;
else if(*tagPointer == '7')
hexCode += 7;
else if(*tagPointer == '8')
hexCode += 8;
else if(*tagPointer == '9')
hexCode += 9;
else if(*tagPointer == 'a')
hexCode += 10;
else if(*tagPointer == 'b')
hexCode += 11;
else if(*tagPointer == 'c')
hexCode += 12;
else if(*tagPointer == 'd')
hexCode += 13;
else if(*tagPointer == 'e')
hexCode += 14;
else if(*tagPointer == 'f')
hexCode += 15;
*code = hexCode;
}
else if(applicationBtxCeptTriggerTag(tagPointer,"<sp>\0") == 0)
*code = ' ';
else if(applicationBtxCeptTriggerTag(tagPointer,"<apb>\0") == 0)
*code = CEPT_APB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apf>\0") == 0)
*code = CEPT_APF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apd>\0") == 0)
*code = CEPT_APD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apu>\0") == 0)
*code = CEPT_APU;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cs>\0") == 0)
*code = CEPT_CS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apr>\0") == 0)
*code = CEPT_APR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<si>\0") == 0)
*code = CEPT_SI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<so>\0") == 0)
*code = CEPT_SO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<con>\0") == 0)
*code = CEPT_CON;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rpt>\0") == 0)
*code = CEPT_RPT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cof>\0") == 0)
*code = CEPT_COF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<can>\0") == 0)
*code = CEPT_CAN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss2>\0") == 0)
*code = CEPT_SS2;
else if(applicationBtxCeptTriggerTag(tagPointer,"<esc>\0") == 0)
*code = CEPT_ESC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss3>\0") == 0)
*code = CEPT_SS3;
else if(applicationBtxCeptTriggerTag(tagPointer,"<aph>\0") == 0)
*code = CEPT_APH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<us>\0") == 0)
*code = CEPT_US;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nul>\0") == 0)
*code = CEPT_NUL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<soh>\0") == 0)
*code = CEPT_SOH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stx>\0") == 0)
*code = CEPT_STX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etx>\0") == 0)
*code = CEPT_ETX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<eot>\0") == 0)
*code = CEPT_EOT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<enq>\0") == 0)
*code = CEPT_ENQ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ack>\0") == 0)
*code = CEPT_ACK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<itb>\0") == 0)
*code = CEPT_ITB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dle>\0") == 0)
*code = CEPT_DLE;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nak>\0") == 0)
*code = CEPT_NAK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<syn>\0") == 0)
*code = CEPT_SYN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etb>\0") == 0)
*code = CEPT_ETB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ini>\0") == 0)
*code = CEPT_INI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ter>\0") == 0)
*code = CEPT_TER;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dct>\0") == 0)
*code = CEPT_DCT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fsh>\0") == 0)
*code = CEPT_FSH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<std>\0") == 0)
*code = CEPT_STD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ebx>\0") == 0)
*code = CEPT_EBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<sbx>\0") == 0)
*code = CEPT_SBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nsz>\0") == 0)
*code = CEPT_NSZ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbh>\0") == 0)
*code = CEPT_DBH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbw>\0") == 0)
*code = CEPT_DBW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbs>\0") == 0)
*code = CEPT_DBS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cdy>\0") == 0)
*code = CEPT_CDY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<spl>\0") == 0)
*code = CEPT_SPL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stl>\0") == 0)
*code = CEPT_STL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<csi>\0") == 0)
*code = CEPT_CSI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<abk>\0") == 0)
*code = CEPT_ABK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anr>\0") == 0)
*code = CEPT_ANR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ang>\0") == 0)
*code = CEPT_ANG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<any>\0") == 0)
*code = CEPT_ANY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anb>\0") == 0)
*code = CEPT_ANB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anm>\0") == 0)
*code = CEPT_ANM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anc>\0") == 0)
*code = CEPT_ANC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anw>\0") == 0)
*code = CEPT_ANW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mbk>\0") == 0)
*code = CEPT_MBK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msr>\0") == 0)
*code = CEPT_MSR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msg>\0") == 0)
*code = CEPT_MSG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msy>\0") == 0)
*code = CEPT_MSY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msb>\0") == 0)
*code = CEPT_MSB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msm>\0") == 0)
*code = CEPT_MSM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msc>\0") == 0)
*code = CEPT_MSC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msw>\0") == 0)
*code = CEPT_MSW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bbd>\0") == 0)
*code = CEPT_BBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nbd>\0") == 0)
*code = CEPT_NBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<hms>\0") == 0)
*code = CEPT_HMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rms>\0") == 0)
*code = CEPT_RMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkf>\0") == 0)
*code = CEPT_BKF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdf>\0") == 0)
*code = CEPT_RDF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grf>\0") == 0)
*code = CEPT_GRF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylf>\0") == 0)
*code = CEPT_YLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blf>\0") == 0)
*code = CEPT_BLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgf>\0") == 0)
*code = CEPT_MGF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnf>\0") == 0)
*code = CEPT_CNF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whf>\0") == 0)
*code = CEPT_WHF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkb>\0") == 0)
*code = CEPT_BKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdb>\0") == 0)
*code = CEPT_RDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grb>\0") == 0)
*code = CEPT_GRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylb>\0") == 0)
*code = CEPT_YLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blb>\0") == 0)
*code = CEPT_BLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgb>\0") == 0)
*code = CEPT_MGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnb>\0") == 0)
*code = CEPT_CNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whb>\0") == 0)
*code = CEPT_WHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<npo>\0") == 0)
*code = CEPT_NPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ipo>\0") == 0)
*code = CEPT_IPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<trb>\0") == 0)
*code = CEPT_TRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stc>\0") == 0)
*code = CEPT_STC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fbkb>\0") == 0)
*code = CEPT_FBKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<frdb>\0") == 0)
*code = CEPT_FRDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fgrb>\0") == 0)
*code = CEPT_FGRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fylb>\0") == 0)
*code = CEPT_FYLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fblb>\0") == 0)
*code = CEPT_FBLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fmgb>\0") == 0)
*code = CEPT_FMGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fcnb>\0") == 0)
*code = CEPT_FCNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fwhb>\0") == 0)
*code = CEPT_FWHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ftrb>\0") == 0)
*code = CEPT_FTRB;
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
return 0;
}
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
}
/* Strip everthing that is encapsulated by <!-- --> */
static int applicationBtxCeptStripComments(char *data)
{
int ignoreData = 0;
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptTriggerTag(dataAheadPointer, "<!--\0") == 0)
ignoreData = 1;
if(applicationBtxCeptTriggerTag(dataAheadPointer, "-->\0") == 0)
{
ignoreData = 0;
dataAheadPointer += 3;
}
*dataPointer = *dataAheadPointer;
if(ignoreData == 0)
dataPointer++;
dataAheadPointer++;
}
*dataPointer = '\0';
return 0;
}
/* Chech if the character is non pintable. Return 0 when printable and -1 when non printable */
static int applicationBtxCeptCheckPrintable(char *data)
{
if(*data == ' ') /* In our case a space is a non printable char (We have <sp> for that) */
return -1;
else if ((*data >= 0x20)&&(*data <= 0x7E)) /* Printable char */
return 0;
else if(*data == '\0') /* Do not destroy \0 terminator */
return 0;
else /* All other chars are threated as non printable */
return -1;
}
/* Strip non printable characters */
static int applicationBtxCeptStripNonPrintable(char *data)
{
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptCheckPrintable(dataAheadPointer) == -1)
dataAheadPointer++;
else
{
*dataPointer = *dataAheadPointer;
dataPointer++;
dataAheadPointer++;
}
}
*dataPointer = '\0';
return 0;
}
/* Extract content and name from a meta tag string */
static int applicationBtxParseMetaTag(char *data, char *name, char *content)
{
char *dataPointer = data;
char *namePointer = name;
char *contentPointer = content;
int copyControl = 0;
int nameSizeCount = 0; /* Size counter to prevent buffer overflow */
int contentSizeCount = 0;
while(*dataPointer != '>')
{
if(*dataPointer == '\0')
return -1; /* Something has gone completely wrong */
if(*dataPointer == '\"') /* Switch off copy control when delimeter character passes by */
copyControl = 0;
if(copyControl == 1)
{
if(nameSizeCount < (BTX_CEPT_META_TAG_NAME_BUFFERSIZE -1))
{
*namePointer = *dataPointer;
namePointer++;
nameSizeCount++;
}
else
return -1;
}
else if(copyControl == 2)
{
if(contentSizeCount < (BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE -1))
{
*contentPointer = *dataPointer;
contentPointer++;
contentSizeCount++;
}
else
return -1;
}
else
{
if((applicationBtxCeptTriggerTag(dataPointer,"name=\"\0") == 0))
{
dataPointer += 5;
copyControl = 1;
}
else if((applicationBtxCeptTriggerTag(dataPointer,"content=\"\0") == 0))
{
dataPointer += 8;
copyControl = 2;
}
}
dataPointer++;
}
*namePointer = '\0';
*contentPointer = '\0';
if(copyControl != 0) /* If copy control flag is not zero something gone wrong ! */
return -1;
else
return 0;
}
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page)
{
char *dataInPointer = dataIn;
char *dataOutPointer = page->ceptPage;
int tagSize;
char binaryCode;
int parserMode = 0; /* Parser control flags */
int parserActive = 0;
int tagHistory = 0;
page->ceptPageLength = 0; /* Initalize data in the page structure */
page->metaTagCount = 0;
applicationBtxCeptStripComments(dataInPointer); /* strip comments */
applicationBtxCeptStripNonPrintable(dataInPointer); /* strip non printable chars (and whitespaces) */
while(*dataInPointer != '\0')
{
/* Handle parser control */
if((applicationBtxCeptTriggerTag(dataInPointer,"<cept>\0") == 0))
{
if(tagHistory == 0)
{
tagHistory = 1;
parserActive = 1;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<head>\0") == 0))
{
if(tagHistory == 1)
{
tagHistory = 2;
parserMode = HEAD_PARSER_MODE;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</head>\0") == 0))
{
if(tagHistory == 2)
{
tagHistory = 3;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<body>\0") == 0))
{
if(tagHistory == 3)
{
tagHistory = 4;
parserMode = HYPERTEXT_PARSER_MODE;
dataInPointer += 6; /* Override the body tag */
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</body>\0") == 0))
{
if(tagHistory == 4)
{
tagHistory = 5;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</cept>\0") == 0))
{
if(tagHistory == 5)
{
tagHistory = 6;
parserActive = 0;
}
else
return -1;
}
/* Head parser mode */
if((parserMode == HEAD_PARSER_MODE)&&(parserActive == 1))
{
if((applicationBtxCeptTriggerTag(dataInPointer,"<meta\0") == 0))
{
if(page->metaTagCount<BTX_CEPT_META_TAG_MAXCOUNT)
{
if(applicationBtxParseMetaTag(dataInPointer,page->metaName[page->metaTagCount],page->metaContent[page->metaTagCount]) == -1)
return -1;
page->metaTagCount++;
}
else
return -1;
}
dataInPointer++;
}
/* Hypertect parser mode */
else if((parserMode == HYPERTEXT_PARSER_MODE)&&(parserActive == 1))
{
if(page->ceptPageLength < BTX_CEPT_BINARY_BUFFERSIZE)
{
applicationBtxCeptTranslateTag(dataInPointer,&binaryCode,&tagSize); /* Translate hypertext to binary */
dataInPointer += tagSize;
*dataOutPointer = binaryCode;
dataOutPointer++;
page->ceptPageLength++;
}
else
return 0;
}
/* Parser off */
else
dataInPointer++;
}
*dataOutPointer = '\0';
/* Do final check, every flack must be set! */
if((tagHistory == 6)&&(parserActive == 0)&&(parserMode == 0))
return 0;
else
return -1;
}
/* #################################################################################### */

283
pc-software/btxasm/cept.h Normal file
View File

@@ -0,0 +1,283 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# cept parser layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* FE Full Screen atributes (single byte constants) */
#define CEPT_FBKB 0x50 /* BlacK Background */
#define CEPT_FRDB 0x51 /* ReD Background */
#define CEPT_FGRB 0x52 /* GReen Background */
#define CEPT_FYLB 0x53 /* YeLlow Background */
#define CEPT_FBLB 0x54 /* BLue Background */
#define CEPT_FMGB 0x55 /* MaGenta Background */
#define CEPT_FCNB 0x56 /* CyaN Background */
#define CEPT_FWHB 0x57 /* WHite Background */
#define CEPT_FTRB 0x5E /* TRansparent Background */
/* FE Full Screen atributes (printf-friendly) */
#define F_CEPT_FBKB "\x50" /* BlacK Background */
#define F_CEPT_FRDB "\x51" /* ReD Background */
#define F_CEPT_FGRB "\x52" /* GReen Background */
#define F_CEPT_FYLB "\x53" /* YeLlow Background */
#define F_CEPT_FBLB "\x54" /* BLue Background */
#define F_CEPT_FMGB "\x55" /* MaGenta Background */
#define F_CEPT_FCNB "\x56" /* CyaN Background */
#define F_CEPT_FWHB "\x57" /* WHite Background */
#define F_CEPT_FTRB "\x5E" /* TRansparent Background */
#define CEPT_ECHOPLEX_GUARDTIME 200 /* Echoplex guardtime, time between receiving and echoing */
/* Data structure of a btx-cept-page */
typedef struct
{
/* Contains the cept page in its binary form */
char ceptPage[BTX_CEPT_BINARY_BUFFERSIZE];
/* Contains the length of the cept page */
int ceptPageLength;
/* Contains the meta tag name */
char metaName[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_NAME_BUFFERSIZE];
/* Contains the corospondenting meta content */
char metaContent[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE];
/* Contains the number of meta tags that are issued to the page */
int metaTagCount;
}btxCeptPageData;
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page);
#endif /*CEPT_H*/
/* #################################################################################### */

View File

@@ -0,0 +1,65 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# mikroPAD configuration #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CONFIG_H
#define CONFIG_H
/* ATTENTION! You must do a "make clean" and then "make" to make the changes take effect! */
/* General configuration */
#define DEBUGPORT 0 /* Debug port configuration (0=Disabled, 1=Enabled) */
#define VERSIONSTRING "V 0.0.1" /* Version string */
#define DISPLAYPAGE_RETRYS 3 /* Configures how often the system retrys to display a page */
#define PAGE_HISTORY_SIZE 23 /* Configures how many entered pageIds the integrated history can store */
/* Ulm configuration */
#define BTX_ULM_INITIAL_PAGE "*index#" /* Set the initial page (Wellcomescreen) */
#define BTX_ULM_HOST "btx.runningserver.com" /* Configure where Ulm is */
#define BTX_ULM_PORT 80 /* Configure on which port of Ulm the http-server is running */
#define BTX_ULM_STYLE 1 /* Configure ulm style: 1=Static, 2=Dynamic (see readme file) */
#define BTX_ULM_PAGE_FILE_SUFFIX "btx" /* File type prefix that will be used for http access */
#define BTX_ULM_PAGE_ID_MAXLENGTH 32 /* The length of the page id (see readme file) */
#define BTX_ULM_HYPERLINK_ID_MAXLENGTH 2 /* The lenght of an hyperlink id (recomanded value is 2) */
#define BTX_ULM_PAGE_BASENAME "page" /* When style 2 is selected, this is the name of the page that generates the contnet */
#define BTX_ULM_PAGE_REQUESTVAR "id" /* When style 2 is selected, this is the name of the variable that contains the request */
#define BTX_ULM_IP_RESOLVE_RETRYS 3 /* Configures how often the system retrys to resolve the ulm ip */
/* Internal messages */
#define BTX_MESSAGE_HTTPERROR "SEITE NICHT VERFUEGBAR" /* Message that is displayed if an http-error anounces */
#define BTX_MESSAGE_CONNECTIONERROR "ZENTRALE NICHT ERREICHBAR" /* Message that is displayed when there is a problem with the ulm connection */
#define BTX_MESSAGE_PARSEERROR "SEITE BESCHAEDIGT" /* Message that is displayed when parse errors anounces */
/* Cept parser configuration: */
#define BTX_CEPT_HYPERTEXT_BUFFERSIZE 10000 /* Maximal size of a hypertext cept-page the PAD can process */
#define BTX_CEPT_BINARY_BUFFERSIZE 10000 /* Maximal size of a binary cept-page the PAD can process */
#define BTX_CEPT_TAG_MAXSIZE 32 /* Maximal size of a single tag */
#define BTX_CEPT_META_TAG_MAXCOUNT 8 /* Maximal number of meta tags that can be stored in one page structure */
#define BTX_CEPT_META_TAG_NAME_BUFFERSIZE 32+1 /* Maximal size of a meta tag name (+1 for \0) */
#define BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE 128+1 /* Maximal size of a meta tag content (+1 for \0) */
#define BTX_CEPT_META_TAG_HYPERLINKLIST_BUFFER 256 /* Hyperlinklist buffer size */
#endif /*CONFIG_H*/
/* #################################################################################### */

View File

@@ -0,0 +1,63 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*fernbl2#">
<meta name="load_timeout" content="5">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Datensch<ss2>Hutzer,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1<sp>St<ss2>Huck<sp>ihres<sp>letzten<sp>T<ss2>Hatigkeitsberichts<!-- apd apr -->
zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Dateischeisser,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1000<sp>St<ss2>Huck<sp>ihres<sp>letzten<apd><apr>
T<ss2>Hatigkeitsberichts<sp>zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,68 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Hilfe<sp><sp><sp><sp><sp><sp><sp><sp>*hilfe#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Text -->
<apd><apr>
<dbh>Die<sp>wichtigsten<sp>codes:<nsz><apd><apr>
<sp>#<sp><sp><sp><sp>=<sp>Weiter<sp><sp><sp><sp>*0#<sp><sp>=<sp><ss2>HUbersichtsseite<!-- apd apr -->
<sp>*#<sp><sp><sp>=<sp>Zur<ss2>Huck<sp><sp><sp><sp>*00#<sp>=<sp>Neu<sp>laden<apd><apr>
<apd><apr>
<dbh>Direktaufruf<sp>von<sp>Seiten:<nsz><apd><apr>
<sp>*seitenname#<sp>oder<sp>*seitennummer#<apd><apr>
<sp>z.B.:<sp>*wtf#<apd><apr>
<apd><apr>
<dbh>Aufruf<sp>von<sp>Verkn<ss2>Hupfungen:<nsz><apd><apr>
<sp>Einfach<sp>die<sp>entsprechende<sp>zweistellige<apd><apr>
<sp>Zahl<sp>eingeben<sp>(<ss2>HAhnlich<sp>Videotext)<apd><apr>
<apd><apr>
<dbh>Eingabe:<nsz><apd><apr>
<sp>Taste<sp><ss3>\<sp>korrigiert<sp>Eingabe<apd><apr>
<sp>Nicht<sp>zu<sp>schnell<sp>tippen!<apd><apr>
<sp>Ung<ss2>Hultige<sp>Eingaben<sp>werden<sp>ignoriert.<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@@ -0,0 +1,51 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*welcome#">
<meta name="load_timeout" content="2">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<apd>
<apd><apr>
<!-- Logo -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp><sp><sp>8######################)0<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>`x|__________}|p<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>h____w######c____}<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>*___/'`~___t"/o__?<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>"cx~_j_____j_|r#<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____j_____j___5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____};///y____5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>______________5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>p000<sp>0`<sp><sp>0<sp>0<sp><sp><sp><sp>`<sp><sp>`<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>=14575mh$7547jkkj!7h"6<sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>"d#!!!#!#"!!!!!""""!!"""`&<apd><apr>
<sp><sp><sp><sp><sp><sp><sp><sp><sp>######################!<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apd>
________________________________________<apd><apr>
<sp><sp><sp>BTX-Nummer<sp><sp><sp><sp>:<sp><sp>23422342235<sp><sp>-<sp><sp>1<apd><apr>
<sp><sp><sp>pers.<sp>Kennwort:<sp><sp>usd7000011<apd><apr>
________________________________________<apd><apr>
<apd>
Bitte<sp>warten...
</body>
</cept>

176
pc-software/btxasm/main.c Normal file
View File

@@ -0,0 +1,176 @@
/*
####################################################################################
# #
# BTXASM V1.0.0 #
# Main-Program #
# #
# Copyright (C) 2010 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <libcodebananas/toolbanana.h>
#include <string.h>
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
#include <libgen.h>
#include "config.h"
#include "cept.h"
char programName[255];
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
/* #################################################################################### */
/* #################################################################################### */
void showUsage(void)
{
printf(" * Usage:\r\n");
printf(" %s -p [PORT] -i [BTXML-INPUT] -o [BINARY-OUTPUT]-f\r\n",programName);
printf("\r\n");
}
/* Main program: Perform some testpages */
int main(int argc, char *argv[])
{
int getoptOption;
char *getoptBtxPage = 0;
char *getoptBtxPageBinary = 0;
int getoptVerboseMode = 0;
char ceptHypertextBuffer[BTX_CEPT_HYPERTEXT_BUFFERSIZE];
int i;
btxCeptPageData btxCeptPage; /* Contains the page information of the last displayed page */
strcpy(programName,basename(argv[0]));
printf("_______________________________________________________________________________\n\r");
printf("Bildschirmtrix BTX Assembler V.1.0\n\r");
printf("Copyright(c) 2014 Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
/* Parse Options */
while ((getoptOption = getopt (argc, argv, ":h?i:o:v")) != -1)
switch (getoptOption)
{
case 'h':
showUsage();
return 0;
case '?':
showUsage();
return 0;
case 'v':
getoptVerboseMode = 1;
break;
case 'i':
getoptBtxPage = optarg;
case 'o':
getoptBtxPageBinary = optarg;
break;
}
/* Check input file */
if(getoptBtxPage)
{
printf(" * Path to BTXML BTX-Page is: %s\r\n", getoptBtxPage);
/* Check whether the file is readable */
if(testFile(getoptBtxPage) != 0)
{
printf(" * Error: Can not read BTX-Page from file system - aborting!\r\n");
printf("\r\n");
exit(1);
}
}
else
{
printf(" * Error: You must specify a BTX-Page!\r\n");
printf("\r\n");
exit(1);
}
printf(" * Path to BINARY BTX-Page is: %s\r\n", getoptBtxPageBinary);
/* Load Hypertext file into buffer */
if(loadFile(ceptHypertextBuffer, sizeof(ceptHypertextBuffer), getoptBtxPage) != -1)
printf(" * Info: BTX-Hypertext loaded successfully...\r\n");
else
{
printf(" * Error: Could not load BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display hypertext page on the screen.. */
if(getoptVerboseMode)
{
printf(" * Info: The following BTX-Hypertext has been loaded:\r\n");
printf("%s\r\n",ceptHypertextBuffer);
}
/* Parse hypertext page */
if(applicationBtxCeptParse(ceptHypertextBuffer, &btxCeptPage) != 1)
printf(" * Info: BTX-Hypertext parsed successfully...\r\n");
else
{
printf(" * Error: Could not parse BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display additional information: hexdump, metatags ect.. */
if(getoptVerboseMode)
{
printf(" * Info: The page contains the following meta information (has no effect here)\r\n");
for(i=0; i<btxCeptPage.metaTagCount; i++)
printf(" %s = %s\r\n", btxCeptPage.metaName[i], btxCeptPage.metaContent[i]);
printf(" * Info: The following binary data (%i bytes) will be transmitted to therminal:\r\n", btxCeptPage.ceptPageLength);
hexBinAsciiDump(btxCeptPage.ceptPage, btxCeptPage.ceptPageLength);
}
printf(" * Writing output file...\n");
if(storeFile(btxCeptPage.ceptPage, btxCeptPage.ceptPageLength, getoptBtxPageBinary) != -1)
printf(" * Info: Outputfile stored successfully!\r\n");
else
{
printf(" * Error: Writing output file failed!\r\n");
exit(1);
}
printf(" * Done!\n\r");
printf("\n\r");
return 0;
}
/* #################################################################################### */

View File

@@ -0,0 +1,2 @@
This is a program to assemble the textual btxml representation into a binary stream.

View File

@@ -0,0 +1,75 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*test2#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Testbild<sp><sp><sp><sp><sp><sp>*test#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Test-Text -->
BTX<sp>Testbild<sp>nach<sp>CEPT<sp>T/CD<sp>6-1<apd><apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set (just activate, only for a better understanding) -->
<grb><bkf>G0-SET:<whf><trb> <!-- Green foreground with black background and back -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G1-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G2-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x62> <!-- Invoke G2 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G3-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x64> <!-- Invoke G3 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@@ -0,0 +1,61 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="06*88#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Deutsche<sp>Chaospost<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
<nsz>02.09.1983<sp><sp>23:23<apd><apr>
<apd><apr>
Guten<sp>Tag<apd><apr>
Frau<apd><apr>
Eris<apd><apr>
Discordia<apd><apr>
<apd><apr>
Mitteilungsempfang<sp><ss2>Hoffnen<sp>mit<sp>06<apd><apr>
<apd>
<apd>
<apd>
<apd>
<apd>
<apd><apr>
Sie<sp>benutzten<sp>Bildschirmtext<sp>zuletzt<apd><apr>
am<sp>31.12.2001<sp>bis<sp>23:59<apd><apr>
<apd><apr>
<apd><apr>
Weiter<sp>mit<sp>#<sp>oder<sp><sp><sp>*Seitennummer#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="10*fernbl#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
10<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
<sp><sp><sp><sp>23.05.84<sp>23:23:23<sp>012345678901-0001<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zum<sp><ss2>HOffnen<sp>der<sp>Mitteilung<sp>nebenstehende<apd><apr>
zweistellige<sp>Zahl<sp>eingeben.
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,16 @@
all: main.o cept.o
gcc -Wall ./*.o -o pageload -lcodebananas
main.o: main.c
gcc -Wall -c main.c
cept.o: cept.c
gcc -Wall -c cept.c
clean:
rm ./*.o
rm ./pageload
install:
cp ./pageload /usr/local/bin

View File

@@ -0,0 +1,67 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a Brown/Yellow ambient -->
<cs> <!-- Clear screen -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<esc><0x23><0x20><fylb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<trb><bkf> <!-- Select Transparent background with white foreground -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp>`ppppppp0<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>z_?////o?///_///_}<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_7<sp><sp><sp><sp><sp>"o4<sp><sp>_%<sp><sp>"_4<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp>"ot<sp>_uppp{uppppp<sp><sp>p0t<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp>k|ps{____ssss{?mv_;}jt<sp><sp><sp><sp><sp><sp><sp>
j_<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>bsssss{________~__{u_x<sp><sp><sp><sp><sp><sp>
<sp>_<sp><sp><sp><sp><sp><sp><sp><sp>`~?'sssssssssssss___}___t<sp><sp><sp><sp><sp>
<sp>_0<sp><sp><sp><sp><sp><sp>`~'<sp>~'###s3######+___o___u0<sp><sp><sp><sp>
<sp>_5<sp><sp><sp><sp><sp>h_!<sp><sp>_<sp><sp><sp><sp>_%<sp><sp><sp><sp><sp><sp><sp>(__/g_w_!<sp><sp><sp><sp>
<sp>k_tpppp_qppp_pppz_<sp><sp><sp><sp><sp><sp><sp><sp><sp>||~?c_'<sp><sp><sp><sp><sp>
<sp>"////////////////!<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>!l~oi}<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>z_4k}ppp0
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>x?k5"_+//!
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>h_!j5<sp>_<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j5<sp>~5j7<sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>ppp_x/<sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>##k?<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>j_<sp><sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>"ot<sp><sp><sp><sp><sp><sp>
<sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp><sp>#<sp><sp><sp><sp><sp><sp>
<!-- Text and input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apu>
<apu>
<apu>
<apu>
<apu>
<apu>
Chaos<sp>Computer<sp>Club<apd><apr>
<apd><apr>
<apd><apr>
#=Zur<ss2>Huck<sp>zum<apd><apr>
Hauptmen<ss2>Hu<apd><apr>
<apd><apr>
<apd><apr>
Kabelsalat<sp>ist<sp>gesund.<apd><apr>
Eingabe==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

635
pc-software/pageload/cept.c Normal file
View File

@@ -0,0 +1,635 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# http client layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h" /* Include btx configuration */
#include "cept.h" /* include own header file */
#define HEAD_PARSER_MODE 1 /* Parser control constants */
#define HYPERTEXT_PARSER_MODE 2
/* #################################################################################### */
/* ## CEPT PARSER ##################################################################### */
/* Trigger on a specified tag (Note: tag should be null terminated e.g. "<body>\0" ) */
static int applicationBtxCeptTriggerTag(char *data, char *tag)
{
char *dataPointer = data;
char *tagPointer = tag;
while(*tagPointer != '\0')
{
if((*tagPointer != *dataPointer)||(*dataPointer == '\0'))
return -1; /* Not that tag what we are looking for */
dataPointer++;
tagPointer++;
}
return 0; /* All chars match, this is the tag what we ar looking for */
}
/* Translate a cept tag to its binary pendant */
static int applicationBtxCeptTranslateTag(char *data, char *code, int *size)
{
*size = 1;
int sizecount = 0;
char *dataPointer = data;
char *tagPointer = data;
char hexCode = 0;
if(*dataPointer == '<')
{
dataPointer++;
/* Calculate tag size */
while(*dataPointer != '>')
{
if((sizecount >= BTX_CEPT_TAG_MAXSIZE)||(*dataPointer == '\0'))
{
*code = *data;
*size = 1;
return -1; /* Invalid tag */
}
dataPointer++;
sizecount++;
}
*size = sizecount + 2; /* Tag + 2 chars for <> */
/* Examine tag */
if(applicationBtxCeptTriggerTag(tagPointer,"<0x\0") == 0)
{
tagPointer++;
tagPointer++;
tagPointer++;
/* Note: I know this is not very witty but i was tired to code a
more sophisticated piece of code... */
if(*tagPointer == '0')
hexCode = 0;
else if(*tagPointer == '1')
hexCode = 16;
else if(*tagPointer == '2')
hexCode = 32;
else if(*tagPointer == '3')
hexCode = 48;
else if(*tagPointer == '4')
hexCode = 64;
else if(*tagPointer == '5')
hexCode = 80;
else if(*tagPointer == '6')
hexCode = 96;
else if(*tagPointer == '7')
hexCode = 112;
else if(*tagPointer == '8')
hexCode = 128;
else if(*tagPointer == '9')
hexCode = 144;
else if(*tagPointer == 'a')
hexCode = 160;
else if(*tagPointer == 'b')
hexCode = 176;
else if(*tagPointer == 'c')
hexCode = 192;
else if(*tagPointer == 'd')
hexCode = 208;
else if(*tagPointer == 'e')
hexCode = 224;
else if(*tagPointer == 'f')
hexCode = 240;
tagPointer++;
if(*tagPointer == '1')
hexCode += 1;
else if(*tagPointer == '2')
hexCode += 2;
else if(*tagPointer == '3')
hexCode += 3;
else if(*tagPointer == '4')
hexCode += 4;
else if(*tagPointer == '5')
hexCode += 5;
else if(*tagPointer == '6')
hexCode += 6;
else if(*tagPointer == '7')
hexCode += 7;
else if(*tagPointer == '8')
hexCode += 8;
else if(*tagPointer == '9')
hexCode += 9;
else if(*tagPointer == 'a')
hexCode += 10;
else if(*tagPointer == 'b')
hexCode += 11;
else if(*tagPointer == 'c')
hexCode += 12;
else if(*tagPointer == 'd')
hexCode += 13;
else if(*tagPointer == 'e')
hexCode += 14;
else if(*tagPointer == 'f')
hexCode += 15;
*code = hexCode;
}
else if(applicationBtxCeptTriggerTag(tagPointer,"<sp>\0") == 0)
*code = ' ';
else if(applicationBtxCeptTriggerTag(tagPointer,"<apb>\0") == 0)
*code = CEPT_APB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apf>\0") == 0)
*code = CEPT_APF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apd>\0") == 0)
*code = CEPT_APD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apu>\0") == 0)
*code = CEPT_APU;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cs>\0") == 0)
*code = CEPT_CS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<apr>\0") == 0)
*code = CEPT_APR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<si>\0") == 0)
*code = CEPT_SI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<so>\0") == 0)
*code = CEPT_SO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<con>\0") == 0)
*code = CEPT_CON;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rpt>\0") == 0)
*code = CEPT_RPT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cof>\0") == 0)
*code = CEPT_COF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<can>\0") == 0)
*code = CEPT_CAN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss2>\0") == 0)
*code = CEPT_SS2;
else if(applicationBtxCeptTriggerTag(tagPointer,"<esc>\0") == 0)
*code = CEPT_ESC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ss3>\0") == 0)
*code = CEPT_SS3;
else if(applicationBtxCeptTriggerTag(tagPointer,"<aph>\0") == 0)
*code = CEPT_APH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<us>\0") == 0)
*code = CEPT_US;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nul>\0") == 0)
*code = CEPT_NUL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<soh>\0") == 0)
*code = CEPT_SOH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stx>\0") == 0)
*code = CEPT_STX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etx>\0") == 0)
*code = CEPT_ETX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<eot>\0") == 0)
*code = CEPT_EOT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<enq>\0") == 0)
*code = CEPT_ENQ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ack>\0") == 0)
*code = CEPT_ACK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<itb>\0") == 0)
*code = CEPT_ITB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dle>\0") == 0)
*code = CEPT_DLE;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nak>\0") == 0)
*code = CEPT_NAK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<syn>\0") == 0)
*code = CEPT_SYN;
else if(applicationBtxCeptTriggerTag(tagPointer,"<etb>\0") == 0)
*code = CEPT_ETB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ini>\0") == 0)
*code = CEPT_INI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ter>\0") == 0)
*code = CEPT_TER;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dct>\0") == 0)
*code = CEPT_DCT;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fsh>\0") == 0)
*code = CEPT_FSH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<std>\0") == 0)
*code = CEPT_STD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ebx>\0") == 0)
*code = CEPT_EBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<sbx>\0") == 0)
*code = CEPT_SBX;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nsz>\0") == 0)
*code = CEPT_NSZ;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbh>\0") == 0)
*code = CEPT_DBH;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbw>\0") == 0)
*code = CEPT_DBW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<dbs>\0") == 0)
*code = CEPT_DBS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cdy>\0") == 0)
*code = CEPT_CDY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<spl>\0") == 0)
*code = CEPT_SPL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stl>\0") == 0)
*code = CEPT_STL;
else if(applicationBtxCeptTriggerTag(tagPointer,"<csi>\0") == 0)
*code = CEPT_CSI;
else if(applicationBtxCeptTriggerTag(tagPointer,"<abk>\0") == 0)
*code = CEPT_ABK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anr>\0") == 0)
*code = CEPT_ANR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ang>\0") == 0)
*code = CEPT_ANG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<any>\0") == 0)
*code = CEPT_ANY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anb>\0") == 0)
*code = CEPT_ANB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anm>\0") == 0)
*code = CEPT_ANM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anc>\0") == 0)
*code = CEPT_ANC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<anw>\0") == 0)
*code = CEPT_ANW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mbk>\0") == 0)
*code = CEPT_MBK;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msr>\0") == 0)
*code = CEPT_MSR;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msg>\0") == 0)
*code = CEPT_MSG;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msy>\0") == 0)
*code = CEPT_MSY;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msb>\0") == 0)
*code = CEPT_MSB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msm>\0") == 0)
*code = CEPT_MSM;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msc>\0") == 0)
*code = CEPT_MSC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<msw>\0") == 0)
*code = CEPT_MSW;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bbd>\0") == 0)
*code = CEPT_BBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<nbd>\0") == 0)
*code = CEPT_NBD;
else if(applicationBtxCeptTriggerTag(tagPointer,"<hms>\0") == 0)
*code = CEPT_HMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rms>\0") == 0)
*code = CEPT_RMS;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkf>\0") == 0)
*code = CEPT_BKF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdf>\0") == 0)
*code = CEPT_RDF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grf>\0") == 0)
*code = CEPT_GRF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylf>\0") == 0)
*code = CEPT_YLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blf>\0") == 0)
*code = CEPT_BLF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgf>\0") == 0)
*code = CEPT_MGF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnf>\0") == 0)
*code = CEPT_CNF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whf>\0") == 0)
*code = CEPT_WHF;
else if(applicationBtxCeptTriggerTag(tagPointer,"<bkb>\0") == 0)
*code = CEPT_BKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<rdb>\0") == 0)
*code = CEPT_RDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<grb>\0") == 0)
*code = CEPT_GRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ylb>\0") == 0)
*code = CEPT_YLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<blb>\0") == 0)
*code = CEPT_BLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<mgb>\0") == 0)
*code = CEPT_MGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<cnb>\0") == 0)
*code = CEPT_CNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<whb>\0") == 0)
*code = CEPT_WHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<npo>\0") == 0)
*code = CEPT_NPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ipo>\0") == 0)
*code = CEPT_IPO;
else if(applicationBtxCeptTriggerTag(tagPointer,"<trb>\0") == 0)
*code = CEPT_TRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<stc>\0") == 0)
*code = CEPT_STC;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fbkb>\0") == 0)
*code = CEPT_FBKB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<frdb>\0") == 0)
*code = CEPT_FRDB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fgrb>\0") == 0)
*code = CEPT_FGRB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fylb>\0") == 0)
*code = CEPT_FYLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fblb>\0") == 0)
*code = CEPT_FBLB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fmgb>\0") == 0)
*code = CEPT_FMGB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fcnb>\0") == 0)
*code = CEPT_FCNB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<fwhb>\0") == 0)
*code = CEPT_FWHB;
else if(applicationBtxCeptTriggerTag(tagPointer,"<ftrb>\0") == 0)
*code = CEPT_FTRB;
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
return 0;
}
else
{
*size = 1;
*code = *data;
return -1; /* Invalid tag! */
}
}
/* Strip everthing that is encapsulated by <!-- --> */
static int applicationBtxCeptStripComments(char *data)
{
int ignoreData = 0;
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptTriggerTag(dataAheadPointer, "<!--\0") == 0)
ignoreData = 1;
if(applicationBtxCeptTriggerTag(dataAheadPointer, "-->\0") == 0)
{
ignoreData = 0;
dataAheadPointer += 3;
}
*dataPointer = *dataAheadPointer;
if(ignoreData == 0)
dataPointer++;
dataAheadPointer++;
}
*dataPointer = '\0';
return 0;
}
/* Chech if the character is non pintable. Return 0 when printable and -1 when non printable */
static int applicationBtxCeptCheckPrintable(char *data)
{
if(*data == ' ') /* In our case a space is a non printable char (We have <sp> for that) */
return -1;
else if ((*data >= 0x20)&&(*data <= 0x7E)) /* Printable char */
return 0;
else if(*data == '\0') /* Do not destroy \0 terminator */
return 0;
else /* All other chars are threated as non printable */
return -1;
}
/* Strip non printable characters */
static int applicationBtxCeptStripNonPrintable(char *data)
{
char *dataPointer = data;
char *dataAheadPointer = data;
while(*dataAheadPointer != '\0')
{
if(applicationBtxCeptCheckPrintable(dataAheadPointer) == -1)
dataAheadPointer++;
else
{
*dataPointer = *dataAheadPointer;
dataPointer++;
dataAheadPointer++;
}
}
*dataPointer = '\0';
return 0;
}
/* Extract content and name from a meta tag string */
static int applicationBtxParseMetaTag(char *data, char *name, char *content)
{
char *dataPointer = data;
char *namePointer = name;
char *contentPointer = content;
int copyControl = 0;
int nameSizeCount = 0; /* Size counter to prevent buffer overflow */
int contentSizeCount = 0;
while(*dataPointer != '>')
{
if(*dataPointer == '\0')
return -1; /* Something has gone completely wrong */
if(*dataPointer == '\"') /* Switch off copy control when delimeter character passes by */
copyControl = 0;
if(copyControl == 1)
{
if(nameSizeCount < (BTX_CEPT_META_TAG_NAME_BUFFERSIZE -1))
{
*namePointer = *dataPointer;
namePointer++;
nameSizeCount++;
}
else
return -1;
}
else if(copyControl == 2)
{
if(contentSizeCount < (BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE -1))
{
*contentPointer = *dataPointer;
contentPointer++;
contentSizeCount++;
}
else
return -1;
}
else
{
if((applicationBtxCeptTriggerTag(dataPointer,"name=\"\0") == 0))
{
dataPointer += 5;
copyControl = 1;
}
else if((applicationBtxCeptTriggerTag(dataPointer,"content=\"\0") == 0))
{
dataPointer += 8;
copyControl = 2;
}
}
dataPointer++;
}
*namePointer = '\0';
*contentPointer = '\0';
if(copyControl != 0) /* If copy control flag is not zero something gone wrong ! */
return -1;
else
return 0;
}
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page)
{
char *dataInPointer = dataIn;
char *dataOutPointer = page->ceptPage;
int tagSize;
char binaryCode;
int parserMode = 0; /* Parser control flags */
int parserActive = 0;
int tagHistory = 0;
page->ceptPageLength = 0; /* Initalize data in the page structure */
page->metaTagCount = 0;
applicationBtxCeptStripComments(dataInPointer); /* strip comments */
applicationBtxCeptStripNonPrintable(dataInPointer); /* strip non printable chars (and whitespaces) */
while(*dataInPointer != '\0')
{
/* Handle parser control */
if((applicationBtxCeptTriggerTag(dataInPointer,"<cept>\0") == 0))
{
if(tagHistory == 0)
{
tagHistory = 1;
parserActive = 1;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<head>\0") == 0))
{
if(tagHistory == 1)
{
tagHistory = 2;
parserMode = HEAD_PARSER_MODE;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</head>\0") == 0))
{
if(tagHistory == 2)
{
tagHistory = 3;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"<body>\0") == 0))
{
if(tagHistory == 3)
{
tagHistory = 4;
parserMode = HYPERTEXT_PARSER_MODE;
dataInPointer += 6; /* Override the body tag */
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</body>\0") == 0))
{
if(tagHistory == 4)
{
tagHistory = 5;
parserMode = 0;
}
else
return -1;
}
if((applicationBtxCeptTriggerTag(dataInPointer,"</cept>\0") == 0))
{
if(tagHistory == 5)
{
tagHistory = 6;
parserActive = 0;
}
else
return -1;
}
/* Head parser mode */
if((parserMode == HEAD_PARSER_MODE)&&(parserActive == 1))
{
if((applicationBtxCeptTriggerTag(dataInPointer,"<meta\0") == 0))
{
if(page->metaTagCount<BTX_CEPT_META_TAG_MAXCOUNT)
{
if(applicationBtxParseMetaTag(dataInPointer,page->metaName[page->metaTagCount],page->metaContent[page->metaTagCount]) == -1)
return -1;
page->metaTagCount++;
}
else
return -1;
}
dataInPointer++;
}
/* Hypertect parser mode */
else if((parserMode == HYPERTEXT_PARSER_MODE)&&(parserActive == 1))
{
if(page->ceptPageLength < BTX_CEPT_BINARY_BUFFERSIZE)
{
applicationBtxCeptTranslateTag(dataInPointer,&binaryCode,&tagSize); /* Translate hypertext to binary */
dataInPointer += tagSize;
*dataOutPointer = binaryCode;
dataOutPointer++;
page->ceptPageLength++;
}
else
return 0;
}
/* Parser off */
else
dataInPointer++;
}
*dataOutPointer = '\0';
/* Do final check, every flack must be set! */
if((tagHistory == 6)&&(parserActive == 0)&&(parserMode == 0))
return 0;
else
return -1;
}
/* #################################################################################### */

283
pc-software/pageload/cept.h Normal file
View File

@@ -0,0 +1,283 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# cept parser layer #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* FE Full Screen atributes (single byte constants) */
#define CEPT_FBKB 0x50 /* BlacK Background */
#define CEPT_FRDB 0x51 /* ReD Background */
#define CEPT_FGRB 0x52 /* GReen Background */
#define CEPT_FYLB 0x53 /* YeLlow Background */
#define CEPT_FBLB 0x54 /* BLue Background */
#define CEPT_FMGB 0x55 /* MaGenta Background */
#define CEPT_FCNB 0x56 /* CyaN Background */
#define CEPT_FWHB 0x57 /* WHite Background */
#define CEPT_FTRB 0x5E /* TRansparent Background */
/* FE Full Screen atributes (printf-friendly) */
#define F_CEPT_FBKB "\x50" /* BlacK Background */
#define F_CEPT_FRDB "\x51" /* ReD Background */
#define F_CEPT_FGRB "\x52" /* GReen Background */
#define F_CEPT_FYLB "\x53" /* YeLlow Background */
#define F_CEPT_FBLB "\x54" /* BLue Background */
#define F_CEPT_FMGB "\x55" /* MaGenta Background */
#define F_CEPT_FCNB "\x56" /* CyaN Background */
#define F_CEPT_FWHB "\x57" /* WHite Background */
#define F_CEPT_FTRB "\x5E" /* TRansparent Background */
#define CEPT_ECHOPLEX_GUARDTIME 200 /* Echoplex guardtime, time between receiving and echoing */
/* Data structure of a btx-cept-page */
typedef struct
{
/* Contains the cept page in its binary form */
char ceptPage[BTX_CEPT_BINARY_BUFFERSIZE];
/* Contains the length of the cept page */
int ceptPageLength;
/* Contains the meta tag name */
char metaName[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_NAME_BUFFERSIZE];
/* Contains the corospondenting meta content */
char metaContent[BTX_CEPT_META_TAG_MAXCOUNT][BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE];
/* Contains the number of meta tags that are issued to the page */
int metaTagCount;
}btxCeptPageData;
/* Parse the raw data that was received via http to a btx-cept-page */
int applicationBtxCeptParse(char *dataIn, btxCeptPageData *page);
#endif /*CEPT_H*/
/* #################################################################################### */

View File

@@ -0,0 +1,65 @@
/*
####################################################################################
# #
# Bildschirmtricks MikroPAD V2.0.0 #
# mikroPAD configuration #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CONFIG_H
#define CONFIG_H
/* ATTENTION! You must do a "make clean" and then "make" to make the changes take effect! */
/* General configuration */
#define DEBUGPORT 0 /* Debug port configuration (0=Disabled, 1=Enabled) */
#define VERSIONSTRING "V 0.0.1" /* Version string */
#define DISPLAYPAGE_RETRYS 3 /* Configures how often the system retrys to display a page */
#define PAGE_HISTORY_SIZE 23 /* Configures how many entered pageIds the integrated history can store */
/* Ulm configuration */
#define BTX_ULM_INITIAL_PAGE "*index#" /* Set the initial page (Wellcomescreen) */
#define BTX_ULM_HOST "btx.runningserver.com" /* Configure where Ulm is */
#define BTX_ULM_PORT 80 /* Configure on which port of Ulm the http-server is running */
#define BTX_ULM_STYLE 1 /* Configure ulm style: 1=Static, 2=Dynamic (see readme file) */
#define BTX_ULM_PAGE_FILE_SUFFIX "btx" /* File type prefix that will be used for http access */
#define BTX_ULM_PAGE_ID_MAXLENGTH 32 /* The length of the page id (see readme file) */
#define BTX_ULM_HYPERLINK_ID_MAXLENGTH 2 /* The lenght of an hyperlink id (recomanded value is 2) */
#define BTX_ULM_PAGE_BASENAME "page" /* When style 2 is selected, this is the name of the page that generates the contnet */
#define BTX_ULM_PAGE_REQUESTVAR "id" /* When style 2 is selected, this is the name of the variable that contains the request */
#define BTX_ULM_IP_RESOLVE_RETRYS 3 /* Configures how often the system retrys to resolve the ulm ip */
/* Internal messages */
#define BTX_MESSAGE_HTTPERROR "SEITE NICHT VERFUEGBAR" /* Message that is displayed if an http-error anounces */
#define BTX_MESSAGE_CONNECTIONERROR "ZENTRALE NICHT ERREICHBAR" /* Message that is displayed when there is a problem with the ulm connection */
#define BTX_MESSAGE_PARSEERROR "SEITE BESCHAEDIGT" /* Message that is displayed when parse errors anounces */
/* Cept parser configuration: */
#define BTX_CEPT_HYPERTEXT_BUFFERSIZE 10000 /* Maximal size of a hypertext cept-page the PAD can process */
#define BTX_CEPT_BINARY_BUFFERSIZE 10000 /* Maximal size of a binary cept-page the PAD can process */
#define BTX_CEPT_TAG_MAXSIZE 32 /* Maximal size of a single tag */
#define BTX_CEPT_META_TAG_MAXCOUNT 8 /* Maximal number of meta tags that can be stored in one page structure */
#define BTX_CEPT_META_TAG_NAME_BUFFERSIZE 32+1 /* Maximal size of a meta tag name (+1 for \0) */
#define BTX_CEPT_META_TAG_CONTENT_BUFFERSIZE 128+1 /* Maximal size of a meta tag content (+1 for \0) */
#define BTX_CEPT_META_TAG_HYPERLINKLIST_BUFFER 256 /* Hyperlinklist buffer size */
#endif /*CONFIG_H*/
/* #################################################################################### */

View File

@@ -0,0 +1,63 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*fernbl2#">
<meta name="load_timeout" content="5">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Datensch<ss2>Hutzer,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1<sp>St<ss2>Huck<sp>ihres<sp>letzten<sp>T<ss2>Hatigkeitsberichts<!-- apd apr -->
zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,62 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*welcome#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Neue<sp>Mitteilungen<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
Von<sp><sp>Chaos<sp>Team<sp>Hamburg<apd><apr>
An<sp>die<sp>Bundesdatenschutzbeauftragten<apd><apr>
<apd><apr>
<apd><apr>
Liebe<sp>Dateischeisser,<apd><apr>
wir<sp>werden<sp>Sie<sp>mit<sp>diesem<sp>Schreiben<apd><apr>
fernbeleidigen<sp>Wir<sp>bitten<sp>Sie<sp>uns<apd><apr>
1000<sp>St<ss2>Huck<sp>ihres<sp>letzten<apd><apr>
T<ss2>Hatigkeitsberichts<sp>zuzusenden<sp>
<apd><apr>
<apd><apr>
Mit<sp>freundlichen<sp>Gr<ss2>Hussen<apd><apr>
Chaos<sp>Team<sp>Hamburg<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
<apd><apr>
Zur<ss2>Huck<sp>mit<sp>#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

View File

@@ -0,0 +1,68 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Hilfe<sp><sp><sp><sp><sp><sp><sp><sp>*hilfe#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Text -->
<apd><apr>
<dbh>Die<sp>wichtigsten<sp>codes:<nsz><apd><apr>
<sp>#<sp><sp><sp><sp>=<sp>Weiter<sp><sp><sp><sp>*0#<sp><sp>=<sp><ss2>HUbersichtsseite<!-- apd apr -->
<sp>*#<sp><sp><sp>=<sp>Zur<ss2>Huck<sp><sp><sp><sp>*00#<sp>=<sp>Neu<sp>laden<apd><apr>
<apd><apr>
<dbh>Direktaufruf<sp>von<sp>Seiten:<nsz><apd><apr>
<sp>*seitenname#<sp>oder<sp>*seitennummer#<apd><apr>
<sp>z.B.:<sp>*wtf#<apd><apr>
<apd><apr>
<dbh>Aufruf<sp>von<sp>Verkn<ss2>Hupfungen:<nsz><apd><apr>
<sp>Einfach<sp>die<sp>entsprechende<sp>zweistellige<apd><apr>
<sp>Zahl<sp>eingeben<sp>(<ss2>HAhnlich<sp>Videotext)<apd><apr>
<apd><apr>
<dbh>Eingabe:<nsz><apd><apr>
<sp>Taste<sp><ss3>\<sp>korrigiert<sp>Eingabe<apd><apr>
<sp>Nicht<sp>zu<sp>schnell<sp>tippen!<apd><apr>
<sp>Ung<ss2>Hultige<sp>Eingaben<sp>werden<sp>ignoriert.<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@@ -0,0 +1,51 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="load_page" content="*welcome#">
<meta name="load_timeout" content="2">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<apd>
<apd><apr>
<!-- Logo -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp><sp><sp><sp><sp><sp><sp><sp>8######################)0<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>`x|__________}|p<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>h____w######c____}<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp>*___/'`~___t"/o__?<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp>"cx~_j_____j_|r#<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____j_____j___5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>____};///y____5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp><sp><sp><sp><sp>______________5<sp><sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>p000<sp>0`<sp><sp>0<sp>0<sp><sp><sp><sp>`<sp><sp>`<sp><sp><sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>j<sp>=14575mh$7547jkkj!7h"6<sp>j<apd><apr>
<sp><sp><sp><sp><sp><sp><sp>"d#!!!#!#"!!!!!""""!!"""`&<apd><apr>
<sp><sp><sp><sp><sp><sp><sp><sp><sp>######################!<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<apd>
________________________________________<apd><apr>
<sp><sp><sp>BTX-Nummer<sp><sp><sp><sp>:<sp><sp>23422342235<sp><sp>-<sp><sp>1<apd><apr>
<sp><sp><sp>pers.<sp>Kennwort:<sp><sp>usd7000011<apd><apr>
________________________________________<apd><apr>
<apd>
Bitte<sp>warten...
</body>
</cept>

221
pc-software/pageload/main.c Normal file
View File

@@ -0,0 +1,221 @@
/*
####################################################################################
# #
# HeardbreakChip V1.0.0 #
# Main-Program #
# #
# Copyright (C) 2010 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <libcodebananas/ttybanana.h>
#include <libcodebananas/toolbanana.h>
#include <string.h>
#include <getopt.h>
#include <ctype.h>
#include <unistd.h>
#include <libgen.h>
#include "config.h"
#include "cept.h"
char programName[255];
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
/* #################################################################################### */
/* #################################################################################### */
void showUsage(void)
{
printf(" * Usage:\r\n");
printf(" %s -p [PORT] -b [BTX-PAGE] -f\r\n",programName);
printf(" -f = fakeinput\r\n");
printf("\r\n");
}
/* Main program: Perform some testpages */
int main(int argc, char *argv[])
{
int getoptOption;
char *getoptPort = 0;
char *getoptBtxPage = 0;
int getoptVerboseMode = 0;
int getoptFakeInput = 0;
char ceptHypertextBuffer[BTX_CEPT_HYPERTEXT_BUFFERSIZE];
char getchar;
int i;
btxCeptPageData btxCeptPage; /* Contains the page information of the last displayed page */
strcpy(programName,basename(argv[0]));
printf("_______________________________________________________________________________\n\r");
printf("Pageload for miniBTX V.1.0\n\r");
printf("Copyright(c) 2010 Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
/* Parse Options */
while ((getoptOption = getopt (argc, argv, ":h?p:b:vf")) != -1)
switch (getoptOption)
{
case 'h':
showUsage();
return 0;
case '?':
showUsage();
return 0;
case 'p':
getoptPort = optarg;
break;
case 'v':
getoptVerboseMode = 1;
break;
case 'f':
getoptFakeInput = 1;
break;
case 'b':
getoptBtxPage = optarg;
break;
}
/* Check whether there is a serial port specified */
if(getoptPort)
printf(" * Serial port is: %s\r\n", getoptPort);
else
{
printf(" * Error: You must specify a serial port!\r\n");
printf("\r\n");
exit(1);
}
/* Check whether there is a BTX-Page specified */
if(getoptBtxPage)
{
printf(" * Path to selected BTX-Page is: %s\r\n", getoptBtxPage);
/* Check whether the file is readable */
if(testFile(getoptBtxPage) != 0)
{
printf(" * Error: Can not read BTX-Page from file system - aborting!\r\n");
printf("\r\n");
exit(1);
}
}
else
{
printf(" * Error: You must specify a BTX-Page!\r\n");
printf("\r\n");
exit(1);
}
/* Load Hypertext file into buffer */
if(loadFile(ceptHypertextBuffer, sizeof(ceptHypertextBuffer), getoptBtxPage) != -1)
printf(" * Info: BTX-Hypertext loaded successfully...\r\n");
else
{
printf(" * Error: Could not load BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display hypertext page on the screen.. */
if(getoptVerboseMode)
{
printf(" * Info: The following BTX-Hypertext has been loaded:\r\n");
printf("%s\r\n",ceptHypertextBuffer);
}
/* Parse hypertext page */
if(applicationBtxCeptParse(ceptHypertextBuffer, &btxCeptPage) != 1)
printf(" * Info: BTX-Hypertext parsed successfully...\r\n");
else
{
printf(" * Error: Could not parse BTX-Hypertext page - aborting!\r\n");
printf("\r\n");
exit(1);
}
/* In verbose mode display additional information: hexdump, metatags ect.. */
if(getoptVerboseMode)
{
printf(" * Info: The page contains the following meta information (has no effect here)\r\n");
for(i=0; i<btxCeptPage.metaTagCount; i++)
printf(" %s = %s\r\n", btxCeptPage.metaName[i], btxCeptPage.metaContent[i]);
printf(" * Info: The following binary data (%i bytes) will be transmitted to therminal:\r\n", btxCeptPage.ceptPageLength);
hexBinAsciiDump(btxCeptPage.ceptPage, btxCeptPage.ceptPageLength);
}
printf(" * Opening serial port...\n\r");
ttyInitProf(getoptPort,MINIBTX_BAUDRATE,8,NONE); /* Initalize tty */
ttyClearBuffer(getoptPort); /* Clear buffer */
printf(" * Serial port is set to %s at %i Baud\n\r",getoptPort,MINIBTX_BAUDRATE);
printf(" * Transmitting page...\n\r");
ttyWriteLen(getoptPort, btxCeptPage.ceptPage, btxCeptPage.ceptPageLength);
if(getoptFakeInput)
{
printf(" * Input from terminal: ");
while(1)
{
fflush(stdout);
getchar = ttyGetchar(getoptPort);
if(getchar == CEPT_TER)
getchar = '#';
else if(getchar == CEPT_INI)
getchar = '*';
printf("%c",getchar);
ttyPutchar(getoptPort,getchar);
if(getchar == '#')
{
printf("\r\n * Terminator (#) caught, exiting...\n\r");
printf(" * Done!\n\r");
exit(0);
}
}
}
printf(" * Done!\n\r");
printf("\n\r");
return -1;
}
/* #################################################################################### */

Binary file not shown.

View File

@@ -0,0 +1,3 @@
This is a small programm that loads a BTXML Hypertext page and transmits it
to the terminal through the miniBTX interface.

View File

@@ -0,0 +1,75 @@
<!-- This ia an example page that illustrate how a CEPT TCD 6-1
looks when it is formatted in the btxml hypertext language
Propose: How to use the different character sets -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*test2#"> <!-- Define the page that is loaded when '#' is pressed -->
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Testbild<sp><sp><sp><sp><sp><sp>*test#<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<!-- Test-Text -->
BTX<sp>Testbild<sp>nach<sp>CEPT<sp>T/CD<sp>6-1<apd><apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set (just activate, only for a better understanding) -->
<grb><bkf>G0-SET:<whf><trb> <!-- Green foreground with black background and back -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G1-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x63> <!-- Invoke G1 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G2-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x62> <!-- Invoke G2 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<esc><0x28><0x40> <!-- Invoke G0 set -->
<grb><bkf>G3-SET:<whf><trb> <!-- Green foreground with black background and back -->
<esc><0x28><0x64> <!-- Invoke G3 set -->
<sp>!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~<apd><apr>
<apd><apr>
<!-- Input prompt -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
#<sp>um<sp>naechste<sp>Testseite<sp>abzurufen<apd><apr>
Eingabe<sp>==><sp>
</body> <!-- Close page body segment -->
</cept> <!-- Close CEPT page -->

View File

@@ -0,0 +1,61 @@
<!-- This is a system page of the fictional online service 'Bildschirmtrix' -->
<cept> <!-- Open CEPT page -->
<head> <!-- This is the header, it contains meta information for service control -->
<meta name="next_page" content="*0#"> <!-- Define the page that is loaded when '#' is pressed -->
<meta name="hyperlinks" content="06*88#">
</head> <!-- Close the header -->
<body> <!-- Open page body segment -->
<!-- First we care about a White/Blue ambient -->
<cs> <!-- Clear screen -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<esc><0x23><0x20><fblb> <!-- Makes the background blue -->
<esc><0x28><0x40> <!-- Invoke G0 set -->
<!-- Headline -->
<esc><0x22><0x41> <!-- Invoke C1P set -->
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<aph> <!-- Set cursor to home position -->
Bildschirmtrix<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table (to get a real white) -->
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<apd>
<esc><0x23><0x21><fwhb> <!-- Maks a white full row -->
<csi><0x31><0x40> <!-- Invoke 2nd color table (to get deep blue) -->
<trb><blf> <!-- Select Transparent background with blue foreground -->
<csi><0x31><0x40> <!-- Invoke 2nd color table -->
<dbs><apr>Deutsche<sp>Chaospost<apd><apr>
<csi><0x30><0x40> <!-- Invoke 1nd color table -->
<trb><whf> <!-- Select Transparent background with white foreground -->
<nsz> <!-- Select normal size font -->
<apd><apr>
<nsz>02.09.1983<sp><sp>23:23<apd><apr>
<apd><apr>
Guten<sp>Tag<apd><apr>
Frau<apd><apr>
Eris<apd><apr>
Discordia<apd><apr>
<apd><apr>
Mitteilungsempfang<sp><ss2>Hoffnen<sp>mit<sp>06<apd><apr>
<apd>
<apd>
<apd>
<apd>
<apd>
<apd><apr>
Sie<sp>benutzten<sp>Bildschirmtext<sp>zuletzt<apd><apr>
am<sp>31.12.2001<sp>bis<sp>23:59<apd><apr>
<apd><apr>
<apd><apr>
Weiter<sp>mit<sp>#<sp>oder<sp><sp><sp>*Seitennummer#<apd><apr>
Eingabe<sp>==><sp>
</body>
</cept>

13
pc-software/test/Makefile Normal file
View File

@@ -0,0 +1,13 @@
all: cept.o main.o
gcc -Werror ./*.o -o miniBTX -lcodebananas
main.o: main.c
gcc -Werror -c main.c
cept.o: cept.c
gcc -Werror -c cept.c
clean:
rm ./*.o
rm ./miniBTX

175
pc-software/test/cept.c Normal file
View File

@@ -0,0 +1,175 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V1.0.0 #
# a (poor) cept protocol implementation #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ttybanana.h> /* TTY-Functions of libCodebananas */
#include <toolbanana.h> /* Tool-Functions of libCodebananas */
#include <unistd.h>
#include <string.h>
#include "cept.h" /* Include own header file */
/* #################################################################################### */
/* #################################################################################### */
/* Query CEPT terminal */
void systemCeptQuery(char *string, int length, char *response, char *port, int linkLayer)
{
int i;
int crc16 = 0;
memset(response, 0x00, sizeof(response));
printf("\n\r\n\rPerforming terminal query:\n\r");
if(length == 0)
printf("* Length of transmission data is null - omitting transmission pass ...\n\r");
else
{
if(linkLayer == CEPT_LINKLAYER)
printf("* Transmitting CEPT data block (linklayer secured) ...\n\r");
else
printf("* Transmitting CEPT data block ...\n\r");
if(linkLayer == CEPT_LINKLAYER)
{
printf("* Sending STX 0x%02x...\n\r", CEPT_STX);
ttyPutchar(port,CEPT_STX); /* Transmit STX-Token, form now on the transmission begins */
}
printf("* Sending Data...\n\r");
hexBinAsciiDump(string,length);
for(i=0;i<length;i++) /* Transmit data and calculate CRC */
{
ttyPutchar(port,string[i]);
crc16 = crcComputationCycle(string[i], 0xA001, crc16);
}
if(linkLayer == CEPT_LINKLAYER)
{
crc16 = crcComputationCycle(CEPT_ETX, 0xA001, crc16); /* Send the STX token - the token goes with in the CRC-calculation */
printf("* Sending ETX 0x%02x...\n\r", CEPT_ETX);
ttyPutchar(port,CEPT_ETX);
printf("* Adding lower CRC16 byte %02hhx...\n\r", (char)crc16);
ttyPutchar(port,(char)crc16); /* Transmit the CRC */
printf("* Adding higher CRC16 byte %02hhx...\n\r", (char)(crc16 >> 8));
ttyPutchar(port,(char)(crc16 >> 8));
}
}
printf("* Receiving response...\n\r");
usleep(CEPT_RESPONSE_TIMOUT); /* Wait some time to be sure that some response data is already in buffer when we start receiving) */
ttyReadNonblocking(port, response, CEPT_RESPONSE_TIMOUT); /* Read the data */
if(response[0] == '\0')
printf(" (no data received)\n\r");
else
hexBinAsciiDump(response,strlen(response));
printf("done!\n\r");
fflush(stdout);
return;
}
/* Filter keyboard input from terminal response (Rip off non printable chars and known protocol patterns) */
void systemCeptFilterKeyboardinput(char *responsedata, char *keyboarddata)
{
printf("\n\r\n\rFilter keyboard-data from Transmission response\n\r");
char *keyboarddataPointer;
char *responsedataPointer;
char *keyboarddataAheadPointer;
printf("* Ripping protocol fragments...\n\r");
keyboarddataPointer = keyboarddata;
responsedataPointer = responsedata;
do
{
/* Rip off the CEPT_DLE, 0x30/0x31 acknoledgement token */
if((*responsedataPointer == CEPT_DLE)&&((*(responsedataPointer+1) == 0x30)||(*(responsedataPointer+1) == 0x31)))
responsedataPointer+=2;
else
{
/* Replace Terminator and Initiator with printable characters */
if(*responsedataPointer == CEPT_INI)
*keyboarddataPointer = '*';
else if(*responsedataPointer == CEPT_TER)
*keyboarddataPointer = '#';
else
*keyboarddataPointer = *responsedataPointer;
/* Note: In a serious Videotex application you should NOT replace terminator and initiator
with thier printable pendants to avoid missunderstandings. */
keyboarddataPointer++;
responsedataPointer++;
}
} while(*responsedataPointer != '\0');
*keyboarddataPointer = '\0';
printf("* Ripping non printable characters...\n\r");
keyboarddataPointer = keyboarddata;
keyboarddataAheadPointer = keyboarddata;
do
{
if((*keyboarddataAheadPointer >= 0x20)&&(*keyboarddataAheadPointer <= 0x7E))
{
*keyboarddataPointer = *keyboarddataAheadPointer;
keyboarddataPointer++;
}
keyboarddataAheadPointer++;
} while(*keyboarddataAheadPointer != '\0');
*keyboarddataPointer = '\0';
printf("* The remaining data is:\n\r");
if(keyboarddata[0] == '\0')
printf(" (the string contained no keyboard data)\n\r");
else
hexBinAsciiDump(keyboarddata,strlen(keyboarddata));
fflush(stdout);
return;
}
/* #################################################################################### */

289
pc-software/test/cept.h Normal file
View File

@@ -0,0 +1,289 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V1.0.0 #
# a (poor) cept protocol implementation #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
#ifndef CEPT_H
#define CEPT_H
/* ==Warning==
This implementation of CEPT T/CD 6-1 is incomplete and for test proposes only.
A complete inplementation would requie much more protocol - so do not wonder
about unexpected effects. Besides you should not use this code in own projects
because this implementation is not really straight forward so you better write
your own implementation */
/* ==Control codes==
The the CEPT protocol includes a wide range of special control codes, here is a
hopefully complete list of all available control codes. A detailed explaination
of nearly all control codes can be found in ETS_300_072 (downloadable from etsi.org) */
/* C0 Control characters (printf-friendly) */
#define F_CEPT_APB "\x08" /* Active Position Back */
#define F_CEPT_APF "\x09" /* Active Position Forward */
#define F_CEPT_APD "\x0A" /* Active Position Down */
#define F_CEPT_APU "\x0B" /* Active Position Up */
#define F_CEPT_CS "\x0C" /* Clear Screen */
#define F_CEPT_APR "\x0D" /* Active Position Return */
#define F_CEPT_SI "\x0E" /* Shift In */
#define F_CEPT_SO "\x0F" /* Shift Out */
#define F_CEPT_CON "\x11" /* Cursor ON */
#define F_CEPT_RPT "\x12" /* Repeat Character */
#define F_CEPT_COF "\x14" /* Cursor OFf */
#define F_CEPT_CAN "\x18" /* CANcel (fills the rest off the line with spaces) */
#define F_CEPT_SS2 "\x19" /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define F_CEPT_ESC "\x1B" /* ESCape */
#define F_CEPT_SS3 "\x1D" /* Single Shift 3 (G3 set) */
#define F_CEPT_APH "\x1E" /* Active Position Home */
#define F_CEPT_US "\x1F" /* Unit Seperator (also known as APA) */
/* C0 Control characters (single byte constants) */
#define CEPT_APB 0x08 /* Active Position Back */
#define CEPT_APF 0x09 /* Active Position Forward */
#define CEPT_APD 0x0A /* Active Position Down */
#define CEPT_APU 0x0B /* Active Position Up */
#define CEPT_CS 0x0C /* Clear Screen */
#define CEPT_APR 0x0D /* Active Position Return */
#define CEPT_SI 0x0E /* Shift In */
#define CEPT_SO 0x0F /* Shift Out */
#define CEPT_CON 0x11 /* Cursor ON */
#define CEPT_RPT 0x12 /* Repeat Last Character */
#define CEPT_COF 0x14 /* Cursor OFf */
#define CEPT_CAN 0x18 /* CANcel (fills the rest off the line with spaces) */
#define CEPT_SS2 0x19 /* Single Shift 2 (G2 set, Some legents say that this is the magic "YES" character) */
#define CEPT_ESC 0x1B /* ESCape */
#define CEPT_SS3 0x1D /* Single Shift 3 (G3 set) */
#define CEPT_APH 0x1E /* Active Position Home */
#define CEPT_US 0x1F /* Unit Seperator (also known as APA) */
/* C0 Data link control tokens (printf-friendly) */
#define F_CEPT_NUL "\x00" /* NULl */
#define F_CEPT_SOH "\x01" /* Start Of Heading */
#define F_CEPT_STX "\x02" /* Start TeXt */
#define F_CEPT_ETX "\x03" /* End TeXt */
#define F_CEPT_EOT "\x04" /* End Of Transmission */
#define F_CEPT_ENQ "\x05" /* ENQuiry */
#define F_CEPT_ACK "\x06" /* ACKnowledge */
#define F_CEPT_ITB "\x07" /* end InTermediate Block */
#define F_CEPT_DLE "\x10" /* Data Link Escape */
#define F_CEPT_NAK "\x15" /* Negative AcKnowledge */
#define F_CEPT_SYN "\x16" /* SYNcronize */
#define F_CEPT_ETB "\x17" /* End TeXtblock */
/* C0 Data link control tokens (single byte constants) */
#define CEPT_NUL 0x00 /* NULl */
#define CEPT_SOH 0x01 /* Start Of Heading */
#define CEPT_STX 0x02 /* Start TeXt */
#define CEPT_ETX 0x03 /* End TeXt */
#define CEPT_EOT 0x04 /* End Of Transmission */
#define CEPT_ENQ 0x05 /* ENQuiry */
#define CEPT_ACK 0x06 /* ACKnowledge */
#define CEPT_ITB 0x07 /* end InTermediate Block */
#define CEPT_DLE 0x10 /* Data Link Escape */
#define CEPT_NAK 0x15 /* Negative AcKnowledge */
#define CEPT_SYN 0x16 /* SYNcronize */
#define CEPT_ETB 0x17 /* End TeXtblock */
/* NOTE: The Data link control tokens are not mentiond in ETS_300_072 */
/* C0 Propritay-BTX tokens (printf-friendly) */
#define F_CEPT_INI "\x13" /* Initiator (*) */
#define F_CEPT_TER "\x1C" /* Terminator (#) */
#define F_CEPT_DCT "\x1A" /* propritary btx (makes the terminal talking) */
/* C0 Propritay-BTX tokens (single byte constants) */
#define CEPT_INI 0x13 /* Initiator (*) */
#define CEPT_TER 0x1C /* Terminator (#) */
#define CEPT_DCT 0x1A /* propritary btx (makes the terminal talking) */
/* C1S/C1P control functions set (printf-friendly) */
#define F_CEPT_FSH "\x88" /* FlaSH */
#define F_CEPT_STD "\x89" /* STeaDy */
#define F_CEPT_EBX "\x8A" /* End BoX */
#define F_CEPT_SBX "\x8B" /* Start BoX */
#define F_CEPT_NSZ "\x8C" /* Normal-SiZe */
#define F_CEPT_DBH "\x8D" /* DouBle-Height */
#define F_CEPT_DBW "\x8E" /* DouBle-Width */
#define F_CEPT_DBS "\x8F" /* DouBle-Size */
#define F_CEPT_CDY "\x98" /* Conceal DisplaY */
#define F_CEPT_SPL "\x99" /* StoP Lining */
#define F_CEPT_STL "\x9A" /* StarT Lining */
#define F_CEPT_CSI "\x9B" /* Control Sequence Introducer */
/* C1S/C1P control functions set (single byte constants) */
#define CEPT_FSH 0x88 /* FlaSH */
#define CEPT_STD 0x89 /* STeaDy */
#define CEPT_EBX 0x8A /* End BoX */
#define CEPT_SBX 0x8B /* Start BoX */
#define CEPT_NSZ 0x8C /* Normal-SiZe */
#define CEPT_DBH 0x8D /* DouBle-Height */
#define CEPT_DBW 0x8E /* DouBle-Width */
#define CEPT_DBS 0x8F /* DouBle-Size */
#define CEPT_CDY 0x98 /* Conceal DisplaY */
#define CEPT_SPL 0x99 /* StoP Lining */
#define CEPT_STL 0x9A /* StarT Lining */
#define CEPT_CSI 0x9B /* Control Sequence Introducer */
/* C1S control functions set (printf-friendly) */
#define F_CEPT_ABK "\x80" /* Alpha BlacK */
#define F_CEPT_ANR "\x81" /* Alpha Red */
#define F_CEPT_ANG "\x82" /* Alpha Green */
#define F_CEPT_ANY "\x83" /* Alpha Yellow */
#define F_CEPT_ANB "\x84" /* Alpha Blue */
#define F_CEPT_ANM "\x85" /* Alpha Mageta */
#define F_CEPT_ANC "\x86" /* Alpha Cyan */
#define F_CEPT_ANW "\x87" /* Alpha White */
#define F_CEPT_MBK "\x90" /* Mosaic BlacK */
#define F_CEPT_MSR "\x91" /* MoSaic Red */
#define F_CEPT_MSG "\x92" /* MoSaic Green */
#define F_CEPT_MSY "\x93" /* MoSaic Yellow */
#define F_CEPT_MSB "\x94" /* MoSaic Blue */
#define F_CEPT_MSM "\x95" /* MoSaic Magenta */
#define F_CEPT_MSC "\x96" /* MoSaic Cyan */
#define F_CEPT_MSW "\x97" /* MoSaic White */
#define F_CEPT_BBD "\x9c" /* Black BackgrounD */
#define F_CEPT_NBD "\x9d" /* New BackgrounD */
#define F_CEPT_HMS "\x9e" /* Hold MoSaic */
#define F_CEPT_RMS "\x9f" /* Release MoSaic */
/* C1S control functions set (single byte constants) */
#define CEPT_ABK 0x80 /* Alpha BlacK */
#define CEPT_ANR 0x81 /* Alpha Red */
#define CEPT_ANG 0x82 /* Alpha Green */
#define CEPT_ANY 0x83 /* Alpha Yellow */
#define CEPT_ANB 0x84 /* Alpha Blue */
#define CEPT_ANM 0x85 /* Alpha Mageta */
#define CEPT_ANC 0x86 /* Alpha Cyan */
#define CEPT_ANW 0x87 /* Alpha White */
#define CEPT_MBK 0x90 /* Mosaic BlacK */
#define CEPT_MSR 0x91 /* MoSaic Red */
#define CEPT_MSG 0x92 /* MoSaic Green */
#define CEPT_MSY 0x93 /* MoSaic Yellow */
#define CEPT_MSB 0x94 /* MoSaic Blue */
#define CEPT_MSM 0x95 /* MoSaic Magenta */
#define CEPT_MSC 0x96 /* MoSaic Cyan */
#define CEPT_MSW 0x97 /* MoSaic White */
#define CEPT_BBD 0x9c /* Black BackgrounD */
#define CEPT_NBD 0x9d /* New BackgrounD */
#define CEPT_HMS 0x9e /* Hold MoSaic */
#define CEPT_RMS 0x9f /* Release MoSaic */
/* C1P control functions set (printf-friendly) */
#define F_CEPT_BKF "\x80" /* BlacK Foreground */
#define F_CEPT_RDF "\x81" /* ReD Foreground */
#define F_CEPT_GRF "\x82" /* GReen Foreground */
#define F_CEPT_YLF "\x83" /* YeLlow Foreground */
#define F_CEPT_BLF "\x84" /* BLue Foreground */
#define F_CEPT_MGF "\x85" /* MaGenta Foreground */
#define F_CEPT_CNF "\x86" /* CyaN Foreground */
#define F_CEPT_WHF "\x87" /* WHite Foreground */
#define F_CEPT_BKB "\x90" /* BlacK Background */
#define F_CEPT_RDB "\x91" /* ReD Background */
#define F_CEPT_GRB "\x92" /* GReen Background */
#define F_CEPT_YLB "\x93" /* YeLlow Background */
#define F_CEPT_BLB "\x94" /* BLue Background */
#define F_CEPT_MGB "\x95" /* MaGenta Background */
#define F_CEPT_CNB "\x96" /* CyaN Background */
#define F_CEPT_WHB "\x97" /* WHite Background */
#define F_CEPT_NPO "\x9c" /* Normal POlarity */
#define F_CEPT_IPO "\x9d" /* Inverted POlarity */
#define F_CEPT_TRB "\x9e" /* TranspaRent Background */
#define F_CEPT_STC "\x9f" /* STop Conceal */
/* C1P control functions set (single byte constants) */
#define CEPT_BKF 0x80 /* BlacK Foreground */
#define CEPT_RDF 0x81 /* ReD Foreground */
#define CEPT_GRF 0x82 /* GReen Foreground */
#define CEPT_YLF 0x83 /* YeLlow Foreground */
#define CEPT_BLF 0x84 /* BLue Foreground */
#define CEPT_MGF 0x85 /* MaGenta Foreground */
#define CEPT_CNF 0x86 /* CyaN Foreground */
#define CEPT_WHF 0x87 /* WHite Foreground */
#define CEPT_BKB 0x90 /* BlacK Background */
#define CEPT_RDB 0x91 /* ReD Background */
#define CEPT_GRB 0x92 /* GReen Background */
#define CEPT_YLB 0x93 /* YeLlow Background */
#define CEPT_BLB 0x94 /* BLue Background */
#define CEPT_MGB 0x95 /* MaGenta Background */
#define CEPT_CNB 0x96 /* CyaN Background */
#define CEPT_WHB 0x97 /* WHite Background */
#define CEPT_NPO 0x9c /* Normal POlarity */
#define CEPT_IPO 0x9d /* Inverted POlarity */
#define CEPT_TRB 0x9e /* TranspaRent Background */
#define CEPT_STC 0x9f /* STop Conceal */
/* Combined sequences to make the programmers cept-life easyer */
#define CEPTSEQ_C1P F_CEPT_ESC "\x22\x41" /* Invoke C1P Set */
#define CEPTSEQ_C1S F_CEPT_ESC "\x22\x40" /* Invoke C1S Set */
#define CEPTSEQ_CRLF F_CEPT_APD F_CEPT_APR /* Do a carrige-return/line-feed */
#define CEPTSEQ_G0 F_CEPT_ESC "\x28\x40" /* Invoke G0 Set */
#define CEPTSEQ_G1 F_CEPT_ESC "\x28\x63" /* Invoke G1 Set */
#define CEPTSEQ_G2 F_CEPT_ESC "\x28\x62" /* Invoke G2 Set */
#define CEPTSEQ_G3 F_CEPT_ESC "\x28\x64" /* Invoke G3 Set */
/* Linklayer configuration types */
#define CEPT_LINKLAYER 1 /* Use CRC secured connection 0=OFF, 1=ON */
#define CEPT_NOLINKLAYER 0 /* Use no linklayler (recommanded) */
/* Hardcoded Linklayer configuration */
#define CEPT_RESPONSE_TIMOUT 200000 /* Response timout for terminal response */
/* NOTE: The linklayer implementation does not secure the data automaticly. You get
the raw terminal data back and then you can transmit the data again. Automatic
retransmission is not supported. In this case linkleayer means that start/stop
tokens and CRC16 ars automaticly added to the datastream.
/* ==Control functions==
This function set shall provide a hassle free interface to a CEPT terminal. You can send
strings without worring about CRC for example... */
/* Query CEPT terminal */
void systemCeptQuery(char *string, int length, char *response, char *port, int linkLayer);
/* Filter keyboard input from terminal response (Rip off non printable chars and known protocol patterns) */
void systemCeptFilterKeyboardinput(char *responsedata, char *keyboarddata);
#endif /*CEPT_H*/
/* #################################################################################### */

231
pc-software/test/main.c Normal file
View File

@@ -0,0 +1,231 @@
/*
####################################################################################
# #
# Bildschirmtricks miniBTX V2.0.0 #
# Main-Program #
# #
# Copyright (C) 2008 Philipp Fabian Benedikt Maier (aka. Dexter) #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
# #
#################################################################################### */
/* ## HEADER ########################################################################## */
/* Header */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <ttybanana.h>
#include <toolbanana.h>
#include <string.h>
#include "cept.h" /* Include CEPT protocol layer */
/* Transmission parameters */
#define MINIBTX_HOOKOFF 0x01 /* Hookoff-token (Do not change) */
#define MINIBTX_CONNECT 0x00 /* Connect-token (Do not change) */
#define MINIBTX_LINKLAYER CEPT_NOLINKLAYER /* Configrue linklayer */
#define MINIBTX_BAUDRATE 1200 /* Baudrate, can not be changed */
#define MINIBTX_PORT "/dev/ttyUSB1" /* Serial port - change if needed */
/* Special parameters */
#define MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA 0 /* Force the terminal to transmit the keyboard data by sending DCT (1=ON,0=OFF) */
/* Note: The software has been tested with the following terminals:
* BtxTV (MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA should be set to 1)
* Multitel11/Bitel */
/* #################################################################################### */
/* #################################################################################### */
/* Main program: Perform some testpages */
int main(void)
{
char transmissionBuffer[255]; /* Here we store the data that is sent to the terminal */
char trsnsmissionResponseBuffer[255]; /* Here we store the date that comes from the terminal */
char keyboardInput[255]; /* The users keyboard input */
printf("_____________________________________________________________________________________________\n\r");
printf("MiniBTX Copyright(c) Philipp Fabian Benedikt Maier\n\r");
printf("\n\r");
printf("Note: This is a small example application to explore some features of CEPT/BTX Terminals. \n\r");
printf(" Please notify that this tools requies the miniBTX hardware. \n\r");
printf("\n\r");
printf("Initalizing...\n\r");
printf("* Opening serial port...\n\r");
ttyInitProf(MINIBTX_PORT,MINIBTX_BAUDRATE,8,NONE); /* Initalize tty */
ttyClearBuffer(MINIBTX_PORT); /* Clear buffer */
printf("* Serial port is set to %s at %i Baud - edit the sourcecode to alter this setting.\n\r",MINIBTX_PORT,MINIBTX_BAUDRATE);
printf("\n\r");
printf("Waiting for BTX-Terminal...\n\r");
if(ttyGetchar(MINIBTX_PORT) == MINIBTX_HOOKOFF) /* Wait for hook-off token */
printf("* Hook off\n\r");
else
printf("* Warning: Incorrect hook off token (should be %02hhx)\n\r",MINIBTX_HOOKOFF);
if(ttyGetchar(MINIBTX_PORT) == MINIBTX_CONNECT) /* Wait for connection-ok token */
printf("* Connection ok\n\r");
else
printf("* Warning: Incorrect connection start token (should be %02hhx)\n\r",MINIBTX_CONNECT);
printf("\n\r");
printf("\n\r");
printf("__________________________________\n\r");
printf("Transmitting testpage...\n\r"); /* Transmit testpage */
while(1)
{
/* ==TRANSMISSION TEST== */
/* Note: for a better understanding of the concept of CEPT control codes the most control
codes are sent seperately. This causes a leak of performance because every single
block that is transmitted causes an startup code which must be sent back through
the slow 75-baud line. If you pack the controlcodes within the textblocks you can
get a much faster page transmission */
sprintf(transmissionBuffer, F_CEPT_CS CEPTSEQ_G0); /* Clear screen and switch to G0 set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, F_CEPT_ANW CEPTSEQ_C1P F_CEPT_DBS F_CEPT_BLB F_CEPT_APR "*BILDSCHIRMTRIX# ");
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* The headline is double hight and covers the next line, so we must add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_C1P F_CEPT_NSZ "miniBTX Testbild nach CEPT T/CD 6-1 ");
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G1); /* Switch to G1 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G2); /* Switch to G2 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G3); /* Switch to G2 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, "!\"#$%%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF CEPTSEQ_CRLF); /* Add some blank lines blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, CEPTSEQ_G0); /* Switch to G0 character set */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
sprintf(transmissionBuffer, F_CEPT_DBH "Testbild neu aufbauen mit # (Terminator)" CEPTSEQ_CRLF); /* Add a blank line */
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
/* ==RECEIVE TEST== */
printf("__________________________________\n\r");
printf("Retrieve keyboard input...\n\r"); /* Receive keyboard data */
/* Note: BTX Terminals are a bit more complex than normal dump terminals - they store the keyboard
input in a buffer. The content of this buffer is transmitted when a DCT-Token is sent
to the terminal. Otherwise the terminal will only transmit the ACK tokens. */
/* Note: Many BTX-Terminal (for example the BtxTV) are equipped with an auto-login function
so the first thing you might see is a long forgotton login password. */
for(;;)
{
/* Note: A terminal can transmit more than one character at a time if you
give the terminal some time it is able to gather some chars */
if(MINIBTX_FORCE_TERMINAL_KEYBOARD_DATA == 1)
{
/* Here we force the terminal to transmit the keyboard buffer data
by sending a DCT token. Warning! This is a cludge! */
sprintf(transmissionBuffer, F_CEPT_DCT);
systemCeptQuery(transmissionBuffer,strlen(transmissionBuffer),trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
}
else
{
/* Here we got a friendly terminal that talks wihout kicking it */
systemCeptQuery(0,0,trsnsmissionResponseBuffer,MINIBTX_PORT,MINIBTX_LINKLAYER);
}
/* Now we filter out printable characters */
systemCeptFilterKeyboardinput(trsnsmissionResponseBuffer, keyboardInput);
/* Show keyboard data if some data received */
if(keyboardInput[0] != '\0')
printf("\n\r Keyboard input ==>%s<==", keyboardInput);
/* When terminator is pressed - redraw screen */
if(keyboardInput[0] == '#') /* Quick and dirty Terminator detection */
break;
fflush(stdout);
}
}
return 0;
}
/* #################################################################################### */

BIN
pc-software/test/miniBTX Normal file

Binary file not shown.