home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / delite / int / kernel.int < prev    next >
Encoding:
Text File  |  1992-04-01  |  17.0 KB  |  429 lines

  1. UNIT Kernel;
  2.  
  3. (*****************************************************************************
  4. Name:              KERNEL.PAS
  5. Version:           2.10
  6. Edit Datum:        1.4.92
  7. Autor:             Frank Seidinger
  8. Kurzbeschreibung:  deLite-Kernel (Ini-File, VDI, Maus, Timer, Events)
  9. *****************************************************************************)
  10.  
  11. {$G-   keine 286-Instruktionen }
  12.  
  13. INTERFACE
  14.  
  15.   CONST deLiteVersion : WORD    =  $0210; { Die deLite Versionsnummer }
  16.         VDIVersion    : WORD    =  $0012; { Die benötigte VDI Versionsnummer }
  17.  
  18.         Debug         : BOOLEAN = TRUE;   { Die Debug Variable }
  19.  
  20.         DefaultCursor        =    0;
  21.         HairCrossCursor      =    1;
  22.         HourGlassCursor      =    2;
  23.         WhiteArrowCursor     =    3;
  24.  
  25.         SingleShot           =    1;
  26.         ContinuousShots      =    2;
  27.  
  28.         NormalPut            =    0;
  29.  
  30.         TextNormal           =    0;
  31.         TextUnderline        =    1;
  32.  
  33.         SolidLn              =  $ff;  { Vordefinierte Pattern für Linien }
  34.         DottedLn             =  $cc;
  35.         CenterLn             =  $be;
  36.         DashedLn             =  $f0;
  37.  
  38.         PutMode              =    0;
  39.         AndMode              =    1;
  40.         OrMode               =    2;
  41.         XorMode              =    3;
  42.  
  43.         DefaultFont          =    0;  { Der Font im Ini-File wird genommen }
  44.  
  45.         HorizDir             =    0;  { Ausrichtungen für skalierbaren Text }
  46.         VertDir              =    1;
  47.  
  48.         LeftText             =    0;  { Justierungen für skalierbaren Text }
  49.         CenterText           =    1;
  50.         RightText            =    2;
  51.         BottomText           =    0;
  52.         TopText              =    2;  
  53.  
  54.         Black                =    0;  { Die Farben }
  55.         Blue                 =    1;
  56.         Green                =    2;
  57.         Cyan                 =    3;
  58.         Red                  =    4;
  59.         Magenta              =    5;
  60.         Brown                =    6;
  61.         LightGray            =    7;
  62.         DarkGray             =    8;
  63.         LightBlue            =    9;
  64.         LightGreen           =   10;
  65.         LightCyan            =   11;
  66.         LightRed             =   12;
  67.         LightMagenta         =   13;
  68.         Yellow               =   14;
  69.         White                =   15;  
  70.  
  71.         MouseMoved           =  #01;  { Die Mausattribute }
  72.         LeftButtonPressed    =  #02;
  73.         LeftButtonReleased   =  #04;
  74.         RightButtonPressed   =  #08;
  75.         RightButtonReleased  =  #16;
  76.         MiddleButtonPressed  =  #32;
  77.         MiddleButtonReleased =  #64;
  78.  
  79.         NoMouseMove          =  $0001;  { keine Mausbewegungen }
  80.         NoLeftButton         =  $0006;
  81.         NoRightButton        =  $0018;
  82.         NoMiddleButton       =  $0060;
  83.         NoMouseButtons       =  $007E;
  84.         NoMouseEvents        =  $FFFF;  { keine Mausevents     }
  85.         AllEvents            =  $0000;  { alle Events erlaubt  }
  86.  
  87.         CAP_HBlit            =  $0001;
  88.         CAP_VBlit            =  $0002;
  89.         CAP_GBlit            =  $0004;
  90.         CAP_WriteMode        =  $0008;
  91.         CAP_Palette          =  $0010;
  92.         CAP_HardwareMouse    =  $0020;
  93.         CAP_ColorDrv         =  $0040;
  94.         CAP_Sprite           =  $0080;
  95.         CAP_ColorIcons       =  $0100;  { Die Fähigkeiten der Grafikkarte }
  96.  
  97.         Esc    =  #27;  CR      =  'm';  Tab    = #105;  BSP     = #104;
  98.         F1     =  #59;  F2      =  #60;  F3     =  #61;  F4      =  #62;
  99.         F5     =  #63;  F6      =  #64;  F7     =  #65;  F8      =  #66;
  100.         F9     =  #67;  F10     =  #68;  F11    = #133;  F12     = #134;
  101.         CtPgUp = #132;  CtPgDn  = #118;
  102.         CrUp   =  #72;  CrDown  =  #80;  CrLeft =  #75;  CrRight =  #77;
  103.         PgUp   =  #73;  PgDown  =  #81;  { Vordefinierte Tasten }
  104.         CrHome =  #71;  CrEnd   =  #79;
  105.  
  106.  
  107.   TYPE  BlockIDString  = STRING;      { Blockidentifier          }
  108.         KeyString      = STRING;      { Schlüsselwort            }
  109.         ValueString    = STRING;      { Wert des Schlüsselwortes }
  110.  
  111.         NameString     = STRING[31];  { allgemeiner String       }
  112.         HelpString     = STRING[60];  { Länge einer Hilfezeile   }
  113.  
  114.         ViewPortType   = RECORD
  115.                            x1, y1, x2, y2 : INTEGER;
  116.                          END; { Beschreibt einen ViewPort }
  117.  
  118.         EventTypes     = (LeMouse, DoubleClick, MouseUnNormalized,
  119.  
  120.                           NormKey, AltKey, CtrlKey, Fkey,
  121.  
  122.                           DoRedraw, Terminate, About,
  123.  
  124.                           Menu,  DialogEvent,
  125.  
  126.                           TimerEvent,
  127.  
  128.                           UserEvent,
  129.  
  130.                           Initialize,
  131.  
  132.                           void);
  133.  
  134.         EventTyp       = RECORD
  135.                            TimeStamp  : Word;
  136.                            Case Class : EventTypes of
  137.                                   TimerEvent : (
  138.                                                  ClientID     : Integer;
  139.                                                  TimerChannel : Integer;
  140.                                                );
  141.  
  142.                                   DialogEvent : (
  143.                                                  ID,MSG       : integer;
  144.                                                  DlgAdr       : Pointer;
  145.                                                 );
  146.  
  147.                                   Menu        : (MenuitemID   : Integer);
  148.  
  149.                                   LeMouse, DoubleClick, MouseUnNormalized,
  150.                                   NormKey, AltKey, CtrlKey, FKey,
  151.                                   DoRedraw, Terminate, About,
  152.                                   UserEvent, Initialize, Void
  153.                                              : (
  154.                                                  Attrib : CHAR;
  155.                                                  x,y    : INTEGER;
  156.                                                );
  157.                          End; { Case & Record }
  158.  
  159.         TextSettingsType = record
  160.                              TheFont      : Word;
  161.                              TheDirection : Word;
  162.                              TheCharSizeX : Word;
  163.                              TheCharSizeY : Word;
  164.                              TheHoriz     : Word;
  165.                              TheVert      : Word;
  166.                            end;
  167.  
  168.         CursorType = Record
  169.                        AndMask  : Array[0..127] of Byte;
  170.                        XorMask  : Array[0..127] of Byte;
  171.                        HotSpotX : Integer;
  172.                        HotSpotY : Integer;
  173.                      End;
  174.  
  175.         PCursorType = ^CursorType;
  176.  
  177.  Const  OffsetY        =  3;
  178.         FrameWidth     =  2;
  179.         ChangedColor   : Word = 0;
  180.         StackPtr       : byte = 1;
  181.  
  182.  Var    ProjektName    : String[12]; { Der Name der gestarteten Applikation }
  183.  
  184.         FontX, FontY   : Byte;  { Fontgröße }
  185.  
  186.         APIDlgFrame    : Byte;  { Rahmen innerhalb von API-Dialogen }
  187.         BackGndCol     : Byte;  { Bildschirmhintergrund }
  188.         BorderCol      : Byte;  { Rahmenfarbe }
  189.         DialogBkGnd    : Byte;  { Hintergrund API-Dialoge }
  190.         DialogStat     : Byte;  { Statusmeldungen in API-Dialogen }
  191.         DialogText     : Byte;  { Texte in Edit-Dialogen }
  192.         ErrBkColor     : Byte;  { Hintergrund von Fehlerfenstern }
  193.         ErrColor       : Byte;  { Text von Fehlerfenstern }
  194.         FrameColor     : Byte;  { Rahmen von API-Dialogen }
  195.         HighLColor     : Byte;  { Highlighted Item im Menü Vordergrund }
  196.         InvColor       : Byte;  { Highlighted Item im Menü Hintergrund }
  197.         InvItemBkGnd   : Byte;  { Hintergrund invertiertes Item Listdialog }
  198.         InvItemCol     : Byte;  { Text invertiertes Item Listdialog }
  199.         ListDlgFG      : Byte;  { Hintergrund Listdialog }
  200.         ListDlgText    : Byte;  { Text Listdialog }
  201.         MenueBkGnd     : Byte;  { Hintergrund Menues }
  202.         MenueColor     : Byte;  { Vordergrund Menuetexte }
  203.         SysColor       : Byte;  { Text von Systemfenstern }
  204.         TextDlgFG      : Byte;  { Hintergrund von Edit-Dialogen }
  205.         DisableText    : Byte;  { Inaktiver Eintrag im Menu }
  206.         Elevator       : Byte;  { Der Elevator im Listdialog }
  207.         WinFrame       : Byte;  { Der Rahmen des aktiven Fensters }
  208.         DlgItemColor   : Byte;  { Vordergrund Dialogelemente }
  209.         DlgItemBkColor : Byte;  { Hintergrund Dialogelemente }
  210.         DlgButtonArea  : Byte;  { Button-Fläche }
  211.         DlgButtonShadow: Byte;  { Button-Schattierung }
  212.         DlgDisableColor: Byte;  { inaktive Beschriftung }
  213.         DlgCaptionBar  : Byte;  { Hintergrund Caption-Bar }
  214.         DlgCaptionText : Byte;  { Vordergrund Caption-Bar }
  215.  
  216. { *********************************************************
  217.   Status und Kontrolle des Kernel
  218.   ********************************************************* }
  219.  
  220.   Function  KernelError : Integer; { Liefert Status der letzten
  221.                                      Kernel Operation }
  222.  
  223.   Procedure DebugOn;  { Schaltet den Debug Modus an  }
  224.   Procedure DebugOff; { Schaltet den Debug Modus aus }
  225.  
  226. { *********************************************************
  227.   Allgemeine Dienste
  228.   ********************************************************* }
  229.  
  230.   Procedure UpString(Var TheString: String);  { Wandelt in Großbuchstaben }
  231.   Function  UpCase(InChar : Char) : Char;     { Wandelt in Großbuchstaben }
  232.   Function  GetBootPath : String;
  233.   Procedure SetProjectName(TheName : String);
  234.  
  235. { *********************************************************
  236.   Der Zugriff auf das INI-File
  237.   ********************************************************* }
  238.  
  239.   Function GetParaName(Var Line,OutVal : String) : Boolean;
  240.   Function GetParaString(Var Line,OutVal : String) : Boolean;
  241.   Function GetParaInteger(Var Line : String; Var OutVal : LongInt) : Boolean;
  242.  
  243.   Function GetInitFileName(       Block   : BlockIDString;
  244.                                   KeyWord : KeyString;
  245.                               Var OutVal  : ValueString) : Boolean;
  246.  
  247.   Function GetInitFileString(     Block   : BlockIDString;
  248.                                   KeyWord : KeyString;
  249.                               Var OutVal  : ValueString) : Boolean;
  250.  
  251.   Function GetInitFileInteger(    Block   : BlockIDString;
  252.                                   KeyWord : KeyString;
  253.                               Var OutVal  : LongInt)     : Boolean;
  254.  
  255.  
  256.   Procedure SetInitFileName(      Block   : BlockIDString;
  257.                                   KeyWord : KeyString;
  258.                                   NewVal  : ValueString);
  259.  
  260.   Procedure SetInitFileString(    Block   : BlockIDString;
  261.                                   KeyWord : KeyString;
  262.                                   NewVal  : ValueString);
  263.  
  264.   Procedure SetInitFileInteger(   Block   : BlockIDString;
  265.                                   KeyWord : KeyString;
  266.                                   NewVal  : LongInt);
  267.  
  268.  
  269.  
  270.  
  271.   Function GetInitFileListFirst(  Block   : BlockIDString;
  272.                                   KeyWord : KeyString;
  273.                               Var OutVal  : ValueString) : Boolean;
  274.  
  275.   Function GetInitFileListNext(   KeyWord : KeyString;
  276.                               Var OutVal  : ValueString) : Boolean;
  277.  
  278.  
  279. { *********************************************************
  280.   Dienste des Grafiktreibers
  281.   ********************************************************* }
  282.  
  283.   FUNCTION  TestSize          : WORD;
  284.  
  285.   Function  InitGraphDriver   : Boolean;
  286.   Function  InitFont          : Boolean;
  287.   Function  GetDriverName     : String;
  288.   Procedure CloseGraphDriver;
  289.  
  290.   Function  GetMaxX           : Integer;
  291.   Function  GetMaxY           : Integer;
  292.   Function  GetFontX          : Byte;
  293.   Function  GetFontY          : Byte;
  294.  
  295.   Function  PortMaxX          : Integer;
  296.   Function  PortMaxY          : Integer;
  297.  
  298.   Function  GetMaxColors      : Byte;
  299.   Function  BitsPerPlane      : Byte;
  300.   Function  IsMono            : Boolean;
  301.  
  302.   Procedure SetBackColor(NewColor : Word);
  303.   Procedure SetPalette(ThePalette,R,B,G : Byte);
  304.   Procedure GetPalette(ThePalette : Byte; Var R,B,G : Byte);
  305.  
  306.   Procedure SetViewPort(x1,y1,x2,y2 : Integer);
  307.   Procedure GetViewSettings(Var TheSet : ViewPortType);
  308.   Procedure ClearViewPort;
  309.  
  310.   Procedure SetLinePattern(ThePattern : Word);
  311.   Function  GetLinePattern : Word;
  312.  
  313.   Procedure SetWriteMode(TheMode : Byte);
  314.   Function  GetWriteMode : Byte;
  315.  
  316.   Function  GetVDICapabilities : Word;
  317.  
  318.   Procedure OutTextAPI(x,y : Integer; InString : String; Color, Attrib : Byte);
  319.   Procedure DrawText(X0,Y0   : Integer; FakX  : Integer; FakY : Integer;
  320.                      Var Str : String;  Color : Byte);
  321.  
  322.   Procedure SetPoint(x,y : Integer; Color : Byte);
  323.   Procedure Line(x1,y1,x2,y2 : Integer; Color : Byte);
  324.   Procedure Rectangle(x1,y1,x2,y2 : Integer; Color : Byte);
  325.   Procedure Bar(x1,y1,x2,y2 : Integer; Color : Byte);
  326.   Procedure Arc(Mx,My : Integer; PhiA,PhiB,Radius : Integer; Color : Byte);
  327.   Procedure Circle(Mx,My : Integer; Radius : Integer; Color : Byte);
  328.  
  329.   Procedure XORLine(x1,y1,x2,y2 : Integer);
  330.   Procedure XORRectangle(x1,y1,x2,y2 : Integer; Thickness : Byte);
  331.   Procedure XORBar(x1,y1,x2,y2 : Integer);
  332.   Procedure XORArc(Mx,My : Integer; PhiA,PhiB,Radius : Integer);
  333.   Procedure XORCircle(Mx,My : Integer; Radius : Integer);
  334.  
  335.  
  336.   Procedure DrawSysIcon(ScrX,ScrY : Integer; Nr,Attrib : Byte);
  337.   Procedure DrawNormIcon(ScrX,ScrY  : Integer; Dx,Dy : Integer;
  338.                          Typ,Color  : Byte; Storage  : Pointer);
  339.  
  340.   Function  ImageSize(x1,y1,x2,y2 : Integer) : LongInt;
  341.   Procedure SaveImage(x1,y1,x2,y2 : Integer; Buffer : Pointer);
  342.   Procedure RestoreImage(x,y : Integer; Buffer : Pointer; Put : Word);
  343.  
  344.   Procedure BitBlit(x1,y1,x2,y2,DeltaX,DeltaY : Integer);
  345.  
  346. { *********************************************************
  347.   GRAPH.TPU Kompatibilität
  348.   ********************************************************* }
  349.  
  350.   Procedure SetTextStyle(Font, Direction: Word; CharSize : Word);
  351.   Procedure SetTextJustify(Horiz, Vert: Word);
  352.  
  353.   Procedure SetTextDirection(Dir: Word);
  354.   Procedure SetTextHeight(CharSize : Word);
  355.   Procedure SetTextUserScale(CharSizeX, CharSizeY : Word);
  356.  
  357.   Procedure GetTextSettings(Var Textinfo: TextSettingsType);
  358.   Function  GetTextLength(Var Str : String) : Integer;
  359.  
  360.   Procedure OutText(Str : String);
  361.   Procedure OutTextXY(X, Y : Integer; Str : String);
  362.  
  363.   Procedure MoveTo(X,Y : Integer);
  364.   Procedure LineTo(X,Y : Integer);
  365.   Procedure MoveRel(X,Y : Integer);
  366.   Procedure LineRel(X,Y : Integer);
  367.  
  368.   Function  GetColor : Byte;
  369.   Procedure SetColor(DieFarbe : Byte);
  370.  
  371.   Function  GetX : Integer;
  372.   Function  GetY : Integer;
  373.  
  374. { *********************************************************
  375.   Zugriff auf den Vektor Font für eigene Anwendungen
  376.   ********************************************************* }
  377.  
  378.   Procedure GetFirstFontVek(TheChar : Char; Var VekX, VekY : Integer;
  379.                                             Var PenDown    : Boolean;
  380.                                             Var Eol        : Boolean);
  381.  
  382.   Procedure GetNextFontVek(Var VekX, VekY : Integer;
  383.                            Var PenDown    : Boolean;
  384.                            Var Eol        : Boolean);
  385.  
  386.   Function  GetFontPitch(TheChar : Char) : Integer;
  387.  
  388. { *********************************************************
  389.   Mausroutinen
  390.   ********************************************************* }
  391.  
  392.   Procedure HideMouse;                  { Mouse für Menueaufbau verstecken  }
  393.   Procedure ShowMouse;                  { Danach wieder angezeigt           }
  394.   Procedure SetMousePos(x,y : Integer); { Setzt Mouse auf Pos. X,Y          }
  395.   Procedure SetMouseRange
  396.             (x1,y1,x2,y2 : Integer);    { Mausfenstergröße                  }
  397.   Procedure SetCursor(TheCursor : PCursorType); { Setzt neuen Mauszeiger    }
  398.   Function  GetCursor : PCursorType;    { Liefert den aktuellen Mauszeiger  }
  399.   Function  LoadCursor(CursorID : Integer) : PCursorType;
  400.                                         { Liefert einen System Mauszeiger   }
  401.  
  402. { *********************************************************
  403.   Die Event Schlange
  404.   ********************************************************* }
  405.  
  406.   PROCEDURE FlushQueue;                     { Verwirft alle Einträge  }
  407.   PROCEDURE WaitConfirm;                    { Wartet auf eine Aktione }
  408.  
  409.   Procedure PermitEvent(PermitMask : Word); { Sperrt Mouse Events  }
  410.   Procedure UnPermitEvent;                  { Erlaubt Mouse Events }
  411.   Function  GetPermitMask: Word;            { liefert Permit-Maske }
  412.  
  413.   Procedure PutEvent(Var Event : EventTyp); { Stellt ein Event in die Queue }
  414.   PROCEDURE GetEvent(VAR Event : EventTyp); { Gibt nächstes Event     }
  415.  
  416. { *********************************************************
  417.   Die System Timer
  418.   ********************************************************* }
  419.  
  420.   Function  GetTimerVal : Word;
  421.   Function  SetTimer(ClientId : Integer; Mode, MiliSecs : Word) : Integer;
  422.   Procedure StopTimer(ClientID, TimerChannel : Integer);
  423.  
  424. { ********************************************************* }
  425.  
  426. IMPLEMENTATION
  427.  
  428. END.
  429.