mconv_encode_range(3m17n)

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

✨ NAME ✨

okay so bestie, the name is mconv_encode_range and that's... literally it. the manpage just gives us a name, a little dash -, and zero description after it. iconic minimalism honestly πŸ’… but yeah, that dash is doing absolutely nothing, it's giving "group project member who didn't show up".


🌸 SYNOPSIS 🌸

int mconv_encode_range (MConverter * converter, MText * mt, int from,
       int to)

like yes, four arguments, three of them are basically vibes and one of them is a converter. we move 🫢


πŸ’– DESCRIPTION πŸ’–

okay so what this does: it encodes a part of an M-text. that's the whole job. main character energy, no notes.

the mconv_encode_range() function encodes the text between from (inclusive) and to (exclusive) in the M-text mt, and writes the resulting byte sequence into the buffer area or the stream that is currently bound to the code converter converter.

and yes bestie, from is IN and to is OUT, that's the classic half-open range moment, iykyk. so if from is 5 and to is 10, you're getting 5, 6, 7, 8, 9. not 10. 10 is a spectator. πŸ™ˆ

where do the bytes go? either the buffer area or the stream β€” whichever one is currently bound to converter. that's not us deciding, that's just whatever you already set up. mconv_rebind_buffer() and mconv_rebind_stream() are the girlies who handle that, see SEE ALSO below ⬇️


πŸŽ€ RETURN VALUE πŸŽ€

  • if the operation was successful, mconv_encode_range() returns the number of written bytes. slay.
  • otherwise it returns -1 and assigns an error code to the external variable merror_code. 😭 not the -1

so like, always check your return value bestie. -1 is not a byte count, it's a cry for help.


πŸ’€ ERRORS πŸ’€

  • MERROR_RANGE
  • MERROR_IO
  • MERROR_CODING

these are the error codes it can drop into merror_code when things go sideways. if you see one of these, it's giving "the range was bad" or "the I/O was bad" or "the coding was bad". rough out here fr fr πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

  • mconv_rebind_buffer()
  • mconv_rebind_stream()
  • mconv_decode()
  • mconv_encode()

go read these, they're the rest of the friend group. periodt. πŸ‘‘


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 pulled from Version 1.8.4, dated Mon Sep 25 2023, and it lives in the m17n Library manpage collection (the 3m17n section, obviously πŸ’–). mwah, go encode responsibly πŸ¦‹βœ¨

πŸ“¦ where this page comes from