~ubuntu-branches/debian/sid/meliae/sid

« back to all changes in this revision

Viewing changes to meliae/_scanner.pyx

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-07-20 18:26:22 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100720182622-b0ks0nu34mify1lj
Tags: upstream-0.2.1
ImportĀ upstreamĀ versionĀ 0.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software: you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License version 3 as
21
21
    FILE *stderr
22
22
    size_t fwrite(void *, size_t, size_t, FILE *)
23
23
    size_t fprintf(FILE *, char *, ...)
 
24
    void fflush(FILE *)
24
25
 
25
26
cdef extern from "Python.h":
26
27
    FILE *PyFile_AsFile(object)
60
61
 
61
62
cdef void _file_io_callback(void *callee_data, char *bytes, size_t len):
62
63
    cdef FILE *file_cb
63
 
    
 
64
 
64
65
    file_cb = <FILE *>callee_data
65
66
    fwrite(bytes, 1, len, file_cb)
66
67
 
93
94
 
94
95
    fp_out = PyFile_AsFile(out)
95
96
    if fp_out != NULL:
96
 
        # This must be a callable
97
97
        _dump_object_info(<write_callback>_file_io_callback, fp_out, obj,
98
98
                          nodump, recurse_depth)
 
99
        fflush(fp_out)
99
100
    else:
100
101
        _dump_object_info(<write_callback>_callable_callback, <void *>out, obj,
101
102
                          nodump, recurse_depth)