C and C++ Binaries

INT_PAIR_SET: cs_int_pair_set.h

Defines a set of cs_int_pair_set operations for CodeSonar.



Links


Defines

#define CS_INT_PAIR_SET_H
#define CS_INT_PAIR_SET_NULL (cs_int_pair_set_get_null()) The null cs_int_pair_set.
#define CS_INT_PAIR_SET_INL_H

Types

typedef cs_int_pair_set_iter
Definition typedef struct cs_int_pair_set_iter_t * cs_int_pair_set_iter
Notes A structure to handle cs_int_pair_set traversal.

Used by:

typedef cs_ips_to_pdgvs_map
Definition typedef struct __cs_ips_to_pdgvs_map * cs_ips_to_pdgvs_map
Notes A map cs_int_pair_set -> cs_pdg_vertex_set, where each entry represents the mapping from a source position to the set of vertices at that source position.

Functions

cs_result cs_int_pair_set_create ( cs_int_pair_set * out_set )
Create an empty cs_int_pair_set.
cs_result cs_int_pair_set_incr ( cs_int_pair_set int_pair_set )
Increment the reference count of a cs_int_pair_set.
cs_result cs_int_pair_set_copy ( cs_const_int_pair_set int_pair_set, cs_int_pair_set * out_set )
Create a copy of a cs_int_pair_set.
cs_result cs_int_pair_set_close ( cs_int_pair_set int_pair_set )
cs_result cs_int_pair_set_put ( cs_int_pair_set int_pair_set, csuint32 int1, csuint32 int2 )
Insert a pair of integers into a cs_int_pair_set.
cs_result cs_int_pair_set_delete ( cs_int_pair_set int_pair_set, csuint32 int1, csuint32 int2 )
Delete a cs_int_pair from a cs_int_pair_set.
cs_boolean cs_int_pair_set_member ( cs_const_int_pair_set int_pair_set, csuint32 int1, csuint32 int2 )
Check: is the specified pair present in the specified cs_int_pair_set?
cs_set_kind cs_int_pair_set_kind ( cs_const_int_pair_set int_pair_set )
Determine the cs_set_kind of int_pair_set.
cs_boolean cs_int_pair_set_empty ( cs_const_int_pair_set int_pair_set )
Check: does the specified cs_int_pair_set contain any elements?
cs_size_t cs_int_pair_set_cardinality ( cs_const_int_pair_set int_pair_set )
Get the number of items in a cs_int_pair_set.
cs_hash_t cs_int_pair_set_hash ( cs_const_int_pair_set int_pair_set )
Hash function for cs_int_pair_set.
cs_result cs_int_pair_set_union ( cs_const_int_pair_set int_pair_set1, cs_const_int_pair_set int_pair_set2, cs_int_pair_set * out_set )
Set union for cs_int_pair_set.
cs_result cs_int_pair_set_union_p ( cs_int_pair_set target, cs_const_int_pair_set source )
Add the elements of one cs_int_pair_set to another.
cs_result cs_int_pair_set_intersect ( cs_const_int_pair_set int_pair_set1, cs_const_int_pair_set int_pair_set2, cs_int_pair_set * out_set )
Set intersection for cs_int_pair_set.
cs_boolean cs_int_pair_set_intersects ( cs_const_int_pair_set int_pair_set1, cs_const_int_pair_set int_pair_set2 )
Check: non-empty cs_int_pair_set intersection.
cs_result cs_int_pair_set_subtract ( cs_const_int_pair_set minuend, cs_const_int_pair_set subtrahend, cs_int_pair_set * out_set )
Set difference for cs_int_pair_set.
cs_result cs_int_pair_set_iter_first ( cs_const_int_pair_set int_pair_set, cs_int_pair * int_pair, cs_int_pair_set_iter * int_pair_set_iter )
Retrieve the first cs_int_pair from a cs_int_pair_set and open a cs_int_pair_set_iter for the rest of the set.
cs_result cs_int_pair_set_iter_next ( cs_int_pair * int_pair, cs_int_pair_set_iter * int_pair_set_iter )
Retrieve the next cs_int_pair from a cs_int_pair_set_iter.
cs_result cs_int_pair_set_iter_close ( cs_int_pair_set_iter * int_pair_set_iter )
Close a cs_int_pair_set_iter iterator.
cs_result cs_int_pair_set_to_list ( cs_const_int_pair_set int_pair_set, cs_int_pair int_pair_list[], cs_size_t allocated_bytes, cs_size_t * bytes_needed )
Retrieve a list of the cs_int_pair elements of a cs_int_pair_set.
cs_result cs_int_pair_set_to_pdg_vertex_set ( cs_sfid sfid, cs_const_int_pair_set int_pair_set, cs_pdg_vertex_set * out_set )
Find the cs_pdg_vertex_set associated with a given cs_int_pair_set.
cs_boolean cs_ips_to_pdgvs_map_same_instance ( cs_ips_to_pdgvs_map map1, cs_ips_to_pdgvs_map map2 )
Determine whether two cs_ips_to_pdgvs_map maps are in fact the same object.
cs_hash_t cs_ips_to_pdgvs_map_hash ( cs_ips_to_pdgvs_map map )
Hash function for cs_ips_to_pdgvs_map.
cs_result cs_ips_to_pdgvs_map_open ( cs_sfid sfid, cs_ips_to_pdgvs_map * out_map )
Get a cs_ips_to_pdgvs_map representing the source location -> cs_pdg_vertex_set mapping for the specified compilation unit.
cs_result cs_ips_to_pdgvs_map_close ( cs_ips_to_pdgvs_map map )
Close a currently open cs_ips_to_pdgvs_map.
cs_result cs_ips_to_pdgvs_map_lookup ( cs_ips_to_pdgvs_map map, csuint32 integer1, csuint32 integer2, cs_pdg_vertex_set * out_set )
Find a cs_pdg_vertex_set for a specified range of source locations, relative to a cs_ips_to_pdgvs_map.
cs_boolean cs_int_pair_set_equal ( cs_const_int_pair_set int_pair_set1, cs_const_int_pair_set int_pair_set2 )
Equality check for cs_int_pair_set.
cs_size_t cs_int_pair_set_get_outstanding_references ( )
Get the number of cs_int_pair_set objects allocated by the C API.
cs_size_t cs_ips_to_pdgvs_map_get_outstanding_references ( )
Get the number of cs_ips_to_pdgvs_map objects allocated by the C API.
cs_boolean cs_int_pair_set_same_instance ( cs_const_int_pair_set int_pair_set1, cs_const_int_pair_set int_pair_set2 )
Determine whether two cs_int_pair_set sets are in fact the same object.
cs_boolean cs_int_pair_set_is_null ( cs_const_int_pair_set int_pair_set )
Determine whether a cs_int_pair_set is null.
cs_const_int_pair_set cs_int_pair_set_get_null ( )
Return a null cs_int_pair_set.

