| Let me re-open note 1556 about TEXT_FILE functions:
================================================================================
Note 1566.0 TEXT_FILE and formatting question. 1 reply
JOCKEY::MARSHALLJ "Glad that the devil is red ......" 26 lines 6-OCT-1992 16:29
--------------------------------------------------------------------------------
> it would seem that READ and WRITE
> subfunctionds of TEXT_FILE will move text happily but drop any
> attributes, ruler settings etc. Moving on from this, the other
> subfunctions (RETURN,SET,GET and PUT) can be used to move text while
> retaining attributes and ruler settings.
I find the same problem, with the difference that GOLD B doesn't work.
More, every line in the new document termi9nates with a carriage-return
character.
Is there any hint to produce "real" WPS-PLUS documents usinf TEXT_FILE
functions?
In case you must produce "real" WPS-PLUS document are TEXT_FILE functions
a real solution, or we must use anything else?
Regards
Mario
|
| ALL-IN-1 3.0-1
I have a customer complaining about GOLD-TABs being converted to
standard TABs by the TEXT_FILE function.
Here is some sample code (not the customers, on COMICS::TEXT_FILE2.SCP)
that demonstrates the problem - a GOLD VIEW shows that the has been
replaced by a HT... (Horizontal Tab code)
This means that GOLD-TABs cannot be copied from one text file to
another.
I'll probably need to SPR this unless there's a good workaround ?...
Thanks,
Clive
! TEXT_FILE.SCP
!
! This is a script to demonstrate TEXT_FILE operations
! NOTE: THEY ARE NOT INTENDED TO COPY FILES LIKE THIS SCRIPT, THUS
! PERFORMANCE IS NOT TOO HOT!
! Get the name of the file to be used on INPUT
PROMPT 'INPUT filename: '
.IF OA$PROMPT_DISPOSE EQS '0' THEN .EXIT
GET #IN = OA$PROMPT_TEXT
! Get the name of the file to be used on OUTPUT
PROMPT 'OUTPUT filename: '
.IF OA$PROMPT_DISPOSE EQS '0' THEN .EXIT
GET #OUT = OA$PROMPT_TEXT
!
! Clear the screen so we can display the text to the user
!
.CLEAR 1,24
! First we will do a copy using only the TEXT portions of the file.
! This pays no attention to attributes
! Open the input file
TEXT_FILE OPEN/READ IN #IN
.IF OA$STATUS EQS '0' THEN .GOTO OPEN_IN_ERROR
! Open the output file
TEXT_FILE OPEN/WRITE OUT #OUT
.IF OA$STATUS EQS '0' THEN .GOTO OPEN_OUT_ERROR
.LABEL LOOP
! read a line of text
TEXT_FILE READ IN #ONE_LINE_OF_TEXT
.IF OA$STATUS EQS '0' THEN .GOTO END_OF_FILE
! Write a line of text
TEXT_FILE WRITE OUT #ONE_LINE_OF_TEXT
!
! Display the text
!
.CLEAR 1,1
.TEXT 1,1, #ONE_LINE_OF_TEXT
.GOTO LOOP
.LABEL END_OF_FILE
! Close the files
TEXT_FILE CLOSE IN
TEXT_FILE CLOSE OUT
!
! Now for a copy paying attention to Attributes
! Open the input file again (could not have left it open and
! started again, as it would still be pointing at the end)
TEXT_FILE OPEN/READ IN #IN
!This time will APPEND to the output from the first copy,
instead
! of creating a new file
TEXT_FILE OPEN/APPEND OUT #OUT
.LABEL TOP
! Get something from the input file. We need the CHANGE_MAP to
! find out what we got. The 'bits' of the CHANGE_MAP
! tell us what we got.
TEXT_FILE GET IN #CHANGE_MAP
.IF OA$STATUS EQS '0' THEN .GOTO EOF
.IF #CHANGE_MAP:1:5 NES '1' THEN .GOTO CHECK_LINE_TYPE
!
! Got a RULER change
!
TEXT_FILE RETURN RULER IN #RULER
TEXT_FILE SET RULER OUT #RULER
!
! #RULER is set just like you would in WPS-PLUS
!
.LABEL CHECK_LINE_TYPE
.IF #CHANGE_MAP:1:2 NES '1' THEN .GOTO CHECK_LINE_ATTRIBUTE
!
! Got a line type change
!
GET #LINE_TYPE = ""
TEXT_FILE RETURN LINE_TYPE IN #LINE_TYPE_TMP
FOR
OA$TABLE:"0./TEXT,1./REGIS,2./VT100,6./COMMENT,7./SIXEL,8./HARD_PAG
DO GET #TMP=.%KEY\\GET_TOKEN #TMP,#POS,"."\\-
GET OA$FUNCTION=".IF #LINE_TYPE_TMP:1:" #POS " EQS '1'
THEN -
GET #LINE_TYPE = #LINE_TYPE #TMP"
GET OA$FUNCTION="TEXT_FILE SET LINE_TYPE OUT " #LINE_TYPE
!
! #LINE_TYPE must be one of:
!
! TEXT - 1000000000000000000
! REGIS - 0100000000000000000
! VT100 - 0010000000000000000
! COMMENT - 0000001000000000000
! SIXEL - 0000000100000000000
! HARD_PAGE - 0000000010000000000
! SOFT_PAGE - 0000000001000000000
!
.LABEL CHECK_LINE_ATTRIBUTE
.IF #CHANGE_MAP:1:6 NES '1' THEN .GOTO CHECK_TEXT
! Got a line attributes change
!
GET #LINE_ATTRIBUTE = ""
TEXT_FILE RETURN LINE_ATTRIBUTE IN #LINE_ATTRIBUTE_TMP
FOR
OA$TABLE:"0./SOFT_LINE,1./CENTERED,2./PARAGRAPH,3./PRINT_CONTROL,4.
DO GET #TMP=.%KEY\\GET_TOKEN #TMP,#POS,"."\\-
GET OA$FUNCTION=".IF #LINE_ATTRIBUTE_TMP:1:" #POS " EQS
'1' THE
GET #LINE_ATTRIBUTE = #LINE_ATTRIBUTE #TMP"
GET OA$FUNCTION="TEXT_FILE SET LINE_ATTRIBUTE OUT "
#LINE_ATTRIBUTE
!
! #LINE_ATTRIBUTE must be one of:
!
! SOFT_LINE - 100000000000
! CENTERED - 010000000000
! PARAGRAPH - 001000000000
! PRINT_CONTROL - 000100000000
! FIRST_PRINT_CONTROL - 000010000000
!
.LABEL CHECK_TEXT
.IF #CHANGE_MAP:1:9 NES '1' THEN .GOTO CHECK_TEXT_ATTRIBUTES
!
! Got TEXT change
!
TEXT_FILE RETURN TEXT IN #TEXT
TEXT_FILE SET TEXT OUT #TEXT
.LABEL CHECK_TEXT_ATTRIBUTES
.IF #CHANGE_MAP:1:10 NES '1' THEN .GOTO WRITE_OUTPUT
!
! Got TEXT_ATTRIBUTES change
!
TEXT_FILE RETURN TEXT_ATTRIBUTES IN #TEXT_ATTRIBUTES
TEXT_FILE SET TEXT_ATTRIBUTES OUT #TEXT_ATTRIBUTES
!
! #TEXT_ATTRIBUTES can contain any of the following for each charater
! possition:
!
! B - bold
! E - Bold and Underline
! X - Special
! T - Tab
! U - Underline
! = - Double Underline
! Q - Superscript
! A - Subscript
! R - Redline
!
.LABEL WRITE_OUTPUT
!
!
TEXT_FILE PUT OUT
!
! Display to the screen all the new stuff
!
.CLEAR 1,6
.TEXT 1,1, "CM " #CHANGE_MAP
.TEXT 2,1, "R " #RULER
.TEXT 3,1, "LT " #LINE_TYPE
.TEXT 4,1, "LA " #LINE_ATTRIBUTE
.TEXT 5,1, "T " #TEXT
.TEXT 6,1, "TA " #TEXT_ATTRIBUTES
.PAUSE 2
!
! Clear all the symbols
!
GET #RULER=#TEXT=#LINE_TYPE=#LINE_ATTRIBUTE=#TEXT_ATTRIBUTES=""
.GOTO TOP
.LABEL EOF
TEXT_FILE CLOSE IN
TEXT_FILE CLOSE OUT
.EXIT
.LABEL OPEN_IN_ERROR
DISPLAY Error opening input file
.EXIT
.LABEL OPEN_OUT_ERROR
TEXT_FILE CLOSE IN
DISPLAY Error opening output file
.EXIT
|
| Unfortunately this problem now requires high level escalation, they
actually want a CLD...
The reason being that WPS-PLUS was bought almost entirely because of its
ability to edit documents under program control. They claim they'll drop
ALL-IN-1 without this functionality which they are trying to achieve via the
TEXT_FILE function. Because this function does not preserve GOLD-TABs
they cannot edit any document that contains GOLD-TABs (TEXT_FILE
reads and changes the whole file record by record) since the resulting
output document has a different format.
Since my program has been deleted I've now moved it to
WAYOUT::TEXT_FILE2.SCP.
Does anyone have a workaround or other suggestion for editing a
document under program control please, otherwise a CLD will be winging
its way to engineering me thinks...
Thanks,
Clive Barham
UK CSC
|