namelur is a random name generator library with rule files. It is fast, lightweight, and easy to use.
It can generate rule files from custom text. It also includes a command line tool that exposes the functionality of the library.
Here are some key features of "namelur":
· very small memory usage and very fast generation algorithm
· rule files (called NAR rule file) for scripting the generation of names
· auto-generation of NAR rule files basing on words contained in any file
· powerful command line tool (rulname) to create NAR files
How to convert a text resource into a NAR rule set
void nr_txt2nar(RWops *sourcefile, RWops *destination_nar);
If 'destination_nar' is NULL only the internal arrays are updated and the library will be in any case ready for name generation. You should NOT generate names using nr_txt2nar on the same source file. If the source is the same, save a .NAR file and use that with the below function.
How to load a NAR rule file
// like in fopen("rulname.nar", "rb"), which is not allowed because the file needs to be cached through an RWops object
rulefile = RWFromFile("rulname.nar", "rb");
After this the needed rules for the name generation will have been recognized.
How to generate a single name
void nr_name(char *genname, int minsyl, int maxsyl);
minsyl is the minimum number of syllables and maxsyl the maximum number of syllables of the generated name.
Note: genname must be a char * array at least big maxsyl*MAX_SYLLABE_LEN+1 characters!
What's New in This Release:
· Some bugs have been fixed, a Win32 example has been added, and the project files for dev-cpp are now correctly working.