home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / thinkref / archive / THINKPascalUH2.1.sea / MPW2TPas next >
Text File  |  1995-09-12  |  13KB  |  473 lines

  1. ##
  2. ##    MPW2TPas
  3. ##    Copyright ©1995, Symantec Corp.
  4. ##    Written by Glenn L. Austin
  5. ##    Symantec Macintosh Development Tools Technical Support
  6. ##
  7. ##    MPW2TPas takes MPW header files and massages them for use with THINK Pascal.
  8. ##    The acid test for this script was converting the MPW Universal Headers 2.1
  9. ##    so that they can be used with THINK Pascal 4.0.2.
  10. ##
  11.  
  12. set exit 0
  13. set me "{0}"
  14.  
  15. if "{1} " == " "
  16.     echo '## '"{me}"' - Copyright ©1995, Symantec Corp.'
  17.     echo '## Written by Glenn L. Austin'
  18.     echo '##'
  19.     echo '## Converts MPW Pascal headers for use within THINK Pascal'
  20.     echo '##'
  21.     echo '## Syntax: '"{me}"' file [file..]'
  22.     exit 0
  23. else
  24.     ## Handle my necessary recursive calls for:
  25.     ##    - calculating a constant value
  26.     ##    - computing the size of a variable type
  27.     ##    - getting the value of a constant
  28.     if "{1}" == "-calculate"
  29.         set s "{2}"
  30.         set f "{3}"
  31.         if "{s}" =~ /$[0-9A-F]+/
  32.             echo "{s}"
  33.             exit 0
  34.         end
  35.         if "{s}" =~ /[-0-9]+/
  36.             echo "{s}"
  37.             exit 0
  38.         end
  39.         loop
  40.             break if "{s}" !~ /≈sizeof∂([¬∂)]+∂)≈/
  41.             ( evaluate "{s}" =~ /(≈)®1sizeof∂(([¬∂)]+)®2∂)(≈)®3/ ) ∑ Dev:Null
  42.             set s1 "{®1}"
  43.             set s2 "{®2}"
  44.             set s3 "{®3}"
  45.             unset ®1 ®2 ®3
  46.             set s2 "`"{me}" -sizeof "{s2}" "{f}"`"
  47.             set s "{s1}{s2}{s3}"
  48.         end
  49.         loop
  50.             break if "{s}" !~ /≈∂(≈∂)≈/
  51.             ( evaluate "{s}" =~ /([¬∂(]*)®1∂((≈)®2∂)([¬∂)]*)®3/ ) ∑ Dev:Null
  52.             set s1 "{®1}"
  53.             set s2 "{®2}"
  54.             set s3 "{®3}"
  55.             unset ®1 ®2 ®3
  56.             set s2 "`"{me}" -calculate "{s2}" "{f}"`"
  57.             set s "{s1}{s2}{s3}"
  58.         end
  59.         
  60.         set v ""
  61.         loop
  62.             break if "{s} " == " "
  63.             if ("{s}" =~ /≈[-+∂/∂*]≈/) && ("{s}" !~ /-[0-9]+/)
  64.                 ( evaluate "{s}" =~ /(?[¬-+ ∂t∂*∂/]*)®1[ ∂t]*([-+∂/∂*]+)®2[ ∂t]*(≈)®3/ ) ∑ Dev:Null
  65.                 set s1 "{®1}"
  66.                 set s2 "{®2}"
  67.                 set s3 "{®3}"
  68.                 unset ®1 ®2 ®3
  69.                 if "{s1}" !~ /[-0-9$A-F]+/
  70.                     set s1 "`"{me}" -valueof "{s1}" "{f}"`"
  71.                 end
  72.                 if "{s2}" == '/'
  73.                     set s2 '÷'
  74.                 else if "{s2}" == '**'
  75.                     if "{s3}" !~ /[-0-9$A-F]+/
  76.                         set s3 "`"{me} -calculate "{s3}" "{f}"`"
  77.                     end
  78.                     set s2 1
  79.                     loop
  80.                         break if {s3} == 0
  81.                         ( evaluate s3 -= 1 ) ∑ Dev:Null
  82.                         ( evaluate s2 = {s2} * {s1} ) ∑ Dev:Null
  83.                     end
  84.                     set s1 "`evaluate -h {s2}`"
  85.                     ( evaluate "{s1}" =~ /0x(≈)®1/ ) ∑ Dev:Null
  86.                     set s1 `echo "00000000{®1}" | translate "a-f" "A-F"`
  87.                     unset ®1
  88.                     ( evaluate "{s1}" =~ /≈([0-9a-fA-F]«8»)®1/ ) ∑ Dev:Null
  89.                     set s1 "${®1}"
  90.                     unset ®1
  91.                     set s2 ""
  92.                     set s3 ""
  93.                 end
  94.                 set v "{v}{s1}{s2}"
  95.                 set s "{s3}"
  96.             else
  97.                 if "{s}" !~ /[-0-9$A-F]+/
  98.                     set s "`"{me}" -valueof "{s}" "{f}"`"
  99.                 end
  100.                 set v "{v}{s}"
  101.                 break
  102.             end
  103.         end
  104.         if "{v}" =~ /≈$[0-9A-F]+≈/
  105.             ( set v `evaluate -h {v}` ) ∑ Dev:Null
  106.             if "{v}" !~ /0x[0-9A-F]+/
  107.                 set v "`"{me}" -calculate "{v}" "{f}"`"
  108.             end
  109.             set v `evaluate -h {v}`
  110.             ( evaluate "{v}" =~ /0x(≈)®1/ ) ∑ Dev:Null
  111.             set v `echo "${®1}" | translate "a-f" "A-F"`
  112.             unset ®1
  113.         else
  114.             ( set v `evaluate {v}` ) ∑ Dev:Null
  115.             if "{v}" !~ /[-0-9]+/
  116.                 set v "`"{me}" -calculate "{v}" "{f}"`"
  117.             end
  118.         end
  119.         echo "{v}"
  120.         exit 0
  121.     else if "{1}" == "-sizeof"
  122.         set s "{2}"
  123.         set f "{3}"
  124.         set elemSize 0
  125.         if ("{s}" == "BYTE") || ("{s}" =~ /[SU]Int8/)
  126.             echo 1
  127.             exit 0
  128.         else if ("{s}" == "INTEGER") || ("{s}" =~ /[SU]Int16/)
  129.             echo 2
  130.             exit 0
  131.         else if ("{s}" == "LONGINT") || ("{s}" =~ /[SU]Int32/) || ("{s}" == "OSType") || ("{s}" == "ResType")
  132.             echo 4
  133.             exit 0
  134.         end
  135.         set filePos "`position -c "{f}"`"
  136.         ( evaluate "{filePos}" =~ /([0-9]+)®1,([0-9]+)®2/ ) ∑ Dev:Null
  137.         set filePos 'Δ1!'{®1}':Δ1!'{®2}
  138.         find • "{f}"
  139.         find /•[ ∂t]+{s}[ ∂t]*∂=[ ∂t]*/ "{f}"
  140.         find §Δ "{f}"
  141.         find /[¬ ∂t∂n;]+/ "{f}"
  142.         set packed 0
  143.         if "`catenate "{f}".§`" == "PACKED"
  144.             set packed 1
  145.             find /[ ∂t∂n]+/Δ "{f}"
  146.             find /[¬ ∂t∂n]+/ "{f}"
  147.         end
  148.         set s1 "`catenate "{f}".§`"
  149.         if ("{s1}" == "BYTE") || ("{s1}" =~ /[SU]Int8/)
  150.             find {filePos} "{f}"
  151.             echo 1
  152.             exit 0
  153.         else if ("{s1}" == "INTEGER") || ("{s1}" =~ /[SU]Int16/)
  154.             find {filePos} "{f}"
  155.             echo 2
  156.             exit 0
  157.         else if ("{s}" == "LONGINT") || ("{s}" =~ /[SU]Int32/) || ("{s}" == "OSType") || ("{s}" == "ResType")
  158.             find {filePos} "{f}"
  159.             echo 4
  160.             exit 0
  161.         end
  162.         if "{s1}" == "RECORD"
  163.             find Δ!1:Δ/•[ ∂t]+END;/ "{f}"
  164.             set numLines `count -l "{f}".§`
  165.             find Δ§ "{f}"
  166.             loop
  167.                 break if {numLines} == 0
  168.                 ( evaluate numLines -= 1 ) ∑ Dev:Null
  169.                 find /:[ ∂t]*/Δ:Δ/;/ "{f}"
  170.                 set s1 "`catenate "{f}".§`"
  171.                 if "{s1}" =~ /(PACKED )«0,1»ARRAY ≈/
  172.                     ( evaluate "{s1}" =~ /≈ARRAY ∂[([¬∂.]+)®1∂.∂.([¬∂]]+)®2∂] OF (≈)®3/ ) ∑ Dev:Null
  173.                     set lb "{®1}"
  174.                     set hb "{®2}"
  175.                     set sz "{®3}"
  176.                     unset ®1 ®2 ®3
  177.                     set sz "`"{me}" -sizeof "{sz}" "{f}"`"
  178.                     #if ({sz} == 1) && !{packed} && ("{s1}" !~ /PACKED ≈/)
  179.                     #    set sz 2
  180.                     #end
  181.                     if "{lb}" !~ /[-0-9]+/
  182.                         set lb "`"{me}" -calculate "{lb}" "{f}"`"
  183.                     end
  184.                     if "{hb}" !~ /[-0-9]+/
  185.                         set hb "`"{me}" -calculate "{hb}" "{f}"`"
  186.                     end
  187.                     ( evaluate sz = {sz} * (1 + {hb} - {lb}) ) ∑ Dev:Null
  188.                 else
  189.                     set sz "`"{me}" -sizeof "{s1}" "{f}"`"
  190.                 end
  191.                 if ({sz} != 1) && !{packed} && `evaluate {elemSize} MOD 2`
  192.                     ( evaluate elemSize += 1 ) ∑ Dev:Null
  193.                 end
  194.                 ( evaluate elemSize += {sz} ) ∑ Dev:Null
  195.                 find Δ!1 "{f}"
  196.             end
  197.         else if "{s1}" == "ARRAY"
  198.             find /∂[/Δ:Δ/∂.∂./ "{f}"
  199.             set lb "`catenate "{f}".§`"
  200.             find /∂.∂./Δ:Δ/∂]/ "{f}"
  201.             set hb "`catenate "{f}".§`"
  202.             find / OF /Δ:Δ/;/ "{f}"
  203.             set sz "`catenate "{f}".§`"
  204.             set sz `"{me}" -sizeof "{sz}" "{f}"`
  205.             if "{lb}" !~ /[-0-9]+/
  206.                 set lb "`"{me}" -calculate "{lb}" "{f}"`"
  207.             end
  208.             if "{hb}" !~ /[-0-9]+/
  209.                 set hb "`"{me}" -calculate "{hb}" "{f}"`"
  210.             end
  211.             if !{packed} && ({sz} == 1)
  212.                 set sz 2
  213.             end
  214.             ( evaluate elemSize = (1 + hb - lb) * sz ) ∑ Dev:Null
  215.         else
  216.             set elemSize "`"{me}" -sizeof "{s1}" "{f}"`"
  217.         end
  218.         find {filePos} "{f}"
  219.         if `evaluate {elemSize} MOD 2`
  220.             ( evaluate elemSize += 1 ) ∑ Dev:Null
  221.         end
  222.         echo {elemSize}
  223.         exit 0
  224.     else if "{1}" == "-valueof"
  225.         set s "{2}"
  226.         set f "{3}"
  227.         set v 0
  228.         set filePos "`position -c "{f}"`"
  229.         ( evaluate "{filePos}" =~ /([0-9]+)®1,([0-9]+)®2/ ) ∑ Dev:Null
  230.         set filePos 'Δ1!'{®1}':Δ1!'{®2}
  231.         find • "{f}"
  232.         find /•[ ∂t]*{s}[ ∂t]*∂=[ ∂t]*/Δ:Δ/;/ "{f}"
  233.         set v "`catenate "{f}".§`"
  234.         find {filePos} "{f}"
  235.         if "{v}" =~ /$[0-9A-F]+/
  236.             echo "{v}"
  237.             exit 0
  238.         end
  239.         if "{v}" != /[-0-9]+/
  240.             set v "`"{me}" -calculate "{v}" "{f}"`"
  241.         end
  242.         echo "{v}"
  243.         exit 0
  244.     else        ## do file(s)
  245.         set filesToDo ""
  246.         loop
  247.             break if "{1} " == " "
  248.             set filesToDo "{filesToDo}{1} "
  249.             shift 1
  250.         end
  251.     end
  252. end
  253.  
  254. for f in {filesToDo}
  255.     open "{f}"
  256.     find • "{f}"
  257.     replace -c ∞ /∂:= UsingIncludes∂}∂n∂{∂$SETC UsingIncludes ∂:= 1∂}∂n+/ "∂:= UsingIncludes∂}∂n∂{∂$SETC UsingIncludes ∂:= 1∂}∂n∂n  USES∂n" "{f}"
  258.     replace -c ∞ /∂{∂$IFC UNDEFINED ≈∂}∂n∂{∂$I (∂$∂$SHELL∂([¬∂)]+∂))«0,1»([¬.]+)®1.p∂}∂n∂{∂$ENDC∂}∂n(∂{[ ∂t]+≈∂}∂n)*/ "®1," "{f}"
  259.     if {status}
  260.         replace \•  USES∂n\ "∂n" "{f}"
  261.     else
  262.         replace -c 1 \,\ ";∂n" "{f}"
  263.         find \•  USES∂n\Δ "{f}"
  264.         echo -n "   " >"{f}".§
  265.         find §Δ:Δ/;/ "{f}"
  266.         set s "`catenate "{f}".§`"
  267.         echo -n "{s}" >"{f}".§
  268.     end
  269.     find • "{f}"
  270.     replace -c ∞ /•∂{∂$PUSH∂}/ "∂{ ∂$PUSH∂}" "{f}"
  271.     find • "{f}"
  272.     replace -c ∞ /•∂{∂$ALIGN (≈)®1∂}/ "∂{ ∂$ALIGN ®1∂}" "{f}"
  273.     find • "{f}"
  274.     replace -c ∞ /•∂{∂$LibExport∂+∂}/ "∂{ ∂$LibExport∂+∂}" "{f}"
  275.     
  276.     find • "{f}"
  277.     find /• +USES∂n   /Δ "{f}"
  278.     if !{status} && ("{f}" !~ /Types.p/)
  279.         echo -n "ConditionalMacros, Types, " >>"{f}".§
  280.     end
  281.     find §Δ "{f}"
  282.     find Δ\?\ "{f}"
  283.     find Δ\?\ "{f}"
  284.     find /, Types/ "{f}"
  285.     if !{status}
  286.         echo -n "" >"{f}".§
  287.     end
  288.     find \• +USES∂n\ "{f}"
  289.     find /, ConditionalMacros/ "{f}"
  290.     if !{status}
  291.         echo -n "" >"{f}".§
  292.     end
  293.     find • "{f}"
  294.     find /,∂{∂$/ "{f}"
  295.     if {status} == 0
  296.         find Δ§ "{f}"
  297.         replace -c 1 /∂{∂$[¬∂}]+∂} +/ " " "{f}"
  298.         replace -c 1 /;∂n∂{∂$ENDC *∂}/ ";" "{f}"
  299.     end
  300.     find • "{f}"
  301.     replace -c ∞ /•([ ∂t]*PROCEDURE[ ∂t][¬∂;]+;[ ∂n∂t]+C;)®1/ "∂{®1∂}" "{f}"
  302.     find • "{f}"
  303.     replace -c ∞ /•([ ∂t]*FUNCTION[ ∂t][¬∂;]+;[ ∂n∂t]+C;)®1/ "∂{®1∂}" "{f}"
  304.     find • "{f}"
  305.     replace -c ∞ /•([ ∂t]*PROCEDURE[ ∂t][¬∂(]+∂([¬∂)]+∂)[¬;]*;[ ∂n∂t]*C;)®1/ "∂{®1∂}" "{f}"
  306.     find • "{f}"
  307.     replace -c ∞ /•([ ∂t]*FUNCTION[ ∂t][¬∂(]+∂([¬∂)]+∂)[¬;]*;[ ∂n∂t]*C;)®1/ "∂{®1∂}" "{f}"
  308.     
  309.     find • "{f}"
  310.     replace -c 1 /•∂{∂$POP∂}/ "∂{ ∂$POP∂}" "{f}"
  311.     replace -c ∞ /•∂{∂$IFC NOT UsingIncludes∂}∂n([ ∂t]*)®1END∂.∂n∂{∂$ENDC∂}/ "∂{∂$IFC NOT UsingIncludes∂}∂n®1IMPLEMENTATION∂n®1END∂.∂n∂{∂$ENDC∂}" "{f}"
  312.     find • "{f}"
  313.     replace -c ∞ /•∂{∂$IFC UNDEFINED UsingIncludes∂}∂n∂{∂$SETC UsingIncludes := 0∂}∂n∂{∂$ENDC∂}∂n+/ "" "{f}"
  314.     find • "{f}"
  315.     replace -c ∞ /•∂{∂$IFC NOT UsingIncludes∂}∂n([¬∂{]+)®1∂{∂$ENDC∂}/ "®1" "{f}"
  316.     find • "{f}"
  317.     replace -c ∞ /•∂{∂$I[-+]∂}∂n∂{∂$SETC [¬ :]+Includes := UsingIncludes∂}∂n∂{∂$SETC UsingIncludes := 1∂}∂n+/ "" "{f}"
  318.     find • "{f}"
  319.     replace -c ∞ /•∂{∂$SETC UsingIncludes := [¬∂}]+Includes∂}∂n+/ "" "{f}"
  320.     find • "{f}"
  321.     loop
  322.         find /[0-9]+∂*∂*∂([¬∂)]+∂)/ "{f}"
  323.         break if {status}
  324.         set s "`catenate "{f}".§`"
  325.         ( evaluate "{s}" =~ /[¬∂(]*(∂(+)®1[¬∂(]*/ ) ∑ Dev:Null
  326.         set v `echo -n "{®1}" | count -c`
  327.         loop
  328.             ( evaluate v -= 1 ) ∑ Dev:Null
  329.             break if {v} == 0
  330.             find §:/∂)/ "{f}"
  331.         end
  332.         set s "`catenate "{f}".§`"
  333.         mark § '--TEMP--' "{f}"
  334.         ( evaluate "{s}" =~ /([0-9]+)®1∂*∂*∂((≈)®2∂)/ ) ∑ Dev:Null
  335.         set m "{®1}"
  336.         set c "{®2}"
  337.         unset ®1 ®2
  338.         if "{c}" !~ /[0-9]+/
  339.             set c "`"{me}" -calculate "{c}" "{f}"`"
  340.         end
  341.         set v 1
  342.         loop
  343.             break if {c} == 0
  344.             ( evaluate c -= 1 ) ∑ Dev:Null
  345.             ( evaluate v = {v} * {m} ) ∑ Dev:Null
  346.         end
  347.         set v "`evaluate -h {v}`"
  348.         ( evaluate "{v}" =~ /0x(≈)®1/ ) ∑ Dev:Null
  349.         set v `echo "00000000{®1}" | translate "a-f" "A-F"`
  350.         unset ®1
  351.         ( evaluate "{v}" =~ /≈([0-9a-fA-F]«8»)®1/ ) ∑ Dev:Null
  352.         set v "${®1}"
  353.         unset ®1
  354.         find '--TEMP--' "{f}"
  355.         unmark '--TEMP--' "{f}"
  356.         echo -n "{v}" >"{f}".§
  357.     end
  358.     find • "{f}"
  359.     loop
  360.         find /ARRAY ∂[/ "{f}"
  361.         break if {status}
  362.         loop
  363.             find §Δ:Δ/∂.∂./ "{f}"
  364.             if "`catenate "{f}".§`" !~ /[0-9]+/
  365.                 set s "`catenate "{f}".§`"
  366.                 set s "`"{me}" -calculate "{s}" "{f}"`"
  367.                 echo -n "{s}" >"{f}".§
  368.             end
  369.             find /∂.∂./Δ:Δ/[,∂]]/ "{f}"
  370.             if "`catenate "{f}".§`" !~ /[0-9]+/
  371.                 set s "`catenate "{f}".§`"
  372.                 set s "`"{me}" -calculate "{s}" "{f}"`"
  373.                 echo -n "{s}" >"{f}".§
  374.             end
  375.             find /?/ "{f}"
  376.             break if "`catenate "{f}".§`" == ']'
  377.         end
  378.     end
  379.     find • "{f}"
  380.     loop
  381.         find /[ ∂t]+=[ ∂t]+[¬-∂'∂"]≈[-+∂/∂*]≈;/ "{f}"
  382.         break if {status}
  383.         find \[ ∂t∂n]\Δ:Δ/[ ∂t=]/ "{f}"
  384.         find /=[ ∂t]*/Δ:Δ/;/ "{f}"
  385.         set s "`catenate "{f}".§`"
  386.         #set echo 1;" MPW2TPas" -calculate "{s}" "{f}";set echo 0
  387.         set v "`"{me}" -calculate "{s}" "{f}"`"
  388.         echo -n "{v}" >"{f}".§
  389.     end
  390.     find • "{f}"
  391.     replace -c ∞ /eventMask: EventMask/ "evtMask: EventMask" "{f}"
  392.     find • "{f}"
  393.     replace -c ∞ /recordID: RecordID/ "recID: RecordID" "{f}"
  394.     find • "{f}"
  395.     replace -c ∞ /attribute: Attribute/ "attrib: Attribute" "{f}"
  396.     find • "{f}"
  397.     replace -c ∞ /timeScale: TimeScale/ "time_Scale: TimeScale" "{f}"
  398.     find • "{f}"
  399.     replace -c ∞ /packedDSSpec: PackedDSSpec/ "packed_DSSpec: PackedDSSpec" "{f}"
  400.     find • "{f}"
  401.     replace -c ∞ /flatInstrument: FlatInstrument/ "flatInstr: FlatInstrument" "{f}"
  402.     find • "{f}"
  403.     replace -c ∞ /noteRequest: NoteRequest/ "noteReq: NoteRequest" "{f}"
  404.     find • "{f}"
  405.     replace -c ∞ /noteChannel: NoteChannel/ "noteChan: NoteChannel" "{f}"
  406.     find • "{f}"
  407.     replace -c ∞ /instrumentData: InstrumentData/ "instrData: InstrumentData" "{f}"
  408.     find • "{f}"
  409.     replace -c ∞ /vblTaskPtr: VBLTaskPtr/ "vblTaskP: VBLTaskPtr" "{f}"
  410.     find • "{f}"
  411.     replace -c ∞ /object: / "obj: " "{f}"
  412.     find • "{f}"
  413.     replace -c ∞ /threadStyle: ThreadStyle/ "thrdStyle: ThreadStyle" "{f}"
  414.     find • "{f}"
  415.     replace -c ∞ /threadState: ThreadState/ "thrdState: ThreadState" "{f}"
  416.     find • "{f}"
  417.     replace -c ∞ /tmTaskPtr: TMTaskPtr/ "tmTaskP: TMTaskPtr" "{f}"
  418.     find • "{f}"
  419.     replace -c ∞ /$0([A-F][0-9A-F]«3»)®1/ "$®1" "{f}"
  420.     find • "{f}"
  421.     replace -c ∞ /∂(∂*∂±/ "∂( ∂*∂±" "{f}"
  422.     find • "{f}"
  423.     replace -c ∞ /(typedef pascal [¬∂(]+)®1∂(∂*/ "®1∂( ∂*" "{f}"
  424.     find • "{f}"
  425.     replace -c ∞ /∂(∂*/ "∂{" "{f}"
  426.     find • "{f}"
  427.     replace -c ∞ /∂*∂)/ "∂}" "{f}"
  428.     find • "{f}"
  429.     set commentDepth 0
  430.     set needMultiLineCommenting 0
  431.     loop
  432.         find /[∂{∂}]/ "{f}"
  433.         break if {status}
  434.         if "`catenate "{f}".§`" == "∂{"
  435.             if {commentDepth}
  436.                 echo -n '(*' >"{f}".§
  437.                 set needMultiLineCommenting 1
  438.             end
  439.             ( evaluate commentDepth = {commentDepth} + 1 ) ∑ Dev:Null
  440.         else
  441.             ( evaluate commentDepth = {commentDepth} - 1 ) ∑ Dev:Null
  442.             if {commentDepth}
  443.                 echo -n '* )' >"{f}".§
  444.             else
  445.                 if {needMultiLineCommenting}
  446.                     find \∂{\:/∂}/ "{f}"
  447.                     set nLines `count -l "{f}".§`
  448.                     ( evaluate nLines = {nLines} - 1 ) ∑ Dev:Null
  449.                     find Δ§ "{f}"
  450.                     replace -c {nLines} /∂n/ "∂}∂n∂{" "{f}"
  451.                     set needMultiLineCommenting 0
  452.                     find /∂}/ "{f}"
  453.                 end
  454.             end
  455.         end
  456.     end
  457.     find • "{f}"
  458.     replace -c ∞ /∂*∂)∂}/ "∂* ∂)∂}" "{f}"
  459.     find • "{f}"
  460.     replace -c ∞ /(typedef pascal [¬∂(]+)®1∂( ∂*/ "®1∂(∂*" "{f}"
  461.     find • "{f}"
  462.     replace -c ∞ /∂( ∂*∂±/ "∂(∂*∂±" "{f}"
  463.     find • "{f}"
  464.     replace -c ∞ /(∂{[¬∂}∂n]«250»)®1(≈)®2/ "®1∂}∂n∂{®2" "{f}"
  465.     find • "{f}"
  466.     echo "∂{ Converted with MPW2TPas `date` ∂}" >"{f}".§
  467.     find • "{f}"
  468.     close -y "{f}"
  469.     setfile -c 'PJMM' -t 'TEXT' "{f}"
  470. end
  471.  
  472. exit 0
  473.