Basic Naming Rules For Functions, Variables, Etc.

Categories

Nitro-SDK functions are classified as categories according to their field. Consideration has also been given to naming to make this clear.

Categories
These consist of two or more continuous uppercase letters. Numerals can also be used, but for graphics only.
[A-Z][A-Z0-9]+
OS
Items related to OS system.
G2,G3,GX...
Items related to graphics. Numerals are also included.
MI
Items related to memory exchange such as DMA.
SVC
Items related to system calls.

(11/13/2003)

Note:  The distinction in the main processor and subprocessor categories was eliminated and all caps are used uniformly.

(01/18/2004)

Functions

Function naming is defined below. The first letters of [verbs], [objects], etc. are in upper case. The words are connected without using an underscore.

Public functions (API)
[Category name]_[verb] [object, etc]
Example: OS_SetInterruptMask, OS_IsLocked
Private functions
[Category name]i_[verb] [object, etc]
Example: OSi_SetInterruptMaskBase
Static functions
Freely

However, as a custom, there are some items that do not follow this rule, such as OS_InterruptHandler.

(11/13/2003)

There are two choices when deciding on the names of functions that create or initialize objects, using either Create or Init. Create is used when a function call must be made explicitly for discarding the object and Init is used when discarding is not necessary.

(12/15/2003)

Variable Type Names

Naming with typedef basically follows the Nintendo GameCube pattern, and therefore functions and forms are the same. You must distinguish with such things as a [verb] not following a category name.

Variable type name
[Category name] [noun]
Example: OSInterruptCallback
Variable name (exception)
[Category name] [verb] Mode
Example: OSCopyMode

Exceptions include types which control API behavior (such as OSCopyMode shown above). GXCopyStatus and GXCopyType would be used to control the behavior of the GXCopy function. In cases like these examples, the exception is permitted because of the natural naming format. However, be careful to not abuse it.

(11/13/2003)

Enumerator Names and Macro Names

Constants defined by enum, define, and const will have the format shown below.

Constant name
[Category name] _ [A-Z0-9_]+
Example: OS_INTERRUPT_MAX, Os_INTERRUPT_MAX

(11/13/2003)

© 2004 Nintendo

NTR-06-0022-001-A3