Sha256: fa12c11bf16d8ecbb5c8587eed92e1b0de3af93aecb7a72a0f6a094a8838895d
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
#ifndef PK11_CONST_MACROS_INCLUDED #define PK11_CONST_MACROS_INCLUDED /**************************************************/ /* constant definition */ /**************************************************/ #define PKCS11_DEFINE_CONST(constant) \ rb_define_const(MODULE_FOR_CONSTS, #constant, INT2NUM(constant)) #define PKCS11_DEFINE_CONST_GROUP(group, name, value) \ do { \ VALUE rvalue = ULONG2NUM(value); \ rb_define_const(MODULE_FOR_CONSTS, name, rvalue); \ VALUE str = rb_obj_freeze(rb_str_new2(name)); \ VALUE old = rb_hash_aref(group, rvalue); \ if (!NIL_P(old)) rb_warning("%s is equal to %s", RSTRING_PTR(old), name); \ rb_hash_aset(group, rvalue, str); \ } while(0) #define PKCS11_DEFINE_OBJECT_CLASS(constant) \ PKCS11_DEFINE_CONST_GROUP(vOBJECT_CLASSES, #constant, constant) #define PKCS11_DEFINE_ATTRIBUTE(constant) \ PKCS11_DEFINE_CONST_GROUP(vATTRIBUTES, #constant, constant) #define PKCS11_DEFINE_MECHANISM(constant) \ PKCS11_DEFINE_CONST_GROUP(vMECHANISMS, #constant, constant) #define PKCS11_DEFINE_RETURN_VALUE(constant) \ do { \ VALUE eError = rb_define_class_under(MODULE_FOR_CONSTS, #constant, BASECLASS_FOR_ERRORS); \ VALUE rvalue = ULONG2NUM(constant); \ VALUE old = rb_hash_aref(vRETURN_VALUES, rvalue); \ if (!NIL_P(old)) rb_warning("%s is equal to %s", RSTRING_PTR(old), #constant); \ rb_hash_aset(vRETURN_VALUES, rvalue, eError); \ } while(0) #endif
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pkcs11-0.2.1-x86-mswin32 | ext/pk11_const_macros.h |
pkcs11-0.2.1-x86-mingw32 | ext/pk11_const_macros.h |
pkcs11-0.2.1 | ext/pk11_const_macros.h |