ui.h File Reference

User interface system. More...

#include "errorcodes.h"
#include <stdint.h>

Include dependency graph for ui.h:

This graph shows which files directly or indirectly include this file:


Data Structures

struct  CallbackList
 List of callback pointers. More...

Enumerations

enum  CallbackType {
  REGISTER_CHANGE, MEMORY_CHANGE, ERROR_MESSAGE, READ_INPUT,
  OUTPUT_AVAILABLE, INTERPRETER_RESET, PROGRAM_START, PROGRAM_END,
  LINE_INTERPRETED
}
 Type of callback. More...

Functions

void pasm_initUi ()
 Initialize the user interface system.
void pasm_setCallbackData (void *data)
 Set data that will be used as one of the arguments when a callback GUI function is called.
ErrorCode pasm_registerCallback (CallbackType type, void(*callBack)(void *))
 Register a callback function with the library.
void pasm_performCallback (CallbackType type)
 Perform a simple callback function of the GUI.
void pasm_performMemoryCallback (uint32_t address, int32_t value)
 Notify the GUI that a memory address has changed through a callback function of the GUI.
void pasm_performOutputCallback (int32_t value)
 Notify the GUI that there is output available through a callback function of the GUI.
void pasm_performLineCallback (uint32_t address)
 Notify the GUI that a certain instruction has been interpreted through a callback function of the GUI.
void pasm_error (ErrorCode errorCode)
 Notify the GUI that an error has occured through a callback function of the GUI.
void pasm_readInput ()
 Request input from the GUI through a callback function of the GUI.
void pasm_setInput (int32_t input)
 Set the input value of the assembler.

Detailed Description

User interface system.

The user interface system is the glue between the PASM library and the actual graphical user interface frontend.

Author:
Wesley Stessens

Enumeration Type Documentation

Type of callback.

These are the possible callbacks that a frontend can register.

Enumerator:
REGISTER_CHANGE  Register has changed.
MEMORY_CHANGE  Memory has changed.
ERROR_MESSAGE  Error has occured.
READ_INPUT  Input is required.
OUTPUT_AVAILABLE  Output is available.
INTERPRETER_RESET  Interpreter has been reset.
PROGRAM_START  Program has started in the pseudo-assembler.
PROGRAM_END  Program has ended in the pseudo-assembler.
LINE_INTERPRETED  A certain instruction has been interpreted.


Function Documentation

void pasm_error ( ErrorCode  errorCode  ) 

Notify the GUI that an error has occured through a callback function of the GUI.

Parameters:
errorCode An error code (NO_ERROR if no error occured)

void pasm_performCallback ( CallbackType  type  ) 

Perform a simple callback function of the GUI.

You use this to actually notify the GUI frontend. To notify the GUI about a changed memory address or to notify the GUI that there is output available or that a certain instruction has been interpreted or that an error has occured, you will need to use other functions.

Parameters:
type Type of callback
See also:
pasm_performMemoryCallback

pasm_performOutputCallback

pasm_performLineCallback

pasm_error

void pasm_performLineCallback ( uint32_t  address  ) 

Notify the GUI that a certain instruction has been interpreted through a callback function of the GUI.

Parameters:
address Virtual address of the instruction that has been interpreted

void pasm_performMemoryCallback ( uint32_t  address,
int32_t  value 
)

Notify the GUI that a memory address has changed through a callback function of the GUI.

Parameters:
address Virtual address that has changed
value New value in the virtual address

void pasm_performOutputCallback ( int32_t  value  ) 

Notify the GUI that there is output available through a callback function of the GUI.

Parameters:
value Outputted value

void pasm_readInput (  ) 

Request input from the GUI through a callback function of the GUI.

The GUI has to call pasm_setInput() to actually set the input value.

Note:
pasm_performCallback(READ_INPUT) does the same thing. This is just a convenience function.

ErrorCode pasm_registerCallback ( CallbackType  type,
void(*)(void *)  callBack 
)

Register a callback function with the library.

Parameters:
type Type of callback
callBack The callback function
Returns:
error that occured when registering the callback (NO_ERROR or UNSUPPORTED_CALLBACK)

void pasm_setCallbackData ( void *  data  ) 

Set data that will be used as one of the arguments when a callback GUI function is called.

Parameters:
data The data that will be used as one of the arguments. This is useful in some special cases, for example when you are writing a C++ based frontend; you could write static callback functions and to interact with the main object/window you could provide that object as a parameter.

void pasm_setInput ( int32_t  input  ) 

Set the input value of the assembler.

Usually this function is called from the GUI when input is required.

Note:
You can register the READ_INPUT callback function with the PASM library to know when input is required.
Parameters:
input Inputted value


Generated on Thu Jun 11 02:07:50 2009 for PASM by  doxygen 1.5.6