/* ############################################################################ # # File: ilists.c # # Subject: Icon-to-C interface for simple Icon lists # # Author: Kostas Oikonomou # # Date: April 26, 2002 # ############################################################################ # # This file is in the public domain. # ############################################################################ # # This file provides three procedures for translating homogeneous # lists of integers, reals, or strings to C arrays: # # IListVal(d) returns an array of C ints. # RListVal(d) returns an array of C doubles. # SListVal(d) returns an array of C char pointers (char *). # ############################################################################ # # Here is an example of using this interface: # # 1. gcc -I/opt/icon/ipl/cfuncs -shared -fPIC -o llib.so l.c # where "l.c" is the C fragment below. # # #include "ilists.c" # int example(int argc, descriptor argv[]) # { # int *ia; # double *ra; # char *(*sa); # int n; int i; # ArgList(1); n = ListLen(argv[1]); # ia = IListVal(argv[1]); # for (i=0; i