1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - PRC -
3 File: prc.c
4
5 Copyright 2003-2008 Nintendo. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law. They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12
13 $Date:: 2008-09-18#$
14 $Rev: 8573 $
15 $Author: okubata_ryoma $
16 *---------------------------------------------------------------------------*/
17
18 #include <nitro.h>
19 #include <nitro/prc/common.h>
20
21 /*===========================================================================*
22 Prototype Declarations
23 *===========================================================================*/
24
25 /*===========================================================================*
26 Variable Definitions
27 *===========================================================================*/
28 static BOOL PRCi_Initialized = FALSE;
29
30 /*===========================================================================*
31 Functions
32 *===========================================================================*/
33
34 /*---------------------------------------------------------------------------*
35 Name: PRCi_Init
36
37 Description: Initializes pattern recognition API.
38 Called first from initialization routines in each recognition algorithm.
39
40 Arguments: None.
41
42 Returns: None.
43 *---------------------------------------------------------------------------*/
PRCi_Init(void)44 void PRCi_Init(void)
45 {
46 if (PRCi_Initialized == TRUE)
47 return;
48
49 // Initialize Something...
50
51 PRCi_Initialized = TRUE;
52 }
53
54 /*---------------------------------------------------------------------------*
55 Name: PRC_GetEntryStrokes
56
57 Description: Gets dot sequence data from sample DB and sample DB entry.
58
59 Arguments: strokes: Obtained dot sequence data
60 Overwriting is not permitted.
61 prototypeList: Sample pattern list
62 entry: Sample DB entry
63
64 Returns: None.
65 *---------------------------------------------------------------------------*/
66 void
PRC_GetEntryStrokes(PRCStrokes * strokes,const PRCPrototypeList * prototypeList,const PRCPrototypeEntry * entry)67 PRC_GetEntryStrokes(PRCStrokes *strokes,
68 const PRCPrototypeList *prototypeList, const PRCPrototypeEntry *entry)
69 {
70 if (entry != NULL)
71 {
72 strokes->points = (PRCPoint *)&prototypeList->pointArray[entry->pointIndex];
73 strokes->size = entry->pointCount;
74 strokes->capacity = entry->pointCount;
75 }
76 else
77 {
78 strokes->points = NULL;
79 strokes->size = 0;
80 strokes->capacity = 0;
81 }
82 }
83
84 /*---------------------------------------------------------------------------*
85 Name: PRC_CopyStrokes
86
87 Description: Deep copies dot sequence data.
88
89 Arguments: srcstrokes: The copy source's PRC_Strokes structure
90 dststrokes: The copy destination PRC_Strokes structure
91
92 Returns: If copy worked, TRUE.
93 *---------------------------------------------------------------------------*/
PRC_CopyStrokes(const PRCStrokes * srcStrokes,PRCStrokes * dstStrokes)94 BOOL PRC_CopyStrokes(const PRCStrokes *srcStrokes, PRCStrokes *dstStrokes)
95 {
96 int iPoint, size;
97 PRCPoint *dstPoint;
98 const PRCPoint *srcPoint;
99
100 SDK_ASSERT(dstStrokes);
101 SDK_ASSERT(srcStrokes);
102
103 if (srcStrokes->size > dstStrokes->capacity)
104 {
105 return FALSE;
106 }
107
108 size = dstStrokes->size = srcStrokes->size;
109 srcPoint = srcStrokes->points;
110 dstPoint = dstStrokes->points;
111 for (iPoint = 0; iPoint < size; iPoint++)
112 {
113 *dstPoint = *srcPoint;
114 dstPoint++;
115 srcPoint++;
116 }
117
118 return TRUE;
119 }
120
121
122 /*---------------------------------------------------------------------------*
123 End of file
124 *---------------------------------------------------------------------------*/
125