- changed name of package library to package.dll
[reactos.git] / rosapps / packmgr / lib / package.hpp
1 ////////////////////////////////////////////////
2 //
3 // package.hpp
4 // Package C++ Header
5 ////////////////////////////////////////////////
6
7 #include <windows.h>
8 #include <vector>
9 #include "error.h"
10
11 using namespace std;
12
13
14 /* Callbacks */
15
16 typedef int (*PML_AddItem) (int id, const char* name, int parent, int icon);
17 typedef int (*PML_SetStatus) (int status1, int status2, WCHAR* text);
18 typedef int (*PML_SetButton) (DWORD dwID, BOOL state);
19 typedef int (*PML_SetIcon) (int id, int icon);
20 typedef int (*PML_SetText) (const char* text);
21 typedef int (*PML_Ask) (const WCHAR* text);
22
23
24 /* Structs */
25
26 typedef struct
27 {
28 char* path;
29 char* name;
30 char* description;
31 char** field;
32
33 BOOL icon;
34 BOOL loaded;
35 vector<int> neededBy;
36 vector<int> children;
37 vector<char*> depencies;
38
39 int action;
40 char* files [4];
41
42 union //which actions are possible
43 {
44 struct { BOOL none, inst, src_inst, update, uninstall; };
45 BOOL actions [4];
46 };
47
48 } PACKAGE;
49
50 typedef struct
51 {
52 char** field;
53
54 vector<char*> todo;
55 vector<char*> sources;
56 vector<char*> descriptionPath;
57 vector<PACKAGE> packages;
58
59 PML_AddItem addItem;
60 PML_SetButton setButton;
61 PML_SetStatus setStatus;
62 PML_SetIcon setIcon;
63 PML_SetText setText;
64
65 } TREE, *pTree;
66
67 #define MAXNODES 10000
68
69
70 /* Prototypes */
71
72 extern "C"
73 {
74 void PML_Abort (void);
75 WCHAR* PML_TransError (int code, WCHAR* string, INT maxchar);
76
77 int PML_LoadTree (pTree*, char* url, PML_AddItem);
78 int PML_FindItem (TREE* tree, const char* what);
79 int PML_LoadPackage (pTree, int id, PML_SetButton);
80 char* PML_GetDescription (TREE* tree, int id);
81 int PML_SetAction (pTree, int package, int action, PML_SetIcon, PML_Ask);
82 int PML_DoIt (pTree, PML_SetStatus, PML_Ask);
83
84 void PML_CloseTree (pTree);
85 }
86
87
88 /* Version */
89
90 #define PACKMGR_VERSION_MAJOR 0
91 #define PACKMGR_VERSION_MINOR 3
92 #define PACKMGR_VERSION_PATCH_LEVEL 1