a pesky file closing logic problem... 
Author Message
 a pesky file closing logic problem...

Ok, you ps whizzes,

I'm in an environment where certain print agents wrap things around my code
outside of my control. I'm attempting to write a font load module which
intelligently searches for a string like %%EOF which I will insert at the end of
the font, and then pick up and continue executing whatever follows.

This would be simple if I could use "readline," but I can't because of the
possibility of binary font data. "Readstring" or "readhexstring" on the other
hand create a condition where my end-of-font token may occur in the middle of a
buffer.

So, I do a readstring, and then a "search" to write the last fragment of font
code to the right place, and it's working fine. My problem is, what do I do to
get the next fragment of the file to execute as it was written? Keep in mind
that not only do I have a partial buffer of executable data, that buffer may
actually have a fragment of a command at the end.

Right now the code looks like the following, and I get an "undefined" error when
the interpreter attempts to execute the fragment of a command which immediately
follows the end of my last "readstring" buffer:

(fonts/somefilename)
/fd exch (w) string def
/buff 128 string def
/endcmd 128 string def
{
        currentfile buff readstring
        {
                (%%EOF) search
                { fd exch writestring pop pop
                  fd closefile exit }
                { fd exch writestring }
                ifelse
        }
        {
                (%%EOF) search
                { fd exch writestring pop
                  fd closefile
                  %
                  % An attempt to append the "post" string to the next buffer
                  % and execute it... but it doesn't work
                  endcmd exch copy length endcmd exch
                  currentfile buff readline putinterval cvx exec
                  %
                  exit }
                { fd exh writestring
                  fd closefile
                  exit }
                ifelse
        } ifelse

Quote:
}

% Font code here
%%EOF
% code here that I have no control over

Any ideas?

Thanks in advance.

Phil Weingart



Mon, 26 Nov 2001 03:00:00 GMT  
 a pesky file closing logic problem...

Quote:

>Ok, you ps whizzes,

>I'm in an environment where certain print agents wrap things around my code
>outside of my control. I'm attempting to write a font load module which
>intelligently searches for a string like %%EOF which I will insert at the
end of
>the font, and then pick up and continue executing whatever follows.
...

>Any ideas?

Read up on SubFileDecode (level 2) filters

Quote:
>Thanks in advance.

>Phil Weingart

--
Roger


Mon, 26 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. scripting logic problem, need help

2. Last Try... Logic Problems

3. Logic Problems

4. logic problem with if then or select case

5. scripting logic problem, need help

6. Last Try... Logic Problems

7. logic problem / have data and situation / need help

8. Problems Closing a New Window using window.close()

9. Operator logic in an HTX file

10. RegExp question (about those pesky, perplexing, perverse, pernicious, patterns)

11. Logic Symbols Needed

12. Using Components for Business Logic

 

 
Powered by phpBB® Forum Software