root/ext/uvector/uvlib.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. clamp_arg
  2. uvlib_s8vectorP
  3. uvlib_make_s8vector
  4. uvlib_s8vector
  5. uvlib_s8vector_length
  6. uvlib_s8vector_ref
  7. uvlib_s8vector_setX
  8. uvlib_s8vector_copy
  9. uvlib_s8vector_copyX
  10. uvlib_s8vector_TOlist
  11. uvlib_list_TOs8vector
  12. uvlib_s8vector_fillX
  13. uvlib_s8vector_TOvector
  14. uvlib_vector_TOs8vector
  15. uvlib_u8vectorP
  16. uvlib_make_u8vector
  17. uvlib_u8vector
  18. uvlib_u8vector_length
  19. uvlib_u8vector_ref
  20. uvlib_u8vector_setX
  21. uvlib_u8vector_copy
  22. uvlib_u8vector_copyX
  23. uvlib_u8vector_TOlist
  24. uvlib_list_TOu8vector
  25. uvlib_u8vector_fillX
  26. uvlib_u8vector_TOvector
  27. uvlib_vector_TOu8vector
  28. uvlib_s16vectorP
  29. uvlib_make_s16vector
  30. uvlib_s16vector
  31. uvlib_s16vector_length
  32. uvlib_s16vector_ref
  33. uvlib_s16vector_setX
  34. uvlib_s16vector_copy
  35. uvlib_s16vector_copyX
  36. uvlib_s16vector_TOlist
  37. uvlib_list_TOs16vector
  38. uvlib_s16vector_fillX
  39. uvlib_s16vector_TOvector
  40. uvlib_vector_TOs16vector
  41. uvlib_u16vectorP
  42. uvlib_make_u16vector
  43. uvlib_u16vector
  44. uvlib_u16vector_length
  45. uvlib_u16vector_ref
  46. uvlib_u16vector_setX
  47. uvlib_u16vector_copy
  48. uvlib_u16vector_copyX
  49. uvlib_u16vector_TOlist
  50. uvlib_list_TOu16vector
  51. uvlib_u16vector_fillX
  52. uvlib_u16vector_TOvector
  53. uvlib_vector_TOu16vector
  54. uvlib_s32vectorP
  55. uvlib_make_s32vector
  56. uvlib_s32vector
  57. uvlib_s32vector_length
  58. uvlib_s32vector_ref
  59. uvlib_s32vector_setX
  60. uvlib_s32vector_copy
  61. uvlib_s32vector_copyX
  62. uvlib_s32vector_TOlist
  63. uvlib_list_TOs32vector
  64. uvlib_s32vector_fillX
  65. uvlib_s32vector_TOvector
  66. uvlib_vector_TOs32vector
  67. uvlib_u32vectorP
  68. uvlib_make_u32vector
  69. uvlib_u32vector
  70. uvlib_u32vector_length
  71. uvlib_u32vector_ref
  72. uvlib_u32vector_setX
  73. uvlib_u32vector_copy
  74. uvlib_u32vector_copyX
  75. uvlib_u32vector_TOlist
  76. uvlib_list_TOu32vector
  77. uvlib_u32vector_fillX
  78. uvlib_u32vector_TOvector
  79. uvlib_vector_TOu32vector
  80. uvlib_s64vectorP
  81. uvlib_make_s64vector
  82. uvlib_s64vector
  83. uvlib_s64vector_length
  84. uvlib_s64vector_ref
  85. uvlib_s64vector_setX
  86. uvlib_s64vector_copy
  87. uvlib_s64vector_copyX
  88. uvlib_s64vector_TOlist
  89. uvlib_list_TOs64vector
  90. uvlib_s64vector_fillX
  91. uvlib_s64vector_TOvector
  92. uvlib_vector_TOs64vector
  93. uvlib_u64vectorP
  94. uvlib_make_u64vector
  95. uvlib_u64vector
  96. uvlib_u64vector_length
  97. uvlib_u64vector_ref
  98. uvlib_u64vector_setX
  99. uvlib_u64vector_copy
  100. uvlib_u64vector_copyX
  101. uvlib_u64vector_TOlist
  102. uvlib_list_TOu64vector
  103. uvlib_u64vector_fillX
  104. uvlib_u64vector_TOvector
  105. uvlib_vector_TOu64vector
  106. uvlib_f32vectorP
  107. uvlib_make_f32vector
  108. uvlib_f32vector
  109. uvlib_f32vector_length
  110. uvlib_f32vector_ref
  111. uvlib_f32vector_setX
  112. uvlib_f32vector_copy
  113. uvlib_f32vector_copyX
  114. uvlib_f32vector_TOlist
  115. uvlib_list_TOf32vector
  116. uvlib_f32vector_fillX
  117. uvlib_f32vector_TOvector
  118. uvlib_vector_TOf32vector
  119. uvlib_f64vectorP
  120. uvlib_make_f64vector
  121. uvlib_f64vector
  122. uvlib_f64vector_length
  123. uvlib_f64vector_ref
  124. uvlib_f64vector_setX
  125. uvlib_f64vector_copy
  126. uvlib_f64vector_copyX
  127. uvlib_f64vector_TOlist
  128. uvlib_list_TOf64vector
  129. uvlib_f64vector_fillX
  130. uvlib_f64vector_TOvector
  131. uvlib_vector_TOf64vector
  132. uvlib_s8vector_add
  133. uvlib_s8vector_addX
  134. uvlib_u8vector_add
  135. uvlib_u8vector_addX
  136. uvlib_s16vector_add
  137. uvlib_s16vector_addX
  138. uvlib_u16vector_add
  139. uvlib_u16vector_addX
  140. uvlib_s32vector_add
  141. uvlib_s32vector_addX
  142. uvlib_u32vector_add
  143. uvlib_u32vector_addX
  144. uvlib_s64vector_add
  145. uvlib_s64vector_addX
  146. uvlib_u64vector_add
  147. uvlib_u64vector_addX
  148. uvlib_f32vector_add
  149. uvlib_f32vector_addX
  150. uvlib_f64vector_add
  151. uvlib_f64vector_addX
  152. uvlib_s8vector_sub
  153. uvlib_s8vector_subX
  154. uvlib_u8vector_sub
  155. uvlib_u8vector_subX
  156. uvlib_s16vector_sub
  157. uvlib_s16vector_subX
  158. uvlib_u16vector_sub
  159. uvlib_u16vector_subX
  160. uvlib_s32vector_sub
  161. uvlib_s32vector_subX
  162. uvlib_u32vector_sub
  163. uvlib_u32vector_subX
  164. uvlib_s64vector_sub
  165. uvlib_s64vector_subX
  166. uvlib_u64vector_sub
  167. uvlib_u64vector_subX
  168. uvlib_f32vector_sub
  169. uvlib_f32vector_subX
  170. uvlib_f64vector_sub
  171. uvlib_f64vector_subX
  172. uvlib_s8vector_mul
  173. uvlib_s8vector_mulX
  174. uvlib_u8vector_mul
  175. uvlib_u8vector_mulX
  176. uvlib_s16vector_mul
  177. uvlib_s16vector_mulX
  178. uvlib_u16vector_mul
  179. uvlib_u16vector_mulX
  180. uvlib_s32vector_mul
  181. uvlib_s32vector_mulX
  182. uvlib_u32vector_mul
  183. uvlib_u32vector_mulX
  184. uvlib_s64vector_mul
  185. uvlib_s64vector_mulX
  186. uvlib_u64vector_mul
  187. uvlib_u64vector_mulX
  188. uvlib_f32vector_mul
  189. uvlib_f32vector_mulX
  190. uvlib_f64vector_mul
  191. uvlib_f64vector_mulX
  192. uvlib_f32vector_div
  193. uvlib_f32vector_divX
  194. uvlib_f64vector_div
  195. uvlib_f64vector_divX
  196. uvlib_s8vector_and
  197. uvlib_s8vector_andX
  198. uvlib_s8vector_ior
  199. uvlib_s8vector_iorX
  200. uvlib_s8vector_xor
  201. uvlib_s8vector_xorX
  202. uvlib_u8vector_and
  203. uvlib_u8vector_andX
  204. uvlib_u8vector_ior
  205. uvlib_u8vector_iorX
  206. uvlib_u8vector_xor
  207. uvlib_u8vector_xorX
  208. uvlib_s16vector_and
  209. uvlib_s16vector_andX
  210. uvlib_s16vector_ior
  211. uvlib_s16vector_iorX
  212. uvlib_s16vector_xor
  213. uvlib_s16vector_xorX
  214. uvlib_u16vector_and
  215. uvlib_u16vector_andX
  216. uvlib_u16vector_ior
  217. uvlib_u16vector_iorX
  218. uvlib_u16vector_xor
  219. uvlib_u16vector_xorX
  220. uvlib_s32vector_and
  221. uvlib_s32vector_andX
  222. uvlib_s32vector_ior
  223. uvlib_s32vector_iorX
  224. uvlib_s32vector_xor
  225. uvlib_s32vector_xorX
  226. uvlib_u32vector_and
  227. uvlib_u32vector_andX
  228. uvlib_u32vector_ior
  229. uvlib_u32vector_iorX
  230. uvlib_u32vector_xor
  231. uvlib_u32vector_xorX
  232. uvlib_s64vector_and
  233. uvlib_s64vector_andX
  234. uvlib_s64vector_ior
  235. uvlib_s64vector_iorX
  236. uvlib_s64vector_xor
  237. uvlib_s64vector_xorX
  238. uvlib_u64vector_and
  239. uvlib_u64vector_andX
  240. uvlib_u64vector_ior
  241. uvlib_u64vector_iorX
  242. uvlib_u64vector_xor
  243. uvlib_u64vector_xorX
  244. uvlib_s8vector_dot
  245. uvlib_u8vector_dot
  246. uvlib_s16vector_dot
  247. uvlib_u16vector_dot
  248. uvlib_s32vector_dot
  249. uvlib_u32vector_dot
  250. uvlib_s64vector_dot
  251. uvlib_u64vector_dot
  252. uvlib_f32vector_dot
  253. uvlib_f64vector_dot
  254. uvlib_s8vector_range_check
  255. uvlib_s8vector_clamp
  256. uvlib_s8vector_clampX
  257. uvlib_u8vector_range_check
  258. uvlib_u8vector_clamp
  259. uvlib_u8vector_clampX
  260. uvlib_s16vector_range_check
  261. uvlib_s16vector_clamp
  262. uvlib_s16vector_clampX
  263. uvlib_u16vector_range_check
  264. uvlib_u16vector_clamp
  265. uvlib_u16vector_clampX
  266. uvlib_s32vector_range_check
  267. uvlib_s32vector_clamp
  268. uvlib_s32vector_clampX
  269. uvlib_u32vector_range_check
  270. uvlib_u32vector_clamp
  271. uvlib_u32vector_clampX
  272. uvlib_s64vector_range_check
  273. uvlib_s64vector_clamp
  274. uvlib_s64vector_clampX
  275. uvlib_u64vector_range_check
  276. uvlib_u64vector_clamp
  277. uvlib_u64vector_clampX
  278. uvlib_f32vector_range_check
  279. uvlib_f32vector_clamp
  280. uvlib_f32vector_clampX
  281. uvlib_f64vector_range_check
  282. uvlib_f64vector_clamp
  283. uvlib_f64vector_clampX
  284. uvlib_s16vector_swap_bytes
  285. uvlib_s16vector_swap_bytesX
  286. uvlib_u16vector_swap_bytes
  287. uvlib_u16vector_swap_bytesX
  288. uvlib_s32vector_swap_bytes
  289. uvlib_s32vector_swap_bytesX
  290. uvlib_u32vector_swap_bytes
  291. uvlib_u32vector_swap_bytesX
  292. uvlib_s64vector_swap_bytes
  293. uvlib_s64vector_swap_bytesX
  294. uvlib_u64vector_swap_bytes
  295. uvlib_u64vector_swap_bytesX
  296. uvlib_f32vector_swap_bytes
  297. uvlib_f32vector_swap_bytesX
  298. uvlib_f64vector_swap_bytes
  299. uvlib_f64vector_swap_bytesX
  300. uvlib_uvector_alias
  301. uvlib_uvector_swap_bytes
  302. uvlib_uvector_swap_bytesX
  303. uvlib_read_blockX
  304. uvlib_write_block
  305. string_to_bytevector
  306. uvlib_string_TOs8vector
  307. uvlib_string_TOu8vector
  308. string_to_bytevectorX
  309. uvlib_string_TOs8vectorX
  310. uvlib_string_TOu8vectorX
  311. bytevector_to_string
  312. uvlib_s8vector_TOstring
  313. uvlib_u8vector_TOstring
  314. string_to_wordvector
  315. uvlib_string_TOs32vector
  316. uvlib_string_TOu32vector
  317. wordvector_to_string
  318. uvlib_s32vector_TOstring
  319. uvlib_u32vector_TOstring
  320. Scm_Init_uvlib

   1 /* Generated by genstub.  Do not edit. */
   2 #include <gauche.h>
   3 #if defined(__CYGWIN__) || defined(__MINGW32__)
   4 #define SCM_CGEN_CONST /*empty*/
   5 #else
   6 #define SCM_CGEN_CONST const
   7 #endif
   8 
   9 #include <math.h>
  10 #include "gauche/uvector.h"
  11 #include "uvectorP.h"
  12 
  13 static SCM_DEFINE_STRING_CONST(sym_both__NAME, "both", 4, 4);
  14 static ScmObj sym_both = SCM_UNBOUND;
  15 static SCM_DEFINE_STRING_CONST(sym_high__NAME, "high", 4, 4);
  16 static ScmObj sym_high = SCM_UNBOUND;
  17 static SCM_DEFINE_STRING_CONST(sym_low__NAME, "low", 3, 3);
  18 static ScmObj sym_low = SCM_UNBOUND;
  19 static int clamp_arg(ScmObj clamp)
  20  {
  21    if (SCM_EQ(clamp, sym_both)) return SCM_CLAMP_BOTH;
  22    else if (SCM_EQ(clamp, sym_low))  return SCM_CLAMP_LO;
  23    else if (SCM_EQ(clamp, sym_high)) return SCM_CLAMP_HI;
  24    if (!SCM_FALSEP(clamp) && !SCM_UNBOUNDP(clamp))
  25      Scm_Error("clamp argument must be either 'both, 'high, 'low or #f, but got %S", clamp);
  26    return SCM_CLAMP_ERROR;
  27  }
  28 
  29 static ScmObj uvlib_s8vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  30 {
  31   ScmObj obj_scm;
  32   ScmObj obj;
  33   SCM_ENTER_SUBR("s8vector?");
  34   obj_scm = SCM_ARGREF(0);
  35   obj = (obj_scm);
  36   {
  37 {
  38 int SCM_RESULT;
  39 SCM_RESULT = SCM_S8VECTORP(obj);
  40 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
  41 }
  42   }
  43 }
  44 
  45 static SCM_DEFINE_STRING_CONST(uvlib_s8vectorP__NAME, "s8vector?", 9, 9);
  46 static SCM_DEFINE_SUBR(uvlib_s8vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_s8vectorP__NAME), uvlib_s8vectorP, NULL, NULL);
  47 
  48 static ScmObj uvlib_make_s8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  49 {
  50   ScmObj length_scm;
  51   int length;
  52   ScmObj fill_scm;
  53   ScmObj fill;
  54   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  55   SCM_ENTER_SUBR("make-s8vector");
  56   if (Scm_Length(SCM_OPTARGS) > 1)
  57     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
  58   length_scm = SCM_ARGREF(0);
  59   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
  60   length = SCM_INT_VALUE(length_scm);
  61   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
  62   else {
  63     fill_scm = SCM_CAR(SCM_OPTARGS);
  64     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
  65   }
  66   fill = (fill_scm);
  67   {
  68 signed char filler;
  69   filler = s8unbox(fill, SCM_CLAMP_ERROR);
  70   SCM_RETURN(Scm_MakeS8Vector(length, filler));
  71   }
  72 }
  73 
  74 static SCM_DEFINE_STRING_CONST(uvlib_make_s8vector__NAME, "make-s8vector", 13, 13);
  75 static SCM_DEFINE_SUBR(uvlib_make_s8vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_s8vector__NAME), uvlib_make_s8vector, NULL, NULL);
  76 
  77 static ScmObj uvlib_s8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  78 {
  79   ScmObj args_scm;
  80   ScmObj args;
  81   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
  82   SCM_ENTER_SUBR("s8vector");
  83   args_scm = SCM_OPTARGS;
  84   args = (args_scm);
  85   {
  86 SCM_RETURN(Scm_ListToS8Vector(args, SCM_CLAMP_ERROR));
  87   }
  88 }
  89 
  90 static SCM_DEFINE_STRING_CONST(uvlib_s8vector__NAME, "s8vector", 8, 8);
  91 static SCM_DEFINE_SUBR(uvlib_s8vector__STUB, 0, 1, SCM_OBJ(&uvlib_s8vector__NAME), uvlib_s8vector, NULL, NULL);
  92 
  93 static ScmObj uvlib_s8vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
  94 {
  95   ScmObj v_scm;
  96   ScmS8Vector* v;
  97   SCM_ENTER_SUBR("s8vector-length");
  98   v_scm = SCM_ARGREF(0);
  99   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 100   v = SCM_S8VECTOR(v_scm);
 101   {
 102 SCM_RETURN(SCM_MAKE_INT(SCM_S8VECTOR_SIZE(v)));
 103   }
 104 }
 105 
 106 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_length__NAME, "s8vector-length", 15, 15);
 107 static SCM_DEFINE_SUBR(uvlib_s8vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_s8vector_length__NAME), uvlib_s8vector_length, NULL, NULL);
 108 
 109 static ScmObj uvlib_s8vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 110 {
 111   ScmObj v_scm;
 112   ScmS8Vector* v;
 113   ScmObj i_scm;
 114   int i;
 115   ScmObj fallback_scm;
 116   ScmObj fallback;
 117   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 118   SCM_ENTER_SUBR("s8vector-ref");
 119   if (Scm_Length(SCM_OPTARGS) > 1)
 120     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 121   v_scm = SCM_ARGREF(0);
 122   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 123   v = SCM_S8VECTOR(v_scm);
 124   i_scm = SCM_ARGREF(1);
 125   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
 126   i = SCM_INT_VALUE(i_scm);
 127   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
 128   else {
 129     fallback_scm = SCM_CAR(SCM_OPTARGS);
 130     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 131   }
 132   fallback = (fallback_scm);
 133   {
 134 SCM_RETURN(Scm_S8VectorRef(v, i, fallback));
 135   }
 136 }
 137 
 138 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_ref__NAME, "s8vector-ref", 12, 12);
 139 static SCM_DEFINE_SUBR(uvlib_s8vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_s8vector_ref__NAME), uvlib_s8vector_ref, NULL, NULL);
 140 
 141 static ScmObj uvlib_s8vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 142 {
 143   ScmObj v_scm;
 144   ScmS8Vector* v;
 145   ScmObj i_scm;
 146   int i;
 147   ScmObj val_scm;
 148   ScmObj val;
 149   ScmObj clamp_scm;
 150   ScmObj clamp;
 151   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 152   SCM_ENTER_SUBR("s8vector-set!");
 153   if (Scm_Length(SCM_OPTARGS) > 1)
 154     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 155   v_scm = SCM_ARGREF(0);
 156   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 157   v = SCM_S8VECTOR(v_scm);
 158   i_scm = SCM_ARGREF(1);
 159   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
 160   i = SCM_INT_VALUE(i_scm);
 161   val_scm = SCM_ARGREF(2);
 162   val = (val_scm);
 163   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
 164   else {
 165     clamp_scm = SCM_CAR(SCM_OPTARGS);
 166     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 167   }
 168   clamp = (clamp_scm);
 169   {
 170 SCM_RETURN(Scm_S8VectorSet(v, i, val, clamp_arg(clamp)));
 171   }
 172 }
 173 
 174 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_setX__NAME, "s8vector-set!", 13, 13);
 175 static SCM_DEFINE_SUBR(uvlib_s8vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_s8vector_setX__NAME), uvlib_s8vector_setX, NULL, NULL);
 176 
 177 static ScmObj uvlib_s8vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 178 {
 179   ScmObj v_scm;
 180   ScmS8Vector* v;
 181   ScmObj start_scm;
 182   int start;
 183   ScmObj end_scm;
 184   int end;
 185   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 186   SCM_ENTER_SUBR("s8vector-copy");
 187   if (Scm_Length(SCM_OPTARGS) > 2)
 188     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 189   v_scm = SCM_ARGREF(0);
 190   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 191   v = SCM_S8VECTOR(v_scm);
 192   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 193   else {
 194     start_scm = SCM_CAR(SCM_OPTARGS);
 195     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 196   }
 197   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 198   start = SCM_INT_VALUE(start_scm);
 199   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 200   else {
 201     end_scm = SCM_CAR(SCM_OPTARGS);
 202     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 203   }
 204   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 205   end = SCM_INT_VALUE(end_scm);
 206   {
 207 {
 208 ScmObj SCM_RESULT;
 209 SCM_RESULT = Scm_S8VectorCopy(v, start, end);
 210 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 211 }
 212   }
 213 }
 214 
 215 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_copy__NAME, "s8vector-copy", 13, 13);
 216 static SCM_DEFINE_SUBR(uvlib_s8vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_s8vector_copy__NAME), uvlib_s8vector_copy, NULL, NULL);
 217 
 218 static ScmObj uvlib_s8vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 219 {
 220   ScmObj dst_scm;
 221   ScmS8Vector* dst;
 222   ScmObj dstart_scm;
 223   ScmObj dstart;
 224   ScmObj src_scm;
 225   ScmObj src;
 226   ScmObj sstart_scm;
 227   int sstart;
 228   ScmObj send_scm;
 229   int send;
 230   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 231   SCM_ENTER_SUBR("s8vector-copy!");
 232   if (Scm_Length(SCM_OPTARGS) > 3)
 233     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 234   dst_scm = SCM_ARGREF(0);
 235   if (!SCM_S8VECTORP(dst_scm)) Scm_Error("<s8vector> required, but got %S", dst_scm);
 236   dst = SCM_S8VECTOR(dst_scm);
 237   dstart_scm = SCM_ARGREF(1);
 238   dstart = (dstart_scm);
 239   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
 240   else {
 241     src_scm = SCM_CAR(SCM_OPTARGS);
 242     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 243   }
 244   src = (src_scm);
 245   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
 246   else {
 247     sstart_scm = SCM_CAR(SCM_OPTARGS);
 248     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 249   }
 250   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
 251   sstart = Scm_GetInteger(sstart_scm);
 252   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
 253   else {
 254     send_scm = SCM_CAR(SCM_OPTARGS);
 255     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 256   }
 257   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
 258   send = Scm_GetInteger(send_scm);
 259   {
 260 if (SCM_INTEGERP(dstart)) {
 261      /* new API */
 262      if (!SCM_S8VECTORP(src)) {
 263        Scm_Error("s8vector-copy!: argument is not a matching uvector: %S",
 264                  src);
 265      }
 266      SCM_RETURN(Scm_S8VectorCopyX(dst, Scm_GetInteger(dstart), 
 267                                     SCM_S8VECTOR(src), sstart, send));
 268   } else if (SCM_S8VECTORP(dstart)) {
 269     /* old API */
 270     SCM_RETURN(Scm_S8VectorCopyX(dst, 0, SCM_S8VECTOR(dstart), 0, -1));
 271   } else {
 272     Scm_Error("integer required, but got %S", dstart);
 273     SCM_RETURN(SCM_UNDEFINED);
 274   }
 275   }
 276 }
 277 
 278 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_copyX__NAME, "s8vector-copy!", 14, 14);
 279 static SCM_DEFINE_SUBR(uvlib_s8vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_s8vector_copyX__NAME), uvlib_s8vector_copyX, NULL, NULL);
 280 
 281 static ScmObj uvlib_s8vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 282 {
 283   ScmObj v_scm;
 284   ScmS8Vector* v;
 285   ScmObj start_scm;
 286   int start;
 287   ScmObj end_scm;
 288   int end;
 289   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 290   SCM_ENTER_SUBR("s8vector->list");
 291   if (Scm_Length(SCM_OPTARGS) > 2)
 292     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 293   v_scm = SCM_ARGREF(0);
 294   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 295   v = SCM_S8VECTOR(v_scm);
 296   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 297   else {
 298     start_scm = SCM_CAR(SCM_OPTARGS);
 299     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 300   }
 301   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 302   start = SCM_INT_VALUE(start_scm);
 303   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 304   else {
 305     end_scm = SCM_CAR(SCM_OPTARGS);
 306     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 307   }
 308   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 309   end = SCM_INT_VALUE(end_scm);
 310   {
 311 {
 312 ScmObj SCM_RESULT;
 313 SCM_RESULT = Scm_S8VectorToList(v, start, end);
 314 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 315 }
 316   }
 317 }
 318 
 319 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_TOlist__NAME, "s8vector->list", 14, 14);
 320 static SCM_DEFINE_SUBR(uvlib_s8vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_s8vector_TOlist__NAME), uvlib_s8vector_TOlist, NULL, NULL);
 321 
 322 static ScmObj uvlib_list_TOs8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 323 {
 324   ScmObj l_scm;
 325   ScmObj l;
 326   ScmObj clamp_scm;
 327   ScmObj clamp;
 328   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 329   SCM_ENTER_SUBR("list->s8vector");
 330   if (Scm_Length(SCM_OPTARGS) > 1)
 331     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 332   l_scm = SCM_ARGREF(0);
 333   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
 334   l = (l_scm);
 335   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
 336   else {
 337     clamp_scm = SCM_CAR(SCM_OPTARGS);
 338     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 339   }
 340   clamp = (clamp_scm);
 341   {
 342 SCM_RETURN(Scm_ListToS8Vector(l, clamp_arg(clamp)));
 343   }
 344 }
 345 
 346 static SCM_DEFINE_STRING_CONST(uvlib_list_TOs8vector__NAME, "list->s8vector", 14, 14);
 347 static SCM_DEFINE_SUBR(uvlib_list_TOs8vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOs8vector__NAME), uvlib_list_TOs8vector, NULL, NULL);
 348 
 349 static ScmObj uvlib_s8vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 350 {
 351   ScmObj v_scm;
 352   ScmS8Vector* v;
 353   ScmObj val_scm;
 354   ScmObj val;
 355   ScmObj start_scm;
 356   int start;
 357   ScmObj end_scm;
 358   int end;
 359   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 360   SCM_ENTER_SUBR("s8vector-fill!");
 361   if (Scm_Length(SCM_OPTARGS) > 2)
 362     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 363   v_scm = SCM_ARGREF(0);
 364   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 365   v = SCM_S8VECTOR(v_scm);
 366   val_scm = SCM_ARGREF(1);
 367   val = (val_scm);
 368   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 369   else {
 370     start_scm = SCM_CAR(SCM_OPTARGS);
 371     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 372   }
 373   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 374   start = SCM_INT_VALUE(start_scm);
 375   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 376   else {
 377     end_scm = SCM_CAR(SCM_OPTARGS);
 378     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 379   }
 380   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 381   end = SCM_INT_VALUE(end_scm);
 382   {
 383 signed char filler;
 384   filler = s8unbox(val, SCM_CLAMP_ERROR);
 385   SCM_RETURN(Scm_S8VectorFill(v, filler, start, end));
 386   }
 387 }
 388 
 389 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_fillX__NAME, "s8vector-fill!", 14, 14);
 390 static SCM_DEFINE_SUBR(uvlib_s8vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_s8vector_fillX__NAME), uvlib_s8vector_fillX, NULL, NULL);
 391 
 392 static ScmObj uvlib_s8vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 393 {
 394   ScmObj v_scm;
 395   ScmS8Vector* v;
 396   ScmObj start_scm;
 397   int start;
 398   ScmObj end_scm;
 399   int end;
 400   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 401   SCM_ENTER_SUBR("s8vector->vector");
 402   if (Scm_Length(SCM_OPTARGS) > 2)
 403     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 404   v_scm = SCM_ARGREF(0);
 405   if (!SCM_S8VECTORP(v_scm)) Scm_Error("<s8vector> required, but got %S", v_scm);
 406   v = SCM_S8VECTOR(v_scm);
 407   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 408   else {
 409     start_scm = SCM_CAR(SCM_OPTARGS);
 410     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 411   }
 412   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 413   start = SCM_INT_VALUE(start_scm);
 414   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 415   else {
 416     end_scm = SCM_CAR(SCM_OPTARGS);
 417     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 418   }
 419   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 420   end = SCM_INT_VALUE(end_scm);
 421   {
 422 {
 423 ScmObj SCM_RESULT;
 424 SCM_RESULT = Scm_S8VectorToVector(v, start, end);
 425 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 426 }
 427   }
 428 }
 429 
 430 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_TOvector__NAME, "s8vector->vector", 16, 16);
 431 static SCM_DEFINE_SUBR(uvlib_s8vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_s8vector_TOvector__NAME), uvlib_s8vector_TOvector, NULL, NULL);
 432 
 433 static ScmObj uvlib_vector_TOs8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 434 {
 435   ScmObj v_scm;
 436   ScmVector* v;
 437   ScmObj start_scm;
 438   int start;
 439   ScmObj end_scm;
 440   int end;
 441   ScmObj clamp_scm;
 442   ScmObj clamp;
 443   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 444   SCM_ENTER_SUBR("vector->s8vector");
 445   if (Scm_Length(SCM_OPTARGS) > 3)
 446     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 447   v_scm = SCM_ARGREF(0);
 448   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
 449   v = SCM_VECTOR(v_scm);
 450   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 451   else {
 452     start_scm = SCM_CAR(SCM_OPTARGS);
 453     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 454   }
 455   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 456   start = SCM_INT_VALUE(start_scm);
 457   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 458   else {
 459     end_scm = SCM_CAR(SCM_OPTARGS);
 460     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 461   }
 462   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 463   end = SCM_INT_VALUE(end_scm);
 464   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
 465   else {
 466     clamp_scm = SCM_CAR(SCM_OPTARGS);
 467     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 468   }
 469   clamp = (clamp_scm);
 470   {
 471 SCM_RETURN(Scm_VectorToS8Vector(v, start, end, clamp_arg(clamp)));
 472   }
 473 }
 474 
 475 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOs8vector__NAME, "vector->s8vector", 16, 16);
 476 static SCM_DEFINE_SUBR(uvlib_vector_TOs8vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOs8vector__NAME), uvlib_vector_TOs8vector, NULL, NULL);
 477 
 478 static ScmObj uvlib_u8vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 479 {
 480   ScmObj obj_scm;
 481   ScmObj obj;
 482   SCM_ENTER_SUBR("u8vector?");
 483   obj_scm = SCM_ARGREF(0);
 484   obj = (obj_scm);
 485   {
 486 {
 487 int SCM_RESULT;
 488 SCM_RESULT = SCM_U8VECTORP(obj);
 489 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
 490 }
 491   }
 492 }
 493 
 494 static SCM_DEFINE_STRING_CONST(uvlib_u8vectorP__NAME, "u8vector?", 9, 9);
 495 static SCM_DEFINE_SUBR(uvlib_u8vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_u8vectorP__NAME), uvlib_u8vectorP, NULL, NULL);
 496 
 497 static ScmObj uvlib_make_u8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 498 {
 499   ScmObj length_scm;
 500   int length;
 501   ScmObj fill_scm;
 502   ScmObj fill;
 503   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 504   SCM_ENTER_SUBR("make-u8vector");
 505   if (Scm_Length(SCM_OPTARGS) > 1)
 506     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 507   length_scm = SCM_ARGREF(0);
 508   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
 509   length = SCM_INT_VALUE(length_scm);
 510   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
 511   else {
 512     fill_scm = SCM_CAR(SCM_OPTARGS);
 513     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 514   }
 515   fill = (fill_scm);
 516   {
 517 unsigned char filler;
 518   filler = u8unbox(fill, SCM_CLAMP_ERROR);
 519   SCM_RETURN(Scm_MakeU8Vector(length, filler));
 520   }
 521 }
 522 
 523 static SCM_DEFINE_STRING_CONST(uvlib_make_u8vector__NAME, "make-u8vector", 13, 13);
 524 static SCM_DEFINE_SUBR(uvlib_make_u8vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_u8vector__NAME), uvlib_make_u8vector, NULL, NULL);
 525 
 526 static ScmObj uvlib_u8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 527 {
 528   ScmObj args_scm;
 529   ScmObj args;
 530   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 531   SCM_ENTER_SUBR("u8vector");
 532   args_scm = SCM_OPTARGS;
 533   args = (args_scm);
 534   {
 535 SCM_RETURN(Scm_ListToU8Vector(args, SCM_CLAMP_ERROR));
 536   }
 537 }
 538 
 539 static SCM_DEFINE_STRING_CONST(uvlib_u8vector__NAME, "u8vector", 8, 8);
 540 static SCM_DEFINE_SUBR(uvlib_u8vector__STUB, 0, 1, SCM_OBJ(&uvlib_u8vector__NAME), uvlib_u8vector, NULL, NULL);
 541 
 542 static ScmObj uvlib_u8vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 543 {
 544   ScmObj v_scm;
 545   ScmU8Vector* v;
 546   SCM_ENTER_SUBR("u8vector-length");
 547   v_scm = SCM_ARGREF(0);
 548   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 549   v = SCM_U8VECTOR(v_scm);
 550   {
 551 SCM_RETURN(SCM_MAKE_INT(SCM_U8VECTOR_SIZE(v)));
 552   }
 553 }
 554 
 555 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_length__NAME, "u8vector-length", 15, 15);
 556 static SCM_DEFINE_SUBR(uvlib_u8vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_u8vector_length__NAME), uvlib_u8vector_length, NULL, NULL);
 557 
 558 static ScmObj uvlib_u8vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 559 {
 560   ScmObj v_scm;
 561   ScmU8Vector* v;
 562   ScmObj i_scm;
 563   int i;
 564   ScmObj fallback_scm;
 565   ScmObj fallback;
 566   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 567   SCM_ENTER_SUBR("u8vector-ref");
 568   if (Scm_Length(SCM_OPTARGS) > 1)
 569     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 570   v_scm = SCM_ARGREF(0);
 571   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 572   v = SCM_U8VECTOR(v_scm);
 573   i_scm = SCM_ARGREF(1);
 574   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
 575   i = SCM_INT_VALUE(i_scm);
 576   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
 577   else {
 578     fallback_scm = SCM_CAR(SCM_OPTARGS);
 579     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 580   }
 581   fallback = (fallback_scm);
 582   {
 583 SCM_RETURN(Scm_U8VectorRef(v, i, fallback));
 584   }
 585 }
 586 
 587 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_ref__NAME, "u8vector-ref", 12, 12);
 588 static SCM_DEFINE_SUBR(uvlib_u8vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_u8vector_ref__NAME), uvlib_u8vector_ref, NULL, NULL);
 589 
 590 static ScmObj uvlib_u8vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 591 {
 592   ScmObj v_scm;
 593   ScmU8Vector* v;
 594   ScmObj i_scm;
 595   int i;
 596   ScmObj val_scm;
 597   ScmObj val;
 598   ScmObj clamp_scm;
 599   ScmObj clamp;
 600   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 601   SCM_ENTER_SUBR("u8vector-set!");
 602   if (Scm_Length(SCM_OPTARGS) > 1)
 603     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 604   v_scm = SCM_ARGREF(0);
 605   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 606   v = SCM_U8VECTOR(v_scm);
 607   i_scm = SCM_ARGREF(1);
 608   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
 609   i = SCM_INT_VALUE(i_scm);
 610   val_scm = SCM_ARGREF(2);
 611   val = (val_scm);
 612   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
 613   else {
 614     clamp_scm = SCM_CAR(SCM_OPTARGS);
 615     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 616   }
 617   clamp = (clamp_scm);
 618   {
 619 SCM_RETURN(Scm_U8VectorSet(v, i, val, clamp_arg(clamp)));
 620   }
 621 }
 622 
 623 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_setX__NAME, "u8vector-set!", 13, 13);
 624 static SCM_DEFINE_SUBR(uvlib_u8vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_u8vector_setX__NAME), uvlib_u8vector_setX, NULL, NULL);
 625 
 626 static ScmObj uvlib_u8vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 627 {
 628   ScmObj v_scm;
 629   ScmU8Vector* v;
 630   ScmObj start_scm;
 631   int start;
 632   ScmObj end_scm;
 633   int end;
 634   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 635   SCM_ENTER_SUBR("u8vector-copy");
 636   if (Scm_Length(SCM_OPTARGS) > 2)
 637     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 638   v_scm = SCM_ARGREF(0);
 639   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 640   v = SCM_U8VECTOR(v_scm);
 641   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 642   else {
 643     start_scm = SCM_CAR(SCM_OPTARGS);
 644     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 645   }
 646   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 647   start = SCM_INT_VALUE(start_scm);
 648   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 649   else {
 650     end_scm = SCM_CAR(SCM_OPTARGS);
 651     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 652   }
 653   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 654   end = SCM_INT_VALUE(end_scm);
 655   {
 656 {
 657 ScmObj SCM_RESULT;
 658 SCM_RESULT = Scm_U8VectorCopy(v, start, end);
 659 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 660 }
 661   }
 662 }
 663 
 664 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_copy__NAME, "u8vector-copy", 13, 13);
 665 static SCM_DEFINE_SUBR(uvlib_u8vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_u8vector_copy__NAME), uvlib_u8vector_copy, NULL, NULL);
 666 
 667 static ScmObj uvlib_u8vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 668 {
 669   ScmObj dst_scm;
 670   ScmU8Vector* dst;
 671   ScmObj dstart_scm;
 672   ScmObj dstart;
 673   ScmObj src_scm;
 674   ScmObj src;
 675   ScmObj sstart_scm;
 676   int sstart;
 677   ScmObj send_scm;
 678   int send;
 679   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 680   SCM_ENTER_SUBR("u8vector-copy!");
 681   if (Scm_Length(SCM_OPTARGS) > 3)
 682     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 683   dst_scm = SCM_ARGREF(0);
 684   if (!SCM_U8VECTORP(dst_scm)) Scm_Error("<u8vector> required, but got %S", dst_scm);
 685   dst = SCM_U8VECTOR(dst_scm);
 686   dstart_scm = SCM_ARGREF(1);
 687   dstart = (dstart_scm);
 688   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
 689   else {
 690     src_scm = SCM_CAR(SCM_OPTARGS);
 691     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 692   }
 693   src = (src_scm);
 694   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
 695   else {
 696     sstart_scm = SCM_CAR(SCM_OPTARGS);
 697     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 698   }
 699   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
 700   sstart = Scm_GetInteger(sstart_scm);
 701   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
 702   else {
 703     send_scm = SCM_CAR(SCM_OPTARGS);
 704     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 705   }
 706   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
 707   send = Scm_GetInteger(send_scm);
 708   {
 709 if (SCM_INTEGERP(dstart)) {
 710      /* new API */
 711      if (!SCM_U8VECTORP(src)) {
 712        Scm_Error("u8vector-copy!: argument is not a matching uvector: %S",
 713                  src);
 714      }
 715      SCM_RETURN(Scm_U8VectorCopyX(dst, Scm_GetInteger(dstart), 
 716                                     SCM_U8VECTOR(src), sstart, send));
 717   } else if (SCM_U8VECTORP(dstart)) {
 718     /* old API */
 719     SCM_RETURN(Scm_U8VectorCopyX(dst, 0, SCM_U8VECTOR(dstart), 0, -1));
 720   } else {
 721     Scm_Error("integer required, but got %S", dstart);
 722     SCM_RETURN(SCM_UNDEFINED);
 723   }
 724   }
 725 }
 726 
 727 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_copyX__NAME, "u8vector-copy!", 14, 14);
 728 static SCM_DEFINE_SUBR(uvlib_u8vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_u8vector_copyX__NAME), uvlib_u8vector_copyX, NULL, NULL);
 729 
 730 static ScmObj uvlib_u8vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 731 {
 732   ScmObj v_scm;
 733   ScmU8Vector* v;
 734   ScmObj start_scm;
 735   int start;
 736   ScmObj end_scm;
 737   int end;
 738   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 739   SCM_ENTER_SUBR("u8vector->list");
 740   if (Scm_Length(SCM_OPTARGS) > 2)
 741     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 742   v_scm = SCM_ARGREF(0);
 743   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 744   v = SCM_U8VECTOR(v_scm);
 745   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 746   else {
 747     start_scm = SCM_CAR(SCM_OPTARGS);
 748     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 749   }
 750   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 751   start = SCM_INT_VALUE(start_scm);
 752   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 753   else {
 754     end_scm = SCM_CAR(SCM_OPTARGS);
 755     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 756   }
 757   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 758   end = SCM_INT_VALUE(end_scm);
 759   {
 760 {
 761 ScmObj SCM_RESULT;
 762 SCM_RESULT = Scm_U8VectorToList(v, start, end);
 763 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 764 }
 765   }
 766 }
 767 
 768 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_TOlist__NAME, "u8vector->list", 14, 14);
 769 static SCM_DEFINE_SUBR(uvlib_u8vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_u8vector_TOlist__NAME), uvlib_u8vector_TOlist, NULL, NULL);
 770 
 771 static ScmObj uvlib_list_TOu8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 772 {
 773   ScmObj l_scm;
 774   ScmObj l;
 775   ScmObj clamp_scm;
 776   ScmObj clamp;
 777   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 778   SCM_ENTER_SUBR("list->u8vector");
 779   if (Scm_Length(SCM_OPTARGS) > 1)
 780     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 781   l_scm = SCM_ARGREF(0);
 782   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
 783   l = (l_scm);
 784   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
 785   else {
 786     clamp_scm = SCM_CAR(SCM_OPTARGS);
 787     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 788   }
 789   clamp = (clamp_scm);
 790   {
 791 SCM_RETURN(Scm_ListToU8Vector(l, clamp_arg(clamp)));
 792   }
 793 }
 794 
 795 static SCM_DEFINE_STRING_CONST(uvlib_list_TOu8vector__NAME, "list->u8vector", 14, 14);
 796 static SCM_DEFINE_SUBR(uvlib_list_TOu8vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOu8vector__NAME), uvlib_list_TOu8vector, NULL, NULL);
 797 
 798 static ScmObj uvlib_u8vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 799 {
 800   ScmObj v_scm;
 801   ScmU8Vector* v;
 802   ScmObj val_scm;
 803   ScmObj val;
 804   ScmObj start_scm;
 805   int start;
 806   ScmObj end_scm;
 807   int end;
 808   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 809   SCM_ENTER_SUBR("u8vector-fill!");
 810   if (Scm_Length(SCM_OPTARGS) > 2)
 811     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 812   v_scm = SCM_ARGREF(0);
 813   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 814   v = SCM_U8VECTOR(v_scm);
 815   val_scm = SCM_ARGREF(1);
 816   val = (val_scm);
 817   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 818   else {
 819     start_scm = SCM_CAR(SCM_OPTARGS);
 820     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 821   }
 822   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 823   start = SCM_INT_VALUE(start_scm);
 824   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 825   else {
 826     end_scm = SCM_CAR(SCM_OPTARGS);
 827     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 828   }
 829   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 830   end = SCM_INT_VALUE(end_scm);
 831   {
 832 unsigned char filler;
 833   filler = u8unbox(val, SCM_CLAMP_ERROR);
 834   SCM_RETURN(Scm_U8VectorFill(v, filler, start, end));
 835   }
 836 }
 837 
 838 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_fillX__NAME, "u8vector-fill!", 14, 14);
 839 static SCM_DEFINE_SUBR(uvlib_u8vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_u8vector_fillX__NAME), uvlib_u8vector_fillX, NULL, NULL);
 840 
 841 static ScmObj uvlib_u8vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 842 {
 843   ScmObj v_scm;
 844   ScmU8Vector* v;
 845   ScmObj start_scm;
 846   int start;
 847   ScmObj end_scm;
 848   int end;
 849   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 850   SCM_ENTER_SUBR("u8vector->vector");
 851   if (Scm_Length(SCM_OPTARGS) > 2)
 852     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 853   v_scm = SCM_ARGREF(0);
 854   if (!SCM_U8VECTORP(v_scm)) Scm_Error("<u8vector> required, but got %S", v_scm);
 855   v = SCM_U8VECTOR(v_scm);
 856   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 857   else {
 858     start_scm = SCM_CAR(SCM_OPTARGS);
 859     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 860   }
 861   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 862   start = SCM_INT_VALUE(start_scm);
 863   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 864   else {
 865     end_scm = SCM_CAR(SCM_OPTARGS);
 866     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 867   }
 868   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 869   end = SCM_INT_VALUE(end_scm);
 870   {
 871 {
 872 ScmObj SCM_RESULT;
 873 SCM_RESULT = Scm_U8VectorToVector(v, start, end);
 874 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 875 }
 876   }
 877 }
 878 
 879 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_TOvector__NAME, "u8vector->vector", 16, 16);
 880 static SCM_DEFINE_SUBR(uvlib_u8vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_u8vector_TOvector__NAME), uvlib_u8vector_TOvector, NULL, NULL);
 881 
 882 static ScmObj uvlib_vector_TOu8vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 883 {
 884   ScmObj v_scm;
 885   ScmVector* v;
 886   ScmObj start_scm;
 887   int start;
 888   ScmObj end_scm;
 889   int end;
 890   ScmObj clamp_scm;
 891   ScmObj clamp;
 892   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 893   SCM_ENTER_SUBR("vector->u8vector");
 894   if (Scm_Length(SCM_OPTARGS) > 3)
 895     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 896   v_scm = SCM_ARGREF(0);
 897   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
 898   v = SCM_VECTOR(v_scm);
 899   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
 900   else {
 901     start_scm = SCM_CAR(SCM_OPTARGS);
 902     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 903   }
 904   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
 905   start = SCM_INT_VALUE(start_scm);
 906   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
 907   else {
 908     end_scm = SCM_CAR(SCM_OPTARGS);
 909     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 910   }
 911   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
 912   end = SCM_INT_VALUE(end_scm);
 913   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
 914   else {
 915     clamp_scm = SCM_CAR(SCM_OPTARGS);
 916     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 917   }
 918   clamp = (clamp_scm);
 919   {
 920 SCM_RETURN(Scm_VectorToU8Vector(v, start, end, clamp_arg(clamp)));
 921   }
 922 }
 923 
 924 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOu8vector__NAME, "vector->u8vector", 16, 16);
 925 static SCM_DEFINE_SUBR(uvlib_vector_TOu8vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOu8vector__NAME), uvlib_vector_TOu8vector, NULL, NULL);
 926 
 927 static ScmObj uvlib_s16vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 928 {
 929   ScmObj obj_scm;
 930   ScmObj obj;
 931   SCM_ENTER_SUBR("s16vector?");
 932   obj_scm = SCM_ARGREF(0);
 933   obj = (obj_scm);
 934   {
 935 {
 936 int SCM_RESULT;
 937 SCM_RESULT = SCM_S16VECTORP(obj);
 938 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
 939 }
 940   }
 941 }
 942 
 943 static SCM_DEFINE_STRING_CONST(uvlib_s16vectorP__NAME, "s16vector?", 10, 10);
 944 static SCM_DEFINE_SUBR(uvlib_s16vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_s16vectorP__NAME), uvlib_s16vectorP, NULL, NULL);
 945 
 946 static ScmObj uvlib_make_s16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 947 {
 948   ScmObj length_scm;
 949   int length;
 950   ScmObj fill_scm;
 951   ScmObj fill;
 952   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 953   SCM_ENTER_SUBR("make-s16vector");
 954   if (Scm_Length(SCM_OPTARGS) > 1)
 955     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 956   length_scm = SCM_ARGREF(0);
 957   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
 958   length = SCM_INT_VALUE(length_scm);
 959   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
 960   else {
 961     fill_scm = SCM_CAR(SCM_OPTARGS);
 962     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 963   }
 964   fill = (fill_scm);
 965   {
 966 short filler;
 967   filler = s16unbox(fill, SCM_CLAMP_ERROR);
 968   SCM_RETURN(Scm_MakeS16Vector(length, filler));
 969   }
 970 }
 971 
 972 static SCM_DEFINE_STRING_CONST(uvlib_make_s16vector__NAME, "make-s16vector", 14, 14);
 973 static SCM_DEFINE_SUBR(uvlib_make_s16vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_s16vector__NAME), uvlib_make_s16vector, NULL, NULL);
 974 
 975 static ScmObj uvlib_s16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 976 {
 977   ScmObj args_scm;
 978   ScmObj args;
 979   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 980   SCM_ENTER_SUBR("s16vector");
 981   args_scm = SCM_OPTARGS;
 982   args = (args_scm);
 983   {
 984 SCM_RETURN(Scm_ListToS16Vector(args, SCM_CLAMP_ERROR));
 985   }
 986 }
 987 
 988 static SCM_DEFINE_STRING_CONST(uvlib_s16vector__NAME, "s16vector", 9, 9);
 989 static SCM_DEFINE_SUBR(uvlib_s16vector__STUB, 0, 1, SCM_OBJ(&uvlib_s16vector__NAME), uvlib_s16vector, NULL, NULL);
 990 
 991 static ScmObj uvlib_s16vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 992 {
 993   ScmObj v_scm;
 994   ScmS16Vector* v;
 995   SCM_ENTER_SUBR("s16vector-length");
 996   v_scm = SCM_ARGREF(0);
 997   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
 998   v = SCM_S16VECTOR(v_scm);
 999   {
1000 SCM_RETURN(SCM_MAKE_INT(SCM_S16VECTOR_SIZE(v)));
1001   }
1002 }
1003 
1004 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_length__NAME, "s16vector-length", 16, 16);
1005 static SCM_DEFINE_SUBR(uvlib_s16vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_s16vector_length__NAME), uvlib_s16vector_length, NULL, NULL);
1006 
1007 static ScmObj uvlib_s16vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1008 {
1009   ScmObj v_scm;
1010   ScmS16Vector* v;
1011   ScmObj i_scm;
1012   int i;
1013   ScmObj fallback_scm;
1014   ScmObj fallback;
1015   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1016   SCM_ENTER_SUBR("s16vector-ref");
1017   if (Scm_Length(SCM_OPTARGS) > 1)
1018     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1019   v_scm = SCM_ARGREF(0);
1020   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
1021   v = SCM_S16VECTOR(v_scm);
1022   i_scm = SCM_ARGREF(1);
1023   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
1024   i = SCM_INT_VALUE(i_scm);
1025   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
1026   else {
1027     fallback_scm = SCM_CAR(SCM_OPTARGS);
1028     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1029   }
1030   fallback = (fallback_scm);
1031   {
1032 SCM_RETURN(Scm_S16VectorRef(v, i, fallback));
1033   }
1034 }
1035 
1036 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_ref__NAME, "s16vector-ref", 13, 13);
1037 static SCM_DEFINE_SUBR(uvlib_s16vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_s16vector_ref__NAME), uvlib_s16vector_ref, NULL, NULL);
1038 
1039 static ScmObj uvlib_s16vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1040 {
1041   ScmObj v_scm;
1042   ScmS16Vector* v;
1043   ScmObj i_scm;
1044   int i;
1045   ScmObj val_scm;
1046   ScmObj val;
1047   ScmObj clamp_scm;
1048   ScmObj clamp;
1049   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1050   SCM_ENTER_SUBR("s16vector-set!");
1051   if (Scm_Length(SCM_OPTARGS) > 1)
1052     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1053   v_scm = SCM_ARGREF(0);
1054   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
1055   v = SCM_S16VECTOR(v_scm);
1056   i_scm = SCM_ARGREF(1);
1057   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
1058   i = SCM_INT_VALUE(i_scm);
1059   val_scm = SCM_ARGREF(2);
1060   val = (val_scm);
1061   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1062   else {
1063     clamp_scm = SCM_CAR(SCM_OPTARGS);
1064     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1065   }
1066   clamp = (clamp_scm);
1067   {
1068 SCM_RETURN(Scm_S16VectorSet(v, i, val, clamp_arg(clamp)));
1069   }
1070 }
1071 
1072 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_setX__NAME, "s16vector-set!", 14, 14);
1073 static SCM_DEFINE_SUBR(uvlib_s16vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_s16vector_setX__NAME), uvlib_s16vector_setX, NULL, NULL);
1074 
1075 static ScmObj uvlib_s16vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1076 {
1077   ScmObj v_scm;
1078   ScmS16Vector* v;
1079   ScmObj start_scm;
1080   int start;
1081   ScmObj end_scm;
1082   int end;
1083   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1084   SCM_ENTER_SUBR("s16vector-copy");
1085   if (Scm_Length(SCM_OPTARGS) > 2)
1086     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1087   v_scm = SCM_ARGREF(0);
1088   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
1089   v = SCM_S16VECTOR(v_scm);
1090   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1091   else {
1092     start_scm = SCM_CAR(SCM_OPTARGS);
1093     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1094   }
1095   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1096   start = SCM_INT_VALUE(start_scm);
1097   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1098   else {
1099     end_scm = SCM_CAR(SCM_OPTARGS);
1100     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1101   }
1102   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1103   end = SCM_INT_VALUE(end_scm);
1104   {
1105 {
1106 ScmObj SCM_RESULT;
1107 SCM_RESULT = Scm_S16VectorCopy(v, start, end);
1108 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
1109 }
1110   }
1111 }
1112 
1113 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_copy__NAME, "s16vector-copy", 14, 14);
1114 static SCM_DEFINE_SUBR(uvlib_s16vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_s16vector_copy__NAME), uvlib_s16vector_copy, NULL, NULL);
1115 
1116 static ScmObj uvlib_s16vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1117 {
1118   ScmObj dst_scm;
1119   ScmS16Vector* dst;
1120   ScmObj dstart_scm;
1121   ScmObj dstart;
1122   ScmObj src_scm;
1123   ScmObj src;
1124   ScmObj sstart_scm;
1125   int sstart;
1126   ScmObj send_scm;
1127   int send;
1128   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1129   SCM_ENTER_SUBR("s16vector-copy!");
1130   if (Scm_Length(SCM_OPTARGS) > 3)
1131     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1132   dst_scm = SCM_ARGREF(0);
1133   if (!SCM_S16VECTORP(dst_scm)) Scm_Error("<s16vector> required, but got %S", dst_scm);
1134   dst = SCM_S16VECTOR(dst_scm);
1135   dstart_scm = SCM_ARGREF(1);
1136   dstart = (dstart_scm);
1137   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
1138   else {
1139     src_scm = SCM_CAR(SCM_OPTARGS);
1140     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1141   }
1142   src = (src_scm);
1143   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
1144   else {
1145     sstart_scm = SCM_CAR(SCM_OPTARGS);
1146     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1147   }
1148   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
1149   sstart = Scm_GetInteger(sstart_scm);
1150   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
1151   else {
1152     send_scm = SCM_CAR(SCM_OPTARGS);
1153     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1154   }
1155   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
1156   send = Scm_GetInteger(send_scm);
1157   {
1158 if (SCM_INTEGERP(dstart)) {
1159      /* new API */
1160      if (!SCM_S16VECTORP(src)) {
1161        Scm_Error("s16vector-copy!: argument is not a matching uvector: %S",
1162                  src);
1163      }
1164      SCM_RETURN(Scm_S16VectorCopyX(dst, Scm_GetInteger(dstart), 
1165                                     SCM_S16VECTOR(src), sstart, send));
1166   } else if (SCM_S16VECTORP(dstart)) {
1167     /* old API */
1168     SCM_RETURN(Scm_S16VectorCopyX(dst, 0, SCM_S16VECTOR(dstart), 0, -1));
1169   } else {
1170     Scm_Error("integer required, but got %S", dstart);
1171     SCM_RETURN(SCM_UNDEFINED);
1172   }
1173   }
1174 }
1175 
1176 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_copyX__NAME, "s16vector-copy!", 15, 15);
1177 static SCM_DEFINE_SUBR(uvlib_s16vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_s16vector_copyX__NAME), uvlib_s16vector_copyX, NULL, NULL);
1178 
1179 static ScmObj uvlib_s16vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1180 {
1181   ScmObj v_scm;
1182   ScmS16Vector* v;
1183   ScmObj start_scm;
1184   int start;
1185   ScmObj end_scm;
1186   int end;
1187   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1188   SCM_ENTER_SUBR("s16vector->list");
1189   if (Scm_Length(SCM_OPTARGS) > 2)
1190     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1191   v_scm = SCM_ARGREF(0);
1192   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
1193   v = SCM_S16VECTOR(v_scm);
1194   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1195   else {
1196     start_scm = SCM_CAR(SCM_OPTARGS);
1197     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1198   }
1199   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1200   start = SCM_INT_VALUE(start_scm);
1201   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1202   else {
1203     end_scm = SCM_CAR(SCM_OPTARGS);
1204     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1205   }
1206   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1207   end = SCM_INT_VALUE(end_scm);
1208   {
1209 {
1210 ScmObj SCM_RESULT;
1211 SCM_RESULT = Scm_S16VectorToList(v, start, end);
1212 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
1213 }
1214   }
1215 }
1216 
1217 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_TOlist__NAME, "s16vector->list", 15, 15);
1218 static SCM_DEFINE_SUBR(uvlib_s16vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_s16vector_TOlist__NAME), uvlib_s16vector_TOlist, NULL, NULL);
1219 
1220 static ScmObj uvlib_list_TOs16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1221 {
1222   ScmObj l_scm;
1223   ScmObj l;
1224   ScmObj clamp_scm;
1225   ScmObj clamp;
1226   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1227   SCM_ENTER_SUBR("list->s16vector");
1228   if (Scm_Length(SCM_OPTARGS) > 1)
1229     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1230   l_scm = SCM_ARGREF(0);
1231   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
1232   l = (l_scm);
1233   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1234   else {
1235     clamp_scm = SCM_CAR(SCM_OPTARGS);
1236     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1237   }
1238   clamp = (clamp_scm);
1239   {
1240 SCM_RETURN(Scm_ListToS16Vector(l, clamp_arg(clamp)));
1241   }
1242 }
1243 
1244 static SCM_DEFINE_STRING_CONST(uvlib_list_TOs16vector__NAME, "list->s16vector", 15, 15);
1245 static SCM_DEFINE_SUBR(uvlib_list_TOs16vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOs16vector__NAME), uvlib_list_TOs16vector, NULL, NULL);
1246 
1247 static ScmObj uvlib_s16vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1248 {
1249   ScmObj v_scm;
1250   ScmS16Vector* v;
1251   ScmObj val_scm;
1252   ScmObj val;
1253   ScmObj start_scm;
1254   int start;
1255   ScmObj end_scm;
1256   int end;
1257   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1258   SCM_ENTER_SUBR("s16vector-fill!");
1259   if (Scm_Length(SCM_OPTARGS) > 2)
1260     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1261   v_scm = SCM_ARGREF(0);
1262   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
1263   v = SCM_S16VECTOR(v_scm);
1264   val_scm = SCM_ARGREF(1);
1265   val = (val_scm);
1266   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1267   else {
1268     start_scm = SCM_CAR(SCM_OPTARGS);
1269     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1270   }
1271   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1272   start = SCM_INT_VALUE(start_scm);
1273   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1274   else {
1275     end_scm = SCM_CAR(SCM_OPTARGS);
1276     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1277   }
1278   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1279   end = SCM_INT_VALUE(end_scm);
1280   {
1281 short filler;
1282   filler = s16unbox(val, SCM_CLAMP_ERROR);
1283   SCM_RETURN(Scm_S16VectorFill(v, filler, start, end));
1284   }
1285 }
1286 
1287 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_fillX__NAME, "s16vector-fill!", 15, 15);
1288 static SCM_DEFINE_SUBR(uvlib_s16vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_s16vector_fillX__NAME), uvlib_s16vector_fillX, NULL, NULL);
1289 
1290 static ScmObj uvlib_s16vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1291 {
1292   ScmObj v_scm;
1293   ScmS16Vector* v;
1294   ScmObj start_scm;
1295   int start;
1296   ScmObj end_scm;
1297   int end;
1298   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1299   SCM_ENTER_SUBR("s16vector->vector");
1300   if (Scm_Length(SCM_OPTARGS) > 2)
1301     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1302   v_scm = SCM_ARGREF(0);
1303   if (!SCM_S16VECTORP(v_scm)) Scm_Error("<s16vector> required, but got %S", v_scm);
1304   v = SCM_S16VECTOR(v_scm);
1305   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1306   else {
1307     start_scm = SCM_CAR(SCM_OPTARGS);
1308     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1309   }
1310   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1311   start = SCM_INT_VALUE(start_scm);
1312   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1313   else {
1314     end_scm = SCM_CAR(SCM_OPTARGS);
1315     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1316   }
1317   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1318   end = SCM_INT_VALUE(end_scm);
1319   {
1320 {
1321 ScmObj SCM_RESULT;
1322 SCM_RESULT = Scm_S16VectorToVector(v, start, end);
1323 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
1324 }
1325   }
1326 }
1327 
1328 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_TOvector__NAME, "s16vector->vector", 17, 17);
1329 static SCM_DEFINE_SUBR(uvlib_s16vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_s16vector_TOvector__NAME), uvlib_s16vector_TOvector, NULL, NULL);
1330 
1331 static ScmObj uvlib_vector_TOs16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1332 {
1333   ScmObj v_scm;
1334   ScmVector* v;
1335   ScmObj start_scm;
1336   int start;
1337   ScmObj end_scm;
1338   int end;
1339   ScmObj clamp_scm;
1340   ScmObj clamp;
1341   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1342   SCM_ENTER_SUBR("vector->s16vector");
1343   if (Scm_Length(SCM_OPTARGS) > 3)
1344     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1345   v_scm = SCM_ARGREF(0);
1346   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
1347   v = SCM_VECTOR(v_scm);
1348   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1349   else {
1350     start_scm = SCM_CAR(SCM_OPTARGS);
1351     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1352   }
1353   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1354   start = SCM_INT_VALUE(start_scm);
1355   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1356   else {
1357     end_scm = SCM_CAR(SCM_OPTARGS);
1358     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1359   }
1360   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1361   end = SCM_INT_VALUE(end_scm);
1362   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1363   else {
1364     clamp_scm = SCM_CAR(SCM_OPTARGS);
1365     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1366   }
1367   clamp = (clamp_scm);
1368   {
1369 SCM_RETURN(Scm_VectorToS16Vector(v, start, end, clamp_arg(clamp)));
1370   }
1371 }
1372 
1373 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOs16vector__NAME, "vector->s16vector", 17, 17);
1374 static SCM_DEFINE_SUBR(uvlib_vector_TOs16vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOs16vector__NAME), uvlib_vector_TOs16vector, NULL, NULL);
1375 
1376 static ScmObj uvlib_u16vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1377 {
1378   ScmObj obj_scm;
1379   ScmObj obj;
1380   SCM_ENTER_SUBR("u16vector?");
1381   obj_scm = SCM_ARGREF(0);
1382   obj = (obj_scm);
1383   {
1384 {
1385 int SCM_RESULT;
1386 SCM_RESULT = SCM_U16VECTORP(obj);
1387 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
1388 }
1389   }
1390 }
1391 
1392 static SCM_DEFINE_STRING_CONST(uvlib_u16vectorP__NAME, "u16vector?", 10, 10);
1393 static SCM_DEFINE_SUBR(uvlib_u16vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_u16vectorP__NAME), uvlib_u16vectorP, NULL, NULL);
1394 
1395 static ScmObj uvlib_make_u16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1396 {
1397   ScmObj length_scm;
1398   int length;
1399   ScmObj fill_scm;
1400   ScmObj fill;
1401   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1402   SCM_ENTER_SUBR("make-u16vector");
1403   if (Scm_Length(SCM_OPTARGS) > 1)
1404     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1405   length_scm = SCM_ARGREF(0);
1406   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
1407   length = SCM_INT_VALUE(length_scm);
1408   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
1409   else {
1410     fill_scm = SCM_CAR(SCM_OPTARGS);
1411     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1412   }
1413   fill = (fill_scm);
1414   {
1415 unsigned short filler;
1416   filler = u16unbox(fill, SCM_CLAMP_ERROR);
1417   SCM_RETURN(Scm_MakeU16Vector(length, filler));
1418   }
1419 }
1420 
1421 static SCM_DEFINE_STRING_CONST(uvlib_make_u16vector__NAME, "make-u16vector", 14, 14);
1422 static SCM_DEFINE_SUBR(uvlib_make_u16vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_u16vector__NAME), uvlib_make_u16vector, NULL, NULL);
1423 
1424 static ScmObj uvlib_u16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1425 {
1426   ScmObj args_scm;
1427   ScmObj args;
1428   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1429   SCM_ENTER_SUBR("u16vector");
1430   args_scm = SCM_OPTARGS;
1431   args = (args_scm);
1432   {
1433 SCM_RETURN(Scm_ListToU16Vector(args, SCM_CLAMP_ERROR));
1434   }
1435 }
1436 
1437 static SCM_DEFINE_STRING_CONST(uvlib_u16vector__NAME, "u16vector", 9, 9);
1438 static SCM_DEFINE_SUBR(uvlib_u16vector__STUB, 0, 1, SCM_OBJ(&uvlib_u16vector__NAME), uvlib_u16vector, NULL, NULL);
1439 
1440 static ScmObj uvlib_u16vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1441 {
1442   ScmObj v_scm;
1443   ScmU16Vector* v;
1444   SCM_ENTER_SUBR("u16vector-length");
1445   v_scm = SCM_ARGREF(0);
1446   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1447   v = SCM_U16VECTOR(v_scm);
1448   {
1449 SCM_RETURN(SCM_MAKE_INT(SCM_U16VECTOR_SIZE(v)));
1450   }
1451 }
1452 
1453 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_length__NAME, "u16vector-length", 16, 16);
1454 static SCM_DEFINE_SUBR(uvlib_u16vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_u16vector_length__NAME), uvlib_u16vector_length, NULL, NULL);
1455 
1456 static ScmObj uvlib_u16vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1457 {
1458   ScmObj v_scm;
1459   ScmU16Vector* v;
1460   ScmObj i_scm;
1461   int i;
1462   ScmObj fallback_scm;
1463   ScmObj fallback;
1464   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1465   SCM_ENTER_SUBR("u16vector-ref");
1466   if (Scm_Length(SCM_OPTARGS) > 1)
1467     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1468   v_scm = SCM_ARGREF(0);
1469   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1470   v = SCM_U16VECTOR(v_scm);
1471   i_scm = SCM_ARGREF(1);
1472   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
1473   i = SCM_INT_VALUE(i_scm);
1474   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
1475   else {
1476     fallback_scm = SCM_CAR(SCM_OPTARGS);
1477     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1478   }
1479   fallback = (fallback_scm);
1480   {
1481 SCM_RETURN(Scm_U16VectorRef(v, i, fallback));
1482   }
1483 }
1484 
1485 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_ref__NAME, "u16vector-ref", 13, 13);
1486 static SCM_DEFINE_SUBR(uvlib_u16vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_u16vector_ref__NAME), uvlib_u16vector_ref, NULL, NULL);
1487 
1488 static ScmObj uvlib_u16vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1489 {
1490   ScmObj v_scm;
1491   ScmU16Vector* v;
1492   ScmObj i_scm;
1493   int i;
1494   ScmObj val_scm;
1495   ScmObj val;
1496   ScmObj clamp_scm;
1497   ScmObj clamp;
1498   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1499   SCM_ENTER_SUBR("u16vector-set!");
1500   if (Scm_Length(SCM_OPTARGS) > 1)
1501     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1502   v_scm = SCM_ARGREF(0);
1503   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1504   v = SCM_U16VECTOR(v_scm);
1505   i_scm = SCM_ARGREF(1);
1506   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
1507   i = SCM_INT_VALUE(i_scm);
1508   val_scm = SCM_ARGREF(2);
1509   val = (val_scm);
1510   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1511   else {
1512     clamp_scm = SCM_CAR(SCM_OPTARGS);
1513     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1514   }
1515   clamp = (clamp_scm);
1516   {
1517 SCM_RETURN(Scm_U16VectorSet(v, i, val, clamp_arg(clamp)));
1518   }
1519 }
1520 
1521 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_setX__NAME, "u16vector-set!", 14, 14);
1522 static SCM_DEFINE_SUBR(uvlib_u16vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_u16vector_setX__NAME), uvlib_u16vector_setX, NULL, NULL);
1523 
1524 static ScmObj uvlib_u16vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1525 {
1526   ScmObj v_scm;
1527   ScmU16Vector* v;
1528   ScmObj start_scm;
1529   int start;
1530   ScmObj end_scm;
1531   int end;
1532   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1533   SCM_ENTER_SUBR("u16vector-copy");
1534   if (Scm_Length(SCM_OPTARGS) > 2)
1535     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1536   v_scm = SCM_ARGREF(0);
1537   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1538   v = SCM_U16VECTOR(v_scm);
1539   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1540   else {
1541     start_scm = SCM_CAR(SCM_OPTARGS);
1542     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1543   }
1544   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1545   start = SCM_INT_VALUE(start_scm);
1546   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1547   else {
1548     end_scm = SCM_CAR(SCM_OPTARGS);
1549     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1550   }
1551   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1552   end = SCM_INT_VALUE(end_scm);
1553   {
1554 {
1555 ScmObj SCM_RESULT;
1556 SCM_RESULT = Scm_U16VectorCopy(v, start, end);
1557 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
1558 }
1559   }
1560 }
1561 
1562 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_copy__NAME, "u16vector-copy", 14, 14);
1563 static SCM_DEFINE_SUBR(uvlib_u16vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_u16vector_copy__NAME), uvlib_u16vector_copy, NULL, NULL);
1564 
1565 static ScmObj uvlib_u16vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1566 {
1567   ScmObj dst_scm;
1568   ScmU16Vector* dst;
1569   ScmObj dstart_scm;
1570   ScmObj dstart;
1571   ScmObj src_scm;
1572   ScmObj src;
1573   ScmObj sstart_scm;
1574   int sstart;
1575   ScmObj send_scm;
1576   int send;
1577   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1578   SCM_ENTER_SUBR("u16vector-copy!");
1579   if (Scm_Length(SCM_OPTARGS) > 3)
1580     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1581   dst_scm = SCM_ARGREF(0);
1582   if (!SCM_U16VECTORP(dst_scm)) Scm_Error("<u16vector> required, but got %S", dst_scm);
1583   dst = SCM_U16VECTOR(dst_scm);
1584   dstart_scm = SCM_ARGREF(1);
1585   dstart = (dstart_scm);
1586   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
1587   else {
1588     src_scm = SCM_CAR(SCM_OPTARGS);
1589     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1590   }
1591   src = (src_scm);
1592   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
1593   else {
1594     sstart_scm = SCM_CAR(SCM_OPTARGS);
1595     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1596   }
1597   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
1598   sstart = Scm_GetInteger(sstart_scm);
1599   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
1600   else {
1601     send_scm = SCM_CAR(SCM_OPTARGS);
1602     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1603   }
1604   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
1605   send = Scm_GetInteger(send_scm);
1606   {
1607 if (SCM_INTEGERP(dstart)) {
1608      /* new API */
1609      if (!SCM_U16VECTORP(src)) {
1610        Scm_Error("u16vector-copy!: argument is not a matching uvector: %S",
1611                  src);
1612      }
1613      SCM_RETURN(Scm_U16VectorCopyX(dst, Scm_GetInteger(dstart), 
1614                                     SCM_U16VECTOR(src), sstart, send));
1615   } else if (SCM_U16VECTORP(dstart)) {
1616     /* old API */
1617     SCM_RETURN(Scm_U16VectorCopyX(dst, 0, SCM_U16VECTOR(dstart), 0, -1));
1618   } else {
1619     Scm_Error("integer required, but got %S", dstart);
1620     SCM_RETURN(SCM_UNDEFINED);
1621   }
1622   }
1623 }
1624 
1625 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_copyX__NAME, "u16vector-copy!", 15, 15);
1626 static SCM_DEFINE_SUBR(uvlib_u16vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_u16vector_copyX__NAME), uvlib_u16vector_copyX, NULL, NULL);
1627 
1628 static ScmObj uvlib_u16vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1629 {
1630   ScmObj v_scm;
1631   ScmU16Vector* v;
1632   ScmObj start_scm;
1633   int start;
1634   ScmObj end_scm;
1635   int end;
1636   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1637   SCM_ENTER_SUBR("u16vector->list");
1638   if (Scm_Length(SCM_OPTARGS) > 2)
1639     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1640   v_scm = SCM_ARGREF(0);
1641   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1642   v = SCM_U16VECTOR(v_scm);
1643   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1644   else {
1645     start_scm = SCM_CAR(SCM_OPTARGS);
1646     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1647   }
1648   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1649   start = SCM_INT_VALUE(start_scm);
1650   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1651   else {
1652     end_scm = SCM_CAR(SCM_OPTARGS);
1653     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1654   }
1655   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1656   end = SCM_INT_VALUE(end_scm);
1657   {
1658 {
1659 ScmObj SCM_RESULT;
1660 SCM_RESULT = Scm_U16VectorToList(v, start, end);
1661 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
1662 }
1663   }
1664 }
1665 
1666 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_TOlist__NAME, "u16vector->list", 15, 15);
1667 static SCM_DEFINE_SUBR(uvlib_u16vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_u16vector_TOlist__NAME), uvlib_u16vector_TOlist, NULL, NULL);
1668 
1669 static ScmObj uvlib_list_TOu16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1670 {
1671   ScmObj l_scm;
1672   ScmObj l;
1673   ScmObj clamp_scm;
1674   ScmObj clamp;
1675   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1676   SCM_ENTER_SUBR("list->u16vector");
1677   if (Scm_Length(SCM_OPTARGS) > 1)
1678     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1679   l_scm = SCM_ARGREF(0);
1680   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
1681   l = (l_scm);
1682   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1683   else {
1684     clamp_scm = SCM_CAR(SCM_OPTARGS);
1685     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1686   }
1687   clamp = (clamp_scm);
1688   {
1689 SCM_RETURN(Scm_ListToU16Vector(l, clamp_arg(clamp)));
1690   }
1691 }
1692 
1693 static SCM_DEFINE_STRING_CONST(uvlib_list_TOu16vector__NAME, "list->u16vector", 15, 15);
1694 static SCM_DEFINE_SUBR(uvlib_list_TOu16vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOu16vector__NAME), uvlib_list_TOu16vector, NULL, NULL);
1695 
1696 static ScmObj uvlib_u16vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1697 {
1698   ScmObj v_scm;
1699   ScmU16Vector* v;
1700   ScmObj val_scm;
1701   ScmObj val;
1702   ScmObj start_scm;
1703   int start;
1704   ScmObj end_scm;
1705   int end;
1706   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1707   SCM_ENTER_SUBR("u16vector-fill!");
1708   if (Scm_Length(SCM_OPTARGS) > 2)
1709     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1710   v_scm = SCM_ARGREF(0);
1711   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1712   v = SCM_U16VECTOR(v_scm);
1713   val_scm = SCM_ARGREF(1);
1714   val = (val_scm);
1715   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1716   else {
1717     start_scm = SCM_CAR(SCM_OPTARGS);
1718     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1719   }
1720   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1721   start = SCM_INT_VALUE(start_scm);
1722   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1723   else {
1724     end_scm = SCM_CAR(SCM_OPTARGS);
1725     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1726   }
1727   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1728   end = SCM_INT_VALUE(end_scm);
1729   {
1730 unsigned short filler;
1731   filler = u16unbox(val, SCM_CLAMP_ERROR);
1732   SCM_RETURN(Scm_U16VectorFill(v, filler, start, end));
1733   }
1734 }
1735 
1736 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_fillX__NAME, "u16vector-fill!", 15, 15);
1737 static SCM_DEFINE_SUBR(uvlib_u16vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_u16vector_fillX__NAME), uvlib_u16vector_fillX, NULL, NULL);
1738 
1739 static ScmObj uvlib_u16vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1740 {
1741   ScmObj v_scm;
1742   ScmU16Vector* v;
1743   ScmObj start_scm;
1744   int start;
1745   ScmObj end_scm;
1746   int end;
1747   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1748   SCM_ENTER_SUBR("u16vector->vector");
1749   if (Scm_Length(SCM_OPTARGS) > 2)
1750     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1751   v_scm = SCM_ARGREF(0);
1752   if (!SCM_U16VECTORP(v_scm)) Scm_Error("<u16vector> required, but got %S", v_scm);
1753   v = SCM_U16VECTOR(v_scm);
1754   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1755   else {
1756     start_scm = SCM_CAR(SCM_OPTARGS);
1757     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1758   }
1759   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1760   start = SCM_INT_VALUE(start_scm);
1761   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1762   else {
1763     end_scm = SCM_CAR(SCM_OPTARGS);
1764     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1765   }
1766   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1767   end = SCM_INT_VALUE(end_scm);
1768   {
1769 {
1770 ScmObj SCM_RESULT;
1771 SCM_RESULT = Scm_U16VectorToVector(v, start, end);
1772 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
1773 }
1774   }
1775 }
1776 
1777 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_TOvector__NAME, "u16vector->vector", 17, 17);
1778 static SCM_DEFINE_SUBR(uvlib_u16vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_u16vector_TOvector__NAME), uvlib_u16vector_TOvector, NULL, NULL);
1779 
1780 static ScmObj uvlib_vector_TOu16vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1781 {
1782   ScmObj v_scm;
1783   ScmVector* v;
1784   ScmObj start_scm;
1785   int start;
1786   ScmObj end_scm;
1787   int end;
1788   ScmObj clamp_scm;
1789   ScmObj clamp;
1790   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1791   SCM_ENTER_SUBR("vector->u16vector");
1792   if (Scm_Length(SCM_OPTARGS) > 3)
1793     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1794   v_scm = SCM_ARGREF(0);
1795   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
1796   v = SCM_VECTOR(v_scm);
1797   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1798   else {
1799     start_scm = SCM_CAR(SCM_OPTARGS);
1800     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1801   }
1802   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1803   start = SCM_INT_VALUE(start_scm);
1804   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1805   else {
1806     end_scm = SCM_CAR(SCM_OPTARGS);
1807     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1808   }
1809   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
1810   end = SCM_INT_VALUE(end_scm);
1811   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1812   else {
1813     clamp_scm = SCM_CAR(SCM_OPTARGS);
1814     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1815   }
1816   clamp = (clamp_scm);
1817   {
1818 SCM_RETURN(Scm_VectorToU16Vector(v, start, end, clamp_arg(clamp)));
1819   }
1820 }
1821 
1822 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOu16vector__NAME, "vector->u16vector", 17, 17);
1823 static SCM_DEFINE_SUBR(uvlib_vector_TOu16vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOu16vector__NAME), uvlib_vector_TOu16vector, NULL, NULL);
1824 
1825 static ScmObj uvlib_s32vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1826 {
1827   ScmObj obj_scm;
1828   ScmObj obj;
1829   SCM_ENTER_SUBR("s32vector?");
1830   obj_scm = SCM_ARGREF(0);
1831   obj = (obj_scm);
1832   {
1833 {
1834 int SCM_RESULT;
1835 SCM_RESULT = SCM_S32VECTORP(obj);
1836 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
1837 }
1838   }
1839 }
1840 
1841 static SCM_DEFINE_STRING_CONST(uvlib_s32vectorP__NAME, "s32vector?", 10, 10);
1842 static SCM_DEFINE_SUBR(uvlib_s32vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_s32vectorP__NAME), uvlib_s32vectorP, NULL, NULL);
1843 
1844 static ScmObj uvlib_make_s32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1845 {
1846   ScmObj length_scm;
1847   int length;
1848   ScmObj fill_scm;
1849   ScmObj fill;
1850   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1851   SCM_ENTER_SUBR("make-s32vector");
1852   if (Scm_Length(SCM_OPTARGS) > 1)
1853     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1854   length_scm = SCM_ARGREF(0);
1855   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
1856   length = SCM_INT_VALUE(length_scm);
1857   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
1858   else {
1859     fill_scm = SCM_CAR(SCM_OPTARGS);
1860     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1861   }
1862   fill = (fill_scm);
1863   {
1864 ScmInt32 filler;
1865   filler = Scm_GetInteger32Clamp(fill, SCM_CLAMP_ERROR, NULL);
1866   SCM_RETURN(Scm_MakeS32Vector(length, filler));
1867   }
1868 }
1869 
1870 static SCM_DEFINE_STRING_CONST(uvlib_make_s32vector__NAME, "make-s32vector", 14, 14);
1871 static SCM_DEFINE_SUBR(uvlib_make_s32vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_s32vector__NAME), uvlib_make_s32vector, NULL, NULL);
1872 
1873 static ScmObj uvlib_s32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1874 {
1875   ScmObj args_scm;
1876   ScmObj args;
1877   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1878   SCM_ENTER_SUBR("s32vector");
1879   args_scm = SCM_OPTARGS;
1880   args = (args_scm);
1881   {
1882 SCM_RETURN(Scm_ListToS32Vector(args, SCM_CLAMP_ERROR));
1883   }
1884 }
1885 
1886 static SCM_DEFINE_STRING_CONST(uvlib_s32vector__NAME, "s32vector", 9, 9);
1887 static SCM_DEFINE_SUBR(uvlib_s32vector__STUB, 0, 1, SCM_OBJ(&uvlib_s32vector__NAME), uvlib_s32vector, NULL, NULL);
1888 
1889 static ScmObj uvlib_s32vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1890 {
1891   ScmObj v_scm;
1892   ScmS32Vector* v;
1893   SCM_ENTER_SUBR("s32vector-length");
1894   v_scm = SCM_ARGREF(0);
1895   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
1896   v = SCM_S32VECTOR(v_scm);
1897   {
1898 SCM_RETURN(SCM_MAKE_INT(SCM_S32VECTOR_SIZE(v)));
1899   }
1900 }
1901 
1902 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_length__NAME, "s32vector-length", 16, 16);
1903 static SCM_DEFINE_SUBR(uvlib_s32vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_s32vector_length__NAME), uvlib_s32vector_length, NULL, NULL);
1904 
1905 static ScmObj uvlib_s32vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1906 {
1907   ScmObj v_scm;
1908   ScmS32Vector* v;
1909   ScmObj i_scm;
1910   int i;
1911   ScmObj fallback_scm;
1912   ScmObj fallback;
1913   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1914   SCM_ENTER_SUBR("s32vector-ref");
1915   if (Scm_Length(SCM_OPTARGS) > 1)
1916     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1917   v_scm = SCM_ARGREF(0);
1918   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
1919   v = SCM_S32VECTOR(v_scm);
1920   i_scm = SCM_ARGREF(1);
1921   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
1922   i = SCM_INT_VALUE(i_scm);
1923   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
1924   else {
1925     fallback_scm = SCM_CAR(SCM_OPTARGS);
1926     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1927   }
1928   fallback = (fallback_scm);
1929   {
1930 SCM_RETURN(Scm_S32VectorRef(v, i, fallback));
1931   }
1932 }
1933 
1934 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_ref__NAME, "s32vector-ref", 13, 13);
1935 static SCM_DEFINE_SUBR(uvlib_s32vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_s32vector_ref__NAME), uvlib_s32vector_ref, NULL, NULL);
1936 
1937 static ScmObj uvlib_s32vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1938 {
1939   ScmObj v_scm;
1940   ScmS32Vector* v;
1941   ScmObj i_scm;
1942   int i;
1943   ScmObj val_scm;
1944   ScmObj val;
1945   ScmObj clamp_scm;
1946   ScmObj clamp;
1947   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1948   SCM_ENTER_SUBR("s32vector-set!");
1949   if (Scm_Length(SCM_OPTARGS) > 1)
1950     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1951   v_scm = SCM_ARGREF(0);
1952   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
1953   v = SCM_S32VECTOR(v_scm);
1954   i_scm = SCM_ARGREF(1);
1955   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
1956   i = SCM_INT_VALUE(i_scm);
1957   val_scm = SCM_ARGREF(2);
1958   val = (val_scm);
1959   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
1960   else {
1961     clamp_scm = SCM_CAR(SCM_OPTARGS);
1962     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1963   }
1964   clamp = (clamp_scm);
1965   {
1966 SCM_RETURN(Scm_S32VectorSet(v, i, val, clamp_arg(clamp)));
1967   }
1968 }
1969 
1970 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_setX__NAME, "s32vector-set!", 14, 14);
1971 static SCM_DEFINE_SUBR(uvlib_s32vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_s32vector_setX__NAME), uvlib_s32vector_setX, NULL, NULL);
1972 
1973 static ScmObj uvlib_s32vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
1974 {
1975   ScmObj v_scm;
1976   ScmS32Vector* v;
1977   ScmObj start_scm;
1978   int start;
1979   ScmObj end_scm;
1980   int end;
1981   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
1982   SCM_ENTER_SUBR("s32vector-copy");
1983   if (Scm_Length(SCM_OPTARGS) > 2)
1984     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
1985   v_scm = SCM_ARGREF(0);
1986   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
1987   v = SCM_S32VECTOR(v_scm);
1988   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
1989   else {
1990     start_scm = SCM_CAR(SCM_OPTARGS);
1991     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1992   }
1993   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
1994   start = SCM_INT_VALUE(start_scm);
1995   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
1996   else {
1997     end_scm = SCM_CAR(SCM_OPTARGS);
1998     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
1999   }
2000   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2001   end = SCM_INT_VALUE(end_scm);
2002   {
2003 {
2004 ScmObj SCM_RESULT;
2005 SCM_RESULT = Scm_S32VectorCopy(v, start, end);
2006 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2007 }
2008   }
2009 }
2010 
2011 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_copy__NAME, "s32vector-copy", 14, 14);
2012 static SCM_DEFINE_SUBR(uvlib_s32vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_s32vector_copy__NAME), uvlib_s32vector_copy, NULL, NULL);
2013 
2014 static ScmObj uvlib_s32vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2015 {
2016   ScmObj dst_scm;
2017   ScmS32Vector* dst;
2018   ScmObj dstart_scm;
2019   ScmObj dstart;
2020   ScmObj src_scm;
2021   ScmObj src;
2022   ScmObj sstart_scm;
2023   int sstart;
2024   ScmObj send_scm;
2025   int send;
2026   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2027   SCM_ENTER_SUBR("s32vector-copy!");
2028   if (Scm_Length(SCM_OPTARGS) > 3)
2029     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2030   dst_scm = SCM_ARGREF(0);
2031   if (!SCM_S32VECTORP(dst_scm)) Scm_Error("<s32vector> required, but got %S", dst_scm);
2032   dst = SCM_S32VECTOR(dst_scm);
2033   dstart_scm = SCM_ARGREF(1);
2034   dstart = (dstart_scm);
2035   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
2036   else {
2037     src_scm = SCM_CAR(SCM_OPTARGS);
2038     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2039   }
2040   src = (src_scm);
2041   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
2042   else {
2043     sstart_scm = SCM_CAR(SCM_OPTARGS);
2044     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2045   }
2046   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
2047   sstart = Scm_GetInteger(sstart_scm);
2048   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
2049   else {
2050     send_scm = SCM_CAR(SCM_OPTARGS);
2051     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2052   }
2053   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
2054   send = Scm_GetInteger(send_scm);
2055   {
2056 if (SCM_INTEGERP(dstart)) {
2057      /* new API */
2058      if (!SCM_S32VECTORP(src)) {
2059        Scm_Error("s32vector-copy!: argument is not a matching uvector: %S",
2060                  src);
2061      }
2062      SCM_RETURN(Scm_S32VectorCopyX(dst, Scm_GetInteger(dstart), 
2063                                     SCM_S32VECTOR(src), sstart, send));
2064   } else if (SCM_S32VECTORP(dstart)) {
2065     /* old API */
2066     SCM_RETURN(Scm_S32VectorCopyX(dst, 0, SCM_S32VECTOR(dstart), 0, -1));
2067   } else {
2068     Scm_Error("integer required, but got %S", dstart);
2069     SCM_RETURN(SCM_UNDEFINED);
2070   }
2071   }
2072 }
2073 
2074 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_copyX__NAME, "s32vector-copy!", 15, 15);
2075 static SCM_DEFINE_SUBR(uvlib_s32vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_s32vector_copyX__NAME), uvlib_s32vector_copyX, NULL, NULL);
2076 
2077 static ScmObj uvlib_s32vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2078 {
2079   ScmObj v_scm;
2080   ScmS32Vector* v;
2081   ScmObj start_scm;
2082   int start;
2083   ScmObj end_scm;
2084   int end;
2085   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2086   SCM_ENTER_SUBR("s32vector->list");
2087   if (Scm_Length(SCM_OPTARGS) > 2)
2088     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2089   v_scm = SCM_ARGREF(0);
2090   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
2091   v = SCM_S32VECTOR(v_scm);
2092   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2093   else {
2094     start_scm = SCM_CAR(SCM_OPTARGS);
2095     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2096   }
2097   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2098   start = SCM_INT_VALUE(start_scm);
2099   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2100   else {
2101     end_scm = SCM_CAR(SCM_OPTARGS);
2102     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2103   }
2104   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2105   end = SCM_INT_VALUE(end_scm);
2106   {
2107 {
2108 ScmObj SCM_RESULT;
2109 SCM_RESULT = Scm_S32VectorToList(v, start, end);
2110 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2111 }
2112   }
2113 }
2114 
2115 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_TOlist__NAME, "s32vector->list", 15, 15);
2116 static SCM_DEFINE_SUBR(uvlib_s32vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_s32vector_TOlist__NAME), uvlib_s32vector_TOlist, NULL, NULL);
2117 
2118 static ScmObj uvlib_list_TOs32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2119 {
2120   ScmObj l_scm;
2121   ScmObj l;
2122   ScmObj clamp_scm;
2123   ScmObj clamp;
2124   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2125   SCM_ENTER_SUBR("list->s32vector");
2126   if (Scm_Length(SCM_OPTARGS) > 1)
2127     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2128   l_scm = SCM_ARGREF(0);
2129   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
2130   l = (l_scm);
2131   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
2132   else {
2133     clamp_scm = SCM_CAR(SCM_OPTARGS);
2134     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2135   }
2136   clamp = (clamp_scm);
2137   {
2138 SCM_RETURN(Scm_ListToS32Vector(l, clamp_arg(clamp)));
2139   }
2140 }
2141 
2142 static SCM_DEFINE_STRING_CONST(uvlib_list_TOs32vector__NAME, "list->s32vector", 15, 15);
2143 static SCM_DEFINE_SUBR(uvlib_list_TOs32vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOs32vector__NAME), uvlib_list_TOs32vector, NULL, NULL);
2144 
2145 static ScmObj uvlib_s32vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2146 {
2147   ScmObj v_scm;
2148   ScmS32Vector* v;
2149   ScmObj val_scm;
2150   ScmObj val;
2151   ScmObj start_scm;
2152   int start;
2153   ScmObj end_scm;
2154   int end;
2155   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2156   SCM_ENTER_SUBR("s32vector-fill!");
2157   if (Scm_Length(SCM_OPTARGS) > 2)
2158     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2159   v_scm = SCM_ARGREF(0);
2160   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
2161   v = SCM_S32VECTOR(v_scm);
2162   val_scm = SCM_ARGREF(1);
2163   val = (val_scm);
2164   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2165   else {
2166     start_scm = SCM_CAR(SCM_OPTARGS);
2167     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2168   }
2169   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2170   start = SCM_INT_VALUE(start_scm);
2171   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2172   else {
2173     end_scm = SCM_CAR(SCM_OPTARGS);
2174     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2175   }
2176   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2177   end = SCM_INT_VALUE(end_scm);
2178   {
2179 ScmInt32 filler;
2180   filler = Scm_GetInteger32Clamp(val, SCM_CLAMP_ERROR, NULL);
2181   SCM_RETURN(Scm_S32VectorFill(v, filler, start, end));
2182   }
2183 }
2184 
2185 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_fillX__NAME, "s32vector-fill!", 15, 15);
2186 static SCM_DEFINE_SUBR(uvlib_s32vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_s32vector_fillX__NAME), uvlib_s32vector_fillX, NULL, NULL);
2187 
2188 static ScmObj uvlib_s32vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2189 {
2190   ScmObj v_scm;
2191   ScmS32Vector* v;
2192   ScmObj start_scm;
2193   int start;
2194   ScmObj end_scm;
2195   int end;
2196   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2197   SCM_ENTER_SUBR("s32vector->vector");
2198   if (Scm_Length(SCM_OPTARGS) > 2)
2199     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2200   v_scm = SCM_ARGREF(0);
2201   if (!SCM_S32VECTORP(v_scm)) Scm_Error("<s32vector> required, but got %S", v_scm);
2202   v = SCM_S32VECTOR(v_scm);
2203   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2204   else {
2205     start_scm = SCM_CAR(SCM_OPTARGS);
2206     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2207   }
2208   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2209   start = SCM_INT_VALUE(start_scm);
2210   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2211   else {
2212     end_scm = SCM_CAR(SCM_OPTARGS);
2213     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2214   }
2215   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2216   end = SCM_INT_VALUE(end_scm);
2217   {
2218 {
2219 ScmObj SCM_RESULT;
2220 SCM_RESULT = Scm_S32VectorToVector(v, start, end);
2221 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2222 }
2223   }
2224 }
2225 
2226 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_TOvector__NAME, "s32vector->vector", 17, 17);
2227 static SCM_DEFINE_SUBR(uvlib_s32vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_s32vector_TOvector__NAME), uvlib_s32vector_TOvector, NULL, NULL);
2228 
2229 static ScmObj uvlib_vector_TOs32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2230 {
2231   ScmObj v_scm;
2232   ScmVector* v;
2233   ScmObj start_scm;
2234   int start;
2235   ScmObj end_scm;
2236   int end;
2237   ScmObj clamp_scm;
2238   ScmObj clamp;
2239   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2240   SCM_ENTER_SUBR("vector->s32vector");
2241   if (Scm_Length(SCM_OPTARGS) > 3)
2242     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2243   v_scm = SCM_ARGREF(0);
2244   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
2245   v = SCM_VECTOR(v_scm);
2246   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2247   else {
2248     start_scm = SCM_CAR(SCM_OPTARGS);
2249     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2250   }
2251   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2252   start = SCM_INT_VALUE(start_scm);
2253   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2254   else {
2255     end_scm = SCM_CAR(SCM_OPTARGS);
2256     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2257   }
2258   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2259   end = SCM_INT_VALUE(end_scm);
2260   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
2261   else {
2262     clamp_scm = SCM_CAR(SCM_OPTARGS);
2263     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2264   }
2265   clamp = (clamp_scm);
2266   {
2267 SCM_RETURN(Scm_VectorToS32Vector(v, start, end, clamp_arg(clamp)));
2268   }
2269 }
2270 
2271 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOs32vector__NAME, "vector->s32vector", 17, 17);
2272 static SCM_DEFINE_SUBR(uvlib_vector_TOs32vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOs32vector__NAME), uvlib_vector_TOs32vector, NULL, NULL);
2273 
2274 static ScmObj uvlib_u32vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2275 {
2276   ScmObj obj_scm;
2277   ScmObj obj;
2278   SCM_ENTER_SUBR("u32vector?");
2279   obj_scm = SCM_ARGREF(0);
2280   obj = (obj_scm);
2281   {
2282 {
2283 int SCM_RESULT;
2284 SCM_RESULT = SCM_U32VECTORP(obj);
2285 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
2286 }
2287   }
2288 }
2289 
2290 static SCM_DEFINE_STRING_CONST(uvlib_u32vectorP__NAME, "u32vector?", 10, 10);
2291 static SCM_DEFINE_SUBR(uvlib_u32vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_u32vectorP__NAME), uvlib_u32vectorP, NULL, NULL);
2292 
2293 static ScmObj uvlib_make_u32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2294 {
2295   ScmObj length_scm;
2296   int length;
2297   ScmObj fill_scm;
2298   ScmObj fill;
2299   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2300   SCM_ENTER_SUBR("make-u32vector");
2301   if (Scm_Length(SCM_OPTARGS) > 1)
2302     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2303   length_scm = SCM_ARGREF(0);
2304   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
2305   length = SCM_INT_VALUE(length_scm);
2306   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
2307   else {
2308     fill_scm = SCM_CAR(SCM_OPTARGS);
2309     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2310   }
2311   fill = (fill_scm);
2312   {
2313 ScmUInt32 filler;
2314   filler = Scm_GetIntegerU32Clamp(fill, SCM_CLAMP_ERROR, NULL);
2315   SCM_RETURN(Scm_MakeU32Vector(length, filler));
2316   }
2317 }
2318 
2319 static SCM_DEFINE_STRING_CONST(uvlib_make_u32vector__NAME, "make-u32vector", 14, 14);
2320 static SCM_DEFINE_SUBR(uvlib_make_u32vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_u32vector__NAME), uvlib_make_u32vector, NULL, NULL);
2321 
2322 static ScmObj uvlib_u32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2323 {
2324   ScmObj args_scm;
2325   ScmObj args;
2326   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2327   SCM_ENTER_SUBR("u32vector");
2328   args_scm = SCM_OPTARGS;
2329   args = (args_scm);
2330   {
2331 SCM_RETURN(Scm_ListToU32Vector(args, SCM_CLAMP_ERROR));
2332   }
2333 }
2334 
2335 static SCM_DEFINE_STRING_CONST(uvlib_u32vector__NAME, "u32vector", 9, 9);
2336 static SCM_DEFINE_SUBR(uvlib_u32vector__STUB, 0, 1, SCM_OBJ(&uvlib_u32vector__NAME), uvlib_u32vector, NULL, NULL);
2337 
2338 static ScmObj uvlib_u32vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2339 {
2340   ScmObj v_scm;
2341   ScmU32Vector* v;
2342   SCM_ENTER_SUBR("u32vector-length");
2343   v_scm = SCM_ARGREF(0);
2344   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2345   v = SCM_U32VECTOR(v_scm);
2346   {
2347 SCM_RETURN(SCM_MAKE_INT(SCM_U32VECTOR_SIZE(v)));
2348   }
2349 }
2350 
2351 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_length__NAME, "u32vector-length", 16, 16);
2352 static SCM_DEFINE_SUBR(uvlib_u32vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_u32vector_length__NAME), uvlib_u32vector_length, NULL, NULL);
2353 
2354 static ScmObj uvlib_u32vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2355 {
2356   ScmObj v_scm;
2357   ScmU32Vector* v;
2358   ScmObj i_scm;
2359   int i;
2360   ScmObj fallback_scm;
2361   ScmObj fallback;
2362   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2363   SCM_ENTER_SUBR("u32vector-ref");
2364   if (Scm_Length(SCM_OPTARGS) > 1)
2365     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2366   v_scm = SCM_ARGREF(0);
2367   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2368   v = SCM_U32VECTOR(v_scm);
2369   i_scm = SCM_ARGREF(1);
2370   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
2371   i = SCM_INT_VALUE(i_scm);
2372   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
2373   else {
2374     fallback_scm = SCM_CAR(SCM_OPTARGS);
2375     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2376   }
2377   fallback = (fallback_scm);
2378   {
2379 SCM_RETURN(Scm_U32VectorRef(v, i, fallback));
2380   }
2381 }
2382 
2383 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_ref__NAME, "u32vector-ref", 13, 13);
2384 static SCM_DEFINE_SUBR(uvlib_u32vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_u32vector_ref__NAME), uvlib_u32vector_ref, NULL, NULL);
2385 
2386 static ScmObj uvlib_u32vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2387 {
2388   ScmObj v_scm;
2389   ScmU32Vector* v;
2390   ScmObj i_scm;
2391   int i;
2392   ScmObj val_scm;
2393   ScmObj val;
2394   ScmObj clamp_scm;
2395   ScmObj clamp;
2396   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2397   SCM_ENTER_SUBR("u32vector-set!");
2398   if (Scm_Length(SCM_OPTARGS) > 1)
2399     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2400   v_scm = SCM_ARGREF(0);
2401   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2402   v = SCM_U32VECTOR(v_scm);
2403   i_scm = SCM_ARGREF(1);
2404   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
2405   i = SCM_INT_VALUE(i_scm);
2406   val_scm = SCM_ARGREF(2);
2407   val = (val_scm);
2408   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
2409   else {
2410     clamp_scm = SCM_CAR(SCM_OPTARGS);
2411     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2412   }
2413   clamp = (clamp_scm);
2414   {
2415 SCM_RETURN(Scm_U32VectorSet(v, i, val, clamp_arg(clamp)));
2416   }
2417 }
2418 
2419 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_setX__NAME, "u32vector-set!", 14, 14);
2420 static SCM_DEFINE_SUBR(uvlib_u32vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_u32vector_setX__NAME), uvlib_u32vector_setX, NULL, NULL);
2421 
2422 static ScmObj uvlib_u32vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2423 {
2424   ScmObj v_scm;
2425   ScmU32Vector* v;
2426   ScmObj start_scm;
2427   int start;
2428   ScmObj end_scm;
2429   int end;
2430   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2431   SCM_ENTER_SUBR("u32vector-copy");
2432   if (Scm_Length(SCM_OPTARGS) > 2)
2433     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2434   v_scm = SCM_ARGREF(0);
2435   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2436   v = SCM_U32VECTOR(v_scm);
2437   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2438   else {
2439     start_scm = SCM_CAR(SCM_OPTARGS);
2440     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2441   }
2442   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2443   start = SCM_INT_VALUE(start_scm);
2444   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2445   else {
2446     end_scm = SCM_CAR(SCM_OPTARGS);
2447     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2448   }
2449   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2450   end = SCM_INT_VALUE(end_scm);
2451   {
2452 {
2453 ScmObj SCM_RESULT;
2454 SCM_RESULT = Scm_U32VectorCopy(v, start, end);
2455 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2456 }
2457   }
2458 }
2459 
2460 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_copy__NAME, "u32vector-copy", 14, 14);
2461 static SCM_DEFINE_SUBR(uvlib_u32vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_u32vector_copy__NAME), uvlib_u32vector_copy, NULL, NULL);
2462 
2463 static ScmObj uvlib_u32vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2464 {
2465   ScmObj dst_scm;
2466   ScmU32Vector* dst;
2467   ScmObj dstart_scm;
2468   ScmObj dstart;
2469   ScmObj src_scm;
2470   ScmObj src;
2471   ScmObj sstart_scm;
2472   int sstart;
2473   ScmObj send_scm;
2474   int send;
2475   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2476   SCM_ENTER_SUBR("u32vector-copy!");
2477   if (Scm_Length(SCM_OPTARGS) > 3)
2478     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2479   dst_scm = SCM_ARGREF(0);
2480   if (!SCM_U32VECTORP(dst_scm)) Scm_Error("<u32vector> required, but got %S", dst_scm);
2481   dst = SCM_U32VECTOR(dst_scm);
2482   dstart_scm = SCM_ARGREF(1);
2483   dstart = (dstart_scm);
2484   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
2485   else {
2486     src_scm = SCM_CAR(SCM_OPTARGS);
2487     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2488   }
2489   src = (src_scm);
2490   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
2491   else {
2492     sstart_scm = SCM_CAR(SCM_OPTARGS);
2493     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2494   }
2495   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
2496   sstart = Scm_GetInteger(sstart_scm);
2497   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
2498   else {
2499     send_scm = SCM_CAR(SCM_OPTARGS);
2500     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2501   }
2502   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
2503   send = Scm_GetInteger(send_scm);
2504   {
2505 if (SCM_INTEGERP(dstart)) {
2506      /* new API */
2507      if (!SCM_U32VECTORP(src)) {
2508        Scm_Error("u32vector-copy!: argument is not a matching uvector: %S",
2509                  src);
2510      }
2511      SCM_RETURN(Scm_U32VectorCopyX(dst, Scm_GetInteger(dstart), 
2512                                     SCM_U32VECTOR(src), sstart, send));
2513   } else if (SCM_U32VECTORP(dstart)) {
2514     /* old API */
2515     SCM_RETURN(Scm_U32VectorCopyX(dst, 0, SCM_U32VECTOR(dstart), 0, -1));
2516   } else {
2517     Scm_Error("integer required, but got %S", dstart);
2518     SCM_RETURN(SCM_UNDEFINED);
2519   }
2520   }
2521 }
2522 
2523 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_copyX__NAME, "u32vector-copy!", 15, 15);
2524 static SCM_DEFINE_SUBR(uvlib_u32vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_u32vector_copyX__NAME), uvlib_u32vector_copyX, NULL, NULL);
2525 
2526 static ScmObj uvlib_u32vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2527 {
2528   ScmObj v_scm;
2529   ScmU32Vector* v;
2530   ScmObj start_scm;
2531   int start;
2532   ScmObj end_scm;
2533   int end;
2534   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2535   SCM_ENTER_SUBR("u32vector->list");
2536   if (Scm_Length(SCM_OPTARGS) > 2)
2537     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2538   v_scm = SCM_ARGREF(0);
2539   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2540   v = SCM_U32VECTOR(v_scm);
2541   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2542   else {
2543     start_scm = SCM_CAR(SCM_OPTARGS);
2544     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2545   }
2546   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2547   start = SCM_INT_VALUE(start_scm);
2548   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2549   else {
2550     end_scm = SCM_CAR(SCM_OPTARGS);
2551     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2552   }
2553   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2554   end = SCM_INT_VALUE(end_scm);
2555   {
2556 {
2557 ScmObj SCM_RESULT;
2558 SCM_RESULT = Scm_U32VectorToList(v, start, end);
2559 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2560 }
2561   }
2562 }
2563 
2564 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_TOlist__NAME, "u32vector->list", 15, 15);
2565 static SCM_DEFINE_SUBR(uvlib_u32vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_u32vector_TOlist__NAME), uvlib_u32vector_TOlist, NULL, NULL);
2566 
2567 static ScmObj uvlib_list_TOu32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2568 {
2569   ScmObj l_scm;
2570   ScmObj l;
2571   ScmObj clamp_scm;
2572   ScmObj clamp;
2573   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2574   SCM_ENTER_SUBR("list->u32vector");
2575   if (Scm_Length(SCM_OPTARGS) > 1)
2576     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2577   l_scm = SCM_ARGREF(0);
2578   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
2579   l = (l_scm);
2580   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
2581   else {
2582     clamp_scm = SCM_CAR(SCM_OPTARGS);
2583     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2584   }
2585   clamp = (clamp_scm);
2586   {
2587 SCM_RETURN(Scm_ListToU32Vector(l, clamp_arg(clamp)));
2588   }
2589 }
2590 
2591 static SCM_DEFINE_STRING_CONST(uvlib_list_TOu32vector__NAME, "list->u32vector", 15, 15);
2592 static SCM_DEFINE_SUBR(uvlib_list_TOu32vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOu32vector__NAME), uvlib_list_TOu32vector, NULL, NULL);
2593 
2594 static ScmObj uvlib_u32vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2595 {
2596   ScmObj v_scm;
2597   ScmU32Vector* v;
2598   ScmObj val_scm;
2599   ScmObj val;
2600   ScmObj start_scm;
2601   int start;
2602   ScmObj end_scm;
2603   int end;
2604   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2605   SCM_ENTER_SUBR("u32vector-fill!");
2606   if (Scm_Length(SCM_OPTARGS) > 2)
2607     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2608   v_scm = SCM_ARGREF(0);
2609   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2610   v = SCM_U32VECTOR(v_scm);
2611   val_scm = SCM_ARGREF(1);
2612   val = (val_scm);
2613   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2614   else {
2615     start_scm = SCM_CAR(SCM_OPTARGS);
2616     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2617   }
2618   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2619   start = SCM_INT_VALUE(start_scm);
2620   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2621   else {
2622     end_scm = SCM_CAR(SCM_OPTARGS);
2623     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2624   }
2625   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2626   end = SCM_INT_VALUE(end_scm);
2627   {
2628 ScmUInt32 filler;
2629   filler = Scm_GetIntegerU32Clamp(val, SCM_CLAMP_ERROR, NULL);
2630   SCM_RETURN(Scm_U32VectorFill(v, filler, start, end));
2631   }
2632 }
2633 
2634 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_fillX__NAME, "u32vector-fill!", 15, 15);
2635 static SCM_DEFINE_SUBR(uvlib_u32vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_u32vector_fillX__NAME), uvlib_u32vector_fillX, NULL, NULL);
2636 
2637 static ScmObj uvlib_u32vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2638 {
2639   ScmObj v_scm;
2640   ScmU32Vector* v;
2641   ScmObj start_scm;
2642   int start;
2643   ScmObj end_scm;
2644   int end;
2645   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2646   SCM_ENTER_SUBR("u32vector->vector");
2647   if (Scm_Length(SCM_OPTARGS) > 2)
2648     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2649   v_scm = SCM_ARGREF(0);
2650   if (!SCM_U32VECTORP(v_scm)) Scm_Error("<u32vector> required, but got %S", v_scm);
2651   v = SCM_U32VECTOR(v_scm);
2652   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2653   else {
2654     start_scm = SCM_CAR(SCM_OPTARGS);
2655     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2656   }
2657   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2658   start = SCM_INT_VALUE(start_scm);
2659   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2660   else {
2661     end_scm = SCM_CAR(SCM_OPTARGS);
2662     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2663   }
2664   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2665   end = SCM_INT_VALUE(end_scm);
2666   {
2667 {
2668 ScmObj SCM_RESULT;
2669 SCM_RESULT = Scm_U32VectorToVector(v, start, end);
2670 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2671 }
2672   }
2673 }
2674 
2675 static SCM_DEFINE_STRING_CONST(uvlib_u32vector_TOvector__NAME, "u32vector->vector", 17, 17);
2676 static SCM_DEFINE_SUBR(uvlib_u32vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_u32vector_TOvector__NAME), uvlib_u32vector_TOvector, NULL, NULL);
2677 
2678 static ScmObj uvlib_vector_TOu32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2679 {
2680   ScmObj v_scm;
2681   ScmVector* v;
2682   ScmObj start_scm;
2683   int start;
2684   ScmObj end_scm;
2685   int end;
2686   ScmObj clamp_scm;
2687   ScmObj clamp;
2688   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2689   SCM_ENTER_SUBR("vector->u32vector");
2690   if (Scm_Length(SCM_OPTARGS) > 3)
2691     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2692   v_scm = SCM_ARGREF(0);
2693   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
2694   v = SCM_VECTOR(v_scm);
2695   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2696   else {
2697     start_scm = SCM_CAR(SCM_OPTARGS);
2698     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2699   }
2700   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2701   start = SCM_INT_VALUE(start_scm);
2702   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2703   else {
2704     end_scm = SCM_CAR(SCM_OPTARGS);
2705     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2706   }
2707   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2708   end = SCM_INT_VALUE(end_scm);
2709   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
2710   else {
2711     clamp_scm = SCM_CAR(SCM_OPTARGS);
2712     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2713   }
2714   clamp = (clamp_scm);
2715   {
2716 SCM_RETURN(Scm_VectorToU32Vector(v, start, end, clamp_arg(clamp)));
2717   }
2718 }
2719 
2720 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOu32vector__NAME, "vector->u32vector", 17, 17);
2721 static SCM_DEFINE_SUBR(uvlib_vector_TOu32vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOu32vector__NAME), uvlib_vector_TOu32vector, NULL, NULL);
2722 
2723 static ScmObj uvlib_s64vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2724 {
2725   ScmObj obj_scm;
2726   ScmObj obj;
2727   SCM_ENTER_SUBR("s64vector?");
2728   obj_scm = SCM_ARGREF(0);
2729   obj = (obj_scm);
2730   {
2731 {
2732 int SCM_RESULT;
2733 SCM_RESULT = SCM_S64VECTORP(obj);
2734 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
2735 }
2736   }
2737 }
2738 
2739 static SCM_DEFINE_STRING_CONST(uvlib_s64vectorP__NAME, "s64vector?", 10, 10);
2740 static SCM_DEFINE_SUBR(uvlib_s64vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_s64vectorP__NAME), uvlib_s64vectorP, NULL, NULL);
2741 
2742 static ScmObj uvlib_make_s64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2743 {
2744   ScmObj length_scm;
2745   int length;
2746   ScmObj fill_scm;
2747   ScmObj fill;
2748   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2749   SCM_ENTER_SUBR("make-s64vector");
2750   if (Scm_Length(SCM_OPTARGS) > 1)
2751     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2752   length_scm = SCM_ARGREF(0);
2753   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
2754   length = SCM_INT_VALUE(length_scm);
2755   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
2756   else {
2757     fill_scm = SCM_CAR(SCM_OPTARGS);
2758     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2759   }
2760   fill = (fill_scm);
2761   {
2762 ScmInt64 filler;
2763   filler = Scm_GetInteger64Clamp(fill, SCM_CLAMP_ERROR, NULL);
2764   SCM_RETURN(Scm_MakeS64Vector(length, filler));
2765   }
2766 }
2767 
2768 static SCM_DEFINE_STRING_CONST(uvlib_make_s64vector__NAME, "make-s64vector", 14, 14);
2769 static SCM_DEFINE_SUBR(uvlib_make_s64vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_s64vector__NAME), uvlib_make_s64vector, NULL, NULL);
2770 
2771 static ScmObj uvlib_s64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2772 {
2773   ScmObj args_scm;
2774   ScmObj args;
2775   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2776   SCM_ENTER_SUBR("s64vector");
2777   args_scm = SCM_OPTARGS;
2778   args = (args_scm);
2779   {
2780 SCM_RETURN(Scm_ListToS64Vector(args, SCM_CLAMP_ERROR));
2781   }
2782 }
2783 
2784 static SCM_DEFINE_STRING_CONST(uvlib_s64vector__NAME, "s64vector", 9, 9);
2785 static SCM_DEFINE_SUBR(uvlib_s64vector__STUB, 0, 1, SCM_OBJ(&uvlib_s64vector__NAME), uvlib_s64vector, NULL, NULL);
2786 
2787 static ScmObj uvlib_s64vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2788 {
2789   ScmObj v_scm;
2790   ScmS64Vector* v;
2791   SCM_ENTER_SUBR("s64vector-length");
2792   v_scm = SCM_ARGREF(0);
2793   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
2794   v = SCM_S64VECTOR(v_scm);
2795   {
2796 SCM_RETURN(SCM_MAKE_INT(SCM_S64VECTOR_SIZE(v)));
2797   }
2798 }
2799 
2800 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_length__NAME, "s64vector-length", 16, 16);
2801 static SCM_DEFINE_SUBR(uvlib_s64vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_s64vector_length__NAME), uvlib_s64vector_length, NULL, NULL);
2802 
2803 static ScmObj uvlib_s64vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2804 {
2805   ScmObj v_scm;
2806   ScmS64Vector* v;
2807   ScmObj i_scm;
2808   int i;
2809   ScmObj fallback_scm;
2810   ScmObj fallback;
2811   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2812   SCM_ENTER_SUBR("s64vector-ref");
2813   if (Scm_Length(SCM_OPTARGS) > 1)
2814     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2815   v_scm = SCM_ARGREF(0);
2816   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
2817   v = SCM_S64VECTOR(v_scm);
2818   i_scm = SCM_ARGREF(1);
2819   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
2820   i = SCM_INT_VALUE(i_scm);
2821   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
2822   else {
2823     fallback_scm = SCM_CAR(SCM_OPTARGS);
2824     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2825   }
2826   fallback = (fallback_scm);
2827   {
2828 SCM_RETURN(Scm_S64VectorRef(v, i, fallback));
2829   }
2830 }
2831 
2832 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_ref__NAME, "s64vector-ref", 13, 13);
2833 static SCM_DEFINE_SUBR(uvlib_s64vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_s64vector_ref__NAME), uvlib_s64vector_ref, NULL, NULL);
2834 
2835 static ScmObj uvlib_s64vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2836 {
2837   ScmObj v_scm;
2838   ScmS64Vector* v;
2839   ScmObj i_scm;
2840   int i;
2841   ScmObj val_scm;
2842   ScmObj val;
2843   ScmObj clamp_scm;
2844   ScmObj clamp;
2845   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2846   SCM_ENTER_SUBR("s64vector-set!");
2847   if (Scm_Length(SCM_OPTARGS) > 1)
2848     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2849   v_scm = SCM_ARGREF(0);
2850   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
2851   v = SCM_S64VECTOR(v_scm);
2852   i_scm = SCM_ARGREF(1);
2853   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
2854   i = SCM_INT_VALUE(i_scm);
2855   val_scm = SCM_ARGREF(2);
2856   val = (val_scm);
2857   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
2858   else {
2859     clamp_scm = SCM_CAR(SCM_OPTARGS);
2860     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2861   }
2862   clamp = (clamp_scm);
2863   {
2864 SCM_RETURN(Scm_S64VectorSet(v, i, val, clamp_arg(clamp)));
2865   }
2866 }
2867 
2868 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_setX__NAME, "s64vector-set!", 14, 14);
2869 static SCM_DEFINE_SUBR(uvlib_s64vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_s64vector_setX__NAME), uvlib_s64vector_setX, NULL, NULL);
2870 
2871 static ScmObj uvlib_s64vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2872 {
2873   ScmObj v_scm;
2874   ScmS64Vector* v;
2875   ScmObj start_scm;
2876   int start;
2877   ScmObj end_scm;
2878   int end;
2879   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2880   SCM_ENTER_SUBR("s64vector-copy");
2881   if (Scm_Length(SCM_OPTARGS) > 2)
2882     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2883   v_scm = SCM_ARGREF(0);
2884   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
2885   v = SCM_S64VECTOR(v_scm);
2886   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2887   else {
2888     start_scm = SCM_CAR(SCM_OPTARGS);
2889     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2890   }
2891   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2892   start = SCM_INT_VALUE(start_scm);
2893   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2894   else {
2895     end_scm = SCM_CAR(SCM_OPTARGS);
2896     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2897   }
2898   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
2899   end = SCM_INT_VALUE(end_scm);
2900   {
2901 {
2902 ScmObj SCM_RESULT;
2903 SCM_RESULT = Scm_S64VectorCopy(v, start, end);
2904 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
2905 }
2906   }
2907 }
2908 
2909 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_copy__NAME, "s64vector-copy", 14, 14);
2910 static SCM_DEFINE_SUBR(uvlib_s64vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_s64vector_copy__NAME), uvlib_s64vector_copy, NULL, NULL);
2911 
2912 static ScmObj uvlib_s64vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2913 {
2914   ScmObj dst_scm;
2915   ScmS64Vector* dst;
2916   ScmObj dstart_scm;
2917   ScmObj dstart;
2918   ScmObj src_scm;
2919   ScmObj src;
2920   ScmObj sstart_scm;
2921   int sstart;
2922   ScmObj send_scm;
2923   int send;
2924   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2925   SCM_ENTER_SUBR("s64vector-copy!");
2926   if (Scm_Length(SCM_OPTARGS) > 3)
2927     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2928   dst_scm = SCM_ARGREF(0);
2929   if (!SCM_S64VECTORP(dst_scm)) Scm_Error("<s64vector> required, but got %S", dst_scm);
2930   dst = SCM_S64VECTOR(dst_scm);
2931   dstart_scm = SCM_ARGREF(1);
2932   dstart = (dstart_scm);
2933   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
2934   else {
2935     src_scm = SCM_CAR(SCM_OPTARGS);
2936     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2937   }
2938   src = (src_scm);
2939   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
2940   else {
2941     sstart_scm = SCM_CAR(SCM_OPTARGS);
2942     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2943   }
2944   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
2945   sstart = Scm_GetInteger(sstart_scm);
2946   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
2947   else {
2948     send_scm = SCM_CAR(SCM_OPTARGS);
2949     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2950   }
2951   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
2952   send = Scm_GetInteger(send_scm);
2953   {
2954 if (SCM_INTEGERP(dstart)) {
2955      /* new API */
2956      if (!SCM_S64VECTORP(src)) {
2957        Scm_Error("s64vector-copy!: argument is not a matching uvector: %S",
2958                  src);
2959      }
2960      SCM_RETURN(Scm_S64VectorCopyX(dst, Scm_GetInteger(dstart), 
2961                                     SCM_S64VECTOR(src), sstart, send));
2962   } else if (SCM_S64VECTORP(dstart)) {
2963     /* old API */
2964     SCM_RETURN(Scm_S64VectorCopyX(dst, 0, SCM_S64VECTOR(dstart), 0, -1));
2965   } else {
2966     Scm_Error("integer required, but got %S", dstart);
2967     SCM_RETURN(SCM_UNDEFINED);
2968   }
2969   }
2970 }
2971 
2972 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_copyX__NAME, "s64vector-copy!", 15, 15);
2973 static SCM_DEFINE_SUBR(uvlib_s64vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_s64vector_copyX__NAME), uvlib_s64vector_copyX, NULL, NULL);
2974 
2975 static ScmObj uvlib_s64vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
2976 {
2977   ScmObj v_scm;
2978   ScmS64Vector* v;
2979   ScmObj start_scm;
2980   int start;
2981   ScmObj end_scm;
2982   int end;
2983   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
2984   SCM_ENTER_SUBR("s64vector->list");
2985   if (Scm_Length(SCM_OPTARGS) > 2)
2986     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
2987   v_scm = SCM_ARGREF(0);
2988   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
2989   v = SCM_S64VECTOR(v_scm);
2990   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
2991   else {
2992     start_scm = SCM_CAR(SCM_OPTARGS);
2993     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
2994   }
2995   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
2996   start = SCM_INT_VALUE(start_scm);
2997   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
2998   else {
2999     end_scm = SCM_CAR(SCM_OPTARGS);
3000     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3001   }
3002   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3003   end = SCM_INT_VALUE(end_scm);
3004   {
3005 {
3006 ScmObj SCM_RESULT;
3007 SCM_RESULT = Scm_S64VectorToList(v, start, end);
3008 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3009 }
3010   }
3011 }
3012 
3013 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_TOlist__NAME, "s64vector->list", 15, 15);
3014 static SCM_DEFINE_SUBR(uvlib_s64vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_s64vector_TOlist__NAME), uvlib_s64vector_TOlist, NULL, NULL);
3015 
3016 static ScmObj uvlib_list_TOs64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3017 {
3018   ScmObj l_scm;
3019   ScmObj l;
3020   ScmObj clamp_scm;
3021   ScmObj clamp;
3022   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3023   SCM_ENTER_SUBR("list->s64vector");
3024   if (Scm_Length(SCM_OPTARGS) > 1)
3025     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3026   l_scm = SCM_ARGREF(0);
3027   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
3028   l = (l_scm);
3029   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3030   else {
3031     clamp_scm = SCM_CAR(SCM_OPTARGS);
3032     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3033   }
3034   clamp = (clamp_scm);
3035   {
3036 SCM_RETURN(Scm_ListToS64Vector(l, clamp_arg(clamp)));
3037   }
3038 }
3039 
3040 static SCM_DEFINE_STRING_CONST(uvlib_list_TOs64vector__NAME, "list->s64vector", 15, 15);
3041 static SCM_DEFINE_SUBR(uvlib_list_TOs64vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOs64vector__NAME), uvlib_list_TOs64vector, NULL, NULL);
3042 
3043 static ScmObj uvlib_s64vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3044 {
3045   ScmObj v_scm;
3046   ScmS64Vector* v;
3047   ScmObj val_scm;
3048   ScmObj val;
3049   ScmObj start_scm;
3050   int start;
3051   ScmObj end_scm;
3052   int end;
3053   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3054   SCM_ENTER_SUBR("s64vector-fill!");
3055   if (Scm_Length(SCM_OPTARGS) > 2)
3056     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3057   v_scm = SCM_ARGREF(0);
3058   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
3059   v = SCM_S64VECTOR(v_scm);
3060   val_scm = SCM_ARGREF(1);
3061   val = (val_scm);
3062   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3063   else {
3064     start_scm = SCM_CAR(SCM_OPTARGS);
3065     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3066   }
3067   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3068   start = SCM_INT_VALUE(start_scm);
3069   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3070   else {
3071     end_scm = SCM_CAR(SCM_OPTARGS);
3072     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3073   }
3074   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3075   end = SCM_INT_VALUE(end_scm);
3076   {
3077 ScmInt64 filler;
3078   filler = Scm_GetInteger64Clamp(val, SCM_CLAMP_ERROR, NULL);
3079   SCM_RETURN(Scm_S64VectorFill(v, filler, start, end));
3080   }
3081 }
3082 
3083 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_fillX__NAME, "s64vector-fill!", 15, 15);
3084 static SCM_DEFINE_SUBR(uvlib_s64vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_s64vector_fillX__NAME), uvlib_s64vector_fillX, NULL, NULL);
3085 
3086 static ScmObj uvlib_s64vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3087 {
3088   ScmObj v_scm;
3089   ScmS64Vector* v;
3090   ScmObj start_scm;
3091   int start;
3092   ScmObj end_scm;
3093   int end;
3094   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3095   SCM_ENTER_SUBR("s64vector->vector");
3096   if (Scm_Length(SCM_OPTARGS) > 2)
3097     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3098   v_scm = SCM_ARGREF(0);
3099   if (!SCM_S64VECTORP(v_scm)) Scm_Error("<s64vector> required, but got %S", v_scm);
3100   v = SCM_S64VECTOR(v_scm);
3101   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3102   else {
3103     start_scm = SCM_CAR(SCM_OPTARGS);
3104     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3105   }
3106   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3107   start = SCM_INT_VALUE(start_scm);
3108   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3109   else {
3110     end_scm = SCM_CAR(SCM_OPTARGS);
3111     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3112   }
3113   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3114   end = SCM_INT_VALUE(end_scm);
3115   {
3116 {
3117 ScmObj SCM_RESULT;
3118 SCM_RESULT = Scm_S64VectorToVector(v, start, end);
3119 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3120 }
3121   }
3122 }
3123 
3124 static SCM_DEFINE_STRING_CONST(uvlib_s64vector_TOvector__NAME, "s64vector->vector", 17, 17);
3125 static SCM_DEFINE_SUBR(uvlib_s64vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_s64vector_TOvector__NAME), uvlib_s64vector_TOvector, NULL, NULL);
3126 
3127 static ScmObj uvlib_vector_TOs64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3128 {
3129   ScmObj v_scm;
3130   ScmVector* v;
3131   ScmObj start_scm;
3132   int start;
3133   ScmObj end_scm;
3134   int end;
3135   ScmObj clamp_scm;
3136   ScmObj clamp;
3137   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3138   SCM_ENTER_SUBR("vector->s64vector");
3139   if (Scm_Length(SCM_OPTARGS) > 3)
3140     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3141   v_scm = SCM_ARGREF(0);
3142   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
3143   v = SCM_VECTOR(v_scm);
3144   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3145   else {
3146     start_scm = SCM_CAR(SCM_OPTARGS);
3147     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3148   }
3149   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3150   start = SCM_INT_VALUE(start_scm);
3151   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3152   else {
3153     end_scm = SCM_CAR(SCM_OPTARGS);
3154     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3155   }
3156   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3157   end = SCM_INT_VALUE(end_scm);
3158   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3159   else {
3160     clamp_scm = SCM_CAR(SCM_OPTARGS);
3161     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3162   }
3163   clamp = (clamp_scm);
3164   {
3165 SCM_RETURN(Scm_VectorToS64Vector(v, start, end, clamp_arg(clamp)));
3166   }
3167 }
3168 
3169 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOs64vector__NAME, "vector->s64vector", 17, 17);
3170 static SCM_DEFINE_SUBR(uvlib_vector_TOs64vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOs64vector__NAME), uvlib_vector_TOs64vector, NULL, NULL);
3171 
3172 static ScmObj uvlib_u64vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3173 {
3174   ScmObj obj_scm;
3175   ScmObj obj;
3176   SCM_ENTER_SUBR("u64vector?");
3177   obj_scm = SCM_ARGREF(0);
3178   obj = (obj_scm);
3179   {
3180 {
3181 int SCM_RESULT;
3182 SCM_RESULT = SCM_U64VECTORP(obj);
3183 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
3184 }
3185   }
3186 }
3187 
3188 static SCM_DEFINE_STRING_CONST(uvlib_u64vectorP__NAME, "u64vector?", 10, 10);
3189 static SCM_DEFINE_SUBR(uvlib_u64vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_u64vectorP__NAME), uvlib_u64vectorP, NULL, NULL);
3190 
3191 static ScmObj uvlib_make_u64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3192 {
3193   ScmObj length_scm;
3194   int length;
3195   ScmObj fill_scm;
3196   ScmObj fill;
3197   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3198   SCM_ENTER_SUBR("make-u64vector");
3199   if (Scm_Length(SCM_OPTARGS) > 1)
3200     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3201   length_scm = SCM_ARGREF(0);
3202   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
3203   length = SCM_INT_VALUE(length_scm);
3204   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
3205   else {
3206     fill_scm = SCM_CAR(SCM_OPTARGS);
3207     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3208   }
3209   fill = (fill_scm);
3210   {
3211 ScmUInt64 filler;
3212   filler = Scm_GetIntegerU64Clamp(fill, SCM_CLAMP_ERROR, NULL);
3213   SCM_RETURN(Scm_MakeU64Vector(length, filler));
3214   }
3215 }
3216 
3217 static SCM_DEFINE_STRING_CONST(uvlib_make_u64vector__NAME, "make-u64vector", 14, 14);
3218 static SCM_DEFINE_SUBR(uvlib_make_u64vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_u64vector__NAME), uvlib_make_u64vector, NULL, NULL);
3219 
3220 static ScmObj uvlib_u64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3221 {
3222   ScmObj args_scm;
3223   ScmObj args;
3224   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3225   SCM_ENTER_SUBR("u64vector");
3226   args_scm = SCM_OPTARGS;
3227   args = (args_scm);
3228   {
3229 SCM_RETURN(Scm_ListToU64Vector(args, SCM_CLAMP_ERROR));
3230   }
3231 }
3232 
3233 static SCM_DEFINE_STRING_CONST(uvlib_u64vector__NAME, "u64vector", 9, 9);
3234 static SCM_DEFINE_SUBR(uvlib_u64vector__STUB, 0, 1, SCM_OBJ(&uvlib_u64vector__NAME), uvlib_u64vector, NULL, NULL);
3235 
3236 static ScmObj uvlib_u64vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3237 {
3238   ScmObj v_scm;
3239   ScmU64Vector* v;
3240   SCM_ENTER_SUBR("u64vector-length");
3241   v_scm = SCM_ARGREF(0);
3242   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3243   v = SCM_U64VECTOR(v_scm);
3244   {
3245 SCM_RETURN(SCM_MAKE_INT(SCM_U64VECTOR_SIZE(v)));
3246   }
3247 }
3248 
3249 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_length__NAME, "u64vector-length", 16, 16);
3250 static SCM_DEFINE_SUBR(uvlib_u64vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_u64vector_length__NAME), uvlib_u64vector_length, NULL, NULL);
3251 
3252 static ScmObj uvlib_u64vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3253 {
3254   ScmObj v_scm;
3255   ScmU64Vector* v;
3256   ScmObj i_scm;
3257   int i;
3258   ScmObj fallback_scm;
3259   ScmObj fallback;
3260   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3261   SCM_ENTER_SUBR("u64vector-ref");
3262   if (Scm_Length(SCM_OPTARGS) > 1)
3263     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3264   v_scm = SCM_ARGREF(0);
3265   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3266   v = SCM_U64VECTOR(v_scm);
3267   i_scm = SCM_ARGREF(1);
3268   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
3269   i = SCM_INT_VALUE(i_scm);
3270   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
3271   else {
3272     fallback_scm = SCM_CAR(SCM_OPTARGS);
3273     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3274   }
3275   fallback = (fallback_scm);
3276   {
3277 SCM_RETURN(Scm_U64VectorRef(v, i, fallback));
3278   }
3279 }
3280 
3281 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_ref__NAME, "u64vector-ref", 13, 13);
3282 static SCM_DEFINE_SUBR(uvlib_u64vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_u64vector_ref__NAME), uvlib_u64vector_ref, NULL, NULL);
3283 
3284 static ScmObj uvlib_u64vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3285 {
3286   ScmObj v_scm;
3287   ScmU64Vector* v;
3288   ScmObj i_scm;
3289   int i;
3290   ScmObj val_scm;
3291   ScmObj val;
3292   ScmObj clamp_scm;
3293   ScmObj clamp;
3294   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3295   SCM_ENTER_SUBR("u64vector-set!");
3296   if (Scm_Length(SCM_OPTARGS) > 1)
3297     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3298   v_scm = SCM_ARGREF(0);
3299   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3300   v = SCM_U64VECTOR(v_scm);
3301   i_scm = SCM_ARGREF(1);
3302   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
3303   i = SCM_INT_VALUE(i_scm);
3304   val_scm = SCM_ARGREF(2);
3305   val = (val_scm);
3306   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3307   else {
3308     clamp_scm = SCM_CAR(SCM_OPTARGS);
3309     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3310   }
3311   clamp = (clamp_scm);
3312   {
3313 SCM_RETURN(Scm_U64VectorSet(v, i, val, clamp_arg(clamp)));
3314   }
3315 }
3316 
3317 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_setX__NAME, "u64vector-set!", 14, 14);
3318 static SCM_DEFINE_SUBR(uvlib_u64vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_u64vector_setX__NAME), uvlib_u64vector_setX, NULL, NULL);
3319 
3320 static ScmObj uvlib_u64vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3321 {
3322   ScmObj v_scm;
3323   ScmU64Vector* v;
3324   ScmObj start_scm;
3325   int start;
3326   ScmObj end_scm;
3327   int end;
3328   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3329   SCM_ENTER_SUBR("u64vector-copy");
3330   if (Scm_Length(SCM_OPTARGS) > 2)
3331     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3332   v_scm = SCM_ARGREF(0);
3333   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3334   v = SCM_U64VECTOR(v_scm);
3335   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3336   else {
3337     start_scm = SCM_CAR(SCM_OPTARGS);
3338     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3339   }
3340   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3341   start = SCM_INT_VALUE(start_scm);
3342   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3343   else {
3344     end_scm = SCM_CAR(SCM_OPTARGS);
3345     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3346   }
3347   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3348   end = SCM_INT_VALUE(end_scm);
3349   {
3350 {
3351 ScmObj SCM_RESULT;
3352 SCM_RESULT = Scm_U64VectorCopy(v, start, end);
3353 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3354 }
3355   }
3356 }
3357 
3358 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_copy__NAME, "u64vector-copy", 14, 14);
3359 static SCM_DEFINE_SUBR(uvlib_u64vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_u64vector_copy__NAME), uvlib_u64vector_copy, NULL, NULL);
3360 
3361 static ScmObj uvlib_u64vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3362 {
3363   ScmObj dst_scm;
3364   ScmU64Vector* dst;
3365   ScmObj dstart_scm;
3366   ScmObj dstart;
3367   ScmObj src_scm;
3368   ScmObj src;
3369   ScmObj sstart_scm;
3370   int sstart;
3371   ScmObj send_scm;
3372   int send;
3373   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3374   SCM_ENTER_SUBR("u64vector-copy!");
3375   if (Scm_Length(SCM_OPTARGS) > 3)
3376     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3377   dst_scm = SCM_ARGREF(0);
3378   if (!SCM_U64VECTORP(dst_scm)) Scm_Error("<u64vector> required, but got %S", dst_scm);
3379   dst = SCM_U64VECTOR(dst_scm);
3380   dstart_scm = SCM_ARGREF(1);
3381   dstart = (dstart_scm);
3382   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
3383   else {
3384     src_scm = SCM_CAR(SCM_OPTARGS);
3385     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3386   }
3387   src = (src_scm);
3388   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
3389   else {
3390     sstart_scm = SCM_CAR(SCM_OPTARGS);
3391     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3392   }
3393   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
3394   sstart = Scm_GetInteger(sstart_scm);
3395   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
3396   else {
3397     send_scm = SCM_CAR(SCM_OPTARGS);
3398     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3399   }
3400   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
3401   send = Scm_GetInteger(send_scm);
3402   {
3403 if (SCM_INTEGERP(dstart)) {
3404      /* new API */
3405      if (!SCM_U64VECTORP(src)) {
3406        Scm_Error("u64vector-copy!: argument is not a matching uvector: %S",
3407                  src);
3408      }
3409      SCM_RETURN(Scm_U64VectorCopyX(dst, Scm_GetInteger(dstart), 
3410                                     SCM_U64VECTOR(src), sstart, send));
3411   } else if (SCM_U64VECTORP(dstart)) {
3412     /* old API */
3413     SCM_RETURN(Scm_U64VectorCopyX(dst, 0, SCM_U64VECTOR(dstart), 0, -1));
3414   } else {
3415     Scm_Error("integer required, but got %S", dstart);
3416     SCM_RETURN(SCM_UNDEFINED);
3417   }
3418   }
3419 }
3420 
3421 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_copyX__NAME, "u64vector-copy!", 15, 15);
3422 static SCM_DEFINE_SUBR(uvlib_u64vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_u64vector_copyX__NAME), uvlib_u64vector_copyX, NULL, NULL);
3423 
3424 static ScmObj uvlib_u64vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3425 {
3426   ScmObj v_scm;
3427   ScmU64Vector* v;
3428   ScmObj start_scm;
3429   int start;
3430   ScmObj end_scm;
3431   int end;
3432   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3433   SCM_ENTER_SUBR("u64vector->list");
3434   if (Scm_Length(SCM_OPTARGS) > 2)
3435     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3436   v_scm = SCM_ARGREF(0);
3437   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3438   v = SCM_U64VECTOR(v_scm);
3439   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3440   else {
3441     start_scm = SCM_CAR(SCM_OPTARGS);
3442     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3443   }
3444   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3445   start = SCM_INT_VALUE(start_scm);
3446   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3447   else {
3448     end_scm = SCM_CAR(SCM_OPTARGS);
3449     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3450   }
3451   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3452   end = SCM_INT_VALUE(end_scm);
3453   {
3454 {
3455 ScmObj SCM_RESULT;
3456 SCM_RESULT = Scm_U64VectorToList(v, start, end);
3457 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3458 }
3459   }
3460 }
3461 
3462 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_TOlist__NAME, "u64vector->list", 15, 15);
3463 static SCM_DEFINE_SUBR(uvlib_u64vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_u64vector_TOlist__NAME), uvlib_u64vector_TOlist, NULL, NULL);
3464 
3465 static ScmObj uvlib_list_TOu64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3466 {
3467   ScmObj l_scm;
3468   ScmObj l;
3469   ScmObj clamp_scm;
3470   ScmObj clamp;
3471   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3472   SCM_ENTER_SUBR("list->u64vector");
3473   if (Scm_Length(SCM_OPTARGS) > 1)
3474     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3475   l_scm = SCM_ARGREF(0);
3476   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
3477   l = (l_scm);
3478   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3479   else {
3480     clamp_scm = SCM_CAR(SCM_OPTARGS);
3481     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3482   }
3483   clamp = (clamp_scm);
3484   {
3485 SCM_RETURN(Scm_ListToU64Vector(l, clamp_arg(clamp)));
3486   }
3487 }
3488 
3489 static SCM_DEFINE_STRING_CONST(uvlib_list_TOu64vector__NAME, "list->u64vector", 15, 15);
3490 static SCM_DEFINE_SUBR(uvlib_list_TOu64vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOu64vector__NAME), uvlib_list_TOu64vector, NULL, NULL);
3491 
3492 static ScmObj uvlib_u64vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3493 {
3494   ScmObj v_scm;
3495   ScmU64Vector* v;
3496   ScmObj val_scm;
3497   ScmObj val;
3498   ScmObj start_scm;
3499   int start;
3500   ScmObj end_scm;
3501   int end;
3502   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3503   SCM_ENTER_SUBR("u64vector-fill!");
3504   if (Scm_Length(SCM_OPTARGS) > 2)
3505     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3506   v_scm = SCM_ARGREF(0);
3507   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3508   v = SCM_U64VECTOR(v_scm);
3509   val_scm = SCM_ARGREF(1);
3510   val = (val_scm);
3511   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3512   else {
3513     start_scm = SCM_CAR(SCM_OPTARGS);
3514     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3515   }
3516   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3517   start = SCM_INT_VALUE(start_scm);
3518   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3519   else {
3520     end_scm = SCM_CAR(SCM_OPTARGS);
3521     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3522   }
3523   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3524   end = SCM_INT_VALUE(end_scm);
3525   {
3526 ScmUInt64 filler;
3527   filler = Scm_GetIntegerU64Clamp(val, SCM_CLAMP_ERROR, NULL);
3528   SCM_RETURN(Scm_U64VectorFill(v, filler, start, end));
3529   }
3530 }
3531 
3532 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_fillX__NAME, "u64vector-fill!", 15, 15);
3533 static SCM_DEFINE_SUBR(uvlib_u64vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_u64vector_fillX__NAME), uvlib_u64vector_fillX, NULL, NULL);
3534 
3535 static ScmObj uvlib_u64vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3536 {
3537   ScmObj v_scm;
3538   ScmU64Vector* v;
3539   ScmObj start_scm;
3540   int start;
3541   ScmObj end_scm;
3542   int end;
3543   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3544   SCM_ENTER_SUBR("u64vector->vector");
3545   if (Scm_Length(SCM_OPTARGS) > 2)
3546     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3547   v_scm = SCM_ARGREF(0);
3548   if (!SCM_U64VECTORP(v_scm)) Scm_Error("<u64vector> required, but got %S", v_scm);
3549   v = SCM_U64VECTOR(v_scm);
3550   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3551   else {
3552     start_scm = SCM_CAR(SCM_OPTARGS);
3553     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3554   }
3555   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3556   start = SCM_INT_VALUE(start_scm);
3557   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3558   else {
3559     end_scm = SCM_CAR(SCM_OPTARGS);
3560     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3561   }
3562   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3563   end = SCM_INT_VALUE(end_scm);
3564   {
3565 {
3566 ScmObj SCM_RESULT;
3567 SCM_RESULT = Scm_U64VectorToVector(v, start, end);
3568 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3569 }
3570   }
3571 }
3572 
3573 static SCM_DEFINE_STRING_CONST(uvlib_u64vector_TOvector__NAME, "u64vector->vector", 17, 17);
3574 static SCM_DEFINE_SUBR(uvlib_u64vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_u64vector_TOvector__NAME), uvlib_u64vector_TOvector, NULL, NULL);
3575 
3576 static ScmObj uvlib_vector_TOu64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3577 {
3578   ScmObj v_scm;
3579   ScmVector* v;
3580   ScmObj start_scm;
3581   int start;
3582   ScmObj end_scm;
3583   int end;
3584   ScmObj clamp_scm;
3585   ScmObj clamp;
3586   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3587   SCM_ENTER_SUBR("vector->u64vector");
3588   if (Scm_Length(SCM_OPTARGS) > 3)
3589     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3590   v_scm = SCM_ARGREF(0);
3591   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
3592   v = SCM_VECTOR(v_scm);
3593   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3594   else {
3595     start_scm = SCM_CAR(SCM_OPTARGS);
3596     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3597   }
3598   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3599   start = SCM_INT_VALUE(start_scm);
3600   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3601   else {
3602     end_scm = SCM_CAR(SCM_OPTARGS);
3603     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3604   }
3605   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3606   end = SCM_INT_VALUE(end_scm);
3607   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3608   else {
3609     clamp_scm = SCM_CAR(SCM_OPTARGS);
3610     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3611   }
3612   clamp = (clamp_scm);
3613   {
3614 SCM_RETURN(Scm_VectorToU64Vector(v, start, end, clamp_arg(clamp)));
3615   }
3616 }
3617 
3618 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOu64vector__NAME, "vector->u64vector", 17, 17);
3619 static SCM_DEFINE_SUBR(uvlib_vector_TOu64vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOu64vector__NAME), uvlib_vector_TOu64vector, NULL, NULL);
3620 
3621 static ScmObj uvlib_f32vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3622 {
3623   ScmObj obj_scm;
3624   ScmObj obj;
3625   SCM_ENTER_SUBR("f32vector?");
3626   obj_scm = SCM_ARGREF(0);
3627   obj = (obj_scm);
3628   {
3629 {
3630 int SCM_RESULT;
3631 SCM_RESULT = SCM_F32VECTORP(obj);
3632 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
3633 }
3634   }
3635 }
3636 
3637 static SCM_DEFINE_STRING_CONST(uvlib_f32vectorP__NAME, "f32vector?", 10, 10);
3638 static SCM_DEFINE_SUBR(uvlib_f32vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_f32vectorP__NAME), uvlib_f32vectorP, NULL, NULL);
3639 
3640 static ScmObj uvlib_make_f32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3641 {
3642   ScmObj length_scm;
3643   int length;
3644   ScmObj fill_scm;
3645   ScmObj fill;
3646   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3647   SCM_ENTER_SUBR("make-f32vector");
3648   if (Scm_Length(SCM_OPTARGS) > 1)
3649     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3650   length_scm = SCM_ARGREF(0);
3651   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
3652   length = SCM_INT_VALUE(length_scm);
3653   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
3654   else {
3655     fill_scm = SCM_CAR(SCM_OPTARGS);
3656     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3657   }
3658   fill = (fill_scm);
3659   {
3660 float filler;
3661   filler = (float)Scm_GetDouble(fill);
3662   SCM_RETURN(Scm_MakeF32Vector(length, filler));
3663   }
3664 }
3665 
3666 static SCM_DEFINE_STRING_CONST(uvlib_make_f32vector__NAME, "make-f32vector", 14, 14);
3667 static SCM_DEFINE_SUBR(uvlib_make_f32vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_f32vector__NAME), uvlib_make_f32vector, NULL, NULL);
3668 
3669 static ScmObj uvlib_f32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3670 {
3671   ScmObj args_scm;
3672   ScmObj args;
3673   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3674   SCM_ENTER_SUBR("f32vector");
3675   args_scm = SCM_OPTARGS;
3676   args = (args_scm);
3677   {
3678 SCM_RETURN(Scm_ListToF32Vector(args, SCM_CLAMP_ERROR));
3679   }
3680 }
3681 
3682 static SCM_DEFINE_STRING_CONST(uvlib_f32vector__NAME, "f32vector", 9, 9);
3683 static SCM_DEFINE_SUBR(uvlib_f32vector__STUB, 0, 1, SCM_OBJ(&uvlib_f32vector__NAME), uvlib_f32vector, NULL, NULL);
3684 
3685 static ScmObj uvlib_f32vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3686 {
3687   ScmObj v_scm;
3688   ScmF32Vector* v;
3689   SCM_ENTER_SUBR("f32vector-length");
3690   v_scm = SCM_ARGREF(0);
3691   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3692   v = SCM_F32VECTOR(v_scm);
3693   {
3694 SCM_RETURN(SCM_MAKE_INT(SCM_F32VECTOR_SIZE(v)));
3695   }
3696 }
3697 
3698 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_length__NAME, "f32vector-length", 16, 16);
3699 static SCM_DEFINE_SUBR(uvlib_f32vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_f32vector_length__NAME), uvlib_f32vector_length, NULL, NULL);
3700 
3701 static ScmObj uvlib_f32vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3702 {
3703   ScmObj v_scm;
3704   ScmF32Vector* v;
3705   ScmObj i_scm;
3706   int i;
3707   ScmObj fallback_scm;
3708   ScmObj fallback;
3709   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3710   SCM_ENTER_SUBR("f32vector-ref");
3711   if (Scm_Length(SCM_OPTARGS) > 1)
3712     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3713   v_scm = SCM_ARGREF(0);
3714   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3715   v = SCM_F32VECTOR(v_scm);
3716   i_scm = SCM_ARGREF(1);
3717   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
3718   i = SCM_INT_VALUE(i_scm);
3719   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
3720   else {
3721     fallback_scm = SCM_CAR(SCM_OPTARGS);
3722     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3723   }
3724   fallback = (fallback_scm);
3725   {
3726 SCM_RETURN(Scm_F32VectorRef(v, i, fallback));
3727   }
3728 }
3729 
3730 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_ref__NAME, "f32vector-ref", 13, 13);
3731 static SCM_DEFINE_SUBR(uvlib_f32vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_f32vector_ref__NAME), uvlib_f32vector_ref, NULL, NULL);
3732 
3733 static ScmObj uvlib_f32vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3734 {
3735   ScmObj v_scm;
3736   ScmF32Vector* v;
3737   ScmObj i_scm;
3738   int i;
3739   ScmObj val_scm;
3740   ScmObj val;
3741   ScmObj clamp_scm;
3742   ScmObj clamp;
3743   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3744   SCM_ENTER_SUBR("f32vector-set!");
3745   if (Scm_Length(SCM_OPTARGS) > 1)
3746     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3747   v_scm = SCM_ARGREF(0);
3748   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3749   v = SCM_F32VECTOR(v_scm);
3750   i_scm = SCM_ARGREF(1);
3751   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
3752   i = SCM_INT_VALUE(i_scm);
3753   val_scm = SCM_ARGREF(2);
3754   val = (val_scm);
3755   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3756   else {
3757     clamp_scm = SCM_CAR(SCM_OPTARGS);
3758     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3759   }
3760   clamp = (clamp_scm);
3761   {
3762 SCM_RETURN(Scm_F32VectorSet(v, i, val, clamp_arg(clamp)));
3763   }
3764 }
3765 
3766 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_setX__NAME, "f32vector-set!", 14, 14);
3767 static SCM_DEFINE_SUBR(uvlib_f32vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_f32vector_setX__NAME), uvlib_f32vector_setX, NULL, NULL);
3768 
3769 static ScmObj uvlib_f32vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3770 {
3771   ScmObj v_scm;
3772   ScmF32Vector* v;
3773   ScmObj start_scm;
3774   int start;
3775   ScmObj end_scm;
3776   int end;
3777   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3778   SCM_ENTER_SUBR("f32vector-copy");
3779   if (Scm_Length(SCM_OPTARGS) > 2)
3780     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3781   v_scm = SCM_ARGREF(0);
3782   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3783   v = SCM_F32VECTOR(v_scm);
3784   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3785   else {
3786     start_scm = SCM_CAR(SCM_OPTARGS);
3787     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3788   }
3789   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3790   start = SCM_INT_VALUE(start_scm);
3791   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3792   else {
3793     end_scm = SCM_CAR(SCM_OPTARGS);
3794     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3795   }
3796   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3797   end = SCM_INT_VALUE(end_scm);
3798   {
3799 {
3800 ScmObj SCM_RESULT;
3801 SCM_RESULT = Scm_F32VectorCopy(v, start, end);
3802 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3803 }
3804   }
3805 }
3806 
3807 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_copy__NAME, "f32vector-copy", 14, 14);
3808 static SCM_DEFINE_SUBR(uvlib_f32vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_f32vector_copy__NAME), uvlib_f32vector_copy, NULL, NULL);
3809 
3810 static ScmObj uvlib_f32vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3811 {
3812   ScmObj dst_scm;
3813   ScmF32Vector* dst;
3814   ScmObj dstart_scm;
3815   ScmObj dstart;
3816   ScmObj src_scm;
3817   ScmObj src;
3818   ScmObj sstart_scm;
3819   int sstart;
3820   ScmObj send_scm;
3821   int send;
3822   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3823   SCM_ENTER_SUBR("f32vector-copy!");
3824   if (Scm_Length(SCM_OPTARGS) > 3)
3825     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3826   dst_scm = SCM_ARGREF(0);
3827   if (!SCM_F32VECTORP(dst_scm)) Scm_Error("<f32vector> required, but got %S", dst_scm);
3828   dst = SCM_F32VECTOR(dst_scm);
3829   dstart_scm = SCM_ARGREF(1);
3830   dstart = (dstart_scm);
3831   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
3832   else {
3833     src_scm = SCM_CAR(SCM_OPTARGS);
3834     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3835   }
3836   src = (src_scm);
3837   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
3838   else {
3839     sstart_scm = SCM_CAR(SCM_OPTARGS);
3840     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3841   }
3842   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
3843   sstart = Scm_GetInteger(sstart_scm);
3844   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
3845   else {
3846     send_scm = SCM_CAR(SCM_OPTARGS);
3847     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3848   }
3849   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
3850   send = Scm_GetInteger(send_scm);
3851   {
3852 if (SCM_INTEGERP(dstart)) {
3853      /* new API */
3854      if (!SCM_F32VECTORP(src)) {
3855        Scm_Error("f32vector-copy!: argument is not a matching uvector: %S",
3856                  src);
3857      }
3858      SCM_RETURN(Scm_F32VectorCopyX(dst, Scm_GetInteger(dstart), 
3859                                     SCM_F32VECTOR(src), sstart, send));
3860   } else if (SCM_F32VECTORP(dstart)) {
3861     /* old API */
3862     SCM_RETURN(Scm_F32VectorCopyX(dst, 0, SCM_F32VECTOR(dstart), 0, -1));
3863   } else {
3864     Scm_Error("integer required, but got %S", dstart);
3865     SCM_RETURN(SCM_UNDEFINED);
3866   }
3867   }
3868 }
3869 
3870 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_copyX__NAME, "f32vector-copy!", 15, 15);
3871 static SCM_DEFINE_SUBR(uvlib_f32vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_f32vector_copyX__NAME), uvlib_f32vector_copyX, NULL, NULL);
3872 
3873 static ScmObj uvlib_f32vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3874 {
3875   ScmObj v_scm;
3876   ScmF32Vector* v;
3877   ScmObj start_scm;
3878   int start;
3879   ScmObj end_scm;
3880   int end;
3881   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3882   SCM_ENTER_SUBR("f32vector->list");
3883   if (Scm_Length(SCM_OPTARGS) > 2)
3884     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3885   v_scm = SCM_ARGREF(0);
3886   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3887   v = SCM_F32VECTOR(v_scm);
3888   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3889   else {
3890     start_scm = SCM_CAR(SCM_OPTARGS);
3891     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3892   }
3893   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3894   start = SCM_INT_VALUE(start_scm);
3895   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3896   else {
3897     end_scm = SCM_CAR(SCM_OPTARGS);
3898     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3899   }
3900   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3901   end = SCM_INT_VALUE(end_scm);
3902   {
3903 {
3904 ScmObj SCM_RESULT;
3905 SCM_RESULT = Scm_F32VectorToList(v, start, end);
3906 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
3907 }
3908   }
3909 }
3910 
3911 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_TOlist__NAME, "f32vector->list", 15, 15);
3912 static SCM_DEFINE_SUBR(uvlib_f32vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_f32vector_TOlist__NAME), uvlib_f32vector_TOlist, NULL, NULL);
3913 
3914 static ScmObj uvlib_list_TOf32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3915 {
3916   ScmObj l_scm;
3917   ScmObj l;
3918   ScmObj clamp_scm;
3919   ScmObj clamp;
3920   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3921   SCM_ENTER_SUBR("list->f32vector");
3922   if (Scm_Length(SCM_OPTARGS) > 1)
3923     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3924   l_scm = SCM_ARGREF(0);
3925   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
3926   l = (l_scm);
3927   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
3928   else {
3929     clamp_scm = SCM_CAR(SCM_OPTARGS);
3930     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3931   }
3932   clamp = (clamp_scm);
3933   {
3934 SCM_RETURN(Scm_ListToF32Vector(l, clamp_arg(clamp)));
3935   }
3936 }
3937 
3938 static SCM_DEFINE_STRING_CONST(uvlib_list_TOf32vector__NAME, "list->f32vector", 15, 15);
3939 static SCM_DEFINE_SUBR(uvlib_list_TOf32vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOf32vector__NAME), uvlib_list_TOf32vector, NULL, NULL);
3940 
3941 static ScmObj uvlib_f32vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3942 {
3943   ScmObj v_scm;
3944   ScmF32Vector* v;
3945   ScmObj val_scm;
3946   ScmObj val;
3947   ScmObj start_scm;
3948   int start;
3949   ScmObj end_scm;
3950   int end;
3951   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3952   SCM_ENTER_SUBR("f32vector-fill!");
3953   if (Scm_Length(SCM_OPTARGS) > 2)
3954     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3955   v_scm = SCM_ARGREF(0);
3956   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3957   v = SCM_F32VECTOR(v_scm);
3958   val_scm = SCM_ARGREF(1);
3959   val = (val_scm);
3960   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
3961   else {
3962     start_scm = SCM_CAR(SCM_OPTARGS);
3963     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3964   }
3965   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
3966   start = SCM_INT_VALUE(start_scm);
3967   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
3968   else {
3969     end_scm = SCM_CAR(SCM_OPTARGS);
3970     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
3971   }
3972   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
3973   end = SCM_INT_VALUE(end_scm);
3974   {
3975 float filler;
3976   filler = (float)Scm_GetDouble(val);
3977   SCM_RETURN(Scm_F32VectorFill(v, filler, start, end));
3978   }
3979 }
3980 
3981 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_fillX__NAME, "f32vector-fill!", 15, 15);
3982 static SCM_DEFINE_SUBR(uvlib_f32vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_f32vector_fillX__NAME), uvlib_f32vector_fillX, NULL, NULL);
3983 
3984 static ScmObj uvlib_f32vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
3985 {
3986   ScmObj v_scm;
3987   ScmF32Vector* v;
3988   ScmObj start_scm;
3989   int start;
3990   ScmObj end_scm;
3991   int end;
3992   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
3993   SCM_ENTER_SUBR("f32vector->vector");
3994   if (Scm_Length(SCM_OPTARGS) > 2)
3995     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
3996   v_scm = SCM_ARGREF(0);
3997   if (!SCM_F32VECTORP(v_scm)) Scm_Error("<f32vector> required, but got %S", v_scm);
3998   v = SCM_F32VECTOR(v_scm);
3999   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4000   else {
4001     start_scm = SCM_CAR(SCM_OPTARGS);
4002     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4003   }
4004   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4005   start = SCM_INT_VALUE(start_scm);
4006   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4007   else {
4008     end_scm = SCM_CAR(SCM_OPTARGS);
4009     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4010   }
4011   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4012   end = SCM_INT_VALUE(end_scm);
4013   {
4014 {
4015 ScmObj SCM_RESULT;
4016 SCM_RESULT = Scm_F32VectorToVector(v, start, end);
4017 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
4018 }
4019   }
4020 }
4021 
4022 static SCM_DEFINE_STRING_CONST(uvlib_f32vector_TOvector__NAME, "f32vector->vector", 17, 17);
4023 static SCM_DEFINE_SUBR(uvlib_f32vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_f32vector_TOvector__NAME), uvlib_f32vector_TOvector, NULL, NULL);
4024 
4025 static ScmObj uvlib_vector_TOf32vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4026 {
4027   ScmObj v_scm;
4028   ScmVector* v;
4029   ScmObj start_scm;
4030   int start;
4031   ScmObj end_scm;
4032   int end;
4033   ScmObj clamp_scm;
4034   ScmObj clamp;
4035   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4036   SCM_ENTER_SUBR("vector->f32vector");
4037   if (Scm_Length(SCM_OPTARGS) > 3)
4038     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4039   v_scm = SCM_ARGREF(0);
4040   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
4041   v = SCM_VECTOR(v_scm);
4042   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4043   else {
4044     start_scm = SCM_CAR(SCM_OPTARGS);
4045     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4046   }
4047   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4048   start = SCM_INT_VALUE(start_scm);
4049   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4050   else {
4051     end_scm = SCM_CAR(SCM_OPTARGS);
4052     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4053   }
4054   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4055   end = SCM_INT_VALUE(end_scm);
4056   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4057   else {
4058     clamp_scm = SCM_CAR(SCM_OPTARGS);
4059     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4060   }
4061   clamp = (clamp_scm);
4062   {
4063 SCM_RETURN(Scm_VectorToF32Vector(v, start, end, clamp_arg(clamp)));
4064   }
4065 }
4066 
4067 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOf32vector__NAME, "vector->f32vector", 17, 17);
4068 static SCM_DEFINE_SUBR(uvlib_vector_TOf32vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOf32vector__NAME), uvlib_vector_TOf32vector, NULL, NULL);
4069 
4070 static ScmObj uvlib_f64vectorP(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4071 {
4072   ScmObj obj_scm;
4073   ScmObj obj;
4074   SCM_ENTER_SUBR("f64vector?");
4075   obj_scm = SCM_ARGREF(0);
4076   obj = (obj_scm);
4077   {
4078 {
4079 int SCM_RESULT;
4080 SCM_RESULT = SCM_F64VECTORP(obj);
4081 SCM_RETURN(SCM_MAKE_BOOL(SCM_RESULT));
4082 }
4083   }
4084 }
4085 
4086 static SCM_DEFINE_STRING_CONST(uvlib_f64vectorP__NAME, "f64vector?", 10, 10);
4087 static SCM_DEFINE_SUBR(uvlib_f64vectorP__STUB, 1, 0, SCM_OBJ(&uvlib_f64vectorP__NAME), uvlib_f64vectorP, NULL, NULL);
4088 
4089 static ScmObj uvlib_make_f64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4090 {
4091   ScmObj length_scm;
4092   int length;
4093   ScmObj fill_scm;
4094   ScmObj fill;
4095   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4096   SCM_ENTER_SUBR("make-f64vector");
4097   if (Scm_Length(SCM_OPTARGS) > 1)
4098     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4099   length_scm = SCM_ARGREF(0);
4100   if (!SCM_INTP(length_scm)) Scm_Error("small integer required, but got %S", length_scm);
4101   length = SCM_INT_VALUE(length_scm);
4102   if (SCM_NULLP(SCM_OPTARGS)) fill_scm = Scm_MakeInteger(0);
4103   else {
4104     fill_scm = SCM_CAR(SCM_OPTARGS);
4105     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4106   }
4107   fill = (fill_scm);
4108   {
4109 double filler;
4110   filler = Scm_GetDouble(fill);
4111   SCM_RETURN(Scm_MakeF64Vector(length, filler));
4112   }
4113 }
4114 
4115 static SCM_DEFINE_STRING_CONST(uvlib_make_f64vector__NAME, "make-f64vector", 14, 14);
4116 static SCM_DEFINE_SUBR(uvlib_make_f64vector__STUB, 1, 1, SCM_OBJ(&uvlib_make_f64vector__NAME), uvlib_make_f64vector, NULL, NULL);
4117 
4118 static ScmObj uvlib_f64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4119 {
4120   ScmObj args_scm;
4121   ScmObj args;
4122   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4123   SCM_ENTER_SUBR("f64vector");
4124   args_scm = SCM_OPTARGS;
4125   args = (args_scm);
4126   {
4127 SCM_RETURN(Scm_ListToF64Vector(args, SCM_CLAMP_ERROR));
4128   }
4129 }
4130 
4131 static SCM_DEFINE_STRING_CONST(uvlib_f64vector__NAME, "f64vector", 9, 9);
4132 static SCM_DEFINE_SUBR(uvlib_f64vector__STUB, 0, 1, SCM_OBJ(&uvlib_f64vector__NAME), uvlib_f64vector, NULL, NULL);
4133 
4134 static ScmObj uvlib_f64vector_length(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4135 {
4136   ScmObj v_scm;
4137   ScmF64Vector* v;
4138   SCM_ENTER_SUBR("f64vector-length");
4139   v_scm = SCM_ARGREF(0);
4140   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4141   v = SCM_F64VECTOR(v_scm);
4142   {
4143 SCM_RETURN(SCM_MAKE_INT(SCM_F64VECTOR_SIZE(v)));
4144   }
4145 }
4146 
4147 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_length__NAME, "f64vector-length", 16, 16);
4148 static SCM_DEFINE_SUBR(uvlib_f64vector_length__STUB, 1, 0, SCM_OBJ(&uvlib_f64vector_length__NAME), uvlib_f64vector_length, NULL, NULL);
4149 
4150 static ScmObj uvlib_f64vector_ref(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4151 {
4152   ScmObj v_scm;
4153   ScmF64Vector* v;
4154   ScmObj i_scm;
4155   int i;
4156   ScmObj fallback_scm;
4157   ScmObj fallback;
4158   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4159   SCM_ENTER_SUBR("f64vector-ref");
4160   if (Scm_Length(SCM_OPTARGS) > 1)
4161     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4162   v_scm = SCM_ARGREF(0);
4163   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4164   v = SCM_F64VECTOR(v_scm);
4165   i_scm = SCM_ARGREF(1);
4166   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
4167   i = SCM_INT_VALUE(i_scm);
4168   if (SCM_NULLP(SCM_OPTARGS)) fallback_scm = SCM_UNBOUND;
4169   else {
4170     fallback_scm = SCM_CAR(SCM_OPTARGS);
4171     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4172   }
4173   fallback = (fallback_scm);
4174   {
4175 SCM_RETURN(Scm_F64VectorRef(v, i, fallback));
4176   }
4177 }
4178 
4179 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_ref__NAME, "f64vector-ref", 13, 13);
4180 static SCM_DEFINE_SUBR(uvlib_f64vector_ref__STUB, 2, 1, SCM_OBJ(&uvlib_f64vector_ref__NAME), uvlib_f64vector_ref, NULL, NULL);
4181 
4182 static ScmObj uvlib_f64vector_setX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4183 {
4184   ScmObj v_scm;
4185   ScmF64Vector* v;
4186   ScmObj i_scm;
4187   int i;
4188   ScmObj val_scm;
4189   ScmObj val;
4190   ScmObj clamp_scm;
4191   ScmObj clamp;
4192   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4193   SCM_ENTER_SUBR("f64vector-set!");
4194   if (Scm_Length(SCM_OPTARGS) > 1)
4195     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4196   v_scm = SCM_ARGREF(0);
4197   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4198   v = SCM_F64VECTOR(v_scm);
4199   i_scm = SCM_ARGREF(1);
4200   if (!SCM_INTP(i_scm)) Scm_Error("small integer required, but got %S", i_scm);
4201   i = SCM_INT_VALUE(i_scm);
4202   val_scm = SCM_ARGREF(2);
4203   val = (val_scm);
4204   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4205   else {
4206     clamp_scm = SCM_CAR(SCM_OPTARGS);
4207     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4208   }
4209   clamp = (clamp_scm);
4210   {
4211 SCM_RETURN(Scm_F64VectorSet(v, i, val, clamp_arg(clamp)));
4212   }
4213 }
4214 
4215 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_setX__NAME, "f64vector-set!", 14, 14);
4216 static SCM_DEFINE_SUBR(uvlib_f64vector_setX__STUB, 3, 1, SCM_OBJ(&uvlib_f64vector_setX__NAME), uvlib_f64vector_setX, NULL, NULL);
4217 
4218 static ScmObj uvlib_f64vector_copy(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4219 {
4220   ScmObj v_scm;
4221   ScmF64Vector* v;
4222   ScmObj start_scm;
4223   int start;
4224   ScmObj end_scm;
4225   int end;
4226   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4227   SCM_ENTER_SUBR("f64vector-copy");
4228   if (Scm_Length(SCM_OPTARGS) > 2)
4229     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4230   v_scm = SCM_ARGREF(0);
4231   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4232   v = SCM_F64VECTOR(v_scm);
4233   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4234   else {
4235     start_scm = SCM_CAR(SCM_OPTARGS);
4236     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4237   }
4238   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4239   start = SCM_INT_VALUE(start_scm);
4240   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4241   else {
4242     end_scm = SCM_CAR(SCM_OPTARGS);
4243     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4244   }
4245   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4246   end = SCM_INT_VALUE(end_scm);
4247   {
4248 {
4249 ScmObj SCM_RESULT;
4250 SCM_RESULT = Scm_F64VectorCopy(v, start, end);
4251 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
4252 }
4253   }
4254 }
4255 
4256 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_copy__NAME, "f64vector-copy", 14, 14);
4257 static SCM_DEFINE_SUBR(uvlib_f64vector_copy__STUB, 1, 1, SCM_OBJ(&uvlib_f64vector_copy__NAME), uvlib_f64vector_copy, NULL, NULL);
4258 
4259 static ScmObj uvlib_f64vector_copyX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4260 {
4261   ScmObj dst_scm;
4262   ScmF64Vector* dst;
4263   ScmObj dstart_scm;
4264   ScmObj dstart;
4265   ScmObj src_scm;
4266   ScmObj src;
4267   ScmObj sstart_scm;
4268   int sstart;
4269   ScmObj send_scm;
4270   int send;
4271   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4272   SCM_ENTER_SUBR("f64vector-copy!");
4273   if (Scm_Length(SCM_OPTARGS) > 3)
4274     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4275   dst_scm = SCM_ARGREF(0);
4276   if (!SCM_F64VECTORP(dst_scm)) Scm_Error("<f64vector> required, but got %S", dst_scm);
4277   dst = SCM_F64VECTOR(dst_scm);
4278   dstart_scm = SCM_ARGREF(1);
4279   dstart = (dstart_scm);
4280   if (SCM_NULLP(SCM_OPTARGS)) src_scm = SCM_UNBOUND;
4281   else {
4282     src_scm = SCM_CAR(SCM_OPTARGS);
4283     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4284   }
4285   src = (src_scm);
4286   if (SCM_NULLP(SCM_OPTARGS)) sstart_scm = Scm_MakeInteger(0);
4287   else {
4288     sstart_scm = SCM_CAR(SCM_OPTARGS);
4289     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4290   }
4291   if (!SCM_EXACTP(sstart_scm)) Scm_Error("C integer required, but got %S", sstart_scm);
4292   sstart = Scm_GetInteger(sstart_scm);
4293   if (SCM_NULLP(SCM_OPTARGS)) send_scm = Scm_MakeInteger(-1);
4294   else {
4295     send_scm = SCM_CAR(SCM_OPTARGS);
4296     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4297   }
4298   if (!SCM_EXACTP(send_scm)) Scm_Error("C integer required, but got %S", send_scm);
4299   send = Scm_GetInteger(send_scm);
4300   {
4301 if (SCM_INTEGERP(dstart)) {
4302      /* new API */
4303      if (!SCM_F64VECTORP(src)) {
4304        Scm_Error("f64vector-copy!: argument is not a matching uvector: %S",
4305                  src);
4306      }
4307      SCM_RETURN(Scm_F64VectorCopyX(dst, Scm_GetInteger(dstart), 
4308                                     SCM_F64VECTOR(src), sstart, send));
4309   } else if (SCM_F64VECTORP(dstart)) {
4310     /* old API */
4311     SCM_RETURN(Scm_F64VectorCopyX(dst, 0, SCM_F64VECTOR(dstart), 0, -1));
4312   } else {
4313     Scm_Error("integer required, but got %S", dstart);
4314     SCM_RETURN(SCM_UNDEFINED);
4315   }
4316   }
4317 }
4318 
4319 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_copyX__NAME, "f64vector-copy!", 15, 15);
4320 static SCM_DEFINE_SUBR(uvlib_f64vector_copyX__STUB, 2, 1, SCM_OBJ(&uvlib_f64vector_copyX__NAME), uvlib_f64vector_copyX, NULL, NULL);
4321 
4322 static ScmObj uvlib_f64vector_TOlist(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4323 {
4324   ScmObj v_scm;
4325   ScmF64Vector* v;
4326   ScmObj start_scm;
4327   int start;
4328   ScmObj end_scm;
4329   int end;
4330   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4331   SCM_ENTER_SUBR("f64vector->list");
4332   if (Scm_Length(SCM_OPTARGS) > 2)
4333     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4334   v_scm = SCM_ARGREF(0);
4335   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4336   v = SCM_F64VECTOR(v_scm);
4337   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4338   else {
4339     start_scm = SCM_CAR(SCM_OPTARGS);
4340     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4341   }
4342   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4343   start = SCM_INT_VALUE(start_scm);
4344   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4345   else {
4346     end_scm = SCM_CAR(SCM_OPTARGS);
4347     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4348   }
4349   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4350   end = SCM_INT_VALUE(end_scm);
4351   {
4352 {
4353 ScmObj SCM_RESULT;
4354 SCM_RESULT = Scm_F64VectorToList(v, start, end);
4355 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
4356 }
4357   }
4358 }
4359 
4360 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_TOlist__NAME, "f64vector->list", 15, 15);
4361 static SCM_DEFINE_SUBR(uvlib_f64vector_TOlist__STUB, 1, 1, SCM_OBJ(&uvlib_f64vector_TOlist__NAME), uvlib_f64vector_TOlist, NULL, NULL);
4362 
4363 static ScmObj uvlib_list_TOf64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4364 {
4365   ScmObj l_scm;
4366   ScmObj l;
4367   ScmObj clamp_scm;
4368   ScmObj clamp;
4369   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4370   SCM_ENTER_SUBR("list->f64vector");
4371   if (Scm_Length(SCM_OPTARGS) > 1)
4372     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4373   l_scm = SCM_ARGREF(0);
4374   if (!SCM_LISTP(l_scm)) Scm_Error("list required, but got %S", l_scm);
4375   l = (l_scm);
4376   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4377   else {
4378     clamp_scm = SCM_CAR(SCM_OPTARGS);
4379     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4380   }
4381   clamp = (clamp_scm);
4382   {
4383 SCM_RETURN(Scm_ListToF64Vector(l, clamp_arg(clamp)));
4384   }
4385 }
4386 
4387 static SCM_DEFINE_STRING_CONST(uvlib_list_TOf64vector__NAME, "list->f64vector", 15, 15);
4388 static SCM_DEFINE_SUBR(uvlib_list_TOf64vector__STUB, 1, 1, SCM_OBJ(&uvlib_list_TOf64vector__NAME), uvlib_list_TOf64vector, NULL, NULL);
4389 
4390 static ScmObj uvlib_f64vector_fillX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4391 {
4392   ScmObj v_scm;
4393   ScmF64Vector* v;
4394   ScmObj val_scm;
4395   ScmObj val;
4396   ScmObj start_scm;
4397   int start;
4398   ScmObj end_scm;
4399   int end;
4400   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4401   SCM_ENTER_SUBR("f64vector-fill!");
4402   if (Scm_Length(SCM_OPTARGS) > 2)
4403     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4404   v_scm = SCM_ARGREF(0);
4405   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4406   v = SCM_F64VECTOR(v_scm);
4407   val_scm = SCM_ARGREF(1);
4408   val = (val_scm);
4409   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4410   else {
4411     start_scm = SCM_CAR(SCM_OPTARGS);
4412     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4413   }
4414   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4415   start = SCM_INT_VALUE(start_scm);
4416   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4417   else {
4418     end_scm = SCM_CAR(SCM_OPTARGS);
4419     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4420   }
4421   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4422   end = SCM_INT_VALUE(end_scm);
4423   {
4424 double filler;
4425   filler = Scm_GetDouble(val);
4426   SCM_RETURN(Scm_F64VectorFill(v, filler, start, end));
4427   }
4428 }
4429 
4430 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_fillX__NAME, "f64vector-fill!", 15, 15);
4431 static SCM_DEFINE_SUBR(uvlib_f64vector_fillX__STUB, 2, 1, SCM_OBJ(&uvlib_f64vector_fillX__NAME), uvlib_f64vector_fillX, NULL, NULL);
4432 
4433 static ScmObj uvlib_f64vector_TOvector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4434 {
4435   ScmObj v_scm;
4436   ScmF64Vector* v;
4437   ScmObj start_scm;
4438   int start;
4439   ScmObj end_scm;
4440   int end;
4441   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4442   SCM_ENTER_SUBR("f64vector->vector");
4443   if (Scm_Length(SCM_OPTARGS) > 2)
4444     Scm_Error("too many arguments: up to 2 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4445   v_scm = SCM_ARGREF(0);
4446   if (!SCM_F64VECTORP(v_scm)) Scm_Error("<f64vector> required, but got %S", v_scm);
4447   v = SCM_F64VECTOR(v_scm);
4448   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4449   else {
4450     start_scm = SCM_CAR(SCM_OPTARGS);
4451     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4452   }
4453   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4454   start = SCM_INT_VALUE(start_scm);
4455   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4456   else {
4457     end_scm = SCM_CAR(SCM_OPTARGS);
4458     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4459   }
4460   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4461   end = SCM_INT_VALUE(end_scm);
4462   {
4463 {
4464 ScmObj SCM_RESULT;
4465 SCM_RESULT = Scm_F64VectorToVector(v, start, end);
4466 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
4467 }
4468   }
4469 }
4470 
4471 static SCM_DEFINE_STRING_CONST(uvlib_f64vector_TOvector__NAME, "f64vector->vector", 17, 17);
4472 static SCM_DEFINE_SUBR(uvlib_f64vector_TOvector__STUB, 1, 1, SCM_OBJ(&uvlib_f64vector_TOvector__NAME), uvlib_f64vector_TOvector, NULL, NULL);
4473 
4474 static ScmObj uvlib_vector_TOf64vector(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4475 {
4476   ScmObj v_scm;
4477   ScmVector* v;
4478   ScmObj start_scm;
4479   int start;
4480   ScmObj end_scm;
4481   int end;
4482   ScmObj clamp_scm;
4483   ScmObj clamp;
4484   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4485   SCM_ENTER_SUBR("vector->f64vector");
4486   if (Scm_Length(SCM_OPTARGS) > 3)
4487     Scm_Error("too many arguments: up to 3 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4488   v_scm = SCM_ARGREF(0);
4489   if (!SCM_VECTORP(v_scm)) Scm_Error("vector required, but got %S", v_scm);
4490   v = SCM_VECTOR(v_scm);
4491   if (SCM_NULLP(SCM_OPTARGS)) start_scm = Scm_MakeInteger(0);
4492   else {
4493     start_scm = SCM_CAR(SCM_OPTARGS);
4494     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4495   }
4496   if (!SCM_INTP(start_scm)) Scm_Error("small integer required, but got %S", start_scm);
4497   start = SCM_INT_VALUE(start_scm);
4498   if (SCM_NULLP(SCM_OPTARGS)) end_scm = Scm_MakeInteger(-1);
4499   else {
4500     end_scm = SCM_CAR(SCM_OPTARGS);
4501     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4502   }
4503   if (!SCM_INTP(end_scm)) Scm_Error("small integer required, but got %S", end_scm);
4504   end = SCM_INT_VALUE(end_scm);
4505   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4506   else {
4507     clamp_scm = SCM_CAR(SCM_OPTARGS);
4508     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4509   }
4510   clamp = (clamp_scm);
4511   {
4512 SCM_RETURN(Scm_VectorToF64Vector(v, start, end, clamp_arg(clamp)));
4513   }
4514 }
4515 
4516 static SCM_DEFINE_STRING_CONST(uvlib_vector_TOf64vector__NAME, "vector->f64vector", 17, 17);
4517 static SCM_DEFINE_SUBR(uvlib_vector_TOf64vector__STUB, 1, 1, SCM_OBJ(&uvlib_vector_TOf64vector__NAME), uvlib_vector_TOf64vector, NULL, NULL);
4518 
4519 static ScmObj uvlib_s8vector_add(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4520 {
4521   ScmObj v0_scm;
4522   ScmS8Vector* v0;
4523   ScmObj v1_scm;
4524   ScmObj v1;
4525   ScmObj clamp_scm;
4526   ScmObj clamp;
4527   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4528   SCM_ENTER_SUBR("s8vector-add");
4529   if (Scm_Length(SCM_OPTARGS) > 1)
4530     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4531   v0_scm = SCM_ARGREF(0);
4532   if (!SCM_S8VECTORP(v0_scm)) Scm_Error("<s8vector> required, but got %S", v0_scm);
4533   v0 = SCM_S8VECTOR(v0_scm);
4534   v1_scm = SCM_ARGREF(1);
4535   v1 = (v1_scm);
4536   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4537   else {
4538     clamp_scm = SCM_CAR(SCM_OPTARGS);
4539     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4540   }
4541   clamp = (clamp_scm);
4542   {
4543 SCM_RETURN(Scm_S8VectorAdd(v0, v1, clamp_arg(clamp)));
4544   }
4545 }
4546 
4547 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_add__NAME, "s8vector-add", 12, 12);
4548 static SCM_DEFINE_SUBR(uvlib_s8vector_add__STUB, 2, 1, SCM_OBJ(&uvlib_s8vector_add__NAME), uvlib_s8vector_add, NULL, NULL);
4549 
4550 static ScmObj uvlib_s8vector_addX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4551 {
4552   ScmObj v0_scm;
4553   ScmS8Vector* v0;
4554   ScmObj v1_scm;
4555   ScmObj v1;
4556   ScmObj clamp_scm;
4557   ScmObj clamp;
4558   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4559   SCM_ENTER_SUBR("s8vector-add!");
4560   if (Scm_Length(SCM_OPTARGS) > 1)
4561     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4562   v0_scm = SCM_ARGREF(0);
4563   if (!SCM_S8VECTORP(v0_scm)) Scm_Error("<s8vector> required, but got %S", v0_scm);
4564   v0 = SCM_S8VECTOR(v0_scm);
4565   v1_scm = SCM_ARGREF(1);
4566   v1 = (v1_scm);
4567   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4568   else {
4569     clamp_scm = SCM_CAR(SCM_OPTARGS);
4570     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4571   }
4572   clamp = (clamp_scm);
4573   {
4574 SCM_RETURN(Scm_S8VectorAddX(v0, v1, clamp_arg(clamp)));
4575   }
4576 }
4577 
4578 static SCM_DEFINE_STRING_CONST(uvlib_s8vector_addX__NAME, "s8vector-add!", 13, 13);
4579 static SCM_DEFINE_SUBR(uvlib_s8vector_addX__STUB, 2, 1, SCM_OBJ(&uvlib_s8vector_addX__NAME), uvlib_s8vector_addX, NULL, NULL);
4580 
4581 static ScmObj uvlib_u8vector_add(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4582 {
4583   ScmObj v0_scm;
4584   ScmU8Vector* v0;
4585   ScmObj v1_scm;
4586   ScmObj v1;
4587   ScmObj clamp_scm;
4588   ScmObj clamp;
4589   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4590   SCM_ENTER_SUBR("u8vector-add");
4591   if (Scm_Length(SCM_OPTARGS) > 1)
4592     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4593   v0_scm = SCM_ARGREF(0);
4594   if (!SCM_U8VECTORP(v0_scm)) Scm_Error("<u8vector> required, but got %S", v0_scm);
4595   v0 = SCM_U8VECTOR(v0_scm);
4596   v1_scm = SCM_ARGREF(1);
4597   v1 = (v1_scm);
4598   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4599   else {
4600     clamp_scm = SCM_CAR(SCM_OPTARGS);
4601     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4602   }
4603   clamp = (clamp_scm);
4604   {
4605 SCM_RETURN(Scm_U8VectorAdd(v0, v1, clamp_arg(clamp)));
4606   }
4607 }
4608 
4609 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_add__NAME, "u8vector-add", 12, 12);
4610 static SCM_DEFINE_SUBR(uvlib_u8vector_add__STUB, 2, 1, SCM_OBJ(&uvlib_u8vector_add__NAME), uvlib_u8vector_add, NULL, NULL);
4611 
4612 static ScmObj uvlib_u8vector_addX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4613 {
4614   ScmObj v0_scm;
4615   ScmU8Vector* v0;
4616   ScmObj v1_scm;
4617   ScmObj v1;
4618   ScmObj clamp_scm;
4619   ScmObj clamp;
4620   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4621   SCM_ENTER_SUBR("u8vector-add!");
4622   if (Scm_Length(SCM_OPTARGS) > 1)
4623     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4624   v0_scm = SCM_ARGREF(0);
4625   if (!SCM_U8VECTORP(v0_scm)) Scm_Error("<u8vector> required, but got %S", v0_scm);
4626   v0 = SCM_U8VECTOR(v0_scm);
4627   v1_scm = SCM_ARGREF(1);
4628   v1 = (v1_scm);
4629   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4630   else {
4631     clamp_scm = SCM_CAR(SCM_OPTARGS);
4632     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4633   }
4634   clamp = (clamp_scm);
4635   {
4636 SCM_RETURN(Scm_U8VectorAddX(v0, v1, clamp_arg(clamp)));
4637   }
4638 }
4639 
4640 static SCM_DEFINE_STRING_CONST(uvlib_u8vector_addX__NAME, "u8vector-add!", 13, 13);
4641 static SCM_DEFINE_SUBR(uvlib_u8vector_addX__STUB, 2, 1, SCM_OBJ(&uvlib_u8vector_addX__NAME), uvlib_u8vector_addX, NULL, NULL);
4642 
4643 static ScmObj uvlib_s16vector_add(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4644 {
4645   ScmObj v0_scm;
4646   ScmS16Vector* v0;
4647   ScmObj v1_scm;
4648   ScmObj v1;
4649   ScmObj clamp_scm;
4650   ScmObj clamp;
4651   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4652   SCM_ENTER_SUBR("s16vector-add");
4653   if (Scm_Length(SCM_OPTARGS) > 1)
4654     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4655   v0_scm = SCM_ARGREF(0);
4656   if (!SCM_S16VECTORP(v0_scm)) Scm_Error("<s16vector> required, but got %S", v0_scm);
4657   v0 = SCM_S16VECTOR(v0_scm);
4658   v1_scm = SCM_ARGREF(1);
4659   v1 = (v1_scm);
4660   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4661   else {
4662     clamp_scm = SCM_CAR(SCM_OPTARGS);
4663     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4664   }
4665   clamp = (clamp_scm);
4666   {
4667 SCM_RETURN(Scm_S16VectorAdd(v0, v1, clamp_arg(clamp)));
4668   }
4669 }
4670 
4671 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_add__NAME, "s16vector-add", 13, 13);
4672 static SCM_DEFINE_SUBR(uvlib_s16vector_add__STUB, 2, 1, SCM_OBJ(&uvlib_s16vector_add__NAME), uvlib_s16vector_add, NULL, NULL);
4673 
4674 static ScmObj uvlib_s16vector_addX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4675 {
4676   ScmObj v0_scm;
4677   ScmS16Vector* v0;
4678   ScmObj v1_scm;
4679   ScmObj v1;
4680   ScmObj clamp_scm;
4681   ScmObj clamp;
4682   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4683   SCM_ENTER_SUBR("s16vector-add!");
4684   if (Scm_Length(SCM_OPTARGS) > 1)
4685     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4686   v0_scm = SCM_ARGREF(0);
4687   if (!SCM_S16VECTORP(v0_scm)) Scm_Error("<s16vector> required, but got %S", v0_scm);
4688   v0 = SCM_S16VECTOR(v0_scm);
4689   v1_scm = SCM_ARGREF(1);
4690   v1 = (v1_scm);
4691   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4692   else {
4693     clamp_scm = SCM_CAR(SCM_OPTARGS);
4694     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4695   }
4696   clamp = (clamp_scm);
4697   {
4698 SCM_RETURN(Scm_S16VectorAddX(v0, v1, clamp_arg(clamp)));
4699   }
4700 }
4701 
4702 static SCM_DEFINE_STRING_CONST(uvlib_s16vector_addX__NAME, "s16vector-add!", 14, 14);
4703 static SCM_DEFINE_SUBR(uvlib_s16vector_addX__STUB, 2, 1, SCM_OBJ(&uvlib_s16vector_addX__NAME), uvlib_s16vector_addX, NULL, NULL);
4704 
4705 static ScmObj uvlib_u16vector_add(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4706 {
4707   ScmObj v0_scm;
4708   ScmU16Vector* v0;
4709   ScmObj v1_scm;
4710   ScmObj v1;
4711   ScmObj clamp_scm;
4712   ScmObj clamp;
4713   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4714   SCM_ENTER_SUBR("u16vector-add");
4715   if (Scm_Length(SCM_OPTARGS) > 1)
4716     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4717   v0_scm = SCM_ARGREF(0);
4718   if (!SCM_U16VECTORP(v0_scm)) Scm_Error("<u16vector> required, but got %S", v0_scm);
4719   v0 = SCM_U16VECTOR(v0_scm);
4720   v1_scm = SCM_ARGREF(1);
4721   v1 = (v1_scm);
4722   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4723   else {
4724     clamp_scm = SCM_CAR(SCM_OPTARGS);
4725     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4726   }
4727   clamp = (clamp_scm);
4728   {
4729 SCM_RETURN(Scm_U16VectorAdd(v0, v1, clamp_arg(clamp)));
4730   }
4731 }
4732 
4733 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_add__NAME, "u16vector-add", 13, 13);
4734 static SCM_DEFINE_SUBR(uvlib_u16vector_add__STUB, 2, 1, SCM_OBJ(&uvlib_u16vector_add__NAME), uvlib_u16vector_add, NULL, NULL);
4735 
4736 static ScmObj uvlib_u16vector_addX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4737 {
4738   ScmObj v0_scm;
4739   ScmU16Vector* v0;
4740   ScmObj v1_scm;
4741   ScmObj v1;
4742   ScmObj clamp_scm;
4743   ScmObj clamp;
4744   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4745   SCM_ENTER_SUBR("u16vector-add!");
4746   if (Scm_Length(SCM_OPTARGS) > 1)
4747     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4748   v0_scm = SCM_ARGREF(0);
4749   if (!SCM_U16VECTORP(v0_scm)) Scm_Error("<u16vector> required, but got %S", v0_scm);
4750   v0 = SCM_U16VECTOR(v0_scm);
4751   v1_scm = SCM_ARGREF(1);
4752   v1 = (v1_scm);
4753   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4754   else {
4755     clamp_scm = SCM_CAR(SCM_OPTARGS);
4756     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4757   }
4758   clamp = (clamp_scm);
4759   {
4760 SCM_RETURN(Scm_U16VectorAddX(v0, v1, clamp_arg(clamp)));
4761   }
4762 }
4763 
4764 static SCM_DEFINE_STRING_CONST(uvlib_u16vector_addX__NAME, "u16vector-add!", 14, 14);
4765 static SCM_DEFINE_SUBR(uvlib_u16vector_addX__STUB, 2, 1, SCM_OBJ(&uvlib_u16vector_addX__NAME), uvlib_u16vector_addX, NULL, NULL);
4766 
4767 static ScmObj uvlib_s32vector_add(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4768 {
4769   ScmObj v0_scm;
4770   ScmS32Vector* v0;
4771   ScmObj v1_scm;
4772   ScmObj v1;
4773   ScmObj clamp_scm;
4774   ScmObj clamp;
4775   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4776   SCM_ENTER_SUBR("s32vector-add");
4777   if (Scm_Length(SCM_OPTARGS) > 1)
4778     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4779   v0_scm = SCM_ARGREF(0);
4780   if (!SCM_S32VECTORP(v0_scm)) Scm_Error("<s32vector> required, but got %S", v0_scm);
4781   v0 = SCM_S32VECTOR(v0_scm);
4782   v1_scm = SCM_ARGREF(1);
4783   v1 = (v1_scm);
4784   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4785   else {
4786     clamp_scm = SCM_CAR(SCM_OPTARGS);
4787     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4788   }
4789   clamp = (clamp_scm);
4790   {
4791 SCM_RETURN(Scm_S32VectorAdd(v0, v1, clamp_arg(clamp)));
4792   }
4793 }
4794 
4795 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_add__NAME, "s32vector-add", 13, 13);
4796 static SCM_DEFINE_SUBR(uvlib_s32vector_add__STUB, 2, 1, SCM_OBJ(&uvlib_s32vector_add__NAME), uvlib_s32vector_add, NULL, NULL);
4797 
4798 static ScmObj uvlib_s32vector_addX(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4799 {
4800   ScmObj v0_scm;
4801   ScmS32Vector* v0;
4802   ScmObj v1_scm;
4803   ScmObj v1;
4804   ScmObj clamp_scm;
4805   ScmObj clamp;
4806   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4807   SCM_ENTER_SUBR("s32vector-add!");
4808   if (Scm_Length(SCM_OPTARGS) > 1)
4809     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4810   v0_scm = SCM_ARGREF(0);
4811   if (!SCM_S32VECTORP(v0_scm)) Scm_Error("<s32vector> required, but got %S", v0_scm);
4812   v0 = SCM_S32VECTOR(v0_scm);
4813   v1_scm = SCM_ARGREF(1);
4814   v1 = (v1_scm);
4815   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4816   else {
4817     clamp_scm = SCM_CAR(SCM_OPTARGS);
4818     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4819   }
4820   clamp = (clamp_scm);
4821   {
4822 SCM_RETURN(Scm_S32VectorAddX(v0, v1, clamp_arg(clamp)));
4823   }
4824 }
4825 
4826 static SCM_DEFINE_STRING_CONST(uvlib_s32vector_addX__NAME, "s32vector-add!", 14, 14);
4827 static SCM_DEFINE_SUBR(uvlib_s32vector_addX__STUB, 2, 1, SCM_OBJ(&uvlib_s32vector_addX__NAME), uvlib_s32vector_addX, NULL, NULL);
4828 
4829 static ScmObj uvlib_u32vector_add(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
4830 {
4831   ScmObj v0_scm;
4832   ScmU32Vector* v0;
4833   ScmObj v1_scm;
4834   ScmObj v1;
4835   ScmObj clamp_scm;
4836   ScmObj clamp;
4837   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
4838   SCM_ENTER_SUBR("u32vector-add");
4839   if (Scm_Length(SCM_OPTARGS) > 1)
4840     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
4841   v0_scm = SCM_ARGREF(0);
4842   if (!SCM_U32VECTORP(v0_scm)) Scm_Error("<u32vector> required, but got %S", v0_scm);
4843   v0 = SCM_U32VECTOR(v0_scm);
4844   v1_scm = SCM_ARGREF(1);
4845   v1 = (v1_scm);
4846   if (SCM_NULLP(SCM_OPTARGS)) clamp_scm = SCM_UNBOUND;
4847   else {
4848     clamp_scm = SCM_CAR(SCM_OPTARGS);
4849     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
4850   }
4851   clamp = (clamp_scm);
4852   {
4853 SCM_RETURN(Scm_U32VectorAdd(v0, v1, clamp_arg(clamp)));
4854   }
4855 }
4856