Function Descriptions

Function cs_int_pair_set_create
cs_result cs_int_pair_set_create (
Create an empty cs_int_pair_set.
Parameters
out_set [out] The newly created, empty cs_int_pair_set.
Returns CS_SUCCESS on success.
Notes The user is responsible for closing the returned set: use cs_int_pair_set_close().
Function cs_int_pair_set_incr
cs_result cs_int_pair_set_incr (
Increment the reference count of a cs_int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set subject to increment.
Returns A cs_result:
Notes Increment function for cs_int_pair_set: increment the reference count for int_pair_set.
Function cs_int_pair_set_copy
cs_result cs_int_pair_set_copy (
Create a copy of a cs_int_pair_set.
Parameters
int_pair_set [in] The source set
out_set [out] The newly created, mutable cs_int_pair_set.
Returns CS_SUCCESS unless an internal error occurs.
Notes The user is responsible for closing out_set : use cs_int_pair_set_close(). The cs_set_kind of out_set is the same as that of int_pair_set.
Function cs_int_pair_set_close
cs_result cs_int_pair_set_close (
Close a cs_int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set to close.
Returns A cs_result:
Notes Decrements the reference count for int_pair_set. If this brings the reference count to 0 (zero), frees the set.
Function cs_int_pair_set_put
cs_result cs_int_pair_set_put (
Insert a pair of integers into a cs_int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set into which the specified pair will be inserted.
int1 [in] The first integer in the pair. Must be less than or equal to 2^32-1.
int2 [in] The second integer in the pair
Returns A cs_result:
Notes Creates a new cs_int_pair ( int1, int2 ) and inserts the pair into int_pair_set. Note that if int2 exceeds 2^32-1, the pair is split into two or more pairs such that the combination of the pairs represents the entire interval ( int1, int2 ).
Function cs_int_pair_set_delete
cs_result cs_int_pair_set_delete (
Delete a cs_int_pair from a cs_int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set from which the specified pair (int1, int2) will be deleted.
int1 [in] The first integer in the pair. Must be less than or equal to 2^32-1.
int2 [in] The second integer in the pair.
Returns A cs_result:
Notes Deletes cs_int_pair (int1, int2) from a int_pair_set. Note that if int2 exceeds 2^32-1, the pair is split into two or more pairs such that the combination of all the pairs represents the entire interval ( int1, int2 ) and each of these pairs is deleted.
Function cs_int_pair_set_member
cs_boolean cs_int_pair_set_member (
Check: is the specified pair present in the specified cs_int_pair_set?
Parameters
int_pair_set [in] The cs_int_pair_set to check for the specified pair (int1, int2).
int1 [in] The first integer in the pair.
int2 [in] The second integer in the pair.
Returns A cs_boolean:
  • cs_true if every cs_int_pair required to represent the interval ( int1, int2 ) is present in int_pair_set (just the pair (int1, int2) if int2 is less than 2^32-1);
  • cs_false otherwise.
Function cs_int_pair_set_kind
cs_set_kind cs_int_pair_set_kind (
Determine the cs_set_kind of int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set of interest.
Returns The kind of int_pair_set, as a cs_set_kind.
Function cs_int_pair_set_empty
cs_boolean cs_int_pair_set_empty (
Check: does the specified cs_int_pair_set contain any elements?
Parameters
int_pair_set [in] The cs_int_pair_set to check.
Returns cs_true if int_pair_set is empty, cs_false otherwise.
Function cs_int_pair_set_cardinality
cs_size_t cs_int_pair_set_cardinality (
Get the number of items in a cs_int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set whose cardinality is to be obtained.
Returns The number of items in int_pair_set. Note that any additional pairs that may have been generated by cs_int_pair_set_put() are included in the count.
Function cs_int_pair_set_hash
cs_hash_t cs_int_pair_set_hash (
Hash function for cs_int_pair_set.
Parameters
int_pair_set [in] A cs_int_pair_set to hash.
Returns A hash of int_pair_set.
Function cs_int_pair_set_union
cs_result cs_int_pair_set_union (
Set union for cs_int_pair_set.
Parameters
int_pair_set1 [in] First argument to union.
int_pair_set2 [in] Second argument to union.
out_set [out] A new cs_int_pair_set containing the union of int_pair_set1 and int_pair_set2.
Returns CS_SUCCESS on success.
Notes It is the responsibility of the user to close out_set after use: use cs_int_pair_set_close().
Function cs_int_pair_set_union_p
cs_result cs_int_pair_set_union_p (
Add the elements of one cs_int_pair_set to another.
Parameters
target [in] The cs_int_pair set to which the elements of source will be added.
source [in] The cs_int_pair set whose elements are added to target.
Returns A cs_result:
Function cs_int_pair_set_intersect
cs_result cs_int_pair_set_intersect (
Set intersection for cs_int_pair_set.
Parameters
int_pair_set1 [in] First argument to intersection.
int_pair_set2 [in] Second argument to intersection.
out_set [out] A new cs_int_pair_set containing the intersection of int_pair_set1 and int_pair_set2.
Returns CS_SUCCESS on success.
Notes It is the responsibility of the user to close out_set after use: use cs_int_pair_set_close().
Function cs_int_pair_set_intersects
cs_boolean cs_int_pair_set_intersects (
Check: non-empty cs_int_pair_set intersection.
Parameters
int_pair_set1 [in] First argument to intersection test.
int_pair_set2 [in] Second argument to intersection test.
Returns cs_true if int_pair_set1 and int_pair_set2 have a non-empty intersection, cs_false otherwise
Function cs_int_pair_set_subtract
cs_result cs_int_pair_set_subtract (
Set difference for cs_int_pair_set.
Parameters
minuend [in] The cs_int_pair_set subject to subtraction.
subtrahend [in] The cs_int_pair_set being subtracted.
out_set [out] The cs_int_pair_set resulting from subtracting subtrahend from minuend.
Returns CS_SUCCESS on success.
Notes It is the responsibility of the user to close out_set after use: use cs_int_pair_set_close().
Function cs_int_pair_set_iter_first
cs_result cs_int_pair_set_iter_first (
Retrieve the first cs_int_pair from a cs_int_pair_set and open a cs_int_pair_set_iter for the rest of the set.
Parameters
int_pair_set [in] The cs_int_pair_set from which to obtain the first cs_int_pair.
int_pair [out] The first cs_int_pair in int_pair_set.
int_pair_set_iter [out] An iterator for int_pair_set.
Returns A cs_result:
Notes Retrieve the first cs_int_pair from int_pair_set. This function opens int_pair_set_iter, which is required by cs_int_pair_set_iter_next(). Use cs_int_pair_set_iter_close() to close int_pair_set_iter.
Function cs_int_pair_set_iter_next
cs_result cs_int_pair_set_iter_next (
Retrieve the next cs_int_pair from a cs_int_pair_set_iter.
Parameters
int_pair [out] The next cs_int_pair.
int_pair_set_iter [inout] The cs_int_pair_set iterator from which to retrieve int_pair.
Returns A cs_result:
Function cs_int_pair_set_iter_close
cs_result cs_int_pair_set_iter_close (
Close a cs_int_pair_set_iter iterator.
Parameters
int_pair_set_iter [out] The cs_int_pair_set_iter to be closed.
Returns CS_SUCCESS on success.
Function cs_int_pair_set_to_list
cs_result cs_int_pair_set_to_list (
Retrieve a list of the cs_int_pair elements of a cs_int_pair_set.
Parameters
int_pair_set [in] The cs_int_pair_set to be converted to a list.
int_pair_list [out] A user-allocated array to be populated with the cs_int_pair elements from int_pair_set.
allocated_bytes [in] The allocated length of int_pair_list, measured in bytes.
bytes_needed [out] The number of bytes required to store the entire list of cs_int_pair elements in int_pair_set. Note that the cardinality of int_pair_set can be computed by dividing this number by the size of a cs_int_pair.
Returns A cs_result:
Notes Write a list of cs_int_pair element of a cs_int_pair_set into a user-allocated array. If the array is not large enough to hold the entire list, the list is truncated to fit into the array.
Function cs_int_pair_set_to_pdg_vertex_set
cs_result cs_int_pair_set_to_pdg_vertex_set (
Find the cs_pdg_vertex_set associated with a given cs_int_pair_set.
Parameters
sfid [in] The cs_sfid of the source file for which int_pair_set contains file positions.
int_pair_set [in] The cs_int_pair_set for which the set of associated cs_pdg_vertex is required.
out_set [out] A new cs_pdg_vertex_set containing the vertices corresponding to the locations given by int_pair_set in the file identified by uid.
Returns A cs_result:
Notes Find the cs_pdg_vertex_set associated with int_pair_set. The user is responsible for closing the returned set: use cs_pdg_vertex_set_close().
Function cs_ips_to_pdgvs_map_same_instance
cs_boolean cs_ips_to_pdgvs_map_same_instance (
Determine whether two cs_ips_to_pdgvs_map maps are in fact the same object.
Parameters
map1 [in] First argument to same-object check.
map2 [in] Second argument to same-object check.
Returns cs_true if map1 and map2 are the same object; cs_false otherwise.
Function cs_ips_to_pdgvs_map_hash
cs_hash_t cs_ips_to_pdgvs_map_hash (
Hash function for cs_ips_to_pdgvs_map.
Parameters
map [in] A cs_ips_to_pdgvs_map to hash.
Returns A hash of map. If you are building a hash table of cs_ips_to_pdgvs_map elements, you can use cs_ips_to_pdgvs_map_hash() as the hash function and cs_ips_to_pdgvs_map_same_instance() as the comparator.
Function cs_ips_to_pdgvs_map_open
cs_result cs_ips_to_pdgvs_map_open (
Get a cs_ips_to_pdgvs_map representing the source location -> cs_pdg_vertex_set mapping for the specified compilation unit.
Parameters
sfid [in] The cs_sfid of the source file instance of interest.
out_map [out] A new cs_ips_to_pdgvs_map representing the location -> cs_pdg_vertex_set mapping for the compilation unit with uid.
Returns A cs_result:
  • CS_NO_POSITION if the compilation unit does not have any position information, for example because it was generated by the back end.
  • CS_SUCCESS otherwise.
Notes Create a cs_ips_to_pdgvs_map representing the location -> cs_pdg_vertex_set mapping for the source file instance with sfid. At most one such map exists at any one time; if there is already an open map for a different source file, close it first before opening the new map.
Function cs_ips_to_pdgvs_map_close
cs_result cs_ips_to_pdgvs_map_close (
Close a currently open cs_ips_to_pdgvs_map.
Parameters
map [in] The cs_ips_to_pdgvs_map to close.
Returns CS_SUCCESS on success.
Function cs_ips_to_pdgvs_map_lookup
cs_result cs_ips_to_pdgvs_map_lookup (
Find a cs_pdg_vertex_set for a specified range of source locations, relative to a cs_ips_to_pdgvs_map.
Parameters
map [in] The cs_ips_to_pdgvs_map from which to generate the cs_pdg_vertex_set.
integer1 [in] The start of the range.
integer2 [in] The size of the range. Follows the convention that this size is one less than the actual length of the range.
out_set [out] A cs_pdg_vertex_set containing every vertex associated with the source text between offset integer1 and offset integer1 + integer2, inclusive.
Returns CS_SUCCESS on success.
Notes Retrieve a cs_pdg_vertex_set that contains every vertex associated with the source text between offset integer1 and offset integer1 + integer2, inclusive. The user is responsible for closing the returned set: use cs_pdg_vertex_set_close().
Function cs_int_pair_set_equal
cs_boolean cs_int_pair_set_equal (
Equality check for cs_int_pair_set.
Parameters
int_pair_set1 [in] First argument to equality check.
int_pair_set2 [in] Second argument to equality check.
Returns cs_true if int_pair_set1 and int_pair_set2 are equal; cs_false if not.
Function cs_int_pair_set_get_outstanding_references
cs_size_t cs_int_pair_set_get_outstanding_references ( )
Get the number of cs_int_pair_set objects allocated by the C API.
Returns The number of cs_int_pair_set objects allocated by the C API.
Time-Complexity O(1)
Function cs_ips_to_pdgvs_map_get_outstanding_references
cs_size_t cs_ips_to_pdgvs_map_get_outstanding_references ( )
Get the number of cs_ips_to_pdgvs_map objects allocated by the C API.
Returns The number of cs_ips_to_pdgvs_map objects allocated by the C API.
Function cs_int_pair_set_same_instance
cs_boolean cs_int_pair_set_same_instance (
Determine whether two cs_int_pair_set sets are in fact the same object.
Parameters
int_pair_set1 [in] First argument to same-object check.
int_pair_set2 [in] Second argument to same-object check.
Returns cs_true if int_pair_set1 and int_pair_set2 are the same object; cs_false if not.
Notes cs_int_pair_set_same_instance( a, b ) implies cs_int_pair_set_equal( a, b )
Function cs_int_pair_set_is_null
cs_boolean cs_int_pair_set_is_null (
Determine whether a cs_int_pair_set is null.
Parameters
int_pair_set [in] The cs_int_pair_set to check for nullity.
Returns cs_true if int_pair_set is null; cs_false otherwise.
Function cs_int_pair_set_get_null
cs_const_int_pair_set cs_int_pair_set_get_null ( )
Return a null cs_int_pair_set.
Returns A null cs_int_pair_set.