Re: xpm resources

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

I think that 2 kinds of mechanisms are enough:

1. For programs that need small amount of data (few icons, etc).
2. For programs that need lots of data (200 icons, other stuff).

1. Small data can be stored in a regular Euphoria sequence (of course):

sequence icons = repeat({}, 15) 
   icons[1] = {0,0,0,0,1,1,1,46,128,255,0,0,...} 
   icons[2] = {0,0,0,0,64,25,30,30,1,1,0,0,...} 
-- ... 

2. Lots of data should be appended to a single data file:

-- (not debugged) 
integer  fn_single, fn_source, byte, counter 
sequence files_list = {"icon1.gif", "icon2.xpm", "hello.txt", "logo.jpg",...} 
sequence files_start_end = repeat({0, -1}, length(files_list)) 
 
fn_single = open(program_name & "dat", "wb")  
counter = 0 
 
for i = 1 to length(files_list) do 
    fn_source = open(files_list[i], "rb") 
    files_start_end[i][1] = counter + 1  
 
    while 1 do 
        byte = getc(fn_source) 
        if byte = -1 then  
            exit  
        else     
            counter += 1 
            puts(fn_single, byte) 
        end if 
    end while 
 
    files_start_end[i][2] = counter  
    close(fn_source) 
end for 
 
close(fn_single) 


Now, I know it may look stupid... but this is straightforward, easy, simple and common.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu