cpiParseBufferFormatted

목적

이 함수는 다음을 제공하는 기존의 cpiParseBuffer() 구현 함수에서 제공하는 기능을 확장하여 제공합니다.
  1. 입력 메시지를 표현되는 데 사용한 인코딩 및 코딩 문자 세트
  2. 메시지의 메시지 세트, 유형 및 형식

이 구현 함수가 CPI_VFT 구조에 제공된 경우, cpiParseBuffer()cpiParseBufferEncoded() 모두 지정할 수 없습니다. CCI_INVALID_IMPL_FUNCTION 리턴 코드가 표시되면서 cpiDefineParserClass() 함수가 작동 중지되기 때문입니다.

정의 대상 유형 구성원
CPI_VFT 조건부 iFpParseBufferFormatted

구문

int cpiParseBufferFormatted(
    CciParser*      parser,
    CciContext* context,
    int            encoding,
    int            ccsid,
    CciChar*       set,
    CciChar*       type,
    CciChar*       format); 

매개변수

parser
구문 분석기 오브젝트의 주소(입력).
context
플러그인 컨텍스트의 주소(입력).
encoding
메시지 버퍼의 인코딩(입력).
ccsid
메시지 버퍼의 CCSID(입력).
set
메시지가 속하는 메시지 세트(입력).
type
메시지 유형(입력).
format
메시지 형식(입력).

리턴 값

구문 분석기가 소유하는 메시지 버퍼의 나머지 부분 크기(바이트 단위).

샘플

다음 예는 샘플 구문 분석기 파일 BipSampPluginParser.c에서 발췌한 것입니다(428 - 466행).

int cpiParseBufferFormatted(
    CciParser*      parser,
    CciContext* context,
    int            encoding,
    int            ccsid,
    CciChar*       set,
    CciChar*       type,
    CciChar*       format
){
    PARSER_CONTEXT_ST* pc = (PARSER_CONTEXT_ST *)context ;
    int                rc;

    /* Get a pointer to the message buffer and set the offset */
    pc->iBuffer = (void *)cpiBufferPointer(&rc, parser);
    pc->iIndex = 0;

    /* Save the format of the buffer */
    pc->iEncoding = encoding;
    pc->iCcsid = ccsid;

    /* Save size of the buffer */
    pc->iSize = cpiBufferSize(&rc, parser);

    /* Prime the first byte in the stream */
    pc->iCurrentCharacter = cpiBufferByte(&rc, parser, pc->iIndex);

    /* Set the current element to the root element */
    pc->iCurrentElement = cpiRootElement(&rc, parser);

    /* Reset flag to ensure parsing is reset correctly */
    pc->iInTag = 0;

            if (pc->trace) {
        fprintf(pc->tracefile, "PLUGIN: <- cpiParseBufferFormatted() 
        retvalue=%d\n", pc->iSize);
              fflush(pc->tracefile);
  }
관련 개념
사용자 정의 구문 분석기
사용자 정의 확장 구성요소
관련 작업
C로 구문 분석기 작성
관련 참조
cpiParseBuffer
cpiParseBufferEncoded
C 구문 분석기 구현 함수
주의사항 | 등록상표 | 다운로드 | 라이브러리 | 지원 | 피드백
Copyright IBM Corporation 1999, 2005 마지막 갱신 날짜: 11/08/2005
as08170_