/******************************************************************************* Copyright (c) 1997-2004, Perforce Software, Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTR IBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ /******************************************************************************* * Name : p4result.cc * * Author : Tony Smith <tony@perforce.com> or <tony@smee.org> * * Description : Ruby class for holding results of Perforce commands * ******************************************************************************/ #include <clientapi.h> #ifdef OS_NT # include <math.h> #endif extern "C" { #include "EXTERN.h" #include "perl.h" #include "XSUB.h" } #ifdef Error // Defined by older versions of Perl to be Perl_Error # undef Error #endif #include "p4result.h" P4Result::P4Result() { merged = 0; output = newAV(); errors = newAV(); warnings = newAV(); } void P4Result::Reset(int merge) { merged = merge; SvREFCNT_dec( output ); SvREFCNT_dec( warnings ); SvREFCNT_dec( errors ); output = newAV(); warnings = newAV(); errors = newAV(); } void P4Result::AddOutput( const char *msg ) { av_push( output, newSVpv( msg, 0 ) ); } void P4Result::AddOutput( SV * out ) { SvREFCNT_inc( out ); av_push( output, out ); } void P4Result::AddError( Error *e ) { StrBuf m; e->Fmt( &m ); int s; s = e->GetSeverity(); // // Empty and informational messages are pushed out as output as nothing // worthy of error handling has occurred. Warnings go into the warnings // list and the rest are lumped together as errors. // if ( s == E_EMPTY || s == E_INFO ) AddOutput( m.Text() ); else if ( s == E_WARN && !merged ) av_push( warnings, newSVpv( m.Text(), 0 ) ); else av_push( errors, newSVpv( m.Text(), 0 ) ); } I32 P4Result::OutputCount() { return av_len( output ) + 1; } I32 P4Result::ErrorCount() { return av_len( errors ) + 1; } I32 P4Result::WarningCount() { return av_len( warnings ) + 1; }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4669 | Raymond Danks | Create a branch of P4-3.4608. | ||
//guest/tony_smith/perforce/API/Perl/P4/lib/p4result.cc | |||||
#2 | 4582 | Tony Smith |
Port new P4Perl architecture to Windows. Fixes a few porting issues and a couple of minor errors in the previous change. |
||
#1 | 4579 | Tony Smith |
Rewrite P4Perl to be more like P4Ruby. This change does away with the old P4/P4::Client split and pulls all the functionality of P4::Client into P4. Hence P4::Client is now deprecated. There are a few gotcha's - see the Changes file, and documentation for the details, but in general it's backwards compatible. As part of this change, I'm also releasing the previous current versions of P4 and P4::Client as released versions - for posterity. P4 now gets a v3.x version number so the old versions will stand out clearly. Hopefully it's all working - works fine for me - but people should consider this a beta build, for now at least. |