Browse Subversion Repository
Contents of /branches/mty-makai/synth.h
Parent Directory
| Revision Log
Revision 192 -
( show annotations)
( download)
( as text)
Mon May 26 06:29:35 2008 UTC
(15 years, 10 months ago)
by notanpe
File MIME type: text/x-chdr
File size: 1435 byte(s)
シーズン 2 に向けて
| 1 |
/*********************************************************************** |
| 2 |
* |
| 3 |
* file: synth.h |
| 4 |
* |
| 5 |
* $Id$ |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef SYNTH_H__ |
| 10 |
#define SYNTH_H__ |
| 11 |
|
| 12 |
#include <stdio.h> |
| 13 |
#include "mtytypes.h" |
| 14 |
|
| 15 |
struct WDICT; |
| 16 |
struct DICT_CHAR; |
| 17 |
|
| 18 |
/* 結果格納スロット |
| 19 |
PARAM::hit[n] */ |
| 20 |
#define HIT_ANY 0 |
| 21 |
#define HIT_BOOL 1 |
| 22 |
|
| 23 |
enum NODE_ID |
| 24 |
{ |
| 25 |
NI_LR = -256, |
| 26 |
NI_SEQ, /* XXX */ |
| 27 |
NI_NOT, |
| 28 |
NI_AND, |
| 29 |
NI_OR, |
| 30 |
NI_XOR, |
| 31 |
NI_NAND, |
| 32 |
NI_MAX, /* sentinel */ |
| 33 |
}; |
| 34 |
|
| 35 |
struct ITREE |
| 36 |
{ |
| 37 |
int opcode; /* NODE_ID もしくは生の OP_XXX */ |
| 38 |
int tn; /* ワークエリア上の割り当て位置(t[tn]) */ |
| 39 |
|
| 40 |
/* for OP_LR */ |
| 41 |
uint64_t bmp; /* 集合 */ |
| 42 |
int lrn; /* キャラ位置(1..10) */ |
| 43 |
|
| 44 |
/* for DICT */ |
| 45 |
struct WDICT *dict; |
| 46 |
|
| 47 |
int ref; /* 被参照数 */ |
| 48 |
|
| 49 |
/* オペランド */ |
| 50 |
int n_ops; |
| 51 |
int n_alloc; /* 確保長(n_ops <= n_alloc) */ |
| 52 |
struct ITREE **ops; |
| 53 |
struct ITREE *tops[2]; |
| 54 |
}; |
| 55 |
|
| 56 |
extern struct ITREE *synth_make_not(void); |
| 57 |
extern struct ITREE *synth_make_and(void); |
| 58 |
extern struct ITREE *synth_make_or(void); |
| 59 |
extern struct ITREE *synth_make_xor(void); |
| 60 |
|
| 61 |
extern int synth_unlink(struct ITREE *node); |
| 62 |
|
| 63 |
extern struct ITREE *synth_make_lr(uint64_t bmp, int lrn); |
| 64 |
|
| 65 |
extern struct ITREE *synth_make_dict(int pos, |
| 66 |
struct DICT_CHAR const *word); |
| 67 |
|
| 68 |
extern struct ITREE *synth_add(struct ITREE *parent, ...); /* NULL terminated */ |
| 69 |
|
| 70 |
extern int synth_synthesize(FILE *sfp, |
| 71 |
struct ITREE *node); |
| 72 |
|
| 73 |
#endif /* SYNTH_H__ */ |
| 74 |
|
| 75 |
/* |
| 76 |
* Local Variables: |
| 77 |
* tab-width: 4 |
| 78 |
* End: |
| 79 |
* |
| 80 |
* EOF */ |
Properties
| svn:eol-style |
native
|
| svn:keywords |
Author Date Id Rev URL
|
| |