CARDS 2.3.99
Package manager for the NuTyX GNU/Linux distribution
compile_dependencies_utils.h
1 //
2 // compile_dependencies_utils.h
3 //
4 // Copyright (c) 2013-2017 by NuTyX team (http://nutyx.org)
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // USA.
20 //
21 
22 #ifndef COMPILE_DEPENDENCIES_UTILS_H
23 #define COMPILE_DEPENDENCIES_UTILS_H
24 
25 #include "string_utils.h"
26 #include "file_utils.h"
27 #include "cards_argument_parser.h"
28 
29 #include <iostream>
30 #include <cstdlib>
31 #include <set>
32 #include <string>
33 #include <list>
34 #include <map>
35 
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <errno.h>
39 #include <locale.h>
40 #include <string.h>
41 #include <sys/types.h>
42 #include <sys/stat.h>
43 #include <sys/file.h>
44 #include <dirent.h>
45 
46 /* depList is a dependances List */
47 typedef struct
48 {
49  unsigned int *depsIndex;
50  int *niveau; /* To show a nice incrementation */
51  unsigned int count;
52  unsigned int decrement; /* number of removed dep when searching them */
53  int decount;
54 } depList;
55 
56 /* pkgInfo is the name of a package and the dependencies itemList */
57 typedef struct
58 {
59  unsigned int nameIndex;
60  depList *dependences;
61  int niveau;
62 } pkgInfo;
63 
64 typedef struct
65 {
66  pkgInfo **pkgs;
67  unsigned int count;
68 } pkgList;
69 
70 
71 /*
72  * depList: Create the list, Add dependence to the list, free the list
73  */
74 depList *initDepsList(void);
75 void addDepToDepList(depList *list, unsigned int nameIndex, int niveau);
76 void freeDepList(depList *list);
77 
78 /*** pkgInfo: create the pkg, Add info, free the pkgInfo ***/
79 pkgInfo *initPkgInfo(void);
80 pkgInfo *addInfoToPkgInfo(unsigned int nameIndex);
81 void freePkgInfo(pkgInfo *package);
82 
83 /*** pkgList: create the pkgList, add pkgs, free the pkgList ***/
84 pkgList *initPkgList(void);
85 void addPkgToPkgList(pkgList *list, pkgInfo *package);
86 void freePkgList(pkgList *packagesList);
87 
88 int deps_direct (itemList *filesList, pkgList *packagesList, depList *dependenciesList,unsigned int niveau);
89 int deps_direct (itemList *filesList, pkgList *packagesList, depList *dependenciesList,const char* pkgName, unsigned int niveau);
90 
91 void generate_level ( itemList *filesList, pkgList *packagesList, unsigned int *niveau);
92 
93 char *getLongPackageName(itemList *filesList, const char * packageName);
94 #endif /* COMPILE_DEPENDENCIES_UTILS_H */
95 // vim:set ts=2 :
Definition: libcards.h:481
Definition: compile_dependencies_utils.h:47
Definition: compile_dependencies_utils.h:57
Definition: compile_dependencies_utils.h:64