Category : Graphic Animations - Lots of older FLI's
Archive   : GIFCOM.ZIP
Filename : GIFCOM.TXT

 
Output of file : GIFCOM.TXT contained in archive : GIFCOM.ZIP
; Demo program written in MMGrasp 1.0 to read comments from a GIF file
; and put in a variable

set wrap on
local my_image f1.gif
global gifcmt "" ; the variable which will contain the comment

read_comment @my_image

if @0
text "
ERROR "$@0

waitkey
else
text "
SUCCESS

"
endif

text @gifcmt

waitkey
exit


;===================================================================
; read_comment:
;
; reads single GIF Comment and puts it in a global variable "GIFCMT"
; traps most errors which might be encountered. No guarantees.
; Has received limited testing. Any comments, suggestions, to
; Marc Reinig CIS 72410,77
; ERRORS: 1-GIF data error; 2-Read error; 3-Not a GIF file; 4-Open error

read_comment:

local IOBUFSIZE 257 ;
local gifin 0
local COMMA 0x2C ; image id
local BANG 0x21 ; extension
local SEMICOLON 0x3B ; terminator
local ERROR 0
local bufptr 0

local gifname @1
alloc iobuf @IOBUFSIZE

set gifin open(@gifname)
if @gifin==0
return 4
endif
read_header @gifname
if @error end1

show_comments
if @error end1
end1:
free iobuf
set junk close(@gifin)
return @ERROR


read_header:
local colors 0

set bufptr read(@gifin,@iobuf,3)
if @bufptr<>3
set ERROR 2
return
else
if @@iobuf<>"GIF"
set ERROR 3
return
endif
endif
set bufptr read(@gifin,@iobuf,10)
if @bufptr<>10
set ERROR 2
return
else
set tmp peek(@iobuf+7)
if @tmp&0x80
set colors 1<<(((peek(@iobuf+7))&(0x07))+1)
realloc iobuf 3*@colors
set bufptr read(@gifin,@iobuf,3*@colors)
if @bufptr<>3*@colors
set ERROR 2
return
endif
else
set colors 2
endif
endif
return



do_comment:
local count 0
skip1:
set bufptr read(@gifin,@iobuf,1)
if @bufptr<>1
set ERROR 2
return
endif
set count peek(@iobuf)
if @count==0
return
endif
realloc iobuf @count
set bufptr read(@gifin,@iobuf,@count)
if @bufptr<>@count
set ERROR 2
return
endif
set gifcmt @gifcmt$@@iobuf
goto skip1
return


skip_blocks:
realloc iobuf 257
local count 0
skip:
set bufptr read(@gifin,@iobuf,1)
set count peek(@iobuf)
if @count==0
return
endif
set bufptr read(@gifin,@iobuf,@count)
if @bufptr<>@count
set ERROR 2
return
endif
goto skip
return


show_comments:
local c ""
while:
set bufptr read(@gifin,@iobuf,1)
if @bufptr<>1 ; EOF
return
endif

set c peek(@iobuf)
if @c<>@SEMICOLON
if @c==@comma ; image
set bufptr read(@gifin,@iobuf,10)
if @bufptr<>10
Set ERROR 2
return
endif
skip_blocks
else if @c==@BANG
set bufptr read(@gifin,@iobuf,1)
if @bufptr<>1
Set ERROR 2
return
endif
set c peek(@iobuf)
if @c==0xFE
do_comment
else
skip_blocks
endif
else
set ERROR 1
return
endif
if @ERROR
Return
endif
endif
goto while
return



  3 Responses to “Category : Graphic Animations - Lots of older FLI's
Archive   : GIFCOM.ZIP
Filename : GIFCOM.TXT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/