mtext_from_data(3m17n)

πŸ“¦
version 1.8.4 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– mtext_from_data πŸ’–

okay bestie, welcome to the mtext_from_data(3m17n) page β€” yes it's a manual page from The m17n Library, and yes we're gonna make it make sense. sit down, grab a boba, let's go ✨


✨ NAME ✨

mtext_from_data β€” like the name says, you're making an M-text out of some data 🫢


🌸 SYNOPSIS 🌸

MText* mtext_from_data (const void * data, int nitems, enum MTextFormat
       format)

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole vibe here is: you have data, you want an M-text, and this function is gonna allocate a brand new M-text with the data you specified. iconic. πŸ’…

The mtext_from_data() function allocates a new M-text whose character sequence is specified by array data of nitems elements. and format? that tells it what format data is in, bestie, so don't get it wrong πŸ™ˆ

here's the breakdown, no cap:

  • When format is either MTEXT_FORMAT_US_ASCII or MTEXT_FORMAT_UTF_8, the contents of data must be of the type unsigned char, and nitems counts by byte.
  • When format is either MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE, the contents of data must be of the type unsigned short, and nitems counts by unsigned short.
  • When format is either MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE, the contents of data must be of the type unsigned, and nitems counts by unsigned.
⚠️ okay important: the character sequence of the M-text is not modifiable. and the contents of data must not be modified while the M-text is alive. fr fr, hands off πŸ”₯

and about cleanup β€” the allocated M-text will not be freed unless you explicitly do it yourself with the m17n_object_unref() function. and even in that case, data is not freed. so like. just so you know. πŸ‘‘


⭐ RETURN VALUE ⭐

  • If the operation was successful, mtext_from_data() returns a pointer to the allocated M-text. slay ✨
  • Otherwise it returns NULL and assigns an error code to the external variable merror_code. 😭

πŸ’€ ERRORS πŸ’€

  • MERROR_MTEXT

Copyright (C) 2001 Information-technology Promotion Agency (IPA)

Copyright (C) 2001-2011 National Institute of Advanced Industrial Science and Technology (AIST)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License <http://www.gnu.org/licenses/fdl.html>.


and that's the whole page, bestie!! this was Version 1.8.4, dated Mon Sep 25 2023 β€” main character energy from the m17n crew, we love to see it πŸ’œ

πŸ“¦ where this page comes from