summaryrefslogtreecommitdiff
path: root/iup/src/iup_maskparse.h
blob: a12a7fa123832a0654f8453c78d0b61425f1874d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/** \file
 * \brief Mask internal functions
 *
 * See Copyright Notice in "iup.h"
 */
 
#ifndef __IUP_MASKPARSE_H 
#define __IUP_MASKPARSE_H

#ifdef __cplusplus
extern "C" {
#endif


typedef struct _ImaskParsed
{
  char ch;
  int command;
  int next1;
  int next2;
} ImaskParsed;

typedef int (*iMaskMatchFunc) (char which_one, long next_pos, long capture_pos, const char *text, void* user_data);

/* Parse the mask and if it is ok create and returns the internal structure. */
int iupMaskParse(const char* mask, ImaskParsed** imk);

/* Do the pattern matching on the given text. */
int iupMaskMatch(const char* text, ImaskParsed* imk, long start, iMaskMatchFunc mask_func, void* user_data, char *addchar, int icase);

/* Change a control character. */
int iupMaskSetChar(int char_number, char new_char);

/* iupMaskMatch return codes */
#define IMASK_PARSE_OK     0    /* No error      */
#define IMASK_NOMATCH     -1    /* no match      */
#define IMASK_MEM_ERROR   -2    /* memory error  */
#define IMASK_PARSE_ERROR -3    /* parser error  */
#define IMASK_PARTIALMATCH -4   /* partial match */


#ifdef __cplusplus
}
#endif

#endif