Category : Files from Magazines
Archive   : WDMAR92.ZIP
Filename : 3N03050A
(* -----------------------------------
Listing 1: Unit WP_Lib
Unit WP_Lib enables the programmer to use Turbo
Pascal's Write procedure to write to files in
WordPerfect 5.0 format.
by David A. Price
Version 1.0
----------------------------------- *)
interface
type
WP_TextAttribute = (WP_ExtraLarge,
WP_VeryLarge,
WP_Large,
WP_Small,
WP_Fine,
WP_Superscript,
WP_Subscript,
WP_Outline,
WP_Italics,
WP_Shadow,
WP_Redline,
WP_DoubleUnderline,
WP_Bold,
WP_StrikeOut,
WP_Underline,
WP_SmallCaps);
WP_PageNumPos = (WP_NoNum,
WP_TopLeftNum,
WP_TopCenterNum,
WP_TopRightNum,
WP_AltTopLeftRightNum,
WP_BottomLeftNum,
WP_BottomCenterNum,
WP_BottomRightNum,
WP_AltBottomLeftRightNum);
const
WP_HardReturn = ^J;
WP_HardPage = ^L;
WP_HardSpace = #160;
WP_RightJustOn = #129;
WP_RightJustOff = #130;
WP_MergeFieldEnd = ^R^J;
WP_MergeRecordEnd = ^E^L;
function WP_Header : String;
(* Returns string containing header for WP 5.0
document. The calling program should write
the string at the beginning of the WP 5.0
file. *)
function WP_Attrib_On(Attrib : WP_TextAttribute)
: String;
(* Returns string containing code to turn on
specified print attribute, e.g., WP_Underline. *)
function WP_Attrib_Off(Attrib : WP_TextAttribute)
: String;
(* Returns string containing code to turn off
specified print attribute. *)
function WP_Set_PageNumPos(Pos : WP_PageNumPos)
: String;
(* Returns string containing code to set page number
position. *)
(* ----------------------------------- *)
implementation
function WP_Header : String;
(* Returns string containing header for WP 5.0
document. The calling program should write
the string at the beginning of the WP 5.0
file. *)
const
HeaderSize = 76;
HeaderInfo : array[1..HeaderSize] of Char =
(#$FF, #$57, #$50, #$43, #$4C, #$00, #$00, #$00,
#$01, #$0A, #$00, #$00, #$00, #$00, #$00, #$00,
#$FB, #$FF, #$05, #$00, #$32, #$00, #$00, #$00,
#$00, #$00, #$06, #$00, #$08, #$00, #$00, #$00,
#$42, #$00, #$00, #$00, #$08, #$00, #$02, #$00,
#$00, #$00, #$4A, #$00, #$00, #$00, #$00, #$00,
#$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00,
#$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00,
#$00, #$00, #$08, #$00, #$7C, #$00, #$78, #$00,
#$00, #$00, #$00, #$00);
begin
WP_Header := HeaderInfo
end; (* of WP_Header *)
function WP_Attrib_On(Attrib : WP_TextAttribute)
: String;
(* Returns string containing code to turn on
specified print attribute, e.g., WP_Underline. *)
begin
WP_Attrib_On := Chr($C3) + Chr(Ord(Attrib))
+ Chr($C3)
end;
function WP_Attrib_Off(Attrib : WP_TextAttribute)
: String;
(* Returns string containing code to turn off
specified print attribute *)
begin
WP_Attrib_Off := Chr($C4) + Chr(Ord(Attrib))
+ Chr($C4)
end;
function WP_Set_PageNumPos(Pos : WP_PageNumPos)
: String;
(* Returns string containing code to set page number
position. *)
begin
WP_Set_PageNumPos := Chr($D0) + #8 + #10#0 + #0#0#0
+ Chr(Ord(Pos))
+ #0#0 + #10#0 + #8 + Chr($D0)
end;
begin
(* No initialization code *)
end.
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/