home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / fish / 911-930 / ff925 / donsgenies / frenchgenies.lha / Rexx / AjoutAutoDeStyles.pprx next >
Text File  |  1993-08-03  |  28KB  |  680 lines

  1. /*
  2. @BAjoutAutoDeStyles @P @I Ecrit et © par Don Cox en septembre 1992
  3. @IRévisé en avril 1993. N'est pas du Domaine Publique. Tous Droits
  4. @IRéservés.
  5. Traduit par Fabien Larini le 01/08/93.
  6.     
  7. Ce Génie crée automatiquement de nouveaux formats de style en examinant 
  8. tout le texte dans un document. Si du texte est dans un style qui
  9. n'existe pas parmis la liste des formats de style, un nouveau format est
  10. crée et le texte reçoit ce format. Les formats sont nommés avec une
  11. description simplifiée de la police de caractère, vous pouvez modifier ces
  12. noms de formats. 
  13. */
  14.  
  15. /* StyleTagsAutoCreate3*/
  16. /* This genie creates new style tags automatically by examining all the text
  17. in a document. If any text is in a style which does not match an existing 
  18. tag, a new tag is created and the text is set to that tag. Tags are named 
  19. with a simplified description of the typeface; you can alter any of these 
  20. names to anything you wish (using the "Style Tags Modify" menu item). If you
  21. modify the tag, its typeface name might no longer suit it. 
  22. Don Cox © Sept 92 Revised April 93. Not Public Domain. All rights reserved.  */
  23.  
  24. /* Method: load in typographic data from article texts. If an existing style is
  25. used, see if it is modified (further data after the style name). Ignore any 
  26. data for text after the first letter. If no existing style is used, assemble
  27. the data and compare with all existing styles to see if there is a match. If
  28. not, suggest a name for a new style, create it and apply it to the block.
  29. Note that style tags can be inspected by saving them (Style Tag menu) and 
  30. then loading the resulting file into a text editor.  */
  31.  
  32.  
  33. trace n
  34. if ~show(l, "gdarexxsupport.library") then
  35.     if ~(exists("libs:gdarexxsupport.library") & addlib("gdarexxsupport.library", 0, -30)) then
  36.         exit_msg("Installez gdarexxsupport.library dans votre répertoire Libs: avant d'utiliser ce Genie !")
  37.     
  38.  
  39. address command
  40. call SafeEndEdit.rexx()
  41. call ppm_AutoUpdate(0)
  42.  
  43. prevdoc  = ppm_GetDocName()
  44.  
  45. if ppm_DocChanged() then
  46. do
  47.     if ppm_SavedDate() = "Not Saved" then prevdoc = ""
  48.  
  49.     if ppm_Inform(2, "Vous devez d'abord sauver ce documet. Sauve et continue?", "Cancel", "Ok") then
  50.                 call ppm_SaveDocument(prevdoc)
  51.     else
  52.             call exit_msg("Non Sauvé, abandon")
  53.  
  54.     prevdoc = ppm_GetDocName()
  55. end
  56.  
  57. cpage   = ppm_CurrentPage()
  58.  
  59.  
  60. tolerant = ppm_Inform(2,"Ignore les caractères gras, italiques et soulignés ?","Non","Oui")
  61. call ppm_ShowStatus("Travail en cours ...")
  62.  
  63. existing = 0   /* flag for style matching existing style  */
  64. randval = (randu() * time(s)) % 1 /* mark boxes with random number to avoid doing them twice */
  65. box = ppm_DocFirstBox()
  66.  
  67. do while box ~= 0
  68.  
  69.     info    = upper(word(ppm_GetBoxInfo(box), 1))
  70.  
  71.     if (info = "TEXTE") & (ppm_GetBoxUserData(box) ~= randval) then do
  72.         oldbox = box
  73.         box = ppm_ArtFirstBox(box)
  74.         text = ppm_GetArticleText(box, 1)
  75.         call ppm_ShowStatus("Analyse du texte commençant boîte "box)
  76.         if text  = '' then iterate
  77.  
  78.         call clearcodes /* initialize style tag codes */
  79.  
  80. position = 1
  81.  
  82.         do x = 1 to 10000  /* big number - go right through article  */
  83.             change = 0
  84.             notcode = 0
  85.             position = parsecodes(position) /* parse a block of codes in text */
  86.             if position = 0 then break /* given by "\." code - end of text */
  87.             if stylecode = "dS" then iterate
  88.             if notcode = 1 then iterate   /* non-style codes  */
  89.  
  90. /* put together style definition from text */
  91.             trackstring = "\t<"tracking">"
  92.             if tracking = "" then trackstring = ""
  93.             linespacestring = "\"linespacecode"<"||linespace||">"
  94.             if linespacecode = "" | linespace = "" then linespacestring = ""
  95.             fontnamestring = "\ff<"fontname">"
  96.             if fontname = "" then fontnamestring = ""
  97.             fontsizestring = "\fs<"fontsize">"
  98.             if fontsize = "" then fontsizestring = ""
  99.             colourstring = "\c<"colour">"
  100.             if colour = "" then colourstring = ""
  101.             paravaluestring = "\pv<"paravalue">"
  102.             if paravalue = "" then paravaluestring = ""
  103.             paraspacingstring = "\ps<"paraspacing">"
  104.             if paraspacing = "" then paraspacingstring = ""
  105.             fillpatternstring = "\FP<"fillpattern">"
  106.             if fillpattern = "" then fillpatternstring = ""
  107.             if fillpattern = "\Fp" then fillpatternstring = "\Fp"
  108.  
  109.             styledefinition = "\"paracode||paraname ||typestyle ||bold ||italic ||outline ||underline ||shadow ||superscript ||subscript || fontnamestring|| fontsizestring|| justification|| kerning|| hyphenation|| linespacestring|| trackstring||colourstring ||fillpatternstring
  110.             
  111.             if tolerant = 1 then styledefinition = "\"paracode||paraname ||shadow|| fontnamestring|| fontsizestring|| justification|| kerning|| hyphenation|| linespacestring|| trackstring||colourstring ||fillpatternstring
  112.             
  113. /* see if new definition matches any of the old ones */
  114.             stylelist = ppm_GetStyleTagList()
  115.             stylelistTest = stylelist||"0a"x
  116.             parse var stylelist NumberOfTags "0a"x stylelist
  117.             tagchange = 1
  118.  
  119.             if NumberOfTags~=0 then do
  120.                 do t=1 to NumberOfTags
  121.                     parse var stylelist thisname "0a"x stylelist
  122.                     thisdata = ppm_GetStyleTagData(thisname)
  123.                     thisdata = substr(thisdata, pos("{",thisdata)+1)
  124.                     thisdata = left(thisdata, lastpos("}",thisdata)-1)
  125.                     if tolerant = 1 then do  /* take out unwanted codes */
  126.                         p=pos(thisdata,"\B")
  127.                         if p~=0 then thisdata = delstr(thisdata,p,2)
  128.                         p=pos(thisdata,"\b")
  129.                         if p~=0 then thisdata = delstr(thisdata,p,2)
  130.                         p=pos(thisdata,"\U")
  131.                         if p~=0 then thisdata = delstr(thisdata,p,2)
  132.                         p=pos(thisdata,"\u")
  133.                         if p~=0 then thisdata = delstr(thisdata,p,2)
  134.                         p=pos(thisdata,"\I")
  135.                         if p~=0 then thisdata = delstr(thisdata,p,2)
  136.                         p=pos(thisdata,"\i")
  137.                         if p~=0 then thisdata = delstr(thisdata,p,2)
  138.                         end
  139.                     if thisdata = styledefinition then do
  140.                         ThisTagName = "\dS<"||thisname||">"
  141.                         if stylecode~= "dS" then text = insert(ThisTagName,text, position-2)
  142.                         tagchange = 0 
  143.                         leave t
  144.                         end
  145.                     end   /* t=1 to NumberOfTags  */
  146.             end
  147.      
  148.             if tagchange = 0 then iterate x   /* No need to make a new tag */
  149.  
  150.             
  151.             numbering = 1
  152.             newbold = ""
  153.             if right(bold,1) = "B" then newbold = "B"
  154.             newitalic = ""
  155.             if right(italic,1) = "I" then newitalic = "I"
  156.             suggestname = left(fontname, 9)||newbold||newitalic||"."||(fontsize%1)||"pt."||colour
  157.             testsuggest = "0a"x||suggestname||"0a"x
  158.     
  159.             do i = 1 to 999  /* if name already used, give it a new number */
  160.                 if pos(testsuggest,stylelistTest)=0 then break
  161.                 numbering = numbering+1
  162.                 suggestname = left(fontname, 9)||newbold||newitalic||"."||(fontsize%1)||"pt."||colour"."||right(numbering, 3,"0")
  163.                 testsuggest = "0a"x||suggestname||"0a"x
  164.                 end
  165.        
  166.             ThisTagName = "\dS<"||suggestname||">"
  167.             text = insert(ThisTagName,text, position-2)
  168.             position = position+3
  169.             styledefinition = "<"suggestname"{"styledefinition"}>"
  170.             call ppm_DefineStyleTag(styledefinition)      
  171.             end   /* of article text - position = 0  */
  172.       
  173. /* replace text with new version containing new style codes */
  174.         gone = ppm_DeleteContents(box)
  175.         overflow = ppm_TextIntoBox(box, text)
  176.         do while box ~= 0  /* mark all the other boxes in this chain  */
  177.             call ppm_SetBoxUserData(box, randval)
  178.             box = ppm_ArtNextBox(box)
  179.             end
  180.         box = oldbox  /* back to the box we are working on */
  181.         end
  182.  
  183.     box = ppm_DocNextBox(box)
  184.  
  185. end
  186.  
  187.  
  188. title = ppm_GetDocName()
  189. colon = lastpos('/', title)
  190. if colon = 0 then colon = pos(':', title)
  191. title = substr(title,colon+1)
  192.  
  193. datafile = "ram:"||title||".tags"
  194. stylelist = ppm_GetStyleTagList()
  195. parse var stylelist NumberOfTags "0a"x stylelist
  196. text ="List of style tags"||"0a0a"x
  197.  
  198. if NumberOfTags~=0 then do
  199.     do t=1 to NumberOfTags
  200.         parse var stylelist thisname "0a"x stylelist
  201.         thisdata = ppm_GetStyleTagData(thisname)
  202.         text = text||thisdata"0a"x
  203.         end   /* t=1 to NumberOfTags  */
  204.     end
  205.  
  206. paralist = ppm_GetParaTagList()
  207. parse var paralist NumberOfTags "0a"x paralist
  208. text =text||"0a"x||"List of paragraph tags"||"0a0a"x
  209.  
  210. if NumberOfTags~=0 then do
  211.     do t=1 to NumberOfTags
  212.         parse var paralist thisname "0a"x paralist
  213.         thisdata = ppm_GetParaTagData(thisname)
  214.         text = text||thisdata"0a"x
  215.         end   /* t=1 to NumberOfTags  */
  216.     end
  217.  
  218. call ppm_SaveText(datafile,text)
  219. newpage = ppm_GoToPage(cpage)
  220. call exit_msg("Terminé")
  221. end
  222.  
  223. /*  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  */
  224.  
  225. /* Parse a block of style codes in text; stop at first text character  */
  226.  
  227. parsecodes:
  228. parse arg position
  229. position = pos("\",text,position)
  230. if position = 0 then return position
  231. if substr(text,position+1,1) = "." then position = 0 /* end of text */
  232. if position = 0 then return position
  233. nonstylecode = ""
  234. stylecode = "ds"  /* assume new block of codes means new style */
  235.  
  236.         do forever
  237.             if substr(text,position,1)~="\" then break
  238.             if substr(text,position+1,1) = "." then position = -1
  239.             if position = -1 then break
  240.             code = substr(text,position+1,2)
  241.             select
  242.                 when verify(left(code,1),"pNMPTs-!?#","m")~=0 then call parsenonstylecodes
  243.                  
  244.                 when code = "dp" then do
  245.                     paraname = ""
  246.                     paracode = code
  247.                     position = position+3
  248.                     end
  249.                 when code = "dP" then do
  250.                     position1 = pos(">",text,position)
  251.                     position = position+4
  252.                     oldname = paraname
  253.                     paraname = "<"||substr(text, position, position1-position)||">"
  254.                     if paraname~=oldname  then change = 1
  255.                     oldname = paracode
  256.                     paracode = "dP"
  257.                     if paracode~=oldname  then change = 1
  258.                     position = position1+1
  259.                     end
  260.                 when code = "ds" then do
  261.                     stylename = ""
  262.                     stylecode = code
  263.                     position = position+3
  264.                     notcode = 0 /* ds is the last in the string at the start of an article, which includes para codes, which are not style tag codes. This switches "code" back on. */
  265.                     end
  266.                 when code = "dS" then do
  267.                     position1 = pos(">",text,position)
  268.                     position = position+4
  269.                     stylename = substr(text,position,position1-position)
  270.                     tagdata = ppm_GetStyleTagData(stylename)
  271.                     call parsetag(tagdata) /* new style so reset all variables  */
  272.                     change = 0
  273.                     stylecode = "dS"
  274.                     position = position1+1
  275.                     end
  276.                 when verify(left(code,1),"bB","m")~=0 then do
  277.                     oldname = bold
  278.                     bold = "\"||left(code,1)
  279.                     position = position+2
  280.                     if bold~=oldname  then change = 1
  281.                     end
  282.                 when verify(left(code,1),"iI","m")~=0 then do
  283.                     oldname = italic
  284.                     italic = "\"||left(code,1)
  285.                     position = position+2
  286.                     if italic~=oldname  then change = 1
  287.                     end
  288.                 when verify(left(code,1),"uU","m")~=0 then do
  289.                     oldname = underline
  290.                     underline = "\"||left(code,1)
  291.                     position = position+2
  292.                     if underline~=oldname  then change = 1
  293.                     end
  294.                 when verify(left(code,1),"oO","m")~=0 then do
  295.                     oldname = outline
  296.                     outline = "\"||left(code,1)
  297.                     position = position+2
  298.                     if outline~=oldname  then change = 1
  299.                     end
  300.                 when left(code,1) = "n" then do
  301.                     typestyle = ""
  302.                     if bold~="" then change = 1
  303.                     bold = "\b"
  304.                     if italic~="" then change = 1
  305.                     italic = "\i"
  306.                     if underline~="" then change = 1
  307.                     underline = "\u"
  308.                     if outline~="" then change = 1
  309.                     outline = "\o"
  310.                     position = position+2
  311.                     end
  312.                 when code = "ff" then do
  313.                     position1 = pos(">",text,position)
  314.                     position = position+4
  315.                     oldname = fontname
  316.                     fontname = substr(text,position,position1-position)
  317.                     if fontname~=oldname  then change = 1
  318.                     position = position1+1
  319.                     end
  320.                 when code = "fs" then do
  321.                     position1 = pos(">",text,position)
  322.                     position = position+4
  323.                     oldname = fontsize
  324.                     fontsize = substr(text,position,position1-position)
  325.                     if fontsize~=oldname  then change = 1
  326.                     position = position1+1
  327.                     end
  328.                 when code = "FP" then do
  329.                     position1 = pos(">",text,position)
  330.                     position = position+4
  331.                     oldname = fillpattern
  332.                     fillpattern = substr(text,position,position1-position)
  333.                     if fillpattern ~=oldname  then change = 1
  334.                     position = position1+1
  335.                     end
  336.                 when code = "Fp" then do
  337.                     oldname = fillpattern
  338.                     fillpattern = "\"||code
  339.                     if fillpattern ~= oldname then change = 1
  340.                     position = position+3
  341.                     end
  342.                 when code = "SH"|code = "Sh" then do
  343.                     oldname = shadow
  344.                     shadow = "\"||code
  345.                     if shadow ~= oldname then change = 1
  346.                     position = position+3
  347.                     end
  348.                 when code = "SP"|code = "Sp" then do
  349.                     oldname = superscript
  350.                     superscript = "\"||code
  351.                     if superscript ~= oldname then change = 1
  352.                     position = position+3
  353.                     end
  354.                 when code = "SB"|code = "Sb" then do
  355.                     oldname = subscript
  356.                     subscript = "\"||code
  357.                     if subscript ~= oldname then change = 1
  358.                     position = position+3
  359.                     end
  360.                 when verify(left(code,1),"kK","m")~=0 then do
  361.                     oldname = kerning
  362.                     kerning = "\"||left(code,1)
  363.                     position = position+2
  364.                     if kerning~=oldname  then change = 1
  365.                     end
  366.                 when verify(left(code,1),"hH","m")~=0 then do
  367.                     oldname = hyphenation
  368.                     hyphenation = "\"||left(code,1)
  369.                     if hyphenation~=oldname  then change = 1
  370.                     position = position+2
  371.                     end
  372.                 when code = "lr"|code = "lf"|code = "ll" then do
  373.                     position1 = pos(">",text,position)
  374.                     position = position+4
  375.                     oldname = linespace
  376.                     linespace = substr(text,position,position1-position)
  377.                     if linespace~=oldname  then change = 1
  378.                     oldname = linespacecode
  379.                     linespacecode = code
  380.                     if linespacecode~=oldname  then change = 1
  381.                     position = position1+1
  382.                     end
  383.                 when code = "ls" then do
  384.                     position1 = pos(">",text,position)
  385.                     position = position+4
  386.                     oldname = lineshift
  387.                     lineshift = substr(text,position,position1-position)
  388.                     if lineshift~=oldname  then change = 1
  389.                     position = position1+1
  390.                     end
  391.  
  392.                 when left(code,1) = "t" then do
  393.                     position1 = pos(">",text,position)
  394.                     position = position+3
  395.                     oldname = tracking
  396.                     tracking = substr(text,position,position1-position)
  397.                     if tracking~=oldname  then change = 1
  398.                     position = position1+1
  399.                     end
  400.                 when left(code,1) = "c" then do
  401.                     position1 = pos(">",text,position)
  402.                     position = position+3
  403.                     oldname = colour
  404.                     colour = substr(text,position,position1-position)
  405.                     if colour~=oldname  then change = 1
  406.                     position = position1+1
  407.                     end
  408.                 when code = "jl"|code = "jr"|code = "jc"|code = "jf" then do
  409.                     oldname = justification
  410.                     justification = "\"||code
  411.                     if justification~=oldname  then change = 1
  412.                     position = position+3
  413.                     end
  414.                 when code = "DC" then do
  415.                     position = pos("}>",text,position)+2
  416.                     nonstylecode = "definecolor"
  417.                     change = 0
  418.                     notcode = 1
  419.                     end
  420.                 otherwise position = position+2  
  421.                 end      /* of select */
  422.         end   /* of do forever */
  423. position = position+1
  424. return position
  425.  
  426.  
  427. /*  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  */
  428.  
  429.  
  430. /* Parse a style tag definition  */
  431. parsetag:
  432.  
  433. parse arg tagdata
  434. tlength = length(tagdata)
  435. tposition = pos("\",tagdata)
  436. if pos = 0 then return
  437.  
  438. /* Clear all codes - the only compulsory info is the tag's name */
  439. call clearcodes
  440.  
  441. do forever
  442.     if substr(tagdata,tposition,1)~="\" then break
  443.     code = substr(tagdata,tposition+1,2)
  444.     select
  445.         when code = "dp" then do
  446.             paraname = ""
  447.             paracode = code
  448.             tposition = tposition+3
  449.             end
  450.         when code = "dP" then do
  451.             tposition1 = pos(">",tagdata,tposition)
  452.             tposition = tposition+4
  453.             paraname = "<"||substr(tagdata,tposition,tposition1-tposition)||">"
  454.             paracode = code
  455.             tposition = tposition1+1
  456.             end
  457.         when verify(left(code,1),"bB","m")~=0 then do
  458.             bold = "\"||left(code,1)
  459.             tposition = tposition+2
  460.             end
  461.         when verify(left(code,1),"iI","m")~=0 then do
  462.             italic = "\"||left(code,1)
  463.             tposition = tposition+2
  464.             end
  465.         when verify(left(code,1),"uU","m")~=0 then do
  466.             underline = "\"||left(code,1)
  467.             tposition = tposition+2
  468.             end
  469.         when verify(left(code,1),"oO","m")~=0 then do
  470.             outline = "\"||left(code,1)
  471.             tposition = tposition+2
  472.             end
  473.         when left(code,1) = "n" then do
  474.             typestyle = "\n"
  475.             bold = ""
  476.             italic = ""
  477.             underline = ""
  478.             outline = ""
  479.             tposition = tposition+2
  480.             end
  481.         when code = "ff" then do
  482.             tposition1 = pos(">",tagdata,tposition)
  483.             tposition = tposition+4
  484.             fontname = substr(tagdata,tposition,tposition1-tposition)
  485.             tposition = tposition1+1
  486.             end
  487.         when code = "fs" then do
  488.             tposition1 = pos(">",tagdata,tposition)
  489.             tposition = tposition+4
  490.             fontsize = substr(tagdata,tposition,tposition1-tposition)
  491.             tposition = tposition1+1
  492.             end
  493.        when code = "FP" then do
  494.             tposition1 = pos(">",text,tposition)
  495.             tposition = tposition+4
  496.             oldname = fillpattern
  497.             fillpattern = substr(text,tposition,tposition1-tposition)
  498.             if fillpattern ~=oldname  then change = 1
  499.             tposition = tposition1+1
  500.             end
  501.         when code = "Fp" then do
  502.             oldname = fillpattern
  503.             fillpattern = "\"||code
  504.             if fillpattern ~= oldname then change = 1
  505.             tposition = tposition+3
  506.             end
  507.         when code = "SH"|code = "Sh" then do
  508.             oldname = shadow
  509.             shadow = "\"||code
  510.             if shadow ~= oldname then change = 1
  511.             tposition = tposition+3
  512.             end
  513.         when code = "SP"|code = "Sp" then do
  514.             oldname = superscript
  515.             superscript = "\"||code
  516.             if superscript ~= oldname then change = 1
  517.             tposition = tposition+3
  518.             end
  519.         when code = "SB"|code = "Sb" then do
  520.             oldname = subscript
  521.             subscript = "\"||code
  522.             if subscript ~= oldname then change = 1
  523.             tposition = tposition+3
  524.             end
  525.         when verify(left(code,1),"kK","m")~=0 then do
  526.             kerning = "\"||left(code,1)
  527.             tposition = tposition+2
  528.             end
  529.         when verify(left(code,1),"hH","m")~=0 then do
  530.             hyphenation = "\"||left(code,1)
  531.             tposition = tposition+2
  532.             end
  533.         when code = "lr"|code = "lf"|code = "ll" then do
  534.             tposition1 = pos(">",tagdata,tposition)
  535.             tposition = tposition+4
  536.             linespace = substr(tagdata,tposition,tposition1-tposition)
  537.             linespacecode = code
  538.             tposition = tposition1+1
  539.             end
  540.         when code = "ls" then do
  541.             tposition1 = pos(">",tagdata,tposition)
  542.             tposition = tposition+4
  543.             lineshift = substr(tagdata,tposition,tposition1-tposition)
  544.             tposition = tposition1+1
  545.             end
  546.         when left(code,1) = "t" then do
  547.             tposition1 = pos(">",tagdata,tposition)
  548.             tposition = tposition+3
  549.             tracking = substr(tagdata,tposition,tposition1-tposition)
  550.             tposition = tposition1+1
  551.             end
  552.         when left(code,1) = "c" then do
  553.             tposition1 = pos(">",tagdata,tposition)
  554.             tposition = tposition+3
  555.             colour = substr(tagdata,tposition,tposition1-tposition)
  556.             tposition = tposition1+1
  557.             end
  558.         when code = "jl"|code = "jr"|code = "jc"|code = "jf" then do
  559.             justification = "\"||code
  560.             tposition = tposition+3
  561.             end
  562.         otherwise tposition = tposition+2
  563.         end
  564. end
  565. return
  566.  
  567.  
  568. /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  */
  569.  
  570. parsenonstylecodes:
  571.                     position = position+2 /* non-style codes */
  572.                     
  573.                     notcode = 1
  574.                     code = substr(text,position-1,5)
  575.                     select
  576.                         when left(code,4) = "#<Pp" then do
  577.                             nonstylecode = "previousboxpage"||substr(code,5,1)
  578.                             position = position+5
  579.                             end
  580.                         when left(code,4) = "#<Pc" then do
  581.                             nonstylecode = "currentpage"||substr(code,5,1)
  582.                             position = position+5
  583.                             end
  584.                         when left(code,4) = "#<Pn" then do
  585.                             nonstylecode = "nextboxpage"||substr(code,5,1)
  586.                             position = position+5
  587.                             end
  588.                         when left(code,4) = "#<Dc" then do
  589.                             nonstylecode = "creationdate"||substr(code,5,1)
  590.                             position = position+5
  591.                             end
  592.                         when left(code,4) = "#<Dp" then do
  593.                             nonstylecode = "printingdate"||substr(code,5,1)
  594.                             position = position+5
  595.                             end
  596.                         when left(code,2) = "pv" then do
  597.                             position1 = pos(">",text,position)
  598.                             position = position+2
  599.                             nonstylecode = "paravalue"||substr(text, position, position1 -position)
  600.                             position = position1+1
  601.                             end
  602.                         when left(code,2) = "ps" then do
  603.                             position1 = pos(">",text,position)
  604.                             position = position+2
  605.                             nonstylecode ="paraspacing"|| substr(text,position, position1 -position)
  606.                             position = position1+1
  607.                             end
  608.                         when left(code,2) = "pi"|left(code,2) = "po" |left(code, 2) = "pn" then do
  609.                             nonstylecode = "indent"||left(code,2)
  610.                             position = position+1
  611.                             end
  612.                         when left(code,1) = "?" then do
  613.                             nonstylecode = "comment"
  614.                             position = pos(">",text,position)
  615.                             end
  616.                         when left(code,1) = "!" then do
  617.                             nonstylecode = "boxbreak"
  618.                             end
  619.                         when left(code,1) = "P" then do
  620.                             nonstylecode = "newparagraph"
  621.                             end
  622.                         when left(code,1) = "M" then do
  623.                             nonstylecode = "mspace"
  624.                             end
  625.                         when left(code,1) = "N" then do
  626.                             nonstylecode = "nspace"
  627.                             end
  628.                         when left(code,1) = "T" then do
  629.                             nonstylecode = "thinspace"
  630.                             end
  631.                         when left(code,1) = "s" then do
  632.                             nonstylecode = "tab"
  633.                             end
  634.                         when left(code,1) = "-" then do
  635.                             nonstylecode = "softhyphen"
  636.                             end
  637.                         otherwise nonstylecode = ""
  638.                         end 
  639. return
  640.  
  641. /*  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  */
  642.  
  643. clearcodes:
  644.         paraname = ""
  645.         paracode = ""
  646.         stylename = ""
  647.         stylecode = ""
  648.         fontname = ""
  649.         typestyle = ""
  650.         fontsize = ""
  651.         bold = ""
  652.         italic = ""
  653.         shadow = ""
  654.         superscript = ""
  655.         subscript = ""
  656.         fillpattern = ""
  657.         underline = ""
  658.         outline = ""
  659.         kerning = ""
  660.         hyphenation = ""
  661.         linespace = ""
  662.         linespacecode = ""
  663.         lineshift = ""
  664.         tracking = ""
  665.         colour = ""
  666.         justification = ""
  667. return
  668.  
  669. /*  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  */
  670.  
  671. exit_msg:
  672. do
  673.     parse arg message
  674.     if message ~="" then call ppm_inform(1,message,)
  675.     call ppm_ClearStatus()
  676.     call ppm_AutoUpdate(1)
  677.     exit
  678. end
  679.  
  680.