Class: Notcurses::Ncpalette

Inherits:
Object
  • Object
show all
Defined in:
ext/notcurses/src/notcurses_wrap.c,
ext/notcurses/src/notcurses_wrap.c

Overview

Proxy of C Notcurses::Ncpalette struct

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Object

call-seq:

Ncpalette.new

Class constructor.



20360
20361
20362
20363
20364
20365
20366
20367
20368
20369
20370
20371
20372
# File 'ext/notcurses/src/notcurses_wrap.c', line 20360

SWIGINTERN VALUE
_wrap_new_Ncpalette(int argc, VALUE *argv, VALUE self) {
  struct ncpalette *result = 0 ;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  result = (struct ncpalette *)calloc(1, sizeof(struct ncpalette));
  DATA_PTR(self) = result;
  return self;
fail:
  return Qnil;
}

Instance Method Details

#chans(*args) ⇒ Object

call-seq:

chans -> uint32_t [256]

Get value of attribute.



20296
20297
20298
20299
20300
20301
20302
20303
20304
20305
20306
20307
20308
20309
20310
20311
20312
20313
20314
20315
20316
20317
20318
20319
20320
20321
20322
20323
20324
20325
20326
20327
20328
20329
20330
20331
20332
20333
# File 'ext/notcurses/src/notcurses_wrap.c', line 20296

SWIGINTERN VALUE
_wrap_Ncpalette_chans_get(int argc, VALUE *argv, VALUE self) {
  struct ncpalette *arg1 = (struct ncpalette *) 0 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  uint32_t *result = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 0) || (argc > 0)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ncpalette, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct ncpalette *","chans", 1, self )); 
  }
  arg1 = (struct ncpalette *)(argp1);
  result = (uint32_t *)(uint32_t *) ((arg1)->chans);
  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_unsigned_int, 0 |  0 );
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("struct ncpalette *");
    if (!ty) ty = SWIGTYPE_p_ncpalette;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg1, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("self")), obj);
  }
  return vresult;
fail:
  return Qnil;
}

#chans=(*args) ⇒ Object

call-seq:

chans=(x) -> uint32_t [256]

Set new value for attribute.



20226
20227
20228
20229
20230
20231
20232
20233
20234
20235
20236
20237
20238
20239
20240
20241
20242
20243
20244
20245
20246
20247
20248
20249
20250
20251
20252
20253
20254
20255
20256
20257
20258
20259
20260
20261
20262
20263
20264
20265
20266
20267
20268
20269
20270
20271
20272
20273
20274
20275
20276
20277
20278
20279
20280
20281
20282
20283
20284
20285
20286
20287
20288
20289
20290
20291
20292
20293
# File 'ext/notcurses/src/notcurses_wrap.c', line 20226

SWIGINTERN VALUE
_wrap_Ncpalette_chans_set(int argc, VALUE *argv, VALUE self) {
  struct ncpalette *arg1 = (struct ncpalette *) 0 ;
  uint32_t *arg2 ;
  void *argp1 = 0 ;
  int res1 = 0 ;
  void *argp2 = 0 ;
  int res2 = 0 ;
  VALUE vresult = Qnil;
  
  if ((argc < 1) || (argc > 1)) {
    rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
  }
  res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ncpalette, 0 |  0 );
  if (!SWIG_IsOK(res1)) {
    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "struct ncpalette *","chans", 1, self )); 
  }
  arg1 = (struct ncpalette *)(argp1);
  res2 = SWIG_ConvertPtr(argv[0], &argp2,SWIGTYPE_p_unsigned_int, 0 |  0 );
  if (!SWIG_IsOK(res2)) {
    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "uint32_t [256]","chans", 2, argv[0] )); 
  } 
  arg2 = (uint32_t *)(argp2);
  {
    if (arg2) {
      size_t ii = 0;
      for (; ii < (size_t)256; ++ii) *(uint32_t *)&arg1->chans[ii] = *((uint32_t *)arg2 + ii);
    } else {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in variable '""chans""' of type '""uint32_t [256]""'");
    }
  }
  vresult = rb_ary_new();
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("struct ncpalette *");
    if (!ty) ty = SWIGTYPE_p_ncpalette;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg1, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("self")), obj);
  }
  {
    if (vresult == Qnil) {
      vresult = rb_hash_new();
    }
    if (!RB_TYPE_P(vresult, T_HASH)) {
      VALUE temp = rb_hash_new();
      rb_hash_aset(temp, ID2SYM(rb_intern("return")), vresult);
      vresult = temp;
    }
    
    swig_type_info *ty = SWIG_TypeQuery("uint32_t [256]");
    if (!ty) ty = SWIGTYPE_p_unsigned_int;
    
    VALUE obj = SWIG_NewPointerObj((void *)arg2, ty, 0);
    rb_hash_aset(vresult, ID2SYM(rb_intern("chans")), obj);
  }
  return vresult;
fail:
  return Qnil;
}