home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / unix / scribepi.sha / gmf_inq.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1985-08-29  |  2.2 KB  |  83 lines

  1.  
  2. module gmf_$extend;
  3.  
  4. DEFINE gmf_$inquire;
  5.  
  6. %include '/sys/ins/base.ins.pas';
  7. %include '/sys/ins/streams.ins.pas';
  8.  
  9. procedure gmf_$inquire(
  10.         in id: stream_$id_t;
  11.         out x_dim,y_dim, bpi: integer; out status: status_$t );  EXTERN;
  12.  
  13. procedure gmf_$inquire;
  14.  
  15. const
  16.          gmf_$not_gmf =      16#06040006;
  17.  
  18. TYPE  header_t = PACKED RECORD
  19.         kind : INTEGER;    { type of header }
  20.      version : INTEGER;    {                }
  21.            x : INTEGER;    { x dimension of bitmap in bits }
  22.            y : INTEGER;    { y dimension of bitmap in bits }
  23.      gmf_bpi : INTEGER;    { resolution of data in bits per inch, to whatever degree of }
  24.                            {  accuracy is feasible (0 means each bit is one dot         }
  25.                            {  regardless of the dot size of the output device)          }
  26.       END;
  27.  
  28.   wordsin_t = array [0..1023] of pinteger;     { scanline-size array of read words from streams file }
  29.   wordsin_ptr_t = ^wordsin_t;
  30.  
  31. var
  32.   t,lines       :integer;                    { counters }
  33.   header        :header_t;                   { header identifier }
  34.   wordsin       :wordsin_t;                  { input buffer from map file }
  35.   bufptr,retptr :wordsin_ptr_t;
  36.   retlen        :integer32;
  37.   seek_key      :stream_$sk_t;
  38.  
  39. begin
  40.   stream_$seek( id, stream_$rec, stream_$absolute, 1, status );
  41.   if status.all <> status_$ok then begin
  42.     status.fail := true;
  43.     return;
  44.   end;
  45.  
  46.   bufptr := addr(wordsin);
  47.  
  48.   { setup header information from map file }
  49.   stream_$get_rec (id,bufptr,SIZEOF(header_t),retptr,retlen,seek_key,status);
  50.  
  51.   if status.all <> status_$ok then begin
  52.     status.fail := true;
  53.     return;
  54.   end;
  55.   for t := 0 to 10 do wordsin[t] := retptr^[t];
  56.  
  57.   with header do begin
  58.     kind := wordsin[0];
  59.     version := wordsin[1];
  60.     x := wordsin[2];
  61.     x_dim := wordsin[2];
  62.     y := wordsin[3];
  63.     y_dim := wordsin[3];
  64.     gmf_bpi := wordsin[4];
  65.     bpi := wordsin[4];
  66.   end;
  67.  
  68.   { re-wind the input for future use... }
  69.   stream_$seek( id, stream_$rec, stream_$absolute, 1, status );
  70.   if status.all <> status_$ok then begin
  71.     status.fail := true;
  72.     return;
  73.   end;
  74.                      
  75.   { is opened file really a gmf map file? }
  76.   if header.kind <> 1 then 
  77.     begin
  78.       status.all :=  gmf_$not_gmf;
  79.       return;
  80.     end;
  81.  
  82. end;
  83.