Skip to content
Snippets Groups Projects
Select Git revision
  • d5d65ea3a8bdbcae95a7f8158cf5499686b99dc7
  • master default protected
  • hpke
  • ppc-chacha-4core
  • delete-internal-name-mangling
  • master-updates
  • ppc-gcm
  • ppc-chacha-2core
  • refactor-ecc-mod
  • ppc-chacha-core
  • use-mpn_cnd-functions
  • optimize-ecc-invert
  • default-m4-quote-char
  • power-asm-wip
  • test-fat
  • chacha-3core-neon
  • x86_64-salsa20-2core
  • salsa20-2core-neon
  • bcrypt
  • arm-salsa20-chacha-vsra
  • test-shlib-dir
  • nettle_3.6_release_20200429
  • nettle_3.6rc3
  • nettle_3.6rc2
  • nettle_3.6rc1
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
41 results

shadata.c

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    Program.pmod 1.71 KiB
    #pike __REAL_VERSION__
    #pragma strict_types
    
    constant inherit_list = __builtin.inherit_list;
    constant inherits = __builtin.program_inherits;
    constant implements = __builtin.program_implements;
    
    // documented in the C-code.
    string defined(program x,string|void y)
    {
        if( !y ) 
            return __builtin.program_defined(x);
        return __builtin.program_identifier_defined(x,y);
    }
    
    
    //! Enumerate all programs this program inherits, directly or indirectly.
    //! Similar to inherit_tree() but returns a flat array.
    //!
    //! @example
    //!  > class a{}
    //!  > class b{}
    //!  > class c{ inherit a; }
    //!  > class d{ inherit b; inherit c; }
    //!  > Program.inherit_tree(d);
    //!  Result: ({ /* 3 elements */
    //!              b,
    //!              c,
    //!              a
    //!          })
    array(program) all_inherits(program p)
    {
      array(program) ret = inherit_list(p);
      // Iterate over a mutated array to catch all inherits to infinite depth
      for(int e=0;e<sizeof(ret);e++) ret+=inherit_list(ret[e]);
      return ret;
    }
    
    //! Recursively builds a inheritance tree by
    //! fetching programs inheritance lists.
    //!
    //! @returns
    //!  Returns an array with programs or arrays
    //!  as elements.
    //!
    //! @example
    //!  > class a{}
    //!  > class b{}
    //!  > class c{ inherit a; }
    //!  > class d{ inherit b; inherit c; }
    //!  > Program.inherit_tree(d);
    //!  Result: ({ /* 3 elements */
    //!              d,
    //!              ({ /* 1 element */
    //!                  program
    //!              }),
    //!              ({ /* 2 elements */
    //!                  c,
    //!                  ({ /* 1 element */
    //!                      program
    //!                  })
    //!              })
    //!          })
    array inherit_tree(program p)
    {
      return ({ p })+
        Array.map(inherit_list(p),inherit_tree);
    }