diff --git a/Lib/guile/typemaps.i b/Lib/guile/typemaps.i index b8185a35a..89e86ed06 100644 --- a/Lib/guile/typemaps.i +++ b/Lib/guile/typemaps.i @@ -1,146 +1,32 @@ -/* typemaps.i --- INPUT/OUTPUT/BOTH typemaps +/* typemaps.i --- guile-specific typemaps Copyright (C) 2000 Matthias Koeppe $Header$ */ -%typemap(guile,out) double, float -{ - $target = gh_double2scm($source); -} +#define MK_SIMPLE_MAP(f) $target = f ($source) -%typemap(guile,out) int, short -{ - $target = gh_int2scm($source); -} +%typemap (guile, in) bool { MK_SIMPLE_MAP (gh_scm2bool); } +%typemap (guile, in) char { MK_SIMPLE_MAP (gh_scm2char); } +%typemap (guile, in) int { MK_SIMPLE_MAP (gh_scm2int); } +%typemap (guile, in) short { MK_SIMPLE_MAP (gh_scm2int); } +%typemap (guile, in) long { MK_SIMPLE_MAP (gh_scm2long); } +%typemap (guile, in) unsigned int { MK_SIMPLE_MAP (gh_scm2ulong); } +%typemap (guile, in) unsigned short { MK_SIMPLE_MAP (gh_scm2ulong); } +%typemap (guile, in) unsigned long { MK_SIMPLE_MAP (gh_scm2ulong); } +%typemap (guile, in) float { MK_SIMPLE_MAP (gh_scm2double); } +%typemap (guile, in) double { MK_SIMPLE_MAP (gh_scm2double); } -%typemap(guile,out) long -{ - $target = gh_long2scm($source); -} +%typemap (guile, out) bool { MK_SIMPLE_MAP (gh_bool2scm); } +%typemap (guile, out) char { MK_SIMPLE_MAP (gh_char2scm); } +%typemap (guile, out) int { MK_SIMPLE_MAP (gh_int2scm); } +%typemap (guile, out) short { MK_SIMPLE_MAP (gh_int2scm); } +%typemap (guile, out) long { MK_SIMPLE_MAP (gh_long2scm); } +%typemap (guile, out) unsigned int { MK_SIMPLE_MAP (gh_ulong2scm); } +%typemap (guile, out) unsigned short { MK_SIMPLE_MAP (gh_ulong2scm); } +%typemap (guile, out) unsigned long { MK_SIMPLE_MAP (gh_ulong2scm); } +%typemap (guile, out) float { MK_SIMPLE_MAP (gh_double2scm); } +%typemap (guile, out) double { MK_SIMPLE_MAP (gh_double2scm); } -%typemap(guile,out) unsigned int, unsigned short, unsigned long -{ - $target = gh_ulong2scm($source); -} - -%typemap(guile,out) unsigned char -{ - $target = gh_char2scm($source); -} - -%typemap(guile,in) double *INPUT(double temp) -{ - temp = gh_scm2double($source); - $target = &temp; -} - -%typemap(guile,in) float *INPUT(float temp) -{ - temp = (float) gh_scm2double($source); - $target = &temp; -} - -%typemap(guile,in) int *INPUT(int temp) -{ - temp = (int) gh_scm2int($source); - $target = &temp; -} - -%typemap(guile,in) short *INPUT(short temp) -{ - temp = (short) gh_scm2int($source); - $target = &temp; -} - -%typemap(guile,in) long *INPUT(long temp) -{ - temp = (long) gh_scm2long($source); - $target = &temp; -} - -%typemap(guile,in) unsigned int *INPUT(unsigned int temp) -{ - temp = (unsigned int) gh_scm2ulong($source); - $target = &temp; -} - -%typemap(guile,in) unsigned short *INPUT(unsigned short temp) -{ - temp = (unsigned short) gh_scm2ulong($source); - $target = &temp; -} - -%typemap(guile,in) unsigned long *INPUT(unsigned long temp) -{ - temp = (unsigned long) gh_scm2ulong($source); - $target = &temp; -} -%typemap(guile,in) unsigned char *INPUT(unsigned char temp) -{ - temp = (unsigned char) gh_scm2char($source); - $target = &temp; -} - -%typemap(guile,ignore) int *OUTPUT(int temp), - short *OUTPUT(short temp), - long *OUTPUT(long temp), - unsigned int *OUTPUT(unsigned int temp), - unsigned short *OUTPUT(unsigned short temp), - unsigned long *OUTPUT(unsigned long temp), - unsigned char *OUTPUT(unsigned char temp), - float *OUTPUT(float temp), - double *OUTPUT(double temp) -{ - $target = &temp; -} - -%typemap(guile,argout) int *OUTPUT, - short *OUTPUT -{ - GUILE_APPEND_RESULT(gh_int2scm(*$target)); -} - -%typemap(guile,argout) long *OUTPUT -{ - GUILE_APPEND_RESULT(gh_long2scm(*$target)); -} - -%typemap(guile,argout) unsigned int *OUTPUT, - unsigned short *OUTPUT, - unsigned long *OUTPUT -{ - GUILE_APPEND_RESULT(gh_ulong2scm(*$target)); -} - -%typemap(guile,argout) unsigned char *OUTPUT -{ - GUILE_APPEND_RESULT(gh_char2scm(*$target)); -} - -%typemap(guile,argout) float *OUTPUT, - double *OUTPUT -{ - GUILE_APPEND_RESULT(gh_double2scm(*$target)); -} - -%typemap(guile,in) int *BOTH = int *INPUT; -%typemap(guile,in) short *BOTH = short *INPUT; -%typemap(guile,in) long *BOTH = long *INPUT; -%typemap(guile,in) unsigned *BOTH = unsigned *INPUT; -%typemap(guile,in) unsigned short *BOTH = unsigned short *INPUT; -%typemap(guile,in) unsigned long *BOTH = unsigned long *INPUT; -%typemap(guile,in) unsigned char *BOTH = unsigned char *INPUT; -%typemap(guile,in) float *BOTH = float *INPUT; -%typemap(guile,in) double *BOTH = double *INPUT; - -%typemap(guile,argout) int *BOTH = int *OUTPUT; -%typemap(guile,argout) short *BOTH = short *OUTPUT; -%typemap(guile,argout) long *BOTH = long *OUTPUT; -%typemap(guile,argout) unsigned *BOTH = unsigned *OUTPUT; -%typemap(guile,argout) unsigned short *BOTH = unsigned short *OUTPUT; -%typemap(guile,argout) unsigned long *BOTH = unsigned long *OUTPUT; -%typemap(guile,argout) unsigned char *BOTH = unsigned char *OUTPUT; -%typemap(guile,argout) float *BOTH = float *OUTPUT; -%typemap(guile,argout) double *BOTH = double *OUTPUT; +#undef MK_SIMPLE_MAP /* typemaps.i ends here */