List of float values.

You will find a general example for the use of floatlist here.

List of float values. In opposition to other lists, the value "break" value of first/next and last/prev loops is not 0 but kMaxFloat.

static FloatList alloc()

Create a new empty list of type FloatList. The list must again be deleted using floatlist::release.

Name Type Default Description
Return FloatList   New empty FloatList

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int release(FloatList li)

Delete a list again that was created with floatlist::alloc.

Name Type Default Description
li FloatList - List to be deleted

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int length(FloatList li)

Ascertain the number of elements of a list.

Name Type Default Description
Return int   Number of entries in the list
li FloatList - List

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float first(FloatList li)

Get the first non-empty entry record of a given FloatList. If nor more etries can found, the function returns the value kMaxFloat.

Name Type Default Description
Return float   First value of the list.
li FloatList - List with at least one element
#include "internal/types.h"
The current list pointer is located at the start of the list. Further values can be fetched using next or last.

Create a FloatList and use some FloatList functions.

#include "internal/types.h"
int w_flist (FloatList fl, char * trailer) { float f;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (f = floatlist::first (fl); f != kMaxFloat; f = floatlist::next (fl)) wlog ("", " %f\n", f);
return 0; }
int main () { FloatList fl = floatlist::alloc (); float f;
wlog ("", "kMaxFloat = %f\n", kMaxFloat);
floatlist::append (fl, 14.01); floatlist::append (fl, 17.02); floatlist::append (fl, 29.10); floatlist::insert (fl, 2, 26.11);
w_flist (fl, "List");
floatlist::sort (fl, 0); w_flist (fl, "Ascent sorted");
floatlist::sort (fl, 1); w_flist (fl, "Descent sorted");
floatlist::remove (fl, 14.01); w_flist (fl, "14.01 removed");
floatlist::release (fl);
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float next(FloatList li)

Get the next record of a given list. If nor more etries can found, the function returns the value kMaxFloat.

Name Type Default Description
Return float   Next value of the list.
li FloatList - List with at least one element after the current list pointer
Current list pointer with first, get_pos or get set and not the last element of the list
#include "internal/types.h"
Current list pointer is relocated one position onwards

Create a FloatList and use some FloatList functions.

#include "internal/types.h"
int w_flist (FloatList fl, char * trailer) { float f;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (f = floatlist::first (fl); f != kMaxFloat; f = floatlist::next (fl)) wlog ("", " %f\n", f);
return 0; }
int main () { FloatList fl = floatlist::alloc (); float f;
wlog ("", "kMaxFloat = %f\n", kMaxFloat);
floatlist::append (fl, 14.01); floatlist::append (fl, 17.02); floatlist::append (fl, 29.10); floatlist::insert (fl, 2, 26.11);
w_flist (fl, "List");
floatlist::sort (fl, 0); w_flist (fl, "Ascent sorted");
floatlist::sort (fl, 1); w_flist (fl, "Descent sorted");
floatlist::remove (fl, 14.01); w_flist (fl, "14.01 removed");
floatlist::release (fl);
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float prev(FloatList li)

Get the previous record of a given list. If nor more etries can found, the function returns the value kMaxFloat.

Name Type Default Description
Return float   Preceding value in the list.
li FloatList - List with at least one element after the current list pointer
Current list pointer with first, get_pos or get set and not the last element of the list
#include "internal/types.h"
Current list pointer is relocated one position backwards

Create a FloatList and use some FloatList functions.

#include "internal/types.h"
int w_flist (FloatList fl, char * trailer) { float f;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (f = floatlist::first (fl); f != kMaxFloat; f = floatlist::next (fl)) wlog ("", " %f\n", f);
return 0; }
int main () { FloatList fl = floatlist::alloc (); float f;
wlog ("", "kMaxFloat = %f\n", kMaxFloat);
floatlist::append (fl, 14.01); floatlist::append (fl, 17.02); floatlist::append (fl, 29.10); floatlist::insert (fl, 2, 26.11);
w_flist (fl, "List");
floatlist::sort (fl, 0); w_flist (fl, "Ascent sorted");
floatlist::sort (fl, 1); w_flist (fl, "Descent sorted");
floatlist::remove (fl, 14.01); w_flist (fl, "14.01 removed");
floatlist::release (fl);
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float last(FloatList li)

Get the last non-empty record of a given list. If nor more etries can found, the function returns the value kMaxFloat.

Name Type Default Description
Return float   Last value of the list.
li FloatList - List with at least one element
#include "internal/types.h"
The current list pointer is located at the end of the list. Further values can be fetched using prev or first.

Create a FloatList and use some FloatList functions.

#include "internal/types.h"
int w_flist (FloatList fl, char * trailer) { float f;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (f = floatlist::first (fl); f != kMaxFloat; f = floatlist::next (fl)) wlog ("", " %f\n", f);
return 0; }
int main () { FloatList fl = floatlist::alloc (); float f;
wlog ("", "kMaxFloat = %f\n", kMaxFloat);
floatlist::append (fl, 14.01); floatlist::append (fl, 17.02); floatlist::append (fl, 29.10); floatlist::insert (fl, 2, 26.11);
w_flist (fl, "List");
floatlist::sort (fl, 0); w_flist (fl, "Ascent sorted");
floatlist::sort (fl, 1); w_flist (fl, "Descent sorted");
floatlist::remove (fl, 14.01); w_flist (fl, "14.01 removed");
floatlist::release (fl);
return 0; }

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int get_pos(
  FloatList li,
  float val,
  int setPos = 0)

Search for the first position of a value in the list. If the value is not found, the function returns -1. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return int   >= 0 : First occurrence of a value in the list
-1 : Value not found
li FloatList - List in which the value is to be search for
val float - This value is searched for
setPos int 0 0 : Leave list positions unchanged
1 : Set current list position at the point of finding
#include "internal/types.h"
If the value was found in the list and setPos is > 0, the current list position is located at the point of finding.

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float get(
  FloatList li,
  int pos,
  int setPos= 0)

Get the i-th element of the list. Wird kein Eintrag in der Liste gefunden, gibt die Funktion den Wert kMaxFloat zurück. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return float   Value of the list at the position i or 0.
li FloatList - List from which the element is to be fetched
pos int - 0-based list position
setPos int 0 0 : Leave list positions unchanged
1 : Set current list position to pos
#include "internal/types.h"
If setPos > 0, the current list position is located at pos.

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float append(FloatList li, float f)

Append a value to the list.

Name Type Default Description
Return float   appended value or kMaxFloat
li FloatList - List to which the append is to be made
f float - value to append
#include "internal/types.h"

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float insert(
  FloatList li,
  int pos,
  float f)

Insert a value into the list.

Name Type Default Description
Return float   inserted value or kMaxFloat
li FloatList - List to which the insertion is to be made
pos int - 0-based position of inserted value
f float - value to insert
#include "internal/types.h"

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float remove(FloatList li, float val)

Remove the first occurence of an given value from the list.

Name Type Default Description
Return int   removed value or kMaxFloat
li FloatList - List from which the remove is to be made
val float - Value to be removed from the list
#include "internal/types.h"

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static float remove_pos(FloatList li, int pos)

Remove a position from the list. List positions are 0-based, the first element has the position 0, the final the position length-1.

Name Type Default Description
Return float   removed value or kMaxFloat
li FloatList - List
pos int - 0-based delete position
#include "internal/types.h"
id	= floatlist::remove_pos (0);
if (id) float::release (id);

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf

static int clear(FloatList li)

Remove all elements of the list

Name Type Default Description
Return int   1 : Action successful
0 : otherwise
li FloatList - List

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int sort(FloatList li, int direction = 0)

Sort the list

Name Type Default Description
Return int   0 or ErrorCode
li FloatList - list to sort
direction int 0 Sort order

0 : ascent 1 : descent

Version 3.1 R2210, 29.11.2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* to_xml(FloatList list, char* rootElementName = "floats")

Generate a XML structure of a FloatList object.

If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.

Name Type Default Description
Return char *   xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released.
list FloatList - object
rootElementName String or char* floats name of the root element

4.0.5 R9650
comet.publication.toXMLFloatList

static FloatList from_xml(char* xml)

Create a FloatList object from a xml structure.

If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.

Name Type Default Description
Return FloatList   object of type FloatList. This list must be released using floatlist::release.
xml String or char* - xml structure

4.0.5 R9650
comet.publication.fromXMLFloatList

static int add_all(
  FloatList target,
  FloatList src,
  int deleteFromSource)

Append all elements from list src to list target.

Name Type Default Description
Return int   0 or ErrorCode
target FloatList - target list
src FloatList - source list
deleteFromSource int 0 delete elements from source after adding to target

4.0.5 R9700

Preconditions
#include "internal/types.h"

Create a FloatList and use some FloatList functions.

#include "internal/types.h"
int w_flist (FloatList fl, char * trailer) { float f;
if (strlen (trailer)) wlog ("", "%s\n", trailer);
for (f = floatlist::first (fl); f != kMaxFloat; f = floatlist::next (fl)) wlog ("", " %f\n", f);
return 0; }
int main () { FloatList fl = floatlist::alloc (); float f;
wlog ("", "kMaxFloat = %f\n", kMaxFloat);
floatlist::append (fl, 14.01); floatlist::append (fl, 17.02); floatlist::append (fl, 29.10); floatlist::insert (fl, 2, 26.11);
w_flist (fl, "List");
floatlist::sort (fl, 0); w_flist (fl, "Ascent sorted");
floatlist::sort (fl, 1); w_flist (fl, "Descent sorted");
floatlist::remove (fl, 14.01); w_flist (fl, "14.01 removed");
floatlist::release (fl);
return 0; }

Since
Version 3.1 R2210, 29.11.2010

Alphabetic index HTML hierarchy of classes or Java