Home | History | Annotate | Download | only in fips181
      1 /*
      2 ** This module uses code from the NIST implementation of  FIPS-181,
      3 ** but the algorythm is CHANGED and I think that I CAN
      4 ** copyright it. See copiright notes below.
      5 */
      6 
      7 /*
      8 ** Copyright (c) 1999, 2000, 2001, 2002, 2003
      9 ** Adel I. Mirzazhanov. All rights reserved
     10 **
     11 ** Redistribution and use in source and binary forms, with or without
     12 ** modification, are permitted provided that the following conditions
     13 ** are met:
     14 **
     15 **     1.Redistributions of source code must retain the above copyright notice,
     16 **       this list of conditions and the following disclaimer.
     17 **     2.Redistributions in binary form must reproduce the above copyright
     18 **       notice, this list of conditions and the following disclaimer in the
     19 **       documentation and/or other materials provided with the distribution.
     20 **     3.The name of the author may not be used to endorse or promote products
     21 **       derived from this software without specific prior written permission.
     22 **
     23 ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND ANY EXPRESS
     24 ** OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO, THE IMPLIED
     25 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26 ** ARE DISCLAIMED.  IN  NO  EVENT  SHALL THE AUTHOR BE LIABLE FOR ANY
     27 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28 ** DAMAGES (INCLUDING, BUT NOT LIMITED TO,  PROCUREMENT OF SUBSTITUTE
     29 ** GOODS OR SERVICES;  LOSS OF USE,  DATA,  OR  PROFITS;  OR BUSINESS
     30 ** INTERRUPTION)  HOWEVER  CAUSED  AND  ON  ANY  THEORY OF LIABILITY,
     31 ** WHETHER  IN  CONTRACT,   STRICT   LIABILITY,  OR  TORT  (INCLUDING
     32 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     33 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     34 */
     35 
     36 
     37 #ifndef APG_PRONPASS_H
     38 #define APG_PRONPASS_H	1
     39 
     40 #ifndef APG_OWN_TYPES_H
     41 #include "owntypes.h"
     42 #endif /* APG_OWN_TYPES_H */
     43 
     44 #define RULE_SIZE             (sizeof(rules)/sizeof(struct unit))
     45 #define ALLOWED(flag)         (digram[units_in_syllable[current_unit -1]][unit] & (flag))
     46 
     47 #define MAX_UNACCEPTABLE      20
     48 #define MAX_RETRIES           (4 * (int) pwlen + RULE_SIZE)
     49 
     50 #define NOT_BEGIN_SYLLABLE    010
     51 #define NO_FINAL_SPLIT        04
     52 #define VOWEL                 02
     53 #define ALTERNATE_VOWEL       01
     54 #define NO_SPECIAL_RULE       0
     55 
     56 #define BEGIN                 0200
     57 #define NOT_BEGIN             0100
     58 #define BREAK                 040
     59 #define PREFIX                020
     60 #define ILLEGAL_PAIR          010
     61 #define SUFFIX                04
     62 #define END                   02
     63 #define NOT_END               01
     64 #define ANY_COMBINATION       0
     65 
     66 #define S_NB    0x01 /* Numeric */
     67 #define S_SS    0x02 /* Special */
     68 #define S_CL    0x04 /* Capital */
     69 #define S_SL    0x08 /* Small   */
     70 #define S_RS    0x10 /* Restricted Symbol*/
     71 
     72 extern int gen_pron_pass (char *word, char* hypenated_word,
     73                           USHORT minlen, USHORT maxlen, unsigned int pass_mode);
     74 USHORT  random_unit (USHORT type);
     75 USHORT  get_random (USHORT minlen, USHORT maxlen);
     76 boolean have_initial_y (USHORT *units, USHORT unit_size);
     77 boolean illegal_placement (USHORT *units, USHORT pwlen);
     78 boolean improper_word (USHORT *units, USHORT word_size);
     79 boolean have_final_split (USHORT *units, USHORT unit_size);
     80 int gen_word (char *word, char *hyphenated_word, USHORT pwlen, unsigned int pass_mode);
     81 char   	*gen_syllable(char *syllable, USHORT pwlen, USHORT *units_in_syllable,
     82                       USHORT *syllable_length);
     83 
     84 #endif /* APG_PRONPASS_H */
     85