Wiki
Clone wikiPureWork / Home
Welcome
Welcome to PureWork!
Versions
Stable: Not available.
Development: 5.x-1.x [Alpha]
Wiki pages
Features
PureWork is a framework for developing applications in a modular way in PureBasic 5.x. It provides a lightweight infrastructure which allows all the modules in your application to talk to each other.
Go ahead and try:
$ git clone git@bitbucket.org:Hroudtwolf/purework.git
Examples
Here's an example of a PureWork application code:
#!pure basic ; Include the PureWork framework. IncludePath "../purework" ; Where is the PureWork framework? XIncludeFile "purework.pack.pbi" ; Include your modules here. ; I.ex.: ; XIncludeFile "fancyapp/GUI.module.pbi" ; XIncludeFile "fancyapp/XMLExporter.module.pbi" ; ... IncludePath "../examples" ; Where are the examples. XIncludeFile "modules/example1/Example1.module.pbi" XIncludeFile "modules/example2/Example2.module.pbi" ; This section could also be in a module. ---> PureWork::start() ; Your code here. ; Custom hook. PureWork::invokeHook("onSomething") PureWork::exit() ; <---
An example of a module that works with PureWork:
#!pure basic DeclareModule Example1 EndDeclareModule Module Example1 ; Registers this Module To the PureWork framework. PureWork::registerModule("Example1") ; /** ; * Implements PureWork::onStart() hook. ; */ Runtime Procedure onStart(*argument.PureWork::tHookArgument) Debug "Example1 Module -> onStart called." ProcedureReturn EndProcedure ; /** ; * Implements PureWork::onExit() hook. ; */ Runtime Procedure onExit(*argument.PureWork::tHookArgument) Debug "Example1 Module -> onExit called." ProcedureReturn EndProcedure ; /** ; * Implements ANYMODULE::onSomething() hook. ; */ Runtime Procedure onSomething(*argument.PureWork::tHookArgument) Debug "Example1 Module -> onSomething called." ProcedureReturn EndProcedure EndModule
Have fun!
Updated