Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ J_UD_delete(3X) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

open_jlib(3X)

SetUserDict(3X)

J_UD_SEARCH(3X)

NAME

J_UD_open, J_UD_close, J_UD_search, J_UD_free, J_UD_store, J_UD_delete − manage user dictionaries

SYNOPSIS

#include <jlib.h>

UserDict *J_UD_open (filename, mode)
char *filename;
int mode;

int J_UD_close (dp)
UserDict *dp;

int J_UD_store (key, kouho, dp)
unsigned char *key;
UDKouho *kouho;
UserDict *dp;

int J_UD_delete (key, kouho, dp)
unsigned char *key;
UDKouho *kouho;
UserDict *dp;

UDKouhogun *J_UD_search (key, dp)
unsigned char *key;
UserDict *dp;

int J_UD_free (p)
UDKouhogun *p;

DESCRIPTION

J_UD_open opens the user dictionary named by filename and returns a dictionary pointer to the UserDict structure associated with the dictionary.  The UserDict structure is declared in the <jlib.h> header file.  Various operations to a user dictionary can be performed only by a dictionary pointer.  The argument mode must be one of the following:

RDONLY Open for reading only. 

RDWR Open for update (reading and writing). 

If J_UD_open
 tries to open the named dictionary and it does not exist, J_UD_open creates a new dictionary. 

Dp is a dictionary pointer obtained from a J_UD_open call.  J_UD_close closes the dictionary pointer indicated by dp.

J_UD_store is used to store a word.  The arguments to J_UD_store are key and kouho. Key is a pointer to YOMI about a word to be stored and must be made of HIRAGANA characters.  The permissible number of characters is 8 at most, counting DAKUTEN and HANDAKUTEN as one character. 

The UDKouho structure includes the following fields:

unsigned char *hyouki; /* HYOUKI (an array of characters terminated by a null character)*/
int hinshi; /* HINSHI */

It is necessary to give hyouki and hinshi in a UDKouho structure before calling J_UD_store. Hyouki points to HYOUKI about the word and must be made of 16-bit Japanese characters.  The permissible number of characters is 10 at most.  A permissible value for Hinshi is as follows:

MEISHI noun

If a dictionary does not contain a word equal to that to be stored, J_UD_store stores the word into the dictionary. 

J_UD_delete is used to delete a word from a user dictionary.  The arguments are the same as for J_UD_store.  If a dictionary does not contain a word equal to that to be deleted, J_UD_delete takes no action and no errors are encountered. 

J_UD_search is used to search a word.  Key is a pointer to YOMI about the word to be found.  J_UD_search returns a pointer to a UDKouhogun structure.  The UDKouhogun structure is declared in the <jlib.h> header file:

typedef struct {

int nkouho: /* number of KOUHOs */
UDKouho **kouho; /* KOUHO table */

} UDKouhogun;

Nkouho equal to 0 means there is no word in a dictionary equal to *key (the value pointed to by key).  The first entry in KOUHO table is the last stored one for the key. 

J_UD_search allocates a space to store a set of KOUHO itself.  The argument to J_UD_free is a pointer obtained from a J_UD_search call.  After J_UD_free is performed, this space is made available for further allocation. 

DIAGNOSTICS

J_UD_open returns a dictionary pointer upon successful completion.  Otherwise, a NULL pointer is returned and jlib_errno is set to indicate the error:

[JUDNOSPC] The named dictionary cannot be created. 

[JUDNOENT] The named dictionary cannot be opened for reading because it does not exist. 

[JUDBADENT] The named file exists but it is not a user dictionary. 

[JUDACCES] The dictionary exists but permission is denied. 

[JUDWRONG] The format of the dictionary is wrong. 

[JUDINVAL] Mode specifies neither RDONLY nor RDWR. 

J_UD_close returns a value of 0 upon successful completion.  Otherwise, a value of -1 is returned and jlib_errno is set to indicate the error. 

[JUDBADDP] Dp is not a valid dictionary pointer. 

J_UD_store returns a value of 0 upon successful completion.  Otherwise, a value of -1 is returned and jlib_errno is set to indicate the error. 

[JUDBADDP] Dp is not a valid dictionary pointer. 

[JUDACCES] The dictionary exists and write permission is denied. 

[JUDNOSPC] The file system is full. 

[JUDINVAL] Hinshi is invalid.  Key includes illegal characters, or key is too long. 

J_UD_delete returns a value of 0 upon successful completion.  Otherwise, a value of -1 is returned and jlib_errno is set to indicate the error. 

[JUDBADDP] Dp is not a valid dictionary pointer. 

[JUDACCES] The dictionary exists and write permission is denied. 

[JUDINVAL] Key includes illegal characters, or key is too long. 

J_UD_search returns a pointer to a UDKouhogun structure upon successful completion.  Otherwise, a NULL pointer is returned and jlib_errno is set to indicate the error:

[JUDBADDP] Dp is not a valid dictionary pointer open for reading. 

[JUDNOSPC] Not enough space on memory to return the result. 

[JUDINVAL] Key includes illegal characters, or key is too long. 

J_UD_free returns a value of 0 upon successful completion.  Otherwise, a value of −1 is returned. 

WARNINGS

It is recommended to call J_UD_free before a J_UD_search call. 

J_UD_store, J_UD_delete, and J_UD_search do not check a lock for a file access. 

J_UD_open and J_UD_store invoke the command wdutil(1).

SEE ALSO

open_jlib(3X), SetUserDict(3X)

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026