EnglishРусский  

   ..

   main.g

   sizelines.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

 1 /******************************************************************************
 2 *
 3 * Copyright (C) 2006, 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: sizelines 18.10.06 0.0.A.
11 *
12 * Author: Aleksandr Antypenko ( santy )
13 *
14 ******************************************************************************/
15 
16 type flinfo
17 {
18   uint countsize
19   uint countlines
20 }
21 
22 /*
23 *   Function sizelines - 
24 *     
25 *   Parameters: 
26 *           uint addfinfo  -  addrees of flinfo structure
27 *           str filePath   -  path and pattern for search files
28 *
29 *   Return :
30 *        fill structure flinfo   
31 *
32 */
33 func int sizelines(flinfo addfinfo,str filePath)
34 {
35    str foundPattern,readstr,sDir
36    ffind fd
37    uint idfile
38    arr proglines of str
39    
40    sDir.fgetdir(filePath)
41    if !(direxist(sDir)) : print("Error. Directory not found. \n".char2oem()); return 0 
42    if !(setcurdir(sDir)) :  print("Error. Can not set current directory. \n".char2oem()); return 0 
43    foundPattern =filePath //+ patternFile  
44    fd.init( foundPattern, $FIND_FILE | $FIND_RECURSE )
45    foreach finfo cur,fd
46    {
47       idfile = open(cur.fullname,$OP_READONLY) 
48       if !(idfile) : continue
49       readstr.read(cur.fullname)
50       readstr.lines(proglines,0)
51       //print("Size -> \(getsize(idfile)) Lines -> \(*proglines) \n")
52       addfinfo.countsize  += getsize(idfile)
53       addfinfo.countlines += *proglines
54       if !(close(idfile)): print("Error closing file \n")
55    }
56    return 1
57 }
58 
59  
60