forked from bitly/pyqrencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqrencode.c
More file actions
1761 lines (1626 loc) · 64.5 KB
/
qrencode.c
File metadata and controls
1761 lines (1626 loc) · 64.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* Generated by Cython 0.11.2 on Wed May 16 18:55:27 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#if PY_VERSION_HEX < 0x02040000
#define METH_COEXIST 0
#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
#define PyNumber_Index(o) PyNumber_Int(o)
#define PyIndex_Check(o) PyNumber_Check(o)
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyString_Type PyBytes_Type
#define PyString_CheckExact PyBytes_CheckExact
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define PyBytes_Type PyString_Type
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#else
#define _USE_MATH_DEFINES
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#define __PYX_HAVE_API__qrencode
#include "stdlib.h"
#include "qrencode.h"
#define __PYX_USE_C99_COMPLEX defined(_Complex_I)
#ifdef __GNUC__
#define INLINE __inline__
#elif _WIN32
#define INLINE __inline
#else
#define INLINE
#endif
typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
static int __pyx_skip_dispatch = 0;
/* Type Conversion Predeclarations */
#if PY_MAJOR_VERSION < 3
#define __Pyx_PyBytes_FromString PyString_FromString
#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize
#define __Pyx_PyBytes_AsString PyString_AsString
#else
#define __Pyx_PyBytes_FromString PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
#define __Pyx_PyBytes_AsString PyBytes_AsString
#endif
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
#if !defined(T_PYSSIZET)
#if PY_VERSION_HEX < 0x02050000
#define T_PYSSIZET T_INT
#elif !defined(T_LONGLONG)
#define T_PYSSIZET \
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
#else
#define T_PYSSIZET \
((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \
((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \
((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
#endif
#endif
#if !defined(T_SIZET)
#if !defined(T_ULONGLONG)
#define T_SIZET \
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
#else
#define T_SIZET \
((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \
((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \
((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
#endif
#endif
static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char **__pyx_f;
#ifdef CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*NewContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk)
#else
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_SetupRefcountContext(name)
#define __Pyx_FinishRefcountContext()
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name); /*proto*/
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
if (likely(PyList_CheckExact(L))) {
if (PyList_Append(L, x) < 0) return NULL;
Py_INCREF(Py_None);
return Py_None; /* this is just to have an accurate signature */
}
else {
PyObject *r, *m;
m = __Pyx_GetAttrString(L, "append");
if (!m) return NULL;
r = PyObject_CallFunctionObjArgs(m, x, NULL);
Py_DECREF(m);
return r;
}
}
static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static INLINE char __Pyx_PyInt_AsChar(PyObject *);
static INLINE short __Pyx_PyInt_AsShort(PyObject *);
static INLINE int __Pyx_PyInt_AsInt(PyObject *);
static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static INLINE long __Pyx_PyInt_AsLong(PyObject *);
static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static void __Pyx_WriteUnraisable(const char *name); /*proto*/
static void __Pyx_AddTraceback(const char *funcname); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Type declarations */
/* Module declarations from qrencode */
static int __pyx_k_1;
static int __pyx_k_2;
static QRcode *__pyx_f_8qrencode_encode_string(PyObject *, int, int); /*proto*/
#define __Pyx_MODULE_NAME "qrencode"
int __pyx_module_is_main_qrencode = 0;
/* Implementation of qrencode */
static PyObject *__pyx_int_0;
static char __pyx_k___main__[] = "__main__";
static PyObject *__pyx_kp___main__;
static char __pyx_k_text[] = "text";
static PyObject *__pyx_kp_text;
static char __pyx_k_ec_level[] = "ec_level";
static PyObject *__pyx_kp_ec_level;
static char __pyx_k_version[] = "version";
static PyObject *__pyx_kp_version;
static char __pyx_k_EC_L[] = "EC_L";
static PyObject *__pyx_kp_EC_L;
static char __pyx_k_EC_M[] = "EC_M";
static PyObject *__pyx_kp_EC_M;
static char __pyx_k_EC_Q[] = "EC_Q";
static PyObject *__pyx_kp_EC_Q;
static char __pyx_k_EC_H[] = "EC_H";
static PyObject *__pyx_kp_EC_H;
static char __pyx_k_EC_DEFAULT[] = "EC_DEFAULT";
static PyObject *__pyx_kp_EC_DEFAULT;
static char __pyx_k_VERSION_DEFAULT[] = "VERSION_DEFAULT";
static PyObject *__pyx_kp_VERSION_DEFAULT;
static char __pyx_k_encode[] = "encode";
static PyObject *__pyx_kp_encode;
static char __pyx_k_decode[] = "decode";
static PyObject *__pyx_kp_decode;
static char __pyx_k_ValueError[] = "ValueError";
static PyObject *__pyx_kp_ValueError;
static char __pyx_k_range[] = "range";
static PyObject *__pyx_kp_range;
static char __pyx_k_append[] = "append";
static PyObject *__pyx_kp_append;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_kp_3;
static PyObject *__pyx_kp_4;
static PyObject *__pyx_kp_5;
static PyObject *__pyx_kp_6;
static char __pyx_k_3[] = "UTF-8";
static char __pyx_k_4[] = "UTF-8";
static char __pyx_k_5[] = "requires text input, got %s";
static char __pyx_k_6[] = "\000";
static PyObject *__pyx_kp_7;
static char __pyx_k_7[] = "\000";
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":40
* VERSION_DEFAULT = 0
*
* cdef QRcode *encode_string( # <<<<<<<<<<<<<<
* text,
* int ec_level,
*/
static QRcode *__pyx_f_8qrencode_encode_string(PyObject *__pyx_v_text, int __pyx_v_ec_level, int __pyx_v_version) {
PyObject *__pyx_v_str_copy;
QRcode *__pyx_r;
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_t_5;
char *__pyx_t_6;
__Pyx_SetupRefcountContext("encode_string");
__Pyx_INCREF(__pyx_v_text);
__pyx_v_str_copy = Py_None; __Pyx_INCREF(Py_None);
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":48
* '''
*
* if isinstance(text, unicode): # <<<<<<<<<<<<<<
* text = text.encode('UTF-8')
* elif PY_MAJOR_VERSION < 3 and isinstance(text, str):
*/
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_text, ((PyTypeObject *)((PyObject*)&PyUnicode_Type)));
if (__pyx_t_1) {
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":49
*
* if isinstance(text, unicode):
* text = text.encode('UTF-8') # <<<<<<<<<<<<<<
* elif PY_MAJOR_VERSION < 3 and isinstance(text, str):
* text.decode('UTF-8')
*/
__pyx_t_2 = PyObject_GetAttr(__pyx_v_text, __pyx_kp_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(__pyx_kp_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_3);
__Pyx_GIVEREF(__pyx_kp_3);
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_v_text);
__pyx_v_text = __pyx_t_4;
__pyx_t_4 = 0;
goto __pyx_L3;
}
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":50
* if isinstance(text, unicode):
* text = text.encode('UTF-8')
* elif PY_MAJOR_VERSION < 3 and isinstance(text, str): # <<<<<<<<<<<<<<
* text.decode('UTF-8')
* else:
*/
if ((PY_MAJOR_VERSION < 3)) {
__pyx_t_1 = PyObject_TypeCheck(__pyx_v_text, ((PyTypeObject *)((PyObject*)&PyString_Type)));
__pyx_t_5 = __pyx_t_1;
} else {
__pyx_t_5 = (PY_MAJOR_VERSION < 3);
}
if (__pyx_t_5) {
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":51
* text = text.encode('UTF-8')
* elif PY_MAJOR_VERSION < 3 and isinstance(text, str):
* text.decode('UTF-8') # <<<<<<<<<<<<<<
* else:
* raise ValueError('requires text input, got %s' % type(text))
*/
__pyx_t_4 = PyObject_GetAttr(__pyx_v_text, __pyx_kp_decode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_INCREF(__pyx_kp_4);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_4);
__Pyx_GIVEREF(__pyx_kp_4);
__pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":53
* text.decode('UTF-8')
* else:
* raise ValueError('requires text input, got %s' % type(text)) # <<<<<<<<<<<<<<
*
* # encode the text as a QR code
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_INCREF(__pyx_v_text);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text);
__Pyx_GIVEREF(__pyx_v_text);
__pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyType_Type)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Remainder(__pyx_kp_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":56
*
* # encode the text as a QR code
* str_copy = text + '\0' # <<<<<<<<<<<<<<
* return QRcode_encodeString(str_copy, version, ec_level, QR_MODE_8, 1)
*
*/
__pyx_t_2 = PyNumber_Add(__pyx_v_text, __pyx_kp_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_str_copy);
__pyx_v_str_copy = __pyx_t_2;
__pyx_t_2 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":57
* # encode the text as a QR code
* str_copy = text + '\0'
* return QRcode_encodeString(str_copy, version, ec_level, QR_MODE_8, 1) # <<<<<<<<<<<<<<
*
* def encode(
*/
__pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_str_copy); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = QRcode_encodeString(__pyx_t_6, __pyx_v_version, __pyx_v_ec_level, QR_MODE_8, 1);
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_WriteUnraisable("qrencode.encode_string");
__pyx_r = 0;
__pyx_L0:;
__Pyx_DECREF(__pyx_v_str_copy);
__Pyx_DECREF(__pyx_v_text);
__Pyx_FinishRefcountContext();
return __pyx_r;
}
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":59
* return QRcode_encodeString(str_copy, version, ec_level, QR_MODE_8, 1)
*
* def encode( # <<<<<<<<<<<<<<
* text,
* int ec_level=EC_DEFAULT,
*/
static PyObject *__pyx_pf_8qrencode_encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8qrencode_encode[] = "\n Encode the given text as a QR Code. Return the QR Code as a bitmap\n represented as a list of lists of boolean values. I.e., \n [ [bool, ... ], ... ].\n ";
static PyObject *__pyx_pf_8qrencode_encode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_text = 0;
int __pyx_v_ec_level;
int __pyx_v_version;
QRcode *__pyx_v_code;
PyObject *__pyx_v_null_terminated_text;
int __pyx_v_width;
unsigned char *__pyx_v_data;
PyObject *__pyx_v_rows;
int __pyx_v_i;
int __pyx_v_start;
int __pyx_v_end;
PyObject *__pyx_r = NULL;
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_t_6;
static PyObject **__pyx_pyargnames[] = {&__pyx_kp_text,&__pyx_kp_ec_level,&__pyx_kp_version,0};
__Pyx_SetupRefcountContext("encode");
__pyx_self = __pyx_self;
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
PyObject* values[3] = {0,0,0};
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_text);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_ec_level);
if (unlikely(value)) { values[1] = value; kw_args--; }
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_version);
if (unlikely(value)) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "encode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
__pyx_v_text = values[0];
if (values[1]) {
__pyx_v_ec_level = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_ec_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_ec_level = __pyx_k_1;
}
if (values[2]) {
__pyx_v_version = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_version == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_version = __pyx_k_2;
}
} else {
__pyx_v_ec_level = __pyx_k_1;
__pyx_v_version = __pyx_k_2;
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: __pyx_v_version = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_version == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
case 2: __pyx_v_ec_level = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_ec_level == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
case 1: __pyx_v_text = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("encode", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("qrencode.encode");
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_v_null_terminated_text = Py_None; __Pyx_INCREF(Py_None);
__pyx_v_rows = Py_None; __Pyx_INCREF(Py_None);
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":71
*
* # encode the text as a QR code
* null_terminated_text = text + '\0' # <<<<<<<<<<<<<<
* code = encode_string(
* null_terminated_text,
*/
__pyx_t_1 = PyNumber_Add(__pyx_v_text, __pyx_kp_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_v_null_terminated_text);
__pyx_v_null_terminated_text = __pyx_t_1;
__pyx_t_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":75
* null_terminated_text,
* version,
* ec_level) # <<<<<<<<<<<<<<
* cdef int width = code.width
* cdef unsigned char* data = code.data
*/
__pyx_v_code = __pyx_f_8qrencode_encode_string(__pyx_v_null_terminated_text, __pyx_v_version, __pyx_v_ec_level);
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":76
* version,
* ec_level)
* cdef int width = code.width # <<<<<<<<<<<<<<
* cdef unsigned char* data = code.data
*
*/
__pyx_v_width = __pyx_v_code->width;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":77
* ec_level)
* cdef int width = code.width
* cdef unsigned char* data = code.data # <<<<<<<<<<<<<<
*
* rows = [] # a list of tuples of bool; the bitmap result-to-be
*/
__pyx_v_data = __pyx_v_code->data;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":79
* cdef unsigned char* data = code.data
*
* rows = [] # a list of tuples of bool; the bitmap result-to-be # <<<<<<<<<<<<<<
* cdef int i, start, end
* for i in range(code.width):
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_DECREF(__pyx_v_rows);
__pyx_v_rows = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":81
* rows = [] # a list of tuples of bool; the bitmap result-to-be
* cdef int i, start, end
* for i in range(code.width): # <<<<<<<<<<<<<<
* start = i * width # first index in this row
* end = start + width # first index AFTER this row
*/
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_v_code->width; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":82
* cdef int i, start, end
* for i in range(code.width):
* start = i * width # first index in this row # <<<<<<<<<<<<<<
* end = start + width # first index AFTER this row
* rows.append([ bool(data[i] & 1) for i in range(start, end) ])
*/
__pyx_v_start = (__pyx_v_i * __pyx_v_width);
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":83
* for i in range(code.width):
* start = i * width # first index in this row
* end = start + width # first index AFTER this row # <<<<<<<<<<<<<<
* rows.append([ bool(data[i] & 1) for i in range(start, end) ])
*
*/
__pyx_v_end = (__pyx_v_start + __pyx_v_width);
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":84
* start = i * width # first index in this row
* end = start + width # first index AFTER this row
* rows.append([ bool(data[i] & 1) for i in range(start, end) ]) # <<<<<<<<<<<<<<
*
* free(code)
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
for (__pyx_t_3 = __pyx_v_start; __pyx_t_3 < __pyx_v_end; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
__pyx_t_4 = PyLong_FromUnsignedLong(((__pyx_v_data[__pyx_v_i]) & 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyBool_Type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_rows, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":86
* rows.append([ bool(data[i] & 1) for i in range(start, end) ])
*
* free(code) # <<<<<<<<<<<<<<
* return rows
*/
free(__pyx_v_code);
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":87
*
* free(code)
* return rows # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_rows);
__pyx_r = __pyx_v_rows;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("qrencode.encode");
__pyx_r = NULL;
__pyx_L0:;
__Pyx_DECREF(__pyx_v_null_terminated_text);
__Pyx_DECREF(__pyx_v_rows);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_FinishRefcountContext();
return __pyx_r;
}
static struct PyMethodDef __pyx_methods[] = {
{__Pyx_NAMESTR("encode"), (PyCFunction)__pyx_pf_8qrencode_encode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8qrencode_encode)},
{0, 0, 0, 0}
};
static void __pyx_init_filenames(void); /*proto*/
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
__Pyx_NAMESTR("qrencode"),
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1},
{&__pyx_kp_text, __pyx_k_text, sizeof(__pyx_k_text), 1, 1, 1},
{&__pyx_kp_ec_level, __pyx_k_ec_level, sizeof(__pyx_k_ec_level), 1, 1, 1},
{&__pyx_kp_version, __pyx_k_version, sizeof(__pyx_k_version), 1, 1, 1},
{&__pyx_kp_EC_L, __pyx_k_EC_L, sizeof(__pyx_k_EC_L), 1, 1, 1},
{&__pyx_kp_EC_M, __pyx_k_EC_M, sizeof(__pyx_k_EC_M), 1, 1, 1},
{&__pyx_kp_EC_Q, __pyx_k_EC_Q, sizeof(__pyx_k_EC_Q), 1, 1, 1},
{&__pyx_kp_EC_H, __pyx_k_EC_H, sizeof(__pyx_k_EC_H), 1, 1, 1},
{&__pyx_kp_EC_DEFAULT, __pyx_k_EC_DEFAULT, sizeof(__pyx_k_EC_DEFAULT), 1, 1, 1},
{&__pyx_kp_VERSION_DEFAULT, __pyx_k_VERSION_DEFAULT, sizeof(__pyx_k_VERSION_DEFAULT), 1, 1, 1},
{&__pyx_kp_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 1, 1, 1},
{&__pyx_kp_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 1, 1, 1},
{&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1},
{&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1},
{&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1},
{&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0},
{&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0},
{&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0},
{&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0},
{&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 0},
{0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitGlobals(void) {
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initqrencode(void); /*proto*/
PyMODINIT_FUNC initqrencode(void)
#else
PyMODINIT_FUNC PyInit_qrencode(void); /*proto*/
PyMODINIT_FUNC PyInit_qrencode(void)
#endif
{
PyObject *__pyx_1 = 0;
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
#ifdef CYTHON_REFNANNY
void* __pyx_refchk = NULL;
__Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny");
if (!__Pyx_Refnanny) {
PyErr_Clear();
__Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny");
if (!__Pyx_Refnanny)
Py_FatalError("failed to import refnanny module");
}
__pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_qrencode(void)", __LINE__, __FILE__);
#endif
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Library function declarations ---*/
__pyx_init_filenames();
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("qrencode"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#if PY_MAJOR_VERSION < 3
Py_INCREF(__pyx_m);
#endif
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (__pyx_module_is_main_qrencode) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_skip_dispatch = 0;
/*--- Global init code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
/*--- Type import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":31
*
*
* EC_L = QR_ECLEVEL_L # <<<<<<<<<<<<<<
* EC_M = QR_ECLEVEL_M
* EC_Q = QR_ECLEVEL_Q
*/
__pyx_t_1 = PyInt_FromLong(QR_ECLEVEL_L); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_kp_EC_L, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":32
*
* EC_L = QR_ECLEVEL_L
* EC_M = QR_ECLEVEL_M # <<<<<<<<<<<<<<
* EC_Q = QR_ECLEVEL_Q
* EC_H = QR_ECLEVEL_H
*/
__pyx_t_1 = PyInt_FromLong(QR_ECLEVEL_M); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_kp_EC_M, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":33
* EC_L = QR_ECLEVEL_L
* EC_M = QR_ECLEVEL_M
* EC_Q = QR_ECLEVEL_Q # <<<<<<<<<<<<<<
* EC_H = QR_ECLEVEL_H
*
*/
__pyx_t_1 = PyInt_FromLong(QR_ECLEVEL_Q); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_kp_EC_Q, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":34
* EC_M = QR_ECLEVEL_M
* EC_Q = QR_ECLEVEL_Q
* EC_H = QR_ECLEVEL_H # <<<<<<<<<<<<<<
*
* EC_DEFAULT = EC_M
*/
__pyx_t_1 = PyInt_FromLong(QR_ECLEVEL_H); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_kp_EC_H, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":36
* EC_H = QR_ECLEVEL_H
*
* EC_DEFAULT = EC_M # <<<<<<<<<<<<<<
*
* VERSION_DEFAULT = 0
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_EC_M); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
if (PyObject_SetAttr(__pyx_m, __pyx_kp_EC_DEFAULT, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":38
* EC_DEFAULT = EC_M
*
* VERSION_DEFAULT = 0 # <<<<<<<<<<<<<<
*
* cdef QRcode *encode_string(
*/
if (PyObject_SetAttr(__pyx_m, __pyx_kp_VERSION_DEFAULT, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":61
* def encode(
* text,
* int ec_level=EC_DEFAULT, # <<<<<<<<<<<<<<
* int version=VERSION_DEFAULT):
* '''
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_EC_DEFAULT); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
__pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_k_1 = __pyx_t_2;
/* "/home/ed/physhy3/vendor/pyqrencode/qrencode.pyx":62
* text,
* int ec_level=EC_DEFAULT,
* int version=VERSION_DEFAULT): # <<<<<<<<<<<<<<
* '''
* Encode the given text as a QR Code. Return the QR Code as a bitmap
*/
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_VERSION_DEFAULT); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_1);
__pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_1); __pyx_1 = 0;
__pyx_k_2 = __pyx_t_2;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_1);