"Fossies" - the Fresh Open Source Software Archive

Member "apg-2.2.3/pronpass.h" (7 Aug 2003, 3350 Bytes) of package /linux/privat/old/apg-2.2.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 #ifndef APG_RND_H
   45 #include "rnd.h"
   46 #endif /* APG_RND_H */
   47 
   48 #define RULE_SIZE             (sizeof(rules)/sizeof(struct unit))
   49 #define ALLOWED(flag)         (digram[units_in_syllable[current_unit -1]][unit] & (flag))
   50 
   51 #define MAX_UNACCEPTABLE      20
   52 #define MAX_RETRIES           (4 * (int) pwlen + RULE_SIZE)
   53 
   54 #define NOT_BEGIN_SYLLABLE    010
   55 #define NO_FINAL_SPLIT        04
   56 #define VOWEL                 02
   57 #define ALTERNATE_VOWEL       01
   58 #define NO_SPECIAL_RULE       0
   59 
   60 #define BEGIN                 0200
   61 #define NOT_BEGIN             0100
   62 #define BREAK                 040
   63 #define PREFIX                020
   64 #define ILLEGAL_PAIR          010
   65 #define SUFFIX                04
   66 #define END                   02
   67 #define NOT_END               01
   68 #define ANY_COMBINATION       0
   69 
   70 extern int gen_pron_pass (char *word, char *hyphenated_word, USHORT minlen,
   71                USHORT maxlen, unsigned int pass_mode);
   72 
   73 USHORT  random_unit (USHORT type);
   74 USHORT  get_random (USHORT minlen, USHORT maxlen);
   75 boolean have_initial_y (USHORT *units, USHORT unit_size);
   76 boolean illegal_placement (USHORT *units, USHORT pwlen);
   77 boolean improper_word (USHORT *units, USHORT word_size);
   78 boolean have_final_split (USHORT *units, USHORT unit_size);
   79 int gen_word (char *word, char *hyphenated_word, USHORT pwlen,
   80               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 */