1 global {
2 str gfgstart = "//!GFG "
3 str gfgend = "//!\\GFG"
4 }
5
6 func uint replcode( str src lab labnew newcode )
7 {
8 spattern sp
9 uint offs, offe
10 sp.init( gfgstart + lab, 0 )
11 offs = sp.search( src, 0 )
12 if offs != *src
13 {
14 sp.init( gfgend, 0 )
15 offe = sp.search( src, offs )
16 if offe != *src
17 {
18 src.replace( offs, offe - offs + *gfgend, gfgstart+labnew+"\l"+newcode+gfgend )
19 return 1
20 }
21 }
22 return 0
23 }
24
25 func uint replcode( str src lab newcode )
26 {
27 return replcode( src, lab, lab, newcode )
28 }
29
30 func inscode( str src lab newcode endcode )
31 {
32 src@"\l"@gfgstart@lab@\"\l"@newcode@gfgend@"\l"@endcode@"\l"
33 }
34
35 func delcode( str src lab )
36 {
37 spattern sp
38 uint offs, offe
39 sp.init( gfgstart + lab, 0 )
40 offs = sp.search( src, 0 )
41 if offs != *src
42 {
43 sp.init( gfgend, 0 )
44 offe = sp.search( src, offs )
45 if offe != *src
46 {
47 src.replace( offs, offe - offs + *gfgend, "" )
48 if src[ offs ] == 0x0d && src[ offs + 1 ] == 0x0a
49 {
50 //print( "pre\n" )
51 src.del( offs, 2 )
52 }
53 if src[ offs ] == 0x0d && src[ offs + 1 ] == 0x0a
54 {
55 //print( "pre\n" )
56 src.del( offs, 2 )
57 }
58 if src[ offs - 2 ] == 0x0d && src[ offs - 1 ] == 0x0a
59 {
60 //print( "post\n" )
61 src.del( offs - 2, 2 )
62 }
63 }
64
65
66 }
67 return
68 }
69
70 /*includetxt, includetxtend
71 formlist, in
72 */
73
74 /*
75 //!GFG и //!\GFG are commentary attributes generated by
76 the Gentee form editor. You should neither delete them
77 nor make any changes into the source code from the beginning
78 of the commentary attribute //!GFG to its end //!\GFG
79 *//*8
80 //!GFG include
81 include {
82 "app.g"
83 "btn.g"
84 "panel.g"
85 "edit.g"
86 "listbox.g" //!\GFG
87
88 }
89
90
91 //!GFG type
92 type vform0 <inherit = vform>
93 {
94 vedit edit0
95 vbtn btn0
96 vedit edit1
97 vbtn btn1 //!\GFG
98 }
99
100 //!GFG method edit0_change eventn
101 method uint vform0.edit0_change( eventn evn )//!GFG*/