1 /******************************************************************************
2 *
3 * Copyright (C) 2005, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * ID: runini 17.10.06 0.0.A.
11 *
12 * Author: Alexey Krivonogov ( gentee )
13 *
14 ******************************************************************************/
15
16 include : $"..\..\lib\ini\ini.g"
17
18 func uint openini( ini retini )
19 {
20 str inifile = "runini.ini"
21
22 if !fileexist( inifile )
23 {
24 congetch( "Cannot find file \(inifile).\nPress any key..." )
25 exit( 0 )
26 }
27 retini.read( inifile )
28 return 1
29 }
30
31 func uint idaction( ini retini, str section )
32 {
33 str src name outname
34 uint run exe result nodll
35
36 retini.getvalue( section, "Src", src, "" )
37 if !*src
38 {
39 congetch("ID '\(section)' is not valid. Press any key...\n")
40 return 0
41 }
42 run = retini.getnum( section, "Run", 1 )
43 exe = retini.getnum( section, "Exe", 0 )
44
45 retini.getvalue( section, "Output", outname, "" )
46
47 if exe
48 {
49 process( "..\\..\\exe\\gentee.exe -p samples \(src)", ".", &result )
50 src.fsetext( src, "ge" )
51 process( "..\\..\\exe\\ge2exe.exe \(src)", ".", &result )
52 deletefile( src )
53 src.fsetext( src, "exe" )
54 if run : process( src, ".", &result )
55 }
56 else : shell( src )
57
58 return 1
59 }
60
61 func runini< main >
62 {
63 ini tini
64 arrstr sections
65 str name src section
66
67 openini( tini )
68
69 tini.sections( sections )
70 while 1
71 {
72 print( "-----------\n" )
73 foreach cur, sections
74 {
75 tini.getvalue( cur, "Src", src, "" )
76 if !*src : continue
77
78 tini.getvalue( cur, "Name", name, src )
79 print( "\(cur)".fillspacer( 20 ) + name + "\n" )
80 }
81 print( "-----------\n" )
82 congetstr("Enter ID name (enter 0 to exit): ", section )
83 if section[0] == '0' : break
84
85 idaction( tini, section )
86 }
87 }
88
Редактировать