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

  1. /*************************************************
  2.  *
  3.  *  SaveFACT.FPL
  4.  *
  5.  *  Prompt for a file, and make a FPL program that will generate the
  6.  *  current FACT setup.
  7.  *
  8.  ***********/
  9. {
  10.   int counter;
  11.   string result;
  12.   int temp;
  13.   string tempstring;
  14.   int oldid=GetEntryID();
  15.   int newid;
  16.   string file;
  17.  
  18.   file=PromptFile();
  19.   
  20.   if (strlen(file)) {
  21.     newid=New();
  22.  
  23.     if (newid) {
  24.       CurrentBuffer(newid);
  25.       Rename(file);
  26.       SetInfo("undo", 0);
  27.   
  28.       for (counter=-2; counter<256; counter++) {
  29.         Status(oldid, joinstr("Countdown: ", ltostr(256-counter)));
  30.         Output(joinstr("FACT(", ltostr(counter), ", 'E', '-'"));
  31.         tempstring=FACTString(counter);
  32.         if (counter!=tempstring[0] || strlen(tempstring)!=1)
  33.           Output(joinstr(", 'S', \"", CConvertString(tempstring), "\""));
  34.   
  35.         if (counter>=0) {
  36.           temp=Isopen(counter);
  37.           if (temp>=0)
  38.             Output(joinstr(", '(', ", ltostr(temp)));
  39.     
  40.           temp=Isclose(counter);
  41.           if (temp>=0)
  42.             Output(joinstr(", ')', ", ltostr(temp)));
  43.     
  44.           temp=Islower(counter);
  45.           if (temp>=0)
  46.             Output(joinstr(", 'L', ", ltostr(temp)));
  47.     
  48.           temp=Isupper(counter);
  49.           if (temp>=0)
  50.             Output(joinstr(", 'U', ", ltostr(temp)));
  51.     
  52.           if (Isnewline(counter))
  53.             Output(", 'N'");
  54.     
  55.           if (Isspace(counter))
  56.             Output(", ' '");
  57.     
  58.           if (Issymbol(counter))
  59.             Output(", '!'");
  60.     
  61.           if (Isword(counter))
  62.             Output(", 'W'");
  63.     
  64.           if (Istab(counter))
  65.             Output(", 'T'");
  66.         }
  67.         Output(");\n");
  68.       }
  69.       Save(file);
  70.       CurrentBuffer(oldid);
  71.       Kill(newid);
  72.       Status();
  73.     }
  74.   } else
  75.     ReturnStatus("Function canceled!");
  76. }
  77.  
  78.