Skip to content

neil-edelman/orcish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

orcish.c

Name generator

Orcish names originate or are inspired by JRR Tolkien's Orcish.

  • Standard:
    C89
ModifiersFunction NameArgument List
voidorcishname, name_size
voidorc_longname, name_size, l
voidorc_ptrname, name_size, p
const char *orcifyp

void orcish(char *const name, const size_t name_size)

Fills name with a random Orcish name. Potentially up to name_size - 1, (with a maximum of 128,) then puts a null terminator. Uses rand from stdlib.h.

  • Parameter: name
    A valid pointer to at least name_size characters.
  • Parameter: name_size
    If zero, does nothing.

void orc_long(char *const name, const size_t name_size, const unsigned long l)

Fills name with a deterministic Orcish name based on l, potentially up to name_size - 1, (with a maximum,) then puts a null terminator.

  • Parameter: name
    A valid pointer to at least name_size characters.
  • Parameter: name_size
    If zero, does nothing.

void orc_ptr(char *const name, const size_t name_size, const void *const p)

Fills name with a deterministic Orcish name based on p, or if p is null, then "null". Potentially up to name_size - 1, (with a maximum,) then puts a null terminator.

  • Parameter: name
    A valid pointer to at least name_size characters.
  • Parameter: name_size
    If zero, does nothing.

const char *orcify(const void *const p)

Call orc_ptr with p with default values and a small temporary buffer.

  • Return:
    A temporary string; can handle four names at a time.

2014 Neil Edelman, distributed under the terms of the MIT License. Orcish is from JRR Tolkien's work, and some syllables from SMAUG, which is a derivative of Merc, and DikuMud; used under fair-use. Contains MurmurHash-derived code, placed in public domain by Austin Appleby.