turbo.imp
上传用户:upcnvip
上传日期:2007-01-06
资源大小:474k
文件大小:9k
源码类别:

编译器/解释器

开发平台:

C/C++

  1. { Turbo Pascal standard units.  For use with p2c. }
  2. { Only partially complete! }
  3. {-------------------------------------------------------------------------}
  4. unit printer;
  5. interface
  6. var
  7.    lst : text;
  8. end;
  9. {-------------------------------------------------------------------------}
  10. unit dos;
  11. interface
  12. const
  13.    FCarry     = $0001;     { 8086 flags }
  14.    FParity    = $0004;
  15.    FAuxiliary = $0010;
  16.    FZero      = $0040;
  17.    FSign      = $0080;
  18.    FOverflow  = $0100;
  19.    fmClosed   = $D7B0;     { File modes }
  20.    fmInput    = $D7B1;
  21.    fmOutput   = $D7B2;
  22.    fmInOut    = $D7B3;
  23.    ReadOnly  = $01;        { File attributes }
  24.    Hidden    = $02;
  25.    SysFile   = $04;
  26.    VolumeID  = $08;
  27.    Directory = $10;
  28.    Archive   = $20;
  29.    AnyFile   = $3F;
  30. type
  31.    PathStr = string[79];
  32.    DirStr = PathStr;
  33.    NameStr = string[8];
  34.    ExtStr = string[3];
  35.    FileRec =
  36.       record
  37.          Handle: Word;
  38.          Mode: Word;
  39.          RecSize: Word;
  40.          Private: array [1..26] of Byte;
  41.          UserData: array [1..16] of Byte;
  42.          Name: array [0..79] of char;
  43.       end;
  44.    TextBuf = array [0..127] of char;
  45.    TextRec =
  46.       record
  47.          Handle: Word;
  48.          Mode: Word;
  49.          BufSize: Word;
  50.          Private: Word;
  51.          BufPos: Word;
  52.          BufEnd: Word;
  53.          BufPtr: ^TextBuf;
  54.          OpenProc: Pointer;
  55.          InOutProc: Pointer;
  56.          FlushProc: Pointer;
  57.          CloseProc: Pointer;
  58.          UserData: array [1..16] of Byte;
  59.          Name: array [0..79] of char;
  60.          Buffer: TextBuf;
  61.       end;
  62.    Registers =
  63.       record
  64.          case integer of
  65.             0: (AX,BX,CX,DX,BP,SI,DI,ES,Flags: word);
  66.             1: (AL,AH,BL,BH,CL,CH,DL,DH: byte);
  67.       end;
  68.    DateTime =
  69.       record
  70.          Year, Month, Day, Hour, Min, Sec: word;
  71.       end;
  72.    SearchRec =
  73.       record
  74.          Fill: array [1..21] of byte;
  75.          Attr: byte;
  76.          Time: longint;
  77.          Size: longint;
  78.          Name: string[12];
  79.       end;
  80. var
  81.    DosError: integer;
  82. procedure GetTime(var hour, minute, second, csec : word);
  83. procedure GetDate(var year, month, day, dow : word);
  84. procedure FSplit(fn : PathStr; var dir, name, ext : string);
  85. {WarnNames=1}
  86. procedure Exec(path, cmdLine : PathStr);
  87. {WarnNames}
  88. end;
  89. {-------------------------------------------------------------------------}
  90. unit crt;
  91. interface
  92. function KeyPressed : boolean;
  93. function ReadKey : char;
  94. procedure ClrScr;
  95. procedure TextBackground(i : integer);
  96. procedure Window(a, b, c, d : integer);
  97. var wherex, wherey : integer;
  98. end;
  99. {-------------------------------------------------------------------------}
  100. unit graph;
  101. interface
  102. const
  103.   gr0k = 0;
  104.   grNoInitGraph      = -1;
  105.   grNotDetected      = -2;
  106.   grFileNotFound     = -3;
  107.   grInvalidDriver    = -4;
  108.   grNoLoadMem        = -5;
  109.   grNoScanMem        = -6;
  110.   grNoFloodMem       = -7;
  111.   grFontNotFound     = -8;
  112.   grNoFontMem        = -9;
  113.   grInvalidMode      = -10;
  114.   grError            = -11;
  115.   grIOerror          = -13;
  116.   grInvalidFontNum   = -14;
  117.   Detect = 0;
  118.   CGA = 1;
  119.   MCGA = 2;
  120.   EGA = 3;
  121.   EGA64 = 4;
  122.   EGAMono = 5;
  123.   IBM8514 = 6;
  124.   HercMono = 7;
  125.   ATT400 = 8;
  126.   VGA = 9;
  127.   PC3270 = 10;
  128.   CurrentDriver = -128;
  129.   CGAC0 = 0;
  130.   CGAC1 = 1;
  131.   CGAC2 = 2;
  132.   CGAC3 = 3;
  133.   CGAHi = 4;
  134.   MCGAC0 = 0;
  135.   MCGAC1 = 1;
  136.   MCGAC2 = 2;
  137.   MCGAC3 = 3;
  138.   MCGAMed = 4;
  139.   MCGAHi = 5;
  140.   EGALo = 0;
  141.   EGAHi = 1;
  142.   EGA64Lo = 0;
  143.   EGA64Hi = 1;
  144.   EGAMonoHi = 3;
  145.   HercMonoHi = 0;
  146.   ATT400C0 = 0;
  147.   ATT400C1 = 1;
  148.   ATT400C2 = 2;
  149.   ATT400C3 = 3;
  150.   ATT400Med = 4;
  151.   ATT400Hi = 5;
  152.   VGALo = 0;
  153.   VGAMed = 1;
  154.   VGAHi = 2;
  155.   PC3270Hi = 0;
  156.   IBM8514LO = 0;
  157.   IBM8514HI = 1;
  158.   Black = 0;
  159.   Blue = 1;
  160.   Green = 2;
  161.   Cyan = 3;
  162.   Red = 4;
  163.   Magenta = 5;
  164.   Brown = 6;
  165.   LightGray = 7;
  166.   DarkGray = 8;
  167.   LightBlue = 9;
  168.   LightGreen = 10;
  169.   LightCyan = 11;
  170.   LightRed = 12;
  171.   LightMagenta = 13;
  172.   Yellow = 14;
  173.   White = 15;
  174.   SolidLn = 0;
  175.   DottedLn = 1;
  176.   CenterLn = 2;
  177.   DashedLn = 3;
  178.   UserBitLn = 4;
  179.   NormWidth = 1;
  180.   ThickWidth = 3;
  181. type
  182.   ArcCoordsType = record
  183.                     X, Y: integer;
  184.                     Xstart, Ystart: integer;
  185.                     Xend, Yend: integer;
  186.                   end;
  187. const
  188.   MaxColors = 15;
  189. type
  190.   PaletteType = record
  191.                   Size: byte;
  192.                   Colors: array[0..MaxColors] of shortint;
  193.                 end;
  194.   FillPatternType = array[1..8] of byte;
  195.   FillSettingsType = record
  196.                        Pattern: word;
  197.                        Color: word;
  198.                      end;
  199.   LineSettingsType = record
  200.                        LineStyle: word;
  201.                        Pattern: word;
  202.                        Thickness: word;
  203.                      end;
  204.   TextSettingsType = record
  205.                        Font: word;
  206.                        Direction: word;
  207.                        CharSize: word;
  208.                        Horiz: word;
  209.                        Vert: word;
  210.                      end;
  211.   ViewPortType = record
  212.                    x1, y1, x2, y2: integer;
  213.                    Clip: boolean;
  214.                  end;
  215. const
  216.   LeftText = 0;
  217.   CenterText = 1;
  218.   RightText = 2;
  219.   BottomText = 0;
  220.   TopText = 2;
  221. const
  222.   ClipOn = true;
  223.   ClipOff = false;
  224. const
  225.   EmptyFill = 0;
  226.   SolidFill = 1;
  227.   LineFill = 2;
  228.   LtSlashFill = 3;
  229.   SlashFill = 4;
  230.   BkSlashFill = 5;
  231.   LtBkSlashFill = 6;
  232.   HatchFill = 7;
  233.   XHatchFill = 8;
  234.   InterleaveFill = 9;
  235.   WideDotFill = 10;
  236.   CloseDotFill = 11;
  237.   UserFill = 17;
  238. const
  239.   NormalPut = 0;
  240.   CopyPut = 0;
  241.   XORPut = 1;
  242.   OrPut = 2;
  243.   AndPut = 3;
  244.   NotPut = 4;
  245. procedure Arc(X, Y: integer; StAngle, EndAngle, Radius: word);
  246. procedure Bar(x1, y1, x2, y2: integer);
  247. procedure Bar3D(x1, y1, x2, y2: integer; Depth: word; Top: boolean);
  248. procedure Circle(X, Y: integer; Radius: word);
  249. procedure ClearDevice;
  250. procedure ClearViewPort;
  251. procedure CloseGraph;
  252. procedure DetectGraph(var GraphDriver, GraphMode: integer);
  253. procedure DrawPoly(NumPoints: word; var PolyPoints);
  254. procedure Ellipse(X, Y: integer; StAngle, EndAngle: word;
  255.                   XRadius, YRadius: word);
  256. procedure FillEllipse(X, Y: integer; XRadius, YRadius: word);
  257. procedure FillPoly(NumPoints: word; var PolyPoints);
  258. procedure FloodFill(x, y: integer; Border: word);
  259. procedure GetArcCoords(var ArcCoords: ArcCoordsType);
  260. procedure GetAspectRatio(var Xasp, Yasp: word);
  261. function GetBkColor: word;
  262. function GetColor: word;
  263. function GetDefaultPalette(var Palette: PaletteType): PaletteType;
  264. function GetDriverName: string;
  265. procedure GetFillPattern(var FillPattern: FillPatternType);
  266. procedure GetFillSettings(var FillInfo: FillSettingsType);
  267. function GetGraphMode: integer;
  268. procedure GetImage(x1, y1, x2, y2: integer; var BitMap);
  269. procedure GetLineSettings(var LineInfo: LineSettingsType);
  270. function GetMaxColor: word;
  271. function GetMaxMode: word;
  272. function GetMaxX: integer;
  273. function GetMaxY: integer;
  274. function GetModeName(ModeNumber: integer): string;
  275. procedure GetModeRange(GraphDriver: integer; var LoMode, HiMode: integer);
  276. procedure GetPalette(var Palette: PaletteType);
  277. function GetPaletteSize: integer;
  278. function GetPixel(X,Y: integer): word;
  279. procedure GetTextSettings(var TextInfo: TextSettingsType);
  280. procedure GetViewSettings(var ViewPort: ViewPortType);
  281. function GetX: integer;
  282. function GetY: integer;
  283. procedure GraphDefaults;
  284. function GraphErrorMsg(ErrorCode: integer): string;
  285. function GraphResult: integer;
  286. function ImageSize(x1, y1, x2, y2: integer): word;
  287. procedure InitGraph(var GraphDriver: integer; var GraphMode: integer;
  288.                     PathToDriver: string);
  289. function InstallUserDriver(Name: string; AutoDetectPtr: pointer): integer;
  290. function InstallUserFont(FontFileName: string): integer;
  291. procedure Line(x1, y1, x2, y2: integer);
  292. procedure LineRel(Dx, Dy: integer);
  293. procedure LineTo(x, y: integer);
  294. procedure MoveRel(Dx, Dy: integer);
  295. procedure MoveTo(x, y: integer);
  296. procedure OutText(TextString: string);
  297. procedure OutTextXY(X,Y: integer; TextString: string);
  298. procedure PieSlice(x, y: integer; StAngle, EndAngle, Radius: word);
  299. procedure PutImage(x, y: integer; var BitMap; BitBlt: word);
  300. procedure PutPixel(x, y: integer; Pixel: word);
  301. procedure Rectangle(x1, y1, x2, y2: integer);
  302. function RegisterBGIdriver(driver: pointer): integer;
  303. function RegisterBGIfont(font: pointer): integer;
  304. procedure RestoreCrtMode;
  305. procedure Sector(x, y: integer; StAngle, EndAngle, XRadius, YRadius: word);
  306. procedure SetActivePage(Page: word);
  307. procedure SetAllPalette(var Palette);
  308. procedure SetAspectRatio(Xasp, Yasp: word);
  309. procedure SetBkColor(ColorNum: word);
  310. procedure SetColor(Color: word);
  311. procedure SetFillPattern(Pattern: FillPatternType; Color: word);
  312. procedure SetFillStyle(Pattern: word; Color: word);
  313. procedure SetGraphBufSize(BufSize: word);
  314. procedure SetGraphMode(Mode: integer);
  315. procedure SetLineStyle(LineStyle: word; Pattern: word; Thickness: word);
  316. procedure SetPalette(ColorNum: word; Color: shortint);
  317. procedure SetRGBPalette(ColorNum, RedValue, GreenValue, BlueValue: integer);
  318. procedure SetTextJustify(Horiz, Vert: word);
  319. procedure SetTextStyle(Font: word; Direction: word; CharSize: word);
  320. procedure SetUserCharSize(MultX, DivX, MultY, DivY: word);
  321. procedure SetViewPort(x1, y1, x2, y2: integer; Clip: boolean);
  322. procedure SetVisualPage(Page: word);
  323. procedure SetWriteMode(WriteMode: integer);
  324. function TextHeight(TextString: string): word;
  325. function TextWidth(TextString: string): word;
  326. end;