In a message dated 12/04/05 01:28:10 GMT Daylight Time, [EMAIL PROTECTED] writes:
> >passed. > In Easyptr, the MAWDRAW command often needs a sliced array. > > Consider a list of files, stored in f$(). We assume a maximum of, say, > 480 files: > > DIM f$(480,36) > > If the list was only 60 files long, the application window menu might > be set up with: > > MAWDRAW #ch%,1,f$(0 to 59) > > (example from memory, open to correction of course). > > This sort of example could probably be rewritten in most cases to do 2 > passes to read the number of files (pass 1), then dimension the array > accordingly, then pass 2 does the actual reading of filenames to the > array f$(), thus avoiding the need for an array slice. > > I presume this means this would not be possible under Turbo as it > stands (sliced arrays cannot be passed to m/code extensions, although > in this case only passing by value of the array slice is required), > although what you have already done to Turbo is of course a most > welcome development. > > -- > Turbo cannot set sliced arrays as parameters to S*BASIC procedures or functions. This is because of the way the array descriptors are defined. However it is theoretically possible to set a sliced array as parameter to a machine code extension since Turbo defines an S*BASIC descriptor. Unfortunately I cannot see at the moment a way of doing this in practice. Also I had thought that programs could be fairly easily written to avoid slicing. Incidentally there is no difference between passing an array by value and by reference in the sense that the only way you can pass an array is by giving the address of the descriptor (which is by reference anyway). George _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm