Changes between Version 1 and Version 2 of Library_IR


Ignore:
Timestamp:
12/10/15 16:05:08 (10 years ago)
Author:
zmanchun
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Library_IR

    v1 v2  
    3535The header `pointer.cvh` declares functions taking pointers as the arguments for different purposes, including:
    3636
    37 * equality checking:
    38   `fun[lib="pointer"] $equals(x: Pointer, y: Pointer): Bool`
    39   this function returns true iff the objects pointed to by the pointers `x` and `y` have the same type and value.
    40 
    41 * membership testing:
    42   `fun[lib="pointer"] $contains(ptr1: Pointer, ptr2: Pointer): Bool`
    43   this function returns true iff the object pointed to by `ptr1` contains the object pointed to by `ptr2`. For example, `$contains(&a, &a[1].x)` would return true.
    44 
    45 * pointer translation:
    46 
    47    `fun[lib="pointer"] $translate_ptr(ptr: Pointer, obj: Pointer): Pointer`
    48 
    49    this function returns a pointer which is the result of translating the pointer `ptr` (a pointer into one object) to a pointer into a different object `obj` with similar structure.
    50 
    51 * copy through pointers:
    52   `fun[lib="pointer"] $copy(ptr: Pointer, value: pointer)`
    53 
    54   copies the value pointed to by `value` to the memory location specified by `ptr`.
    55 
    56 * get leaf node pointers:
     37* `fun[lib="pointer"] $equals(x: Pointer, y: Pointer): Bool`
     38 * equality checking
     39 * this function returns true iff the objects pointed to by the pointers `x` and `y` have the same type and value.
     40* `fun[lib="pointer"] $contains(ptr1: Pointer, ptr2: Pointer): Bool`
     41 * membership testing
     42 * returns true iff the object pointed to by `ptr1` contains the object pointed to by `ptr2`. For example, `$contains(&a, &a[1].x)` would return true.
     43* `fun[lib="pointer"] $translate_ptr(ptr: Pointer, obj: Pointer): Pointer`
     44 * pointer translation
     45 * returns a pointer which is the result of translating the pointer `ptr` (a pointer into one object) to a pointer into a different object `obj` with similar structure.
     46* `fun[lib="pointer"] $copy(ptr: Pointer, value: pointer)`
     47 * copies the value pointed to by `value` to the memory location specified by `ptr`.
     48* `fun[lib="pointer"] $leaf_node_ptrs(array: Pointer, obj: Pointer)`
     49 * copies the references to the leaf nodes of `obj` to the given `array`. The type of `obj` is `Pointer[T']`, all leaf nodes of `T'` has type `T`, and `array` has type `Pointer[Array[T]]`. For example, `T'` could be `Tuple[<Integer, Array[Integer], Integer>]`
     50* `fun[lib="pointer"] $set_leaf_nodes(obj: Pointer, value: Integer)`
     51 * sets leaf nodes with the given value
     52* `fun[lib="pointer"] $is_identity_ref(obj: Pointer)`
     53 * checks if the given pointer is pointing to a variable
     54* `fun[lib="pointer"] $leaf_nodes_equal_to(obj: Pointer, value: Integer)`
     55 * checks if the leaf nodes of the given object are equal to the given integer value
     56* `fun[lib="pointer"] $has_leaf_node_equal_to(obj: Pointer, value: Integer)`
     57 * checks if the given object has a leaf node whose value is equal to the given integer value
     58* `fun[lib="pointer"] $is_derefable_pointer(ptr: Pointer)`
     59 * checks if the given pointer could be safely dereferenced
     60* `fun[lib="pointer"] $pointer_add(ptr: Pointer,  offset: Integer, type_size: Integer)`
     61 * pointer addition
    5762 
    58   `fun[lib="pointer"] $leaf_node_ptrs(array: Pointer, obj: Pointer)`
    59 
    60   copies the references to the leaf nodes of `obj` to the given `array`. The type of `obj` is `Pointer[T']`, all leaf nodes of `T'` has type `T`, and `array` has type `Pointer[Array[T]]`. For example, `T'` could be `Tuple[<Integer, Array[Integer], Integer>]`
    61 
    62 * set leaf nodes:
    63   `fun[lib="pointer"] $set_leaf_nodes(obj: Pointer, value: Integer)`
    64 
    65 * check if the given pointer is pointing to a variable:
    66 
    67   `fun[lib="pointer"] $is_identity_ref(obj: Pointer)`
    68 
    69 * check if the leaf nodes of the given object are equal to the given integer value
    70  
    71   `fun[lib="pointer"] $leaf_nodes_equal_to(obj: Pointer, value: Integer)`
    72 
    73 * check if the given object has a leaf node whose value is equal to the given integer value
    74 
    75   `fun[lib="pointer"] $has_leaf_node_equal_to(obj: Pointer, value: Integer)`
    76 
    77 * check if the given pointer could be safely dereferenced
    78 
    79   `fun[lib="pointer"] $is_derefable_pointer(ptr: Pointer)`
    80 
    81 * pointer addition
    82   `fun[lib="pointer"] $pointer_add(ptr: Pointer,  offset: Integer, type_size: Integer)`
    83  
    8463=== `bundle` utility ===
    8564