satyr  0.26
Data Structures | Functions
java/frame.h File Reference

java frame structure and related algorithms. More...

#include "../report_type.h"
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  sr_java_frame
 

Functions

struct sr_java_framesr_java_frame_new (void)
 
struct sr_java_framesr_java_frame_new_exception (void)
 
void sr_java_frame_init (struct sr_java_frame *frame)
 
void sr_java_frame_free (struct sr_java_frame *frame)
 
void sr_java_frame_free_full (struct sr_java_frame *frame)
 
struct sr_java_framesr_java_frame_append (struct sr_java_frame *dest, struct sr_java_frame *item)
 
struct sr_java_framesr_java_frame_get_last (struct sr_java_frame *frame)
 
struct sr_java_framesr_java_frame_dup (struct sr_java_frame *frame, bool siblings)
 
int sr_java_frame_cmp (struct sr_java_frame *frame1, struct sr_java_frame *frame2)
 
int sr_java_frame_cmp_distance (struct sr_java_frame *frame1, struct sr_java_frame *frame2)
 
void sr_java_frame_append_to_str (struct sr_java_frame *frame, struct sr_strbuf *dest)
 
struct sr_java_framesr_java_frame_parse_exception (const char **input, struct sr_location *location)
 
struct sr_java_framesr_java_frame_parse (const char **input, struct sr_location *location)
 
char * sr_java_frame_to_json (struct sr_java_frame *frame)
 
struct sr_java_framesr_java_frame_from_json (struct sr_json_value *root, char **error_message)
 

Detailed Description

java frame structure and related algorithms.

Definition in file java/frame.h.

Function Documentation

◆ sr_java_frame_append()

struct sr_java_frame* sr_java_frame_append ( struct sr_java_frame dest,
struct sr_java_frame item 
)

Appends 'item' at the end of the list 'dest'.

Returns
This function returns the 'dest' frame.

◆ sr_java_frame_append_to_str()

void sr_java_frame_append_to_str ( struct sr_java_frame frame,
struct sr_strbuf dest 
)

Appends the textual representation of the frame to the string buffer.

Parameters
frameIt must be a non-NULL pointer. It's not modified by calling this function.

◆ sr_java_frame_cmp()

int sr_java_frame_cmp ( struct sr_java_frame frame1,
struct sr_java_frame frame2 
)

Compares two frames.

Parameters
frame1It must be non-NULL pointer. It's not modified by calling this function.
frame2It must be non-NULL pointer. It's not modified by calling this function.
Returns
Returns 0 if the frames are same. Returns negative number if frame1 is found to be 'less' than frame2. Returns positive number if frame1 is found to be 'greater' than frame2.

◆ sr_java_frame_cmp_distance()

int sr_java_frame_cmp_distance ( struct sr_java_frame frame1,
struct sr_java_frame frame2 
)

Compares two frames.

Parameters
frame1It must be non-NULL pointer. It's not modified by calling this function.
frame2It must be non-NULL pointer. It's not modified by calling this function.
Returns
Returns 0 if the frames are same. Returns negative number if frame1 is found to be 'less' than frame2. Returns positive number if frame1 is found to be 'greater' than frame2.

◆ sr_java_frame_dup()

struct sr_java_frame* sr_java_frame_dup ( struct sr_java_frame frame,
bool  siblings 
)

Creates a duplicate of the frame.

Parameters
frameIt must be non-NULL pointer. The frame is not modified by calling this function.
siblingsWhether to duplicate also siblings referenced by frame->next. If false, frame->next is not duplicated for the new frame, but it is set to NULL.
Returns
This function never returns NULL. The returned duplicate frame must be released by calling the function sr_java_frame_free().

◆ sr_java_frame_free()

void sr_java_frame_free ( struct sr_java_frame frame)

Releases the memory held by the frame. The frame siblings are not released.

Parameters
frameIf the frame is NULL, no operation is performed.

◆ sr_java_frame_free_full()

void sr_java_frame_free_full ( struct sr_java_frame frame)

Releases the memory held by the frame all its siblings.

Parameters
frameIf the frame is NULL, no operation is performed.

◆ sr_java_frame_from_json()

struct sr_java_frame* sr_java_frame_from_json ( struct sr_json_value root,
char **  error_message 
)

Deserializes frame structure from JSON representation.

Parameters
rootJSON value to be deserialized.
error_messageOn error, *error_message will contain the description of the error.
Returns
Resulting frame, or NULL on error.

◆ sr_java_frame_get_last()

struct sr_java_frame* sr_java_frame_get_last ( struct sr_java_frame frame)

Gets a number of frame in list.

Parameters
frameIf the frame is NULL, no operation is performed.
Returns
A number of frames.

◆ sr_java_frame_init()

void sr_java_frame_init ( struct sr_java_frame frame)

Initializes all members of the frame structure to their default values. No memory is released, members are simply overwritten. This is useful for initializing a frame structure placed on the stack.

◆ sr_java_frame_new()

struct sr_java_frame* sr_java_frame_new ( void  )

Creates and initializes a new frame structure.

Returns
It never returns NULL. The returned pointer must be released by calling the function sr_java_frame_free().

◆ sr_java_frame_new_exception()

struct sr_java_frame* sr_java_frame_new_exception ( void  )

Creates and initializes a new exception in frame structure.

Returns
It never returns NULL. The returned pointer must be released by calling the function sr_java_frame_free().

◆ sr_java_frame_parse()

struct sr_java_frame* sr_java_frame_parse ( const char **  input,
struct sr_location location 
)

If the input contains a complete frame, this function parses the frame text, returns it in a structure, and moves the input pointer after the frame. If the input does not contain proper, complete frame, the function does not modify input and returns NULL.

Returns
Allocated pointer with a frame structure. The pointer should be released by sr_java_frame_free().
Parameters
locationThe caller must provide a pointer to an instance of sr_location here. When this function returns NULL, the structure will contain the error line, column, and message. The line and column members of the location are gradually increased as the parser handles the input, so the location should be initialized before calling this function to get reasonable values.

◆ sr_java_frame_parse_exception()

struct sr_java_frame* sr_java_frame_parse_exception ( const char **  input,
struct sr_location location 
)

If the input contains proper exception with frames, parse the exception, move the input pointer after the exception, and return a structure representing the exception. Otherwise to not modify the input pointer and return NULL.

Parameters
locationThe caller must provide a pointer to struct sr_location here. The line and column members are gradually increased as the parser handles the input, keep this in mind to get reasonable values. When this function returns NULL (an error occurred), the structure will contain the error line, column, and message.
Returns
NULL or newly allocated structure, which should be released by calling sr_java_frame_free().

◆ sr_java_frame_to_json()

char* sr_java_frame_to_json ( struct sr_java_frame frame)

Returns a textual representation of the frame.

Parameters
frameIt must be a non-NULL pointer. It's not modified by calling this function.