home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / TextEditors&Viewers / Texteditors / FFRED10.LHA / fpl / Index.FPL < prev    next >
Encoding:
Text File  |  1994-09-22  |  1.8 KB  |  99 lines

  1. export int FixIndex()
  2. {
  3.   int line;
  4.   int col;
  5.   int page;
  6.   string block;
  7.   int number;
  8.   int max;
  9.  
  10.   Visible(0);
  11.   GotoLine(1);
  12.   SearchSet("f+");
  13.   while(!Search("@#"))
  14.     number++;
  15.  
  16.   GotoLine(1);
  17.  
  18.   max = number;
  19.  
  20.   while(number) {
  21.     page=1;
  22.     SearchSet("f+");
  23.  
  24.     Status(0, Sprintf("%ld left!", number));
  25.  
  26.     if(Search("@#")) {        // block start
  27.       ReturnStatus("No reference found!");
  28.       return 0;
  29.     }
  30.     CursorRight(2);
  31.     line = ReadInfo("line");
  32.     col = ReadInfo("byte_position");
  33.   
  34.     BlockMark();
  35.     if(Search("@")) {        // block end
  36.       ReturnStatus("No end of reference found!");
  37.       return 0;
  38.     }
  39.     BlockCut();
  40.     block = GetBlock();
  41.     GotoLine(1);
  42.     Search(block);
  43.   
  44.     SearchSet("f-");
  45.     if(!Search(" ")) {
  46.       int line = ReadInfo("line");
  47.       CursorRightWord(3);
  48.       if(line != ReadInfo("line")) {
  49.         while(!Search(" "))
  50.           page++;
  51.       } else
  52.         page = atoi(GetWord());
  53.     }
  54.     GotoLine(line, col); // get back to start
  55.     Backspace(2);
  56.     Delete();
  57.     Output(itoa(page));
  58.  
  59.     number--;
  60.   }
  61.   return 1;
  62. }
  63.  
  64. export int FixHeaders()
  65. {
  66.   int page =1;
  67.   int lastline=0;
  68.   int nowline=0;
  69.   Visible(0);
  70.   GotoLine(1);
  71.   SearchSet("f+");
  72.   while(!Search(" ")) {
  73.     nowline = ReadInfo("line");
  74.     if(nowline-lastline > 72) {
  75.       int ret;
  76.       ret = Request(Sprintf("Page %ld was %ld lines!\nContinue?", page, nowline-lastline), "Info", "Continue|Abort");
  77.       if(!ret)
  78.         break;
  79.     }
  80.     lastline = nowline;
  81.     page++;
  82.     CursorRight();
  83.     DeleteEol();
  84.     Output(Sprintf("%65lcPage: %ld", ' ', page));
  85.   }
  86. }
  87.  
  88. export int RemoveFormFeeds()
  89. {
  90.   Visible(0);
  91.   SearchSet("f+");
  92.   while(!Search(" "))
  93.     DeleteLine();
  94. }
  95.  
  96. AssignKey("FixHeaders();", "control I");
  97. AssignKey("FixIndex();", "control i");
  98. AssignKey("RemoveFormFeeds();", "control alt i");
  99.