home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / DOpus4-GPL / Program / dopusfunctions.c < prev    next >
C/C++ Source or Header  |  2000-01-27  |  11KB  |  258 lines

  1. /*
  2.  
  3. Directory Opus 4
  4. Original GPL release version 4.12
  5. Copyright 1993-2000 Jonathan Potter
  6.  
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License
  9. as published by the Free Software Foundation; either version 2
  10. of the License, or (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. All users of Directory Opus 4 (including versions distributed
  22. under the GPL) are entitled to upgrade to the latest version of
  23. Directory Opus version 5 at a reduced price. Please see
  24. http://www.gpsoft.com.au for more information.
  25.  
  26. The release of Directory Opus 4 under the GPL in NO WAY affects
  27. the existing commercial status of Directory Opus 5.
  28.  
  29. */
  30.  
  31. /* Data for DOpus functions, including the actual internal command list and
  32.    ARexx data */
  33.  
  34. #include "dopus.h"
  35.  
  36. /* List of Internal commands */
  37.  
  38. struct CommandList commandlist[]={
  39.     {"About",FUNC_ABOUT,0},
  40.     {"AddCustEntry",FUNC_ADDCUSTENTRY,RCL_NOBUTTON},
  41.     {"AddCustHandler",FUNC_ADDCUSTHANDLER,RCL_NOBUTTON},
  42.     {"AddFile",FUNC_ADDFILE,RCL_NOBUTTON},
  43.     {"AddIcon",FUNC_ADDICON,0},
  44.     {"Alarm",FUNC_ALARM,0},
  45.     {"All",FUNC_ALL,RCL_NOBUTTON},
  46.     {"AnsiRead",FUNC_ANSIREAD,0},
  47.     {"ARexx",FUNC_AREXX,0},
  48.     {"Assign",FUNC_ASSIGN,RCL_NOBUTTON},
  49.     {"Auto",FUNC_AUTO,RCL_SYNONYM},
  50.     {"Auto2",FUNC_AUTO2,RCL_SYNONYM},
  51.     {"Beep",FUNC_BEEP,0},
  52.     {"BufferList",FUNC_BUFFERLIST,RCL_NOBUTTON},
  53.     {"Busy",FUNC_BUSY,RCL_NOBUTTON},
  54.     {"ButtonIconify",FUNC_ICONIFYBUTTONS,RCL_NOBUTTON},
  55.     {"Byte",FUNC_BYTE,RCL_NOBUTTON|RCL_SYNONYM},
  56.     {"CD",FUNC_SETCURDIR,0},
  57.     {"CheckAbort",FUNC_CHECKABORT,0},
  58.     {"CheckFit",FUNC_CHECKFIT,RCL_NOBUTTON},
  59.     {"ClearBuffers",FUNC_CLEARBUFFERS,RCL_NOBUTTON},
  60.     {"ClearSizes",FUNC_UNBYTE,RCL_NOBUTTON},
  61.     {"ClearWin",FUNC_CLEARWINDOW,RCL_NOBUTTON},
  62.     {"Clone",FUNC_CLONE,RCL_NEEDDEST},
  63.     {"Comment",FUNC_COMMENT,0},
  64.     {"Configure",FUNC_CONFIGURE,0},
  65.     {"ContST",FUNC_CONTST,0},
  66.     {"Copy",FUNC_COPY,RCL_NEEDDEST},
  67.     {"CopyAs",FUNC_COPYAS,RCL_NEEDDEST},
  68.     {"CopyWindow",FUNC_COPYWINDOW,RCL_NOBUTTON},
  69.     {"DateStamp",FUNC_DATESTAMP,0},
  70.     {"Defaults",FUNC_DEFAULTCONFIG,RCL_NOBUTTON},
  71.     {"Delete",FUNC_DELETE,0},
  72.     {"DirTree",FUNC_DIRTREE,RCL_NOBUTTON},
  73.     {"Diskcopy",FUNC_DISKCOPY,0},
  74.     {"DiskcopyBG",FUNC_BGDISKCOPY,0},
  75.     {"DiskInfo",FUNC_DISKINFO,RCL_NOFILE|RCL_NOBUTTON},
  76.     {"DisplayDir",FUNC_DISPLAYDIR,RCL_NOBUTTON},
  77.     {"DopusToBack",FUNC_DOPUSTOBACK,RCL_NOBUTTON},
  78.     {"DopusToFront",FUNC_DOPUSTOFRONT,RCL_NOBUTTON},
  79.     {"Encrypt",FUNC_ENCRYPT,RCL_NEEDDEST},
  80.     {"EndFunction",FUNC_ENDFUNCTION,RCL_SYNONYM},
  81.     {"ErrorHelp",FUNC_ERRORHELP,0},
  82.     {"Execute",FUNC_RUN,0},
  83.     {"FileInfo",FUNC_FILEINFO,RCL_NOBUTTON},
  84.     {"FinishSection",FUNC_ENDFUNCTION,0},
  85.     {"Format",FUNC_FORMAT,0},
  86.     {"FormatBG",FUNC_BGFORMAT,0},
  87.     {"GetAll",FUNC_GETALL,RCL_NOBUTTON},
  88.     {"GetDevices",FUNC_DEVICELIST,RCL_NOBUTTON},
  89.     {"GetDirs",FUNC_GETDIRS,RCL_NOBUTTON},
  90.     {"GetEntry",FUNC_GETENTRY,RCL_NOBUTTON},
  91.     {"GetFiletype",FUNC_GETFILETYPE,RCL_NOBUTTON},
  92.     {"GetFiles",FUNC_GETFILES,RCL_NOBUTTON},
  93.     {"GetNextSelected",FUNC_GETNEXTSELECTED,RCL_NOBUTTON},
  94.     {"GetSelectedAll",FUNC_GETSELECTEDALL,RCL_NOBUTTON},
  95.     {"GetSelectedDirs",FUNC_GETSELECTEDDIRS,RCL_NOBUTTON},
  96.     {"GetSelectedFiles",FUNC_GETSELECTEDFILES,RCL_NOBUTTON},
  97.     {"GetSizes",FUNC_BYTE,RCL_NOBUTTON},
  98.     {"GetString",FUNC_GETSTRING,0},
  99.     {"Help",FUNC_HELP,0},
  100.     {"HexRead",FUNC_HEXREAD,0},
  101.     {"Hunt",FUNC_HUNT,RCL_NOFILE},
  102.     {"Iconify",FUNC_ICONIFY,RCL_NOBUTTON},
  103.     {"IconInfo",FUNC_ICONINFO,0},
  104.     {"Install",FUNC_INSTALL,0},
  105.     {"InstallBG",FUNC_BGINSTALL,0},
  106.     {"LastSaved",FUNC_LASTSAVEDCONFIG,RCL_NOBUTTON},
  107.     {"LoadConfig",FUNC_LOADCONFIG,RCL_NOBUTTON},
  108.     {"LoadStrings",FUNC_LOADSTRINGFILE,RCL_NOBUTTON},
  109.     {"LoopPlay",FUNC_LOOPPLAY,0},
  110.     {"LPlay",FUNC_LOOPPLAY,RCL_SYNONYM},
  111.     {"MakeDir",FUNC_MAKEDIR,0},
  112.     {"Modify",FUNC_MODIFY,0},
  113.     {"Move",FUNC_MOVE,RCL_NEEDDEST},
  114.     {"MoveAs",FUNC_MOVEAS,RCL_NEEDDEST},
  115.     {"NewCLI",FUNC_NEWCLI,0},
  116.     {"NewShell",FUNC_NEWCLI,0},
  117.     {"NextDrives",FUNC_NEXTDRIVES,RCL_NOBUTTON},
  118.     {"NNCopy",FUNC_COPYAS,RCL_NEEDDEST|RCL_SYNONYM},
  119.     {"NNMove",FUNC_MOVEAS,RCL_NEEDDEST|RCL_SYNONYM},
  120.     {"Notify",FUNC_NOTIFY,0},
  121.     {"None",FUNC_NONE,RCL_NOBUTTON},
  122.     {"OtherWindow",FUNC_OTHERWINDOW,RCL_NOBUTTON},
  123.     {"Parent",FUNC_PARENT,RCL_NOBUTTON},
  124.     {"ParentList",FUNC_PARENTLIST,RCL_NOBUTTON},
  125.     {"PatternMatch",FUNC_PATTERNMATCH,0},
  126.     {"Play",FUNC_PLAY,0},
  127.     {"PlayST",FUNC_PLAYST,0},
  128.     {"Print",FUNC_PRINT,0},
  129.     {"PrintDir",FUNC_PRINTDIR,RCL_NOBUTTON},
  130.     {"Protect",FUNC_PROTECT,0},
  131.     {"Query",FUNC_QUERY,0},
  132.     {"Quit",FUNC_QUIT,0},
  133.     {"Read",FUNC_READ,0},
  134.     {"Redraw",FUNC_REDRAW,RCL_NOBUTTON},
  135.     {"Relabel",FUNC_RELABEL,RCL_NOFILE},
  136.     {"Remember",FUNC_REMEMBER,0},
  137.     {"RemoveEntry",FUNC_REMOVEENTRY,RCL_NOBUTTON},
  138.     {"RemoveFile",FUNC_REMOVEFILE,RCL_NOBUTTON},
  139.     {"Rename",FUNC_RENAME,0},
  140.     {"Request",FUNC_REQUEST,0},
  141.     {"Rescan",FUNC_RESCAN,RCL_NOBUTTON},
  142.     {"Reselect",FUNC_RESELECT,RCL_NOBUTTON},
  143.     {"Restore",FUNC_RESTORE,0},
  144.     {"Root",FUNC_ROOT,RCL_NOBUTTON},
  145.     {"Run",FUNC_RUN,0},
  146.     {"SaveConfig",FUNC_SAVECONFIG,0},
  147.     {"ScanDir",FUNC_SCANDIR,RCL_NOBUTTON},
  148.     {"ScrollH",FUNC_SCROLLH,RCL_NOBUTTON},
  149.     {"ScrollToShow",FUNC_SCROLLTOSHOW,RCL_NOBUTTON},
  150.     {"ScrollV",FUNC_SCROLLV,RCL_NOBUTTON},
  151.     {"Search",FUNC_SEARCH,0},
  152.     {"Select",FUNC_SELECT,RCL_NOBUTTON},
  153.     {"SelectEntry",FUNC_SELECTENTRY,RCL_NOBUTTON},
  154.     {"SelectFile",FUNC_SELECTFILE,RCL_NOBUTTON},
  155.     {"SetVar",FUNC_SETVAR,0},
  156.     {"SetWinTitle",FUNC_SETWINTITLE,0},
  157.     {"Show",FUNC_SHOW,0},
  158.     {"SmartRead",FUNC_SMARTREAD,0},
  159.     {"Status",FUNC_STATUS,0},
  160.     {"StopST",FUNC_STOPST,0},
  161.     {"SwapWindow",FUNC_SWAPWINDOW,RCL_NOBUTTON},
  162.     {"Toggle",FUNC_TOGGLE,RCL_NOBUTTON},
  163.     {"TopText",FUNC_TOPTEXT,0},
  164.     {"UnByte",FUNC_UNBYTE,RCL_NOBUTTON|RCL_SYNONYM},
  165.     {"UnIconify",FUNC_UNICONIFY,0},
  166.     {"User1",FUNC_AUTO,0},
  167.     {"User2",FUNC_AUTO2,0},
  168.     {"User3",FUNC_AUTO3,0},
  169.     {"User4",FUNC_AUTO4,0},
  170.     {"Verify",FUNC_VERIFY,0},
  171.     {"Version",FUNC_VERSION,0},
  172.     {NULL,NULL}};
  173.  
  174. /* ARexx and Function data */
  175.  
  176. ULONG rexx_signalbit;                     /* Signal bit for ARexx port */
  177. SHORT rexx_argcount;                      /* ARexx argument count */
  178. char  *rexx_args[16];                     /* ARexx arguments */
  179. LONG  rexx_arg_value[16];                 /* Argument values */
  180. UBYTE rexx_global_flag=0;                 /* Signifies an ARexx command */
  181. char  *rexx_pathbuffer[2];                /* Path buffer of an ARexx argument */
  182. LONG  rexx_result_code;                   /* Return code for ARexx functions */
  183. LONG  rexx_return_value;                  /* RC for ARexx functions */
  184.  
  185. ULONG func_global_function=0;             /* Global function number */
  186. char  func_single_file[32];               /* Single file to operate on */
  187. char  func_external_file[256];            /* External file to operate on */
  188. struct Directory *func_single_entry=NULL; /* Single entry to operate on */
  189. UBYTE func_entry_deleted=0;               /* Indicates entry was deleted */
  190.  
  191. struct DirWindowPars func_reselection;    /* Reselection data */
  192.  
  193. /* Parameters recognised by the Modify command */
  194.  
  195. char *modifynames[]={
  196.     "CopyFlags",                            /* copyflags */
  197.     "DeleteFlags",                          /* deleteflags */
  198.     "ErrorFlags",                           /* errorflags */
  199.     "ListFormat",                           /* displaypos */
  200.     "GeneralFlags",                         /* generalflags */
  201.     "IconFlags",                            /* iconflags */
  202.     "ReplaceFlags",                         /* existflags */
  203.     "SortFlags",                            /* sortflags */
  204.     "UpdateFlags",                          /* dynamicflags */
  205.     "OutputCmd",                            /* outputcmd */
  206.     "OutputWindow",                         /* output */
  207.     "ScrDepth",                             /* scrdepth */
  208.     "ScreenFlags",                          /* screenflags */
  209.     "ScreenMode",                           /* screenmode */
  210.     "ScrW",                                 /* scrw */
  211.     "ScrH",                                 /* scrh */
  212.     "DirFlags",                             /* dirflags */
  213.     "Helpfile",                             /* helpfile */
  214.     "DefaultTool",                          /* defaulttool */
  215.     "ShowDelay",                            /* showdelay */
  216.     "ViewPlayFlags",                        /* viewbits */
  217.     "FadeDelay",                            /* fadetime */
  218.     "ShowPatBits",                          /* hiddenbit */
  219.     "ShowPattern",                          /* showpat */
  220.     "HidePattern",                          /* hidepat */
  221.     "IconifyFlags",                         /* icontype */
  222.     "ScrClockFlags",                        /* scrclktype */
  223.     "ShowFreeFlags",                        /* showfree */
  224.     "Font",                                 /* fontsizes/fontbufs */
  225.     "BankNumber",                           /* current gadget bank */
  226.     "DateFormat",                           /* dateformat */
  227.     "ButtonRows",                           /* gadgetrows */
  228.     "DisplayLength",                        /* displaylength */
  229.     "WindowSize",                           /* windowdelta */
  230.     "SortMethod",                           /* sortmethod */
  231.     "SeparateMethod",                       /* separatemethod */
  232.     "Filter",                               /* file filter */
  233.     "WindowXY",                             /* wbwinx, wbwiny */
  234.     "WindowWH",                             /* scr_winw, scr_winh */
  235.     "PubScreen",                            /* pubscreen_name */
  236.     "WindowXYWH",                           /* wbwinx, wbwiny, scr_winw, scr_winh */
  237.     "ScreenName",                           /* Screen we are open on */
  238.     "PortName",                             /* Rexx port name */
  239.     ""};
  240.  
  241. /* Data for Remember/Restore function */
  242.  
  243. struct RememberData *remember_data;       /* Storage for remembered data */
  244.  
  245. /* Date for Search function */
  246.  
  247. int search_flags=SEARCH_NOCASE;           /* Search flags */
  248. char *search_found_position;              /* Position of match */
  249. int search_found_size;                    /* Bytes searched */
  250. int search_found_lines;                   /* Lines searched */
  251. int search_last_line_pos;                 /* Last line position searched */
  252.  
  253. /* Data for Show Info routine */
  254.  
  255. struct TextFont *show_global_font=NULL;   /* Font info */
  256. struct DiskObject *show_global_icon=NULL; /* Icon info */
  257. char *show_global_icon_name;              /* Icon name */
  258.