mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-06 11:30:44 +01:00
AROS, OS4, MorphOS: Console, ConUnit added, Crt first Version
git-svn-id: trunk@43815 -
This commit is contained in:
parent
643c1ea7e0
commit
9b67c65749
8
.gitattributes
vendored
8
.gitattributes
vendored
@ -1186,6 +1186,8 @@ packages/arosunits/src/amigados.pas svneol=native#text/plain
|
||||
packages/arosunits/src/asl.pas svneol=native#text/plain
|
||||
packages/arosunits/src/clipboard.pas svneol=native#text/plain
|
||||
packages/arosunits/src/commodities.pas svneol=native#text/pascal
|
||||
packages/arosunits/src/console.pas svneol=native#text/plain
|
||||
packages/arosunits/src/conunit.pas svneol=native#text/plain
|
||||
packages/arosunits/src/cybergraphics.pas svneol=native#text/plain
|
||||
packages/arosunits/src/datatypes.pas svneol=native#text/pascal
|
||||
packages/arosunits/src/diskfont.pas svneol=native#text/plain
|
||||
@ -7439,6 +7441,8 @@ packages/morphunits/src/asl.pas svneol=native#text/plain
|
||||
packages/morphunits/src/cgxvideo.pas svneol=native#text/plain
|
||||
packages/morphunits/src/clipboard.pas svneol=native#text/plain
|
||||
packages/morphunits/src/commodities.pas svneol=native#text/pascal
|
||||
packages/morphunits/src/console.pas svneol=native#text/plain
|
||||
packages/morphunits/src/conunit.pas svneol=native#text/plain
|
||||
packages/morphunits/src/cybergraphics.pas svneol=native#text/plain
|
||||
packages/morphunits/src/datatypes.pas svneol=native#text/plain
|
||||
packages/morphunits/src/diskfont.pas svneol=native#text/plain
|
||||
@ -7931,6 +7935,8 @@ packages/os4units/src/agraphics.pas svneol=native#text/pascal
|
||||
packages/os4units/src/amigados.pas svneol=native#text/pascal
|
||||
packages/os4units/src/asl.pas svneol=native#text/pascal
|
||||
packages/os4units/src/clipboard.pas svneol=native#text/pascal
|
||||
packages/os4units/src/console.pas svneol=native#text/plain
|
||||
packages/os4units/src/conunit.pas svneol=native#text/plain
|
||||
packages/os4units/src/cybergraphics.pas svneol=native#text/pascal
|
||||
packages/os4units/src/datatypes.pas svneol=native#text/pascal
|
||||
packages/os4units/src/diskfont.pas svneol=native#text/pascal
|
||||
@ -8550,11 +8556,11 @@ packages/rtl-console/Makefile svneol=native#text/plain
|
||||
packages/rtl-console/Makefile.fpc svneol=native#text/plain
|
||||
packages/rtl-console/Makefile.fpc.fpcmake svneol=native#text/plain
|
||||
packages/rtl-console/fpmake.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/amicommon/crt.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/amicommon/keyboard.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/amicommon/mouse.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/amicommon/video.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/amicommon/videodata.inc svneol=native#text/plain
|
||||
packages/rtl-console/src/amiga/crt.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/emx/crt.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/go32v2/crt.pp svneol=native#text/plain
|
||||
packages/rtl-console/src/go32v2/keyboard.pp svneol=native#text/plain
|
||||
|
||||
@ -57,6 +57,8 @@ begin
|
||||
T:=P.Targets.AddUnit('commodities.pas');
|
||||
T:=P.Targets.AddUnit('datatypes.pas');
|
||||
T:=P.Targets.AddUnit('serial.pas');
|
||||
T:=P.Targets.AddUnit('console.pas');
|
||||
T:=P.Targets.AddUnit('conunit.pas');
|
||||
|
||||
{$ifndef ALLPACKAGES}
|
||||
Run;
|
||||
|
||||
124
packages/arosunits/src/console.pas
Normal file
124
packages/arosunits/src/console.pas
Normal file
@ -0,0 +1,124 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
|
||||
A file in Amiga system run time library.
|
||||
Copyright (c) 1998-2003 by Nils Sjoholm
|
||||
member of the Amiga RTL development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{
|
||||
To call the two routines defined below, you'll need to set
|
||||
ConsoleBase to an appropriate value.
|
||||
|
||||
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
|
||||
}
|
||||
|
||||
unit console;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
exec, inputevent, keymap, utility, amigados;
|
||||
|
||||
const
|
||||
|
||||
{***** Console commands *****}
|
||||
CD_ASKKEYMAP = CMD_NONSTD + 0;
|
||||
CD_SETKEYMAP = CMD_NONSTD + 1;
|
||||
CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2;
|
||||
CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
|
||||
|
||||
{***** SGR parameters *****}
|
||||
|
||||
SGR_PRIMARY = 0;
|
||||
SGR_BOLD = 1;
|
||||
SGR_ITALIC = 3;
|
||||
SGR_UNDERSCORE = 4;
|
||||
SGR_NEGATIVE = 7;
|
||||
|
||||
SGR_NORMAL = 22; // default foreground color, not bold
|
||||
SGR_NOTITALIC = 23;
|
||||
SGR_NOTUNDERSCORE = 24;
|
||||
SGR_POSITIVE = 27;
|
||||
|
||||
{ these names refer to the ANSI standard, not the implementation }
|
||||
|
||||
SGR_BLACK = 30;
|
||||
SGR_RED = 31;
|
||||
SGR_GREEN = 32;
|
||||
SGR_YELLOW = 33;
|
||||
SGR_BLUE = 34;
|
||||
SGR_MAGENTA = 35;
|
||||
SGR_CYAN = 36;
|
||||
SGR_WHITE = 37;
|
||||
SGR_DEFAULT = 39;
|
||||
|
||||
SGR_BLACKBG = 40;
|
||||
SGR_REDBG = 41;
|
||||
SGR_GREENBG = 42;
|
||||
SGR_YELLOWBG = 43;
|
||||
SGR_BLUEBG = 44;
|
||||
SGR_MAGENTABG = 45;
|
||||
SGR_CYANBG = 46;
|
||||
SGR_WHITEBG = 47;
|
||||
SGR_DEFAULTBG = 49;
|
||||
|
||||
{ these names refer to the implementation, they are the preferred }
|
||||
{ names for use with the Amiga console device. }
|
||||
|
||||
SGR_CLR0 = 30;
|
||||
SGR_CLR1 = 31;
|
||||
SGR_CLR2 = 32;
|
||||
SGR_CLR3 = 33;
|
||||
SGR_CLR4 = 34;
|
||||
SGR_CLR5 = 35;
|
||||
SGR_CLR6 = 36;
|
||||
SGR_CLR7 = 37;
|
||||
|
||||
SGR_CLR0BG = 40;
|
||||
SGR_CLR1BG = 41;
|
||||
SGR_CLR2BG = 42;
|
||||
SGR_CLR3BG = 43;
|
||||
SGR_CLR4BG = 44;
|
||||
SGR_CLR5BG = 45;
|
||||
SGR_CLR6BG = 46;
|
||||
SGR_CLR7BG = 47;
|
||||
|
||||
{***** DSR parameters *****}
|
||||
DSR_CPR = 6;
|
||||
|
||||
{***** CTC parameters *****}
|
||||
CTC_HSETTAB = 0;
|
||||
CTC_HCLRTAB = 2;
|
||||
CTC_HCLRTABSALL = 5;
|
||||
|
||||
{***** TBC parameters *****}
|
||||
TBC_HCLRTAB = 0;
|
||||
TBC_HCLRTABSALL = 3;
|
||||
|
||||
{***** SM and RM parameters *****}
|
||||
M_LNM = 20; // linefeed newline mode
|
||||
M_ASM = '>1'; // auto scroll mode
|
||||
M_AWM = '?7'; // auto wrap mode
|
||||
|
||||
var
|
||||
ConsoleDevice: PDevice = nil;
|
||||
|
||||
function CDInputHandler(Events: PInputEvent; CDIhData: APTR): PInputEvent; syscall ConsoleDevice 7;
|
||||
function RawKeyConvert(Events: PInputEvent; Buffer: PChar; Length: LongInt; KeyMap: PKeyMap): LongInt; syscall ConsoleDevice 8;
|
||||
function GetConSnip(): APTR; syscall ConsoleDevice 84;
|
||||
function SetConSnip(Param: APTR): LongInt; syscall ConsoleDevice 88;
|
||||
procedure AddConSnipHook(Hook: PHook); syscall ConsoleDevice 92;
|
||||
procedure RemConSnipHook(Hook: PHook); syscall ConsoleDevice 96;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
94
packages/arosunits/src/conunit.pas
Normal file
94
packages/arosunits/src/conunit.pas
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
|
||||
A file in Amiga system run time library.
|
||||
Copyright (c) 1998 by Nils Sjoholm
|
||||
member of the Amiga RTL development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit conunit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
exec, console, keymap, inputevent, intuition, agraphics;
|
||||
|
||||
const
|
||||
{ ---- console unit numbers for OpenDevice() }
|
||||
CONU_LIBRARY = -1; // no unit, just fill in IO_DEVICE field
|
||||
CONU_STANDARD = 0; // standard unmapped console
|
||||
|
||||
{ ---- New unit numbers for OpenDevice() - (V36) }
|
||||
CONU_CHARMAP = 1; // bind character map to console
|
||||
CONU_SNIPMAP = 3; // bind character map w/ snip to console
|
||||
|
||||
{ ---- New flag defines for OpenDevice() - (V37) }
|
||||
CONFLAG_DEFAULT = 0;
|
||||
CONFLAG_NODRAW_ON_NEWSIZE = 1;
|
||||
|
||||
PMB_ASM = M_LNM + 1; // internal storage bit for AS flag
|
||||
PMB_AWM = PMB_ASM + 1; // internal storage bit for AW flag
|
||||
MAXTABS = 80;
|
||||
|
||||
|
||||
type
|
||||
{$PACKRECORDS 2}
|
||||
PConUnit = ^TConUnit;
|
||||
TConUnit = record
|
||||
cu_MP: TMsgPort;
|
||||
{ ---- read only variables }
|
||||
cu_Window: PWindow; // Intuition window bound to this unit
|
||||
cu_XCP: SmallInt; // character position
|
||||
cu_YCP: SmallInt;
|
||||
cu_XMax: SmallInt; // max character position
|
||||
cu_YMax: SmallInt;
|
||||
cu_XRSize: SmallInt; // character raster size
|
||||
cu_YRSize: SmallInt;
|
||||
cu_XROrigin: SmallInt; // raster origin
|
||||
cu_YROrigin: SmallInt;
|
||||
cu_XRExtant: SmallInt; // raster maxima
|
||||
cu_YRExtant: SmallInt;
|
||||
cu_XMinShrink: SmallInt; // smallest area intact from resize process
|
||||
cu_YMinShrink: SmallInt;
|
||||
cu_XCCP: SmallInt; // cursor position
|
||||
cu_YCCP: SmallInt;
|
||||
|
||||
{ ---- read/write variables (writes must must be protected) }
|
||||
{ ---- storage for AskKeyMap and SetKeyMap }
|
||||
cu_KeyMapStruct: TKeyMap;
|
||||
{ ---- tab stops }
|
||||
cu_TabStops: array[0..MAXTABS - 1] of Word; // 0 at start, 0xFFFF at end of list
|
||||
|
||||
// ---- console rastport attributes
|
||||
cu_Mask: ShortInt;
|
||||
cu_FgPen: ShortInt;
|
||||
cu_BgPen: ShortInt;
|
||||
cu_AOLPen: ShortInt;
|
||||
cu_DrawMode: ShortInt;
|
||||
cu_Obsolete1: ShortInt; // was cu_AreaPtSz -- not used in V36
|
||||
cu_Obsolete2: APTR; // was cu_AreaPtrn -- not used in V36
|
||||
cu_Minterms: array[0..7] of Byte; // console minterms
|
||||
cu_Font: PTextFont;
|
||||
cu_AlgoStyle: Byte;
|
||||
cu_TxFlags: Byte;
|
||||
cu_TxHeight: Word;
|
||||
cu_TxWidth: Word;
|
||||
cu_TxBaseline: Word;
|
||||
cu_TxSpacing: Word;
|
||||
|
||||
{ ---- console MODES and RAW EVENTS switches }
|
||||
cu_Modes: array[0..(PMB_AWM + 7) div 8 - 1] of Byte; // one bit per mode
|
||||
cu_RawEvents: array[0..(IECLASS_MAX + 7) div 8 - 1] of Byte;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -62,6 +62,8 @@ begin
|
||||
T:=P.Targets.AddUnit('locale.pas');
|
||||
T:=P.Targets.AddUnit('commodities.pas');
|
||||
T:=P.Targets.AddUnit('serial.pas');
|
||||
T:=P.Targets.AddUnit('console.pas');
|
||||
T:=P.Targets.AddUnit('conunit.pas');
|
||||
|
||||
{$ifndef ALLPACKAGES}
|
||||
Run;
|
||||
|
||||
120
packages/morphunits/src/console.pas
Normal file
120
packages/morphunits/src/console.pas
Normal file
@ -0,0 +1,120 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
|
||||
A file in Amiga system run time library.
|
||||
Copyright (c) 1998-2003 by Nils Sjoholm
|
||||
member of the Amiga RTL development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{
|
||||
To call the two routines defined below, you'll need to set
|
||||
ConsoleBase to an appropriate value.
|
||||
|
||||
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
|
||||
}
|
||||
|
||||
unit console;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
exec, inputevent, keymap;
|
||||
|
||||
const
|
||||
|
||||
{***** Console commands *****}
|
||||
CD_ASKKEYMAP = CMD_NONSTD + 0;
|
||||
CD_SETKEYMAP = CMD_NONSTD + 1;
|
||||
CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2;
|
||||
CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
|
||||
|
||||
{***** SGR parameters *****}
|
||||
|
||||
SGR_PRIMARY = 0;
|
||||
SGR_BOLD = 1;
|
||||
SGR_ITALIC = 3;
|
||||
SGR_UNDERSCORE = 4;
|
||||
SGR_NEGATIVE = 7;
|
||||
|
||||
SGR_NORMAL = 22; // default foreground color, not bold
|
||||
SGR_NOTITALIC = 23;
|
||||
SGR_NOTUNDERSCORE = 24;
|
||||
SGR_POSITIVE = 27;
|
||||
|
||||
{ these names refer to the ANSI standard, not the implementation }
|
||||
|
||||
SGR_BLACK = 30;
|
||||
SGR_RED = 31;
|
||||
SGR_GREEN = 32;
|
||||
SGR_YELLOW = 33;
|
||||
SGR_BLUE = 34;
|
||||
SGR_MAGENTA = 35;
|
||||
SGR_CYAN = 36;
|
||||
SGR_WHITE = 37;
|
||||
SGR_DEFAULT = 39;
|
||||
|
||||
SGR_BLACKBG = 40;
|
||||
SGR_REDBG = 41;
|
||||
SGR_GREENBG = 42;
|
||||
SGR_YELLOWBG = 43;
|
||||
SGR_BLUEBG = 44;
|
||||
SGR_MAGENTABG = 45;
|
||||
SGR_CYANBG = 46;
|
||||
SGR_WHITEBG = 47;
|
||||
SGR_DEFAULTBG = 49;
|
||||
|
||||
{ these names refer to the implementation, they are the preferred }
|
||||
{ names for use with the Amiga console device. }
|
||||
|
||||
SGR_CLR0 = 30;
|
||||
SGR_CLR1 = 31;
|
||||
SGR_CLR2 = 32;
|
||||
SGR_CLR3 = 33;
|
||||
SGR_CLR4 = 34;
|
||||
SGR_CLR5 = 35;
|
||||
SGR_CLR6 = 36;
|
||||
SGR_CLR7 = 37;
|
||||
|
||||
SGR_CLR0BG = 40;
|
||||
SGR_CLR1BG = 41;
|
||||
SGR_CLR2BG = 42;
|
||||
SGR_CLR3BG = 43;
|
||||
SGR_CLR4BG = 44;
|
||||
SGR_CLR5BG = 45;
|
||||
SGR_CLR6BG = 46;
|
||||
SGR_CLR7BG = 47;
|
||||
|
||||
{***** DSR parameters *****}
|
||||
DSR_CPR = 6;
|
||||
|
||||
{***** CTC parameters *****}
|
||||
CTC_HSETTAB = 0;
|
||||
CTC_HCLRTAB = 2;
|
||||
CTC_HCLRTABSALL = 5;
|
||||
|
||||
{***** TBC parameters *****}
|
||||
TBC_HCLRTAB = 0;
|
||||
TBC_HCLRTABSALL = 3;
|
||||
|
||||
{***** SM and RM parameters *****}
|
||||
M_LNM = 20; // linefeed newline mode
|
||||
M_ASM = '>1'; // auto scroll mode
|
||||
M_AWM = '?7'; // auto wrap mode
|
||||
|
||||
var
|
||||
ConsoleDevice: PDevice = nil;
|
||||
|
||||
function CDInputHandler(Events: PInputEvent location 'a0'; ConsoleDev: PLibrary location 'a1'): PInputEvent; syscall ConsoleDevice 42;
|
||||
function RawKeyConvert(Events: PInputEvent location 'a0'; Buffer: PChar location 'a1'; Length: LongInt location 'd1'; KeyMap: PKeyMap location 'a2'): LongInt; syscall ConsoleDevice 48;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
94
packages/morphunits/src/conunit.pas
Normal file
94
packages/morphunits/src/conunit.pas
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
|
||||
A file in Amiga system run time library.
|
||||
Copyright (c) 1998 by Nils Sjoholm
|
||||
member of the Amiga RTL development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit conunit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
exec, console, keymap, inputevent, intuition, agraphics;
|
||||
|
||||
const
|
||||
{ ---- console unit numbers for OpenDevice() }
|
||||
CONU_LIBRARY = -1; // no unit, just fill in IO_DEVICE field
|
||||
CONU_STANDARD = 0; // standard unmapped console
|
||||
|
||||
{ ---- New unit numbers for OpenDevice() - (V36) }
|
||||
CONU_CHARMAP = 1; // bind character map to console
|
||||
CONU_SNIPMAP = 3; // bind character map w/ snip to console
|
||||
|
||||
{ ---- New flag defines for OpenDevice() - (V37) }
|
||||
CONFLAG_DEFAULT = 0;
|
||||
CONFLAG_NODRAW_ON_NEWSIZE = 1;
|
||||
|
||||
PMB_ASM = M_LNM + 1; // internal storage bit for AS flag
|
||||
PMB_AWM = PMB_ASM + 1; // internal storage bit for AW flag
|
||||
MAXTABS = 80;
|
||||
|
||||
|
||||
type
|
||||
{$PACKRECORDS 2}
|
||||
PConUnit = ^TConUnit;
|
||||
TConUnit = record
|
||||
cu_MP: TMsgPort;
|
||||
{ ---- read only variables }
|
||||
cu_Window: PWindow; // Intuition window bound to this unit
|
||||
cu_XCP: SmallInt; // character position
|
||||
cu_YCP: SmallInt;
|
||||
cu_XMax: SmallInt; // max character position
|
||||
cu_YMax: SmallInt;
|
||||
cu_XRSize: SmallInt; // character raster size
|
||||
cu_YRSize: SmallInt;
|
||||
cu_XROrigin: SmallInt; // raster origin
|
||||
cu_YROrigin: SmallInt;
|
||||
cu_XRExtant: SmallInt; // raster maxima
|
||||
cu_YRExtant: SmallInt;
|
||||
cu_XMinShrink: SmallInt; // smallest area intact from resize process
|
||||
cu_YMinShrink: SmallInt;
|
||||
cu_XCCP: SmallInt; // cursor position
|
||||
cu_YCCP: SmallInt;
|
||||
|
||||
{ ---- read/write variables (writes must must be protected) }
|
||||
{ ---- storage for AskKeyMap and SetKeyMap }
|
||||
cu_KeyMapStruct: TKeyMap;
|
||||
{ ---- tab stops }
|
||||
cu_TabStops: array[0..MAXTABS - 1] of Word; // 0 at start, 0xFFFF at end of list
|
||||
|
||||
// ---- console rastport attributes
|
||||
cu_Mask: ShortInt;
|
||||
cu_FgPen: ShortInt;
|
||||
cu_BgPen: ShortInt;
|
||||
cu_AOLPen: ShortInt;
|
||||
cu_DrawMode: ShortInt;
|
||||
cu_Obsolete1: ShortInt; // was cu_AreaPtSz -- not used in V36
|
||||
cu_Obsolete2: APTR; // was cu_AreaPtrn -- not used in V36
|
||||
cu_Minterms: array[0..7] of Byte; // console minterms
|
||||
cu_Font: PTextFont;
|
||||
cu_AlgoStyle: Byte;
|
||||
cu_TxFlags: Byte;
|
||||
cu_TxHeight: Word;
|
||||
cu_TxWidth: Word;
|
||||
cu_TxBaseline: Word;
|
||||
cu_TxSpacing: Word;
|
||||
|
||||
{ ---- console MODES and RAW EVENTS switches }
|
||||
cu_Modes: array[0..(PMB_AWM + 7) div 8 - 1] of Byte; // one bit per mode
|
||||
cu_RawEvents: array[0..(IECLASS_MAX + 7) div 8 - 1] of Byte;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -53,6 +53,8 @@ begin
|
||||
T:=P.Targets.AddUnit('locale.pas');
|
||||
T:=P.Targets.AddUnit('datatypes.pas');
|
||||
T:=P.Targets.AddUnit('serial.pas');
|
||||
T:=P.Targets.AddUnit('console.pas');
|
||||
T:=P.Targets.AddUnit('conunit.pas');
|
||||
|
||||
{$ifndef ALLPACKAGES}
|
||||
Run;
|
||||
|
||||
125
packages/os4units/src/console.pas
Normal file
125
packages/os4units/src/console.pas
Normal file
@ -0,0 +1,125 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
|
||||
A file in Amiga system run time library.
|
||||
Copyright (c) 1998-2003 by Nils Sjoholm
|
||||
member of the Amiga RTL development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{
|
||||
To call the two routines defined below, you'll need to set
|
||||
ConsoleBase to an appropriate value.
|
||||
|
||||
nils.sjoholm@mailbox.swipnet.se Nils Sjoholm
|
||||
}
|
||||
|
||||
unit console;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
exec, inputevent, keymap;
|
||||
|
||||
const
|
||||
|
||||
{***** Console commands *****}
|
||||
CD_ASKKEYMAP = CMD_NONSTD + 0;
|
||||
CD_SETKEYMAP = CMD_NONSTD + 1;
|
||||
CD_ASKDEFAULTKEYMAP = CMD_NONSTD + 2;
|
||||
CD_SETDEFAULTKEYMAP = CMD_NONSTD + 3;
|
||||
|
||||
{***** SGR parameters *****}
|
||||
|
||||
SGR_PRIMARY = 0;
|
||||
SGR_BOLD = 1;
|
||||
SGR_ITALIC = 3;
|
||||
SGR_UNDERSCORE = 4;
|
||||
SGR_NEGATIVE = 7;
|
||||
|
||||
SGR_NORMAL = 22; // default foreground color, not bold
|
||||
SGR_NOTITALIC = 23;
|
||||
SGR_NOTUNDERSCORE = 24;
|
||||
SGR_POSITIVE = 27;
|
||||
|
||||
{ these names refer to the ANSI standard, not the implementation }
|
||||
|
||||
SGR_BLACK = 30;
|
||||
SGR_RED = 31;
|
||||
SGR_GREEN = 32;
|
||||
SGR_YELLOW = 33;
|
||||
SGR_BLUE = 34;
|
||||
SGR_MAGENTA = 35;
|
||||
SGR_CYAN = 36;
|
||||
SGR_WHITE = 37;
|
||||
SGR_DEFAULT = 39;
|
||||
|
||||
SGR_BLACKBG = 40;
|
||||
SGR_REDBG = 41;
|
||||
SGR_GREENBG = 42;
|
||||
SGR_YELLOWBG = 43;
|
||||
SGR_BLUEBG = 44;
|
||||
SGR_MAGENTABG = 45;
|
||||
SGR_CYANBG = 46;
|
||||
SGR_WHITEBG = 47;
|
||||
SGR_DEFAULTBG = 49;
|
||||
|
||||
{ these names refer to the implementation, they are the preferred }
|
||||
{ names for use with the Amiga console device. }
|
||||
|
||||
SGR_CLR0 = 30;
|
||||
SGR_CLR1 = 31;
|
||||
SGR_CLR2 = 32;
|
||||
SGR_CLR3 = 33;
|
||||
SGR_CLR4 = 34;
|
||||
SGR_CLR5 = 35;
|
||||
SGR_CLR6 = 36;
|
||||
SGR_CLR7 = 37;
|
||||
|
||||
SGR_CLR0BG = 40;
|
||||
SGR_CLR1BG = 41;
|
||||
SGR_CLR2BG = 42;
|
||||
SGR_CLR3BG = 43;
|
||||
SGR_CLR4BG = 44;
|
||||
SGR_CLR5BG = 45;
|
||||
SGR_CLR6BG = 46;
|
||||
SGR_CLR7BG = 47;
|
||||
|
||||
{***** DSR parameters *****}
|
||||
DSR_CPR = 6;
|
||||
|
||||
{***** CTC parameters *****}
|
||||
CTC_HSETTAB = 0;
|
||||
CTC_HCLRTAB = 2;
|
||||
CTC_HCLRTABSALL = 5;
|
||||
|
||||
{***** TBC parameters *****}
|
||||
TBC_HCLRTAB = 0;
|
||||
TBC_HCLRTABSALL = 3;
|
||||
|
||||
{***** SM and RM parameters *****}
|
||||
M_LNM = 20; // linefeed newline mode
|
||||
M_ASM = '>1'; // auto scroll mode
|
||||
M_AWM = '?7'; // auto wrap mode
|
||||
|
||||
var
|
||||
ConsoleDevice: PDevice = nil;
|
||||
IConsoleDevice: Pointer = nil;
|
||||
|
||||
function CDInputHandler(Events: PInputEvent; ConsoleDev: PLibrary): PInputEvent; syscall IConsoleDevice 76;
|
||||
function RawKeyConvert(Events: PInputEvent; Buffer: PChar; Length: LongInt; KeyMap: PKeyMap): LongInt; syscall IConsoleDevice 80;
|
||||
function GetConSnip(): APTR; syscall ConsoleDevice 9;
|
||||
function SetConSnip(Param: APTR): LongInt; syscall ConsoleDevice 10;
|
||||
procedure AddConSnipHook(Hook: PHook); syscall ConsoleDevice 11;
|
||||
procedure RemConSnipHook(Hook: PHook); syscall ConsoleDevice 12;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
94
packages/os4units/src/conunit.pas
Normal file
94
packages/os4units/src/conunit.pas
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
|
||||
A file in Amiga system run time library.
|
||||
Copyright (c) 1998 by Nils Sjoholm
|
||||
member of the Amiga RTL development team.
|
||||
|
||||
See the file COPYING.FPC, included in this distribution,
|
||||
for details about the copyright.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit conunit;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
exec, console, keymap, inputevent, intuition, agraphics;
|
||||
|
||||
const
|
||||
{ ---- console unit numbers for OpenDevice() }
|
||||
CONU_LIBRARY = -1; // no unit, just fill in IO_DEVICE field
|
||||
CONU_STANDARD = 0; // standard unmapped console
|
||||
|
||||
{ ---- New unit numbers for OpenDevice() - (V36) }
|
||||
CONU_CHARMAP = 1; // bind character map to console
|
||||
CONU_SNIPMAP = 3; // bind character map w/ snip to console
|
||||
|
||||
{ ---- New flag defines for OpenDevice() - (V37) }
|
||||
CONFLAG_DEFAULT = 0;
|
||||
CONFLAG_NODRAW_ON_NEWSIZE = 1;
|
||||
|
||||
PMB_ASM = M_LNM + 1; // internal storage bit for AS flag
|
||||
PMB_AWM = PMB_ASM + 1; // internal storage bit for AW flag
|
||||
MAXTABS = 80;
|
||||
|
||||
|
||||
type
|
||||
{$PACKRECORDS 2}
|
||||
PConUnit = ^TConUnit;
|
||||
TConUnit = record
|
||||
cu_MP: TMsgPort;
|
||||
{ ---- read only variables }
|
||||
cu_Window: PWindow; // Intuition window bound to this unit
|
||||
cu_XCP: SmallInt; // character position
|
||||
cu_YCP: SmallInt;
|
||||
cu_XMax: SmallInt; // max character position
|
||||
cu_YMax: SmallInt;
|
||||
cu_XRSize: SmallInt; // character raster size
|
||||
cu_YRSize: SmallInt;
|
||||
cu_XROrigin: SmallInt; // raster origin
|
||||
cu_YROrigin: SmallInt;
|
||||
cu_XRExtant: SmallInt; // raster maxima
|
||||
cu_YRExtant: SmallInt;
|
||||
cu_XMinShrink: SmallInt; // smallest area intact from resize process
|
||||
cu_YMinShrink: SmallInt;
|
||||
cu_XCCP: SmallInt; // cursor position
|
||||
cu_YCCP: SmallInt;
|
||||
|
||||
{ ---- read/write variables (writes must must be protected) }
|
||||
{ ---- storage for AskKeyMap and SetKeyMap }
|
||||
cu_KeyMapStruct: TKeyMap;
|
||||
{ ---- tab stops }
|
||||
cu_TabStops: array[0..MAXTABS - 1] of Word; // 0 at start, 0xFFFF at end of list
|
||||
|
||||
// ---- console rastport attributes
|
||||
cu_Mask: ShortInt;
|
||||
cu_FgPen: ShortInt;
|
||||
cu_BgPen: ShortInt;
|
||||
cu_AOLPen: ShortInt;
|
||||
cu_DrawMode: ShortInt;
|
||||
cu_Obsolete1: ShortInt; // was cu_AreaPtSz -- not used in V36
|
||||
cu_Obsolete2: APTR; // was cu_AreaPtrn -- not used in V36
|
||||
cu_Minterms: array[0..7] of Byte; // console minterms
|
||||
cu_Font: PTextFont;
|
||||
cu_AlgoStyle: Byte;
|
||||
cu_TxFlags: Byte;
|
||||
cu_TxHeight: Word;
|
||||
cu_TxWidth: Word;
|
||||
cu_TxBaseline: Word;
|
||||
cu_TxSpacing: Word;
|
||||
|
||||
{ ---- console MODES and RAW EVENTS switches }
|
||||
cu_Modes: array[0..(PMB_AWM + 7) div 8 - 1] of Byte; // one bit per mode
|
||||
cu_RawEvents: array[0..(IECLASS_MAX + 7) div 8 - 1] of Byte;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@ -16,7 +16,7 @@ Const
|
||||
KVMAll = [emx,go32v2,msdos,netware,netwlibc,os2,win32,win64,win16]+UnixLikes+AllAmigaLikeOSes;
|
||||
|
||||
// all full KVMers have crt too, except Amigalikes
|
||||
CrtOSes = KVMALL+[WatCom]-[aros,morphos];
|
||||
CrtOSes = KVMALL+[WatCom];
|
||||
KbdOSes = KVMALL;
|
||||
VideoOSes = KVMALL;
|
||||
MouseOSes = KVMALL;
|
||||
|
||||
@ -90,7 +90,11 @@ begin
|
||||
|
||||
if Assigned(Info) then
|
||||
begin
|
||||
{$ifdef AmigaOS4}
|
||||
Port := PFileHandle(BADDR(DosInput()))^.fh_MsgPort;
|
||||
{$else}
|
||||
Port := PFileHandle(BADDR(DosInput()))^.fh_Type;
|
||||
{$endif}
|
||||
//GetConsoleTask;
|
||||
Bptr1 := MKBADDR(Info);
|
||||
|
||||
@ -316,10 +320,10 @@ begin
|
||||
OutP := DosOutput();
|
||||
SetMode(OutP, 1);
|
||||
// Wait one millisecond for the key (-1 = timeout)
|
||||
{$if defined(MorphOS) or defined(Amiga68k))}
|
||||
KeyPressed := WaitForChar(OutP, 1);
|
||||
{$else}
|
||||
{$if defined(AROS)}
|
||||
KeyPressed := WaitForChar(OutP, 1) <> 0;
|
||||
{$else}
|
||||
KeyPressed := WaitForChar(OutP, 1);
|
||||
{$endif}
|
||||
SetMode(OutP, 0);
|
||||
end;
|
||||
Loading…
Reference in New Issue
Block a user