v2.0.2
Instance Methods | Class Methods | Properties | List of all members
CC3ShaderSourceCodeLineNumberLocalizingVisitor Class Reference

#import <CC3Shaders.h>

Inheritance diagram for CC3ShaderSourceCodeLineNumberLocalizingVisitor:
Inheritance graph
[legend]

Instance Methods

(void) - addLineNumberOffset:
 
(id) - initWithLineNumber:
 
(void) - popLineNumberOffset
 
(void) - pushLineNumberOffset:
 
- Instance Methods inherited from CC3ShaderSourceCodeVisitor
(BOOL) - hasAlreadyVisited:
 

Class Methods

(id) + visitorWithLineNumber:
 
- Class Methods inherited from CC3ShaderSourceCodeVisitor
(id) + visitor
 

Properties

GLuint lineNumber
 
GLuint lineNumberOffset
 
CC3ShaderSourceCodelocalizedSourceCode
 

Detailed Description

Visits an assembly of nested CC3ShaderSourceCode instances to determine in which source code group a particular global line number exists.

The GLSL compiler treats the GLSL source code as a monolithic block, and errors are attributed to source code lines as if all of the submitted source code came from a single string or file.

When a GLSL compiler error is reported, this visitor can be used to map the global line number, reported by the compiler, to a local line number within a particular source code segment, taking into consideration any import nesting that has occurred during soruce code loading.

To keep track of line numbers within nested import/includes, this instance maintains a stack of line number offsets as it traverses the source code tree.

Method Documentation

- (void) addLineNumberOffset: (GLuint)  offset

Adds the specified offset to the current line number offset at the top of the line number offsets stack.

This method is invoked for each section of source code that is traversed prior to the source code section that contains the error.

- (id) initWithLineNumber: (GLuint)  lineNumber

Initializes this instance with the specified global line number, which is the line number reported by the compiler when a compilation error occurs.

- (void) popLineNumberOffset

Pops the current line number offset from the stack of offsets.

This method is invoked at the end of each source code group, as the visitor transfers up one level in the source code tree.

- (void) pushLineNumberOffset: (GLuint)  lineNumberOffset

Pushes the specified line number offset to the stack of offsets.

This method is invoked at the start of each source code group, to reset the line number offset back to zero.

+ (id) visitorWithLineNumber: (GLuint)  lineNumber

Allocates and initializes an instance with the specified global line number, which is the line number reported by the compiler when a compilation error occurs.

Property Documentation

- (GLuint) lineNumber
readwritenonatomicassign

The line number of the source code line that originated the error.

During instantiation, this line number is initialized to the global line number reported by the compiler. After the source code tree has been visited by this visitor, this property will contain the local line number, within the source code segment indicated by the localizedSourceCode property, at which the reported error occurred.

- (GLuint) lineNumberOffset
readnonatomicassign

The line number offset of the beginning of the source code that originated the error.

While traversing the source code stucture, this property is set to zero at the start of each shader source group. As each subsection of source bytes is traversed, this value is incremented by the line count.

When the subsection that contains the error is found, this offset value is added to the lineNumber to determine the actual line number in the original file.

- (CC3ShaderSourceCode*) localizedSourceCode
readwritenonatomicretain

The source code group that contains the line of code reported as bad by the compiler.

The value of this property will be nil until the visitation run has finished, after which it will contain the source code group that contains the error.


The documentation for this class was generated from the following file: