Embedding breve In Another Program
<< previous | Chapter 14. The breve Source Code | next >>

## Embedding breve In Another Program

To implement a custom application frontend, or to use breve simulations as part of another program, you'll need to familiarize yourself with functions relating to the breve engine structure `brEngine`.

- Create and initialize the breve engine (`brEngineNew`)

  Call `brEngineNew()` to get a breve engine. You may optionally pass in command-line arguments using the alternative function `brEngineNewWithArguments( argc, argv )`. After creating the engine, initialize the standard frontend languages using `brInitFrontendLanguages( engine )`

      engine = brEngineNew();
      brInitFrontendLanguages( engine );

- Add breve file search paths using `brAddSearchPath( engine, path )`. The search paths must be properly initialized so that breve can locate the standard class files.

      brAddSearchPath( engine, "lib/classes/breve" );
      brAddSearchPath( engine, "lib/classes/mybreveclasses" );

- Start a simulation using `brLoadSimulation`.

      brLoadSimulation( engine, simulationText, simulationFilename );

- Iterate the breve engine (`brEngineIterate`) repeatedly in your program's execution loop.

      brEngineIterate( engine );

<< previous | Up | next >>
Adding a frontend language to the breve engine: the breve object API | Table of Contents | Chapter 15. "Push": a Language for Evolutionary Computation Integrated With breve