Programmable Macros

The Slick-CŪ macro programming language is behind most of the actions performed in SlickEditŪ Core. Slick-C functions are mapped to menus, buttons, and keys, and perform the action behind an event. You can use Slick-C to extend the editor's functionality. With Slick-C, you can manipulate buffers; parse strings; navigate buffers and source code; and create and modify menus, dialogs, toolbars, and views.

For documentation purposes, "programmable macros" is a term used to encompass Slick-C modules, variables, and batch macros. These items are described in detail below.

This section contains the following topics:

Slick-CŪ Modules

A Slick-C module is a file with the extension .e that contains Slick-C code. Slick-C modules are the most typical use of Slick-C, used to define functionality that you want to keep loaded, such as user-defined commands. You must compile and load a Slick-C module into the State File before it can be utilized. When a module is compiled, the Slick-C translator converts the file into byte code, which is saved in a corresponding file with the extension .ex. To compile and load the module, use the menu item Macro → Load Module. See Loading and Unloading Slick-C Modules for more information.

Tip

Slick-C modules that are included with SlickEdit Core are located in the [EclipseInstallDir]/plugins/com.slickedit.windows.libs_[VERSION]/slickedit/macros subdirectory. You can store the macros you write in any directory you like. It is best not to store your macros in the macros subdirectory, however.

Loading and Unloading Slick-CŪ Modules

To compile and load a Slick-C module into the State File, from the main menu, click Macro → Load Module. You can also press F12 or use the gui_load command on the SlickEditŪ Core command line. The Open dialog is displayed, prompting you for the file to load.

To unload a Slick-C module from the State File, from the main menu, click Macro → Unload Module, or use the gui_unload command.

Caution

  • Use caution when unloading modules that are shipped with SlickEdit Core (standard SlickEdit Core modules). Unloading a standard module could cause the editor to behave unpredictably.

  • Standard modules are identified by file name. If you load a module with a name that matches a standard SlickEdit Core module, it will replace the standard module, which (like unloading a standard module), could potentially cause problems.

Slick-CŪ Variables (Config Variables)

Slick-C variables are global variables that are persistently stored in the State File. Because these typically contain user configuration settings, Slick-C variables are also called "configuration variables". Config variables start with the prefix def_. See Configuration Variables for more information.

Slick-CŪ Batch Macros

A Slick-C batch macro is a .e file that contains a defmain() function. This file cannot be loaded - you must compile and run it from the SlickEditŪ Core command line. Slick-C batch macros are useful for infrequent tasks that do not involve a persistant state. They are different from recorded macros in that they usually perform specific tasks and cannot be bound to a key. An example of a Slick-C batch macro is a file called autotag.e. This batch macro launches the Create Tag Files for Run-Time Libraries dialog that appears when you run SlickEdit Core for the first time. See Creating Tag Files for Compiler-Specific Libraries for more information.

State File

SlickEditŪ Core ships with a system state file that contains default settings. The system state file is only changed or updated when you upgrade. As you make changes to the configuration of the editor or apply customizations, the changes are saved to a user state file, which is a copy of the system state file with user customizations.

The user state file is located in your User Configuration Directory. On Windows, the state file is named vslick.sta, and on UNIX, vslick.stu. The file extensions were made different to avoid any confusion between the two, since a Windows state file is not compatible with UNIX, and vice versa.

The state file is a binary file that stores the following information:

  • Loadable Slick-CŪ Modules.

  • Slick-C settings such as global options, language-specific options, etc.

  • Slick-C resources such as event tables, dialogs, toolbars, views, menus, bitmaps, and icons.

  • DLL-exported function linkage.

The state file does not include DLLs themselves or Slick-CŪ Batch Macros.

Slick-CŪ Header Files and More Resources

Slick-C header files use the .sh extension. All Slick-C source files #include slick.sh.

For information about writing Slick-C, see the Slick-C Macro Programming Guide, which is included in the SlickEditŪ Core Help system and also available as a stand-alone PDF in the docs installation subdirectory.