Macros |
Program Macros OverviewMacros are the set of Objects, Inline Functions, Inline Methods, and #Define Statements, available to all your Fractal Science Kit fractal programs. At first, you may not need any macros other than the built-in macros. In fact, it is recommended that you read through the built-in macros so you know what is available, and to get an idea how to define your own macros when the time comes. As you begin to develop fractal programs, you will find that you want to use a piece of code you have already written in another program. Creating a function or method in My Macros solves this problem. All the macros in My Macros can be used in any of your programs. Since the functions/methods are compiled inline and highly optimized, there is virtually no overhead for calling a macro. Macros increase your productivity by allowing you to define blocks of code in a central location and include that code in your program simply by referencing the macro name. Macros can define arguments that allow you to pass information to the macro code when you call the macro. Before you can use a macro, it must be defined. Macros are defined in 3 places:
Use the Macro Editor to view/edit the macro code in the built-in macros, My Macros, or any file containing macro definitions. WarningWhen you use a macro in a fractal program, the macro is expanded inline in your program when the program is compiled/run. This means that changes to the set of macros can impact existing programs and saved fractal properties files. This is both a blessing and a curse! If you improve a macro, all the programs and fractal files that reference the macro, will get the new and improved version the next time they are compiled. No action on your part is required. However, if you introduce a bug in a macro, or you change the required arguments to a macro, or you remove a macro altogether, you can break existing programs and fractal files without even knowing you have done so. You could even inadvertently change your favorite fractal by fixing a bug in a macro! Please be careful. |
Copyright © 2004-2019 Ross Hilbert |