Changes between Version 20 and Version 21 of PIL


Ignore:
Timestamp:
10/16/24 15:04:14 (19 months ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PIL

    v20 v21  
    316316== Objects
    317317
    318 The function
    319318- `$obj $empty_obj($int size);`
    320 returns the empty object spanning `size` bytes.  Only values of a sized type can be written to an object.
     319 * this function returns the empty object spanning `size` bytes.
     320   Only values of a sized type can be written to an object.
     321- `void* $obj_base($obj* optr);`
     322 * returns a pointer to byte 0 of the object.  That pointer can be cast to different
     323   pointer types in order to access the object.
    321324
    322325An object is modified through a pointer into the object, for example:
     
    325328typedef $size(8) $real double;
    326329$obj o1 = $empty_obj(1000);
    327 double* dp = (double*)&o1;  // points to byte 0
     330double* dp = (double*)$obj_base(&o1);  // points to byte 0
    328331*dp = 3.14;
    329332*(dp+7) = 2.718;
    330 int* ip = (int*)&o1;
     333int* ip = (int*)dp;
    331334*(ip+2) = 17;
    332335}}}
    333 The operations above place the double value 3.14 in o1 at positions 0..7, the double value 2.718 at positions 28..35, and the integer value 17 at positions 8..11.
     336The operations above place the double value 3.14 in `o1` at positions 0..7, the double value 2.718 at positions 28..35, and the integer value 17 at positions 8..11.
    334337
    335338If a write to an object overlaps the interval of an existing value, the old value is removed.
     
    343346* how to deal with "undefined" values?
    344347* can there be nondeterministic expressions, i.e., expressions that evaluate to a set of values instead of one value?
     348* can there be nondeterministic statements, i.e., statements which result in multiple transitions
    345349* how to implement C's malloc?
    346 * what to return when something is wrong, e.g., $map_get$ when the specified key is not in the map (default value of type?)
    347 
    348 Ideas on malloc:
    349 
    350 Union of all types occurring in program:
    351 {{{
    352 typedef union {
    353   T1 t1;
    354   T2 t2;
    355   ...
    356 } BigUnion;
    357 }}}
    358 
    359 A call to malloc returns a memory block:
    360   - size (in bytes) (int)
    361   - num_elements (int)
    362   - sequence of tuples:
    363     - offset (int)
    364     - size (int)
    365     - value (type `BigUnion`)
     350