[emboss-dev] 2d array questions

Jon Ison jison at ebi.ac.uk
Wed Aug 3 11:12:15 UTC 2005


Dear Martin

ajInt2dElemExists and ajInt2dLenElem are indeed removed.

If you use ajInt2dNew or ajInt2dNewL you'll get the first
dimension of your array.  Subsequent calls to ajInt2dPut
will allocate in the second dimension (your array can be
ragged).  All memory allocation is done for you, however the
application code shouldn't ever ajInt2dGet an element it hasn't
first ajInt2dPut a value into (errors otherwise).  A safe bet
if you know your second dimensions up front is to call ajInt2dPut
to initialise your array, e.g.

for(x=0;x<dim1;x++)
  ajInt2dPut(&myarr, x, dim2[x], 0);

or some such (for a ragged array).

Does that help?

Cheers

Jon

> I wrote some code for an EMBOSS app which has been quietly languishing for
> the last few years so decided to make use of the MYEMBOSS to ressurect it.
>
> On trying to compile I get a bunch of errors related to the functions
> ajInt2dElemExists and ajInt2dLenElem, both of which seem to have been
> deprecated in recent versions.
>
> Have these been removed and if so, this is what I am trying to do:
>
> Populate a relatively sparse array, ie I do not need to have a full
> rectangular 2d array, but may populate odd cells in the array and add to
> them. So I was chacking to see whether the second dimension was large
> enough
> and whether the elements I wanted to increment had been initialised or
> not.
>
> Otherwise ajInt2dGet will throw an error if I try to access something
> which
> hasn't been initialised.
>
> ..d
>
>
> _______________________________________________
> emboss-dev mailing list
> emboss-dev at emboss.open-bio.org
> http://newportal.open-bio.org/mailman/listinfo/emboss-dev
>





More information about the emboss-dev mailing list