Re: Embedding Graphics.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here's another one - short and sweet smile


--- begin incsesf.e --

-- incsesf -- Sequence to include file -- G.Burke 4/98 -- <hmi at
powerup.com.au>
--
-- Pass the procedure any sequence as data, give it a name, and an include
-- file will be generated. This method uses standard Euphoria sequence format
-- which results in larger generated files than the method employed in
-- incbm() and incseq(). The advantage is that it is more memory efficiant;
-- provided that the sequence is left unaltered, only one copy will be kept in
-- memory. I imagine pk/win zip will make light work of all those commas.
-- If you get a "subprogram too large" message, update to the current version
-- of Euphoria.

include file.e

global procedure incsesf(sequence data,sequence name)
    integer fn,fn2,c,l,flag
    fn2=open("temp.hmi","wb") print(fn2,data) close(fn2)
    fn2=open("temp.hmi","rb") fn=open(name&".e","wb")
    puts(fn,"\n-- incsesf -- "&name&
    " -- G.Burke  4/98\nglobal constant "&name&" =\n")
    l=seek(fn2,-1) l=where(fn2) c=seek(fn2,0) flag=0
    for x=1 to l do
        c=getc(fn2) puts(fn,c)
        if flag then
            if c=',' then
                puts(fn,"\n") flag=0
        end if end if
        if remainder(x,75)=0 then
            flag=1
        end if
    end for
    puts(fn,"\n\n") close(fn) close(fn2)
    system("del temp.hmi",2)
end procedure

--- end incsesf.e ---

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu