www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/24/13:31:05

Date: Thu, 24 Mar 1994 12:28:26 -0500
From: davis AT amy DOT tch DOT harvard DOT edu ("John E. Davis")
To: dj AT ctron DOT com, eliz AT is DOT elta DOT co DOT il
Subject: Re: Line terms; UNIX v. DOS; opinions wanted (was: Info port...)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

>The basic problem is that makeinfo stores absolute offsets and info
>assumes they're still valid when it reads them.  This is *not* true if
>the file has been changed since makeinfo (like cr/lf translation).

This is only an issue if you actually use the offsets.  JED's info reader
only uses the offsets to determine what file it should look in.  Here is how
it is done in S-lang from `info.sl'  (S-Lang is JED's extension language):

define info_find_node_split_file (node)
{
   variable tag, tagpos, pos, pos_len, tag_len, buf, file;
   variable re;
   buf = " *Info*";
  
   !if (bufferp(buf), setbuf(buf)) 
     {
	insbuf("*Info*");
     }
   
   widen();
      
   tag = strcat("Node: ", node);
   eob();
  
   
   re = strcat(tag, "[\t \x7F][0-9]+[ \t]*\n");
   !if (re_bsearch(re)) error ("tag not found");
   eol ();
   bskip_chars(" \t");
   push_mark(); bskip_chars ("0-9");
   tagpos = bufsubstr();  % see comment about DOS below
   tag_len = strlen(tagpos);
  
   bob ();
   bol_fsearch("Indirect:"); pop();
   push_mark();
   !if (info_search_marker(1)) eob();
   narrow();
   bob();
   forever
     {
	!if (down(1)) break;
	bol();
	!if (ffind(": ")) break;
	go_right(2);
	
	% This will not work on DOS with 16 bit ints.  Do strcmp instead.
	push_mark(); eol(); pos = bufsubstr(); 
	pos_len = strlen(pos);
	if (tag_len > pos_len) continue;
	if (tag_len < pos_len) break;
	if (strcmp(tagpos, pos) < 0) break;
     }
   
   Info_Split_File_Buffer = Null_String;
   go_up(1); bol();
   push_mark();
   ffind(": "); pop();
   widen();
   file = bufsubstr();

   info_find_file(file);
   info_find_node_this_file(node);
   Info_Split_File_Buffer = buf;
}

As you can see, the offset is only used to get the right file.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019