VistaIOInsertAttr(3)

✨ VistaIOInsertAttr ✨

okay bestie, so this is from the Library Functions Manual, and it's literally the trio of functions that add attributes to a list: VistaIOInsertAttr, VistaIOAppendAttr, and VistaIOPrependAttr. sit down, grab a boba, we're learning πŸ’–


🌸 NAME 🌸

VistaIOInsertAttr, VistaIOAppendAttr, VistaIOPrependAttr β€” add an attribute to a list πŸ’…

like. that's the whole job. adding attributes. iconic behavior.


πŸŽ€ SYNOPSIS πŸŽ€

void VistaIOInsertAttr (posn, after, name, dict, repn, value)
       VistaIOAttrListPosn *posn;
       VistaIOBoolean after;
       VistaIOStringConst name;
       VistaIODictEntry *dict;
       VistaIORepnKind repn;
       type value;

void VistaIOAppendAttr (list, name, dict, repn, value)
       VistaIOAttrList list;
       VistaIOStringConst name;
       VistaIODictEntry *dict;
       VistaIORepnKind repn;
       type value;

void VistaIOPrependAttr (list, name, dict, repn, value)
       VistaIOAttrList list;
       VistaIOStringConst name;
       VistaIODictEntry *dict;
       VistaIORepnKind repn;
       type value;

and where it says type, bestie, that's a placeholder for literally any of these:

VistaIOBit, VistaIOUByte, VistaIOSByte, VistaIOShort, VistaIOLong, VistaIOFloat, VistaIODouble, VistaIOAttrList, VistaIOBoolean, VistaIOBundle, VistaIOList, VistaIOPointer, VistaIOString, VistaIOEdges, VistaIOImage, etc.

(and yes the "etc." is doing a LOT of heavy lifting there but that's what the page says so we're keeping it 🫢)


πŸ¦‹ ARGUMENTS πŸ¦‹

  • posn β€” the attribute list position where the new attribute is getting inserted. this is your spot. your little landing pad.
  • after β€” tells us whether the new attribute goes before posn (FALSE) or after posn (TRUE). yes, FALSE means before, don't ask, just vibe with it 😭
  • list β€” the attribute list we're appending to or prepending to. the guest list, basically.
  • name β€” the name for the new attribute. every attribute needs a name, it's giving main character energy.
  • dict β€” may specify a dictionary used in translating the value you supply into a keyword that should be stored as the attribute's value β€” or it can be NULL. your call, bestie.
  • repn β€” the representation of the new attribute value.
  • value β€” the new attribute value itself. the content. the moment.

πŸ’– DESCRIPTION πŸ’–

so these routines give you three ways to add a new attribute to an attribute list:

  • VistaIOInsertAttr inserts the new attribute immediately before or after the existing attribute specified by posn.
  • VistaIOAppendAttr places the new attribute at the end of list.
  • VistaIOPrependAttr places the new attribute at the beginning of list.

three flavors. one goal. we love a supportive trio 🌈


🧚 the dict situation (iykyk)

with the dict argument you can hand over a dictionary for mapping value to a keyword that will be stored as the attribute's value (peep VistaIOdictionary(3) for the lore).

for example: if you pass an attribute value of 1 and a dictionary that associates the value 1 with the keyword ubyte (like the dictionary VistaIORepnDict does), then the string ubyte will be stored as the attribute's value. slay.

dictionaries may be used to map both numeric values and strings to keywords.

and if you supply a dictionary but value is not mentioned in that dictionary? then value itself will be stored with the attribute. no drama, it just keeps the original.


πŸ™ˆ the copy situation (lowkey important)

if value is a number or a character string, the routine makes its own copy of the value as a character string for storing in the attribute. cute, safe, self-sufficient.

if, on the other hand, value is an attribute list, pointer, image, edge set, etc., then the routine stores a pointer in the attribute β€” but it does not make a copy of the object pointed to.

⚠️ okay so that second one is the plot twist: you get a pointer, not a duplicate. the object itself is not copied. just so we're clear, bestie. πŸ‘€

πŸ‘‘ RETURN VALUES πŸ‘‘

as a side effect, these routines modify the attribute list referred to by list or posn.

that's it. that's the side effect. it's giving "changes things behind the scenes" πŸ’…


🌟 SEE ALSO 🌟

VistaIOSetAttr(3), VistaIOSetAttrValue(3), VistaIOattribute(3), VistaIOdictionary(3),

go read those too, they're the extended universe πŸ¦‹


πŸ’œ AUTHOR πŸ’œ

Art Pope <pope@cs.ubc.ca>

Adaption to vistaio: Gert Wollny <gw.fossdev@gmail.com>


and that's the whole page, bestie β€” brought to you by VistaIO Version 1.2.14, dated 24 April 1993, in all its VistaIOInsertAttr(3) glory. vintage but make it iconic. periodt. πŸ’–βœ¨