next up previous contents index
Next: Morpho line Up: Chain of morpho sets Previous: Related file (external) types   Contents   Index


Functions Summary

The following is a description of all the functions related to the Morpho_sets type. The list is in alphabetical order.

$ \bigcirc$Name


mw_change_morpho_sets - Define a morpho sets, if not already defined




$ \bigcirc$Summary


Morpho_sets mw_change_morpho_sets(mss)

Morpho_sets mss;




$ \bigcirc$Description


This function returns a Morpho_sets structure if the input mss = NULL. It is provided despite the
mw_new_morpho_sets() function for global coherence with other memory types.

The function mw_change_morpho_sets returns NULL if not enough memory is available to allocate the structure. Your code should check this return value to send an error message in the NULL case, and do appropriate statement.

Since the MegaWave2 compiler allocates structures for input and output objects (See Volume one: ``MegaWave2 User's Guide''), this function is normally used only for internal objects. Do not forget to deallocate the internal structures before the end of the module, except if they are part of an input or output chain.




$ \bigcirc$Example

Morpho_sets mss=NULL; /* Internal use: no Input neither Output of module */
Hsegment seg;
Morpho_set ms;

/* Define a morpho sets containing one morpho set */

if (!(seg=mw_new_hsegment()) ||
    !(ms=mw_new_morpho_set()) ||
    !(mss=mw_change_morpho_sets(mss))) mwerror(FATAL,1,"Not enough memory.\n");
seg->xstart=0; 
seg->xend=200;
seg->y=10;

ms->first_segment=seg;
ms->minvalue=0.0;
ms->maxvalue = 1.0;
ms->area=201;

mss->morphoset=ms;

$ \bigcirc$Name


mw_copy_morpho_sets - Copy a morpho sets into another one




$ \bigcirc$Summary


Morpho_sets mw_copy_morpho_sets(in,out)

Morpho_sets in, out;




$ \bigcirc$Description


This function copies the Morpho_sets in into out. The Morpho_set pointed by the in->morphoset field is not only copied, but also all the chain starting from in. The neighbor Morpho_sets pointed by each Morpho_set are also copied. The result is put in out, which may not be a predefined structure : in case of out=NULL, the out structure is allocated.

The function mw_copy_morpho_sets returns NULL if not enough memory is available to perform the copy, or out elsewhere. Your code should check this return value to send an error message in the NULL case, and do appropriate statement.




$ \bigcirc$Example

Morpho_sets in; /* Predefined morpho_sets */
Morpho_sets out=NULL; 

out=mw_copy_morpho_sets(in,out);
if (!out) mwerror(FATAL,1,"Not enough memory.\n");

$ \bigcirc$Name


mw_delete_morpho_sets - Deallocate a morpho sets




$ \bigcirc$Summary


void mw_delete_morpho_sets(mss)

Morpho_sets mss;




$ \bigcirc$Description


This function frees the Morpho_set mss->morphoset, all the chain starting from mss and it deallocates the Morpho_sets mss structure. You should sets mss = NULL after this call since the address pointed by mss is no longer valid.




$ \bigcirc$Example

Morpho_sets mss; /* Internal use: no Input neither Output of module */
Hsegment seg;
Morpho_set ms;

/* Define a morpho sets containing one morpho set */

if (!(seg=mw_new_hsegment()) ||
    !(ms=mw_new_morpho_set()) ||
    !(mss=mw_new_morpho_sets())) mwerror(FATAL,1,"Not enough memory.\n");
seg->xstart=0; 
seg->xend=200;
seg->y=10;

ms->first_segment=seg; ms->minvalue=0.0; ms->maxvalue = 1.0; ms->area=201;
mss->morphoset=ms;

/* .
   .
   (statement)
   .
   .
*/

/* Deallocate the morpho_sets mss ; ms and seg will be also deallocated. */
mw_delete_morpho_set(mss);

$ \bigcirc$Name


mw_length_morpho_sets - Return the number of morpho sets a Morpho_sets structure contains




$ \bigcirc$Summary


unsigned int mw_length_morpho_sets(mss)

Morpho_sets mss;




$ \bigcirc$Description


This function returns the number of morpho sets the Morpho_sets structure mss contains, starting the chain from the current position given by mss. It returns 0 if the structure is empty or undefined.




$ \bigcirc$Example

Morpho_sets mss; /* Internal use: no Input neither Output of module */
Hsegment seg;
Morpho_set ms;

/* Define a morpho sets containing one morpho set */

if (!(seg=mw_new_hsegment()) ||
    !(ms=mw_new_morpho_set()) ||
    !(mss=mw_new_morpho_sets())) mwerror(FATAL,1,"Not enough memory.\n");
seg->xstart=0; 
seg->xend=200;
seg->y=10;

ms->first_segment=seg; ms->minvalue=0.0; ms->maxvalue = 1.0; ms->area=201;
mss->morphoset=ms;

/* This will print 1 */
printf("%d",mw_length_morpho_sets(mss));

$ \bigcirc$Name


mw_new_morpho_sets - Create a new morpho sets




$ \bigcirc$Summary


Morpho_sets mw_new_morpho_sets()




$ \bigcirc$Description


This function returns a new Morpho_sets structure, or NULL if not enough memory is available to allocate the structure. Your code should check this return value to send an error message in the NULL case, and do appropriate statement.

The new structure is created with fields set to 0 or NULL.




$ \bigcirc$Example

Morpho_sets mss; /* Internal use: no Input neither Output of module */
Hsegment seg;
Morpho_set ms;

/* Define a morpho sets containing one morpho set */

if (!(seg=mw_new_hsegment()) ||
    !(ms=mw_new_morpho_set()) ||
    !(mss=mw_new_morpho_sets())) mwerror(FATAL,1,"Not enough memory.\n");
seg->xstart=0; 
seg->xend=200;
seg->y=10;

ms->first_segment=seg;
ms->minvalue=0.0;
ms->maxvalue = 1.0;
ms->area=201;

mss->morphoset=ms;


next up previous contents index
Next: Morpho line Up: Chain of morpho sets Previous: Related file (external) types   Contents   Index
mw 2004-05-05