🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by fairfield Mon, 25 Jan 1993 23:09
KHF$FORMAT.1-OF-3, V2.2 (EVE Justify/Unjustify)
#139
Author: fairfield
Date: Mon, 25 Jan 1993 23:09
309 lines
15907 bytes
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_UNPACK_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 8.2
$!   On 25-JAN-1993 14:27:51.69   By user FAIRFIELD (Ken Fairfield)
$!
$! The VMS_SHARE software that created this archive
$!    was written by  Andy Harper, Kings College London UK
$!    -- December 1992
$!
$! Credit is due to these people for their original ideas:
$!    James Gray, Michael Bednarek 
$!
$!+ THIS PACKAGE DISTRIBUTED IN 3 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. KHF$FORMAT.README;1
$!       2. KHF$FORMAT.TPU;12
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_UNPACK_TEMP","SYS$SCRATCH:."+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if .not. f$trnlnm("SHARE_UNPACK_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto start
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$unpack: subroutine ! P1=filename, P2=checksum, P3=attributes
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'"
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn' File skipped"
$ delete 'f'*
$ exit
$dirok:
$ x=f$search(P1)
$ if x .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped"
$ delete 'f'*
$ exit
$file_absent:
$ w "-I-UNPACK, Unpacking file ", P1
$ n=P1
$ if P3 .nes. "" then $ n=f
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='n'
PROCEDURE GetHex(s,p)LOCAL x1,x2;x1:=INDEX(t,SUBSTR(s,p,1))-1;x2:=INDEX(t,
SUBSTR(s,p+1,1))-1;RETURN 16*x1+x2;ENDPROCEDURE;
PROCEDURE SkipPartsep LOOP EXITIF MARK(NONE)=END_OF(b);EXITIF INDEX(ERASE_LINE,
"-+-+-+-+-+-+-+-+")=1;ENDLOOP;ENDPROCEDURE;PROCEDURE COPY_PREVIOUS(b,n)LOCAL m,
s,e;m:=MARK(NONE);MOVE_HORIZONTAL(-b);s:=MARK(NONE);MOVE_HORIZONTAL(n-1);e:=
MARK(NONE);POSITION(m);COPY_TEXT(CREATE_RANGE(s,e));ENDPROCEDURE;
PROCEDURE ProcessLine LOCAL c,s,l,b,n,p;c := ERASE_CHARACTER(1);s :=
 ERASE_LINE;IF c = "X" THEN SPLIT_LINE; ENDIF;MOVE_HORIZONTAL(-1);l := LENGTH(
s);p := 1;LOOP EXITIF p > l;c := SUBSTR(s,p,1);p := p+1;
CASE c FROM ' ' TO '`' ['\']: b:=GetHex(s,p); n:=GetHex(s,p+2); p:=p+4;
 COPY_PREVIOUS(b,n);['`']: COPY_TEXT(ASCII(GetHex(s,p))); p:=p+2;[' ']: p:=p+1;
[INRANGE,OUTRANGE]: COPY_TEXT(c);ENDCASE;ENDLOOP;ENDPROCEDURE;
PROCEDURE Decode POSITION(BEGINNING_OF(b));LOOP EXITIF MARK(NONE)=END_OF(b);
IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+-")=1 THEN SkipPartSep;ELSE ProcessLine;
MOVE_HORIZONTAL(1);ENDIF;ENDLOOP;ENDPROCEDURE;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);t:="0123456789ABCDEF";f:=GET_INFO(
COMMAND_LINE,"file_name");b:=CREATE_BUFFER(f,f);Decode;WRITE_FILE(b,GET_INFO(
COMMAND_LINE,"output_file"));QUIT;
$ if p3 .eqs. "" then $ goto dl
$ open/write fdl &f
$ write fdl "RECORD"
$ write fdl P3
$ close fdl
$ w "-I-CONVRFM, Converting record format to ", P3
$ convert/fdl=&f &f-1 &P1
$dl: delete 'f'*
$ checksum 'P1'
$ if checksum$checksum .nes. P2 then $ -
  e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ exit
