home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / vmsnet / tpu / 607 < prev    next >
Encoding:
Text File  |  1993-01-25  |  5.6 KB  |  140 lines

  1. Newsgroups: vmsnet.tpu
  2. Path: sparky!uunet!stanford.edu!agate!spool.mu.edu!uwm.edu!linac!unixhub!umahe1.slac.stanford.edu!fairfield
  3. From: fairfield@umahe1.slac.stanford.edu
  4. Subject: KHF$FORMAT.3-OF-3, V2.2  (EVE Justify/Unjustify)
  5. Message-ID: <1993Jan25.151015.1@umahe1.slac.stanford.edu>
  6. Lines: 129
  7. Sender: news@unixhub.SLAC.Stanford.EDU
  8. Organization: Stanford Linear Accelerator Center
  9. Date: Mon, 25 Jan 1993 23:10:15 GMT
  10.  
  11. -+-+-+-+-+-+-+-+ START OF PART 3 -+-+-+-+-+-+-+-+
  12. X`09`20`20`20`20temp`20:=`20\530F;
  13. X\1E05Exitif`20(CURRENT_CHARACTER`20=`20"");`09\2504!`20Line_end`20condition.
  14. X\1B05indx\5E04\0805+`201;\1706khf$x_word_array`20`7Bindx`7D`20:=`20Mark`20(NON
  15. VE);
  16. X`09Endloop;
  17. X
  18. X`09ngaps`20\4C07;`09`09`09\7C07Number\EA04gaps
  19. X`09E\B307\3006<=`200);`09\2D08Can't`20justify`20one`20word...
  20. X`09If`20(nspaces\3604ngaps)
  21. X`09Then
  22. X\3E05nsmall\8204\2707\CD07nbig\0703:=`200;\1206small_fil\2E05"`20";\1806the_
  23. V\1605\2E05\1806Else\3608_size`20\1E06\8B08/`20ngaps;`09\C106Size`20of`20\630A
  24. V\850D\3D0F-`20(s\5607*`20\D206\B508\CD06\3008gaps\2E03nbig;`09\6B07Number
  25. V\6D0E`20gaps\4206If`20(\7605>`200)\1306Then\0A06`09t\EB08:=`20Substr`20(eve$kt
  26. V_spaces,`201,\9E09+1))\9907Else\442D\4307\4009ndif\0C07\B80B\431D\440C\4007
  27. X!+
  28. X!`20`20Choose`20the`20filling`20pattern`20based`20on\1D05variable\2605_type.
  29. V`20`20Patterns
  30. X\4903are`20from`20\2E04center`20outward,`20\1909outside`20towards`20\2D0A
  31. V\2506\4A04\1404right`20\260Cbeginn\A004of\1105line,`20and\5E0Aleft\3508\4A08en
  32. Vd`20o\320A.
  33. X!-
  34. X`09Case`20\CA09`20F\41041`20To`204
  35. X
  36. X`09`20`20`20`20`5B1`5D:`09`09`09\0B04!`20Fill`20t\29041:`20`20\0E05gaps`20star
  37. Vting
  38. X`09`09indx1`20:=`20(ngaps/2)`20+`201;\4004`20!`09at`20t\E909\8E0C\BF04\3E072
  39. V`20:=`20indx1;`09\7806`09worki\F104utward.`20`20Variable
  40. X\3406`20`20:=`20\300A"indx"`20is`20just`20a`20coun\7204here.
  41. X`09`09Loop\0703\2E04Exitif`20(\4705>`20(nsmall+nbig));
  42. X\2506Position`20(khf$x_word_array`20`7Bindx1`7D)\2B08Copy_Text`20(the_fill)
  43. V\1C08\AB09\0905+`201;\190B\F8092`20-`20\1A09If\9B07=`20(nbig+1))\1B07Then
  44. V\0B03`09t\6707\4004small_fill\4108Endif;\ED4C2`7D\ED2A\EC171`20\19071`20\1A0B
  45. V\EC4AEndloop;
  46. X
  47. X`09\1804`5B2`5D:\3D03\0B04!`20Fill`20type`202:`20\0E06gaps`20starting
  48. X`09`09\A3091;\3607`09both`20ends`20of`20the`20line`20and`20work\34072`20:=`20n
  49. Vgaps\3809toward\3205center.`20`20Variable
  50. X\3606`20`20\6A0D"indx"`20is`20just`20a`20counter`20here.\3403Loop\F108xitif
  51. V`20(i\4704>`20(nsmall+nbig));
  52. X\2506Position`20(khf$x_word_array`20`7Bindx1`7D)\2B08Copy_Text`20(the_fill)
  53. V\1C08\AB09\0906+`201;\1A0B1`20\1A071`20\1A0BIf\9C07=`20(nbig+1))\1B07Then
  54. V\0B03`09t\6807\4004small_fill\4108Endif;\EE4C2`7D\EE33\ED0F2`20\19072`20-`20
  55. V\ED53Endloop\0B04\3503\1B04!`20Fill`20type`203:`20\0E06gaps`20starting
  56. X\2805`5B3`5D:\3308`09from`20the`20right,`20working`20toward
  57. X`09`09\AE05:=`20ngaps;`09\3707\3204beginn\2D04of\4305line.
  58. X`09`09Loop\AF08xiti\F408<=`20(ngaps-nsmall-nbig));\2C07Position`20(khf$x_word_
  59. Varray`20`7Bindx`7D)\2A08Copy_Text`20(the_fill\1C09\B008\0805-`201;\1807If
  60. V\8607\850Abig))\1F07Then\0B03\D904_fill\4304small_fill\4508Endif;\0D03Endloop
  61. V\0B04\3503\1B04!`20Fill`20type`204:`20\0E06gaps`20starting
  62. X\2805`5B4`5D:\3308`09from`20the`20left,`20working`20toward
  63. X`09`09\CD081;\3208\2D04end`20of\3806ine.\2903Loop\A408xiti\ED08>`20(nsmall+n
  64. V\EE05\C908Position`20(khf$x_word_array`20`7Bindx`7D)\2A08Copy_Text`20(the_fill
  65. V\1C09If\6707=`20(nbig))\1907Then\0B03\AE04_fill\C404small_fill\3F08Endif;
  66. V\0D07\EB08\0805+`201;\1803Endloop\0B04fill_type`20:=`200;`09`09!`20Reset`20so
  67. V`20it's`201`20next`20time`20through
  68. X`09Endcase;
  69. X`09\400D\0D0A\6905\8C0B\0C05Move_Vertical`20(1);
  70. X\8A09
  71. XSet`20(saved_mode,`20CURRENT_BUFFER);
  72. XPosition\2708po\1006);
  73. X
  74. XReturn`20(TRUE);
  75. X
  76. XEndprocedure;\D504Khf$Justify
  77. X
  78. X`0C
  79. X!++
  80. X!\9303This`20p\2A08`20prepares`20a`20range`20for`20(paragraph)`20filling`20and
  81. V`20possibly
  82. X\4904justifying.`20`20All`20leadi\2A07trai\3705spac\5E04re`20trimmed,\2105sent
  83. Vences\4C05have`20an`20additional\3906`20appended`20to`20their`20ends.
  84. X!\3704Author/Date:`09`09K.H.`20Fairfield,`09`0917-DEC-1992
  85. X!--
  86. X
  87. XPr\F608Khf$Fill_Edit
  88. X!`09`20`20------\0606-
  89. X\1103`20(range_arg)`09`09!`20Range\8704edit.
  90. X
  91. XLocal`09saved_mode,`09!`20Save`20current`20mode`20of`20the`20buffer
  92. X`09end_mark,\2D03End`20of`20\6609
  93. X`09found_range\2104An\ED04\2404sentence
  94. X`09term_patt;\2103Pattern`20\220B`20terminators
  95. X
  96. Xs\9E09`20:=`20Get_Info`20(CURRENT_BUFFER,`20"mode");
  97. XSet`20(INSERT,`20C\260D);
  98. X
  99. X!+
  100. X!`20`20Following`20p\8107assignment`20will`20match`20a\C005-of-\9E09within`20a
  101. V\4704line`20or`20at`20the\EB08a`20line.
  102. X!-
  103. Xt\EC08\BD04("."`20`7C`20"!"\0604?")`20+`20("`20"\0E03LINE_END\A20ASqueeze`20ou
  104. Vt`20excess`20spaces.
  105. X!-
  106. XEdit`20(range_arg,`20COMPRESS,`20TRIM,`20OFF\EE0Bind`20\C109terminators`20and
  107. V`20add`20a\5D06.
  108. X!-
  109. Xend_mark`20:=`20End_Of\6A0B);
  110. XPosition\160ELoop
  111. X`20`20`20`20found_range\4204Search_Quietly`20(term_patt,`20FORWARD);
  112. X\3804Exitif`20(\400C=`200)\1E06\750A\9308\280B))\430EMark`20(NONE)`20>`20e
  113. V\D007\2507Copy_Text`20("`20");
  114. XEndloop;
  115. X
  116. X!+
  117. X!`20`20If`20there's`20a`20trailing`20final`20space`20at`20the\5904`20of`20
  118. V\8305_arg`20(the`20usual`20case),\4F04erase`20it.
  119. X!-
  120. X\C70A\960BMove_Horizontal`20(-1);
  121. XIf`20CURRENT_CHARACTER`20=`20"`20"
  122. XThen
  123. X\F105rase_Character`20(1);
  124. XEndif;
  125. X
  126. XSet`20(saved_mode,\4F09BUFFER);
  127. X
  128. XReturn`20(TRUE);
  129. X
  130. XEndprocedure;`09`09!`20Khf$Fill_Edit
  131. $ call unpack KHF$FORMAT.TPU;12 1850775168 ""
  132. $ v=f$verify(v)
  133. $ exit
  134. -- 
  135.  Dr. Kenneth H. Fairfield    |  Internet: Fairfield@Slac.Stanford.Edu
  136.  SLAC, P.O.Box 4349, MS 98   |  DECnet:   45537::FAIRFIELD (45537=SLACVX)
  137.  Stanford, CA   94309        |  BITNET    Fairfield@Slacvx
  138.  ----------------------------------------------------------------------------
  139.  These opinions are mine, not SLAC's, Stanford's, nor the DOE's...
  140.