seq( call(int socket(int, int, int)) && args(AF INET, SOCK STREAM, 0) && return(fd)then socket(AF INET, SOCK DGRAM, 0);call(int connect(int, struct socketaddr∗, socklen t)) && args(fd, address, length)then returnZero(); // where int returnZero() { return 0; }( call(size t read(int, void∗, size t)) && args(fd, readBuffer, readLength)then recvfrom(fd, readBuffer, readLength, 0, address, length);|| call(size t write(int, void∗, size t)) && args(fd, writeBuffer, writeLength)then sendto(fd, writeBuffer, writeLength, 0, address, length); ) ∗call(int close(int)) && args(fd) ; )Figure 2: An Aspect for Switching Transport <strong>Pro</strong>tocols, from TCP to UDPseq( call(void ∗ malloc(size t))&& args(allocatedSize) && return(buffer) ;write(buffer) && size(writtenSize)&& if(writtenSize > allocatedSize)then reportOverflow (); ∗call(void free(void∗)) )Figure 3: An Aspect for Detecting Buffer Overflowrespectively. Note that sequences of such access are potentiallytranslated (due to use of the repetition operator ∗).Finally, a call to close() on fd terminates the TCP protocolas well as the UDP protocol <strong>and</strong> thus is not modified (i.e.,there is no then clause). This last step is required to freethe variables used in the sequence (here, fd, address <strong>and</strong>length). Indeed, this aspect can use numerous (instances ofthese) variables when it deals with interleaved sequences, aseach call to socket() creates a new instance of the sequence.The aspect in shown in Fig. 3 detects buffer overflows.The corresponding sequence starts when the function malloc()returns the buffer address which is then bound tobuffer. Then, each time this address is accessed (througha global variable or a local alias) the size of the data to bewritten is compared with the size of the initially allocatedmemory. If the former exceeds the latter, an overflow isindicated. The sequence terminates when the memory isdeallocated by calling free().The aspect in Fig. 4 introduces prefetching in a web cache.The first controlflow phrase initializes prefetching whenan HTTP response is built (clientBuildReply()) within thecontrol flow of aclient request (clientSendMoreData()). Theuntil clause stops prefetching when the number of connectionbecomes too large, a situation where prefetching wouldeffectively degrade performance. The second controlflowphrase analyzes hyperlinks in a page being transmitted (i.e.,when comm write mbuf() is called within the control flow ofclientSendMoreData()). Finally, the last call phrase prefetcheshyperlinks analyzed by the second aspect. It does so byreplacing the method call to clientWriteComplete() withretrieveHyperlinks(). Finally, note that the two requireclauses at the top of the aspect declare the types of theglobal variables of the base program used in the aspects.3.2 Join point modelA join point model defines the points in the executionof the base program to which pointcuts may refer. In ourcase, join points are defined by JP in the grammar shownin Fig. 5. A join point is either:• A call of a function callJP(v 1 funId( −→ v 2)) with functionname funId, return value v 1 <strong>and</strong> a vector of arguments −→ v 2.JP ::= callJP(val funId( −→ val))| readGlobalJP(varId, val)| readJP(@, val)| writeGlobalJP(varId, val, size)| writeJP(@, val, size)| controlflowJP( −−−−→ funId, cfEnd)| controlflowstarJP( −−−−→ funId, cfEnd)cfEnd ::= callJP(val funId( −→ val))| readGlobalJP(varId, val)| writeGlobalJP(varId, val, size)val ::= 0 | 1 | 2 | ... // int| @0 | @1 | @2 | ... // int*| ... // values of other C typesFigure 5: Join point model• A read access which comes in two variants:readGlobalJP(varId, v) denotes reading a global variablewith name varId holding the value v; readJP(@, v)denotes reading a global variable or a local alias withaddress @ holding the value v.• Write access which also comes in two variants:writeGlobalJP(varId, v, size) denotes assignment to a globalvariable with name varId of the value v of size size.writeJP(@, v, size) denotes assignment to a global variableor a local alias with address @ of the value v of size size.• A cflow expression controlflowJP( −−−−→ funId, c), where−−−−→funId = [funId 1 , .., funId n] is a stack of function names, <strong>and</strong>c (either a function call or an access to a global variable) occurswithin the body of function funId n. Such a join pointrequires a call to funId i+1 within the body of funId i.• A cflow expression controlflowstarJP( −−−−→ funId, c), where−−−−→funId = [funId 1 , .., funId n] is a partial stack of functionnames, <strong>and</strong> c (either a function call or an access to a globalvariable) occurs within the control flow of function funId n.Such a join point requires a call to funId i+1 within thecontrol flow of (i.e., not necessarily in the body of) funId i.Two features of this join point model may be surprisingat first sight: distinction of accesses to aliases from those toglobal variables <strong>and</strong> explicit representation of control flowexpressions. Both are motivated by our quest for efficiency<strong>and</strong> are grounded in strong implementation constraints inthe context of dynamic weaving of binary C code: an accessto a local alias is several magnitudes slower than an access
<strong>Pro</strong>-<strong>Poor</strong> <strong>Tourism</strong>: <strong>Principles</strong>, <strong>Methodologies</strong> <strong>and</strong> Mainstreamingtourism is a sensible strategy for them; <strong>and</strong> the community empowered to manage itsimpacts, maximising the positives <strong>and</strong> minimising the negatives. . 6[11] <strong>Pro</strong>-poor <strong>Tourism</strong> strategies can bring economic, <strong>and</strong> non-economic benefitsincluding infrastructure gains, capacity building <strong>and</strong> training; <strong>and</strong> empowerment. Whilstthe main focus is generally on direct employment; <strong>and</strong> indirect employment throughmicro-enterprise development, it is important to look at the whole range of potentialbenefits (<strong>and</strong> possible negative impacts) <strong>and</strong> to look at livelihood diversification – thefocus of pro-poor tourism is on additional <strong>and</strong> supplementary livelihoods at the individual<strong>and</strong> household level. It is far less risky for communities to engage in tourism if thatengagement complements their existing livelihood strategies rather than competes with orreplaces them.[12*] I have listed here some of the key issues which I think need to be considered, it iscertainly not an exhaustive list <strong>and</strong> the issues differ from community to community. Iwould emphasise the importance of market access that requires both tourists nearby <strong>and</strong>opportunities to sell to them – if they pass by on a bus <strong>and</strong> cannot be effectively temptedto stop there is no opportunity. Commercial sustainability is the critical issue – there arelots of good ideas which are not commercially viable. There need to be enough willingpurchasers to ensure the viability of an initiative – the tourists need motivation,opportunity <strong>and</strong> cash enough to purchase. . <strong>Tourism</strong> businesses are sometimes willing toengage with local communities but lack the skills or capacity to carry all the transactioncosts of setting up an initiative – project funding can assist with this, but sustainabilityrequires a viable commercial business.[13] This is the agenda for action identified back in 1998 – fundamental to pro-poortourism is building on <strong>and</strong> complementing existing livelihood strategies throughemployment <strong>and</strong> small enterprise development. 76 Ashley C. (2000) The Impacts of <strong>Tourism</strong> on Rural Livelihoods: Namibia's Experience, OverseasDevelopment Institute Working Paper 1287 <strong>Goodwin</strong> H (1998) Sustainable <strong>Tourism</strong> <strong>and</strong> Poverty Elimination, A Discussion Paper for the Departmentfor the Environment, Transport <strong>and</strong> the Regions <strong>and</strong> the Department for International Developmentwww.haroldgoodwin.info/resources/dfidpaper.pdfDr <strong>Harold</strong> <strong>Goodwin</strong> Universiti Teknologi Malaysia May 2005 5