source\example\autoformat\main.g
1 #!gentee.exe -p default "%1" -k test.g
2 /******************************************************************************
3 *
4 * Copyright (C) 2004-2006, The Gentee Group. All rights reserved.
5 * This file is part of the Gentee open source project.
6 * http://www.gentee.com
7 *
8 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
9 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
10 * ACCEPTANCE OF THE AGREEMENT.
11 *
12 * ID: main.g 12.10.06
13 *
14 * Author: Aleksandr Antypenko ( santy )
15 *
16 * Summary: Example of the using gentee analizer, utility autoformatting Gentee sources
17 *
18 ******************************************************************************/
19
20
21 include
22 {
23 $"..\..\lib\lex\lex.g"
24 "lexfgentee.g"
25 }
26
27
28 include
29 {
30 "autoformat.g"
31 }
32
33 func formatfile <main>()
34 {
35 str findDir,sBak //"C:\\gentee\\";
36 byte bCreateBak = 0
37 if argc()<1 || argc()>2 || (argc() == 2 && argv(sBak,1) != "-k")
38 {
39 print("\t\nUsage : formatfile [Options] [File_name] \n")
40 print("\t\n Options : -k - Create backup file\n")
41 print("\n")
42 print("\n")
43 getch()
44 exit(1)
45 }
46 congetch("Oooops\n")
47 if (argc() == 1): argv(findDir,1)
48 else : bCreateBak = 1; argv(findDir,2)
49 print("--------------------------\n\n")
50 if !( formatfile(findDir,3,80,bCreateBak)) : print("Error run function \n")
51 else : print("File -- "+findDir+" -- was formatted. \n")
52 print("\n--------------------------\n")
53 //else : print("Ok. Formated file -> \(argv(findDir,1)) \n")
54 getch()
55 }
56
57
58