[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

1411.0. "text_file and control blocks" by OASS::VALDEZ_C (A smile is the same in any language) Mon Sep 14 1992 23:33

Hi,

I'm having trouble getting the TEXT_FILE function to write out an END CONTROL 
(signifying the end of a WPSPLUS control block).  I can get a START CONTROL 
and the correct attributes on whatever text should fall within the block, but 
I can't get the END CONTROL.  

The bottom line is that the customer needs to read a text file in as a WPSPLUS 
file and cannot have the ruler with no right margin and needs control blocks 
with a variable number of lines inside the control blocks.  We thought 
TEXT_FIILE was the way to go but ran into the END CONTROL problem.  We then 
tried various iterations of MERGE and using the text file as a list file but 
could never get teh desired results.  Any help with TEXT_FILE or any other 
ideas to accomplish what the customer needs would be greatly appreciated.

Thanks a lot.

Cindy

T.RTitleUserPersonal
Name
DateLines
1411.1Change the line attributes to get end_controlSHALOT::WARFORDRichard Warford @OPA DTN 393-7495Tue Sep 15 1992 16:0712
    Hi Cindy,
    
    TEXT_FILE stores the line attributes as you change them. Then keeps
    using that same attribute until you change it to something else. So
    what you need to do to get the end control in place is issue a:
    
    	TEXT_FILE SET LINE_ATTRIBUTES xxx /SOFT
    
    This changes the attribute to be just a soft carriage return, and turns
    off the PRINT_CONTROL resulting in a END_CONTROL block being generated.
    
    Rick
1411.2text_file is great!SUOSW3::HAMANNTue Sep 15 1992 16:08255
    Hi cindy,
    
    text_file works miracles, but you can't learn how from the
    documentation.
    
    Find below a script that I use to convert OfficeVision documents from
    a tagged text file to WPS document. I hope you can extract what you
    need.
    
    Good luck
    Klaus
    
    
    
! load.scp
! read an OfficeVision document and convert to WPL
!
! The input TXT file is a normal text file structured as followed:
! Each block starts with a tag consisting of two letters
! Following this tag are zero or more lines of the specified type
! The output file is a WPL document
!
! � Klaus Hamann 1992 Stuttgart, Germany
!
! --------------------------------------------------------------
!
! SET_TRACE (ALL,LOG="LOAD.LOG")
prompt 'input TXT-file: '
.if oa$prompt_dispose eqs '0' then .exit
get #in = oa$prompt_text
!
prompt 'output WPL-file: '
.if oa$prompt_dispose eqs '0' then .exit
get #out = oa$prompt_text

!
text_file open/read in #in
.if oa$status eqs '0' then .goto open_in_error
!
text_file open/write out #out
.if oa$status eqs '0' then .goto open_out_error
!
.CLEAR 1,24
! -----------------------------------------------------------------
.label read_next_tag
!
GET #TAG=#LINE=#ATTS=""
!
text_file READ in #tag
.if oa$status eqs '0' then .goto eof
!
.TEXT 1,1, "TAG " #TAG
!
.label process_next_tag
!
.if #tag eqs 'RU' then .goto got_ruler
.if #tag eqs 'TX' then .goto got_text
.if #tag eqs 'PC' then .goto got_printercommand
.if #tag eqs 'FT' then .goto got_fontcommand
.if #tag eqs 'AA' then .goto got_nobreak
.if #tag eqs 'AE' then .goto got_endnobreak
.if #tag eqs '**' then .goto got_comment
.if #tag eqs 'PA' then .goto got_page
.if #tag eqs 'SL' then .goto got_softline
.if #tag eqs 'SC' then .goto got_STARTCONTROL
.if #tag eqs 'EC' then .goto got_ENDCONTROL
.if #tag eqs 'TC' then .goto got_TOC
.GOTO TAG_ERROR
! ............................................................
.label got_ruler
! ruler is in next line
!
text_file READ in #line
text_file set ruler out #line
text_file put out
.goto READ_NEXT_TAG
! ............................................................
.LABEL GOT_TEXT
! next line is text, following line attributes
!
text_file READ in #line
text_file READ in #atts
text_file set line_type/text out
text_file set text out #line
text_file set text_attributes out #atts
text_file put out
text_file set line_attribute out
.goto READ_NEXT_TAG
! ............................................................
.LABEL GOT_PRINTERCOMMAND
! next line is command
!
text_file READ in #line
text_file set line_type/text out                                                             "
text_file set line_attribute/print_control out
text_file set line_attribute/first_print_control out
text_file put out
text_file set line_type/text out
text_file set line_attribute/print_control out
text_file set text out #line
text_file set text_attributes out #atts
TEXT_FILE PUT OUT
text_file set line_attribute out
text_file set line_type/text out
text_file put out
.goto READ_NEXT_TAG
! ............................................................
.LABEL GOT_FONTCOMMAND
! next line is font name
!
text_file READ in #line
text_file set line_type/text out                                                             "
text_file set line_attribute/print_control out
text_file set line_attribute/first_print_control out
text_file put out
text_file set line_type/text out
text_file set line_attribute/print_control out
text_file set text out #line
text_file set text_attributes out #atts
TEXT_FILE PUT OUT
text_file set line_attribute out
text_file set line_type/text out
text_file put out
.goto READ_NEXT_TAG
! ............................................................
.LABEL GOT_NOBREAK
! no data line
!
text_file set line_type/text out                                                             "
text_file set line_attribute/print_control out
text_file set line_attribute/first_print_control out
text_file put out
text_file set line_type/text out
text_file set line_attribute/print_control out
text_file set text out            "NO_BREAK"
text_file set text_attributes out "        "
TEXT_FILE PUT OUT
text_file set line_attribute out
text_file set line_type/text out
text_file put out
.goto READ_NEXT_TAG
! ............................................................
.LABEL GOT_ENDNOBREAK
! no data line
!
text_file set line_type/text out                                                             "
text_file set line_attribute/print_control out
text_file set line_attribute/first_print_control out
text_file put out
text_file set line_type/text out
text_file set line_attribute/print_control out
text_file set text out            "END_NO_BREAK"
text_file set text_attributes out "            "
TEXT_FILE PUT OUT
text_file set line_attribute out
text_file set line_type/text out
text_file put out
.goto READ_NEXT_TAG
! ............................................................
.LABEL GOT_COMMENT
! next line is comment
!
text_file READ in #line
text_file set line_type/comment out
text_file put out
text_file set line_type/comment out
text_file set text out            "COMMENT"
TEXT_FILE SET TEXT_ATTRIBUTES OUT "       "
text_file put out
!
text_file set line_type/comment out
text_file set text out #LINE
TEXT_FILE SET TEXT_ATTRIBUTES OUT "                                         "
text_file put out
!
text_file set line_type/text out
TEXT_FILE PUT OUT
.GOTO READ_NEXT_TAG
! ............................................................
.LABEL GOT_PAGE
! got page mark, no data line
!
TEXT_FILE SET LINE_TYPE/HARD_PAGE OUT
TEXT_FILE SET LINE_ATTRIBUTE OUT
TEXT_FILE PUT OUT
.GOTO READ_NEXT_TAG
! ............................................................
.label GOT_SOFTLINE
!
text_file set line_attribute/soft_line out
.goto READ_NEXT_TAG
! ............................................................
.label GOT_STARTCONTROL
! got a TOP or BOTTOM control block, text in next lines until
! tag is not 'TX'
!
text_file set line_type/text out                                            
text_file set line_attribute/print_control out
text_file set line_attribute/first_print_control out
text_file put out
text_file read in #bot
text_file set line_type/text out
text_file set line_attribute/print_control out
text_file set text out            #bot
text_file set text_attributes out "        "
TEXT_FILE PUT OUT
!
.label next_line
text_file read in #tag
.if #tag nes 'TX' then .goto FINISH_CONTROL
text_file READ in #line
text_file READ in #atts
text_file set line_type/text out
text_file set line_attribute/PRINT_CONTROL out
text_file set text out #line
text_file set text_attributes out #atts
text_file put out
.goto next_line
!
.LABEL FINISH_CONTROL
text_file set line_attribute out
TEXT_FILE SET LINE_TYPE/TEXT OUT
TEXT_FILE PUT OUT
.GOTO PROCESS_NEXT_TAG
! ............................................................
.label GOT_ENDCONTROL
! should be caught in GOT_STARTCONTROL
.GOTO READ_NEXT_TAG
! ............................................................
.label GOT_TOC
! TOC processing to be supplied
!
.GOTO READ_NEXT_TAG
! ----------------------------------------------------------------------
.label tag_error
get #mess = "no such tag >" #tag "<  after line" #line 
display (#mess)
.goto eof
! ............................................................
.label open_in_error
display ("open in error " #in)
.exit
! ............................................................
.label open_out_error
display ("open out error " #out)
.exit
! ............................................................
.label eof
text_file close in
text_file close out
! SET_TRACE (OFF)
.exit