/*
 * close files
 *
 * allfile_close(param)
 *  arguments:
 *   param: Integer
 *          NuSDaS::N_FOPEN_READ  : files opened for read
 *          NuSDaS::N_FOPEN_WRITE : files opened for write
 *          NuSDaS::N_FOPEN_ALL   : all files
 *  return: Integer (number of cloesd files) or nil (no files were closed)
 */
VALUE
rb_allfile_close(VALUE self,
                 VALUE param)
{
  N_SI4 code;
  code = nusdas_allfile_close( (N_SI4)NUM2INT(param) );
  if (code > 0)
    return INT2NUM((int)code);
  else if (code == 0)
    return Qnil;
  else
    rb_raise(rb_eRuntimeError, "%d files cannot be closeed", code);
}