]>
Commit | Line | Data |
---|---|---|
b2e465d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
cb063009 | 3 | // $Id: pkgsystem.cc,v 1.3 2004/02/27 00:43:16 mdz Exp $ |
b2e465d6 AL |
4 | /* ###################################################################### |
5 | ||
6 | System - Abstraction for running on different systems. | |
7 | ||
8 | Basic general structure.. | |
9 | ||
10 | ##################################################################### */ | |
11 | /*}}}*/ | |
12 | // Include Files /*{{{*/ | |
ea542140 DK |
13 | #include<config.h> |
14 | ||
b2e465d6 | 15 | #include <apt-pkg/pkgsystem.h> |
cb063009 | 16 | #include <cassert> |
4f333a8b | 17 | #include <cstring> |
b2e465d6 AL |
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.. */ | |
dcaa1185 | 28 | pkgSystem::pkgSystem() : Label(NULL), VS(NULL) |
b2e465d6 | 29 | { |
cb063009 | 30 | assert(GlobalListLen < sizeof(SysList)/sizeof(*SysList)); |
b2e465d6 | 31 | SysList[GlobalListLen] = this; |
dcaa1185 | 32 | ++GlobalListLen; |
b2e465d6 AL |
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 | /*}}}*/ |