User Tools

Site Tools


soft_velocity_pragmas.htm
Navigation:  Advanced Topics > Legacy Project System Reference >====== #pragmas ====== Previous pageReturn to chapter overviewNext page

Modula-2 Pragma Syntax

Old-type Compiler Directives

C_and_C++_Pragma_Syntax

Project System Pragma Syntax

Pragma Classes

Call #pragmas

Data #pragmas

Code #pragmas

Check #pragmas

Name #pragmas

Optimize #pragmas

Debug #pragmas

Module #pragmas

Option #pragmas

Warn #pragmas

Project #pragmas

Save/Restore #pragmas

Link #pragmas

Link_Option #pragmas

Define #pragmas

Pre-defined Flags

All SoftVelocity languages, and the Project System, use a common set of compiler options known as #pragmas. In general, pragmas may appear in the source code or in a project file, and the effect will be the same.

NoteBox.jpg

A pragma can be used in the Project language, C++ code, Modula-2 code, or Clarion code. Some only work in certain places. A 'P' to the right of the pragma indicates it can be used in the Project language, a 'C' indicates it can be used in C++ code, a 'M' indicates it can be used in Modula-2 code, and a 'W' indicates that it can be used in Clarion code (CLW files).

Modula-2 Pragma Syntax

Pragmas in SoftVelocity Modula-2 occur in a special form of comment which begins with '(*#'. For example:

(*# check( index ⇒ off ) *)

Old-type Compiler Directives

In the original version of SoftVelocity Modula-2, compiler directives starting with a $ were used to specify compiler options. These directives are still accepted in later versions of SoftVelocity Modula-2, with the following exceptions:

·$B (Ctrl-Break handler). This is no longer supported. Use Lib.EnableBreakCheck instead.

·$D (data segment name). This is supported, but adds the suffix _BSS (for uninitialized data) or _DATA (for initialized data) to the name instead of the D_ prefix.

·$J (use IRET instead of RET). This is not supported. Instead, you should use the pragma:

(*# call( interrupt ⇒ on ) *)

·However, you may find that you have to make other changes as well as the effect of the pragma is different from the $J directive:

·$K (C calling convention). This is not supported. Instead, you should use the pragma:

(*# call( c_conv ⇒ on ) *)

·$M (code segment name). This is supported but adds the suffix _TEXT to the name instead of the C_ prefix.

·$P (external names for local procedures). This is no longer supported. It is no longer applicable.

·$Q (procedure tracing). This is no longer supported. Instead, you should use the pragma:

(*# debug( proc_trace ⇒ on ) *)

·This enables a different method of tracing procedures. Refer to the proc_trace pragma for further details.

·$X (80×87 stack spilling). This is no longer supported (and is no longer necessary).

·$Z (NIL pointer checks). This still does NIL pointer checks but no longer clears memory.

·$@ (preserve DS). This is no longer supported.

The support for these directives has been included with later systems so that your old programs and modules will recompile with minimum changes. However, you should avoid using the old directives with new programs, and use pragmas instead.

C and C++ Pragma Syntax

Pragmas are an integral part of the C and C++ languages, and are implemented as compiler directives:

#pragma check( index ⇒ off )

Project System Pragma Syntax

Pragmas in the Project System use a similar syntax to the C and C++ languages:

#pragma check(index ⇒ off)

Pragmas in the Project System may also be specified in the #compile command, to apply to a single compilation. For example:

#compile mandel.mod /debug(vid⇒on)

Pragma Classes

A #pragma takes the form #pragma class(name⇒value). The #pragma classes are as follows:

Call #pragmas

Check #pragmas

Code #pragmas

Data #pragmas

Debug #pragmas

Define #pragmas

File pragmas

Link and Linkfirst #pragmas

Link_option #pragmas

Module #pragmas

Name #pragmas

Optimize #pragmas

Option #pragmas

Project #pragmas

Save and Restore #pragmas

Warn #pragmas

soft_velocity_pragmas.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1