home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Editor / DVD!FX17.LHA / FrexxEd / fpl / SaveFACT.FPL < prev    next >
Encoding:
Text File  |  1995-04-13  |  2.0 KB  |  83 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, factname;
  17.   string facts[1];
  18.   int fact_no;
  19.  
  20.   fact_no=GetList("FACT", &facts);
  21.   Sort(&facts);
  22.   if ((fact_no==1 || RequestWindow("Save FACT", "", "a", &facts, &factname, -1)) &&
  23.       strlen(file=PromptFile("","FACT file name"))) {
  24.     newid=New();
  25.  
  26.     if (newid) {
  27.       CurrentBuffer(newid);
  28.       Rename(file);
  29.       SetInfo(-1, "undo", 0);
  30.   
  31.       if (strlen(factname))
  32.         Output("FACTCreate(\""+factname+"\");\n");
  33.       for (counter=-5; counter<256; counter++) {
  34.         Status(oldid, joinstr("Countdown: ", ltostr(256-counter)));
  35.         Output("FACT(\""+factname+"\", "+ltostr(counter)+", 'E', '-'");
  36.         tempstring=FACTString(counter);
  37.         if (counter!=tempstring[0] || strlen(tempstring)!=1)
  38.           Output(joinstr(", 'S', \"", CConvertString(tempstring), "\""));
  39.   
  40.         if (counter>=0) {
  41.           temp=Isopen(counter);
  42.           if (temp>=0)
  43.             Output(joinstr(", '(', ", ltostr(temp)));
  44.     
  45.           temp=Isclose(counter);
  46.           if (temp>=0)
  47.             Output(joinstr(", ')', ", ltostr(temp)));
  48.     
  49.           temp=Islower(counter);
  50.           if (temp>=0)
  51.             Output(joinstr(", 'L', ", ltostr(temp)));
  52.     
  53.           temp=Isupper(counter);
  54.           if (temp>=0)
  55.             Output(joinstr(", 'U', ", ltostr(temp)));
  56.     
  57.           if (Isnewline(counter))
  58.             Output(", 'N'");
  59.     
  60.           if (Isspace(counter))
  61.             Output(", ' '");
  62.     
  63.           if (Issymbol(counter))
  64.             Output(", '!'");
  65.     
  66.           if (Isword(counter))
  67.             Output(", 'W'");
  68.     
  69.           if (Istab(counter))
  70.             Output(", 'T'");
  71.         }
  72.         Output(");\n");
  73.       }
  74.       Save(file);
  75.       CurrentBuffer(oldid);
  76.       Kill(newid);
  77.       Status();
  78.     }
  79.   } else
  80.     ReturnStatus("Function canceled!");
  81. }
  82.  
  83.