Ignore:
Timestamp:
Jan 21, 2018, 12:10:09 AM (6 years ago)
Author:
coas-nagasima
Message:

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

Location:
EcnlProtoTool/trunk/mruby-1.3.0
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/mruby-1.3.0/include/mruby/hash.h

    r321 r331  
    88#define MRUBY_HASH_H
    99
    10 #include "mruby/common.h"
     10#include "common.h"
     11#include <mruby/khash.h>
    1112
    1213/**
     
    2425#define mrb_hash_value(p)  mrb_obj_value((void*)(p))
    2526
    26 MRB_API mrb_value mrb_hash_new_capa(mrb_state*, int);
     27MRB_API mrb_value mrb_hash_new_capa(mrb_state*, mrb_int);
    2728
    2829/*
    2930 * Initializes a new hash.
     31 *
     32 * Equivalent to:
     33 *
     34 *      Hash.new
     35 *
     36 * @param mrb The mruby state reference.
     37 * @return The initialized hash.
    3038 */
    3139MRB_API mrb_value mrb_hash_new(mrb_state *mrb);
     
    3341/*
    3442 * Sets a keys and values to hashes.
     43 *
     44 * Equivalent to:
     45 *
     46 *      hash[key] = val
     47 *
     48 * @param mrb The mruby state reference.
     49 * @param hash The target hash.
     50 * @param key The key to set.
     51 * @param val The value to set.
     52 * @return The value.
    3553 */
    3654MRB_API void mrb_hash_set(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value val);
    3755
    3856/*
    39  * Gets a value from a key.
     57 * Gets a value from a key. If the key is not found, the default of the
     58 * hash is used.
     59 *
     60 * Equivalent to:
     61 *
     62 *     hash[key]
     63 *
     64 * @param mrb The mruby state reference.
     65 * @param hash The target hash.
     66 * @param key The key to get.
     67 * @return The found value.
    4068 */
    4169MRB_API mrb_value mrb_hash_get(mrb_state *mrb, mrb_value hash, mrb_value key);
    4270
     71/*
     72 * Gets a value from a key. If the key is not found, the default parameter is
     73 * used.
     74 *
     75 * Equivalent to:
     76 *
     77 *     hash.hash_key?(key) ? hash[key] : def
     78 *
     79 * @param mrb The mruby state reference.
     80 * @param hash The target hash.
     81 * @param key The key to get.
     82 * @param def The default value.
     83 * @return The found value.
     84 */
    4385MRB_API mrb_value mrb_hash_fetch(mrb_state *mrb, mrb_value hash, mrb_value key, mrb_value def);
    4486
    4587/*
    4688 * Deletes hash key and value pair.
     89 *
     90 * Equivalent to:
     91 *
     92 *     hash.delete(key)
     93 *
     94 * @param mrb The mruby state reference.
     95 * @param hash The target hash.
     96 * @param key The key to delete.
     97 * @return The deleted value.
    4798 */
    4899MRB_API mrb_value mrb_hash_delete_key(mrb_state *mrb, mrb_value hash, mrb_value key);
     
    50101/*
    51102 * Gets an array of keys.
     103 *
     104 * Equivalent to:
     105 *
     106 *     hash.keys
     107 *
     108 * @param mrb The mruby state reference.
     109 * @param hash The target hash.
     110 * @return An array with the keys of the hash.
    52111 */
    53112MRB_API mrb_value mrb_hash_keys(mrb_state *mrb, mrb_value hash);
    54113MRB_API mrb_value mrb_check_hash_type(mrb_state *mrb, mrb_value hash);
     114
     115/*
     116 * Check if the hash is empty
     117 *
     118 * Equivalent to:
     119 *
     120 *     hash.empty?
     121 *
     122 * @param mrb The mruby state reference.
     123 * @param self The target hash.
     124 * @return True if the hash is empty, false otherwise.
     125 */
    55126MRB_API mrb_value mrb_hash_empty_p(mrb_state *mrb, mrb_value self);
    56127
    57128/*
     129 * Gets an array of values.
     130 *
     131 * Equivalent to:
     132 *
     133 *     hash.values
     134 *
     135 * @param mrb The mruby state reference.
     136 * @param hash The target hash.
     137 * @return An array with the values of the hash.
     138 */
     139MRB_API mrb_value mrb_hash_values(mrb_state *mrb, mrb_value hash);
     140
     141/*
    58142 * Clears the hash.
     143 *
     144 * Equivalent to:
     145 *
     146 *     hash.clear
     147 *
     148 * @param mrb The mruby state reference.
     149 * @param hash The target hash.
     150 * @return The hash
    59151 */
    60152MRB_API mrb_value mrb_hash_clear(mrb_state *mrb, mrb_value hash);
     153
     154/* declaration of struct kh_ht */
     155/* be careful when you touch the internal */
     156typedef struct {
     157  mrb_value v;
     158  mrb_int n;
     159} mrb_hash_value;
     160
     161KHASH_DECLARE(ht, mrb_value, mrb_hash_value, TRUE)
    61162
    62163/* RHASH_TBL allocates st_table if not available. */
     
    67168MRB_API struct kh_ht * mrb_hash_tbl(mrb_state *mrb, mrb_value hash);
    68169
    69 #define MRB_HASH_PROC_DEFAULT 256
     170#define MRB_HASH_DEFAULT      1
     171#define MRB_HASH_PROC_DEFAULT 2
     172#define MRB_RHASH_DEFAULT_P(h) (RHASH(h)->flags & MRB_HASH_DEFAULT)
    70173#define MRB_RHASH_PROCDEFAULT_P(h) (RHASH(h)->flags & MRB_HASH_PROC_DEFAULT)
    71174
Note: See TracChangeset for help on using the changeset viewer.