Procedure Declaration Keywords
Use the following keywords to declare procedures of various kinds. These keywords always appear in an Igor procedure window, not in the command line.
End
The End keyword signals the end of a macro, function, or menu definition. See Function for an example.
EndMacro
The EndMacro keyword signals the end of a macro. You can also use the End keyword to end a macro. See Macro for an example.
EndStructure
The EndStructure keyword marks the end of a Structure definition.
Function [ /C /D /S /DF /WAVE ]
The Function keyword introduces a user-defined function in a procedure window.
The optional flags specify the return value type, if any, for the function.
Flags
| /C | Returns a complex number. | |
| /D | Returns a double-precision number. Obsolete, accepted for backward compatibility. | |
| /S | Returns a string. | |
| /DF | Returns a data folder reference. See Data Folder Reference Function Results. | |
| /WAVE | Returns a wave reference. See Wave Reference Function Results. | |
Details
If you omit all flags, the result is a scalar double-precision number.
The /D flag is not needed because all numeric return values are double-precision.
See Also
User-defined Functions, Programming Overview
Macro
The Macro keyword is used in a procedure window and introduces a procedure whose name you want to appear in the Macros menu. For example:
Macro TestMacro()
Print "Hello, world!"
EndMacro
For most purposes, it is better to use Function instead of Macro, because functions run faster and have other advantages.
See Also
Macros, User-defined Functions, Programming Overview
Picture
The Picture keyword introduces an ASCII code picture definition of binary image data. For example:
// PNG: width= 56, height= 44
Picture myPictName
ASCII85Begin
M,6r;%14!\!!!!.8Ou6I!!!!Y!!!!M#Qau+!5G;q_uKc;&TgHDFAm*iFE_/6AH5;7DfQssEc39jTBQ
=U!7FG,5u`*!m?g0PK.mR"U!k63rtBW)]$T)Q*!=Sa1TCDV*V+l:Lh^NW!fu1>;(.<VU1bs4L8&@Q_
<4e(%"^F50:Jg6);j!CQdUA[dh6]%[OkHSC,ht+Q7ZO#.6U,IgfSZ!R1g':oO_iLF.GQ@RF[/*G98D
bjE.g?NCte(pX-($m^\_FhhfL`D9uO6Qi5c[r4849Fc7+*)*O[tY(6<rkm^)/KLIc]VdDEbF-n5&Am
2^hbTu:U#8ies_W<LGkp_LEU1bs4L8&?fqRJ[h#sVSSz8OZBBY!QNJ
ASCII85End
End
See Also
Proc
The Proc keyword is used in a procedure window and introduces a procedure whose name you do not want to appear in the Macros menu. For example:
Proc TestProc()
Print "Hello, world!"
End
A Proc is a type of macro. For most purposes, it is better to use Function instead of Proc, because functions run faster and have other advantages.
See Also
Macros, User-defined Functions, Programming Overview
Structure
The Structure keyword introduces a structure definition in a user function. Within the body of the structure you declare the member type (memType) and the corresponding member name(s) (memName). Each memName may be declared with an optional array size.
Structure declarations have the format:
Structure structureName
memType memName [arraySize ] [, memName [arraySize ]]
...
EndStructure
Details
Structure member types (memType) can be any of the following Igor objects: Variable, String, WAVE, NVAR, SVAR, DFREF, FUNCREF, or STRUCT.
Igor structures also support additional member types, as given in the next table, for compatibility with C programming structures and disk files.
| Igor Member Type | C Equivalent | Size |
|---|---|---|
| char | signed 8-bit int | 1 byte |
| uchar | unsigned 8-bit int | 1 byte |
| int16 | signed16-bit int | 2 bytes |
| uint16 | unsigned 16-bit int | 2 bytes |
| int32 | signed32-bit int | 4 bytes |
| uint32 | unsigned 32-bit int | 4 bytes |
| int64 | signed 64-bit int | 8 bytes (requires Igor Pro 7.00 or later) |
| uint64 | unsigned 64-bit int | 8 bytes (requires Igor Pro 7.00 or later) |
| float | float | 4 bytes |
| double | double | 8 bytes |
The Variable and double types are identical although Variable can be also specified as complex (using the /C flag).
Each structure member may have an optional arraySize specification, which gives the number of elements contained by the structure member. The array size is an integer number from 1 to 400 except for members of type STRUCT for which the upper limit is 100.
See Also
Structures in Functions for further information.
See the STRUCT declaration for creating a local reference to a Structure.
Window
The Window keyword is used in a procedure window and introduces a window recreation procedure. For example:
Window Graph0() : Graph
Display wave0
ModifyGraph rgb(wave0)=(0,0,65535)
End
A Window recreation procedure is a type of macro. Igor automatically creates a window recreation macro when you close a graph, table, layout, control panel, or XOP target window. The name of each window recreation macro appears in a submenu in the Windows menu, such as the Graph Macros submenu.
Except in rare circumstances, a programmer should not use the Window keyword, but should use Macro, Proc, or Function instead. For most purposes, it is best to use Function because functions run faster and have other advantages.