[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

1566.0. "TEXT_FILE and formatting question." by JOCKEY::MARSHALLJ (Glad that the devil is red ......) Tue Oct 06 1992 19:29

    
    		*** TEXT_FILE modus operandi ?? ***
    
    Hi.
    
    I'm investigating how best to achieve `batch formatting' of WPL docs on
    behalf of my customer (very much along the lines of note 1200).
    
    Customer has been looking at using TEXT_FILE function to seamlessly ie.
    without it appearing to the user on the screen, bring together records
    from a WPL boilerplate and a WPL `text' file.  Using info from 15-2 to
    15-7 of the App Prog guide, 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.
    
    This is what the customer wants.  However, when he follows example
    15-2, the resultant document does have all its attributes, but isn't
    formatted (still requires a GOLD B, GOLD T to sort out line-wrapping
    etc).
    
    Is this how it should happen or are we missing something ??
    
    Regards,
    John
T.RTitleUserPersonal
Name
DateLines
1566.1A humble suggestionSCOTTC::MARSHALLDo you feel lucky?Tue Oct 06 1992 20:069
Hi,

>> bring together records
>> from a WPL boilerplate and a WPL `text' file

Can you not use any of the various MERGE functions?  That is, after all, what
they were designed for?

Scott
1566.2Moved from 3017 - Please don't start new topics!ROMEDU::NEBBIAMario Nebbia @VVR - LS Rome ItalyFri Jul 16 1993 12:4627
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

1566.3GOLD-TABs not preserved ??COMICS::BARHAMNorbert:Tue Aug 31 1993 18:43205
    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
1566.4anyone ?TOPPER::BARHAMNorbert:Fri Sep 03 1993 14:2721
    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
                         
1566.5Topic 2937IOSG::NEWLANDRichard Newland, IOSG, REO2-G/L2Sat Sep 04 1993 20:5113
Topic 2937 in this conference discusses TEXT_FILE limitations in that it
does not support all possible text attributes, and also possible
enhancements to TEXT_FILE so that it could support all text attributes. 

Enhancements to support all text attributes would require code level changes. 

I don't know why the original authors of TEXT_FILE only supported a subset
or the rationale for the subset which was selected. 

I don't know of any workaround the existing limitations of TEXT_FILE.


Richard
1566.6If at first you don't succeed ...IOSG::MAURICEDifferently hirsuteMon Sep 06 1993 12:147
    Perhaps your customer should be using another method to solve the
    problem. What exactly is your customer trying to do? Maybe merging
    files is going to be a solution?
    
    Cheers
    
    Stuart
1566.7TOPPER::BARHAMNorbert:Mon Sep 06 1993 16:0122
    Thanks,
    
    Here is the comment at the top of the customer's script to explain what
    they're trying to achieve...
    
    !Script to copy a WPS document using the TEXT_FILE functions and remove
    !a <CR> and TABS following a special symbol held in #special_char.
    !It also inserts a copy of the first ruler encountered in the document
    !wherever a line with #ruler_char in it is found and replaces the
    !character set in #tab_char with a tab.
    
    
    
    So basically they're editing documents to take out some characters and 
    adding rulers.
    
    The EDIT function wouldn't help in batch would it ? Can MERGE achieve
    anything like this ?
    
    Thanks,
    
    Clive
1566.8Would a UDP be allowed?IOSG::MAURICEDifferently hirsuteTue Sep 07 1993 15:158
    Hi,
    
    I can't think of a good solution for you I'm afraid. I was hoping that
    someone else would! Have you ruled out running a UDP in the foreground?
    
    Cheers
    
    Stuart