]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode: cpp; mode: fold -*- | |
2 | // Description /*{{{*/ | |
3 | // $Id: pkgsystem.cc,v 1.3 2004/02/27 00:43:16 mdz Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | System - Abstraction for running on different systems. | |
7 | ||
8 | Basic general structure.. | |
9 | ||
10 | ##################################################################### */ | |
11 | /*}}}*/ | |
12 | // Include Files /*{{{*/ | |
13 | #include<config.h> | |
14 | ||
15 | #include <apt-pkg/pkgsystem.h> | |
16 | #include <cassert> | |
17 | #include <cstring> | |
18 | /*}}}*/ | |
19 | ||
20 | pkgSystem *_system = 0; | |
21 | static pkgSystem *SysList[10]; | |
22 | pkgSystem **pkgSystem::GlobalList = SysList; | |
23 | unsigned long pkgSystem::GlobalListLen = 0; | |
24 | ||
25 | // System::pkgSystem - Constructor /*{{{*/ | |
26 | // --------------------------------------------------------------------- | |
27 | /* Add it to the global list.. */ | |
28 | pkgSystem::pkgSystem() : Label(NULL), VS(NULL) | |
29 | { | |
30 | assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList)); | |
31 | SysList[GlobalListLen] = this; | |
32 | ++GlobalListLen; | |
33 | } | |
34 | /*}}}*/ | |
35 | // System::GetSystem - Get the named system /*{{{*/ | |
36 | // --------------------------------------------------------------------- | |
37 | /* */ | |
38 | pkgSystem *pkgSystem::GetSystem(const char *Label) | |
39 | { | |
40 | for (unsigned I = 0; I != GlobalListLen; I++) | |
41 | if (strcmp(SysList[I]->Label,Label) == 0) | |
42 | return SysList[I]; | |
43 | return 0; | |
44 | } | |
45 | /*}}}*/ |