$ endsubroutine
$start:
$!
$ create 'f'
X
X`20`20`20\0303`20`20As`20noted`20`20in`20`20the`20`20original`20`2018-DEC-1992
V`20`20announcement\2503f`20`20this\4905package,`20`20I`20`20have`20chosen`20to
V`20use`20slightly`20modified`20versions\4805EVE'\4907rocedures`20EVE_FILL_PARA
VGRAPH`20`20an\A803EVE$FILL_RANGE`20`20while`20`20retaining
X\4904their\CB0Cnames.\1A03\A203did`20this\9F04avoid`20unnecessary`20duplicate
X\4904code`20in`20an`20already`20large`20section`20file.
X\2C05\0404Some`20people`20have`20informed`20me`20`20privately\A204at\A704y`20p
Vrefer`20a`20mor\7506modular\0A03approach`20`20(I\EB03onde\1703why?\1D03:-)`20
V\FF04\1F04makes`20\5104m`20`20less\4905susceptible`20to`20EVE`20vers\B804`20ch
Vanges.`20`20`20If`20`20you`20`20wis\4C03to`20`20take\4F04is\4905\8808,`20simp
V\C003do\6C04`20following:
X\2805o`20Change`20all`20occurances`20of\7D04$FILL_RANGE`20to`20KHF$\120A.
X\4128PARAGRAPH`20\450C\1609\4908Delete`20procedure\4104_F\410Efrom\E605`20modu
Vle.
X
X\3E05\0404Ken`20Fairfield`20\1608\0909\0909January`2023,`201993\420AStanford
V`20Linear`20Accelerator`20Center\2B09P.O.Box`204349,`20M/S`2098\4811,`20CA`20
V`2093409
X\1C08USA
X\0D09Internet:\B90A@Slac.\4208.Edu\2E09DECn\2C04`20`2045537::FAIRFIELD`20(
V\1205=SLACVX)\3209BITNET\0A04\600Evx
X
X--------\0808\1010\2020\0C0C
X
X\7305KHF$FORMAT`20V02-002\8908\0808\1010\070725-JAN-1993
X\BD09I`20discovered`20a`20bug`20in`20`20the`20`20procedure`20Khf$Justify`20whi
Vch`20has`20been\4905corrected`20\3D07is`20version.`20`20The`20\5805s`20obvious
V`20when`20it`20`20occurs`20`20(a
X\4904line\4304\6406\8504last`20word`20extend\2C03past`20\A206righ\0C03margin),
V`20`20but
X\4904generally`20`20onl\0604\6907if\3B06paragraph`20or`20box`20being`20justifi
Ved`20is\4905relatively`20narrow.
X\1805\0404\D904follow\3B04conditions`20are`20necessary`20for`20\7304bug`20to
V\8A06:
X\4609o`20Given`20a`20\FE05\8907\8A0B`20that`20`20(1)`20needed`20to`20have`20M
V\4509`20`20spaces`20`20added,`20`20and\34032)\EF05re`20were`20`20N`20`20word
V`20`20gaps\0C03here\450Badditional\5008could`20be\5806;
X\B70BM`20was`20exactly`20divisible`20by`20N`20(`20MOD`20(M,N)`20=`200`20);
V\3B0D/N\3D05greater`20than`20one.\2506If`20all\B904se`20conditions`20\C405met,
V\1B04\3105`20too`20many`20\B007\5604added\4905in`20each`20\F409.`20`20`20This
V`20`20result\0903in`20\4F04`20`20last`20`20\2B06of\1405line\4905extending`20p
V\2604\1C04right`20margin\B807\0404The`20problem`20\8D05`20logic`20error`20(mi
V\B503:-(`20)`20which`20led`20to`20incorrect
X\B806itialization\8E08variable`20`20"the_fill"\B103hen`20\1F0D"nbig"\4905
V\8204zero`20and`20"small_spaces"`20\1C04longer`20than`20one`20space\CE0BVers
V\82042-002`20\A307s`20this`20`20\E708\5D05incorporates`20two`20other
X\4504minor`20changes`20with`20respect\FA04\BB04\F007`20releas\8105--------
V\0808\1010\2020\0C0C\D006KHF$FORMAT`20V02-001`20UPD`20\EB08\0909\111122-DEC-19
V92
X\4A05Well,`20I`20can't`20seem\C904leave`20well`20enough`20alone...\3606\0404In
V`20looking`20at`20the`20Khf$Justify`20procedure`20in\AF0B.TPU,`20which
X\4505`20posted`20a`20few`20days`20ago\9204got`20to`20thin\6506bout`20all`20
V\6C04unnecessary
X\4904work\1905Eve$Current_Word`20is`20do\4104\8A04`20terms`20`20of`20creat
V\1804marks`20and\4905ranges.`20`20`20Since`20`20DEC`20TPU`20developers`20have
V`20noted`20on\A204s`20list\6207he\4905past`20that\6A13\6607\9C04"expensive"
V`20in`20TPU,`20\2204since\4905\D604JUSTIFY`20comm\1E04takes`20a\8504iceable
V`20amount\DA04`20tim\B903to`20`20complet\4906(compared`20\1C05a`20`20simple
V`20`20FILL`20`20for`20example),`20I've`20replaced`20calls`20to\4905Eve$Current
V_Word`20`20by\1606End_of_Word.`20\2A03I`20`20`20won't`20\6D03ay\CD04at\D305
V\4905performance`20is`20\CE09y`20better,`20but`20it`20_is_`20an`20improvement.
V
X\4305\0404Below`20\4204\D504VMS_SHARE`20\D303il\DF03which`20`20contain\2603KHF
V$FORMAT.UPD.
X\D505xtract\9C04\430B\4105(into`20something`20like`20F\4006SHARE),`20strip
V\4905ou\E205is`20message`20down`20to`20\5B04"CUT`20HERE"`20line,`20and`20@F
V\4D0B\2704\4905result\7104\8705.`20\1403Then\0703us\D703\5005`20`20SUMSLP
V\0903editor\1804o`20\2303pdat\4906\EF0BTPU:
X
X\1504\0404\0808$`20EDIT/SUM\2C0F`20/UPDATE=K\170AUPD\420A-Ken
X
X`20--------\0808\1010\2020\0C0C\5D06\710A`20V02-001\B510\1010\080818-DEC-1992
X\4B05Greetings`20All!\BC0AHere's`20a`20Holiday`20gift`20for`20`20everyone`20
V`20in`20INFO-TPU`20land.`20`20I've`20been
X\4604stimulated`20`20by\0403oth`20`20Hunter`20Goatley's`20and`20Ken`20Selvia's
V`20`20EVE`20`20Justify\4A05procedures`20to`20merge`20paragraph`20justification
V`20with`20the`20FILL,`20FILL`20RANGE\4A05\6D04\1305PARAGRAPH`20commands`20
V\D103\3804current`20`20version`20`20of`20\9404\E103`20Also,\4A05there\AE04new
V`20`20functionalit\EB03in`20TPU`20that`20wasn't`20available`20when`20Hunter
V\9409Ken`20wrote\5804ir\7C08s,`20so`20`20hopefully,`20this\9A09is`20a`20little
V
X\4A04more\D004pact`20(e.g.,`20compare`20Hg$Squeeze_Range\7706hf$Fill_Edit).
X
X\4604\0404First,`20I`20took`20\AD06's`20idea`20of`20`20alternately`20filling
V`20out`20the`20lines
X\4604from`20`20\1404`20right\7405then`20\1A05\2D05eft,`20\1804supplemented`20
V\1C03at`20`20with\4A06\6407\3809center\8C04\7308\8004ward\4E06\7B06both`20`20e
Vnds`20`20of\4A05\8E05\3005`20toward\1B03\1405\5206.`20`20`20Thus,`20`20on`20
V\9503ccessive\3506\2D03in`20a\4A05paragraph`20or`20range,`20\2407ar\3003fill
V\CB04\8B06\B50A-out\C909\4A05outside-in,\2F0C`20right\A80A\EA05eft,\E205\290Cl
Veft\DE06\2B0Bright\D003This`20alternation`20of\9C05ing`20`20pattern\B403help
V\0703\9408\DE0Aappear`20more`20balanced.
X\2505\0404Second,`20I`20took`20Ken's`20idea`20\6904`20using`20Eve$Current_Word
V`20to`20pick`20out\4A05each`20`20word`20`20in`20a`20line`20\E804st\7904\D105es
Vults\2005n`20array\DF03I`20`20use`20\B909ranges`20as`20returned`20`20from`20
V`20\8511`20rather`20`20than`20\6405`20corre-
X\4A04spond\BE04`20stri\0804that`20\E304\7304s,`20but\1405's`20a`20detail\9205a
Vlso`20imple\4A06mented`20\6105"extra\5E04ac\0F03follow\5E05\1504entence"`20
V`20which`20`20both`20these\4A05gentlemen`20had`20done,`20if`20in\3E03slightly
V`20different`20way.
X\3905\0404Third,`20and`20`20perhaps`20`20mos\D403important,`20\C003`20integrat
Ved`20\B605justify
X\4604procedur\BD03`20within`20`20`20EVE'\4D03FILL\4203FILL`20`20PARAGRAPH`20
V\7306\1606`20RANGE\4A0Es.\9D03o`20do`20this,`20I`20split`20\7B04original`20Eve
V_Fill_Paragraph\A704o
X\4A04two`20`20`20routines\8203`20a\0403"stub"\9E04\3B11\2304\9606\2B06`20new
V\4A05Eve$F\2B0D\9C04he`20latter`20contains`20all`20of\A306ld`20code,`20with
V`20my
X\9405he`20`20small`20`20additions\7803including`20`20optional`20input`20parame
Vters,`20which`20I
X\4A04required`20in`20order`20to`20implement\6906justification\B305us`20I`20hav
Ve`20added\4A05just\F104handfu\C105lines`20to`20\FA09Range`20and\130AParagraph
V`20and\4A05\5906voided`20\8204ne\0904o`20add`20`20duplicat\9903code\F504`20
V`20\A812\4A05procedure`20\9E05to`20find`20\8004fill`20p\7C08s.
X
X\3104\0404The`20result`20is`20three`20new`20EVE`20commands:`20JUSTIFY,`20
V\0907`20PARAGRAPH,
X\4604\6404\1B08RANGE.\5A06\5107`20are`20`20entirely`20`20analogous`20to`20
V\CE04three\4A05corresponding`20FILL\8709\5403For`20instance\8D0A\7E11\4A05wi
V\F403`20work`20`20on`20`20a`20BOX`20selection`20in`20addit\0C04to`20\2003`20no
Vrma\3503\2509.
X\4A04Paragraph`20indention,`20positive`20or`20negative,`20_is_`20respected`20b
Vy`20\9907.
X\4B05\0404Finally,`20I`20found`20`20there`20`20w\0605times`20\1D03`20might
V\1703an\0603to`20undo`20the\4A05spacing`20`20that`20`20\6707`20had`20done.`20
V`20Unlike`20earlier`20versions`20of`20EVE\F103nd\4A05TPU,\5704`20current`20
V\2A07\2904`20FILL`20`20leave\9503embedded`20\7F0Aintact.
X\4A05hu\BA06have`20supplied`20three`20corresponding`20UN\B208commands.\4004es
V\DE06use`20\9304same`20procedure\EC06\3908\2504s`20before`20fill\5804out`20lin
Ves`20to\4A05first`20\6604press`20out`20extra`20spaces,`20and\6C04n`20add`20one
V`20\1F0B`20at`20the\4A05end`20of`20each`20`20sentence\B603\B704\1E03ffec\6903i
Vs`20`20like`20`20Ken'\0D03"ragged-right"\4A05justification`20(I`20call`20
V\DD05NO\1E0F:-).
X
X\3604\0404I`20have`20packaged\9C04`20modified`20\C904`20new`20FILL,`20JUSTIFY
V\1705UN\0E07\4A05procedures\B003nto`20a`20singl\4C05ule,`20KHF$FORMAT,`20whi
V\F203can`20be`20used`20as-is\4A05to`20EXTEND`20TPU`20*,`20or\2A08included`20in
V`20your`20xxx$MASTER.FILE`20`20for`20\5104\4A05with`20`20EVE$BUILD.\ED05`20wil
Vl`20`20se\DA04out`20\980A\5704three`20VMS_SHARE'd
X\DE05arts`20following`20this`20note.`20`20As\5604comment`20\4305at`20file,`20m
Vodifications\DE08\9204\5303rocedures`20are`20clearly`20labeled`20\BC05"!\9E04"
V`20at`20`20the`20`20e\B505f
X\4A04affected`20lines.\1203Furthermore,`20\9208s`20\3F0Abeginn\C104`20of\1405
V\DE06\8B08`20Khf$Justify`20outline`20ways`20\3F04user`20can\D606y`20\1404patte
Vrn`20\9407filling,`20etc.,\ED04suit`20an`20individual's`20taste`20or`20needs.
X
X\3C04\0404Use`20and`20enjoy!`20`20Co\C407are`20hereby`20solici\F904;-)
X\3B09\0808Cheers,`20Ken
X--
X`20Dr.`20Kenneth`20H.`20Fairfield`20\2C03`7C`20`20Internet:`20\1A09@Slac.Stanf
Vord.Edu
X`20SLAC,`20P.O.Box`204349,`20MS`2098`20\4605DECn\4404`20`2045537::FAIRFIELD
V`20(45537=SLACVX)
X`20S\5807,`20CA\300394309`20\BC07\4A03BITNET\0D04\900Evx
X`20--------\0808\1010\2020\0C0C
$ call unpack KHF$FORMAT.README;1 1769806412 ""
$!
$ create 'f'
Xprocedure`20KHF$FORMAT_MODULE_IDENT
X`20`20`20`20return`20"V02-002";
Xendp\3B08;
X
X!++
X!\2903\450A.TPU
X!\1505The`20\2D09s`20found`20here`20implement`20new`20EVE`20commands`20JUSTIFY
V,`20\0907\4A05PARAGRAPH,`20and`20\1B07`20RANGE.`20`20In`20order`20to`20avoid
V`20duplicate`20code,`20the
X\4904various`20\7304FILLxxxx\A40Care`20\A80A,`20slightly`20modified`20to\4905s
Vupport`20calls`20to`20Khf$Fill_Edit`20\A604Khf$Justify.`20`20The`20\4506cation
Vs\4705\7004indicated`20by`20a`20"KHF"`20comments\3A03Eve_Fill_paragraph`20was
V`20split`20in\9107two`20\C90Bto`20facilitate`20access`20from\4F05\9707_P\5208.
V
X!
X!
X\4804Mo\E907\4D0Bextrac\A204\4206VE$FORMAT.TPU`20(V02-100b):
X!`09`09`09`09`20\4703\0303--------\0606
X!`09eve_fi\C90C`09`09Now`20calls`20eve$f\1E0D\3306\150F`09`09Fill`20p\1008`20b
Vetween`20margins`20using\8906\8A03spaces\4A0Crange`09\4707a`20range\FC07New
V`20\F70Bin`20this`20file:
X!
X!`09Eve_Justify`09\4208nd`20j\1306\4E08`20or`20\C50C\360B_P\C80F\3F0E\3618Ra
V\B405\3211the`20selected\CA08\3905Un\2307\A707_Edit`20\3B04fil\F709\A914\3A09
V\AB10\4311\3A1A\AF0B\360F\B115Khf$\EA07\AF03Does\2805work`20of`20right-\5C07in
Vg
X!`09\2703`09`20\C608\4207\6E09\1C03Prepares`20\E908for`20filling
X!
X!`20Author/Date:`09`09K.H.`20Fairfield,`09`0917-DEC-1992
X\2F04Revisions:
X!
X!--
X
X
X!--------\0808\0909Modified`20EVE`20Procedures\3019-----
X
X
Xpr\2B07`20eve_fill_paragraph
X
X`20`20`20`20return`20(eve$f\200D);
X
Xendp\4308;`09`09!\4715\660E\460F\3403Fill`20p\1108`20between`20margins`20using
V`20spaces
X!`09`20`20\CA13\1603\AC03(;do_justify,`09!`20Flag`20whether`20to`20j\1B06`20th
Ve\700A
X`09`09`09\2C03\3E03DEFAULT`20=`20FALSE)\5607`20`20do_fill_edit)`09\5812callKhf
V$Fill_Edit`20before\5B09fill\600C\A70A)
X
Xlocal`09saved_mark,\3404Marker`20for`20current\0804sor`20position
X`09start_\C909\F204\370Bstart`20of`20\4008\F20Bstop\390C\3A0Eend`20\3816the_ri
Vght_margin,\1306left\120Eindent,
X`09fill_range;`09\6603Range\D60D\5E0A
Xon_error
X`20`20`20`20`5BOTHERWISE`5D:
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-
-- 
 Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
 SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
 Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
 ----------------------------------------------------------------------------
 These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads