Skip to content
Authors

File production_store.c

FileList > production_store > src > production_store.c

Go to the source code of this file

Describes the storage used for productions of a language. More...

  • #include "production_store.h"
  • #include <string.h>
  • #include <pdgl_defs.h>
  • #include <stddef.h>

Public Functions

Type Name
bool prodstr_add (prodstr_store_t * store, prodstr_obj_t * prd)
Add a production to the given store.
const prodstr_obj_t * prodstr_find (const prodstr_store_t * store, const char * name)
Find a production with the given name in the given store.
STATIC_INLINE size_t prodstr_hash (const void * buf, size_t buflength)
Hash an input buffer into an unsigned int.

Detailed Description

Author:

Joe Starr

Public Functions Documentation

function prodstr_add

Add a production to the given store.

bool prodstr_add (
    prodstr_store_t * store,
    prodstr_obj_t * prd
) 

Add the given production to the given store. Indicate success with true and failure with false.

Parameters:

  • store The store to add to.
  • prd The production to add.

Returns:

The success or failure of the addition.


function prodstr_find

Find a production with the given name in the given store.

const prodstr_obj_t * prodstr_find (
    const prodstr_store_t * store,
    const char * name
) 

Search the store for a production with the given name. Indicate success with a pointer to a production. Indicate failure with a NULL pointer.

Parameters:

  • store The store to search.
  • name The name to find.

Returns:

A pointer to a production on success. A NULL pointer on failure.


function prodstr_hash

Hash an input buffer into an unsigned int.

STATIC_INLINE size_t prodstr_hash (
    const void * buf,
    size_t buflength
) 

Hash with the input buffer with Adler-32.

Parameters:

  • buf The buffer to hash.
  • buflength The number of bytes to include in the hash.

Returns:

An unsigned int in the range of \(0<h<\)PRODSTR_TABLE_SIZE.



The documentation for this class was generated from the following file source/production_store/src/production_store.c