John,
Here's another version of the code that keeps the constants together based on the enum group:
lparameters pcPreHFile, pcHFile
if ( pcount() != 2 )
wait window "no files specified"
return .f.
endif
create cursor temp (cLine c(100))
append from (pcPreHFile) type sdf
create cursor hfile (cGroup c(32), mDefine m)
wait window "Reading" nowait
select temp
scan
if ( "typedef" $ cLine )
lcDefine = ""
lnRecStart = recno( "temp" )
do while ! ( ";" $ cLine )
skip
if ( ! ";" $ cLine )
lcDefine = lcDefine + "#define " + chrtran( alltrim( cLine ), ",=", "" ) + chr(13)+chr(10)
endif
enddo
lcGroup = chrtran( alltrim( cLine ), ";}", "" )
insert into hfile values ( lcGroup, lcDefine )
endif
endscan
wait window "Writing" nowait
select hFile
index on cGroup tag cGroup
goto top
set textmerge to (pcHFile)
set textmerge on noshow
lcGroup = ""
scan
\<<"* " + cGroup>>
\<<mDefine>>
endscan
set textmerge off
set textmerge to
use in temp
use in hfile
wait clear
>I conned Menachem Bazian into sending me a file with all the Office97 constants. It's on my website and it may be here as well. Probably easier to get to on my site. (Thanks again Menachem!)