1 import org.python.core.*;
3 public class calendar extends java.lang.Object {
4 static String[] jpy$mainProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions"};
5 static String[] jpy$proxyProperties = new String[] {"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
6 static String[] jpy$packages = new String[] {"java.net", null, "java.lang", null, "org.python.core", null, "java.io", null, "java.util.zip", null};
8 public static class _PyInner extends PyFunctionTable implements PyRunnable {
9 private static PyObject s$0;
10 private static PyObject s$1;
11 private static PyObject s$2;
12 private static PyObject s$3;
13 private static PyObject s$4;
14 private static PyObject s$5;
15 private static PyObject s$6;
16 private static PyObject s$7;
17 private static PyObject s$8;
18 private static PyObject s$9;
19 private static PyObject s$10;
20 private static PyObject s$11;
21 private static PyObject s$12;
22 private static PyObject s$13;
23 private static PyObject i$14;
24 private static PyObject i$15;
25 private static PyObject i$16;
26 private static PyObject i$17;
27 private static PyObject i$18;
28 private static PyObject i$19;
29 private static PyObject s$20;
30 private static PyObject s$21;
31 private static PyObject s$22;
32 private static PyObject s$23;
33 private static PyObject s$24;
34 private static PyObject s$25;
35 private static PyObject s$26;
36 private static PyObject s$27;
37 private static PyObject s$28;
38 private static PyObject s$29;
39 private static PyObject s$30;
40 private static PyObject s$31;
41 private static PyObject s$32;
42 private static PyObject s$33;
43 private static PyObject s$34;
44 private static PyObject s$35;
45 private static PyObject s$36;
46 private static PyObject s$37;
47 private static PyObject s$38;
48 private static PyObject s$39;
49 private static PyObject s$40;
50 private static PyObject s$41;
51 private static PyObject s$42;
52 private static PyObject s$43;
53 private static PyObject s$44;
54 private static PyObject s$45;
55 private static PyObject s$46;
56 private static PyObject s$47;
57 private static PyObject s$48;
58 private static PyObject s$49;
59 private static PyObject s$50;
60 private static PyObject s$51;
61 private static PyObject s$52;
62 private static PyObject s$53;
63 private static PyObject s$54;
64 private static PyObject s$55;
65 private static PyObject s$56;
66 private static PyObject s$57;
67 private static PyObject s$58;
68 private static PyObject i$59;
69 private static PyObject s$60;
70 private static PyObject s$61;
71 private static PyObject s$62;
72 private static PyObject i$63;
73 private static PyObject i$64;
74 private static PyObject i$65;
75 private static PyObject s$66;
76 private static PyObject s$67;
77 private static PyObject i$68;
78 private static PyObject s$69;
79 private static PyObject i$70;
80 private static PyObject s$71;
81 private static PyObject s$72;
82 private static PyObject i$73;
83 private static PyObject s$74;
84 private static PyObject s$75;
85 private static PyObject s$76;
86 private static PyObject s$77;
87 private static PyObject s$78;
88 private static PyObject s$79;
89 private static PyObject i$80;
90 private static PyObject s$81;
91 private static PyObject s$82;
92 private static PyObject s$83;
93 private static PyObject i$84;
94 private static PyObject s$85;
95 private static PyObject s$86;
96 private static PyObject s$87;
97 private static PyObject s$88;
98 private static PyObject i$89;
99 private static PyObject s$90;
100 private static PyObject i$91;
101 private static PyObject i$92;
102 private static PyObject i$93;
103 private static PyObject s$94;
104 private static PyFunctionTable funcTable;
105 private static PyCode c$0_firstweekday;
106 private static PyCode c$1_setfirstweekday;
107 private static PyCode c$2_isleap;
108 private static PyCode c$3_leapdays;
109 private static PyCode c$4_weekday;
110 private static PyCode c$5_monthrange;
111 private static PyCode c$6_monthcalendar;
112 private static PyCode c$7__center;
113 private static PyCode c$8_prweek;
114 private static PyCode c$9_week;
115 private static PyCode c$10_weekheader;
116 private static PyCode c$11_prmonth;
117 private static PyCode c$12_month;
118 private static PyCode c$13_format3c;
119 private static PyCode c$14_format3cstring;
120 private static PyCode c$15_prcal;
121 private static PyCode c$16_calendar;
122 private static PyCode c$17_timegm;
123 private static PyCode c$18_main;
124 private static void initConstants() {
125 s$0 = Py.newString("Calendar printing functions\012\012Note when comparing these calendars to the ones printed by cal(1): By\012default, these calendars have Monday as the first day of the week, and\012Sunday as the last (the European convention). Use setfirstweekday() to\012set the first day of the week (0=Monday, 6=Sunday).");
126 s$1 = Py.newString("error");
127 s$2 = Py.newString("setfirstweekday");
128 s$3 = Py.newString("firstweekday");
129 s$4 = Py.newString("isleap");
130 s$5 = Py.newString("leapdays");
131 s$6 = Py.newString("weekday");
132 s$7 = Py.newString("monthrange");
133 s$8 = Py.newString("monthcalendar");
134 s$9 = Py.newString("prmonth");
135 s$10 = Py.newString("month");
136 s$11 = Py.newString("prcal");
137 s$12 = Py.newString("calendar");
138 s$13 = Py.newString("timegm");
139 i$14 = Py.newInteger(1);
140 i$15 = Py.newInteger(2);
141 i$16 = Py.newInteger(0);
142 i$17 = Py.newInteger(31);
143 i$18 = Py.newInteger(28);
144 i$19 = Py.newInteger(30);
145 s$20 = Py.newString("Monday");
146 s$21 = Py.newString("Tuesday");
147 s$22 = Py.newString("Wednesday");
148 s$23 = Py.newString("Thursday");
149 s$24 = Py.newString("Friday");
150 s$25 = Py.newString("Saturday");
151 s$26 = Py.newString("Sunday");
152 s$27 = Py.newString("Mon");
153 s$28 = Py.newString("Tue");
154 s$29 = Py.newString("Wed");
155 s$30 = Py.newString("Thu");
156 s$31 = Py.newString("Fri");
157 s$32 = Py.newString("Sat");
158 s$33 = Py.newString("Sun");
159 s$34 = Py.newString("");
160 s$35 = Py.newString("January");
161 s$36 = Py.newString("February");
162 s$37 = Py.newString("March");
163 s$38 = Py.newString("April");
164 s$39 = Py.newString("May");
165 s$40 = Py.newString("June");
166 s$41 = Py.newString("July");
167 s$42 = Py.newString("August");
168 s$43 = Py.newString("September");
169 s$44 = Py.newString("October");
170 s$45 = Py.newString("November");
171 s$46 = Py.newString("December");
172 s$47 = Py.newString(" ");
173 s$48 = Py.newString("Jan");
174 s$49 = Py.newString("Feb");
175 s$50 = Py.newString("Mar");
176 s$51 = Py.newString("Apr");
177 s$52 = Py.newString("Jun");
178 s$53 = Py.newString("Jul");
179 s$54 = Py.newString("Aug");
180 s$55 = Py.newString("Sep");
181 s$56 = Py.newString("Oct");
182 s$57 = Py.newString("Nov");
183 s$58 = Py.newString("Dec");
184 i$59 = Py.newInteger(7);
185 s$60 = Py.newString("Set weekday (Monday=0, Sunday=6) to start each week.");
186 s$61 = Py.newString("bad weekday number; must be 0 (Monday) to 6 (Sunday)");
187 s$62 = Py.newString("Return 1 for leap years, 0 for non-leap years.");
188 i$63 = Py.newInteger(4);
189 i$64 = Py.newInteger(100);
190 i$65 = Py.newInteger(400);
191 s$66 = Py.newString("Return number of leap years in range [y1, y2).\012 Assume y1 <= y2.");
192 s$67 = Py.newString("Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),\012 day (1-31).");
193 i$68 = Py.newInteger(6);
194 s$69 = Py.newString("Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for\012 year, month.");
195 i$70 = Py.newInteger(12);
196 s$71 = Py.newString("bad month number");
197 s$72 = Py.newString("Return a matrix representing a month's calendar.\012 Each row represents a week; days outside this month are zero.");
198 i$73 = Py.newInteger(5);
199 s$74 = Py.newString("Center a string in a field.");
200 s$75 = Py.newString(" ");
201 s$76 = Py.newString("Print a single week (no newline).");
202 s$77 = Py.newString("Returns a single week in a string (no newline).");
203 s$78 = Py.newString("%2i");
204 s$79 = Py.newString("Return a header for a week.");
205 i$80 = Py.newInteger(9);
206 s$81 = Py.newString("Print a month's calendar.");
207 s$82 = Py.newString("Return a month's calendar string (multi-line).");
208 s$83 = Py.newString("\012");
209 i$84 = Py.newInteger(3);
210 s$85 = Py.newString("Prints 3-column formatting for year calendars");
211 s$86 = Py.newString("Returns a string formatted from 3 strings, centered within 3 columns.");
212 s$87 = Py.newString("Print a year's calendar.");
213 s$88 = Py.newString("Returns a year's calendar as a multi-line string.");
214 i$89 = Py.newInteger(1970);
215 s$90 = Py.newString("Unrelated but handy function to calculate Unix timestamp from GMT.");
216 i$91 = Py.newInteger(365);
217 i$92 = Py.newInteger(24);
218 i$93 = Py.newInteger(60);
219 s$94 = Py.newString("/usr/share/jython/Lib-cpython/calendar.py");
220 funcTable = new _PyInner();
221 c$0_firstweekday = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/calendar.py", "firstweekday", false, false, funcTable, 0, null, null, 0, 1);
222 c$1_setfirstweekday = Py.newCode(1, new String[] {"weekday"}, "/usr/share/jython/Lib-cpython/calendar.py", "setfirstweekday", false, false, funcTable, 1, null, null, 0, 1);
223 c$2_isleap = Py.newCode(1, new String[] {"year"}, "/usr/share/jython/Lib-cpython/calendar.py", "isleap", false, false, funcTable, 2, null, null, 0, 1);
224 c$3_leapdays = Py.newCode(2, new String[] {"y1", "y2"}, "/usr/share/jython/Lib-cpython/calendar.py", "leapdays", false, false, funcTable, 3, null, null, 0, 1);
225 c$4_weekday = Py.newCode(3, new String[] {"year", "month", "day", "tuple", "secs"}, "/usr/share/jython/Lib-cpython/calendar.py", "weekday", false, false, funcTable, 4, null, null, 0, 1);
226 c$5_monthrange = Py.newCode(2, new String[] {"year", "month", "ndays", "day1"}, "/usr/share/jython/Lib-cpython/calendar.py", "monthrange", false, false, funcTable, 5, null, null, 0, 1);
227 c$6_monthcalendar = Py.newCode(2, new String[] {"year", "month", "ndays", "i", "day", "day1", "r7", "row", "rows"}, "/usr/share/jython/Lib-cpython/calendar.py", "monthcalendar", false, false, funcTable, 6, null, null, 0, 1);
228 c$7__center = Py.newCode(2, new String[] {"str", "width", "n"}, "/usr/share/jython/Lib-cpython/calendar.py", "_center", false, false, funcTable, 7, null, null, 0, 1);
229 c$8_prweek = Py.newCode(2, new String[] {"theweek", "width"}, "/usr/share/jython/Lib-cpython/calendar.py", "prweek", false, false, funcTable, 8, null, null, 0, 1);
230 c$9_week = Py.newCode(2, new String[] {"theweek", "width", "day", "s", "days"}, "/usr/share/jython/Lib-cpython/calendar.py", "week", false, false, funcTable, 9, null, null, 0, 1);
231 c$10_weekheader = Py.newCode(1, new String[] {"width", "i", "names", "days"}, "/usr/share/jython/Lib-cpython/calendar.py", "weekheader", false, false, funcTable, 10, null, null, 0, 1);
232 c$11_prmonth = Py.newCode(4, new String[] {"theyear", "themonth", "w", "l"}, "/usr/share/jython/Lib-cpython/calendar.py", "prmonth", false, false, funcTable, 11, null, null, 0, 1);
233 c$12_month = Py.newCode(4, new String[] {"theyear", "themonth", "w", "l", "aweek", "s"}, "/usr/share/jython/Lib-cpython/calendar.py", "month", false, false, funcTable, 12, null, null, 0, 1);
234 c$13_format3c = Py.newCode(5, new String[] {"a", "b", "c", "colwidth", "spacing"}, "/usr/share/jython/Lib-cpython/calendar.py", "format3c", false, false, funcTable, 13, null, null, 0, 1);
235 c$14_format3cstring = Py.newCode(5, new String[] {"a", "b", "c", "colwidth", "spacing"}, "/usr/share/jython/Lib-cpython/calendar.py", "format3cstring", false, false, funcTable, 14, null, null, 0, 1);
236 c$15_prcal = Py.newCode(4, new String[] {"year", "w", "l", "c"}, "/usr/share/jython/Lib-cpython/calendar.py", "prcal", false, false, funcTable, 15, null, null, 0, 1);
237 c$16_calendar = Py.newCode(4, new String[] {"year", "w", "l", "c", "weeks", "cal", "s", "height", "q", "colwidth", "amonth", "i", "header", "data"}, "/usr/share/jython/Lib-cpython/calendar.py", "calendar", false, false, funcTable, 16, null, null, 0, 1);
238 c$17_timegm = Py.newCode(1, new String[] {"tuple", "second", "minute", "minutes", "hour", "i", "month", "year", "day", "hours", "seconds", "days"}, "/usr/share/jython/Lib-cpython/calendar.py", "timegm", false, false, funcTable, 17, null, null, 0, 1);
239 c$18_main = Py.newCode(0, new String[] {}, "/usr/share/jython/Lib-cpython/calendar.py", "main", false, false, funcTable, 18, null, null, 0, 0);
243 public PyCode getMain() {
244 if (c$18_main == null) _PyInner.initConstants();
248 public PyObject call_function(int index, PyFrame frame) {
251 return _PyInner.firstweekday$1(frame);
253 return _PyInner.setfirstweekday$2(frame);
255 return _PyInner.isleap$3(frame);
257 return _PyInner.leapdays$4(frame);
259 return _PyInner.weekday$5(frame);
261 return _PyInner.monthrange$6(frame);
263 return _PyInner.monthcalendar$7(frame);
265 return _PyInner._center$8(frame);
267 return _PyInner.prweek$9(frame);
269 return _PyInner.week$10(frame);
271 return _PyInner.weekheader$11(frame);
273 return _PyInner.prmonth$12(frame);
275 return _PyInner.month$13(frame);
277 return _PyInner.format3c$14(frame);
279 return _PyInner.format3cstring$15(frame);
281 return _PyInner.prcal$16(frame);
283 return _PyInner.calendar$17(frame);
285 return _PyInner.timegm$18(frame);
287 return _PyInner.main$19(frame);
293 private static PyObject firstweekday$1(PyFrame frame) {
294 return frame.getglobal("_firstweekday");
297 private static PyObject setfirstweekday$2(PyFrame frame) {
298 // Temporary Variables
299 PyObject t$0$PyObject;
302 /* Set weekday (Monday=0, Sunday=6) to start each week. */
303 // global _firstweekday
304 if ((frame.getglobal("MONDAY")._le(t$0$PyObject = frame.getlocal(0)).__nonzero__() ? t$0$PyObject._le(frame.getglobal("SUNDAY")) : Py.Zero).__not__().__nonzero__()) {
305 throw Py.makeException(frame.getglobal("ValueError"), s$61);
307 frame.setglobal("_firstweekday", frame.getlocal(0));
311 private static PyObject isleap$3(PyFrame frame) {
312 // Temporary Variables
313 PyObject t$0$PyObject, t$1$PyObject;
316 /* Return 1 for leap years, 0 for non-leap years. */
317 return (t$0$PyObject = frame.getlocal(0)._mod(i$63)._eq(i$16)).__nonzero__() ? ((t$1$PyObject = frame.getlocal(0)._mod(i$64)._ne(i$16)).__nonzero__() ? t$1$PyObject : frame.getlocal(0)._mod(i$65)._eq(i$16)) : t$0$PyObject;
320 private static PyObject leapdays$4(PyFrame frame) {
321 // Temporary Variables
322 PyObject t$0$PyObject;
325 /* Return number of leap years in range [y1, y2).
328 frame.setlocal(0, frame.getlocal(0).__isub__(t$0$PyObject));
330 frame.setlocal(1, frame.getlocal(1).__isub__(t$0$PyObject));
331 return frame.getlocal(1)._div(i$63)._sub(frame.getlocal(0)._div(i$63))._sub(frame.getlocal(1)._div(i$64)._sub(frame.getlocal(0)._div(i$64)))._add(frame.getlocal(1)._div(i$65)._sub(frame.getlocal(0)._div(i$65)));
334 private static PyObject weekday$5(PyFrame frame) {
335 /* Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
337 frame.setlocal(4, frame.getglobal("mktime").__call__(new PyTuple(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), i$16, i$16, i$16, i$16, i$16, i$16})));
338 frame.setlocal(3, frame.getglobal("localtime").__call__(frame.getlocal(4)));
339 return frame.getlocal(3).__getitem__(i$68);
342 private static PyObject monthrange$6(PyFrame frame) {
343 // Temporary Variables
344 PyObject t$0$PyObject;
347 /* Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
349 if ((i$14._le(t$0$PyObject = frame.getlocal(1)).__nonzero__() ? t$0$PyObject._le(i$70) : Py.Zero).__not__().__nonzero__()) {
350 throw Py.makeException(frame.getglobal("ValueError"), s$71);
352 frame.setlocal(3, frame.getglobal("weekday").__call__(frame.getlocal(0), frame.getlocal(1), i$14));
353 frame.setlocal(2, frame.getglobal("mdays").__getitem__(frame.getlocal(1))._add((t$0$PyObject = frame.getlocal(1)._eq(frame.getglobal("February"))).__nonzero__() ? frame.getglobal("isleap").__call__(frame.getlocal(0)) : t$0$PyObject));
354 return new PyTuple(new PyObject[] {frame.getlocal(3), frame.getlocal(2)});
357 private static PyObject monthcalendar$7(PyFrame frame) {
358 // Temporary Variables
360 PyObject[] t$0$PyObject__;
361 PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
364 /* Return a matrix representing a month's calendar.
365 Each row represents a week; days outside this month are zero. */
366 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getglobal("monthrange").__call__(frame.getlocal(0), frame.getlocal(1)), 2);
367 frame.setlocal(5, t$0$PyObject__[0]);
368 frame.setlocal(2, t$0$PyObject__[1]);
369 frame.setlocal(8, new PyList(new PyObject[] {}));
370 frame.setlocal(6, frame.getglobal("range").__call__(i$59));
371 frame.setlocal(4, frame.getglobal("_firstweekday")._sub(frame.getlocal(5))._add(i$68)._mod(i$59)._sub(i$73));
372 while (frame.getlocal(4)._le(frame.getlocal(2)).__nonzero__()) {
373 frame.setlocal(7, new PyList(new PyObject[] {i$16, i$16, i$16, i$16, i$16, i$16, i$16}));
375 t$1$PyObject = frame.getlocal(6);
376 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
377 frame.setlocal(3, t$0$PyObject);
378 if ((i$14._le(t$2$PyObject = frame.getlocal(4)).__nonzero__() ? t$2$PyObject._le(frame.getlocal(2)) : Py.Zero).__nonzero__()) {
379 frame.getlocal(7).__setitem__(frame.getlocal(3), frame.getlocal(4));
381 frame.setlocal(4, frame.getlocal(4)._add(i$14));
383 frame.getlocal(8).invoke("append", frame.getlocal(7));
385 return frame.getlocal(8);
388 private static PyObject _center$8(PyFrame frame) {
389 /* Center a string in a field. */
390 frame.setlocal(2, frame.getlocal(1)._sub(frame.getglobal("len").__call__(frame.getlocal(0))));
391 if (frame.getlocal(2)._le(i$16).__nonzero__()) {
392 return frame.getlocal(0);
394 return s$75._mul(frame.getlocal(2)._add(i$14)._div(i$15))._add(frame.getlocal(0))._add(s$75._mul(frame.getlocal(2)._div(i$15)));
397 private static PyObject prweek$9(PyFrame frame) {
398 /* Print a single week (no newline). */
399 Py.printComma(frame.getglobal("week").__call__(frame.getlocal(0), frame.getlocal(1)));
403 private static PyObject week$10(PyFrame frame) {
404 // Temporary Variables
406 PyObject t$0$PyObject, t$1$PyObject;
409 /* Returns a single week in a string (no newline). */
410 frame.setlocal(4, new PyList(new PyObject[] {}));
412 t$1$PyObject = frame.getlocal(0);
413 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
414 frame.setlocal(2, t$0$PyObject);
415 if (frame.getlocal(2)._eq(i$16).__nonzero__()) {
416 frame.setlocal(3, s$34);
419 frame.setlocal(3, s$78._mod(frame.getlocal(2)));
421 frame.getlocal(4).invoke("append", frame.getglobal("_center").__call__(frame.getlocal(3), frame.getlocal(1)));
423 return s$75.invoke("join", frame.getlocal(4));
426 private static PyObject weekheader$11(PyFrame frame) {
427 // Temporary Variables
429 PyObject t$0$PyObject, t$1$PyObject;
432 /* Return a header for a week. */
433 if (frame.getlocal(0)._ge(i$80).__nonzero__()) {
434 frame.setlocal(2, frame.getglobal("day_name"));
437 frame.setlocal(2, frame.getglobal("day_abbr"));
439 frame.setlocal(3, new PyList(new PyObject[] {}));
441 t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("_firstweekday"), frame.getglobal("_firstweekday")._add(i$59));
442 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
443 frame.setlocal(1, t$0$PyObject);
444 frame.getlocal(3).invoke("append", frame.getglobal("_center").__call__(frame.getlocal(2).__getitem__(frame.getlocal(1)._mod(i$59)).__getslice__(null, frame.getlocal(0), null), frame.getlocal(0)));
446 return s$75.invoke("join", frame.getlocal(3));
449 private static PyObject prmonth$12(PyFrame frame) {
450 /* Print a month's calendar. */
451 Py.printComma(frame.getglobal("month").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)}));
455 private static PyObject month$13(PyFrame frame) {
456 // Temporary Variables
458 PyObject t$0$PyObject, t$1$PyObject;
461 /* Return a month's calendar string (multi-line). */
462 frame.setlocal(2, frame.getglobal("max").__call__(i$15, frame.getlocal(2)));
463 frame.setlocal(3, frame.getglobal("max").__call__(i$14, frame.getlocal(3)));
464 frame.setlocal(5, frame.getglobal("_center").__call__(frame.getglobal("month_name").__getitem__(frame.getlocal(1))._add(s$75)._add(frame.getlocal(0).__repr__()), i$59._mul(frame.getlocal(2)._add(i$14))._sub(i$14)).invoke("rstrip")._add(s$83._mul(frame.getlocal(3)))._add(frame.getglobal("weekheader").__call__(frame.getlocal(2)).invoke("rstrip"))._add(s$83._mul(frame.getlocal(3))));
466 t$1$PyObject = frame.getglobal("monthcalendar").__call__(frame.getlocal(0), frame.getlocal(1));
467 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
468 frame.setlocal(4, t$0$PyObject);
469 frame.setlocal(5, frame.getlocal(5)._add(frame.getglobal("week").__call__(frame.getlocal(4), frame.getlocal(2)).invoke("rstrip"))._add(s$83._mul(frame.getlocal(3))));
471 return frame.getlocal(5).__getslice__(null, frame.getlocal(3).__neg__(), null)._add(s$83);
474 private static PyObject format3c$14(PyFrame frame) {
475 /* Prints 3-column formatting for year calendars */
476 Py.println(frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3), frame.getlocal(4)}));
480 private static PyObject format3cstring$15(PyFrame frame) {
481 /* Returns a string formatted from 3 strings, centered within 3 columns. */
482 return frame.getglobal("_center").__call__(frame.getlocal(0), frame.getlocal(3))._add(s$75._mul(frame.getlocal(4)))._add(frame.getglobal("_center").__call__(frame.getlocal(1), frame.getlocal(3)))._add(s$75._mul(frame.getlocal(4)))._add(frame.getglobal("_center").__call__(frame.getlocal(2), frame.getlocal(3)));
485 private static PyObject prcal$16(PyFrame frame) {
486 /* Print a year's calendar. */
487 Py.printComma(frame.getglobal("calendar").__call__(new PyObject[] {frame.getlocal(0), frame.getlocal(1), frame.getlocal(2), frame.getlocal(3)}));
491 private static PyObject calendar$17(PyFrame frame) {
492 // Temporary Variables
493 int t$0$int, t$1$int, t$2$int, t$3$int;
494 PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject, t$3$PyObject, t$4$PyObject, t$5$PyObject, t$6$PyObject, t$7$PyObject;
497 /* Returns a year's calendar as a multi-line string. */
498 frame.setlocal(1, frame.getglobal("max").__call__(i$15, frame.getlocal(1)));
499 frame.setlocal(2, frame.getglobal("max").__call__(i$14, frame.getlocal(2)));
500 frame.setlocal(3, frame.getglobal("max").__call__(i$15, frame.getlocal(3)));
501 frame.setlocal(9, frame.getlocal(1)._add(i$14)._mul(i$59)._sub(i$14));
502 frame.setlocal(6, frame.getglobal("_center").__call__(frame.getlocal(0).__repr__(), frame.getlocal(9)._mul(i$84)._add(frame.getlocal(3)._mul(i$15))).invoke("rstrip")._add(s$83._mul(frame.getlocal(2))));
503 frame.setlocal(12, frame.getglobal("weekheader").__call__(frame.getlocal(1)));
504 frame.setlocal(12, frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getlocal(12), frame.getlocal(12), frame.getlocal(12), frame.getlocal(9), frame.getlocal(3)}).invoke("rstrip"));
506 t$1$PyObject = frame.getglobal("range").__call__(frame.getglobal("January"), frame.getglobal("January")._add(i$70), i$84);
507 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
508 frame.setlocal(8, t$0$PyObject);
509 frame.setlocal(6, frame.getlocal(6)._add(s$83._mul(frame.getlocal(2)))._add(frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getglobal("month_name").__getitem__(frame.getlocal(8)), frame.getglobal("month_name").__getitem__(frame.getlocal(8)._add(i$14)), frame.getglobal("month_name").__getitem__(frame.getlocal(8)._add(i$15)), frame.getlocal(9), frame.getlocal(3)}).invoke("rstrip"))._add(s$83._mul(frame.getlocal(2)))._add(frame.getlocal(12))._add(s$83._mul(frame.getlocal(2))));
510 frame.setlocal(13, new PyList(new PyObject[] {}));
511 frame.setlocal(7, i$16);
513 t$3$PyObject = frame.getglobal("range").__call__(frame.getlocal(8), frame.getlocal(8)._add(i$84));
514 while ((t$2$PyObject = t$3$PyObject.__finditem__(t$1$int++)) != null) {
515 frame.setlocal(10, t$2$PyObject);
516 frame.setlocal(5, frame.getglobal("monthcalendar").__call__(frame.getlocal(0), frame.getlocal(10)));
517 if (frame.getglobal("len").__call__(frame.getlocal(5))._gt(frame.getlocal(7)).__nonzero__()) {
518 frame.setlocal(7, frame.getglobal("len").__call__(frame.getlocal(5)));
520 frame.getlocal(13).invoke("append", frame.getlocal(5));
523 t$5$PyObject = frame.getglobal("range").__call__(frame.getlocal(7));
524 while ((t$4$PyObject = t$5$PyObject.__finditem__(t$2$int++)) != null) {
525 frame.setlocal(11, t$4$PyObject);
526 frame.setlocal(4, new PyList(new PyObject[] {}));
528 t$7$PyObject = frame.getlocal(13);
529 while ((t$6$PyObject = t$7$PyObject.__finditem__(t$3$int++)) != null) {
530 frame.setlocal(5, t$6$PyObject);
531 if (frame.getlocal(11)._ge(frame.getglobal("len").__call__(frame.getlocal(5))).__nonzero__()) {
532 frame.getlocal(4).invoke("append", s$34);
535 frame.getlocal(4).invoke("append", frame.getglobal("week").__call__(frame.getlocal(5).__getitem__(frame.getlocal(11)), frame.getlocal(1)));
538 frame.setlocal(6, frame.getlocal(6)._add(frame.getglobal("format3cstring").__call__(new PyObject[] {frame.getlocal(4).__getitem__(i$16), frame.getlocal(4).__getitem__(i$14), frame.getlocal(4).__getitem__(i$15), frame.getlocal(9), frame.getlocal(3)}).invoke("rstrip"))._add(s$83._mul(frame.getlocal(2))));
541 return frame.getlocal(6).__getslice__(null, frame.getlocal(2).__neg__(), null)._add(s$83);
544 private static PyObject timegm$18(PyFrame frame) {
545 // Temporary Variables
547 PyObject[] t$0$PyObject__;
548 PyObject t$0$PyObject, t$1$PyObject, t$2$PyObject;
551 /* Unrelated but handy function to calculate Unix timestamp from GMT. */
552 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getlocal(0).__getslice__(null, i$68, null), 6);
553 frame.setlocal(7, t$0$PyObject__[0]);
554 frame.setlocal(6, t$0$PyObject__[1]);
555 frame.setlocal(8, t$0$PyObject__[2]);
556 frame.setlocal(4, t$0$PyObject__[3]);
557 frame.setlocal(2, t$0$PyObject__[4]);
558 frame.setlocal(1, t$0$PyObject__[5]);
559 if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(7)._ge(frame.getglobal("EPOCH")));
560 if (frame.getglobal("__debug__").__nonzero__()) Py.assert(i$14._le(t$0$PyObject = frame.getlocal(6)).__nonzero__() ? t$0$PyObject._le(i$70) : Py.Zero);
561 frame.setlocal(11, i$91._mul(frame.getlocal(7)._sub(frame.getglobal("EPOCH")))._add(frame.getglobal("leapdays").__call__(frame.getglobal("EPOCH"), frame.getlocal(7))));
563 t$1$PyObject = frame.getglobal("range").__call__(i$14, frame.getlocal(6));
564 while ((t$0$PyObject = t$1$PyObject.__finditem__(t$0$int++)) != null) {
565 frame.setlocal(5, t$0$PyObject);
566 frame.setlocal(11, frame.getlocal(11)._add(frame.getglobal("mdays").__getitem__(frame.getlocal(5))));
568 if (((t$2$PyObject = frame.getlocal(6)._gt(i$15)).__nonzero__() ? frame.getglobal("isleap").__call__(frame.getlocal(7)) : t$2$PyObject).__nonzero__()) {
569 frame.setlocal(11, frame.getlocal(11)._add(i$14));
571 frame.setlocal(11, frame.getlocal(11)._add(frame.getlocal(8))._sub(i$14));
572 frame.setlocal(9, frame.getlocal(11)._mul(i$92)._add(frame.getlocal(4)));
573 frame.setlocal(3, frame.getlocal(9)._mul(i$93)._add(frame.getlocal(2)));
574 frame.setlocal(10, frame.getlocal(3)._mul(i$93)._add(frame.getlocal(1)));
575 return frame.getlocal(10);
578 private static PyObject main$19(PyFrame frame) {
579 frame.setglobal("__file__", s$94);
582 // Temporary Variables
583 PyObject[] t$0$PyObject__;
586 /* Calendar printing functions
588 Note when comparing these calendars to the ones printed by cal(1): By
589 default, these calendars have Monday as the first day of the week, and
590 Sunday as the last (the European convention). Use setfirstweekday() to
591 set the first day of the week (0=Monday, 6=Sunday). */
592 imp_accu = org.python.core.imp.importFrom("time", new String[] {"localtime", "mktime"}, frame);
593 frame.setlocal("localtime", imp_accu[0]);
594 frame.setlocal("mktime", imp_accu[1]);
596 frame.setlocal("__all__", new PyList(new PyObject[] {s$1, s$2, s$3, s$4, s$5, s$6, s$7, s$8, s$9, s$10, s$11, s$12, s$13}));
597 frame.setlocal("error", frame.getname("ValueError"));
598 frame.setlocal("January", i$14);
599 frame.setlocal("February", i$15);
600 frame.setlocal("mdays", new PyList(new PyObject[] {i$16, i$17, i$18, i$17, i$19, i$17, i$19, i$17, i$17, i$19, i$17, i$19, i$17}));
601 frame.setlocal("day_name", new PyList(new PyObject[] {s$20, s$21, s$22, s$23, s$24, s$25, s$26}));
602 frame.setlocal("day_abbr", new PyList(new PyObject[] {s$27, s$28, s$29, s$30, s$31, s$32, s$33}));
603 frame.setlocal("month_name", new PyList(new PyObject[] {s$34, s$35, s$36, s$37, s$38, s$39, s$40, s$41, s$42, s$43, s$44, s$45, s$46}));
604 frame.setlocal("month_abbr", new PyList(new PyObject[] {s$47, s$48, s$49, s$50, s$51, s$39, s$52, s$53, s$54, s$55, s$56, s$57, s$58}));
605 t$0$PyObject__ = org.python.core.Py.unpackSequence(frame.getname("range").__call__(i$59), 7);
606 frame.setlocal("MONDAY", t$0$PyObject__[0]);
607 frame.setlocal("TUESDAY", t$0$PyObject__[1]);
608 frame.setlocal("WEDNESDAY", t$0$PyObject__[2]);
609 frame.setlocal("THURSDAY", t$0$PyObject__[3]);
610 frame.setlocal("FRIDAY", t$0$PyObject__[4]);
611 frame.setlocal("SATURDAY", t$0$PyObject__[5]);
612 frame.setlocal("SUNDAY", t$0$PyObject__[6]);
613 frame.setlocal("_firstweekday", i$16);
614 frame.setlocal("firstweekday", new PyFunction(frame.f_globals, new PyObject[] {}, c$0_firstweekday));
615 frame.setlocal("setfirstweekday", new PyFunction(frame.f_globals, new PyObject[] {}, c$1_setfirstweekday));
616 frame.setlocal("isleap", new PyFunction(frame.f_globals, new PyObject[] {}, c$2_isleap));
617 frame.setlocal("leapdays", new PyFunction(frame.f_globals, new PyObject[] {}, c$3_leapdays));
618 frame.setlocal("weekday", new PyFunction(frame.f_globals, new PyObject[] {}, c$4_weekday));
619 frame.setlocal("monthrange", new PyFunction(frame.f_globals, new PyObject[] {}, c$5_monthrange));
620 frame.setlocal("monthcalendar", new PyFunction(frame.f_globals, new PyObject[] {}, c$6_monthcalendar));
621 frame.setlocal("_center", new PyFunction(frame.f_globals, new PyObject[] {}, c$7__center));
622 frame.setlocal("prweek", new PyFunction(frame.f_globals, new PyObject[] {}, c$8_prweek));
623 frame.setlocal("week", new PyFunction(frame.f_globals, new PyObject[] {}, c$9_week));
624 frame.setlocal("weekheader", new PyFunction(frame.f_globals, new PyObject[] {}, c$10_weekheader));
625 frame.setlocal("prmonth", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16}, c$11_prmonth));
626 frame.setlocal("month", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16}, c$12_month));
627 frame.setlocal("_colwidth", i$59._mul(i$84)._sub(i$14));
628 frame.setlocal("_spacing", i$68);
629 frame.setlocal("format3c", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("_colwidth"), frame.getname("_spacing")}, c$13_format3c));
630 frame.setlocal("format3cstring", new PyFunction(frame.f_globals, new PyObject[] {frame.getname("_colwidth"), frame.getname("_spacing")}, c$14_format3cstring));
631 frame.setlocal("prcal", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16, frame.getname("_spacing")}, c$15_prcal));
632 frame.setlocal("calendar", new PyFunction(frame.f_globals, new PyObject[] {i$16, i$16, frame.getname("_spacing")}, c$16_calendar));
633 frame.setlocal("EPOCH", i$89);
634 frame.setlocal("timegm", new PyFunction(frame.f_globals, new PyObject[] {}, c$17_timegm));
639 public static void moduleDictInit(PyObject dict) {
640 dict.__setitem__("__name__", new PyString("calendar"));
641 Py.runCode(new _PyInner().getMain(), dict, dict);
644 public static void main(String[] args) throws java.lang.Exception {
645 String[] newargs = new String[args.length+1];
646 newargs[0] = "calendar";
647 System.arraycopy(args, 0, newargs, 1, args.length);
648 Py.runMain(calendar._PyInner.class, newargs, calendar.jpy$packages, calendar.jpy$mainProperties, "", new String[] {"string", "random", "util", "traceback", "sre_compile", "atexit", "sre", "sre_constants", "StringIO", "javaos", "socket", "yapm", "calendar", "repr", "copy_reg", "SocketServer", "server", "re", "linecache", "javapath", "UserDict", "copy", "threading", "stat", "PathVFS", "sre_parse"});