mdatabase_define(3m17n)

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

✨ mdatabase_define ✨ β€” from the m17n Library, bestie πŸ’–

okay so before we even start, let me just say: this one is a manual page for mdatabase_define(3m17n), and yes it's a C library thing, and yes it's giving very much "systems programmer who also knows how to have fun". sit down, grab a strawberry πŸ“, and let's get into it.


🌸 NAME 🌸

mdatabase_define β€” bestie this is literally just the function name, no cap. that's the whole NAME section. slay.


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole vibe in code form, copy it exactly or the compiler will simply Not:

MDatabase* mdatabase_define (MSymbol tag0, MSymbol tag1, MSymbol tag2,
       MSymbol tag3, void *(*)(MSymbol *, void *) loader, void * extra_info)

four tags, a loader function pointer, and some extra_info. the way that signature is iconic honestly. πŸ¦‹


πŸ’… DESCRIPTION πŸ’…

so what this actually does: mdatabase_define() defines a data of the m17n database. like, you're registering a thing so the library knows it exists. it defines a data that has tags tag0 through tag3, plus additional information called extra_info. four tags, that's your whole identity bestie.

now. loader is a pointer to a function that loads the data from the database. and here's the tea: this function gets called from the mdatabase_load() function with the two arguments tags and extra_info. and tags there? that's the array of tag0 through tag3. so your four tags get bundled up into an array and handed over. cute. 🌈

and if loader is NULL, the default loader of the m17n library is used. lowkey convenient. but β€” and this is important β€” in this case, extra_info must be a string specifying a filename that contains the data. must. not should. must. if you pass NULL loader and then hand it something that isn't a filename string, that's on you, not me. πŸ™ˆ


πŸ‘‘ RETURN VALUE πŸ‘‘

  • If the operation was successful, mdatabase_define() returns a pointer to the defined data, which can be used as an argument to mdatabase_load(). periodt. you got your pointer, go use it.
  • Otherwise, it returns NULL. and if you see NULL, that's a vibe check failure, bestie. πŸ’€

⭐ SEE ALSO ⭐

go read these too, iykyk:

  • mdatabase_load()
  • mdatabase_define()

(yeah it references itself. main character energy fr fr. πŸ’…)


gotta give credit where credit is due, no plagiarism here:

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>.


okay that's the whole page!! 🫢 this was Version 1.8.4, dated Mon Sep 25 2023, and it's part of the mdatabase_define(3m17n) manual. go define some data, bestie, you're gonna ate. πŸ’–βœ¨

πŸ“¦ where this page comes from