reactor-c
C Runtime for Lingua Franca
|
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "reactor.h"
#include "trace.h"
#include "trace_util.h"
#include "trace_impl.h"
Data Structures | |
struct | open_file_t |
Macros | |
#define | LF_TRACE |
Typedefs | |
typedef struct open_file_t | open_file_t |
Functions | |
void | termination () |
Perform final wrap-up on exit. | |
char * | root_name (const char *path) |
Return the root file name from the given path. Given a path to a file, this function returns a dynamically allocated string (which you must free) that points to the root filename without the preceding path and without the file extension. | |
FILE * | open_file (const char *path, const char *mode) |
Open the specified file for reading or writing. This function records the file for closing at termination. | |
char * | get_object_description (void *pointer, int *index) |
char * | get_trigger_name (void *trigger, int *index) |
void | print_table () |
size_t | read_header () |
int | read_trace () |
Variables | |
char | buffer [BUFFER_SIZE] |
trace_record_t | trace [TRACE_BUFFER_CAPACITY] |
instant_t | start_time |
char * | top_level = NULL |
object_description_t * | object_table |
int | object_table_size = 0 |
open_file_t * | _open_files = NULL |
const char | PATH_SEPARATOR |
Copyright (c) 2020, The University of California at Berkeley
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Standalone program to convert a Lingua Franca trace file to a comma-separated values text file.
#define LF_TRACE |
typedef struct open_file_t open_file_t |
char * get_object_description | ( | void * | pointer, |
int * | index ) |
Get the description of the object pointed to by the specified pointer. For example, this can be the name of a reactor (pointer points to the self struct) or a user-define string. If there is no such pointer in the symbol table, return NULL. If the index argument is non-null, then put the index of the entry in the table into the int pointed to or -1 if none was found.
pointer | The pointer to to an object, e.g. a self struct. |
index | An optional pointer into which to write the index. |
char * get_trigger_name | ( | void * | trigger, |
int * | index ) |
Get the trigger name for the specified pointer. If there is no such trigger, return NULL. If the index argument is non-null, then put the index of the trigger in the table into the int pointed to or -1 if none was found.
reactor | The pointer to a self struct. |
index | An optional pointer into which to write the index. |
FILE * open_file | ( | const char * | path, |
const char * | mode ) |
Open the specified file for reading or writing. This function records the file for closing at termination.
path | The path to the file. |
mode | "r" for reading and "w" for writing. |
void print_table | ( | ) |
Print the object to description table.
size_t read_header | ( | ) |
Read header information.
int read_trace | ( | ) |
Read the trace from the trace_file and put it in the trace global variable. Return the length of the trace.
char * root_name | ( | const char * | path | ) |
Return the root file name from the given path. Given a path to a file, this function returns a dynamically allocated string (which you must free) that points to the root filename without the preceding path and without the file extension.
path | The path including the full filename. |
void termination | ( | void | ) |
Perform final wrap-up on exit.
Function to be invoked upon exiting.
open_file_t* _open_files = NULL |
char buffer[BUFFER_SIZE] |
Buffer for reading object descriptions. Size limit is BUFFER_SIZE bytes.
object_description_t* object_table |
Table of pointers to the self struct of a reactor.
int object_table_size = 0 |
const char PATH_SEPARATOR |
instant_t start_time |
The start time read from the trace file.
char* top_level = NULL |
Name of the top-level reactor (first entry in symbol table).
trace_record_t trace[TRACE_BUFFER_CAPACITY] |
Buffer for reading trace records.