PbSlice2 Core Functions
PbSlice is a project for manipulating PowerBASIC source code. This project includes the core source code and test routines for the PbSlice API. The API is provided as a series of Subs and Functions that can either be included directly in your project or via a DLL. These routines were separated to facilitate use in multiple projects. Currently there are no dependencies on external include files. This was done to make it easier for projects using differing include files that do not wish to use the DLL.
The project currently provides some capabilities in project-management, editing, refactoring, and code-generation categories. These will be enhanced over time.
It is the intent of this project to enhance my ability to manipulate source code and automate time consuming repetitive tasks. It is released as Public Domain in the hopes that others may also find a use for it or even possibly contribute enhancements to it.
The PbSlice200DLL.inc provides declarations for use of PbSlice200.dll.
- Place PbSlice200.dll in your project directory or a search path.
- Add the following line to your project: #include "PbSlice200.inc"
- Place PbSlice200.inc in your project directory or one of the compiler include directories for compiling: Window | Options | Compiler | Include in the PbWin/PbCC IDE.
Using PbSlice Source Code
If you want to include the source directly in your project:
- Place the PbSlice source code in your project.
- Set a compiler include path to c:\Prj\Pb\PbSlice2\src, or the directory you placed the PbSlice source code In the PbWin/PbCC IDE use the following menu options: Windows | Options | Compiler | Include.
- Ensure src\PbSlice.inc has the path you placed the source in. Replace ALL c:\Prj\Pb\PbSlice2\Src with the directory you're copy of the source is.
You can look at pbsFix.bas and pbsTest.bas in the test directory for examplesof using the source directly.
- Make a file or snippet the target of future api operations.
- The name specified in the Alias clause for a Sub, Function, Method or Property.
- Base path
- The directory the original Project file was loaded from.
- Formatting codes used by the PowerBASIC forums.
- A PowerBASIC pre-defined symbol See Keyword.
- Short for a line continuation i.e. _
- The source code for a declaration May be a single line, such as for variables, or multiple lines, such as for a Sub.
- The name and location of an asmdata, class, constant, enum, fastproc, field, function, interface, label, macro, method, property, reference, sub, type, union, or variable were defined.
- A file that is not in the Project directory or one of it's sub-directories.
- A single file in a project collection.
- A language element as pre-defined by PowerBASIC Does not include operators.
- Load source file from disk into memory.
- PbSlice core
- The API routines that allow manipulation of source code.
- The collection of files that would be compiled by loading one file.
- Write memory source file to disk.
- The line containing a declaration.
- A set of unrelated source codes May be related to files or not.
- A single word as defined by the PowerBASIC language. i.e. +, For
- A space (Ascii 32) or tab (Ascii 9) characters.
Files and snippets are designed to be activated. Subsequent calls to the API use the last activated file or snippet. You can use either Activate or New routines.
To use any declaration routines you must first perform a scan. Many routines will alter the number or lines or locations of declarations. Whenever one of these routines is used, you must rescan before using another declaration routine.
Adding a file to a project is temporary. To permanently add a file to a project you should add a #Include to the source code. Then future Loads or Reloads will include the file.