Skip to content

Commit

Permalink
Updated documentation to the latest API.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Jun 3, 2015
1 parent 361f8d2 commit cd6fb4a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,13 @@ public interface ILibrary
void Setup(Driver driver);

/// Setup your passes here.
void SetupPasses(Driver driver, PassBuilder passes);
void SetupPasses(Driver driver);

/// Do transformations that should happen before passes are processed.
void Preprocess(Driver driver, Library lib);
void Preprocess(Driver driver, ASTContext ctx);

/// Do transformations that should happen after passes are processed.
void Postprocess(Driver driver, Library lib);
void Postprocess(Driver driver, ASTContext ctx);
}
```

Expand Down Expand Up @@ -372,15 +372,15 @@ whose methods get called for each declaration that was parsed from the headers
CppSharp already comes with a collection of useful built-in passes and we will
now see how to use them to fix the flaws enumerated above.

2. `void SetupPasses(Driver driver, PassBuilder passes)`
2. `void SetupPasses(Driver driver)`

New passes are added to the generator by using the API provided by `PassBuilder`.

```csharp
void SetupPasses(Driver driver, PassBuilder passes)
void SetupPasses(Driver driver)
{
passes.RenameDeclsUpperCase(RenameTargets.Any);
passes.FunctionToInstanceMethod();
driver.TranslationUnitPasses.AddPass(new RenameDeclsUpperCase(RenameTargets.Any));
driver.TranslationUnitPasses.AddPass(new FunctionToInstanceMethodPass());
}
```

Expand Down Expand Up @@ -487,8 +487,8 @@ Now that the bindings are looking good from a .NET perspective, let's see how
we can achieve more advanced things by using the remaining overloads in the
interface.

3. `void Preprocess(Driver driver, Library lib);`
4. `void Postprocess(Driver driver, Library lib);`
3. `void Preprocess(Driver driver, ASTContext ctx);`
4. `void Postprocess(Driver driver, ASTContext ctx);`

As their comments suggest, these get called either before or after the the
passes we setup earlier are run and they allow you free reign to manipulate
Expand All @@ -498,11 +498,11 @@ Let's say we want to change the class to provide .NET value semantics,
drop one field from the generated bindings and rename the `FooAdd` function.

```csharp
void Postprocess(Driver driver, Library lib)
void Postprocess(Driver driver, ASTContext ctx)
{
lib.SetClassAsValueType("Foo");
lib.SetNameOfFunction("FooAdd", "FooCalc");
lib.IgnoreClassField("Foo", "b");
ctx.SetClassAsValueType("Foo");
ctx.SetNameOfFunction("FooAdd", "FooCalc");
ctx.IgnoreClassField("Foo", "b");
}
```

Expand Down

0 comments on commit cd6fb4a

Please sign in to comment.