home *** CD-ROM | disk | FTP | other *** search
- /*************************************************
- *
- * SaveFACT.FPL
- *
- * Prompt for a file, and make a FPL program that will generate the
- * current FACT setup.
- *
- ***********/
- {
- int counter;
- string result;
- int temp;
- string tempstring;
- int oldid=GetEntryID();
- int newid;
- string file;
-
- file=PromptFile();
-
- if (strlen(file)) {
- newid=New();
-
- if (newid) {
- CurrentBuffer(newid);
- Rename(file);
- SetInfo("undo", 0);
-
- for (counter=-2; counter<256; counter++) {
- Status(oldid, joinstr("Countdown: ", ltostr(256-counter)));
- Output(joinstr("FACT(", ltostr(counter), ", 'E', '-'"));
- tempstring=FACTString(counter);
- if (counter!=tempstring[0] || strlen(tempstring)!=1)
- Output(joinstr(", 'S', \"", CConvertString(tempstring), "\""));
-
- if (counter>=0) {
- temp=Isopen(counter);
- if (temp>=0)
- Output(joinstr(", '(', ", ltostr(temp)));
-
- temp=Isclose(counter);
- if (temp>=0)
- Output(joinstr(", ')', ", ltostr(temp)));
-
- temp=Islower(counter);
- if (temp>=0)
- Output(joinstr(", 'L', ", ltostr(temp)));
-
- temp=Isupper(counter);
- if (temp>=0)
- Output(joinstr(", 'U', ", ltostr(temp)));
-
- if (Isnewline(counter))
- Output(", 'N'");
-
- if (Isspace(counter))
- Output(", ' '");
-
- if (Issymbol(counter))
- Output(", '!'");
-
- if (Isword(counter))
- Output(", 'W'");
-
- if (Istab(counter))
- Output(", 'T'");
- }
- Output(");\n");
- }
- Save(file);
- CurrentBuffer(oldid);
- Kill(newid);
- Status();
- }
- } else
- ReturnStatus("Function canceled!");
- }
-
-