Lines Matching defs:state

27     _multibytecodec_state *state = PyModule_GetState(module);
28 assert(state != NULL);
29 return state;
225 MultibyteCodec_State *state,
275 r = codec->encode(state, codec->config,
337 retstr = multibytecodec_encode(codec, state, tobj,
380 MultibyteCodec_State *state,
484 MultibyteCodec_State *state,
525 r = codec->encode(state, codec->config,
531 else if (multibytecodec_encerror(codec, state, &buf, errors,r))
542 r = codec->encreset(state, codec->config, &buf.outbuf,
546 else if (multibytecodec_encerror(codec, state,
589 MultibyteCodec_State state;
620 self->codec->encinit(&state, self->codec->config) != 0)
622 r = multibytecodec_encode(self->codec, &state,
658 MultibyteCodec_State state;
684 self->codec->decinit(&state, self->codec->config) != 0)
692 r = self->codec->decode(&state, self->codec->config,
696 else if (multibytecodec_decerror(self->codec, &state,
811 r = multibytecodec_encode(ctx->codec, &ctx->state,
885 r = ctx->codec->decode(&ctx->state, ctx->codec->config,
889 else if (multibytecodec_decerror(ctx->codec, &ctx->state,
921 /* state made up of 1 byte for buffer size, up to MAXENCPENDING*4 bytes
925 values for the same state, e.g. as a result of struct padding.
927 unsigned char statebytes[1 + MAXENCPENDING*4 + sizeof(self->state.c)];
948 memcpy(statebytes+statesize, self->state.c,
949 sizeof(self->state.c));
950 statesize += sizeof(self->state.c);
959 state as statelong: object(type='PyLongObject *', subclass_of='&PyLong_Type')
969 unsigned char statebytes[1 + MAXENCPENDING*4 + sizeof(self->state.c)];
990 memcpy(self->state.c, statebytes+1+statebytes[0],
991 sizeof(self->state.c));
1013 r = self->codec->encreset(&self->state, self->codec->config,
1049 _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
1050 if (!MultibyteCodec_Check(state, codec)) {
1061 self->codec->encinit(&self->state, self->codec->config) != 0)
1171 if (multibytecodec_decerror(self->codec, &self->state,
1219 statelong = (PyObject *)_PyLong_FromByteArray(self->state.c,
1220 sizeof(self->state.c),
1233 state: object(subclass_of='&PyTuple_Type')
1239 PyObject *state)
1248 if (!PyArg_ParseTuple(state, "SO!;setstate(): illegal state argument",
1276 memcpy(self->state.c, statebytes, sizeof(statebytes));
1290 self->codec->decreset(&self->state, self->codec->config) != 0)
1324 _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
1325 if (!MultibyteCodec_Check(state, codec)) {
1336 self->codec->decinit(&self->state, self->codec->config) != 0)
1462 multibytecodec_decerror(self->codec, &self->state,
1600 self->codec->decreset(&self->state, self->codec->config) != 0)
1641 _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
1642 if (!MultibyteCodec_Check(state, codec)) {
1655 self->codec->decinit(&self->state, self->codec->config) != 0)
1747 _multibytecodec_state *state = PyType_GetModuleState(cls);
1748 assert(state != NULL);
1749 if (mbstreamwriter_iwrite(self, strobj, state->str_write)) {
1778 _multibytecodec_state *state = PyType_GetModuleState(cls);
1779 assert(state != NULL);
1786 r = mbstreamwriter_iwrite(self, strobj, state->str_write);
1816 pwrt = multibytecodec_encode(self->codec, &self->state,
1829 _multibytecodec_state *state = PyType_GetModuleState(cls);
1830 assert(state != NULL);
1835 wr = _PyObject_CallMethodOneArg(self->stream, state->str_write, pwrt);
1865 _multibytecodec_state *state = _multibyte_codec_find_state_by_type(type);
1866 if (!MultibyteCodec_Check(state, codec)) {
1879 self->codec->encinit(&self->state, self->codec->config) != 0)
1976 _multibytecodec_state *state = _multibytecodec_get_state(module);
1977 self = PyObject_GC_New(MultibyteCodecObject, state->multibytecodec_type);
1989 _multibytecodec_state *state = _multibytecodec_get_state(mod);
1990 Py_VISIT(state->multibytecodec_type);
1991 Py_VISIT(state->encoder_type);
1992 Py_VISIT(state->decoder_type);
1993 Py_VISIT(state->reader_type);
1994 Py_VISIT(state->writer_type);
2001 _multibytecodec_state *state = _multibytecodec_get_state(mod);
2002 Py_CLEAR(state->multibytecodec_type);
2003 Py_CLEAR(state->encoder_type);
2004 Py_CLEAR(state->decoder_type);
2005 Py_CLEAR(state->reader_type);
2006 Py_CLEAR(state->writer_type);
2007 Py_CLEAR(state->str_write);
2035 _multibytecodec_state *state = _multibytecodec_get_state(mod);
2036 state->str_write = PyUnicode_InternFromString("write");
2037 if (state->str_write == NULL) {
2040 CREATE_TYPE(mod, state->multibytecodec_type, &multibytecodec_spec);
2041 CREATE_TYPE(mod, state->encoder_type, &encoder_spec);
2042 CREATE_TYPE(mod, state->decoder_type, &decoder_spec);
2043 CREATE_TYPE(mod, state->reader_type, &reader_spec);
2044 CREATE_TYPE(mod, state->writer_type, &writer_spec);
2046 ADD_TYPE(mod, state->encoder_type);
2047 ADD_TYPE(mod, state->decoder_type);
2048 ADD_TYPE(mod, state->reader_type);
2049 ADD_TYPE(mod, state->writer_type);