help-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using librec


From: Jose E. Marchesi
Subject: Re: Using librec
Date: Thu, 06 May 2021 14:25:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Thanks for your quick response! If you don't mind, could you give me an
> example usage of creating a multi-set/record? Some functions need typedef
> function pointers, which I can't make heads or tails of.

This is how you would create a rec_record_t with the following record:

  Foo: bar
  # this is a comment
  Bar: baz

The code:

  rec_field_t f1 = rec_field_new ("Foo", "bar");
  rec_comment_t c = rec_comment_new ("this is a comment");
  rec_field_t f2 = rec_field_new ("Bar", "baz");

  rec_record_t rec = rec_record_new ();
  rec_mset_t rec_elements = rec_record_mset (rec):

  rec_mset_append (rec_elements, MSET_FIELD, f1, MSET_ANY);
  rec_mset_append (rec_elements, MSET_COMMENT, c, MSET_ANY);
  rec_mset_append (rec_elements, MSET_FIELD, f2, MSET_ANY);

Working with record sets is similar: they also have a mset that contains
MSET_RECORD or MSET_COMMENT elements.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]