Added ANSI parsers and rendering ANSI frames
This commit is contained in:
@@ -46,6 +46,7 @@ class Login extends Action
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->so->log('info','User Login: '.$this->uo->name);
|
||||
$this->page = ['frame'=>1,'index'=>'a']; // @todo Get from DB.
|
||||
|
||||
$this->action = 2; // ACTION_GOTO
|
||||
|
@@ -5,6 +5,7 @@ namespace App\Classes\Frame;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Classes\Frame as AbstractFrame;
|
||||
use App\Classes\Parser\Ansi as AnsiParser;
|
||||
|
||||
class Ansi extends AbstractFrame
|
||||
{
|
||||
@@ -18,9 +19,21 @@ class Ansi extends AbstractFrame
|
||||
|
||||
public static $if_filler = '.';
|
||||
|
||||
public function fields($startline=0)
|
||||
public function __construct(\App\Models\Frame $o,string $msg='')
|
||||
{
|
||||
$this->output .= str_replace(LF,CR.LF,$this->frame->content);
|
||||
parent::__construct($o);
|
||||
|
||||
// If we have a message to display on the bottom line.
|
||||
if ($msg)
|
||||
$this->output .= ESC.'[24;0f'.$msg.HOME;
|
||||
}
|
||||
|
||||
public function fields($startline=1)
|
||||
{
|
||||
$o = new AnsiParser($this->frame->content,$startline);
|
||||
$this->output .= (string)$o;
|
||||
|
||||
$this->fields = $o->fields;
|
||||
}
|
||||
|
||||
public function strlenv($text):int {
|
||||
|
@@ -19,26 +19,32 @@ class Videotex extends AbstractFrame
|
||||
|
||||
public static $if_filler = '.';
|
||||
|
||||
public function fields($startline=0)
|
||||
public function __construct(\App\Models\Frame $o,string $msg='')
|
||||
{
|
||||
parent::__construct($o);
|
||||
|
||||
// If we have a message to display on the bottom line.
|
||||
if ($msg)
|
||||
$this->output .= HOME.UP.$msg.HOME;
|
||||
}
|
||||
|
||||
public function fields($startline=1)
|
||||
{
|
||||
$infield = FALSE; // In a field
|
||||
$fieldtype = NULL; // Type of field
|
||||
$fieldlength = 0; // Length of field
|
||||
|
||||
if ($startline)
|
||||
$this->output .= str_repeat(DOWN,$startline);
|
||||
|
||||
// $fieldadrline = 1;
|
||||
|
||||
// Scan the frame for a field start
|
||||
for ($y=$startline;$y<=static::$frame_length;$y++)
|
||||
for ($y=$startline-1;$y<=static::$frame_length;$y++)
|
||||
{
|
||||
// Fields can only be on a single line
|
||||
$fieldx = $fieldy = FALSE;
|
||||
|
||||
for ($x=0;$x<static::$frame_width;$x++)
|
||||
{
|
||||
$posn = $y*40+$x;
|
||||
$posn = $y*static::$frame_width+$x;
|
||||
|
||||
// If the frame is not big enough, fill it with spaces.
|
||||
$byte = ord(isset($this->frame->content{$posn}) ? $this->frame->content{$posn} : ' ')%128;
|
||||
@@ -62,7 +68,6 @@ class Videotex extends AbstractFrame
|
||||
}
|
||||
|
||||
// Is this a magic field?
|
||||
// @todo For page redisplay *00, we should show entered contents - for refresh *09 we should show updated contents
|
||||
if (array_get($this->fieldmap,chr($fieldtype)) ) {
|
||||
$field = $this->fieldmap[chr($fieldtype)];
|
||||
//dump(['infield','byte'=>$byte,'fieldtype'=>$fieldtype,'field'=>$field,'strpos'=>strpos($field,'#')]);
|
||||
|
Reference in New Issue
Block a user