code stringlengths 4 1.01M | language stringclasses 2 values |
|---|---|
<html>
<head>
<title>
WARNING: at arch/x86/kernel/cpu/perf_event_intel.c:1373 perfevents: irq loop stuck!
</title>
</head>
<body>
<center>
<h1>
WARNING: at arch/x86/kernel/cpu/perf_event_intel.c:1373 perfevents: irq loop stuck!
</h1>
</center>
<h3>Severity</h3>
Just a warning, although it does cause a long pause while
the interrupt is stuck on.
<h3>Found by</h3>
perf_fuzzer
<h3>First Seen</h3>
3.15-rc1
<h3>Most recently Seen</h3>
4.8-rc1
<h3>Reproducible</h3>
yes
<h3>Found On</h3>
Haswell
<h3>Linux-kernel Mailing List Report</h3>
13 May 2014 --
<a href="https://lkml.org/lkml/2014/5/13/906">perfevents: irq loop stuck!</a>
<h3>Analysis</h3>
There are two problems. The first was the 63-bit overflow issue
detailed below which makes triggering the problem easier.
The other is the overflow interrupt getting stuck on when
the fixed-counter-0 sample_period is 2.<br><br>
<h3>Kernel Splat</h3>
<ol>
<li>
<pre>
*** perf_fuzzer 0.30-pre *** by Vince Weaver
Linux version 4.0.0+ x86_64
Processor: Intel 6/60/3
Seeding random number generator with 1429913766
/proc/sys/kernel/perf_event_max_sample_rate currently: 100000/s
/proc/sys/kernel/perf_event_paranoid currently: 0
Logging perf_event_open() failures: no
Running fsync after every syscall: no
To reproduce, try: ./perf_fuzzer -s 30000 -r 1429913766
Pid=26448, sleeping 1s
==================================================
Fuzzing the following syscalls:
mmap perf_event_open close read write ioctl fork prctl poll
*NOT* Fuzzing the following syscalls:
Also attempting the following:
signal-handler-on-overflow busy-instruction-loop accessing-perf-proc-and-sys-files trashing-the-mmap-page
*NOT* attempting the following:
==================================================
Iteration 10000
Open attempts: 127761 Successful: 907 Currently open: 595
EPERM : 13
ENOENT : 638
E2BIG : 12148
EBADF : 7160
UNKNOWN 16 : 1
EINVAL : 106556
ENOSPC : 9
EOPNOTSUPP : 329
Type (Hardware 216/16984)(software 320/18429)(tracepoint 68/18304)(Cache 57/16130)(cpu 172/18053)(breakpoint 23/18313)(power 0/2258)(intel_bts 51/2332)(uncore_imc 0/2316)(#9 0/18)(#10 0/18)(#11 0/12)(#12 0/24)(#13 0/18)(#14 0/14)(>14 0/14538)
Close attempts: 312 Successful: 312
Read attempts: 894 Successful: 786
Write attempts: 871 Successful: 0
Ioctl attempts: 914 Successful: 411
Mmap attempts: 907 Successful: 102
Prctl attempts: 900 Successful: 900
Fork attempts: 446 Successful: 446
Poll attempts: 883 Successful: 865
Access attempts: 939 Successful: 466
Trash mmap attempts: 900 Successful: 900
Overflows: 0
SIGIOs due to RT signal queue full: 0
[ 8224.179407] ------------[ cut here ]------------
[ 8224.184368] WARNING: CPU: 0 PID: 0 at arch/x86/kernel/cpu/perf_event_intel.c:1602 intel_pmu_handle_irq+0x2bc/0x450()
[ 8224.195686] perfevents: irq loop stuck!
[ 8224.199835] Modules linked in: fuse x86_pkg_temp_thermal intel_powerclamp intel_rapl iosf_mbi coretemp kvm crct10dif_pclmul snd_hda_codec_hdmi crc32_pclmul ghash_clmulni_intel snd_hda_codec_realtek aesni_intel snd_hda_codec_generic aes_x86_64 i915 snd_hda_intel snd_hda_controller snd_hda_codec snd_hda_core snd_hwdep lrw snd_pcm gf128mul iTCO_wdt iTCO_vendor_support drm_kms_helper glue_helper snd_timer ppdev evdev drm ablk_helper snd cryptd mei_me soundcore xhci_pci tpm_tis psmouse xhci_hcd mei serio_raw lpc_ich tpm mfd_core parport_pc pcspkr parport wmi i2c_algo_bit battery i2c_i801 button processor video sg sr_mod sd_mod cdrom ahci libahci libata ehci_pci ehci_hcd e1000e usbcore ptp crc32c_intel fan scsi_mod pps_core usb_common thermal thermal_sys
[ 8224.273188] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 4.0.0+ #136
[ 8224.281012] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 01/26/2014
[ 8224.288988] ffffffff81a093a8 ffff88011ea05b50 ffffffff816d5639 0000000000000000
[ 8224.297058] ffff88011ea05ba0 ffff88011ea05b90 ffffffff81072e4a ffff880119b87090
[ 8224.306453] 0000000000000064 ffff88011ea0bd80 ffff8800c38c7800 0000000000000040
[ 8224.315894] Call Trace:
[ 8224.319886] <NMI> [<ffffffff816d5639>] dump_stack+0x45/0x57
[ 8224.327439] [<ffffffff81072e4a>] warn_slowpath_common+0x8a/0xc0
[ 8224.335238] [<ffffffff81072ec6>] warn_slowpath_fmt+0x46/0x50
[ 8224.342812] [<ffffffff8103399c>] intel_pmu_handle_irq+0x2bc/0x450
[ 8224.350830] [<ffffffff81164215>] ? perf_event_task_tick+0x1d5/0x2b0
[ 8224.359025] [<ffffffff8102a40b>] perf_event_nmi_handler+0x2b/0x50
[ 8224.367069] [<ffffffff810185c0>] nmi_handle+0xa0/0x150
[ 8224.374067] [<ffffffff81018525>] ? nmi_handle+0x5/0x150
[ 8224.381169] [<ffffffff8101886a>] default_do_nmi+0x4a/0x140
[ 8224.388487] [<ffffffff810189f8>] do_nmi+0x98/0xe0
[ 8224.394886] [<ffffffff816df8af>] end_repeat_nmi+0x1e/0x2e
[ 8224.402082] [<ffffffff8105bffa>] ? native_write_msr_safe+0xa/0x10
[ 8224.409958] [<ffffffff8105bffa>] ? native_write_msr_safe+0xa/0x10
[ 8224.417785] [<ffffffff8105bffa>] ? native_write_msr_safe+0xa/0x10
[ 8224.425536] <<EOE>> <IRQ> [<ffffffff8103356e>] intel_pmu_enable_event+0x20e/0x230
[ 8224.435001] [<ffffffff8102b721>] x86_pmu_start+0x81/0x120
[ 8224.442007] [<ffffffff8102bf25>] x86_pmu_enable+0x295/0x310
[ 8224.449150] [<ffffffff811621aa>] perf_pmu_enable+0x2a/0x30
[ 8224.456173] [<ffffffff81029fe8>] x86_pmu_commit_txn+0x78/0xa0
[ 8224.456173] [<ffffffff81029fe8>] x86_pmu_commit_txn+0x78/0xa0
[ 8224.463561] [<ffffffff81427f6b>] ? debug_object_activate+0x14b/0x1e0
[ 8224.471591] [<ffffffff810bdde9>] ? __lock_acquire.isra.31+0x3b9/0x1000
[ 8224.479715] [<ffffffff81427f6b>] ? debug_object_activate+0x14b/0x1e0
[ 8224.487676] [<ffffffff810bcba4>] ? __lock_is_held+0x54/0x80
[ 8224.494794] [<ffffffff81162d50>] ? event_sched_in.isra.85+0x190/0x330
[ 8224.502894] [<ffffffff811630a8>] group_sched_in+0x1b8/0x1e0
[ 8224.510082] [<ffffffff8101df1a>] ? native_sched_clock+0x2a/0x90
[ 8224.517646] [<ffffffff811637bc>] __perf_event_enable+0x25c/0x2a0
[ 8224.525297] [<ffffffff810f3e69>] ? tick_nohz_irq_exit+0x29/0x30
[ 8224.532776] [<ffffffff8115ef30>] ? cpu_clock_event_start+0x40/0x40
[ 8224.540595] [<ffffffff8115ef80>] remote_function+0x50/0x60
[ 8224.547668] [<ffffffff810f8cd1>] flush_smp_call_function_queue+0x81/0x180
[ 8224.556126] [<ffffffff810f9763>] generic_smp_call_function_single_interrupt+0x13/0x60
[ 8224.565749] [<ffffffff8104b5c8>] smp_trace_call_function_single_interrupt+0x38/0xc0
[ 8224.575132] [<ffffffff816de9be>] trace_call_function_single_interrupt+0x6e/0x80
[ 8224.584168] <EOI> [<ffffffff8156e8b5>] ? cpuidle_enter_state+0x65/0x160
[ 8224.592646] [<ffffffff8156e8a1>] ? cpuidle_enter_state+0x51/0x160
[ 8224.600408] [<ffffffff8156e9e7>] cpuidle_enter+0x17/0x20
[ 8224.607285] [<ffffffff810b6e39>] cpu_startup_entry+0x399/0x440
[ 8224.614712] [<ffffffff816c9ddb>] rest_init+0xbb/0xd0
[ 8224.621283] [<ffffffff81d46f74>] start_kernel+0x44e/0x45b
[ 8224.628212] [<ffffffff81d46120>] ? early_idt_handlers+0x120/0x120
[ 8224.635980] [<ffffffff81d464d7>] x86_64_start_reservations+0x2a/0x2c
[ 8224.643999] [<ffffffff81d46614>] x86_64_start_kernel+0x13b/0x14a
[ 8224.651691] ---[ end trace 5679ca0875946dba ]---
[ 8224.657764]
[ 8224.660447] CPU#0: ctrl: 0000000000000000
[ 8224.666448] CPU#0: status: 0000000000000000
[ 8224.672414] CPU#0: overflow: 0000000000000000
[ 8224.678373] CPU#0: fixed: 00000000000000b9
[ 8224.684338] CPU#0: pebs: 0000000000000000
[ 8224.690322] CPU#0: debugctl: 0000000000000000
[ 8224.696253] CPU#0: active: 0000000300000000
[ 8224.702232] CPU#0: gen-PMC0 ctrl: 00000000108001c2
[ 8224.708823] CPU#0: gen-PMC0 count: 0000000000000001
[ 8224.715371] CPU#0: gen-PMC0 left: 0000ffffffffffff
[ 8224.721914] CPU#0: gen-PMC1 ctrl: 00000000001382d0
[ 8224.728402] CPU#0: gen-PMC1 count: 0000000000ff3792
[ 8224.734849] CPU#0: gen-PMC1 left: 0000ffffff012119
[ 8224.741271] CPU#0: gen-PMC2 ctrl: 00000003ff96764b
[ 8224.747600] CPU#0: gen-PMC2 count: 0000000000000001
[ 8224.753884] CPU#0: gen-PMC2 left: 0000ffffffffffff
[ 8224.760100] CPU#0: gen-PMC3 ctrl: 0000000000131acd
[ 8224.766320] CPU#0: gen-PMC3 count: 000000000000288a
[ 8224.772585] CPU#0: gen-PMC3 left: 0000ffffffffffff
[ 8224.778769] CPU#0: fixed-PMC0 count: 0000fffffffffffe
[ 8224.784973] CPU#0: fixed-PMC1 count: 0000fffda1877268
[ 8224.791196] CPU#0: fixed-PMC2 count: 0000000000f222eb
[ 8224.797450] perf_event_intel: clearing PMU state on CPU#0
[ 8224.804063] INFO: NMI handler (perf_event_nmi_handler) took too long to run: 624.630 msecs
[ 8224.813789] perf interrupt took too long (4880480 > 2500), lowering kernel.perf_event_max_sample_rate to 50000
[ 8224.825400] perf interrupt took too long (4842512 > 5000), lowering kernel.perf_event_max_sample_rate to 25000
[ 8225.007411] perf interrupt took too long (4804688 > 10000), lowering kernel.perf_event_max_sample_rate to 12500
[ 8225.244832] perf interrupt took too long (4767159 > 20000), lowering kernel.perf_event_max_sample_rate to 6250
[ 8225.295535] perf interrupt took too long (4729923 > 38461), lowering kernel.perf_event_max_sample_rate to 3250
[ 8225.747314] perf interrupt took too long (4692980 > 71428), lowering kernel.perf_event_max_sample_rate to 1750
</pre>
<li>With PeterZ's 63-bit limit patch applied.
<pre>
*** perf_fuzzer 0.29-pre *** by Vince Weaver
Linux version 3.15.0-rc5+ x86_64
Processor: Intel 6/60/3
Seeding random number generator with 1400341222
/proc/sys/kernel/perf_event_max_sample_rate currently: 12500/s
/proc/sys/kernel/perf_event_paranoid currently: 1
Logging perf_event_open() failures: no
Running fsync after every syscall: no
To reproduce, try: ./perf_fuzzer -t OCIRMQWPFpAi -s 50000 -r 1400341222
Pid=9255, sleeping 1s
==================================================
Fuzzing the following syscalls:
mmap perf_event_open close read write ioctl fork prctl poll
*NOT* Fuzzing the following syscalls:
Also attempting the following:
busy-instruction-loop accessing-perf-proc-and-sys-files trashing-the-mmap-page
*NOT* attempting the following:
signal-handler-on-overflow
==================================================
Iteration 10000
Open attempts: 204136 Successful: 889
EPERM : 23
ENOENT : 1782
E2BIG : 23607
EBADF : 10276
EACCES : 983
EINVAL : 165653
ENOSPC : 304
EOPNOTSUPP : 619
Type (Hardware 192/26697)(software 411/30206)(tracepoint 75/29889)(Cache 34/25527)(cpu 151/30007)(breakpoint 26/29908)(uncore_imc 0/4158)(power 0/4179)(#8 0/104)(#9 0/30)(#10 0/24)(#11 0/21)(#12 0/28)(#13 0/24)(#14 0/27)(>14 0/23307)
Close attempts: 855 Successful: 855
Read attempts: 932 Successful: 838
Write attempts: 845 Successful: 0
Ioctl attempts: 875 Successful: 397
Mmap attempts: 889 Successful: 377
Prctl attempts: 891 Successful: 891
Fork attempts: 463 Successful: 463
Poll attempts: 871 Successful: 0
Access attempts: 907 Successful: 461
Trash mmap attempts: 894 Successful: 894
Overflows: 0
SIGIOs due to RT signal queue full: 0
Iteration 20000
Open attempts: 198724 Successful: 946
EPERM : 20
ENOENT : 1780
E2BIG : 22966
EBADF : 9207
EACCES : 973
EINVAL : 161838
ENOSPC : 329
EOPNOTSUPP : 665
Type (Hardware 211/26247)(software 395/29165)(tracepoint 85/28975)(Cache 62/25198)(cpu 178/29118)(breakpoint 15/29305)(uncore_imc 0/4178)(power 0/4140)(#8 0/96)(#9 0/25)(#10 0/27)(#11 0/23)(#12 0/25)(#13 0/22)(#14 0/32)(>14 0/22148)
Close attempts: 910 Successful: 910
Read attempts: 918 Successful: 827
Write attempts: 908 Successful: 0
Ioctl attempts: 907 Successful: 404
Mmap attempts: 946 Successful: 369
Prctl attempts: 866 Successful: 866
Fork attempts: 448 Successful: 448
Poll attempts: 884 Successful: 1
Access attempts: 916 Successful: 485
Trash mmap attempts: 936 Successful: 936
Overflows: 0
SIGIOs due to RT signal queue full: 0
Iteration 30000
Open attempts: 195961 Successful: 886
EPERM : 22
ENOENT : 1790
E2BIG : 22597
EBADF : 9114
EACCES : 994
EINVAL : 159620
ENOSPC : 327
EOPNOTSUPP : 611
Type (Hardware 212/25756)(software 347/29144)(tracepoint 91/28665)(Cache 45/24682)(cpu 172/28491)(breakpoint 19/28515)(uncore_imc 0/4074)(power 0/4151)(#8 0/89)(#9 0/35)(#10 0/29)(#11 0/15)(#12 0/24)(#13 0/26)(#14 0/32)(>14 0/22233)
Close attempts: 933 Successful: 933
Read attempts: 900 Successful: 806
Write attempts: 902 Successful: 0
Ioctl attempts: 925 Successful: 416
Mmap attempts: 886 Successful: 371
Prctl attempts: 884 Successful: 884
Fork attempts: 455 Successful: 455
Poll attempts: 912 Successful: 2
Access attempts: 952 Successful: 474
Trash mmap attempts: 904 Successful: 904
Overflows: 0
SIGIOs due to RT signal queue full: 0
Iteration 40000
Open attempts: 188894 Successful: 919
EPERM : 18
ENOENT : 1756
E2BIG : 22159
EBADF : 8667
EACCES : 944
EINVAL : 153542
ENOSPC : 307
EOPNOTSUPP : 582
Type (Hardware 215/25176)(software 395/27947)(tracepoint 64/27458)(Cache 52/23674)(cpu 173/27533)(breakpoint 20/27463)(uncore_imc 0/3960)(power 0/4112)(#8 0/72)(#9 0/37)(#10 0/24)(#11 0/24)(#12 0/30)(#13 0/28)(#14 0/30)(>14 0/21326)
Close attempts: 862 Successful: 862
Read attempts: 928 Successful: 818
Write attempts: 925 Successful: 0
Ioctl attempts: 898 Successful: 397
Mmap attempts: 919 Successful: 367
Prctl attempts: 903 Successful: 903
Fork attempts: 454 Successful: 454
Poll attempts: 936 Successful: 0
Access attempts: 875 Successful: 444
Trash mmap attempts: 899 Successful: 899
Overflows: 0
SIGIOs due to RT signal queue full: 0
[69213.252805] ------------[ cut here ]------------
[69213.260637] WARNING: CPU: 4 PID: 11343 at arch/x86/kernel/cpu/perf_event_intel.c:1373 intel_pmu_handle_irq+0x2a4/0x3c0()
[69213.276788] perfevents: irq loop stuck!
[69213.285424] Modules linked in: fuse x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek kvm snd_hda_codec_hdmi snd_hda_codec_generic crc32_pclmul snd_hda_intel ghash_clmulni_intel aesni_intel snd_hda_controller aes_x86_64 snd_hda_codec i915 snd_hwdep iTCO_wdt lrw snd_pcm gf128mul drm_kms_helper glue_helper snd_timer iTCO_vendor_support ppdev evdev drm wmi battery parport_pc mei_me tpm_tis parport ablk_helper button i2c_algo_bit processor video i2c_i801 psmouse i2c_core snd pcspkr serio_raw cryptd soundcore tpm lpc_ich mfd_core mei sd_mod crc_t10dif sr_mod crct10dif_generic cdrom ehci_pci ehci_hcd xhci_hcd ahci e1000e libahci libata crct10dif_pclmul crct10dif_common ptp usbcore crc32c_intel scsi_mod pps_core usb_common fan thermal thermal_sys
[69213.378556] CPU: 4 PID: 11343 Comm: perf_fuzzer Tainted: G D 3.15.0-rc5+ #108
[69213.391205] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 01/26/2014
[69213.403033] 0000000000000009 ffff88011eb06cb0 ffffffff8164a8f0 ffff88011eb06cf8
[69213.414865] ffff88011eb06ce8 ffffffff810646ad 0000000000000064 ffff88011eb0cbe0
[69213.426497] ffff880036ec8000 0000000000000040 ffff88011eb0cde0 ffff88011eb06d48
[69213.438024] Call Trace:
[69213.444133] <NMI> [<ffffffff8164a8f0>] dump_stack+0x45/0x56
[69213.453792] [<ffffffff810646ad>] warn_slowpath_common+0x7d/0xa0
[69213.463691] [<ffffffff8106471c>] warn_slowpath_fmt+0x4c/0x50
[69213.473231] [<ffffffff8102efe4>] intel_pmu_handle_irq+0x2a4/0x3c0
[69213.483198] [<ffffffff8165440b>] perf_event_nmi_handler+0x2b/0x50
[69213.493162] [<ffffffff81653bd8>] nmi_handle.isra.5+0xa8/0x150
[69213.502796] [<ffffffff81653b35>] ? nmi_handle.isra.5+0x5/0x150
[69213.512514] [<ffffffff81653d58>] do_nmi+0xd8/0x340
[69213.521079] [<ffffffff81653201>] end_repeat_nmi+0x1e/0x2e
[69213.530362] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[69213.540425] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[69213.550387] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[69213.560288] <<EOE>> <IRQ> [<ffffffff8102ebcd>] intel_pmu_enable_event+0x21d/0x240
[69213.571791] [<ffffffff81027bfa>] x86_pmu_start+0x7a/0x100
[69213.580833] [<ffffffff810283f5>] x86_pmu_enable+0x295/0x310
[69213.590010] [<ffffffff8113538f>] perf_pmu_enable+0x2f/0x40
[69213.599039] [<ffffffff81136c04>] perf_cpu_hrtimer_handler+0xf4/0x200
[69213.609033] [<ffffffff8108b286>] __run_hrtimer+0x86/0x1e0
[69213.617999] [<ffffffff81136b10>] ? perf_event_context_sched_in+0xd0/0xd0
[69213.628315] [<ffffffff8108bdd7>] hrtimer_interrupt+0xf7/0x240
[69213.637648] [<ffffffff81044677>] local_apic_timer_interrupt+0x37/0x60
[69213.647709] [<ffffffff8165da16>] smp_trace_apic_timer_interrupt+0x46/0xb9
[69213.658188] [<ffffffff8165c41d>] trace_apic_timer_interrupt+0x6d/0x80
[69213.668302] <EOI>
[69213.670400] ---[ end trace 4d7b668c63a63e5c ]---
[69213.681834]
[69213.686561] CPU#4: ctrl: 0000000000000000
[69213.694352] CPU#4: status: 0000000000000000
[69213.701979] CPU#4: overflow: 0000000000000000
[69213.709599] CPU#4: fixed: 00000000000000b8
[69213.717172] CPU#4: pebs: 0000000000000000
[69213.724596] CPU#4: active: 0000000300000000
[69213.731939] CPU#4: gen-PMC0 ctrl: 000000000013412e
[69213.739877] CPU#4: gen-PMC0 count: 000000000000002c
[69213.747820] CPU#4: gen-PMC0 left: 0000ffffffffffd7
[69213.755657] CPU#4: gen-PMC1 ctrl: 0000000000138b40
[69213.763461] CPU#4: gen-PMC1 count: 00000000000086b3
[69213.771152] CPU#4: gen-PMC1 left: 0000ffffffff81c9
[69213.778742] CPU#4: gen-PMC2 ctrl: 000000000013024e
[69213.786271] CPU#4: gen-PMC2 count: 0000000000000001
[69213.793784] CPU#4: gen-PMC2 left: 0000ffffffffffff
[69213.801227] CPU#4: gen-PMC3 ctrl: 0000000000134f2e
[69213.808720] CPU#4: gen-PMC3 count: 00000000000009f9
[69213.816192] CPU#4: gen-PMC3 left: 0000fffffffff6de
[69213.823620] CPU#4: fixed-PMC0 count: 0000fffffffffffe
[69213.831035] CPU#4: fixed-PMC1 count: 0000ffffea2a90b2
[69213.838477] CPU#4: fixed-PMC2 count: 00000000051c5865
[69213.845792] perf_event_intel: clearing PMU state on CPU#4
[69213.853505] INFO: NMI handler (perf_event_nmi_handler) took too long to run: 600.823 msecs
[69213.864201] perf interrupt took too long (4696473 > 20000), lowering kernel.perf_event_max_sample_rate to 6250
</pre>
<li>Reproducibe case with 0.29-pre
<pre>
./perf_fuzzer -t OCIRMQWPFpAi -s 50000 -r 1400007525
</pre>
<li>
<pre>
*** perf_fuzzer 0.28 *** by Vince Weaver
Linux version 3.15.0-rc1+ x86_64
Processor: Intel 6/60/3
Seeding random number generator with 1399378358
/proc/sys/kernel/perf_event_max_sample_rate currently: 6250/s
/proc/sys/kernel/perf_event_paranoid currently: 1
Logging perf_event_open() failures: no
Running fsync after every syscall: no
To reproduce, try: ./perf_fuzzer -t OCIRMQWPFpAi -s 50000 -r 1399378358
Pid=4598, sleeping 1s
==================================================
Fuzzing the following syscalls:
mmap perf_event_open close read write ioctl fork prctl poll
*NOT* Fuzzing the following syscalls:
Also attempting the following:
busy-instruction-loop accessing-perf-proc-and-sys-files trashing-the-mma
p-page
*NOT* attempting the following:
signal-handler-on-overflow
==================================================
[76576.580505] ------------[ cut here ]------------
[76576.585446] WARNING: CPU: 4 PID: 4598 at arch/x86/kernel/cpu/perf_event_intel.c:1373 intel_pmu_handle_irq+0x2a4/0x3c0()
[76576.597028] perfevents: irq loop stuck!
[76576.601156] Modules linked in: fuse x86_pkg_temp_thermal intel_powerclamp coretemp kvm snd_hda_codec_hdmi crct10dif_pclmul crc32_pclmul ghash_clmulni_intel snd_hda_codec_realtek snd_hda_codec_generic i915 aesni_intel snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_pcm snd_seq snd_timer snd_seq_device tpm_tis ppdev snd aes_x86_64 parport_pc tpm evdev mei_me drm_kms_helper iTCO_wdt drm soundcore lrw gf128mul glue_helper iTCO_vendor_support wmi ablk_helper i2c_algo_bit button battery processor mei psmouse parport pcspkr serio_raw cryptd i2c_i801 video i2c_core lpc_ich mfd_core sd_mod sr_mod crc_t10dif cdrom crct10dif_common ahci libahci ehci_pci e1000e libata xhci_hcd ehci_hcd ptp crc32c_intel usbcore scsi_mod pps_core usb_common fan thermal thermal_sys
[76576.675785] CPU: 4 PID: 4598 Comm: perf_fuzzer Not tainted 3.15.0-rc1+ #104
[76576.683257] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 01/26/2014
[76576.691229] 0000000000000009 ffff88011eb06cb0 ffffffff81649ca0 ffff88011eb06cf8
[76576.699279] ffff88011eb06ce8 ffffffff810646ad 0000000000000064 ffff88011eb0cbe0
[76576.707343] ffff8800c9c1d800 0000000000000040 ffff88011eb0cde0 ffff88011eb06d48
[76576.715389] Call Trace:
[76576.718009] <NMI> [<ffffffff81649ca0>] dump_stack+0x45/0x56
[76576.724230] [<ffffffff810646ad>] warn_slowpath_common+0x7d/0xa0
[76576.730682] [<ffffffff8106471c>] warn_slowpath_fmt+0x4c/0x50
[76576.736888] [<ffffffff8102ef94>] intel_pmu_handle_irq+0x2a4/0x3c0
[76576.743541] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[76576.750209] [<ffffffff8165378b>] perf_event_nmi_handler+0x2b/0x50
[76576.756867] [<ffffffff81652f58>] nmi_handle.isra.5+0xa8/0x150
[76576.763149] [<ffffffff81652eb5>] ? nmi_handle.isra.5+0x5/0x150
[76576.769543] [<ffffffff816530d8>] do_nmi+0xd8/0x340
[76576.774799] [<ffffffff81652581>] end_repeat_nmi+0x1e/0x2e
[76576.780706] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[76576.787384] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[76576.794028] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[76576.800659] <<EOE>> [<ffffffff8102eb7d>] intel_pmu_enable_event+0x21d/0x240
[76576.808304] [<ffffffff81027baa>] x86_pmu_start+0x7a/0x100
[76576.814200] [<ffffffff810283a5>] x86_pmu_enable+0x295/0x310
[76576.820254] [<ffffffff8113528f>] perf_pmu_enable+0x2f/0x40
[76576.826225] [<ffffffff8102644a>] x86_pmu_commit_txn+0x7a/0xa0
[76576.832496] [<ffffffff8108b98a>] ? __hrtimer_start_range_ns+0x19a/0x3a0
[76576.839738] [<ffffffff810b0cad>] ? __lock_acquire.isra.29+0x3bd/0xb90
[76576.846734] [<ffffffff8101a21e>] ? arch_install_hw_breakpoint+0xce/0x100
[76576.854001] [<ffffffff81135fe0>] ? event_sched_in.isra.76+0x150/0x1e0
[76576.861030] [<ffffffff81136230>] group_sched_in+0x1c0/0x1e0
[76576.867117] [<ffffffff81136725>] __perf_event_enable+0x255/0x260
[76576.873717] [<ffffffff811318f0>] remote_function+0x40/0x50
[76576.879698] [<ffffffff810dda26>] generic_exec_single+0x126/0x170
[76576.886210] [<ffffffff811318b0>] ? task_clock_event_add+0x40/0x40
[76576.892894] [<ffffffff810ddad7>] smp_call_function_single+0x67/0xa0
[76576.899684] [<ffffffff811307f9>] task_function_call+0x49/0x60
[76576.905957] [<ffffffff811364d0>] ? perf_event_sched_in+0x90/0x90
[76576.913747] [<ffffffff811308a0>] perf_event_enable+0x90/0xf0
[76576.921171] [<ffffffff81130810>] ? task_function_call+0x60/0x60
[76576.928855] [<ffffffff8113097f>] perf_event_for_each_child+0x3f/0xb0
[76576.937001] [<ffffffff811372af>] perf_event_task_enable+0x4f/0x80
[76576.944851] [<ffffffff8107be85>] SyS_prctl+0x255/0x4b0
[76576.951663] [<ffffffff813becc6>] ? lockdep_sys_exit_thunk+0x35/0x67
[76576.959707] [<ffffffff8165a96d>] system_call_fastpath+0x1a/0x1f
[76576.967357] ---[ end trace 2b5a3d32e8d767a6 ]---
[76576.973524]
[76576.976338] CPU#4: ctrl: 0000000000000000
[76576.982445] CPU#4: status: 0000000000000000
[76576.988522] CPU#4: overflow: 0000000000000000
[76576.994597] CPU#4: fixed: 00000000000000b9
[76577.000694] CPU#4: pebs: 0000000000000000
[76577.006774] CPU#4: active: 0000000300000007
[76577.012842] CPU#4: gen-PMC0 ctrl: 000000002450123c
[76577.019480] CPU#4: gen-PMC0 count: 0000000000000001
[76577.026151] CPU#4: gen-PMC0 left: 0000ffffffffffff
[76577.032825] CPU#4: gen-PMC1 ctrl: 0000000010c101c2
[76577.039477] CPU#4: gen-PMC1 count: 00000000039f37f8
[76577.046121] CPU#4: gen-PMC1 left: 0000fffffc618a8f
[76577.052722] CPU#4: gen-PMC2 ctrl: 0000000000540800
[76577.059354] CPU#4: gen-PMC2 count: 0000000000000001
[76577.065924] CPU#4: gen-PMC2 left: 0000ffffffffffff
[76577.072474] CPU#4: gen-PMC3 ctrl: 000000000010412e
[76577.079016] CPU#4: gen-PMC3 count: 0000000000000001
[76577.091968] CPU#4: fixed-PMC0 count: 0000fffffffffffe
[76577.098320] CPU#4: fixed-PMC1 count: 0000fffcb8c081d9
[76577.104602] CPU#4: fixed-PMC2 count: 000000000288ac63
[76577.110844] perf_event_intel: clearing PMU state on CPU#4
[76577.117485] INFO: NMI handler (perf_event_nmi_handler) took too long to run: 536.956 msecs
[76577.127177] perf interrupt took too long (4196671 > 38461), lowering kernel.perf_event_max_sample_rate to 3250
[76577.138804] perf_event_intel: clearing PMU state on CPU#4
[76577.145453] perf interrupt took too long (4215989 > 71428), lowering kernel.perf_event_max_sample_rate to 1750
[76577.619546] perf interrupt took too long (4117985 > 500000), lowering kernel.perf_event_max_sample_rate to 250
</pre>
<li>
<pre>
*** perf_fuzzer 0.28 *** by Vince Weaver
Linux version 3.15.0-rc1+ x86_64
Processor: Intel 6/60/3
Seeding random number generator with 1399077851
/proc/sys/kernel/perf_event_max_sample_rate currently: 12500/s
/proc/sys/kernel/perf_event_paranoid currently: 1
Logging perf_event_open() failures: no
Running fsync after every syscall: no
To reproduce, try: ./perf_fuzzer -t OCIRMQWPFpAi -s 50000 -r 1399077851
Pid=4743, sleeping 1s
==================================================
Fuzzing the following syscalls:
mmap perf_event_open close read write ioctl fork prctl poll
*NOT* Fuzzing the following syscalls:
Also attempting the following:
busy-instruction-loop accessing-perf-proc-and-sys-files trashing-the-mmap-page
*NOT* attempting the following:
signal-handler-on-overflow
==================================================
Iteration 10000
Open attempts: 353239 Successful: 915
EPERM : 17
ENOENT : 942
E2BIG : 41017
EBADF : 6289
EACCES : 272
EINVAL : 303113
ENOSPC : 19
EOPNOTSUPP : 655
Close attempts: 876 Successful: 876
Read attempts: 881 Successful: 763
Write attempts: 844 Successful: 0
Ioctl attempts: 854 Successful: 388
Mmap attempts: 915 Successful: 289
Prctl attempts: 884 Successful: 884
Fork attempts: 445 Successful: 445
Poll attempts: 900 Successful: 7
Access attempts: 929 Successful: 466
Trash mmap attempts: 843 Successful: 843
Overflows: 0
SIGIOs due to RT signal queue full: 0
Iteration 20000
Open attempts: 336925 Successful: 913
EPERM : 19
ENOENT : 923
E2BIG : 39023
EBADF : 5522
EACCES : 247
EINVAL : 289437
ENOSPC : 144
EOPNOTSUPP : 697
Close attempts: 901 Successful: 901
Read attempts: 952 Successful: 819
Write attempts: 929 Successful: 0
Ioctl attempts: 857 Successful: 379
Mmap attempts: 913 Successful: 262
Prctl attempts: 875 Successful: 875
Fork attempts: 460 Successful: 460
Poll attempts: 885 Successful: 8
Access attempts: 927 Successful: 482
Trash mmap attempts: 889 Successful: 889
Overflows: 0
SIGIOs due to RT signal queue full: 0
[17190.202941] ------------[ cut here ]------------
[17190.207906] WARNING: CPU: 2 PID: 4743 at arch/x86/kernel/cpu/perf_event_intel.c:1373 intel_pmu_handle_irq+0x2a4/0x3c0()
[17190.219460] perfevents: irq loop stuck!
[17190.223579] Modules linked in: fuse x86_pkg_temp_thermal intel_powerclamp coretemp kvm snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel snd_hda_controller crct10dif_pclmul snd_hda_codec crc32_pclmul snd_hwdep ghash_clmulni_intel snd_pcm aesni_intel aes_x86_64 lrw snd_seq snd_timer snd_seq_device gf128mul snd i915 glue_helper evdev soundcore drm_kms_helper mei_me iTCO_wdt iTCO_vendor_support lpc_ich battery drm ppdev psmouse serio_raw ablk_helper cryptd wmi parport_pc mei parport tpm_tis i2c_algo_bit button processor video tpm i2c_i801 i2c_core mfd_core pcspkr sd_mod sr_mod crc_t10dif cdrom crct10dif_common ehci_pci ahci xhci_hcd ehci_hcd libahci e1000e libata ptp crc32c_intel usbcore scsi_mod pps_core usb_common thermal fan thermal_sys
[17190.298419] CPU: 2 PID: 4743 Comm: perf_fuzzer Not tainted 3.15.0-rc1+ #102
[17190.305926] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 01/26/2014
[17190.313906] 0000000000000009 ffff88011ea86cb0 ffffffff81649c80 ffff88011ea86cf8
[17190.322034] ffff88011ea86ce8 ffffffff810646ad 0000000000000064 ffff88011ea8cbe0
[17190.330134] ffff8800cf7a7800 0000000000000040 ffff88011ea8cde0 ffff88011ea86d48
[17190.338122] Call Trace:
[17190.340775] <NMI> [<ffffffff81649c80>] dump_stack+0x45/0x56
[17190.347023] [<ffffffff810646ad>] warn_slowpath_common+0x7d/0xa0
[17190.353472] [<ffffffff8106471c>] warn_slowpath_fmt+0x4c/0x50
[17190.359677] [<ffffffff8102ef94>] intel_pmu_handle_irq+0x2a4/0x3c0
[17190.366315] [<ffffffff8105034d>] ? native_write_msr_safe+0xd/0x10
[17190.372954] [<ffffffff8165378b>] perf_event_nmi_handler+0x2b/0x50
[17190.379629] [<ffffffff81652f58>] nmi_handle.isra.5+0xa8/0x150
[17190.385879] [<ffffffff81652eb5>] ? nmi_handle.isra.5+0x5/0x150
[17190.392287] [<ffffffff816530d8>] do_nmi+0xd8/0x340
[17190.397572] [<ffffffff81652581>] end_repeat_nmi+0x1e/0x2e
[17190.403472] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[17190.410098] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[17190.416765] [<ffffffff8105034a>] ? native_write_msr_safe+0xa/0x10
[17190.423386] <<EOE>> [<ffffffff8102eb7d>] intel_pmu_enable_event+0x21d/0x240
[17190.431048] [<ffffffff81027baa>] x86_pmu_start+0x7a/0x100
[17190.436992] [<ffffffff810283a5>] x86_pmu_enable+0x295/0x310
[17190.443104] [<ffffffff8113528f>] perf_pmu_enable+0x2f/0x40
[17190.449087] [<ffffffff811369a8>] perf_event_context_sched_in+0x88/0xd0
[17190.456165] [<ffffffff8113713d>] __perf_event_task_sched_in+0x1dd/0x1f0
[17190.463412] [<ffffffff81090ca8>] finish_task_switch+0xd8/0x120
[17190.469750] [<ffffffff8164ca90>] __schedule+0x2c0/0x740
[17190.475443] [<ffffffff8164cf39>] schedule+0x29/0x70
[17190.480772] [<ffffffff8164c74c>] schedule_hrtimeout_range_clock+0x13c/0x180
[17190.488331] [<ffffffff8108b1c0>] ? hrtimer_get_res+0x50/0x50
[17190.494491] [<ffffffff8164c6c9>] ? schedule_hrtimeout_range_clock+0xb9/0x180
[17190.502135] [<ffffffff8164c7a3>] schedule_hrtimeout_range+0x13/0x20
[17190.508983] [<ffffffff811c94c9>] poll_schedule_timeout+0x49/0x70
[17190.515535] [<ffffffff811cab22>] do_sys_poll+0x422/0x540
[17190.521354] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.528737] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.536129] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.543552] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.550915] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.558290] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.565698] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.573075] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.580488] [<ffffffff811c9650>] ? poll_select_copy_remaining+0x130/0x130
[17190.589071] [<ffffffff811cad15>] SyS_poll+0x65/0x100
[17190.595690] [<ffffffff8165a96d>] system_call_fastpath+0x1a/0x1f
[17190.603315] ---[ end trace d44f7960e96a18da ]---
[17190.609412]
[17190.612182] CPU#2: ctrl: 0000000000000000
[17190.618136] CPU#2: status: 0000000000000000
[17190.624190] CPU#2: overflow: 0000000000000000
[17190.630144] CPU#2: fixed: 00000000000000ba
[17190.636123] CPU#2: pebs: 0000000000000000
[17190.642042] CPU#2: active: 0000000300000001
[17190.648000] CPU#2: gen-PMC0 ctrl: 00000000004000c4
[17190.654531] CPU#2: gen-PMC0 count: 0000000000000001
[17190.661059] CPU#2: gen-PMC0 left: 0000ffffffffffff
[17190.667576] CPU#2: gen-PMC1 ctrl: 0000000000120280
[17190.674101] CPU#2: gen-PMC1 count: 0000000000005439
[17190.680623] CPU#2: gen-PMC1 left: 0000ffffffffaf43
[17190.687127] CPU#2: gen-PMC2 ctrl: 0000000000114f2e
[17190.693589] CPU#2: gen-PMC2 count: 0000000000000001
[17190.700039] CPU#2: gen-PMC2 left: 0000ffffffffffff
[17190.706455] CPU#2: gen-PMC3 ctrl: 00000000001300c0
[17190.712846] CPU#2: gen-PMC3 count: 0000000000000001
[17190.719135] CPU#2: gen-PMC3 left: 0000ffffffffffff
[17190.725357] CPU#2: fixed-PMC0 count: 0000fffffffffffe
[17190.731529] CPU#2: fixed-PMC1 count: 0000ffff192febe2
[17190.737687] CPU#2: fixed-PMC2 count: 0000000000000001
[17190.743840] perf_event_intel: clearing PMU state on CPU#2
</pre>
<li>
<pre>
*** perf_fuzzer 0.28 *** by Vince Weaver
Linux version 3.15.0-rc1+ x86_64
Processor: Intel 6/60/3
Seeding random number generator with 1398101771
/proc/sys/kernel/perf_event_max_sample_rate currently: 50000/s
/proc/sys/kernel/perf_event_paranoid currently: 1
Logging perf_event_open() failures: no
Running fsync after every syscall: no
To reproduce, try: ./perf_fuzzer -t OCIRMQWPFpAi -s 50000 -r 1398101771
Pid=11876, sleeping 1s
==================================================
Fuzzing the following syscalls:
mmap perf_event_open close read write ioctl fork prctl poll
*NOT* Fuzzing the following syscalls:
Also attempting the following:
busy-instruction-loop accessing-perf-proc-and-sys-files trashing-the-mmap-page
*NOT* attempting the following:
signal-handler-on-overflow
==================================================
Iteration 10000
Open attempts: 337104 Successful: 905
EPERM : 14
ENOENT : 919
E2BIG : 39172
EBADF : 5587
EACCES : 249
EINVAL : 289434
ENOSPC : 179
EOPNOTSUPP : 645
Close attempts: 874 Successful: 874
Read attempts: 912 Successful: 781
Write attempts: 869 Successful: 0
Ioctl attempts: 875 Successful: 404
Mmap attempts: 905 Successful: 270
Prctl attempts: 889 Successful: 889
Fork attempts: 482 Successful: 482
Poll attempts: 945 Successful: 13
Access attempts: 857 Successful: 459
Trash mmap attempts: 885 Successful: 885
Overflows: 0
SIGIOs due to RT signal queue full: 0
Iteration 20000
Open attempts: 356748 Successful: 929
EPERM : 16
ENOENT : 966
E2BIG : 41129
EBADF : 5836
EACCES : 279
EINVAL : 306820
ENOSPC : 133
EOPNOTSUPP : 640
Close attempts: 913 Successful: 913
Read attempts: 925 Successful: 793
Write attempts: 859 Successful: 0
Ioctl attempts: 908 Successful: 400
Mmap attempts: 929 Successful: 283
Prctl attempts: 853 Successful: 853
Fork attempts: 483 Successful: 483
Poll attempts: 946 Successful: 19
Access attempts: 921 Successful: 441
Trash mmap attempts: 867 Successful: 867
Overflows: 0
SIGIOs due to RT signal queue full: 0
Iteration 30000
Open attempts: 356531 Successful: 924
EPERM : 14
ENOENT : 1027
E2BIG : 41510
EBADF : 5409
EACCES : 263
EINVAL : 306288
ENOSPC : 397
EOPNOTSUPP : 699
Close attempts: 871 Successful: 871
Read attempts: 886 Successful: 772
Write attempts: 905 Successful: 0
Ioctl attempts: 912 Successful: 402
Mmap attempts: 924 Successful: 231
Prctl attempts: 958 Successful: 958
Fork attempts: 449 Successful: 449
Poll attempts: 880 Successful: 42
Access attempts: 941 Successful: 478
Trash mmap attempts: 935 Successful: 935
Overflows: 0
SIGIOs due to RT signal queue full: 0
[233086.504483] perf interrupt took too long (5017 > 5000), lowering kernel.perf_event_max_sample_rate to 25000
Iteration 40000
Open attempts: 323102 Successful: 866
EPERM : 14
ENOENT : 883
E2BIG : 37600
EBADF : 5049
EACCES : 232
EINVAL : 277485
ENOSPC : 351
EOPNOTSUPP : 622
Close attempts: 928 Successful: 928
Read attempts: 881 Successful: 726
Write attempts: 891 Successful: 0
Ioctl attempts: 889 Successful: 404
Mmap attempts: 866 Successful: 232
Prctl attempts: 882 Successful: 882
Fork attempts: 463 Successful: 463
Poll attempts: 949 Successful: 34
Access attempts: 939 Successful: 472
Trash mmap attempts: 907 Successful: 907
Overflows: 0
SIGIOs due to RT signal queue full: 0
[233108.540578] ------------[ cut here ]------------
[233108.545658] WARNING: CPU: 3 PID: 11876 at arch/x86/kernel/cpu/perf_event_intel.c:1373 intel_pmu_handle_irq+0x2a4/0x3c0()
[233108.557265] perfevents: irq loop stuck!
[233108.561443] Modules linked in: fuse x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic kvm snd_hda_intel snd_hda_controller crct10dif_pclmul snd_hda_codec crc32_pclmul ghash_clmulni_intel aesni_intel aes_x86_64 mei_me snd_hwdep snd_pcm lrw gf128mul glue_helper snd_seq i915 mei ablk_helper iTCO_wdt snd_timer cryptd snd_seq_device parport_pc iTCO_vendor_support psmouse wmi i2c_i801 pcspkr snd parport serio_raw tpm_tis drm_kms_helper lpc_ich mfd_core drm evdev tpm i2c_algo_bit button processor video battery i2c_core soundcore sg sd_mod sr_mod crc_t10dif cdrom crct10dif_common hid_generic usbhid hid ahci libahci libata ehci_pci xhci_hcd ehci_hcd e1000e scsi_mod ptp crc32c_intel usbcore pps_core usb_common fan thermal thermal_sys
[233108.636437] CPU: 3 PID: 11876 Comm: perf_fuzzer Not tainted 3.15.0-rc1+ #66
[233108.643855] Hardware name: LENOVO 10AM000AUS/SHARKBAY, BIOS FBKT72AUS 01/26/2014
[233108.651806] 0000000000000009 ffff88011eac6cb0 ffffffff8164f86d ffff88011eac6cf8
[233108.659967] ffff88011eac6ce8 ffffffff810647cd 0000000000000064 ffff88011eaccbe0
[233108.668082] ffff880004cbc000 0000000000000040 ffff88011eaccde0 ffff88011eac6d48
[233108.676239] Call Trace:
[233108.678919] <NMI> [<ffffffff8164f86d>] dump_stack+0x45/0x56
[233108.685240] [<ffffffff810647cd>] warn_slowpath_common+0x7d/0xa0
[233108.691783] [<ffffffff8106483c>] warn_slowpath_fmt+0x4c/0x50
[233108.698068] [<ffffffff81026e76>] ? x86_pmu_stop+0x76/0xd0
[233108.704058] [<ffffffff8102ef94>] intel_pmu_handle_irq+0x2a4/0x3c0
[233108.710799] [<ffffffff81116b8d>] ? trace_buffer_unlock_commit+0x4d/0x60
[233108.718108] [<ffffffff8112436a>] ? ftrace_event_buffer_commit+0x8a/0xc0
[233108.725417] [<ffffffff8165940b>] perf_event_nmi_handler+0x2b/0x50
[233108.732169] [<ffffffff81658bd8>] nmi_handle.isra.5+0xa8/0x150
[233108.738480] [<ffffffff81658b35>] ? nmi_handle.isra.5+0x5/0x150
[233108.744912] [<ffffffff81658d58>] do_nmi+0xd8/0x340
[233108.750267] [<ffffffff81658201>] end_repeat_nmi+0x1e/0x2e
[233108.756248] [<ffffffff8105046a>] ? native_write_msr_safe+0xa/0x10
[233108.762977] [<ffffffff8105046a>] ? native_write_msr_safe+0xa/0x10
[233108.769700] [<ffffffff8105046a>] ? native_write_msr_safe+0xa/0x10
[233108.776456] <<EOE>> [<ffffffff8102eb7d>] intel_pmu_enable_event+0x21d/0x240
[233108.784264] [<ffffffff81027baa>] x86_pmu_start+0x7a/0x100
[233108.790258] [<ffffffff810283a5>] x86_pmu_enable+0x295/0x310
[233108.796411] [<ffffffff81135a67>] perf_pmu_enable+0x27/0x30
[233108.802457] [<ffffffff8102644a>] x86_pmu_commit_txn+0x7a/0xa0
[233108.808831] [<ffffffff81116b8d>] ? trace_buffer_unlock_commit+0x4d/0x60
[233108.816143] [<ffffffff8112436a>] ? ftrace_event_buffer_commit+0x8a/0xc0
[233108.823428] [<ffffffff810b13bd>] ? __lock_acquire.isra.29+0x3bd/0xb90
[233108.830509] [<ffffffff810af8ca>] ? ftrace_raw_event_lock_acquire+0xba/0x100
[233108.838183] [<ffffffff81136748>] ? event_sched_in.isra.76+0x148/0x1e0
[233108.845318] [<ffffffff811369a0>] group_sched_in+0x1c0/0x1e0
[233108.851515] [<ffffffff81136e95>] __perf_event_enable+0x255/0x260
[233108.858151] [<ffffffff81132390>] remote_function+0x40/0x50
[233108.864288] [<ffffffff810de136>] generic_exec_single+0x126/0x170
[233108.870954] [<ffffffff81132350>] ? task_clock_event_add+0x40/0x40
[233108.877665] [<ffffffff810de1e7>] smp_call_function_single+0x67/0xa0
[233108.884584] [<ffffffff811312f4>] task_function_call+0x44/0x50
[233108.890971] [<ffffffff81136c40>] ? perf_event_sched_in+0x90/0x90
[233108.897650] [<ffffffff81131390>] perf_event_enable+0x90/0xf0
[233108.903936] [<ffffffff81131300>] ? task_function_call+0x50/0x50
[233108.910465] [<ffffffff8113146a>] perf_event_for_each_child+0x3a/0xa0
[233108.917448] [<ffffffff811379ff>] perf_event_task_enable+0x4f/0x80
[233108.924198] [<ffffffff8107c015>] SyS_prctl+0x255/0x4b0
[233108.929938] [<ffffffff81660d44>] tracesys+0xe1/0xe6
[233108.935334] ---[ end trace 01c78b8dcb064f75 ]---
[233108.940414]
[233108.942136] CPU#3: ctrl: 0000000000000000
[233108.947065] CPU#3: status: 0000000000000000
[233108.953180] CPU#3: overflow: 0000000000000000
[233108.959254] CPU#3: fixed: 00000000000000b0
[233108.965309] CPU#3: pebs: 0000000000000000
[233108.971365] CPU#3: active: 000000020000000f
[233108.977354] CPU#3: gen-PMC0 ctrl: 0000000000500030
[233108.983917] CPU#3: gen-PMC0 count: 0000000000000001
[233108.990455] CPU#3: gen-PMC0 left: 0000ffffffffffff
[233108.996937] CPU#3: gen-PMC1 ctrl: 000000000052013c
[233109.003417] CPU#3: gen-PMC1 count: 0000000000001d2e
[233109.009888] CPU#3: gen-PMC1 left: 0000ffffffffffff
[233109.016324] CPU#3: gen-PMC2 ctrl: 0000000010c001c2
[233109.022720] CPU#3: gen-PMC2 count: 000000000f44a8c7
[233109.029064] CPU#3: gen-PMC2 left: 0000fffff0bf60c5
[233109.035351] CPU#3: gen-PMC3 ctrl: 0000000000534f2e
[233109.041600] CPU#3: gen-PMC3 count: 0000fffffffe4164
[233109.047798] CPU#3: gen-PMC3 left: 000000000001be9c
[233109.054009] CPU#3: fixed-PMC0 count: 0000fffffffffffe
[233109.060247] CPU#3: fixed-PMC1 count: 0000fff95bbfd25f
[233109.066456] CPU#3: fixed-PMC2 count: 0000000000000001
[233109.072660] perf_event_intel: clearing PMU state on CPU#3
</pre>
</ol>
<hr>
<a href="bugs_found.html">Back to perf_fuzzer bugs found</a>
</body>
</html>
| Java |
/*
Copyright (C) 2004 Michael Liebscher
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
* renderer.h: Interface to graphics API.
*
* Author: Michael Liebscher <wolf3d.redux@gmail.com>
* Date: 2004
*
* Acknowledgement:
* This code was derived from Quake II, and was originally
* written by Id Software, Inc.
*
*/
/*
Notes:
This module communicates with the graphics API. The API can be any graphics
API, e.g OpenGL, DirectX, SDL, GDI, etc; as long as the functions listed in
this header are implemented.
*/
#ifndef __RENDERER_H__
#define __RENDERER_H__
#include "filesystem.h"
#include "platform.h"
#include "texture_manager.h"
#include "font_manager.h"
#ifdef _WIN32
#define OPENGL_DLL_NAME "opengl32.dll"
#elif __unix__
#define OPENGL_DLL_NAME "libGL.so.1"
#else
#error "Define OPENGL_DLL_NAME"
#endif
typedef enum
{
rserr_ok,
rserr_invalid_fullscreen,
rserr_invalid_mode,
rserr_unknown
} rserr_t;
int registration_sequence;
int R_Init( void *hinstance, void *hWnd );
void R_Shutdown( void );
void R_BeginRegistration( const char *model );
void R_EndRegistration( void );
void R_BeginFrame( void );
void R_EndFrame( void );
void R_AppActivate( _boolean active );
void R_SwapBuffers( int );
void R_SetPalette( const unsigned char *palette);
void R_DeleteTexture( unsigned int texnum );
_boolean R_UploadTexture( texture_t *tex, PW8 data );
void R_SetGL2D( void );
void R_Draw_Pic( int x, int y, const char *name );
void R_Draw_StretchPic( int x, int y, int w, int h, const char *name );
void R_Draw_Character( int x, int y, int num, font_t *myfont );
void R_Draw_Tile( int x, int y, int w, int h, const char *name );
void R_Draw_Fill( int x, int y, int w, int h, colour3_t c );
void R_Draw_Line( int nXStart, int nYStart, int nXEnd, int nYEnd, int width, colour3_t c );
#endif /* __RENDERER_H__ */
| Java |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc.
* @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* Postgre Database Adapter Class
*
* Note: _DB is an extender class that the app controller
* creates dynamically based on whether the active record
* class is being used or not.
*
* @package CodeIgniter
* @subpackage Drivers
* @category Database
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/database/
*/
class CI_DB_postgre_driver extends CI_DB {
var $dbdriver = 'postgre';
var $_escape_char = '"';
// clause and character used for LIKE escape sequences
var $_like_escape_str = " ESCAPE '%s' ";
var $_like_escape_chr = '!';
/**
* The syntax to count rows is slightly different across different
* database engines, so this string appears in each driver and is
* used for the count_all() and count_all_results() functions.
*/
var $_count_string = "SELECT COUNT(*) AS ";
var $_random_keyword = ' RANDOM()'; // database specific random keyword
/**
* Connection String
*
* @access private
* @return string
*/
function _connect_string()
{
$components = array(
'hostname' => 'host',
'port' => 'port',
'database' => 'dbname',
'username' => 'user',
'password' => 'password'
);
$connect_string = "";
foreach ($components as $key => $val)
{
if (isset($this->$key) && $this->$key != '')
{
$connect_string .= " $val=".$this->$key;
}
}
return trim($connect_string);
}
// --------------------------------------------------------------------
/**
* Non-persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_connect()
{
return @pg_connect($this->_connect_string());
}
// --------------------------------------------------------------------
/**
* Persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_pconnect()
{
return @pg_pconnect($this->_connect_string());
}
// --------------------------------------------------------------------
/**
* Reconnect
*
* Keep / reestablish the db connection if no queries have been
* sent for a length of time exceeding the server's idle timeout
*
* @access public
* @return void
*/
function reconnect()
{
if (pg_ping($this->conn_id) === FALSE)
{
$this->conn_id = FALSE;
}
}
// --------------------------------------------------------------------
/**
* Select the database
*
* @access private called by the base class
* @return resource
*/
function db_select()
{
// Not needed for Postgre so we'll return TRUE
return TRUE;
}
// --------------------------------------------------------------------
/**
* Set client character set
*
* @access public
* @param string
* @param string
* @return resource
*/
function db_set_charset($charset, $collation)
{
// @todo - add support if needed
return TRUE;
}
// --------------------------------------------------------------------
/**
* Version number query string
*
* @access public
* @return string
*/
function _version()
{
return "SELECT version() AS ver";
}
// --------------------------------------------------------------------
/**
* Execute the query
*
* @access private called by the base class
* @param string an SQL query
* @return resource
*/
function _execute($sql)
{
$sql = $this->_prep_query($sql);
return @pg_query($this->conn_id, $sql);
}
// --------------------------------------------------------------------
/**
* Prep the query
*
* If needed, each database adapter can prep the query string
*
* @access private called by execute()
* @param string an SQL query
* @return string
*/
function _prep_query($sql)
{
return $sql;
}
// --------------------------------------------------------------------
/**
* Begin Transaction
*
* @access public
* @return bool
*/
function trans_begin($test_mode = FALSE)
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
return TRUE;
}
// Reset the transaction failure flag.
// If the $test_mode flag is set to TRUE transactions will be rolled back
// even if the queries produce a successful result.
$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;
return @pg_exec($this->conn_id, "begin");
}
// --------------------------------------------------------------------
/**
* Commit Transaction
*
* @access public
* @return bool
*/
function trans_commit()
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
return TRUE;
}
return @pg_exec($this->conn_id, "commit");
}
// --------------------------------------------------------------------
/**
* Rollback Transaction
*
* @access public
* @return bool
*/
function trans_rollback()
{
if ( ! $this->trans_enabled)
{
return TRUE;
}
// When transactions are nested we only begin/commit/rollback the outermost ones
if ($this->_trans_depth > 0)
{
return TRUE;
}
return @pg_exec($this->conn_id, "rollback");
}
// --------------------------------------------------------------------
/**
* Escape String
*
* @access public
* @param string
* @param bool whether or not the string will be used in a LIKE condition
* @return string
*/
function escape_str($str, $like = FALSE)
{
if (is_array($str))
{
foreach ($str as $key => $val)
{
$str[$key] = $this->escape_str($val, $like);
}
return $str;
}
$str = pg_escape_string($str);
// escape LIKE condition wildcards
if ($like === TRUE)
{
$str = str_replace( array('%', '_', $this->_like_escape_chr),
array($this->_like_escape_chr.'%', $this->_like_escape_chr.'_', $this->_like_escape_chr.$this->_like_escape_chr),
$str);
}
return $str;
}
// --------------------------------------------------------------------
/**
* Affected Rows
*
* @access public
* @return integer
*/
function affected_rows()
{
return @pg_affected_rows($this->result_id);
}
// --------------------------------------------------------------------
/**
* Insert ID
*
* @access public
* @return integer
*/
function insert_id()
{
$v = $this->_version();
$v = $v['server'];
$table = func_num_args() > 0 ? func_get_arg(0) : NULL;
$column = func_num_args() > 1 ? func_get_arg(1) : NULL;
if ($table == NULL && $v >= '8.1')
{
$sql='SELECT LASTVAL() as ins_id';
}
elseif ($table != NULL && $column != NULL && $v >= '8.0')
{
$sql = sprintf("SELECT pg_get_serial_sequence('%s','%s') as seq", $table, $column);
$query = $this->query($sql);
$row = $query->row();
$sql = sprintf("SELECT CURRVAL('%s') as ins_id", $row->seq);
}
elseif ($table != NULL)
{
// seq_name passed in table parameter
$sql = sprintf("SELECT CURRVAL('%s') as ins_id", $table);
}
else
{
return pg_last_oid($this->result_id);
}
$query = $this->query($sql);
$row = $query->row();
return $row->ins_id;
}
// --------------------------------------------------------------------
/**
* "Count All" query
*
* Generates a platform-specific query string that counts all records in
* the specified database
*
* @access public
* @param string
* @return string
*/
function count_all($table = '')
{
if ($table == '')
{
return 0;
}
$query = $this->query($this->_count_string . $this->_protect_identifiers('numrows') . " FROM " . $this->_protect_identifiers($table, TRUE, NULL, FALSE));
if ($query->num_rows() == 0)
{
return 0;
}
$row = $query->row();
$this->_reset_select();
return (int) $row->numrows;
}
// --------------------------------------------------------------------
/**
* Show table query
*
* Generates a platform-specific query string so that the table names can be fetched
*
* @access private
* @param boolean
* @return string
*/
function _list_tables($prefix_limit = FALSE)
{
$sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'";
if ($prefix_limit !== FALSE AND $this->dbprefix != '')
{
$sql .= " AND table_name LIKE '".$this->escape_like_str($this->dbprefix)."%' ".sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
return $sql;
}
// --------------------------------------------------------------------
/**
* Show column query
*
* Generates a platform-specific query string so that the column names can be fetched
*
* @access public
* @param string the table name
* @return string
*/
function _list_columns($table = '')
{
return "SELECT column_name FROM information_schema.columns WHERE table_name ='".$table."'";
}
// --------------------------------------------------------------------
/**
* Field data query
*
* Generates a platform-specific query so that the column data can be retrieved
*
* @access public
* @param string the table name
* @return object
*/
function _field_data($table)
{
return "SELECT * FROM ".$table." LIMIT 1";
}
// --------------------------------------------------------------------
/**
* The error message string
*
* @access private
* @return string
*/
function _error_message()
{
return pg_last_error($this->conn_id);
}
// --------------------------------------------------------------------
/**
* The error message number
*
* @access private
* @return integer
*/
function _error_number()
{
return '';
}
// --------------------------------------------------------------------
/**
* Escape the SQL Identifiers
*
* This function escapes column and table names
*
* @access private
* @param string
* @return string
*/
function _escape_identifiers($item)
{
if ($this->_escape_char == '')
{
return $item;
}
foreach ($this->_reserved_identifiers as $id)
{
if (strpos($item, '.'.$id) !== FALSE)
{
$str = $this->_escape_char. str_replace('.', $this->_escape_char.'.', $item);
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
}
if (strpos($item, '.') !== FALSE)
{
$str = $this->_escape_char.str_replace('.', $this->_escape_char.'.'.$this->_escape_char, $item).$this->_escape_char;
}
else
{
$str = $this->_escape_char.$item.$this->_escape_char;
}
// remove duplicates if the user already included the escape
return preg_replace('/['.$this->_escape_char.']+/', $this->_escape_char, $str);
}
// --------------------------------------------------------------------
/**
* From Tables
*
* This function implicitly groups FROM tables so there is no confusion
* about operator precedence in harmony with SQL standards
*
* @access public
* @param type
* @return type
*/
function _from_tables($tables)
{
if ( ! is_array($tables))
{
$tables = array($tables);
}
return implode(', ', $tables);
}
// --------------------------------------------------------------------
/**
* Insert statement
*
* Generates a platform-specific insert string from the supplied data
*
* @access public
* @param string the table name
* @param array the insert keys
* @param array the insert values
* @return string
*/
function _insert($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")";
}
// --------------------------------------------------------------------
/**
* Insert_batch statement
*
* Generates a platform-specific insert string from the supplied data
*
* @access public
* @param string the table name
* @param array the insert keys
* @param array the insert values
* @return string
*/
function _insert_batch($table, $keys, $values)
{
return "INSERT INTO ".$table." (".implode(', ', $keys).") VALUES ".implode(', ', $values);
}
// --------------------------------------------------------------------
/**
* Update statement
*
* Generates a platform-specific update string from the supplied data
*
* @access public
* @param string the table name
* @param array the update data
* @param array the where clause
* @param array the orderby clause
* @param array the limit clause
* @return string
*/
function _update($table, $values, $where, $orderby = array(), $limit = FALSE)
{
foreach ($values as $key => $val)
{
$valstr[] = $key." = ".$val;
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
$orderby = (count($orderby) >= 1)?' ORDER BY '.implode(", ", $orderby):'';
$sql = "UPDATE ".$table." SET ".implode(', ', $valstr);
$sql .= ($where != '' AND count($where) >=1) ? " WHERE ".implode(" ", $where) : '';
$sql .= $orderby.$limit;
return $sql;
}
// --------------------------------------------------------------------
/**
* Truncate statement
*
* Generates a platform-specific truncate string from the supplied data
* If the database does not support the truncate() command
* This function maps to "DELETE FROM table"
*
* @access public
* @param string the table name
* @return string
*/
function _truncate($table)
{
return "TRUNCATE ".$table;
}
// --------------------------------------------------------------------
/**
* Delete statement
*
* Generates a platform-specific delete string from the supplied data
*
* @access public
* @param string the table name
* @param array the where clause
* @param string the limit clause
* @return string
*/
function _delete($table, $where = array(), $like = array(), $limit = FALSE)
{
$conditions = '';
if (count($where) > 0 OR count($like) > 0)
{
$conditions = "\nWHERE ";
$conditions .= implode("\n", $this->ar_where);
if (count($where) > 0 && count($like) > 0)
{
$conditions .= " AND ";
}
$conditions .= implode("\n", $like);
}
$limit = ( ! $limit) ? '' : ' LIMIT '.$limit;
return "DELETE FROM ".$table.$conditions.$limit;
}
// --------------------------------------------------------------------
/**
* Limit string
*
* Generates a platform-specific LIMIT clause
*
* @access public
* @param string the sql query string
* @param integer the number of rows to limit the query to
* @param integer the offset value
* @return string
*/
function _limit($sql, $limit, $offset)
{
$sql .= "LIMIT ".$limit;
if ($offset > 0)
{
$sql .= " OFFSET ".$offset;
}
return $sql;
}
// --------------------------------------------------------------------
/**
* Close DB Connection
*
* @access public
* @param resource
* @return void
*/
function _close($conn_id)
{
@pg_close($conn_id);
}
}
/* End of file postgre_driver.php */
/* Location: ./system/database/drivers/postgre/postgre_driver.php */ | Java |
/*** ESSENTIAL STYLES ***/
.sf-menu, .sf-menu * {
margin: 0;
padding: 0;
list-style: none;
}
.sf-menu {
line-height: 1.0;
}
.sf-menu ul {
position: absolute;
top: -999em;
width: 10em; /* left offset of submenus need to match (see below) */
}
.sf-menu ul li {
width: 100%;
}
.sf-menu li:hover {
visibility: inherit; /* fixes IE7 'sticky bug' */
}
.sf-menu li {
float: left;
position: relative;
}
.sf-menu a {
display: block;
position: relative;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
left: 0;
top: 2.5em; /* match top ul list item height */
z-index: 9999;
}
ul.sf-menu li:hover li ul,
ul.sf-menu li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li:hover ul,
ul.sf-menu li li.sfHover ul {
left: 13.5em; /* match ul width */
top: 0;
}
ul.sf-menu li li:hover li ul,
ul.sf-menu li li.sfHover li ul {
top: -999em;
}
ul.sf-menu li li li:hover ul,
ul.sf-menu li li li.sfHover ul {
left: 10em; /* match ul width */
top: 0;
}
/*** DEMO SKIN ***/
.sf-menu {
float: left;
margin-bottom: 1px;
}
.sf-menu a {
padding: .75em 1em;
text-decoration:none;
}
.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
color: #bbbbbb;
/*font-weight: bold;*/
}
.sf-menu li {
}
.sf-menu li li {
background: url("img/sub-menu-center.png") repeat-y transparent;
float: left;
}
.sf-menu .sub-menu {
margin-top: -26px;
padding-top: 17px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
z-index: 99999;
}
.sf-menu .sub-menu li{}
.sf-menu .sub-menu li a{
color: #4e4d4c!important;
margin: 5px 15px 5px 16px;
padding-bottom: 10px;
border-bottom: 1px solid rgba(153, 153, 153, 0.28);
}
.sf-menu .sub-menu li:last-child a {border: none}
.sf-menu .sub-menu li:first-child a {margin-top: 10px}
.sf-menu .sub-menu li:last-child {
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
border-bottom: 1px solid rgba(0, 0, 0, 0.21);
}
.sf-menu .sub-menu-last ul li a{
border-bottom: 1px solid #e9e8e8!important;
padding: 0.7em 0;
width: 94%;
}
.sf-menu .sub-menu-last ul li a.sub-sub-menu-last{border-bottom:0px solid #fff!important;}
.sf-menu li li li {}
.sf-menu li:hover, .sf-menu li.sfHover,
.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
color: #fff;
outline: 0;
}
.sf-menu .sub-menu a:hover{
color:#ff6825!important;
outline: 0;
background: none!important;
}
.sf-menu .sub-menu li:hover{}
/*** arrows **/
.sf-menu a.sf-with-ul {
min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
}
.sf-sub-indicator {
position: absolute;
display: block;
right: .75em;
top: 1.05em; /* IE6 only */
width: 10px;
height: 10px;
text-indent: -999em;
overflow: hidden;
}
a > .sf-sub-indicator { /* give all except IE6 the correct values */
top: .8em;
background-position: 0 -100px; /* use translucent arrow for modern browsers*/
}
/* apply hovers to modern browsers */
a:focus > .sf-sub-indicator,
a:hover > .sf-sub-indicator,
a:active > .sf-sub-indicator,
li:hover > a > .sf-sub-indicator,
li.sfHover > a > .sf-sub-indicator {
background-position: -10px -100px; /* arrow hovers for modern browsers*/
}
/* point right for anchors in subs */
.sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
/* apply hovers to modern browsers */
.sf-menu ul a:focus > .sf-sub-indicator,
.sf-menu ul a:hover > .sf-sub-indicator,
.sf-menu ul a:active > .sf-sub-indicator,
.sf-menu ul li:hover > a > .sf-sub-indicator,
.sf-menu ul li.sfHover > a > .sf-sub-indicator {
background-position: -10px 0; /* arrow hovers for modern browsers*/
}
/*** shadows for all but IE6 ***/
.sf-shadow ul { margin: 5px 0 0 0; }
.sf-shadow ul.sf-shadow-off {
background: transparent;
}
/*--- TOP, BOTTOM SUB-MENU --*/
.sub-menu-top{
background: url("img/sub-menu-top.png") no-repeat transparent;
float: left;
height: 3px;
width: 191px;
}
.sub-menu-bottom{
background: url("img/sub-menu-bottom.png") no-repeat transparent;
float: left;
height: 8px;
width: 191px;
}
| Java |
#include <acpi/acpi.h>
#include "accommon.h"
#include "acnamesp.h"
#include "acresrc.h"
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME("rsutils")
u8 acpi_rs_decode_bitmask(u16 mask, u8 * list)
{
u8 i;
u8 bit_count;
ACPI_FUNCTION_ENTRY();
/* Decode the mask bits */
for (i = 0, bit_count = 0; mask; i++) {
if (mask & 0x0001) {
list[bit_count] = i;
bit_count++;
}
mask >>= 1;
}
return (bit_count);
}
u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
{
u32 i;
u16 mask;
ACPI_FUNCTION_ENTRY();
/* Encode the list into a single bitmask */
for (i = 0, mask = 0; i < count; i++) {
mask |= (0x1 << list[i]);
}
return mask;
}
void
acpi_rs_move_data(void *destination, void *source, u16 item_count, u8 move_type)
{
u32 i;
ACPI_FUNCTION_ENTRY();
/* One move per item */
for (i = 0; i < item_count; i++) {
switch (move_type) {
/*
* For the 8-bit case, we can perform the move all at once
* since there are no alignment or endian issues
*/
case ACPI_RSC_MOVE8:
ACPI_MEMCPY(destination, source, item_count);
return;
/*
* 16-, 32-, and 64-bit cases must use the move macros that perform
* endian conversion and/or accomodate hardware that cannot perform
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
ACPI_MOVE_16_TO_16(&ACPI_CAST_PTR(u16, destination)[i],
&ACPI_CAST_PTR(u16, source)[i]);
break;
case ACPI_RSC_MOVE32:
ACPI_MOVE_32_TO_32(&ACPI_CAST_PTR(u32, destination)[i],
&ACPI_CAST_PTR(u32, source)[i]);
break;
case ACPI_RSC_MOVE64:
ACPI_MOVE_64_TO_64(&ACPI_CAST_PTR(u64, destination)[i],
&ACPI_CAST_PTR(u64, source)[i]);
break;
default:
return;
}
}
}
void
acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
union aml_resource *aml)
{
acpi_rs_length resource_length;
ACPI_FUNCTION_ENTRY();
/* Length is the total descriptor length minus the header length */
resource_length = (acpi_rs_length)
(total_length - acpi_ut_get_resource_header_length(aml));
/* Length is stored differently for large and small descriptors */
if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) {
/* Large descriptor -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16(&aml->large_header.resource_length,
&resource_length);
} else {
/* Small descriptor -- bits 2:0 of byte 0 contain the length */
aml->small_header.descriptor_type = (u8)
/* Clear any existing length, preserving descriptor type bits */
((aml->small_header.
descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
| resource_length);
}
}
void
acpi_rs_set_resource_header(u8 descriptor_type,
acpi_rsdesc_size total_length,
union aml_resource *aml)
{
ACPI_FUNCTION_ENTRY();
/* Set the Resource Type */
aml->small_header.descriptor_type = descriptor_type;
/* Set the Resource Length */
acpi_rs_set_resource_length(total_length, aml);
}
static u16 acpi_rs_strcpy(char *destination, char *source)
{
u16 i;
ACPI_FUNCTION_ENTRY();
for (i = 0; source[i]; i++) {
destination[i] = source[i];
}
destination[i] = 0;
/* Return string length including the NULL terminator */
return ((u16) (i + 1));
}
acpi_rs_length
acpi_rs_get_resource_source(acpi_rs_length resource_length,
acpi_rs_length minimum_length,
struct acpi_resource_source * resource_source,
union aml_resource * aml, char *string_ptr)
{
acpi_rsdesc_size total_length;
u8 *aml_resource_source;
ACPI_FUNCTION_ENTRY();
total_length =
resource_length + sizeof(struct aml_resource_large_header);
aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
/*
* resource_source is present if the length of the descriptor is longer than
* the minimum length.
*
* Note: Some resource descriptors will have an additional null, so
* we add 1 to the minimum length.
*/
if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) {
/* Get the resource_source_index */
resource_source->index = aml_resource_source[0];
resource_source->string_ptr = string_ptr;
if (!string_ptr) {
/*
* String destination pointer is not specified; Set the String
* pointer to the end of the current resource_source structure.
*/
resource_source->string_ptr =
ACPI_ADD_PTR(char, resource_source,
sizeof(struct acpi_resource_source));
}
/*
* In order for the Resource length to be a multiple of the native
* word, calculate the length of the string (+1 for NULL terminator)
* and expand to the next word multiple.
*
* Zero the entire area of the buffer.
*/
total_length = (u32)
ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 1;
total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length);
ACPI_MEMSET(resource_source->string_ptr, 0, total_length);
/* Copy the resource_source string to the destination */
resource_source->string_length =
acpi_rs_strcpy(resource_source->string_ptr,
ACPI_CAST_PTR(char,
&aml_resource_source[1]));
return ((acpi_rs_length) total_length);
}
/* resource_source is not present */
resource_source->index = 0;
resource_source->string_length = 0;
resource_source->string_ptr = NULL;
return (0);
}
acpi_rsdesc_size
acpi_rs_set_resource_source(union aml_resource * aml,
acpi_rs_length minimum_length,
struct acpi_resource_source * resource_source)
{
u8 *aml_resource_source;
acpi_rsdesc_size descriptor_length;
ACPI_FUNCTION_ENTRY();
descriptor_length = minimum_length;
/* Non-zero string length indicates presence of a resource_source */
if (resource_source->string_length) {
/* Point to the end of the AML descriptor */
aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length);
/* Copy the resource_source_index */
aml_resource_source[0] = (u8) resource_source->index;
/* Copy the resource_source string */
ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]),
resource_source->string_ptr);
/*
* Add the length of the string (+ 1 for null terminator) to the
* final descriptor length
*/
descriptor_length +=
((acpi_rsdesc_size) resource_source->string_length + 1);
}
/* Return the new total length of the AML descriptor */
return (descriptor_length);
}
acpi_status
acpi_rs_get_prt_method_data(struct acpi_namespace_node * node,
struct acpi_buffer * ret_buffer)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE(rs_get_prt_method_data);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT,
ACPI_BTYPE_PACKAGE, &obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Create a resource linked list from the byte stream buffer that comes
* back from the _CRS method execution.
*/
status = acpi_rs_create_pci_routing_table(obj_desc, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
acpi_status
acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE(rs_get_crs_method_data);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS,
ACPI_BTYPE_BUFFER, &obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Make the call to create a resource linked list from the
* byte stream buffer that comes back from the _CRS method
* execution.
*/
status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE(rs_get_prs_method_data);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS,
ACPI_BTYPE_BUFFER, &obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Make the call to create a resource linked list from the
* byte stream buffer that comes back from the _CRS method
* execution.
*/
status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
#endif /* ACPI_FUTURE_USAGE */
acpi_status
acpi_rs_get_method_data(acpi_handle handle,
char *path, struct acpi_buffer *ret_buffer)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE(rs_get_method_data);
/* Parameters guaranteed valid by caller */
/* Execute the method, no parameters */
status =
acpi_ut_evaluate_object(handle, path, ACPI_BTYPE_BUFFER, &obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/*
* Make the call to create a resource linked list from the
* byte stream buffer that comes back from the method
* execution.
*/
status = acpi_rs_create_resource_list(obj_desc, ret_buffer);
/* On exit, we must delete the object returned by evaluate_object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}
acpi_status
acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *in_buffer)
{
struct acpi_evaluate_info *info;
union acpi_operand_object *args[2];
acpi_status status;
struct acpi_buffer buffer;
ACPI_FUNCTION_TRACE(rs_set_srs_method_data);
/* Allocate and initialize the evaluation information block */
info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info));
if (!info) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
info->prefix_node = node;
info->pathname = METHOD_NAME__SRS;
info->parameters = args;
info->flags = ACPI_IGNORE_RETURN_VALUE;
/*
* The in_buffer parameter will point to a linked list of
* resource parameters. It needs to be formatted into a
* byte stream to be sent in as an input parameter to _SRS
*
* Convert the linked list into a byte stream
*/
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
/* Create and initialize the method parameter object */
args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
if (!args[0]) {
/*
* Must free the buffer allocated above (otherwise it is freed
* later)
*/
ACPI_FREE(buffer.pointer);
status = AE_NO_MEMORY;
goto cleanup;
}
args[0]->buffer.length = (u32) buffer.length;
args[0]->buffer.pointer = buffer.pointer;
args[0]->common.flags = AOPOBJ_DATA_VALID;
args[1] = NULL;
/* Execute the method, no return value is expected */
status = acpi_ns_evaluate(info);
/* Clean up and return the status from acpi_ns_evaluate */
acpi_ut_remove_reference(args[0]);
cleanup:
ACPI_FREE(info);
return_ACPI_STATUS(status);
}
| Java |
/* drivers/i2c/chips/lis3dh.c - LIS3DH motion sensor driver
*
*
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/miscdevice.h>
#include <asm/uaccess.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/workqueue.h>
#include <linux/kobject.h>
#include <linux/earlysuspend.h>
#include <linux/platform_device.h>
#include <asm/atomic.h>
#include <cust_acc.h>
#include <linux/hwmsensor.h>
#include <linux/hwmsen_dev.h>
#include <linux/sensors_io.h>
#include "lis3dh.h"
#include <linux/hwmsen_helper.h>
#include <mach/mt_devs.h>
#include <mach/mt_typedefs.h>
#include <mach/mt_gpio.h>
#include <mach/mt_pm_ldo.h>
#define POWER_NONE_MACRO MT65XX_POWER_NONE
/*----------------------------------------------------------------------------*/
//#define I2C_DRIVERID_LIS3DH 345
/*----------------------------------------------------------------------------*/
#define DEBUG 1
/*----------------------------------------------------------------------------*/
#define CONFIG_LIS3DH_LOWPASS /*apply low pass filter on output*/
/*----------------------------------------------------------------------------*/
#define LIS3DH_AXIS_X 0
#define LIS3DH_AXIS_Y 1
#define LIS3DH_AXIS_Z 2
#define LIS3DH_AXES_NUM 3
#define LIS3DH_DATA_LEN 6
#define LIS3DH_DEV_NAME "LIS3DH"
/*----------------------------------------------------------------------------*/
static const struct i2c_device_id lis3dh_i2c_id[] = {{LIS3DH_DEV_NAME,0},{}};
/*the adapter id will be available in customization*/
static struct i2c_board_info __initdata i2c_LIS3DH={ I2C_BOARD_INFO("LIS3DH", (0x32>>1))};
//static unsigned short lis3dh_force[] = {0x00, LIS3DH_I2C_SLAVE_ADDR, I2C_CLIENT_END, I2C_CLIENT_END};
//static const unsigned short *const lis3dh_forces[] = { lis3dh_force, NULL };
//static struct i2c_client_address_data lis3dh_addr_data = { .forces = lis3dh_forces,};
/*----------------------------------------------------------------------------*/
static int lis3dh_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id);
static int lis3dh_i2c_remove(struct i2c_client *client);
//static int lis3dh_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info);
static int lis3dh_local_init(void);
static int lis3dh_remove(void);
static int lis3dh_init_flag =0; // 0<==>OK -1 <==> fail
/*----------------------------------------------------------------------------*/
typedef enum {
ADX_TRC_FILTER = 0x01,
ADX_TRC_RAWDATA = 0x02,
ADX_TRC_IOCTL = 0x04,
ADX_TRC_CALI = 0X08,
ADX_TRC_INFO = 0X10,
} ADX_TRC;
/*----------------------------------------------------------------------------*/
struct scale_factor{
u8 whole;
u8 fraction;
};
/*----------------------------------------------------------------------------*/
struct data_resolution {
struct scale_factor scalefactor;
int sensitivity;
};
/*----------------------------------------------------------------------------*/
#define C_MAX_FIR_LENGTH (32)
/*----------------------------------------------------------------------------*/
struct data_filter {
s16 raw[C_MAX_FIR_LENGTH][LIS3DH_AXES_NUM];
int sum[LIS3DH_AXES_NUM];
int num;
int idx;
};
/*----------------------------------------------------------------------------*/
static struct sensor_init_info lis3dh_init_info = {
.name = "lis3dh",
.init = lis3dh_local_init,
.uninit = lis3dh_remove,
};
/*----------------------------------------------------------------------------*/
struct lis3dh_i2c_data {
struct i2c_client *client;
struct acc_hw *hw;
struct hwmsen_convert cvt;
/*misc*/
struct data_resolution *reso;
atomic_t trace;
atomic_t suspend;
atomic_t selftest;
atomic_t filter;
s16 cali_sw[LIS3DH_AXES_NUM+1];
/*data*/
s8 offset[LIS3DH_AXES_NUM+1]; /*+1: for 4-byte alignment*/
s16 data[LIS3DH_AXES_NUM+1];
#if defined(CONFIG_LIS3DH_LOWPASS)
atomic_t firlen;
atomic_t fir_en;
struct data_filter fir;
#endif
/*early suspend*/
#if defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_drv;
#endif
};
/*----------------------------------------------------------------------------*/
static struct i2c_driver lis3dh_i2c_driver = {
.driver = {
// .owner = THIS_MODULE,
.name = LIS3DH_DEV_NAME,
},
.probe = lis3dh_i2c_probe,
.remove = lis3dh_i2c_remove,
// .detect = lis3dh_i2c_detect,
#if !defined(CONFIG_HAS_EARLYSUSPEND)
.suspend = lis3dh_suspend,
.resume = lis3dh_resume,
#endif
.id_table = lis3dh_i2c_id,
// .address_data = &lis3dh_addr_data,
};
/*----------------------------------------------------------------------------*/
static struct i2c_client *lis3dh_i2c_client = NULL;
//static struct platform_driver lis3dh_gsensor_driver;
static struct lis3dh_i2c_data *obj_i2c_data = NULL;
static bool sensor_power = false;
static GSENSOR_VECTOR3D gsensor_gain, gsensor_offset;
//static char selftestRes[10] = {0};
/*----------------------------------------------------------------------------*/
#define GSE_TAG "[Gsensor] "
#define GSE_FUN(f) printk(KERN_INFO GSE_TAG"%s\n", __FUNCTION__)
#define GSE_ERR(fmt, args...) printk(KERN_ERR GSE_TAG"%s %d : "fmt, __FUNCTION__, __LINE__, ##args)
#define GSE_LOG(fmt, args...) printk(KERN_INFO GSE_TAG fmt, ##args)
/*----------------------------------------------------------------------------*/
static struct data_resolution lis3dh_data_resolution[] = {
/* combination by {FULL_RES,RANGE}*/
{{ 1, 0}, 1024}, // dataformat +/-2g in 12-bit resolution; { 1, 0} = 1.0 = (2*2*1000)/(2^12); 1024 = (2^12)/(2*2)
{{ 1, 9}, 512}, // dataformat +/-4g in 12-bit resolution; { 1, 9} = 1.9 = (2*4*1000)/(2^12); 512 = (2^12)/(2*4)
{{ 3, 9}, 256}, // dataformat +/-8g in 12-bit resolution; { 1, 0} = 1.0 = (2*8*1000)/(2^12); 1024 = (2^12)/(2*8)
};
/*----------------------------------------------------------------------------*/
static struct data_resolution lis3dh_offset_resolution = {{15, 6}, 64};
/*
static int hwmsen_read_byte_sr(struct i2c_client *client, u8 addr, u8 *data)
{
u8 buf;
int ret = 0;
client->addr = client->addr& I2C_MASK_FLAG | I2C_WR_FLAG |I2C_RS_FLAG;
buf = addr;
ret = i2c_master_send(client, (const char*)&buf, 1<<8 | 1);
//ret = i2c_master_send(client, (const char*)&buf, 1);
if (ret < 0) {
GSE_ERR("send command error!!\n");
return -EFAULT;
}
*data = buf;
client->addr = client->addr& I2C_MASK_FLAG;
return 0;
}
*/
static void dumpReg(struct i2c_client *client)
{
int i=0;
u8 addr = 0x20;
u8 regdata=0;
for(i=0; i<3 ; i++)
{
//dump all
hwmsen_read_byte(client,addr,®data);
GSE_LOG("Reg addr=%x regdata=%x\n",addr,regdata);
addr++;
}
}
/*--------------------ADXL power control function----------------------------------*/
static void LIS3DH_power(struct acc_hw *hw, unsigned int on)
{
static unsigned int power_on = 0;
if(hw->power_id != POWER_NONE_MACRO) // have externel LDO
{
GSE_LOG("power %s\n", on ? "on" : "off");
if(power_on == on) // power status not change
{
GSE_LOG("ignore power control: %d\n", on);
}
else if(on) // power on
{
if(!hwPowerOn(hw->power_id, hw->power_vol, "LIS3DH"))
{
GSE_ERR("power on fails!!\n");
}
}
else // power off
{
if (!hwPowerDown(hw->power_id, "LIS3DH"))
{
GSE_ERR("power off fail!!\n");
}
}
}
power_on = on;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetDataResolution(struct lis3dh_i2c_data *obj)
{
int err = 0;
u8 dat, reso;
err = hwmsen_read_byte(obj->client, LIS3DH_REG_CTL_REG4, &dat);
if(err)
{
GSE_ERR("write data format fail!!\n");
return err;
}
/*the data_reso is combined by 3 bits: {FULL_RES, DATA_RANGE}*/
reso = (dat & 0x30)<<4;
if(reso >= 0x3)
reso = 0x2;
if(reso < sizeof(lis3dh_data_resolution)/sizeof(lis3dh_data_resolution[0]))
{
obj->reso = &lis3dh_data_resolution[reso];
return 0;
}
else
{
return -EINVAL;
}
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadData(struct i2c_client *client, s16 data[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *priv = i2c_get_clientdata(client);
// u8 addr = LIS3DH_REG_DATAX0;
u8 buf[LIS3DH_DATA_LEN] = {0};
int err = 0;
if(NULL == client)
{
err = -EINVAL;
}
else
{
if(hwmsen_read_block(client, LIS3DH_REG_OUT_X, buf, 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
if(hwmsen_read_block(client, LIS3DH_REG_OUT_X+1, &buf[1], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
data[LIS3DH_AXIS_X] = (s16)((buf[0]+(buf[1]<<8))>>4);
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Y, &buf[2], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Y+1, &buf[3], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
data[LIS3DH_AXIS_Y] = (s16)((s16)(buf[2] +( buf[3]<<8))>>4);
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Z, &buf[4], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
if(hwmsen_read_block(client, LIS3DH_REG_OUT_Z+1, &buf[5], 0x01))
{
GSE_ERR("read G sensor data register err!\n");
return -1;
}
data[LIS3DH_AXIS_Z] =(s16)((buf[4]+(buf[5]<<8))>>4);
//GSE_LOG("[%08X %08X %08X %08x %08x %08x]\n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
data[LIS3DH_AXIS_X] &= 0xfff;
data[LIS3DH_AXIS_Y] &= 0xfff;
data[LIS3DH_AXIS_Z] &= 0xfff;
if(atomic_read(&priv->trace) & ADX_TRC_RAWDATA)
{
GSE_LOG("[%08X %08X %08X] => [%5d %5d %5d]\n", data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z],
data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z]);
}
if(data[LIS3DH_AXIS_X]&0x800)
{
data[LIS3DH_AXIS_X] = ~data[LIS3DH_AXIS_X];
data[LIS3DH_AXIS_X] &= 0xfff;
data[LIS3DH_AXIS_X]+=1;
data[LIS3DH_AXIS_X] = -data[LIS3DH_AXIS_X];
}
if(data[LIS3DH_AXIS_Y]&0x800)
{
data[LIS3DH_AXIS_Y] = ~data[LIS3DH_AXIS_Y];
data[LIS3DH_AXIS_Y] &= 0xfff;
data[LIS3DH_AXIS_Y]+=1;
data[LIS3DH_AXIS_Y] = -data[LIS3DH_AXIS_Y];
}
if(data[LIS3DH_AXIS_Z]&0x800)
{
data[LIS3DH_AXIS_Z] = ~data[LIS3DH_AXIS_Z];
data[LIS3DH_AXIS_Z] &= 0xfff;
data[LIS3DH_AXIS_Z]+=1;
data[LIS3DH_AXIS_Z] = -data[LIS3DH_AXIS_Z];
}
if(atomic_read(&priv->trace) & ADX_TRC_RAWDATA)
{
GSE_LOG("[%08X %08X %08X] => [%5d %5d %5d] after\n", data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z],
data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z]);
}
#ifdef CONFIG_LIS3DH_LOWPASS
if(atomic_read(&priv->filter))
{
if(atomic_read(&priv->fir_en) && !atomic_read(&priv->suspend))
{
int idx, firlen = atomic_read(&priv->firlen);
if(priv->fir.num < firlen)
{
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_X] = data[LIS3DH_AXIS_X];
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Y] = data[LIS3DH_AXIS_Y];
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Z] = data[LIS3DH_AXIS_Z];
priv->fir.sum[LIS3DH_AXIS_X] += data[LIS3DH_AXIS_X];
priv->fir.sum[LIS3DH_AXIS_Y] += data[LIS3DH_AXIS_Y];
priv->fir.sum[LIS3DH_AXIS_Z] += data[LIS3DH_AXIS_Z];
if(atomic_read(&priv->trace) & ADX_TRC_FILTER)
{
GSE_LOG("add [%2d] [%5d %5d %5d] => [%5d %5d %5d]\n", priv->fir.num,
priv->fir.raw[priv->fir.num][LIS3DH_AXIS_X], priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Y], priv->fir.raw[priv->fir.num][LIS3DH_AXIS_Z],
priv->fir.sum[LIS3DH_AXIS_X], priv->fir.sum[LIS3DH_AXIS_Y], priv->fir.sum[LIS3DH_AXIS_Z]);
}
priv->fir.num++;
priv->fir.idx++;
}
else
{
idx = priv->fir.idx % firlen;
priv->fir.sum[LIS3DH_AXIS_X] -= priv->fir.raw[idx][LIS3DH_AXIS_X];
priv->fir.sum[LIS3DH_AXIS_Y] -= priv->fir.raw[idx][LIS3DH_AXIS_Y];
priv->fir.sum[LIS3DH_AXIS_Z] -= priv->fir.raw[idx][LIS3DH_AXIS_Z];
priv->fir.raw[idx][LIS3DH_AXIS_X] = data[LIS3DH_AXIS_X];
priv->fir.raw[idx][LIS3DH_AXIS_Y] = data[LIS3DH_AXIS_Y];
priv->fir.raw[idx][LIS3DH_AXIS_Z] = data[LIS3DH_AXIS_Z];
priv->fir.sum[LIS3DH_AXIS_X] += data[LIS3DH_AXIS_X];
priv->fir.sum[LIS3DH_AXIS_Y] += data[LIS3DH_AXIS_Y];
priv->fir.sum[LIS3DH_AXIS_Z] += data[LIS3DH_AXIS_Z];
priv->fir.idx++;
data[LIS3DH_AXIS_X] = priv->fir.sum[LIS3DH_AXIS_X]/firlen;
data[LIS3DH_AXIS_Y] = priv->fir.sum[LIS3DH_AXIS_Y]/firlen;
data[LIS3DH_AXIS_Z] = priv->fir.sum[LIS3DH_AXIS_Z]/firlen;
if(atomic_read(&priv->trace) & ADX_TRC_FILTER)
{
GSE_LOG("add [%2d] [%5d %5d %5d] => [%5d %5d %5d] : [%5d %5d %5d]\n", idx,
priv->fir.raw[idx][LIS3DH_AXIS_X], priv->fir.raw[idx][LIS3DH_AXIS_Y], priv->fir.raw[idx][LIS3DH_AXIS_Z],
priv->fir.sum[LIS3DH_AXIS_X], priv->fir.sum[LIS3DH_AXIS_Y], priv->fir.sum[LIS3DH_AXIS_Z],
data[LIS3DH_AXIS_X], data[LIS3DH_AXIS_Y], data[LIS3DH_AXIS_Z]);
}
}
}
}
#endif
}
return err;
}
/*----------------------------------------------------------------------------*/
/*
static int LIS3DH_ReadOffset(struct i2c_client *client, s8 ofs[LIS3DH_AXES_NUM])
{
int err;
return err;
}
*/
/*----------------------------------------------------------------------------*/
static int LIS3DH_ResetCalibration(struct i2c_client *client)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
memset(obj->cali_sw, 0x00, sizeof(obj->cali_sw));
return 0;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadCalibration(struct i2c_client *client, int dat[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
dat[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*obj->cali_sw[LIS3DH_AXIS_X];
dat[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*obj->cali_sw[LIS3DH_AXIS_Y];
dat[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*obj->cali_sw[LIS3DH_AXIS_Z];
return 0;
}
/*----------------------------------------------------------------------------*/
/*
static int LIS3DH_ReadCalibrationEx(struct i2c_client *client, int act[LIS3DH_AXES_NUM], int raw[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int err;
int mul;
if(err = LIS3DH_ReadOffset(client, obj->offset))
{
GSE_ERR("read offset fail, %d\n", err);
return err;
}
mul = obj->reso->sensitivity/lis3dh_offset_resolution.sensitivity;
raw[LIS3DH_AXIS_X] = obj->offset[LIS3DH_AXIS_X]*mul + obj->cali_sw[LIS3DH_AXIS_X];
raw[LIS3DH_AXIS_Y] = obj->offset[LIS3DH_AXIS_Y]*mul + obj->cali_sw[LIS3DH_AXIS_Y];
raw[LIS3DH_AXIS_Z] = obj->offset[LIS3DH_AXIS_Z]*mul + obj->cali_sw[LIS3DH_AXIS_Z];
act[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*raw[LIS3DH_AXIS_X];
act[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*raw[LIS3DH_AXIS_Y];
act[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*raw[LIS3DH_AXIS_Z];
return 0;
}
*/
/*----------------------------------------------------------------------------*/
static int LIS3DH_WriteCalibration(struct i2c_client *client, int dat[LIS3DH_AXES_NUM])
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int err = 0;
// int cali[LIS3DH_AXES_NUM];
GSE_FUN();
if(!obj || ! dat)
{
GSE_ERR("null ptr!!\n");
return -EINVAL;
}
else
{
s16 cali[LIS3DH_AXES_NUM];
cali[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*obj->cali_sw[LIS3DH_AXIS_X];
cali[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*obj->cali_sw[LIS3DH_AXIS_Y];
cali[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*obj->cali_sw[LIS3DH_AXIS_Z];
cali[LIS3DH_AXIS_X] += dat[LIS3DH_AXIS_X];
cali[LIS3DH_AXIS_Y] += dat[LIS3DH_AXIS_Y];
cali[LIS3DH_AXIS_Z] += dat[LIS3DH_AXIS_Z];
obj->cali_sw[LIS3DH_AXIS_X] += obj->cvt.sign[LIS3DH_AXIS_X]*dat[obj->cvt.map[LIS3DH_AXIS_X]];
obj->cali_sw[LIS3DH_AXIS_Y] += obj->cvt.sign[LIS3DH_AXIS_Y]*dat[obj->cvt.map[LIS3DH_AXIS_Y]];
obj->cali_sw[LIS3DH_AXIS_Z] += obj->cvt.sign[LIS3DH_AXIS_Z]*dat[obj->cvt.map[LIS3DH_AXIS_Z]];
}
return err;
}
/*----------------------------------------------------------------------------*/
#if 0
static int LIS3DH_CheckDeviceID(struct i2c_client *client)
{
u8 databuf[10];
int res = 0;
/*
memset(databuf, 0, sizeof(u8)*10);
databuf[0] = LIS3DH_REG_DEVID;
res = i2c_master_send(client, databuf, 0x1);
if(res <= 0)
{
goto exit_LIS3DH_CheckDeviceID;
}
udelay(500);
databuf[0] = 0x0;
res = i2c_master_recv(client, databuf, 0x01);
if(res <= 0)
{
goto exit_LIS3DH_CheckDeviceID;
}
if(databuf[0]!=LIS3DH_FIXED_DEVID)
{
return LIS3DH_ERR_IDENTIFICATION;
}
exit_LIS3DH_CheckDeviceID:
if (res <= 0)
{
return LIS3DH_ERR_I2C;
}
*/
return LIS3DH_SUCCESS;
}
#endif
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetPowerMode(struct i2c_client *client, bool enable)
{
u8 databuf[2];
int res = 0;
u8 addr = LIS3DH_REG_CTL_REG1;
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
if(enable == sensor_power)
{
GSE_LOG("Sensor power status is newest!\n");
return LIS3DH_SUCCESS;
}
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read power ctl register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] &= ~LIS3DH_MEASURE_MODE;
if(enable == TRUE)
{
databuf[0] &= ~LIS3DH_MEASURE_MODE;
}
else
{
databuf[0] |= LIS3DH_MEASURE_MODE;
}
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG1;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
GSE_LOG("set power mode failed!\n");
return LIS3DH_ERR_I2C;
}
else if(atomic_read(&obj->trace) & ADX_TRC_INFO)
{
GSE_LOG("set power mode ok %d!\n", databuf[1]);
}
sensor_power = enable;
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetDataFormat(struct i2c_client *client, u8 dataformat)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
u8 databuf[10];
u8 addr = LIS3DH_REG_CTL_REG4;
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read reg_ctl_reg1 register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] &= ~0x30;
databuf[0] |=dataformat;
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG4;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
return LIS3DH_ERR_I2C;
}
return LIS3DH_SetDataResolution(obj);
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_SetBWRate(struct i2c_client *client, u8 bwrate)
{
u8 databuf[10];
u8 addr = LIS3DH_REG_CTL_REG1;
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read reg_ctl_reg1 register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] &= ~0xF0;
databuf[0] |= bwrate;
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG1;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
return LIS3DH_ERR_I2C;
}
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
//enalbe data ready interrupt
static int LIS3DH_SetIntEnable(struct i2c_client *client, u8 intenable)
{
u8 databuf[10];
u8 addr = LIS3DH_REG_CTL_REG3;
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(hwmsen_read_byte(client, addr, &databuf[0]))
{
GSE_ERR("read reg_ctl_reg1 register err!\n");
return LIS3DH_ERR_I2C;
}
databuf[0] = 0x00;
databuf[1] = databuf[0];
databuf[0] = LIS3DH_REG_CTL_REG3;
res = i2c_master_send(client, databuf, 0x2);
if(res <= 0)
{
return LIS3DH_ERR_I2C;
}
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_Init(struct i2c_client *client, int reset_cali)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int res = 0;
/*
res = LIS3DH_CheckDeviceID(client);
if(res != LIS3DH_SUCCESS)
{
return res;
}
*/
// first clear reg1
res = hwmsen_write_byte(client,LIS3DH_REG_CTL_REG1,0x07);
if(res != LIS3DH_SUCCESS)
{
return res;
}
res = LIS3DH_SetPowerMode(client, false);
if(res != LIS3DH_SUCCESS)
{
return res;
}
res = LIS3DH_SetBWRate(client, LIS3DH_BW_100HZ);//400 or 100 no other choice
if(res != LIS3DH_SUCCESS )
{
return res;
}
res = LIS3DH_SetDataFormat(client, LIS3DH_RANGE_2G);//8g or 2G no oher choise
if(res != LIS3DH_SUCCESS)
{
return res;
}
gsensor_gain.x = gsensor_gain.y = gsensor_gain.z = obj->reso->sensitivity;
res = LIS3DH_SetIntEnable(client, false);
if(res != LIS3DH_SUCCESS)
{
return res;
}
if(0 != reset_cali)
{
//reset calibration only in power on
res = LIS3DH_ResetCalibration(client);
if(res != LIS3DH_SUCCESS)
{
return res;
}
}
#ifdef CONFIG_LIS3DH_LOWPASS
memset(&obj->fir, 0x00, sizeof(obj->fir));
#endif
return LIS3DH_SUCCESS;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadChipInfo(struct i2c_client *client, char *buf, int bufsize)
{
u8 databuf[10];
memset(databuf, 0, sizeof(u8)*10);
if((NULL == buf)||(bufsize<=30))
{
return -1;
}
if(NULL == client)
{
*buf = 0;
return -2;
}
sprintf(buf, "LIS3DH Chip");
return 0;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadSensorData(struct i2c_client *client, char *buf, int bufsize)
{
struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client);
u8 databuf[20];
int acc[LIS3DH_AXES_NUM];
int res = 0;
memset(databuf, 0, sizeof(u8)*10);
if(NULL == buf)
{
return -1;
}
if(NULL == client)
{
*buf = 0;
return -2;
}
if(sensor_power == FALSE)
{
res = LIS3DH_SetPowerMode(client, true);
if(res)
{
GSE_ERR("Power on lis3dh error %d!\n", res);
}
msleep(20);
}
if((res = LIS3DH_ReadData(client, obj->data)))
{
GSE_ERR("I2C error: ret value=%d", res);
return -3;
}
else
{
obj->data[LIS3DH_AXIS_X] += obj->cali_sw[LIS3DH_AXIS_X];
obj->data[LIS3DH_AXIS_Y] += obj->cali_sw[LIS3DH_AXIS_Y];
obj->data[LIS3DH_AXIS_Z] += obj->cali_sw[LIS3DH_AXIS_Z];
/*remap coordinate*/
acc[obj->cvt.map[LIS3DH_AXIS_X]] = obj->cvt.sign[LIS3DH_AXIS_X]*obj->data[LIS3DH_AXIS_X];
acc[obj->cvt.map[LIS3DH_AXIS_Y]] = obj->cvt.sign[LIS3DH_AXIS_Y]*obj->data[LIS3DH_AXIS_Y];
acc[obj->cvt.map[LIS3DH_AXIS_Z]] = obj->cvt.sign[LIS3DH_AXIS_Z]*obj->data[LIS3DH_AXIS_Z];
//GSE_LOG("Mapped gsensor data: %d, %d, %d!\n", acc[LIS3DH_AXIS_X], acc[LIS3DH_AXIS_Y], acc[LIS3DH_AXIS_Z]);
//Out put the mg
acc[LIS3DH_AXIS_X] = acc[LIS3DH_AXIS_X] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
acc[LIS3DH_AXIS_Y] = acc[LIS3DH_AXIS_Y] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
acc[LIS3DH_AXIS_Z] = acc[LIS3DH_AXIS_Z] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
sprintf(buf, "%04x %04x %04x", acc[LIS3DH_AXIS_X], acc[LIS3DH_AXIS_Y], acc[LIS3DH_AXIS_Z]);
if(atomic_read(&obj->trace) & ADX_TRC_IOCTL)//atomic_read(&obj->trace) & ADX_TRC_IOCTL
{
GSE_LOG("gsensor data: %s!\n", buf);
dumpReg(client);
}
}
return 0;
}
/*----------------------------------------------------------------------------*/
static int LIS3DH_ReadRawData(struct i2c_client *client, char *buf)
{
struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client);
int res = 0;
if (!buf || !client)
{
return EINVAL;
}
if((res = LIS3DH_ReadData(client, obj->data)))
{
GSE_ERR("I2C error: ret value=%d", res);
return EIO;
}
else
{
sprintf(buf, "%04x %04x %04x", obj->data[LIS3DH_AXIS_X],
obj->data[LIS3DH_AXIS_Y], obj->data[LIS3DH_AXIS_Z]);
}
return 0;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_chipinfo_value(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
char strbuf[LIS3DH_BUFSIZE];
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
LIS3DH_ReadChipInfo(client, strbuf, LIS3DH_BUFSIZE);
return snprintf(buf, PAGE_SIZE, "%s\n", strbuf);
}
/*----------------------------------------------------------------------------*/
static ssize_t show_sensordata_value(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
char strbuf[LIS3DH_BUFSIZE];
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
LIS3DH_ReadSensorData(client, strbuf, LIS3DH_BUFSIZE);
return snprintf(buf, PAGE_SIZE, "%s\n", strbuf);
}
/*----------------------------------------------------------------------------*/
static ssize_t show_cali_value(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj;
int err, len = 0, mul;
int tmp[LIS3DH_AXES_NUM];
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
obj = i2c_get_clientdata(client);
if((err = LIS3DH_ReadCalibration(client, tmp)))
{
return -EINVAL;
}
else
{
mul = obj->reso->sensitivity/lis3dh_offset_resolution.sensitivity;
len += snprintf(buf+len, PAGE_SIZE-len, "[HW ][%d] (%+3d, %+3d, %+3d) : (0x%02X, 0x%02X, 0x%02X)\n", mul,
obj->offset[LIS3DH_AXIS_X], obj->offset[LIS3DH_AXIS_Y], obj->offset[LIS3DH_AXIS_Z],
obj->offset[LIS3DH_AXIS_X], obj->offset[LIS3DH_AXIS_Y], obj->offset[LIS3DH_AXIS_Z]);
len += snprintf(buf+len, PAGE_SIZE-len, "[SW ][%d] (%+3d, %+3d, %+3d)\n", 1,
obj->cali_sw[LIS3DH_AXIS_X], obj->cali_sw[LIS3DH_AXIS_Y], obj->cali_sw[LIS3DH_AXIS_Z]);
len += snprintf(buf+len, PAGE_SIZE-len, "[ALL] (%+3d, %+3d, %+3d) : (%+3d, %+3d, %+3d)\n",
obj->offset[LIS3DH_AXIS_X]*mul + obj->cali_sw[LIS3DH_AXIS_X],
obj->offset[LIS3DH_AXIS_Y]*mul + obj->cali_sw[LIS3DH_AXIS_Y],
obj->offset[LIS3DH_AXIS_Z]*mul + obj->cali_sw[LIS3DH_AXIS_Z],
tmp[LIS3DH_AXIS_X], tmp[LIS3DH_AXIS_Y], tmp[LIS3DH_AXIS_Z]);
return len;
}
}
/*----------------------------------------------------------------------------*/
static ssize_t store_cali_value(struct device_driver *ddri, const char *buf, size_t count)
{
struct i2c_client *client = lis3dh_i2c_client;
int err, x, y, z;
int dat[LIS3DH_AXES_NUM];
if(!strncmp(buf, "rst", 3))
{
if((err = LIS3DH_ResetCalibration(client)))
{
GSE_ERR("reset offset err = %d\n", err);
}
}
else if(3 == sscanf(buf, "0x%02X 0x%02X 0x%02X", &x, &y, &z))
{
dat[LIS3DH_AXIS_X] = x;
dat[LIS3DH_AXIS_Y] = y;
dat[LIS3DH_AXIS_Z] = z;
if((err = LIS3DH_WriteCalibration(client, dat)))
{
GSE_ERR("write calibration err = %d\n", err);
}
}
else
{
GSE_ERR("invalid format\n");
}
return count;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_power_status(struct device_driver *ddri, char *buf)
{
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj;
u8 data;
if(NULL == client)
{
GSE_ERR("i2c client is null!!\n");
return 0;
}
obj = i2c_get_clientdata(client);
hwmsen_read_byte(client,LIS3DH_REG_CTL_REG1,&data);
data &= 0x08;
data = data>>3;
return snprintf(buf, PAGE_SIZE, "%x\n", data);
}
/*----------------------------------------------------------------------------*/
static ssize_t show_firlen_value(struct device_driver *ddri, char *buf)
{
#ifdef CONFIG_LIS3DH_LOWPASS
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
if(atomic_read(&obj->firlen))
{
int idx, len = atomic_read(&obj->firlen);
GSE_LOG("len = %2d, idx = %2d\n", obj->fir.num, obj->fir.idx);
for(idx = 0; idx < len; idx++)
{
GSE_LOG("[%5d %5d %5d]\n", obj->fir.raw[idx][LIS3DH_AXIS_X], obj->fir.raw[idx][LIS3DH_AXIS_Y], obj->fir.raw[idx][LIS3DH_AXIS_Z]);
}
GSE_LOG("sum = [%5d %5d %5d]\n", obj->fir.sum[LIS3DH_AXIS_X], obj->fir.sum[LIS3DH_AXIS_Y], obj->fir.sum[LIS3DH_AXIS_Z]);
GSE_LOG("avg = [%5d %5d %5d]\n", obj->fir.sum[LIS3DH_AXIS_X]/len, obj->fir.sum[LIS3DH_AXIS_Y]/len, obj->fir.sum[LIS3DH_AXIS_Z]/len);
}
return snprintf(buf, PAGE_SIZE, "%d\n", atomic_read(&obj->firlen));
#else
return snprintf(buf, PAGE_SIZE, "not support\n");
#endif
}
/*----------------------------------------------------------------------------*/
static ssize_t store_firlen_value(struct device_driver *ddri, const char *buf, size_t count)
{
#ifdef CONFIG_LIS3DH_LOWPASS
struct i2c_client *client = lis3dh_i2c_client;
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int firlen;
if(1 != sscanf(buf, "%d", &firlen))
{
GSE_ERR("invallid format\n");
}
else if(firlen > C_MAX_FIR_LENGTH)
{
GSE_ERR("exceeds maximum filter length\n");
}
else
{
atomic_set(&obj->firlen, firlen);
if(0 == firlen)//yucong fix build warning
{
atomic_set(&obj->fir_en, 0);
}
else
{
memset(&obj->fir, 0x00, sizeof(obj->fir));
atomic_set(&obj->fir_en, 1);
}
}
#endif
return count;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_trace_value(struct device_driver *ddri, char *buf)
{
ssize_t res;
struct lis3dh_i2c_data *obj = obj_i2c_data;
if (obj == NULL)
{
GSE_ERR("i2c_data obj is null!!\n");
return 0;
}
res = snprintf(buf, PAGE_SIZE, "0x%04X\n", atomic_read(&obj->trace));
return res;
}
/*----------------------------------------------------------------------------*/
static ssize_t store_trace_value(struct device_driver *ddri, const char *buf, size_t count)
{
struct lis3dh_i2c_data *obj = obj_i2c_data;
int trace;
if (obj == NULL)
{
GSE_ERR("i2c_data obj is null!!\n");
return 0;
}
if(1 == sscanf(buf, "0x%x", &trace))
{
atomic_set(&obj->trace, trace);
}
else
{
GSE_ERR("invalid content: '%s', length = %d\n", buf, count);
}
return count;
}
/*----------------------------------------------------------------------------*/
static ssize_t show_status_value(struct device_driver *ddri, char *buf)
{
ssize_t len = 0;
struct lis3dh_i2c_data *obj = obj_i2c_data;
if (obj == NULL)
{
GSE_ERR("i2c_data obj is null!!\n");
return 0;
}
if(obj->hw)
{
len += snprintf(buf+len, PAGE_SIZE-len, "CUST: %d %d (%d %d)\n",
obj->hw->i2c_num, obj->hw->direction, obj->hw->power_id, obj->hw->power_vol);
}
else
{
len += snprintf(buf+len, PAGE_SIZE-len, "CUST: NULL\n");
}
return len;
}
/*----------------------------------------------------------------------------*/
static DRIVER_ATTR(chipinfo, S_IRUGO, show_chipinfo_value, NULL);
static DRIVER_ATTR(sensordata, S_IRUGO, show_sensordata_value, NULL);
static DRIVER_ATTR(cali, S_IWUSR | S_IRUGO, show_cali_value, store_cali_value);
static DRIVER_ATTR(power, S_IRUGO, show_power_status, NULL);
static DRIVER_ATTR(firlen, S_IWUSR | S_IRUGO, show_firlen_value, store_firlen_value);
static DRIVER_ATTR(trace, S_IWUSR | S_IRUGO, show_trace_value, store_trace_value);
static DRIVER_ATTR(status, S_IRUGO, show_status_value, NULL);
/*----------------------------------------------------------------------------*/
static struct driver_attribute *lis3dh_attr_list[] = {
&driver_attr_chipinfo, /*chip information*/
&driver_attr_sensordata, /*dump sensor data*/
&driver_attr_cali, /*show calibration data*/
&driver_attr_power, /*show power reg*/
&driver_attr_firlen, /*filter length: 0: disable, others: enable*/
&driver_attr_trace, /*trace log*/
&driver_attr_status,
};
/*----------------------------------------------------------------------------*/
static int lis3dh_create_attr(struct device_driver *driver)
{
int idx, err = 0;
int num = (int)(sizeof(lis3dh_attr_list)/sizeof(lis3dh_attr_list[0]));
if (driver == NULL)
{
return -EINVAL;
}
for(idx = 0; idx < num; idx++)
{
if((err = driver_create_file(driver, lis3dh_attr_list[idx])))
{
GSE_ERR("driver_create_file (%s) = %d\n", lis3dh_attr_list[idx]->attr.name, err);
break;
}
}
return err;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_delete_attr(struct device_driver *driver)
{
int idx ,err = 0;
int num = (int)(sizeof(lis3dh_attr_list)/sizeof(lis3dh_attr_list[0]));
if(driver == NULL)
{
return -EINVAL;
}
for(idx = 0; idx < num; idx++)
{
driver_remove_file(driver, lis3dh_attr_list[idx]);
}
return err;
}
/*----------------------------------------------------------------------------*/
int lis3dh_operate(void* self, uint32_t command, void* buff_in, int size_in,
void* buff_out, int size_out, int* actualout)
{
int err = 0;
int value, sample_delay;
struct lis3dh_i2c_data *priv = (struct lis3dh_i2c_data*)self;
hwm_sensor_data* gsensor_data;
char buff[LIS3DH_BUFSIZE];
//GSE_FUN(f);
switch (command)
{
case SENSOR_DELAY:
if((buff_in == NULL) || (size_in < sizeof(int)))
{
GSE_ERR("Set delay parameter error!\n");
err = -EINVAL;
}
else
{
value = *(int *)buff_in;
if(value <= 5)
{
sample_delay = LIS3DH_BW_200HZ;
}
else if(value <= 10)
{
sample_delay = ~LIS3DH_BW_100HZ;
}
else
{
sample_delay = ~LIS3DH_BW_50HZ;
}
err = LIS3DH_SetBWRate(priv->client, sample_delay);
if(err != LIS3DH_SUCCESS ) //0x2C->BW=100Hz
{
GSE_ERR("Set delay parameter error!\n");
}
if(value >= 50)
{
atomic_set(&priv->filter, 0);
}
else
{
priv->fir.num = 0;
priv->fir.idx = 0;
priv->fir.sum[LIS3DH_AXIS_X] = 0;
priv->fir.sum[LIS3DH_AXIS_Y] = 0;
priv->fir.sum[LIS3DH_AXIS_Z] = 0;
atomic_set(&priv->filter, 1);
}
}
break;
case SENSOR_ENABLE:
if((buff_in == NULL) || (size_in < sizeof(int)))
{
GSE_ERR("Enable sensor parameter error!\n");
err = -EINVAL;
}
else
{
value = *(int *)buff_in;
GSE_LOG("enable value=%d, sensor_power =%d\n",value,sensor_power);
if(((value == 0) && (sensor_power == false)) ||((value == 1) && (sensor_power == true)))
{
GSE_LOG("Gsensor device have updated!\n");
}
else
{
err = LIS3DH_SetPowerMode( priv->client, !sensor_power);
}
}
break;
case SENSOR_GET_DATA:
if((buff_out == NULL) || (size_out< sizeof(hwm_sensor_data)))
{
GSE_ERR("get sensor data parameter error!\n");
err = -EINVAL;
}
else
{
gsensor_data = (hwm_sensor_data *)buff_out;
LIS3DH_ReadSensorData(priv->client, buff, LIS3DH_BUFSIZE);
sscanf(buff, "%x %x %x", &gsensor_data->values[0],
&gsensor_data->values[1], &gsensor_data->values[2]);
gsensor_data->status = SENSOR_STATUS_ACCURACY_MEDIUM;
gsensor_data->value_divide = 1000;
}
break;
default:
GSE_ERR("gsensor operate function no this parameter %d!\n", command);
err = -1;
break;
}
return err;
}
/******************************************************************************
* Function Configuration
******************************************************************************/
static int lis3dh_open(struct inode *inode, struct file *file)
{
file->private_data = lis3dh_i2c_client;
if(file->private_data == NULL)
{
GSE_ERR("null pointer!!\n");
return -EINVAL;
}
return nonseekable_open(inode, file);
}
/*----------------------------------------------------------------------------*/
static int lis3dh_release(struct inode *inode, struct file *file)
{
file->private_data = NULL;
return 0;
}
/*----------------------------------------------------------------------------*/
//static int lis3dh_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
// unsigned long arg)
static long lis3dh_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
struct i2c_client *client = (struct i2c_client*)file->private_data;
struct lis3dh_i2c_data *obj = (struct lis3dh_i2c_data*)i2c_get_clientdata(client);
char strbuf[LIS3DH_BUFSIZE];
void __user *data;
SENSOR_DATA sensor_data;
long err = 0;
int cali[3];
//GSE_FUN(f);
if(_IOC_DIR(cmd) & _IOC_READ)
{
err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd));
}
else if(_IOC_DIR(cmd) & _IOC_WRITE)
{
err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd));
}
if(err)
{
GSE_ERR("access error: %08X, (%2d, %2d)\n", cmd, _IOC_DIR(cmd), _IOC_SIZE(cmd));
return -EFAULT;
}
switch(cmd)
{
case GSENSOR_IOCTL_INIT:
LIS3DH_Init(client, 0);
break;
case GSENSOR_IOCTL_READ_CHIPINFO:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
LIS3DH_ReadChipInfo(client, strbuf, LIS3DH_BUFSIZE);
if(copy_to_user(data, strbuf, strlen(strbuf)+1))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_SENSORDATA:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
LIS3DH_ReadSensorData(client, strbuf, LIS3DH_BUFSIZE);
if(copy_to_user(data, strbuf, strlen(strbuf)+1))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_GAIN:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if(copy_to_user(data, &gsensor_gain, sizeof(GSENSOR_VECTOR3D)))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_OFFSET:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if(copy_to_user(data, &gsensor_offset, sizeof(GSENSOR_VECTOR3D)))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_READ_RAW_DATA:
data = (void __user *) arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
LIS3DH_ReadRawData(client, strbuf);
if(copy_to_user(data, &strbuf, strlen(strbuf)+1))
{
err = -EFAULT;
break;
}
break;
case GSENSOR_IOCTL_SET_CALI:
data = (void __user*)arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if(copy_from_user(&sensor_data, data, sizeof(sensor_data)))
{
err = -EFAULT;
break;
}
if(atomic_read(&obj->suspend))
{
GSE_ERR("Perform calibration in suspend state!!\n");
err = -EINVAL;
}
else
{
cali[LIS3DH_AXIS_X] = sensor_data.x * obj->reso->sensitivity / GRAVITY_EARTH_1000;
cali[LIS3DH_AXIS_Y] = sensor_data.y * obj->reso->sensitivity / GRAVITY_EARTH_1000;
cali[LIS3DH_AXIS_Z] = sensor_data.z * obj->reso->sensitivity / GRAVITY_EARTH_1000;
err = LIS3DH_WriteCalibration(client, cali);
}
break;
case GSENSOR_IOCTL_CLR_CALI:
err = LIS3DH_ResetCalibration(client);
break;
case GSENSOR_IOCTL_GET_CALI:
data = (void __user*)arg;
if(data == NULL)
{
err = -EINVAL;
break;
}
if((err = LIS3DH_ReadCalibration(client, cali)))
{
break;
}
sensor_data.x = cali[LIS3DH_AXIS_X] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
sensor_data.y = cali[LIS3DH_AXIS_Y] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
sensor_data.z = cali[LIS3DH_AXIS_Z] * GRAVITY_EARTH_1000 / obj->reso->sensitivity;
if(copy_to_user(data, &sensor_data, sizeof(sensor_data)))
{
err = -EFAULT;
break;
}
break;
default:
GSE_ERR("unknown IOCTL: 0x%08x\n", cmd);
err = -ENOIOCTLCMD;
break;
}
return err;
}
/*----------------------------------------------------------------------------*/
static struct file_operations lis3dh_fops = {
.owner = THIS_MODULE,
.open = lis3dh_open,
.release = lis3dh_release,
//.ioctl = lis3dh_ioctl,
.unlocked_ioctl = lis3dh_unlocked_ioctl,
};
/*----------------------------------------------------------------------------*/
static struct miscdevice lis3dh_device = {
.minor = MISC_DYNAMIC_MINOR,
.name = "gsensor",
.fops = &lis3dh_fops,
};
/*----------------------------------------------------------------------------*/
#ifndef CONFIG_HAS_EARLYSUSPEND
/*----------------------------------------------------------------------------*/
static int lis3dh_suspend(struct i2c_client *client, pm_message_t msg)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
int err = 0;
u8 dat;
GSE_FUN();
if(msg.event == PM_EVENT_SUSPEND)
{
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return -EINVAL;
}
//read old data
if ((err = hwmsen_read_byte(client, LIS3DH_REG_CTL_REG1, &dat)))
{
GSE_ERR("write data format fail!!\n");
return err;
}
dat = dat&0b10111111;
atomic_set(&obj->suspend, 1);
if(err = hwmsen_write_byte(client, LIS3DH_REG_CTL_REG1, dat))
{
GSE_ERR("write power control fail!!\n");
return err;
}
LIS3DH_power(obj->hw, 0);
}
return err;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_resume(struct i2c_client *client)
{
struct lis3dh_i2c_data *obj = i2c_get_clientdata(client);
//int err;
GSE_FUN();
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return -EINVAL;
}
LIS3DH_power(obj->hw, 1);
#if 0
mdelay(30);//yucong add for fix g sensor resume issue
if(err = LIS3DH_Init(client, 0))
{
GSE_ERR("initialize client fail!!\n");
return err;
}
#endif
atomic_set(&obj->suspend, 0);
return 0;
}
/*----------------------------------------------------------------------------*/
#else /*CONFIG_HAS_EARLY_SUSPEND is defined*/
/*----------------------------------------------------------------------------*/
static void lis3dh_early_suspend(struct early_suspend *h)
{
struct lis3dh_i2c_data *obj = container_of(h, struct lis3dh_i2c_data, early_drv);
int err;
GSE_FUN();
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return;
}
atomic_set(&obj->suspend, 1);
/*
if(err = hwmsen_write_byte(obj->client, LIS3DH_REG_POWER_CTL, 0x00))
{
GSE_ERR("write power control fail!!\n");
return;
}
*/
if((err = LIS3DH_SetPowerMode(obj->client, false)))
{
GSE_ERR("write power control fail!!\n");
return;
}
sensor_power = false;
LIS3DH_power(obj->hw, 0);
}
/*----------------------------------------------------------------------------*/
static void lis3dh_late_resume(struct early_suspend *h)
{
struct lis3dh_i2c_data *obj = container_of(h, struct lis3dh_i2c_data, early_drv);
//int err;
GSE_FUN();
if(obj == NULL)
{
GSE_ERR("null pointer!!\n");
return;
}
LIS3DH_power(obj->hw, 1);
#if 0
mdelay(30);//yucong add for fix g sensor resume issue
if((err = LIS3DH_Init(obj->client, 0)))
{
GSE_ERR("initialize client fail!!\n");
return;
}
#endif
atomic_set(&obj->suspend, 0);
}
/*----------------------------------------------------------------------------*/
#endif /*CONFIG_HAS_EARLYSUSPEND*/
/*----------------------------------------------------------------------------*/
/*
static int lis3dh_i2c_detect(struct i2c_client *client, int kind, struct i2c_board_info *info)
{
strcpy(info->type, LIS3DH_DEV_NAME);
return 0;
}
*/
/*----------------------------------------------------------------------------*/
static int lis3dh_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct i2c_client *new_client;
struct lis3dh_i2c_data *obj;
struct hwmsen_object sobj;
int err = 0;
GSE_FUN();
if(!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
{
err = -ENOMEM;
goto exit;
}
memset(obj, 0, sizeof(struct lis3dh_i2c_data));
obj->hw = lis3dh_get_cust_acc_hw();
if((err = hwmsen_get_convert(obj->hw->direction, &obj->cvt)))
{
GSE_ERR("invalid direction: %d\n", obj->hw->direction);
goto exit;
}
obj_i2c_data = obj;
obj->client = client;
new_client = obj->client;
i2c_set_clientdata(new_client,obj);
atomic_set(&obj->trace, 0);
atomic_set(&obj->suspend, 0);
#ifdef CONFIG_LIS3DH_LOWPASS
if(obj->hw->firlen > C_MAX_FIR_LENGTH)
{
atomic_set(&obj->firlen, C_MAX_FIR_LENGTH);
}
else
{
atomic_set(&obj->firlen, obj->hw->firlen);
}
if(atomic_read(&obj->firlen) > 0)
{
atomic_set(&obj->fir_en, 1);
}
#endif
lis3dh_i2c_client = new_client;
if((err = LIS3DH_Init(new_client, 1)))
{
goto exit_init_failed;
}
if((err = misc_register(&lis3dh_device)))
{
GSE_ERR("lis3dh_device register failed\n");
goto exit_misc_device_register_failed;
}
if((err = lis3dh_create_attr(&(lis3dh_init_info.platform_diver_addr->driver))))
{
GSE_ERR("create attribute err = %d\n", err);
goto exit_create_attr_failed;
}
sobj.self = obj;
sobj.polling = 1;
sobj.sensor_operate = lis3dh_operate;
if((err = hwmsen_attach(ID_ACCELEROMETER, &sobj)))
{
GSE_ERR("attach fail = %d\n", err);
goto exit_kfree;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
obj->early_drv.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 1,
obj->early_drv.suspend = lis3dh_early_suspend,
obj->early_drv.resume = lis3dh_late_resume,
register_early_suspend(&obj->early_drv);
#endif
GSE_LOG("%s: OK\n", __func__);
lis3dh_init_flag = 0;
return 0;
exit_create_attr_failed:
misc_deregister(&lis3dh_device);
exit_misc_device_register_failed:
exit_init_failed:
//i2c_detach_client(new_client);
exit_kfree:
kfree(obj);
exit:
GSE_ERR("%s: err = %d\n", __func__, err);
lis3dh_init_flag = -1;
return err;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_i2c_remove(struct i2c_client *client)
{
int err = 0;
if((err = lis3dh_delete_attr(&(lis3dh_init_info.platform_diver_addr->driver))))
{
GSE_ERR("lis3dh_delete_attr fail: %d\n", err);
}
if((err = misc_deregister(&lis3dh_device)))
{
GSE_ERR("misc_deregister fail: %d\n", err);
}
if((err = hwmsen_detach(ID_ACCELEROMETER)))
lis3dh_i2c_client = NULL;
i2c_unregister_device(client);
kfree(i2c_get_clientdata(client));
return 0;
}
/*----------------------------------------------------------------------------*/
#if 0
/*----------------------------------------------------------------------------*/
static int lis3dh_probe(struct platform_device *pdev)
{
struct acc_hw *hw = get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 1);
//lis3dh_force[0] = hw->i2c_num;
if(i2c_add_driver(&lis3dh_i2c_driver))
{
GSE_ERR("add driver error\n");
return -1;
}
return 0;
}
/*----------------------------------------------------------------------------*/
static int lis3dh_remove(struct platform_device *pdev)
{
struct acc_hw *hw = get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 0);
i2c_del_driver(&lis3dh_i2c_driver);
return 0;
}
/*----------------------------------------------------------------------------*/
static struct platform_driver lis3dh_gsensor_driver = {
.probe = lis3dh_probe,
.remove = lis3dh_remove,
.driver = {
.name = "gsensor",
.owner = THIS_MODULE,
}
};
/*----------------------------------------------------------------------------*/
#endif
/*----------------------------------------------------------------------------*/
static int lis3dh_remove(void)
{
struct acc_hw *hw = lis3dh_get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 0);
i2c_del_driver(&lis3dh_i2c_driver);
return 0;
}
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
static int lis3dh_local_init(void)
{
struct acc_hw *hw = lis3dh_get_cust_acc_hw();
GSE_FUN();
LIS3DH_power(hw, 1);
if(i2c_add_driver(&lis3dh_i2c_driver))
{
GSE_ERR("add driver error\n");
return -1;
}
if(-1 == lis3dh_init_flag)
{
return -1;
}
return 0;
}
/*----------------------------------------------------------------------------*/
static int __init lis3dh_init(void)
{
GSE_FUN();
i2c_register_board_info(0, &i2c_LIS3DH, 1);
hwmsen_gsensor_add(&lis3dh_init_info);
#if 0
if(platform_driver_register(&lis3dh_gsensor_driver))
{
GSE_ERR("failed to register driver");
return -ENODEV;
}
#endif
return 0;
}
/*----------------------------------------------------------------------------*/
static void __exit lis3dh_exit(void)
{
GSE_FUN();
//platform_driver_unregister(&lis3dh_gsensor_driver);
}
/*----------------------------------------------------------------------------*/
module_init(lis3dh_init);
module_exit(lis3dh_exit);
/*----------------------------------------------------------------------------*/
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LIS3DH I2C driver");
MODULE_AUTHOR("Chunlei.Wang@mediatek.com");
| Java |
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
/**
* Cairo implementation for Image_Transform package
*
* PHP versions 4 and 5
*
* @category Image
* @package Image_Transform
* @subpackage Image_Transform_Driver_Cairowrapper
* @author Christian Weiske <cweiske@php.net>
* @copyright 2008 The PHP Group
* @license https://www.gnu.org/copyleft/lesser.html LGPL
* @version CVS: $Id: Cairowrapper.php 288112 2009-09-06 21:02:37Z cweiske $
* @link http://pear.php.net/package/Image_Transform
*/
require_once __DIR__ . '/Image/Transform.php';
/**
* Cairo implementation for Image_Transform package using pecl's cairo_wrapper
* extension.
*
* Supports png files only.
*
* @category Image
* @package Image_Transform
* @subpackage Image_Transform_Driver_Cairowrapper
* @author Christian Weiske <cweiske@php.net>
* @copyright 2008 The PHP Group
* @license https://www.gnu.org/copyleft/lesser.html LGPL
* @version Release: @package_version@
* @link http://pear.php.net/package/Image_Transform
*/
class Image_Transform_Driver_Cairowrapper extends Image_Transform
{
public $surface = null;
/**
* Supported image types
*
* @var array
* @access protected
*/
public $_supported_image_types = [
'png' => 'rw',
];
/**
* Check settings
*/
public function Image_Transform_Driver_Cairowrapper()
{
$this->__construct();
}
/**
* Create object and check if cairo_wrapper is loaded
*/
public function __construct()
{
if (!PEAR::loadExtension('cairo_wrapper')) {
$this->isError(PEAR::raiseError('cairo_wrapper extension is not available.', IMAGE_TRANSFORM_ERROR_UNSUPPORTED));
}
}
/**
* Loads an image from file
*
* @param string $image filename
*
* @return bool|PEAR_Error TRUE or a PEAR_Error object on error
*
* @access public
*/
public function load($image)
{
$this->free();
$this->image = $image;
$result = $this->_get_image_details($image);
if (PEAR::isError($result)) {
return $result;
}
if (!$this->supportsType($this->type, 'r')) {
return PEAR::raiseError('Image type not supported for input', IMAGE_TRANSFORM_ERROR_UNSUPPORTED);
}
$this->surface = cairo_image_surface_create_from_png($this->image);
if (CAIRO_STATUS_SUCCESS != cairo_surface_status($this->surface)) {
$this->surface = null;
return PEAR::raiseError('Error while loading image file.', IMAGE_TRANSFORM_ERROR_IO);
}
return true;
}
//function load(..)
/**
* Resize the image
*
* @param int $new_x New width
* @param int $new_y New height
* @param array $options Optional parameters
*
* @return bool|PEAR_Error TRUE on success or PEAR_Error object on error
*
* @access protected
*/
public function _resize($new_x, $new_y, $options = null)
{
if (true === $this->resized) {
return PEAR::raiseError('You have already resized the image without saving it.' . ' Your previous resizing will be overwritten', null, PEAR_ERROR_TRIGGER, E_USER_NOTICE);
}
if ($this->new_x == $new_x && $this->new_y == $new_y) {
return true;
}
$xFactor = $new_x / $this->img_x;
$yFactor = $new_y / $this->img_y;
$outputSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, $new_x, $new_y);
$outputContext = cairo_create($outputSurface);
cairo_scale($outputContext, $xFactor, $yFactor);
cairo_set_source_surface($outputContext, $this->surface, 0, 0);
cairo_paint($outputContext);
cairo_destroy($outputContext);
cairo_surface_destroy($this->surface);
$this->surface = $outputSurface;
$this->new_x = $new_x;
$this->new_y = $new_y;
return true;
}
//function _resize(..)
/**
* Saves the scaled image into a file.
*
* @param string $filename The filename to save to
* @param mixed $type ignored
* @param mixed $quality ignored
*
* @return bool|PEAR_Error TRUE on success or PEAR_Error object on error
*
* @access public
*/
public function save($filename, $type = null, $quality = null)
{
cairo_surface_write_to_png($this->surface, $filename);
$this->free();
return true;
}
//function save(..)
/**
* Returns the surface of the image so it can be modified further
*
* @return resource
*
* @access public
*/
public function getHandle()
{
return $this->surface;
}
//function getHandle()
/**
* Frees cairo handles
*
*
* @access public
*/
public function free()
{
$this->resized = false;
if (is_resource($this->surface)) {
cairo_surface_destroy($this->surface);
}
$this->surface = null;
}
//function free()
/**
* Mirrors the image vertically
* Uses an affine transformation matrix to flip the image.
*/
public function flip()
{
$outputSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, $this->img_x, $this->img_y);
$outputContext = cairo_create($outputSurface);
// xx, yx, xy, yy, x0, y0
$matrix = cairo_matrix_create(1, 0, 0, -1, 0, $this->img_y);
cairo_set_matrix($outputContext, $matrix);
cairo_set_source_surface($outputContext, $this->surface, 0, 0);
cairo_paint($outputContext);
cairo_destroy($outputContext);
cairo_surface_destroy($this->surface);
$this->surface = $outputSurface;
}
//function flip()
/**
* Mirrors the image horizontally.
* Uses an affine transformation matrix to mirror the image.
*
* 123 -> 321
*/
public function mirror()
{
$outputSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, $this->img_x, $this->img_y);
$outputContext = cairo_create($outputSurface);
// xx, yx, xy, yy, x0, y0
$matrix = cairo_matrix_create(-1, 0, 0, 1, $this->img_x, 0);
cairo_set_matrix($outputContext, $matrix);
cairo_set_source_surface($outputContext, $this->surface, 0, 0);
cairo_paint($outputContext);
cairo_destroy($outputContext);
cairo_surface_destroy($this->surface);
$this->surface = $outputSurface;
}
//function mirror()
}//class Image_Transform_Driver_Cairowrapper extends Image_Transform
| Java |
/*--------------------------------------------------------------------------
*--------------------------------------------------------------------------
*
* Copyright (C) 2011 Gabriel Terejanu - terejanu@cec.sc.edu
*
* This is an application framework for solving the problem of
* predictive model selection of coupled models as presented in the
* following paper:
*
* Gabriel Terejanu, Todd Oliver, Chris Simmons (2011). Application of
* Predictive Model Selection to Coupled Models. In Proceedings of the World
* Congress on Engineering and Computer Science 2011 Vol II, WCECS 2011,
* pp. 927-932.
*
* The framework is built on top of statistical library QUESO
* (Quantification of Uncertainty for Estimation, Simulation and Optimization).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*--------------------------------------------------------------------------
*
* coupled_OLS_SED_funcs_test.C
*
*--------------------------------------------------------------------------
*-------------------------------------------------------------------------- */
#include <cmath>
#include <map>
#include <string>
#include <iostream>
#include "uqDefines.h"
#include "uqGslVector.h"
#include "uqVectorSpace.h"
#include "uqGslMatrix.h"
#include "testsCommon.h"
#include "oscillatorLinearSpring.h"
#include "forcingSimpleExponentialDecay.h"
#include "modelForcingSimpleExponentialDecay.h"
uqFullEnvironmentClass* env;
//********************************************************************
// Definitions
//********************************************************************
bool test_OLS_SED_func();
bool test_OLS_SED_int_exact();
bool test_OLS_SED_int_energy();
//********************************************************************
// main - OLS - SED tests
//********************************************************************
int main(int argc, char* argv[])
{
MPI_Init(&argc,&argv);
env = new uqFullEnvironmentClass(MPI_COMM_WORLD,argv[1],"",NULL);
// tests OLS_SED_func
TST_MACRO( test_OLS_SED_func(),
"oscillatorLinearSpring_func",
"with forcing" );
// tests OLS_SED_int_exact
TST_MACRO( test_OLS_SED_int_exact(),
"oscillatorLinearSpring_int",
"exact solution with forcing" );
// Finalize environment
delete env;
MPI_Finalize();
// no error has been found
return 0;
}
//********************************************************************
// tests OLS_SED_func
//********************************************************************
bool test_OLS_SED_func()
{
// scenario
double scn_time = 1.0;
// params oscillator
double param_c = 2.0;
double param_k10 = param_c;
// params forcing
double param_F0 = 2.0;
double param_tau = 1.0;
// map inputs params (oscillator)
std::map<std::string, double> map_act_params;
map_act_params[ __OLS_PARAM_C ] = param_c;
map_act_params[ __OLS_PARAM_K10 ] = param_k10;
// forcing
map_act_params[ __SED_PARAM_F0 ] = param_F0;
map_act_params[ __SED_PARAM_TAU ] = param_tau;
// set coupling
map_act_params[ __SED_NAME ] = 1.0;
// outputs
double ic_y[2] = {0.5, 1.5};
double computed_f[2] = {0.0, 0.0};
double exact_f[2] =
{ ic_y[1],
param_F0*exp(-scn_time/param_tau) - param_c/__OSCILLATOR_MASS*(ic_y[0]+ic_y[1]) };
// get values
oscillatorLinearSpring_func( scn_time,
ic_y,
computed_f,
(void*)&map_act_params );
// compare the exact value with the computed one
return ( ( std::fabs( exact_f[0] - computed_f[0] ) > DOUBLE_TOL ) ||
( std::fabs( exact_f[1] - computed_f[1] ) > DOUBLE_TOL ) );
}
//********************************************************************
// tests OLS_SED_int_exact
//********************************************************************
bool test_OLS_SED_int_exact()
{
// scenario
double scn_time = 1.0;
// params oscillator
double param_c = 0.1;
double param_k10 = 0.0; // to have a linear ODE in velocity
// params forcing
double param_F0 = 2.0;
double param_tau = 1.0;
// map inputs
std::map<std::string, double> map_scn;
map_scn[ __OLS_SCN_TIME ] = scn_time;
// map params oscillator
std::map<std::string, double> map_act_params;
map_act_params[ __OLS_PARAM_C ] = param_c;
map_act_params[ __OLS_PARAM_K10 ] = param_k10;
// forcing
map_act_params[ __SED_PARAM_F0 ] = param_F0;
map_act_params[ __SED_PARAM_TAU ] = param_tau;
// set coupling
map_act_params[ __SED_NAME ] = 1.0;
// outputs
double final_y0;
double final_y1;
double time_to_rest;
double max_displacement;
double max_velocity;
// get final velocity
oscillatorLinearSpring_int( final_y0, final_y1,
time_to_rest,
max_displacement,
max_velocity,
false,
map_scn,
map_act_params );
double my_const = __OSCILLATOR_IC_X2 +
param_tau * param_F0 / (__OSCILLATOR_MASS - param_tau * param_c );
double pre_exp = param_tau * param_F0 / ( param_tau * param_c - __OSCILLATOR_MASS );
double exact_y1 = exp( -param_c/__OSCILLATOR_MASS*scn_time ) *
( pre_exp *
exp( (param_tau*param_c-__OSCILLATOR_MASS)/(__OSCILLATOR_MASS*param_tau)*scn_time )
+ my_const );
// std::cout << "final_y1 = " << final_y1 << std::endl;
// std::cout << "exact_y1 = " << exact_y1 << std::endl;
// compare the exact value with the computed one
return ( std::fabs( exact_y1 - final_y1 ) > DOUBLE_TOL ) ;
}
| Java |
import sys
import time
import logging
from socketio import socketio_manage
from socketio.mixins import BroadcastMixin
from socketio.namespace import BaseNamespace
from DataAggregation.webdata_aggregator import getAvailableWorkshops
logger = logging.getLogger(__name__)
std_out_logger = logging.StreamHandler(sys.stdout)
logger.addHandler(std_out_logger)
def broadcast_msg(server, ns_name, event, *args):
pkt = dict(type="event",
name=event,
args=args,
endpoint=ns_name)
for sessid, socket in server.sockets.iteritems():
socket.send_packet(pkt)
def workshops_monitor(server):
sizes = []
workshops = getAvailableWorkshops()
for w in workshops:
tmp = [w.workshopName, w.q.qsize()]
sizes.append(tmp)
broadcast_msg(server, '', "sizes", tmp)
while True:
logger.info("Participants viewing frontend:" + str(len(server.sockets)))
workshops_available = []
curr_workshops = getAvailableWorkshops()
for w in curr_workshops:
workshops_available.append([w.workshopName, w.q.qsize()])
wq = filter(lambda x: x[0] == w.workshopName, sizes)[0]
if wq[1] != w.q.qsize():
wq[1] = w.q.qsize()
logging.info("client_updater: New update being pushed to clients: " + str(wq))
broadcast_msg(server, '', 'sizes', wq)
logger.info("Workshops available:" + str(workshops_available))
time.sleep(1)
class RequestHandlerApp(object):
def __call__(self, environ, start_response):
if environ['PATH_INFO'].startswith('/socket.io'):
socketio_manage(environ, {'': QueueStatusHandler})
class QueueStatusHandler(BaseNamespace, BroadcastMixin):
def on_connect(self):
sizes = []
workshops = getAvailableWorkshops()
for w in workshops:
tmp = [w.workshopName, w.q.qsize()]
sizes.append(tmp)
self.emit('sizes', tmp)
| Java |
/* Javadoc style sheet */
/*
Overall document style
*/
body {
background-color:#ffffff;
color:#353833;
font-family:Arial, Helvetica, sans-serif;
font-size:76%;
margin:0;
}
a:link, a:visited {
text-decoration:none;
color:#4c6b87;
}
a:hover, a:focus {
text-decoration:none;
color:#bb7a2a;
}
a:active {
text-decoration:none;
color:#4c6b87;
}
a[name] {
color:#353833;
}
a[name]:hover {
text-decoration:none;
color:#353833;
}
pre {
font-size:1.3em;
}
h1 {
font-size:1.8em;
}
h2 {
font-size:1.5em;
}
h3 {
font-size:1.4em;
}
h4 {
font-size:1.3em;
}
h5 {
font-size:1.2em;
}
h6 {
font-size:1.1em;
}
ul {
list-style-type:circle;
}
code, tt {
font-size:1.3em
}
dt code {
}
table tr td dt code {
font-size:1.2em;
vertical-align:top;
}
sup {
font-size:.6em;
}
/*
Document title and Copyright styles
*/
.clear {
clear:both;
height:0px;
overflow:hidden;
}
.aboutLanguage {
float:right;
padding:0px 21px;
font-size:.8em;
z-index:200;
margin-top:-7px;
}
.legalCopy {
margin-left:.5em;
}
.bar a, .bar a:link, .bar a:visited, .bar a:active {
color:#FFFFFF;
text-decoration:none;
}
.bar a:hover, .bar a:focus {
color:#bb7a2a;
}
.tab {
background-color:#0066FF;
background-image:url(resources/titlebar.gif);
background-position:left top;
background-repeat:no-repeat;
color:#ffffff;
padding:8px;
width:5em;
font-weight:bold;
}
/*
Navigation bar styles
*/
.bar {
background-image:url(resources/background.gif);
background-repeat:repeat-x;
color:#FFFFFF;
padding:.8em .5em .4em .8em;
height:auto;/*height:1.8em;*/
font-size:1em;
margin:0;
}
.topNav {
background-image:url(resources/background.gif);
background-repeat:repeat-x;
color:#FFFFFF;
float:left;
padding:0;
width:100%;
clear:right;
height:2.8em;
padding-top:10px;
overflow:hidden;
}
.bottomNav {
margin-top:10px;
background-image:url(resources/background.gif);
background-repeat:repeat-x;
color:#FFFFFF;
float:left;
padding:0;
width:100%;
clear:right;
height:2.8em;
padding-top:10px;
overflow:hidden;
}
.subNav {
background-color:#dee3e9;
border-bottom:1px solid #9eadc0;
float:left;
width:100%;
overflow:hidden;
}
.subNav div {
clear:left;
float:left;
padding:0 0 5px 6px;
}
ul.navList, ul.subNavList {
float:left;
margin:0 25px 0 0;
padding:0;
}
ul.navList li{
list-style:none;
float:left;
padding:3px 6px;
}
ul.subNavList li{
list-style:none;
float:left;
font-size:90%;
}
.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
color:#FFFFFF;
text-decoration:none;
}
.topNav a:hover, .bottomNav a:hover {
text-decoration:none;
color:#bb7a2a;
}
.navBarCell1Rev {
background-image:url(resources/tab.gif);
background-color:#a88834;
color:#FFFFFF;
margin: auto 5px;
border:1px solid #c9aa44;
}
/*
Page header and footer styles
*/
.header, .footer {
clear:both;
margin:0 20px;
padding:5px 0 0 0;
}
.indexHeader {
margin:10px;
position:relative;
}
.indexHeader h1 {
font-size:1.3em;
}
.title {
color:#2c4557;
margin:10px 0;
}
.subTitle {
margin:5px 0 0 0;
}
.header ul {
margin:0 0 25px 0;
padding:0;
}
.footer ul {
margin:20px 0 5px 0;
}
.header ul li, .footer ul li {
list-style:disc;
}
/*
Heading styles
*/
div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
background-color:#dee3e9;
border-top:1px solid #9eadc0;
border-bottom:1px solid #9eadc0;
margin:0 0 6px -8px;
padding:2px 5px;
}
ul.blockList ul.blockList ul.blockList li.blockList h3 {
background-color:#dee3e9;
border-top:1px solid #9eadc0;
border-bottom:1px solid #9eadc0;
margin:0 0 6px -8px;
padding:2px 5px;
}
ul.blockList ul.blockList li.blockList h3 {
padding:0;
margin:15px 0;
}
ul.blockList li.blockList h2 {
padding:0px 0 20px 0;
}
/*
Page layout container styles
*/
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
clear:both;
padding:10px 20px;
position:relative;
}
.indexContainer {
margin:10px;
position:relative;
font-size:1.0em;
}
.indexContainer h2 {
font-size:1.1em;
padding:0 0 3px 0;
}
.indexContainer ul {
margin:0;
padding:0;
}
.indexContainer ul li {
list-style:none;
}
.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
font-size:1.1em;
font-weight:bold;
margin:10px 0 0 0;
color:#4E4E4E;
}
.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
margin:10px 0 10px 20px;
}
.serializedFormContainer dl.nameValue dt {
margin-left:1px;
font-size:1.1em;
display:inline;
font-weight:bold;
}
.serializedFormContainer dl.nameValue dd {
margin:0 0 0 1px;
font-size:1.1em;
display:inline;
}
/*
List styles
*/
ul.horizontal li {
display:inline;
font-size:0.9em;
}
ul.inheritance {
margin:0;
padding:0;
}
ul.inheritance li {
display:inline;
list-style:none;
}
ul.inheritance li ul.inheritance {
margin-left:15px;
padding-left:15px;
padding-top:1px;
}
ul.blockList, ul.blockListLast {
margin:10px 0 10px 0;
padding:0;
}
ul.blockList li.blockList, ul.blockListLast li.blockList {
list-style:none;
margin-bottom:25px;
}
ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
padding:0px 20px 5px 10px;
border:1px solid #9eadc0;
background-color:#f9f9f9;
}
ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
padding:0 0 5px 8px;
background-color:#ffffff;
border:1px solid #9eadc0;
border-top:none;
}
ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
margin-left:0;
padding-left:0;
padding-bottom:15px;
border:none;
border-bottom:1px solid #9eadc0;
}
ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
list-style:none;
border-bottom:none;
padding-bottom:0;
}
table tr td dl, table tr td dl dt, table tr td dl dd {
margin-top:0;
margin-bottom:1px;
}
/*
Table styles
*/
.contentContainer table, .classUseContainer table, .constantValuesContainer table {
border-bottom:1px solid #9eadc0;
width:100%;
}
.contentContainer ul li table, .classUseContainer ul li table, .constantValuesContainer ul li table {
width:100%;
}
.contentContainer .description table, .contentContainer .details table {
border-bottom:none;
}
.contentContainer ul li table th.colOne, .contentContainer ul li table th.colFirst, .contentContainer ul li table th.colLast, .classUseContainer ul li table th, .constantValuesContainer ul li table th, .contentContainer ul li table td.colOne, .contentContainer ul li table td.colFirst, .contentContainer ul li table td.colLast, .classUseContainer ul li table td, .constantValuesContainer ul li table td{
vertical-align:top;
padding-right:20px;
}
.contentContainer ul li table th.colLast, .classUseContainer ul li table th.colLast,.constantValuesContainer ul li table th.colLast,
.contentContainer ul li table td.colLast, .classUseContainer ul li table td.colLast,.constantValuesContainer ul li table td.colLast,
.contentContainer ul li table th.colOne, .classUseContainer ul li table th.colOne,
.contentContainer ul li table td.colOne, .classUseContainer ul li table td.colOne {
padding-right:3px;
}
.overviewSummary caption, .packageSummary caption, .contentContainer ul.blockList li.blockList caption, .summary caption, .classUseContainer caption, .constantValuesContainer caption {
position:relative;
text-align:left;
background-repeat:no-repeat;
color:#FFFFFF;
font-weight:bold;
clear:none;
overflow:hidden;
padding:0px;
margin:0px;
}
caption a:link, caption a:hover, caption a:active, caption a:visited {
color:#FFFFFF;
}
.overviewSummary caption span, .packageSummary caption span, .contentContainer ul.blockList li.blockList caption span, .summary caption span, .classUseContainer caption span, .constantValuesContainer caption span {
white-space:nowrap;
padding-top:8px;
padding-left:8px;
display:block;
float:left;
background-image:url(resources/titlebar.gif);
height:18px;
}
.overviewSummary .tabEnd, .packageSummary .tabEnd, .contentContainer ul.blockList li.blockList .tabEnd, .summary .tabEnd, .classUseContainer .tabEnd, .constantValuesContainer .tabEnd {
width:10px;
background-image:url(resources/titlebar_end.gif);
background-repeat:no-repeat;
background-position:top right;
position:relative;
float:left;
}
ul.blockList ul.blockList li.blockList table {
margin:0 0 12px 0px;
width:100%;
}
.tableSubHeadingColor {
background-color: #EEEEFF;
}
.altColor {
background-color:#eeeeef;
}
.rowColor {
background-color:#ffffff;
}
.overviewSummary td, .packageSummary td, .contentContainer ul.blockList li.blockList td, .summary td, .classUseContainer td, .constantValuesContainer td {
text-align:left;
padding:3px 3px 3px 7px;
}
th.colFirst, th.colLast, th.colOne, .constantValuesContainer th {
background:#dee3e9;
border-top:1px solid #9eadc0;
border-bottom:1px solid #9eadc0;
text-align:left;
padding:3px 3px 3px 7px;
}
td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
font-weight:bold;
}
td.colFirst, th.colFirst {
border-left:1px solid #9eadc0;
white-space:nowrap;
}
td.colLast, th.colLast {
border-right:1px solid #9eadc0;
}
td.colOne, th.colOne {
border-right:1px solid #9eadc0;
border-left:1px solid #9eadc0;
}
table.overviewSummary {
padding:0px;
margin-left:0px;
}
table.overviewSummary td.colFirst, table.overviewSummary th.colFirst,
table.overviewSummary td.colOne, table.overviewSummary th.colOne {
width:25%;
vertical-align:middle;
}
table.packageSummary td.colFirst, table.overviewSummary th.colFirst {
width:25%;
vertical-align:middle;
}
/*
Content styles
*/
.description pre {
margin-top:0;
}
.deprecatedContent {
margin:0;
padding:10px 0;
}
.docSummary {
padding:0;
}
/*
Formatting effect styles
*/
.sourceLineNo {
color:green;
padding:0 30px 0 0;
}
h1.hidden {
visibility:hidden;
overflow:hidden;
font-size:.9em;
}
.block {
display:block;
margin:3px 0 0 0;
}
.strong {
font-weight:bold;
}
| Java |
<?php
/**
* @file
* Contains \Drupal\Core\Lock\LockBackendInterface.
*/
namespace Drupal\Core\Lock;
/**
* @defgroup lock Locking mechanisms
* @{
* Functions to coordinate long-running operations across requests.
*
* In most environments, multiple Drupal page requests (a.k.a. threads or
* processes) will execute in parallel. This leads to potential conflicts or
* race conditions when two requests execute the same code at the same time. A
* common example of this is a rebuild like menu_router_rebuild() where we
* invoke many hook implementations to get and process data from all active
* modules, and then delete the current data in the database to insert the new
* afterwards.
*
* This is a cooperative, advisory lock system. Any long-running operation
* that could potentially be attempted in parallel by multiple requests should
* try to acquire a lock before proceeding. By obtaining a lock, one request
* notifies any other requests that a specific operation is in progress which
* must not be executed in parallel.
*
* To use this API, pick a unique name for the lock. A sensible choice is the
* name of the function performing the operation. A very simple example use of
* this API:
* @code
* function mymodule_long_operation() {
* $lock = \Drupal::lock();
* if ($lock->acquire('mymodule_long_operation')) {
* // Do the long operation here.
* // ...
* $lock->release('mymodule_long_operation');
* }
* }
* @endcode
*
* If a function acquires a lock it should always release it when the operation
* is complete by calling $lock->release(), as in the example.
*
* A function that has acquired a lock may attempt to renew a lock (extend the
* duration of the lock) by calling $lock->acquire() again during the operation.
* Failure to renew a lock is indicative that another request has acquired the
* lock, and that the current operation may need to be aborted.
*
* If a function fails to acquire a lock it may either immediately return, or
* it may call $lock->wait() if the rest of the current page request requires
* that the operation in question be complete. After $lock->wait() returns, the
* function may again attempt to acquire the lock, or may simply allow the page
* request to proceed on the assumption that a parallel request completed the
* operation.
*
* $lock->acquire() and $lock->wait() will automatically break (delete) a lock
* whose duration has exceeded the timeout specified when it was acquired.
*
* @} End of "defgroup lock".
*/
/**
* Lock backend interface.
*
* @ingroup lock
*/
interface LockBackendInterface {
/**
* Acquires a lock.
*
* @param string $name
* Lock name. Limit of name's length is 255 characters.
* @param float $timeout = 30.0
* (optional) Lock lifetime in seconds.
*
* @return bool
*/
public function acquire($name, $timeout = 30.0);
/**
* Checks if a lock is available for acquiring.
*
* @param string $name
* Lock to acquire.
*
* @return bool
*/
public function lockMayBeAvailable($name);
/**
* Waits a short amount of time before a second lock acquire attempt.
*
* While this method is subject to have a generic implementation in abstract
* backend implementation, some backends may provide non blocking or less I/O
* intensive wait mechanism: this is why this method remains on the backend
* interface.
*
* @param string $name
* Lock name currently being locked.
* @param int $delay = 30
* Milliseconds to wait for.
*
* @return bool
* TRUE if the lock holds, FALSE if it may be available. You still need to
* acquire the lock manually and it may fail again.
*/
public function wait($name, $delay = 30);
/**
* Releases the given lock.
*
* @param string $name
*/
public function release($name);
/**
* Releases all locks for the given lock token identifier.
*
* @param string $lockId
* (optional) If none given, remove all locks from the current page.
* Defaults to NULL.
*/
public function releaseAll($lockId = NULL);
/**
* Gets the unique page token for locks.
*
* Locks will be wiped out at the end of each page request on a token basis.
*
* @return string
*/
public function getLockId();
}
| Java |
def freq_month(obj):
if obj is None or obj == []:
return
months = {1: 'jan',
2: 'feb',
3: 'mar',
4: 'apr',
5: 'may',
6: 'jun',
7: 'jul',
8: 'aug',
9: 'sep',
10: 'oct',
11: 'nov',
12: 'dec',
}
frequencies = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
# for i in range(0, len(obj)):
# frequencies[ obj[i] -1] += 1
for i in obj:
frequencies[ i-1 ] += 1
print "The following month(s) have a birthday celebration"
for i in range(0, len(frequencies)):
if frequencies[i] > 0:
print str(months[i+1]) + " has " + str(frequencies[i])
return frequencies
in_array = [3,6,2,7,7,7,]
print freq_month(in_array)
print freq_month([])
| Java |
# -*- coding: utf-8 -*-
#
# pynag - Python Nagios plug-in and configuration environment
# Copyright (C) 2010 Drew Stinnet
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
"""This module contains low-level Parsers for nagios configuration and status objects.
Hint: If you are looking to parse some nagios configuration data, you probably
want pynag.Model module instead.
The highlights of this module are:
class Config: For Parsing nagios local nagios configuration files
class Livestatus: To connect to MK-Livestatus
class StatusDat: To read info from status.dat (not used a lot, migrate to mk-livestatus)
class LogFiles: To read nagios log-files
class MultiSite: To talk with multiple Livestatus instances
"""
import os
import re
import time
import sys
import socket # for mk_livestatus
import stat
import pynag.Plugins
import pynag.Utils
import StringIO
import tarfile
_sentinel = object()
class Config(object):
""" Parse and write nagios config files """
# Regex for beginning of object definition
# We want everything that matches:
# define <object_type> {
__beginning_of_object = re.compile("^\s*define\s+(\w+)\s*\{?(.*)$")
def __init__(self, cfg_file=None, strict=False):
""" Constructor for :py:class:`pynag.Parsers.config` class
Args:
cfg_file (str): Full path to nagios.cfg. If None, try to
auto-discover location
strict (bool): if True, use stricter parsing which is more prone to
raising exceptions
"""
self.cfg_file = cfg_file # Main configuration file
self.strict = strict # Use strict parsing or not
# If nagios.cfg is not set, lets do some minor autodiscover.
if self.cfg_file is None:
self.cfg_file = self.guess_cfg_file()
self.data = {}
self.maincfg_values = []
self._is_dirty = False
self.reset() # Initilize misc member variables
def guess_nagios_directory(self):
""" Returns a path to the nagios configuration directory on your system
Use this function for determining the nagios config directory in your
code
Returns:
str. directory containing the nagios.cfg file
Raises:
:py:class:`pynag.Parsers.ConfigFileNotFound` if cannot guess config
file location.
"""
cfg_file = self.guess_cfg_file()
if not cfg_file:
raise ConfigFileNotFound("Could not find nagios.cfg")
return os.path.dirname(cfg_file)
def guess_nagios_binary(self):
""" Returns a path to any nagios binary found on your system
Use this function if you don't want specify path to the nagios binary
in your code and you are confident that it is located in a common
location
Checked locations are as follows:
* /usr/bin/nagios
* /usr/sbin/nagios
* /usr/local/nagios/bin/nagios
* /nagios/bin/nagios
* /usr/bin/icinga
* /usr/sbin/icinga
* /usr/bin/naemon
* /usr/sbin/naemon
* /usr/local/naemon/bin/naemon.cfg
* /usr/bin/shinken
* /usr/sbin/shinken
Returns:
str. Path to the nagios binary
None if could not find a binary in any of those locations
"""
possible_files = ('/usr/bin/nagios',
'/usr/sbin/nagios',
'/usr/local/nagios/bin/nagios',
'/nagios/bin/nagios',
'/usr/bin/icinga',
'/usr/sbin/icinga',
'/usr/bin/naemon',
'/usr/sbin/naemon',
'/usr/local/naemon/bin/naemon.cfg',
'/usr/bin/shinken',
'/usr/sbin/shinken')
possible_binaries = ('nagios', 'nagios3', 'naemon', 'icinga', 'shinken')
for i in possible_binaries:
command = ['which', i]
code, stdout, stderr = pynag.Utils.runCommand(command=command, shell=False)
if code == 0:
return stdout.splitlines()[0].strip()
return None
def guess_cfg_file(self):
""" Returns a path to any nagios.cfg found on your system
Use this function if you don't want specify path to nagios.cfg in your
code and you are confident that it is located in a common location
Checked locations are as follows:
* /etc/nagios/nagios.cfg
* /etc/nagios3/nagios.cfg
* /usr/local/nagios/etc/nagios.cfg
* /nagios/etc/nagios/nagios.cfg
* ./nagios.cfg
* ./nagios/nagios.cfg
* /etc/icinga/icinga.cfg
* /usr/local/icinga/etc/icinga.cfg
* ./icinga.cfg
* ./icinga/icinga.cfg
* /etc/naemon/naemon.cfg
* /usr/local/naemon/etc/naemon.cfg
* ./naemon.cfg
* ./naemon/naemon.cfg
* /etc/shinken/shinken.cfg
Returns:
str. Path to the nagios.cfg or equivalent file
None if couldn't find a file in any of these locations.
"""
possible_files = ('/etc/nagios/nagios.cfg',
'/etc/nagios3/nagios.cfg',
'/usr/local/nagios/etc/nagios.cfg',
'/nagios/etc/nagios/nagios.cfg',
'./nagios.cfg',
'./nagios/nagios.cfg',
'/etc/icinga/icinga.cfg',
'/usr/local/icinga/etc/icinga.cfg',
'./icinga.cfg',
'./icinga/icinga.cfg',
'/etc/naemon/naemon.cfg',
'/usr/local/naemon/etc/naemon.cfg',
'./naemon.cfg',
'./naemon/naemon.cfg',
'/etc/shinken/shinken.cfg',
)
for file_path in possible_files:
if self.isfile(file_path):
return file_path
return None
def reset(self):
""" Reinitializes the data of a parser instance to its default values.
"""
self.cfg_files = [] # List of other configuration files
self.data = {} # dict of every known object definition
self.errors = [] # List of ParserErrors
self.item_list = None
self.item_cache = None
self.maincfg_values = [] # The contents of main nagios.cfg
self._resource_values = [] # The contents of any resource_files
self.item_apply_cache = {} # This is performance tweak used by _apply_template
# This is a pure listof all the key/values in the config files. It
# shouldn't be useful until the items in it are parsed through with the proper
# 'use' relationships
self.pre_object_list = []
self.post_object_list = []
self.object_type_keys = {
'hostgroup': 'hostgroup_name',
'hostextinfo': 'host_name',
'host': 'host_name',
'service': 'name',
'servicegroup': 'servicegroup_name',
'contact': 'contact_name',
'contactgroup': 'contactgroup_name',
'timeperiod': 'timeperiod_name',
'command': 'command_name',
#'service':['host_name','description'],
}
def _has_template(self, target):
""" Determine if an item has a template associated with it
Args:
target (dict): Parsed item as parsed by :py:class:`pynag.Parsers.config`
"""
return 'use' in target
def _get_pid(self):
""" Checks the lock_file var in nagios.cfg and returns the pid from the file
If the pid file does not exist, returns None.
"""
try:
return self.open(self.get_cfg_value('lock_file'), "r").readline().strip()
except Exception:
return None
def _get_hostgroup(self, hostgroup_name):
""" Returns the hostgroup that matches the queried name.
Args:
hostgroup_name: Name of the hostgroup to be returned (string)
Returns:
Hostgroup item with hostgroup_name that matches the queried name.
"""
return self.data['all_hostgroup'].get(hostgroup_name, None)
def _get_key(self, object_type, user_key=None):
""" Return the correct 'key' for an item.
This is mainly a helper method for other methods in this class. It is
used to shorten code repetition.
Args:
object_type: Object type from which to obtain the 'key' (string)
user_key: User defined key. Default None. (string)
Returns:
Correct 'key' for the object type. (string)
"""
if not user_key and not object_type in self.object_type_keys:
raise ParserError("Unknown key for object type: %s\n" % object_type)
# Use a default key
if not user_key:
user_key = self.object_type_keys[object_type]
return user_key
def _get_item(self, item_name, item_type):
""" Return an item from a list
Creates a cache of items in self.pre_object_list and returns an element
from this cache. Looks for an item with corresponding name and type.
Args:
item_name: Name of the item to be returned (string)
item_type: Type of the item to be returned (string)
Returns:
Item with matching name and type from
:py:attr:`pynag.Parsers.config.item_cache`
"""
# create local cache for performance optimizations. TODO: Rewrite functions that call this function
if not self.item_list:
self.item_list = self.pre_object_list
self.item_cache = {}
for item in self.item_list:
if not "name" in item:
continue
name = item['name']
tmp_item_type = (item['meta']['object_type'])
if not tmp_item_type in self.item_cache:
self.item_cache[tmp_item_type] = {}
self.item_cache[tmp_item_type][name] = item
my_cache = self.item_cache.get(item_type, None)
if not my_cache:
return None
return my_cache.get(item_name, None)
def _apply_template(self, original_item):
""" Apply all attributes of item named parent_name to "original_item".
Applies all of the attributes of parents (from the 'use' field) to item.
Args:
original_item: Item 'use'-ing a parent item. The parent's attributes
will be concretely added to this item.
Returns:
original_item to which have been added all the attributes defined
in parent items.
"""
# TODO: There is space for more performance tweaks here
# If item does not inherit from anyone else, lets just return item as is.
if 'use' not in original_item:
return original_item
object_type = original_item['meta']['object_type']
raw_definition = original_item['meta']['raw_definition']
my_cache = self.item_apply_cache.get(object_type, {})
# Performance tweak, if item has been parsed. Lets not do it again
if raw_definition in my_cache:
return my_cache[raw_definition]
parent_names = original_item['use'].split(',')
parent_items = []
for parent_name in parent_names:
parent_item = self._get_item(parent_name, object_type)
if parent_item is None:
error_string = "Can not find any %s named %s\n" % (object_type, parent_name)
self.errors.append(ParserError(error_string, item=original_item))
continue
try:
# Parent item probably has use flags on its own. So lets apply to parent first
parent_item = self._apply_template(parent_item)
except RuntimeError:
t, e = sys.exc_info()[:2]
self.errors.append(ParserError("Error while parsing item: %s (it might have circular use=)" % str(e),
item=original_item))
parent_items.append(parent_item)
inherited_attributes = original_item['meta']['inherited_attributes']
template_fields = original_item['meta']['template_fields']
for parent_item in parent_items:
for k, v in parent_item.iteritems():
if k in ('use', 'register', 'meta', 'name'):
continue
if k not in inherited_attributes:
inherited_attributes[k] = v
if k not in original_item:
original_item[k] = v
template_fields.append(k)
if 'name' in original_item:
my_cache[raw_definition] = original_item
return original_item
def _get_items_in_file(self, filename):
""" Return all items in the given file
Iterates through all elements in self.data and gatehrs all the items
defined in the queried filename.
Args:
filename: file from which are defined the items that will be
returned.
Returns:
A list containing all the items in self.data that were defined in
filename
"""
return_list = []
for k in self.data.keys():
for item in self[k]:
if item['meta']['filename'] == filename:
return_list.append(item)
return return_list
def get_new_item(self, object_type, filename):
""" Returns an empty item with all necessary metadata
Creates a new item dict and fills it with usual metadata:
* object_type : object_type (arg)
* filename : filename (arg)
* template_fields = []
* needs_commit = None
* delete_me = None
* defined_attributes = {}
* inherited_attributes = {}
* raw_definition = "define %s {\\n\\n} % object_type"
Args:
object_type: type of the object to be created (string)
filename: Path to which the item will be saved (string)
Returns:
A new item with default metadata
"""
meta = {
'object_type': object_type,
'filename': filename,
'template_fields': [],
'needs_commit': None,
'delete_me': None,
'defined_attributes': {},
'inherited_attributes': {},
'raw_definition': "define %s {\n\n}" % object_type,
}
return {'meta': meta}
def _load_file(self, filename):
""" Parses filename with self.parse_filename and append results in self._pre_object_list
This function is mostly here for backwards compatibility
Args:
filename: the file to be parsed. This is supposed to a nagios object definition file
"""
for i in self.parse_file(filename):
self.pre_object_list.append(i)
def parse_file(self, filename):
""" Parses a nagios object configuration file and returns lists of dictionaries.
This is more or less a wrapper around :py:meth:`config.parse_string`,
so reading documentation there is useful.
Args:
filename: Path to the file to parse (string)
Returns:
A list containing elements parsed by :py:meth:`parse_string`
"""
try:
raw_string = self.open(filename, 'rb').read()
return self.parse_string(raw_string, filename=filename)
except IOError:
t, e = sys.exc_info()[:2]
parser_error = ParserError(e.strerror)
parser_error.filename = e.filename
self.errors.append(parser_error)
return []
def parse_string(self, string, filename='None'):
""" Parses a string, and returns all object definitions in that string
Args:
string: A string containing one or more object definitions
filename (optional): If filename is provided, it will be referenced
when raising exceptions
Examples:
>>> test_string = "define host {\\nhost_name examplehost\\n}\\n"
>>> test_string += "define service {\\nhost_name examplehost\\nservice_description example service\\n}\\n"
>>> c = config()
>>> result = c.parse_string(test_string)
>>> for i in result: print i.get('host_name'), i.get('service_description', None)
examplehost None
examplehost example service
Returns:
A list of dictionaries, that look like self.data
Raises:
:py:class:`ParserError`
"""
append = ""
current = None
in_definition = {}
tmp_buffer = []
result = []
for sequence_no, line in enumerate(string.splitlines(False)):
line_num = sequence_no + 1
# If previous line ended with backslash, treat this line as a
# continuation of previous line
if append:
line = append + line
append = None
# Cleanup and line skips
line = line.strip()
if line == "":
continue
if line[0] == "#" or line[0] == ';':
continue
# If this line ends with a backslash, continue directly to next line
if line.endswith('\\'):
append = line.strip('\\')
continue
if line.startswith('}'): # end of object definition
if not in_definition:
p = ParserError("Unexpected '}' found outside object definition in line %s" % line_num)
p.filename = filename
p.line_start = line_num
raise p
in_definition = None
current['meta']['line_end'] = line_num
# Looks to me like nagios ignores everything after the } so why shouldn't we ?
rest = line.split("}", 1)[1]
tmp_buffer.append(line)
try:
current['meta']['raw_definition'] = '\n'.join(tmp_buffer)
except Exception:
raise ParserError("Encountered Unexpected end of object definition in file '%s'." % filename)
result.append(current)
# Destroy the Nagios Object
current = None
continue
elif line.startswith('define'): # beginning of object definition
if in_definition:
msg = "Unexpected 'define' in {filename} on line {line_num}. was expecting '}}'."
msg = msg.format(**locals())
self.errors.append(ParserError(msg, item=current))
m = self.__beginning_of_object.search(line)
tmp_buffer = [line]
object_type = m.groups()[0]
if self.strict and object_type not in self.object_type_keys.keys():
raise ParserError(
"Don't know any object definition of type '%s'. it is not in a list of known object definitions." % object_type)
current = self.get_new_item(object_type, filename)
current['meta']['line_start'] = line_num
# Start off an object
in_definition = True
# Looks to me like nagios ignores everything after the {, so why shouldn't we ?
rest = m.groups()[1]
continue
else: # In the middle of an object definition
tmp_buffer.append(' ' + line)
# save whatever's left in the buffer for the next iteration
if not in_definition:
append = line
continue
# this is an attribute inside an object definition
if in_definition:
#(key, value) = line.split(None, 1)
tmp = line.split(None, 1)
if len(tmp) > 1:
(key, value) = tmp
else:
key = tmp[0]
value = ""
# Strip out in-line comments
if value.find(";") != -1:
value = value.split(";", 1)[0]
# Clean info
key = key.strip()
value = value.strip()
# Rename some old values that may be in the configuration
# This can probably be removed in the future to increase performance
if (current['meta']['object_type'] == 'service') and key == 'description':
key = 'service_description'
# Special hack for timeperiods as they are not consistent with other objects
# We will treat whole line as a key with an empty value
if (current['meta']['object_type'] == 'timeperiod') and key not in ('timeperiod_name', 'alias'):
key = line
value = ''
current[key] = value
current['meta']['defined_attributes'][key] = value
# Something is wrong in the config
else:
raise ParserError("Error: Unexpected token in file '%s'" % filename)
# Something is wrong in the config
if in_definition:
raise ParserError("Error: Unexpected EOF in file '%s'" % filename)
return result
def _locate_item(self, item):
""" This is a helper function for anyone who wishes to modify objects.
It takes "item", locates the file which is configured in, and locates
exactly the lines which contain that definition.
Returns: (tuple)
(everything_before, object_definition, everything_after, filename):
* everything_before (list of lines): Every line in filename before object was defined
* everything_after (list of lines): Every line in "filename" after object was defined
* object_definition (list of lines): Every line used to define our item in "filename"
* filename (string): file in which the object was written to
Raises:
:py:class:`ValueError` if object was not found in "filename"
"""
if "filename" in item['meta']:
filename = item['meta']['filename']
else:
raise ValueError("item does not have a filename")
# Look for our item, store it as my_item
for i in self.parse_file(filename):
if self.compareObjects(item, i):
my_item = i
break
else:
raise ValueError("We could not find object in %s\n%s" % (filename, item))
# Caller of this method expects to be returned
# several lists that describe the lines in our file.
# The splitting logic starts here.
my_file = self.open(filename)
all_lines = my_file.readlines()
my_file.close()
start = my_item['meta']['line_start'] - 1
end = my_item['meta']['line_end']
everything_before = all_lines[:start]
object_definition = all_lines[start:end]
everything_after = all_lines[end:]
# If there happen to be line continuations in the object we will edit
# We will remove them from object_definition
object_definition = self._clean_backslashes(object_definition)
return everything_before, object_definition, everything_after, filename
def _clean_backslashes(self, list_of_strings):
""" Returns list_of_strings with all all strings joined that ended with backslashes
Args:
list_of_strings: List of strings to join
Returns:
Another list of strings, which lines ending with \ joined together.
"""
tmp_buffer = ''
result = []
for i in list_of_strings:
if i.endswith('\\\n'):
tmp_buffer += i.strip('\\\n')
else:
result.append(tmp_buffer + i)
tmp_buffer = ''
return result
def _modify_object(self, item, field_name=None, new_value=None, new_field_name=None, new_item=None,
make_comments=False):
""" Locates "item" and changes the line which contains field_name.
Helper function for object_* functions. Locates "item" and changes the
line which contains field_name. If new_value and new_field_name are both
None, the attribute is removed.
Args:
item(dict): The item to be modified
field_name(str): The field_name to modify (if any)
new_field_name(str): If set, field_name will be renamed
new_value(str): If set the value of field_name will be changed
new_item(str): If set, whole object will be replaced with this
string
make_comments: If set, put pynag-branded comments where changes
have been made
Returns:
True on success
Raises:
:py:class:`ValueError` if object or field_name is not found
:py:class:`IOError` is save is unsuccessful.
"""
if item is None:
return
if field_name is None and new_item is None:
raise ValueError("either field_name or new_item must be set")
if '\n' in str(new_value):
raise ValueError("Invalid character \\n used as an attribute value.")
everything_before, object_definition, everything_after, filename = self._locate_item(item)
if new_item is not None:
# We have instruction on how to write new object, so we dont need to parse it
object_definition = [new_item]
else:
change = None
value = None
i = 0
for i in range(len(object_definition)):
tmp = object_definition[i].split(None, 1)
if len(tmp) == 0:
continue
# Hack for timeperiods, they dont work like other objects
elif item['meta']['object_type'] == 'timeperiod' and field_name not in ('alias', 'timeperiod_name'):
tmp = [object_definition[i]]
# we can't change timeperiod, so we fake a field rename
if new_value is not None:
new_field_name = new_value
new_value = None
value = ''
elif len(tmp) == 1:
value = ''
else:
value = tmp[1]
k = tmp[0].strip()
if k == field_name:
# Attribute was found, lets change this line
if new_field_name is None and new_value is None:
# We take it that we are supposed to remove this attribute
change = object_definition.pop(i)
break
elif new_field_name:
# Field name has changed
k = new_field_name
if new_value is not None:
# value has changed
value = new_value
# Here we do the actual change
change = "\t%-30s%s\n" % (k, value)
if item['meta']['object_type'] == 'timeperiod' and field_name not in ('alias', 'timeperiod_name'):
change = "\t%s\n" % new_field_name
object_definition[i] = change
break
if not change and new_value is not None:
# Attribute was not found. Lets add it
change = "\t%-30s%s\n" % (field_name, new_value)
object_definition.insert(i, change)
# Lets put a banner in front of our item
if make_comments:
comment = '# Edited by PyNag on %s\n' % time.ctime()
if len(everything_before) > 0:
last_line_before = everything_before[-1]
if last_line_before.startswith('# Edited by PyNag on'):
everything_before.pop() # remove this line
object_definition.insert(0, comment)
# Here we overwrite the config-file, hoping not to ruin anything
str_buffer = "%s%s%s" % (''.join(everything_before), ''.join(object_definition), ''.join(everything_after))
self.write(filename, str_buffer)
return True
def open(self, filename, *args, **kwargs):
""" Wrapper around global open()
Simply calls global open(filename, *args, **kwargs) and passes all arguments
as they are received. See global open() function for more details.
"""
return open(filename, *args, **kwargs)
@pynag.Utils.synchronized(pynag.Utils.rlock)
def write(self, filename, string):
""" Wrapper around open(filename).write()
Writes string to filename and closes the file handler. File handler is
openned in `'w'` mode.
Args:
filename: File where *string* will be written. This is the path to
the file. (string)
string: String to be written to file. (string)
Returns:
Return code as returned by :py:meth:`os.write`
"""
fh = self.open(filename, 'w')
return_code = fh.write(string)
fh.flush()
# os.fsync(fh)
fh.close()
self._is_dirty = True
return return_code
def item_rewrite(self, item, str_new_item):
""" Completely rewrites item with string provided.
Args:
item: Item that is to be rewritten
str_new_item: str representation of the new item
..
In the following line, every "\\n" is actually a simple line break
This is only a little patch for the generated documentation.
Examples::
item_rewrite( item, "define service {\\n name example-service \\n register 0 \\n }\\n" )
Returns:
True on success
Raises:
:py:class:`ValueError` if object is not found
:py:class:`IOError` if save fails
"""
return self._modify_object(item=item, new_item=str_new_item)
def item_remove(self, item):
""" Delete one specific item from its configuration files
Args:
item: Item that is to be rewritten
str_new_item: string representation of the new item
..
In the following line, every "\\n" is actually a simple line break
This is only a little patch for the generated documentation.
Examples::
item_remove( item, "define service {\\n name example-service \\n register 0 \\n }\\n" )
Returns:
True on success
Raises:
:py:class:`ValueError` if object is not found
:py:class:`IOError` if save fails
"""
return self._modify_object(item=item, new_item="")
def item_edit_field(self, item, field_name, new_value):
""" Modifies one field of a (currently existing) object.
Changes are immediate (i.e. there is no commit)
Args:
item: Item to be modified. Its field `field_name` will be set to
`new_value`.
field_name: Name of the field that will be modified. (str)
new_value: Value to which will be set the field `field_name`. (str)
Example usage::
edit_object( item, field_name="host_name", new_value="examplehost.example.com") # doctest: +SKIP
Returns:
True on success
Raises:
:py:class:`ValueError` if object is not found
:py:class:`IOError` if save fails
"""
return self._modify_object(item, field_name=field_name, new_value=new_value)
def item_remove_field(self, item, field_name):
""" Removes one field of a (currently existing) object.
Changes are immediate (i.e. there is no commit)
Args:
item: Item to remove field from.
field_name: Field to remove. (string)
Example usage::
item_remove_field( item, field_name="contactgroups" )
Returns:
True on success
Raises:
:py:class:`ValueError` if object is not found
:py:class:`IOError` if save fails
"""
return self._modify_object(item=item, field_name=field_name, new_value=None, new_field_name=None)
def item_rename_field(self, item, old_field_name, new_field_name):
""" Renames a field of a (currently existing) item.
Changes are immediate (i.e. there is no commit).
Args:
item: Item to modify.
old_field_name: Name of the field that will have its name changed. (string)
new_field_name: New name given to `old_field_name` (string)
Example usage::
item_rename_field(item, old_field_name="normal_check_interval", new_field_name="check_interval")
Returns:
True on success
Raises:
:py:class:`ValueError` if object is not found
:py:class:`IOError` if save fails
"""
return self._modify_object(item=item, field_name=old_field_name, new_field_name=new_field_name)
def item_add(self, item, filename):
""" Adds a new object to a specified config file.
Args:
item: Item to be created
filename: Filename that we are supposed to write the new item to.
This is the path to the file. (string)
Returns:
True on success
Raises:
:py:class:`IOError` on failed save
"""
if not 'meta' in item:
item['meta'] = {}
item['meta']['filename'] = filename
# Create directory if it does not already exist
dirname = os.path.dirname(filename)
if not self.isdir(dirname):
os.makedirs(dirname)
str_buffer = self.print_conf(item)
fh = self.open(filename, 'a')
fh.write(str_buffer)
fh.close()
return True
def edit_object(self, item, field_name, new_value):
""" Modifies a (currently existing) item.
Changes are immediate (i.e. there is no commit)
Args:
item: Item to modify.
field_name: Field that will be updated.
new_value: Updated value of field `field_name`
Example Usage:
edit_object( item, field_name="host_name", new_value="examplehost.example.com")
Returns:
True on success
.. WARNING::
THIS FUNCTION IS DEPRECATED. USE item_edit_field() instead
"""
return self.item_edit_field(item=item, field_name=field_name, new_value=new_value)
def compareObjects(self, item1, item2):
""" Compares two items. Returns true if they are equal
Compares every key: value pair for both items. If anything is different,
the items will not be considered equal.
Args:
item1, item2: Items to be compared.
Returns:
True -- Items are equal
False -- Items are not equal
"""
keys1 = item1['meta']['defined_attributes'].keys()
keys2 = item2['meta']['defined_attributes'].keys()
keys1.sort()
keys2.sort()
result = True
if keys1 != keys2:
return False
for key in keys1:
if key == 'meta':
continue
key1 = item1[key]
key2 = item2[key]
# For our purpose, 30 is equal to 30.000
if key == 'check_interval':
key1 = int(float(key1))
key2 = int(float(key2))
if str(key1) != str(key2):
result = False
if result is False:
return False
return True
def edit_service(self, target_host, service_description, field_name, new_value):
""" Edit a service's attributes
Takes a host, service_description pair to identify the service to modify
and sets its field `field_name` to `new_value`.
Args:
target_host: name of the host to which the service is attached to. (string)
service_description: Service description of the service to modify. (string)
field_name: Field to modify. (string)
new_value: Value to which the `field_name` field will be updated (string)
Returns:
True on success
Raises:
:py:class:`ParserError` if the service is not found
"""
original_object = self.get_service(target_host, service_description)
if original_object is None:
raise ParserError("Service not found")
return self.edit_object(original_object, field_name, new_value)
def _get_list(self, item, key):
""" Return a comma list from an item
Args:
item: Item from which to select value. (string)
key: Field name of the value to select and return as a list. (string)
Example::
_get_list(Foo_object, host_name)
define service {
service_description Foo
host_name larry,curly,moe
}
returns
['larry','curly','moe']
Returns:
A list of the item's values of `key`
Raises:
:py:class:`ParserError` if item is not a dict
"""
if not isinstance(item, dict):
raise ParserError("%s is not a dictionary\n" % item)
# return []
if not key in item:
return []
return_list = []
if item[key].find(",") != -1:
for name in item[key].split(","):
return_list.append(name)
else:
return_list.append(item[key])
# Alphabetize
return_list.sort()
return return_list
def delete_object(self, object_type, object_name, user_key=None):
""" Delete object from configuration files
Args:
object_type: Type of the object to delete from configuration files.
object_name: Name of the object to delete from configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
True on success.
"""
item = self.get_object(object_type=object_type, object_name=object_name, user_key=user_key)
return self.item_remove(item)
def delete_service(self, service_description, host_name):
""" Delete service from configuration files
Args:
service_description: service_description field value of the object
to delete from configuration files.
host_name: host_name field value of the object to delete from
configuration files.
Returns:
True on success.
"""
item = self.get_service(host_name, service_description)
return self.item_remove(item)
def delete_host(self, object_name, user_key=None):
""" Delete a host from its configuration files
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
True on success.
"""
return self.delete_object('host', object_name, user_key=user_key)
def delete_hostgroup(self, object_name, user_key=None):
""" Delete a hostgroup from its configuration files
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
True on success.
"""
return self.delete_object('hostgroup', object_name, user_key=user_key)
def get_object(self, object_type, object_name, user_key=None):
""" Return a complete object dictionary
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: User defined key. Default None. (string)
Returns:
The item found to match all the criterias.
None if object is not found
"""
object_key = self._get_key(object_type, user_key)
for item in self.data['all_%s' % object_type]:
if item.get(object_key, None) == object_name:
return item
return None
def get_host(self, object_name, user_key=None):
""" Return a host object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('host', object_name, user_key=user_key)
def get_servicegroup(self, object_name, user_key=None):
""" Return a Servicegroup object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('servicegroup', object_name, user_key=user_key)
def get_contact(self, object_name, user_key=None):
""" Return a Contact object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('contact', object_name, user_key=user_key)
def get_contactgroup(self, object_name, user_key=None):
""" Return a Contactgroup object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('contactgroup', object_name, user_key=user_key)
def get_timeperiod(self, object_name, user_key=None):
""" Return a Timeperiod object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('timeperiod', object_name, user_key=user_key)
def get_command(self, object_name, user_key=None):
""" Return a Command object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('command', object_name, user_key=user_key)
def get_hostgroup(self, object_name, user_key=None):
""" Return a hostgroup object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('hostgroup', object_name, user_key=user_key)
def get_servicedependency(self, object_name, user_key=None):
""" Return a servicedependency object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('servicedependency', object_name, user_key=user_key)
def get_hostdependency(self, object_name, user_key=None):
""" Return a hostdependency object
Args:
object_name: object_name field value of the object to delete from
configuration files.
user_key: user_key to pass to :py:meth:`get_object`
Returns:
The item found to match all the criterias.
"""
return self.get_object('hostdependency', object_name, user_key=user_key)
def get_service(self, target_host, service_description):
""" Return a service object
Args:
target_host: host_name field of the service to be returned. This is
the host to which is attached the service.
service_description: service_description field of the service to be
returned.
Returns:
The item found to match all the criterias.
"""
for item in self.data['all_service']:
if item.get('service_description') == service_description and item.get('host_name') == target_host:
return item
return None
def _append_use(self, source_item, name):
""" Append attributes to source_item that are inherited via 'use' attribute'
Args:
source_item: item (dict) to apply the inheritance upon
name: obsolete (discovered automatically via source_item['use'].
Here for compatibility.
Returns:
Source Item with appended attributes.
Raises:
:py:class:`ParserError` on recursion errors
"""
# Remove the 'use' key
if "use" in source_item:
del source_item['use']
for possible_item in self.pre_object_list:
if "name" in possible_item:
# Start appending to the item
for k, v in possible_item.iteritems():
try:
if k == 'use':
source_item = self._append_use(source_item, v)
except Exception:
raise ParserError("Recursion error on %s %s" % (source_item, v))
# Only add the item if it doesn't already exist
if not k in source_item:
source_item[k] = v
return source_item
def _post_parse(self):
""" Creates a few optimization tweaks and easy access lists in self.data
Creates :py:attr:`config.item_apply_cache` and fills the all_object
item lists in self.data.
"""
self.item_list = None
self.item_apply_cache = {} # This is performance tweak used by _apply_template
for raw_item in self.pre_object_list:
# Performance tweak, make sure hashmap exists for this object_type
object_type = raw_item['meta']['object_type']
if not object_type in self.item_apply_cache:
self.item_apply_cache[object_type] = {}
# Tweak ends
if "use" in raw_item:
raw_item = self._apply_template(raw_item)
self.post_object_list.append(raw_item)
# Add the items to the class lists.
for list_item in self.post_object_list:
type_list_name = "all_%s" % list_item['meta']['object_type']
if not type_list_name in self.data:
self.data[type_list_name] = []
self.data[type_list_name].append(list_item)
def commit(self):
""" Write any changes that have been made to it's appropriate file """
# Loops through ALL items
for k in self.data.keys():
for item in self[k]:
# If the object needs committing, commit it!
if item['meta']['needs_commit']:
# Create file contents as an empty string
file_contents = ""
# find any other items that may share this config file
extra_items = self._get_items_in_file(item['meta']['filename'])
if len(extra_items) > 0:
for commit_item in extra_items:
# Ignore files that are already set to be deleted:w
if commit_item['meta']['delete_me']:
continue
# Make sure we aren't adding this thing twice
if item != commit_item:
file_contents += self.print_conf(commit_item)
# This is the actual item that needs commiting
if not item['meta']['delete_me']:
file_contents += self.print_conf(item)
# Write the file
filename = item['meta']['filename']
self.write(filename, file_contents)
# Recreate the item entry without the commit flag
self.data[k].remove(item)
item['meta']['needs_commit'] = None
self.data[k].append(item)
def flag_all_commit(self):
""" Flag every item in the configuration to be committed
This should probably only be used for debugging purposes
"""
for object_type in self.data.keys():
for item in self.data[object_type]:
item['meta']['needs_commit'] = True
def print_conf(self, item):
""" Return a string that can be used in a configuration file
Args:
item: Item to be dumped as a string.
Returns:
String representation of item.
"""
output = ""
# Header, to go on all files
output += "# Configuration file %s\n" % item['meta']['filename']
output += "# Edited by PyNag on %s\n" % time.ctime()
# Some hostgroup information
if "hostgroup_list" in item['meta']:
output += "# Hostgroups: %s\n" % ",".join(item['meta']['hostgroup_list'])
# Some hostgroup information
if "service_list" in item['meta']:
output += "# Services: %s\n" % ",".join(item['meta']['service_list'])
# Some hostgroup information
if "service_members" in item['meta']:
output += "# Service Members: %s\n" % ",".join(item['meta']['service_members'])
if len(item['meta']['template_fields']) != 0:
output += "# Values from templates:\n"
for k in item['meta']['template_fields']:
output += "#\t %-30s %-30s\n" % (k, item[k])
output += "\n"
output += "define %s {\n" % item['meta']['object_type']
for k, v in item.iteritems():
if v is None:
# Skip entries with No value
continue
if k != 'meta':
if k not in item['meta']['template_fields']:
output += "\t %-30s %-30s\n" % (k, v)
output += "}\n\n"
return output
def _load_static_file(self, filename=None):
""" Load a general config file (like nagios.cfg) that has key=value config file format. Ignore comments
Arguments:
filename: name of file to parse, if none nagios.cfg will be used
Returns:
a [ (key,value), (key,value) ] list
"""
result = []
if not filename:
filename = self.cfg_file
for line in self.open(filename).readlines():
# Strip out new line characters
line = line.strip()
# Skip blank lines
if line == "":
continue
# Skip comments
if line[0] == "#" or line[0] == ';':
continue
tmp = line.split("=", 1)
if len(tmp) < 2:
continue
key, value = tmp
key = key.strip()
value = value.strip()
result.append((key, value))
return result
def _edit_static_file(self, attribute, new_value, filename=None, old_value=None, append=False):
""" Modify a general config file (like nagios.cfg) that has a key=value config file format.
Arguments:
filename: Name of config file that will be edited (i.e. nagios.cfg)
attribute: name of attribute to edit (i.e. check_external_commands)
new_value: new value for the said attribute (i.e. "1"). None deletes
the line.
old_value: Useful if multiple attributes exist (i.e. cfg_dir) and
you want to replace a specific one.
append: If true, do not overwrite current setting. Instead append
this at the end. Use this with settings that are repeated like
cfg_file.
Examples::
_edit_static_file(filename='/etc/nagios/nagios.cfg', attribute='check_external_commands', new_value='1')
_edit_static_file(filename='/etc/nagios/nagios.cfg', attribute='cfg_dir', new_value='/etc/nagios/okconfig', append=True)
"""
if filename is None:
filename = self.cfg_file
# For some specific attributes, append should be implied
if attribute in ('cfg_file', 'cfg_dir', 'broker_module'):
append = True
# If/when we make a change, new_line is what will be written
new_line = '%s=%s\n' % (attribute, new_value)
# new_value=None means line should be removed
if new_value is None:
new_line = ''
write_buffer = self.open(filename).readlines()
is_dirty = False # dirty if we make any changes
for i, line in enumerate(write_buffer):
# Strip out new line characters
line = line.strip()
# Skip blank lines
if line == "":
continue
# Skip comments
if line[0] == "#" or line[0] == ';':
continue
key, value = line.split("=", 1)
key = key.strip()
value = value.strip()
# If key does not match, we are not interested in this line
if key != attribute:
continue
# If old_value was specified, and it matches, dont have to look any further
elif value == old_value:
write_buffer[i] = new_line
is_dirty = True
break
# if current value is the same as new_value, no need to make changes
elif value == new_value:
return False
# Special so cfg_dir matches despite double-slashes, etc
elif attribute == 'cfg_dir' and new_value and os.path.normpath(value) == os.path.normpath(new_value):
return False
# We are not appending, and no old value was specified:
elif append is False and not old_value:
write_buffer[i] = new_line
is_dirty = True
break
if is_dirty is False and new_value is not None:
# If we get here, it means we read the whole file,
# and we have not yet made any changes, So we assume
# We should append to the file
write_buffer.append(new_line)
is_dirty = True
# When we get down here, it is time to write changes to file
if is_dirty is True:
str_buffer = ''.join(write_buffer)
self.write(filename, str_buffer)
return True
else:
return False
def needs_reload(self):
""" Checks if the Nagios service needs a reload.
Returns:
True if Nagios service needs reload of cfg files
False if reload not needed or Nagios is not running
"""
if not self.maincfg_values:
self.reset()
self.parse_maincfg()
new_timestamps = self.get_timestamps()
object_cache_file = self.get_cfg_value('object_cache_file')
if self._get_pid() is None:
return False
if not object_cache_file:
return True
if not self.isfile(object_cache_file):
return True
object_cache_timestamp = new_timestamps.get(object_cache_file, 0)
# Reload not needed if no object_cache file
if object_cache_file is None:
return False
for k, v in new_timestamps.items():
if not v or int(v) > object_cache_timestamp:
return True
return False
def needs_reparse(self):
""" Checks if the Nagios configuration needs to be reparsed.
Returns:
True if any Nagios configuration file has changed since last parse()
"""
# If Parse has never been run:
if self.data == {}:
return True
# If previous save operation has forced a reparse
if self._is_dirty is True:
return True
# If we get here, we check the timestamps of the configs
new_timestamps = self.get_timestamps()
if len(new_timestamps) != len(self.timestamps):
return True
for k, v in new_timestamps.items():
if self.timestamps.get(k, None) != v:
return True
return False
@pynag.Utils.synchronized(pynag.Utils.rlock)
def parse_maincfg(self):
""" Parses your main configuration (nagios.cfg) and stores it as key/value pairs in self.maincfg_values
This function is mainly used by config.parse() which also parses your
whole configuration set.
Raises:
py:class:`ConfigFileNotFound`
"""
# If nagios.cfg is not set, lets do some minor autodiscover.
if self.cfg_file is None:
raise ConfigFileNotFound('Could not find nagios.cfg')
self.maincfg_values = self._load_static_file(self.cfg_file)
@pynag.Utils.synchronized(pynag.Utils.rlock)
def parse(self):
""" Parse all objects in your nagios configuration
This functions starts by loading up your nagios.cfg ( parse_maincfg() )
then moving on to your object configuration files (as defined via
cfg_file and cfg_dir) and and your resource_file as well.
Returns:
None
Raises:
:py:class:`IOError` if unable to read any file due to permission
problems
"""
# reset
self.reset()
self.parse_maincfg()
self.cfg_files = self.get_cfg_files()
# When parsing config, we will softly fail if permission denied
# comes on resource files. If later someone tries to get them via
# get_resource, we will fail hard
try:
self._resource_values = self.get_resources()
except IOError:
t, e = sys.exc_info()[:2]
self.errors.append(str(e))
self.timestamps = self.get_timestamps()
# This loads everything into
for cfg_file in self.cfg_files:
self._load_file(cfg_file)
self._post_parse()
self._is_dirty = False
def get_resource(self, resource_name):
""" Get a single resource value which can be located in any resource.cfg file
Arguments:
resource_name: Name as it appears in resource file (i.e. $USER1$)
Returns:
String value of the resource value.
Raises:
:py:class:`KeyError` if resource is not found
:py:class:`ParserError` if resource is not found and you do not have
permissions
"""
resources = self.get_resources()
for k, v in resources:
if k == resource_name:
return v
def get_timestamps(self):
""" Returns hash map of all nagios related files and their timestamps"""
files = {}
files[self.cfg_file] = None
for k, v in self.maincfg_values:
if k in ('resource_file', 'lock_file', 'object_cache_file'):
files[v] = None
for i in self.get_cfg_files():
files[i] = None
# Now lets lets get timestamp of every file
for k, v in files.items():
if not self.isfile(k):
continue
files[k] = self.stat(k).st_mtime
return files
def isfile(self, *args, **kwargs):
""" Wrapper around os.path.isfile """
return os.path.isfile(*args, **kwargs)
def isdir(self, *args, **kwargs):
""" Wrapper around os.path.isdir """
return os.path.isdir(*args, **kwargs)
def islink(self, *args, **kwargs):
""" Wrapper around os.path.islink """
return os.path.islink(*args, **kwargs)
def readlink(selfself, *args, **kwargs):
""" Wrapper around os.readlink """
return os.readlink(*args, **kwargs)
def stat(self, *args, **kwargs):
""" Wrapper around os.stat """
return os.stat(*args, **kwargs)
def remove(self, *args, **kwargs):
""" Wrapper around os.remove """
return os.remove(*args, **kwargs)
def access(self, *args, **kwargs):
""" Wrapper around os.access """
return os.access(*args, **kwargs)
def listdir(self, *args, **kwargs):
""" Wrapper around os.listdir """
return os.listdir(*args, **kwargs)
def exists(self, *args, **kwargs):
""" Wrapper around os.path.exists """
return os.path.exists(*args, **kwargs)
def get_resources(self):
"""Returns a list of every private resources from nagios.cfg"""
resources = []
for config_object, config_value in self.maincfg_values:
if config_object == 'resource_file' and self.isfile(config_value):
resources += self._load_static_file(config_value)
return resources
def extended_parse(self):
""" This parse is used after the initial parse() command is run.
It is only needed if you want extended meta information about hosts or other objects
"""
# Do the initial parsing
self.parse()
# First, cycle through the hosts, and append hostgroup information
index = 0
for host in self.data['all_host']:
if host.get("register", None) == "0":
continue
if not "host_name" in host:
continue
if not "hostgroup_list" in self.data['all_host'][index]['meta']:
self.data['all_host'][index]['meta']['hostgroup_list'] = []
# Append any hostgroups that are directly listed in the host definition
if "hostgroups" in host:
for hostgroup_name in self._get_list(host, 'hostgroups'):
if not "hostgroup_list" in self.data['all_host'][index]['meta']:
self.data['all_host'][index]['meta']['hostgroup_list'] = []
if hostgroup_name not in self.data['all_host'][index]['meta']['hostgroup_list']:
self.data['all_host'][index]['meta']['hostgroup_list'].append(hostgroup_name)
# Append any services which reference this host
service_list = []
for service in self.data['all_service']:
if service.get("register", None) == "0":
continue
if not "service_description" in service:
continue
if host['host_name'] in self._get_active_hosts(service):
service_list.append(service['service_description'])
self.data['all_host'][index]['meta']['service_list'] = service_list
# Increment count
index += 1
# Loop through all hostgroups, appending them to their respective hosts
for hostgroup in self.data['all_hostgroup']:
for member in self._get_list(hostgroup, 'members'):
index = 0
for host in self.data['all_host']:
if not "host_name" in host:
continue
# Skip members that do not match
if host['host_name'] == member:
# Create the meta var if it doesn' exist
if not "hostgroup_list" in self.data['all_host'][index]['meta']:
self.data['all_host'][index]['meta']['hostgroup_list'] = []
if hostgroup['hostgroup_name'] not in self.data['all_host'][index]['meta']['hostgroup_list']:
self.data['all_host'][index]['meta']['hostgroup_list'].append(hostgroup['hostgroup_name'])
# Increment count
index += 1
# Expand service membership
index = 0
for service in self.data['all_service']:
# Find a list of hosts to negate from the final list
self.data['all_service'][index]['meta']['service_members'] = self._get_active_hosts(service)
# Increment count
index += 1
def _get_active_hosts(self, item):
""" Given an object, return a list of active hosts.
This will exclude hosts that are negated with a "!"
Args:
item: Item to obtain active hosts from.
Returns:
List of all the active hosts for `item`
"""
# First, generate the negation list
negate_hosts = []
# Hostgroups
if "hostgroup_name" in item:
for hostgroup_name in self._get_list(item, 'hostgroup_name'):
if hostgroup_name[0] == "!":
hostgroup_obj = self.get_hostgroup(hostgroup_name[1:])
negate_hosts.extend(self._get_list(hostgroup_obj, 'members'))
# Host Names
if "host_name" in item:
for host_name in self._get_list(item, 'host_name'):
if host_name[0] == "!":
negate_hosts.append(host_name[1:])
# Now get hosts that are actually listed
active_hosts = []
# Hostgroups
if "hostgroup_name" in item:
for hostgroup_name in self._get_list(item, 'hostgroup_name'):
if hostgroup_name[0] != "!":
active_hosts.extend(self._get_list(self.get_hostgroup(hostgroup_name), 'members'))
# Host Names
if "host_name" in item:
for host_name in self._get_list(item, 'host_name'):
if host_name[0] != "!":
active_hosts.append(host_name)
# Combine the lists
return_hosts = []
for active_host in active_hosts:
if active_host not in negate_hosts:
return_hosts.append(active_host)
return return_hosts
def get_cfg_dirs(self):
""" Parses the main config file for configuration directories
Returns:
List of all cfg directories used in this configuration
Example::
print(get_cfg_dirs())
['/etc/nagios/hosts','/etc/nagios/objects',...]
"""
cfg_dirs = []
for config_object, config_value in self.maincfg_values:
if config_object == "cfg_dir":
cfg_dirs.append(config_value)
return cfg_dirs
def get_cfg_files(self):
""" Return a list of all cfg files used in this configuration
Filenames are normalised so that if nagios.cfg specifies relative
filenames we will convert it to fully qualified filename before returning.
Returns:
List of all configurations files used in the configuration.
Example:
print(get_cfg_files())
['/etc/nagios/hosts/host1.cfg','/etc/nagios/hosts/host2.cfg',...]
"""
cfg_files = []
for config_object, config_value in self.maincfg_values:
# Add cfg_file objects to cfg file list
if config_object == "cfg_file":
config_value = self.abspath(config_value)
if self.isfile(config_value):
cfg_files.append(config_value)
# Parse all files in a cfg directory
if config_object == "cfg_dir":
config_value = self.abspath(config_value)
directories = []
raw_file_list = []
directories.append(config_value)
# Walk through every subdirectory and add to our list
while directories:
current_directory = directories.pop(0)
# Nagios doesnt care if cfg_dir exists or not, so why should we ?
if not self.isdir(current_directory):
continue
for item in self.listdir(current_directory):
# Append full path to file
item = "%s" % (os.path.join(current_directory, item.strip()))
if self.islink(item):
item = os.readlink(item)
if self.isdir(item):
directories.append(item)
if raw_file_list.count(item) < 1:
raw_file_list.append(item)
for raw_file in raw_file_list:
if raw_file.endswith('.cfg'):
if self.exists(raw_file) and not self.isdir(raw_file):
# Nagios doesnt care if cfg_file exists or not, so we will not throws errors
cfg_files.append(raw_file)
return cfg_files
def abspath(self, path):
""" Return the absolute path of a given relative path.
The current working directory is assumed to be the dirname of nagios.cfg
Args:
path: relative path to be transformed into absolute path. (string)
Returns:
Absolute path of given relative path.
Example:
>>> c = config(cfg_file="/etc/nagios/nagios.cfg")
>>> c.abspath('nagios.cfg')
'/etc/nagios/nagios.cfg'
>>> c.abspath('/etc/nagios/nagios.cfg')
'/etc/nagios/nagios.cfg'
"""
if not isinstance(path, str):
return ValueError("Path must be a string got %s instead" % type(path))
if path.startswith('/'):
return path
nagiosdir = os.path.dirname(self.cfg_file)
normpath = os.path.abspath(os.path.join(nagiosdir, path))
return normpath
def get_cfg_value(self, key):
""" Returns one specific value from your nagios.cfg file,
None if value is not found.
Arguments:
key: what attribute to fetch from nagios.cfg (example: "command_file" )
Returns:
String of the first value found for
Example:
>>> c = Config() # doctest: +SKIP
>>> log_file = c.get_cfg_value('log_file') # doctest: +SKIP
# Should return something like "/var/log/nagios/nagios.log"
"""
if not self.maincfg_values:
self.parse_maincfg()
for k, v in self.maincfg_values:
if k == key:
return v
return None
def get_object_types(self):
""" Returns a list of all discovered object types """
return map(lambda x: re.sub("all_", "", x), self.data.keys())
def cleanup(self):
""" Remove configuration files that have no configuration items """
for filename in self.cfg_files:
if not self.parse_file(filename): # parse_file returns empty list on empty files
self.remove(filename)
# If nagios.cfg specifies this file directly via cfg_file directive then...
for k, v in self.maincfg_values:
if k == 'cfg_file' and v == filename:
self._edit_static_file(k, old_value=v, new_value=None)
def __setitem__(self, key, item):
self.data[key] = item
def __getitem__(self, key):
return self.data[key]
class Livestatus(object):
""" Wrapper around MK-Livestatus
Example usage::
s = Livestatus()
for hostgroup s.get_hostgroups():
print(hostgroup['name'], hostgroup['num_hosts'])
"""
def __init__(self, livestatus_socket_path=None, nagios_cfg_file=None, authuser=None):
""" Initilize a new instance of Livestatus
Args:
livestatus_socket_path: Path to livestatus socket (if none specified,
use one specified in nagios.cfg)
nagios_cfg_file: Path to your nagios.cfg. If None then try to
auto-detect
authuser: If specified. Every data pulled is with the access rights
of that contact.
"""
self.nagios_cfg_file = nagios_cfg_file
self.error = None
if not livestatus_socket_path:
c = config(cfg_file=nagios_cfg_file)
c.parse_maincfg()
self.nagios_cfg_file = c.cfg_file
# Look for a broker_module line in the main config and parse its arguments
# One of the arguments is path to the file socket created
for k, v in c.maincfg_values:
if k == 'broker_module' and "livestatus.o" in v:
for arg in v.split()[1:]:
if arg.startswith('/') or '=' not in arg:
livestatus_socket_path = arg
break
else:
# If we get here, then we could not locate a broker_module argument
# that looked like a filename
msg = "No Livestatus socket defined. Make sure livestatus broker module is loaded."
raise ParserError(msg)
self.livestatus_socket_path = livestatus_socket_path
self.authuser = authuser
def test(self, raise_error=True):
""" Test if connection to livestatus socket is working
Args:
raise_error: If set to True, raise exception if test fails,otherwise return False
Raises:
ParserError if raise_error == True and connection fails
Returns:
True -- Connection is OK
False -- there are problems and raise_error==False
"""
try:
self.query("GET hosts")
except Exception:
t, e = sys.exc_info()[:2]
self.error = e
if raise_error:
raise ParserError("got '%s' when testing livestatus socket. error was: '%s'" % (type(e), e))
else:
return False
return True
def _get_socket(self):
""" Returns a socket.socket() instance to communicate with livestatus
Socket might be either unix filesocket or a tcp socket depenging in
the content of :py:attr:`livestatus_socket_path`
Returns:
Socket to livestatus instance (socket.socket)
Raises:
:py:class:`LivestatusNotConfiguredException` on failed connection.
:py:class:`ParserError` If could not parse configured TCP address
correctly.
"""
if not self.livestatus_socket_path:
msg = "We could not find path to MK livestatus socket file. Make sure MK livestatus is installed and configured"
raise LivestatusNotConfiguredException(msg)
try:
# If livestatus_socket_path contains a colon, then we assume that it is tcp socket instead of a local filesocket
if self.livestatus_socket_path.find(':') > 0:
address, tcp_port = self.livestatus_socket_path.split(':', 1)
if not tcp_port.isdigit():
msg = 'Could not parse host:port "%s". %s does not look like a valid port is not a valid tcp port.'
raise ParserError(msg % (self.livestatus_socket_path, tcp_port))
tcp_port = int(tcp_port)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((address, tcp_port))
else:
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(self.livestatus_socket_path)
return s
except IOError:
t, e = sys.exc_info()[:2]
msg = "%s while connecting to '%s'. Make sure nagios is running and mk_livestatus loaded."
raise ParserError(msg % (e, self.livestatus_socket_path))
def query(self, query, *args, **kwargs):
""" Performs LQL queries the livestatus socket
Queries are corrected and convienient default data are added to the
query before sending it to the socket.
Args:
query: Query to be passed to the livestatus socket (string)
args, kwargs: Additionnal parameters that will be sent to
:py:meth:`pynag.Utils.grep_to_livestatus`. The result will be
appended to the query.
Returns:
Answer from livestatus. It will be in python format unless specified
otherwise.
Raises:
:py:class:`ParserError` if problems connecting to livestatus.
"""
# columns parameter is here for backwards compatibility only
kwargs.pop('columns', None)
# We break query up into a list, of commands, then before sending command to the socket
# We will write it one line per item in the array
query = query.split('\n')
query += pynag.Utils.grep_to_livestatus(*args, **kwargs)
# If no response header was specified, we add fixed16
response_header = None
if not filter(lambda x: x.startswith('ResponseHeader:'), query):
query.append("ResponseHeader: fixed16")
response_header = "fixed16"
# If no specific outputformat is requested, we will return in python format
python_format = False
if not filter(lambda x: x.startswith('OutputFormat:'), query):
query.append("OutputFormat: python")
python_format = True
# There is a bug in livestatus where if requesting Stats, then no column headers are sent from livestatus
# In later version, the headers are sent, but the output is corrupted.
#
# We maintain consistency by clinging on to the old bug, and if there are Stats in the output
# we will not ask for column headers
doing_stats = len(filter(lambda x: x.startswith('Stats:'), query)) > 0
if not filter(lambda x: x.startswith('Stats:'), query) and not filter(
lambda x: x.startswith('ColumnHeaders: on'), query):
query.append("ColumnHeaders: on")
# Check if we need to add authuser to the query
if not filter(lambda x: x.startswith('AuthUser:'), query) and self.authuser not in (None, ''):
query.append("AuthUser: %s" % self.authuser)
# When we reach here, we are done adding options to the query, so we convert to the string that will
# be sent to the livestatus socket
query = '\n'.join(query) + '\n'
self.last_query = query
#
# Lets create a socket and see if we can write to it
#
s = self._get_socket()
try:
s.send(query)
except IOError:
msg = "Could not write to socket '%s'. Make sure you have the right permissions"
raise ParserError(msg % self.livestatus_socket_path)
s.shutdown(socket.SHUT_WR)
tmp = s.makefile()
# Read the response header from livestatus
if response_header == "fixed16":
response_data = tmp.readline()
if len(response_data) == 0:
return []
return_code = response_data.split()[0]
if not return_code.startswith('2'):
error_message = tmp.readline().strip()
raise ParserError("Error '%s' from livestatus: %s" % (return_code, error_message))
answer = tmp.read()
# We are done with the livestatus socket. lets close it
s.close()
if answer == '':
return []
# If something other than python format was requested, we return the answer as is
if python_format is False:
return answer
# If we reach down here, it means we are supposed to parse the output before returning it
try:
answer = eval(answer)
except Exception:
raise ParserError("Error, could not parse response from livestatus.\n%s" % answer)
# Workaround for livestatus bug, where column headers are not provided even if we asked for them
if doing_stats is True and len(answer) == 1:
return answer[0]
columns = answer.pop(0)
# Lets throw everything into a hashmap before we return
result = []
for line in answer:
tmp = {}
for i, column in enumerate(line):
column_name = columns[i]
tmp[column_name] = column
result.append(tmp)
return result
def get(self, table, *args, **kwargs):
""" Same as self.query('GET %s' % (table,))
Extra arguments will be appended to the query.
Args:
table: Table from which the data will be retrieved
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Example::
get('contacts', 'Columns: name alias')
Returns:
Answer from livestatus in python format.
"""
return self.query('GET %s' % (table,), *args, **kwargs)
def get_host(self, host_name):
""" Performs a GET query for a particular host
This performs::
'''GET hosts
Filter: host_name = %s''' % host_name
Args:
host_name: name of the host to obtain livestatus data from
Returns:
Answer from livestatus in python format.
"""
return self.query('GET hosts', 'Filter: host_name = %s' % host_name)[0]
def get_service(self, host_name, service_description):
""" Performs a GET query for a particular service
This performs::
'''GET services
Filter: host_name = %s
Filter: service_description = %s''' % (host_name, service_description)
Args:
host_name: name of the host the target service is attached to.
service_description: Description of the service to obtain livestatus
data from.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET services', 'Filter: host_name = %s' % host_name,
'Filter: description = %s' % service_description)[0]
def get_hosts(self, *args, **kwargs):
""" Performs a GET query for all hosts
This performs::
'''GET hosts %s %s''' % (*args, **kwargs)
Args:
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET hosts', *args, **kwargs)
def get_services(self, *args, **kwargs):
""" Performs a GET query for all services
This performs::
'''GET services
%s %s''' % (*args, **kwargs)
Args:
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET services', *args, **kwargs)
def get_hostgroups(self, *args, **kwargs):
""" Performs a GET query for all hostgroups
This performs::
'''GET hostgroups
%s %s''' % (*args, **kwargs)
Args:
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET hostgroups', *args, **kwargs)
def get_servicegroups(self, *args, **kwargs):
""" Performs a GET query for all servicegroups
This performs::
'''GET servicegroups
%s %s''' % (*args, **kwargs)
Args:
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET servicegroups', *args, **kwargs)
def get_contactgroups(self, *args, **kwargs):
""" Performs a GET query for all contactgroups
This performs::
'''GET contactgroups
%s %s''' % (*args, **kwargs)
Args:
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET contactgroups', *args, **kwargs)
def get_contacts(self, *args, **kwargs):
""" Performs a GET query for all contacts
This performs::
'''GET contacts
%s %s''' % (*args, **kwargs)
Args:
args, kwargs: These will be appendend to the end of the query to
perform additionnal instructions.
Returns:
Answer from livestatus in python format.
"""
return self.query('GET contacts', *args, **kwargs)
def get_contact(self, contact_name):
""" Performs a GET query for a particular contact
This performs::
'''GET contacts
Filter: contact_name = %s''' % contact_name
Args:
contact_name: name of the contact to obtain livestatus data from
Returns:
Answer from livestatus in python format.
"""
return self.query('GET contacts', 'Filter: contact_name = %s' % contact_name)[0]
def get_servicegroup(self, name):
""" Performs a GET query for a particular servicegroup
This performs::
'''GET servicegroups
Filter: servicegroup_name = %s''' % servicegroup_name
Args:
servicegroup_name: name of the servicegroup to obtain livestatus data from
Returns:
Answer from livestatus in python format.
"""
return self.query('GET servicegroups', 'Filter: name = %s' % name)[0]
def get_hostgroup(self, name):
""" Performs a GET query for a particular hostgroup
This performs::
'''GET hostgroups
Filter: hostgroup_name = %s''' % hostgroup_name
Args:
hostgroup_name: name of the hostgroup to obtain livestatus data from
Returns:
Answer from livestatus in python format.
"""
return self.query('GET hostgroups', 'Filter: name = %s' % name)[0]
def get_contactgroup(self, name):
""" Performs a GET query for a particular contactgroup
This performs::
'''GET contactgroups
Filter: contactgroup_name = %s''' % contactgroup_name
Args:
contactgroup_name: name of the contactgroup to obtain livestatus data from
Returns:
Answer from livestatus in python format.
"""
return self.query('GET contactgroups', 'Filter: name = %s' % name)[0]
class RetentionDat(object):
""" Easy way to parse the content of retention.dat
After calling parse() contents of retention.dat are kept in self.data
Example Usage::
r = retention()
r.parse()
print r
print r.data['info']
"""
def __init__(self, filename=None, cfg_file=None):
""" Initilize a new instance of retention.dat
Args (you only need to provide one of these):
filename: path to your retention.dat file
cfg_file: path to your nagios.cfg file, path to retention.dat will
be looked up in this file
"""
# If filename is not provided, lets try to discover it from
# nagios.cfg
if filename is None:
c = config(cfg_file=cfg_file)
for key, value in c._load_static_file():
if key == "state_retention_file":
filename = value
self.filename = filename
self.data = None
def parse(self):
""" Parses your status.dat file and stores in a dictionary under self.data
Returns:
None
Raises:
:py:class:`ParserError`: if problem arises while reading status.dat
:py:class:`ParserError`: if status.dat is not found
:py:class:`IOError`: if status.dat cannot be read
"""
self.data = {}
status = {} # Holds all attributes of a single item
key = None # if within definition, store everything before =
value = None # if within definition, store everything after =
if not self.filename:
raise ParserError("status.dat file not found")
lines = open(self.filename, 'rb').readlines()
for sequence_no, line in enumerate(lines):
line_num = sequence_no + 1
# Cleanup and line skips
line = line.strip()
if line == "":
pass
elif line[0] == "#" or line[0] == ';':
pass
elif line.find("{") != -1:
status = {}
status['meta'] = {}
status['meta']['type'] = line.split("{")[0].strip()
elif line.find("}") != -1:
# Status definition has finished, lets add it to
# self.data
if status['meta']['type'] not in self.data:
self.data[status['meta']['type']] = []
self.data[status['meta']['type']].append(status)
else:
tmp = line.split("=", 1)
if len(tmp) == 2:
(key, value) = line.split("=", 1)
status[key] = value
elif key == "long_plugin_output":
# special hack for long_output support. We get here if:
# * line does not contain {
# * line does not contain }
# * line does not contain =
# * last line parsed started with long_plugin_output=
status[key] += "\n" + line
else:
raise ParserError("Error on %s:%s: Could not parse line: %s" % (self.filename, line_num, line))
def __setitem__(self, key, item):
self.data[key] = item
def __getitem__(self, key):
return self.data[key]
def __str__(self):
if not self.data:
self.parse()
str_buffer = "# Generated by pynag"
for datatype, datalist in self.data.items():
for item in datalist:
str_buffer += "%s {\n" % datatype
for attr, value in item.items():
str_buffer += "%s=%s\n" % (attr, value)
str_buffer += "}\n"
return str_buffer
class StatusDat(RetentionDat):
""" Easy way to parse status.dat file from nagios
After calling parse() contents of status.dat are kept in status.data
Example usage::
>>> s = status()
>>> s.parse()
>>> keys = s.data.keys()
>>> 'info' in keys
True
>>> 'programstatus' in keys
True
>>> for service in s.data.get('servicestatus',[]):
... host_name=service.get('host_name', None)
... description=service.get('service_description',None)
"""
def __init__(self, filename=None, cfg_file=None):
""" Initilize a new instance of status
Args (you only need to provide one of these):
filename: path to your status.dat file
cfg_file: path to your nagios.cfg file, path to status.dat will be
looked up in this file
"""
# If filename is not provided, lets try to discover it from
# nagios.cfg
if filename is None:
c = config(cfg_file=cfg_file)
for key, value in c._load_static_file():
if key == "status_file":
filename = value
self.filename = filename
self.data = None
def get_contactstatus(self, contact_name):
""" Returns a dictionary derived from status.dat for one particular contact
Args:
contact_name: `contact_name` field of the contact's status.dat data
to parse and return as a dict.
Returns:
dict derived from status.dat for the contact.
Raises:
ValueError if object is not found
Example:
>>> s = status()
>>> s.get_contactstatus(contact_name='invalid_contact')
ValueError('invalid_contact',)
>>> first_contact = s.data['contactstatus'][0]['contact_name']
>>> s.get_contactstatus(first_contact)['contact_name'] == first_contact
True
"""
if self.data is None:
self.parse()
for i in self.data['contactstatus']:
if i.get('contact_name') == contact_name:
return i
return ValueError(contact_name)
def get_hoststatus(self, host_name):
""" Returns a dictionary derived from status.dat for one particular contact
Args:
host_name: `host_name` field of the host's status.dat data
to parse and return as a dict.
Returns:
dict derived from status.dat for the host.
Raises:
ValueError if object is not found
"""
if self.data is None:
self.parse()
for i in self.data['hoststatus']:
if i.get('host_name') == host_name:
return i
raise ValueError(host_name)
def get_servicestatus(self, host_name, service_description):
""" Returns a dictionary derived from status.dat for one particular service
Args:
service_name: `service_name` field of the host's status.dat data
to parse and return as a dict.
Returns:
dict derived from status.dat for the service.
Raises:
ValueError if object is not found
"""
if self.data is None:
self.parse()
for i in self.data['servicestatus']:
if i.get('host_name') == host_name:
if i.get('service_description') == service_description:
return i
raise ValueError(host_name, service_description)
class ObjectCache(Config):
""" Loads the configuration as it appears in objects.cache file """
def get_cfg_files(self):
for k, v in self.maincfg_values:
if k == 'object_cache_file':
return [v]
class ParserError(Exception):
""" ParserError is used for errors that the Parser has when parsing config.
Typical usecase when there is a critical error while trying to read configuration.
"""
filename = None
line_start = None
message = None
def __init__(self, message, item=None):
""" Creates an instance of ParserError
Args:
message: Message to be printed by the error
item: Pynag item who caused the error
"""
self.message = message
if item is None:
return
self.item = item
self.filename = item['meta']['filename']
self.line_start = item['meta'].get('line_start')
def __str__(self):
message = self.message
if self.filename and self.line_start:
message = '%s in %s, line %s' % (message, self.filename, self.line_start)
return repr(message)
class ConfigFileNotFound(ParserError):
""" This exception is thrown if we cannot locate any nagios.cfg-style config file. """
pass
class LivestatusNotConfiguredException(ParserError):
""" This exception is raised if we tried to autodiscover path to livestatus and failed """
class LogFiles(object):
""" Parses Logfiles defined in nagios.cfg and allows easy access to its content
Content is stored in python-friendly arrays of dicts. Output should be more
or less compatible with mk_livestatus log output
"""
def __init__(self, maincfg=None):
self.config = config(maincfg)
self.log_file = self.config.get_cfg_value('log_file')
self.log_archive_path = self.config.get_cfg_value('log_archive_path')
def get_log_entries(self, start_time=None, end_time=None, strict=True, search=None, **kwargs):
""" Get Parsed log entries for given timeperiod.
Args:
start_time: unix timestamp. if None, return all entries from today
end_time: If specified, only fetch log entries older than this (unix
timestamp)
strict: If True, only return entries between start_time and
end_time, if False, then return entries that belong to same log
files as given timeset
search: If provided, only return log entries that contain this
string (case insensitive)
kwargs: All extra arguments are provided as filter on the log
entries. f.e. host_name="localhost"
Returns:
List of dicts
"""
now = time.time()
if end_time is None:
end_time = now
if start_time is None:
if 'filename' in kwargs:
start_time = 1
else:
seconds_in_a_day = 60 * 60 * 24
seconds_today = end_time % seconds_in_a_day # midnight of today
start_time = end_time - seconds_today
start_time = int(start_time)
end_time = int(end_time)
logfiles = self.get_logfiles()
if 'filename' in kwargs:
logfiles = filter(lambda x: x == kwargs.get('filename'), logfiles)
# If start time was provided, skip all files that we last modified
# before start_time
if start_time:
logfiles = filter(lambda x: start_time <= os.stat(x).st_mtime, logfiles)
# Log entries are returned in ascending order, which is the opposite of
# what get_logfiles returns.
logfiles.reverse()
result = []
for log_file in logfiles:
entries = self._parse_log_file(filename=log_file)
if len(entries) == 0:
continue
first_entry = entries[0]
last_entry = entries[-1]
if first_entry['time'] > end_time:
continue
# If strict, filter entries to only include the ones in the timespan
if strict is True:
entries = [x for x in entries if x['time'] >= start_time and x['time'] <= end_time]
# If search string provided, filter the string
if search is not None:
entries = [x for x in entries if x['message'].lower().find(search.lower()) > -1]
for k, v in kwargs.items():
entries = [x for x in entries if x.get(k) == v]
result += entries
if start_time is None or int(start_time) >= int(first_entry.get('time')):
continue
# Now, logfiles should in MOST cases come sorted for us.
# However we rely on modification time of files and if it is off,
# We want to make sure log entries are coming in the correct order.
# The following sort should not impact performance in the typical use case.
result.sort(key=lambda x: x.get('time'))
return result
def get_logfiles(self):
""" Returns a list with the fullpath to every log file used by nagios.
Lists are sorted by modification times. Newest logfile is at the front
of the list so usually nagios.log comes first, followed by archivelogs
Returns:
List of strings
"""
logfiles = []
for filename in os.listdir(self.log_archive_path):
full_path = "%s/%s" % (self.log_archive_path, filename)
logfiles.append(full_path)
logfiles.append(self.log_file)
# Sort the logfiles by modification time, newest file at the front
compare_mtime = lambda a, b: os.stat(a).st_mtime < os.stat(b).st_mtime
logfiles.sort(key=lambda x: int(os.stat(x).st_mtime))
# Newest logfiles go to the front of the list
logfiles.reverse()
return logfiles
def get_flap_alerts(self, **kwargs):
""" Same as :py:meth:`get_log_entries`, except return timeperiod transitions.
Takes same parameters.
"""
return self.get_log_entries(class_name="timeperiod transition", **kwargs)
def get_notifications(self, **kwargs):
""" Same as :py:meth:`get_log_entries`, except return only notifications.
Takes same parameters.
"""
return self.get_log_entries(class_name="notification", **kwargs)
def get_state_history(self, start_time=None, end_time=None, host_name=None, strict=True, service_description=None):
""" Returns a list of dicts, with the state history of hosts and services.
Args:
start_time: unix timestamp. if None, return all entries from today
end_time: If specified, only fetch log entries older than this (unix
timestamp)
host_name: If provided, only return log entries that contain this
string (case insensitive)
service_description: If provided, only return log entries that contain this
string (case insensitive)
Returns:
List of dicts with state history of hosts and services
"""
log_entries = self.get_log_entries(start_time=start_time, end_time=end_time, strict=strict, class_name='alerts')
result = []
last_state = {}
now = time.time()
for line in log_entries:
if 'state' not in line:
continue
line['duration'] = now - int(line.get('time'))
if host_name is not None and host_name != line.get('host_name'):
continue
if service_description is not None and service_description != line.get('service_description'):
continue
if start_time is None:
start_time = int(line.get('time'))
short_name = "%s/%s" % (line['host_name'], line['service_description'])
if short_name in last_state:
last = last_state[short_name]
last['end_time'] = line['time']
last['duration'] = last['end_time'] - last['time']
line['previous_state'] = last['state']
last_state[short_name] = line
if strict is True:
if start_time is not None and int(start_time) > int(line.get('time')):
continue
if end_time is not None and int(end_time) < int(line.get('time')):
continue
result.append(line)
return result
def _parse_log_file(self, filename=None):
""" Parses one particular nagios logfile into arrays of dicts.
Args:
filename: Log file to be parsed. If is None, then log_file from
nagios.cfg is used.
Returns:
A list of dicts containing all data from the log file
"""
if filename is None:
filename = self.log_file
result = []
for line in open(filename).readlines():
parsed_entry = self._parse_log_line(line)
if parsed_entry != {}:
parsed_entry['filename'] = filename
result.append(parsed_entry)
return result
def _parse_log_line(self, line):
""" Parse one particular line in nagios logfile and return a dict.
Args:
line: Line of the log file to be parsed.
Returns:
dict containing the information from the log file line.
"""
host = None
service_description = None
state = None
check_attempt = None
plugin_output = None
contact = None
m = re.search('^\[(.*?)\] (.*?): (.*)', line)
if m is None:
return {}
line = line.strip()
timestamp, logtype, options = m.groups()
result = {}
try:
timestamp = int(timestamp)
except ValueError:
timestamp = 0
result['time'] = int(timestamp)
result['type'] = logtype
result['options'] = options
result['message'] = line
result['class'] = 0 # unknown
result['class_name'] = 'unclassified'
if logtype in ('CURRENT HOST STATE', 'CURRENT SERVICE STATE', 'SERVICE ALERT', 'HOST ALERT'):
result['class'] = 1
result['class_name'] = 'alerts'
if logtype.find('HOST') > -1:
# This matches host current state:
m = re.search('(.*?);(.*?);(.*);(.*?);(.*)', options)
if m is None:
return result
host, state, hard, check_attempt, plugin_output = m.groups()
service_description = None
if logtype.find('SERVICE') > -1:
m = re.search('(.*?);(.*?);(.*?);(.*?);(.*?);(.*)', options)
if m is None:
return result
host, service_description, state, hard, check_attempt, plugin_output = m.groups()
result['host_name'] = host
result['service_description'] = service_description
result['state'] = int(pynag.Plugins.state[state])
result['check_attempt'] = check_attempt
result['plugin_output'] = plugin_output
result['text'] = plugin_output
elif "NOTIFICATION" in logtype:
result['class'] = 3
result['class_name'] = 'notification'
if logtype == 'SERVICE NOTIFICATION':
m = re.search('(.*?);(.*?);(.*?);(.*?);(.*?);(.*)', options)
if m is None:
return result
contact, host, service_description, state, command, plugin_output = m.groups()
elif logtype == 'HOST NOTIFICATION':
m = re.search('(.*?);(.*?);(.*?);(.*?);(.*)', options)
if m is None:
return result
contact, host, state, command, plugin_output = m.groups()
service_description = None
result['contact_name'] = contact
result['host_name'] = host
result['service_description'] = service_description
try:
result['state'] = int(pynag.Plugins.state[state])
except Exception:
result['state'] = -1
result['plugin_output'] = plugin_output
result['text'] = plugin_output
elif logtype == "EXTERNAL COMMAND":
result['class'] = 5
result['class_name'] = 'command'
m = re.search('(.*?);(.*)', options)
if m is None:
return result
command_name, text = m.groups()
result['command_name'] = command_name
result['text'] = text
elif logtype in ('PASSIVE SERVICE CHECK', 'PASSIVE HOST CHECK'):
result['class'] = 4
result['class_name'] = 'passive'
if logtype.find('HOST') > -1:
# This matches host current state:
m = re.search('(.*?);(.*?);(.*)', options)
if m is None:
return result
host, state, plugin_output = m.groups()
service_description = None
if logtype.find('SERVICE') > -1:
m = re.search('(.*?);(.*?);(.*?);(.*)', options)
if m is None:
return result
host, service_description, state, plugin_output = m.groups()
result['host_name'] = host
result['service_description'] = service_description
result['state'] = state
result['plugin_output'] = plugin_output
result['text'] = plugin_output
elif logtype in ('SERVICE FLAPPING ALERT', 'HOST FLAPPING ALERT'):
result['class_name'] = 'flapping'
elif logtype == 'TIMEPERIOD TRANSITION':
result['class_name'] = 'timeperiod_transition'
elif logtype == 'Warning':
result['class_name'] = 'warning'
result['state'] = "1"
result['text'] = options
if 'text' not in result:
result['text'] = result['options']
result['log_class'] = result['class'] # since class is a python keyword
return result
class ExtraOptsParser(object):
""" Get Nagios Extra-Opts from a config file as specified by http://nagiosplugins.org/extra-opts
We could ALMOST use pythons ConfParser but nagios plugin team thought it would be a
good idea to support multiple values per key, so a dict datatype no longer works.
Its a shame because we have to make our own "ini" parser as a result
Usage::
# cat /etc/nagios/plugins.ini
[main]
host_name = localhost
[other section]
host_name = example.com
# EOF
e = ExtraOptsParser(section_name='main', config_file='/etc/nagios/plugins.ini')
e.get('host_name') # returns "localhost"
e.get_values() # Returns a dict of all the extra opts
e.getlist('host_name') # returns all values of host_name (if more than one were specified) in a list
"""
standard_locations = [
"/etc/nagios/plugins.ini",
"/usr/local/nagios/etc/plugins.ini",
"/usr/local/etc/nagios/plugins.ini",
"/etc/opt/nagios/plugins.ini",
"/etc/nagios-plugins.ini",
"/usr/local/etc/nagios-plugins.ini",
"/etc/opt/nagios-plugins.ini",
]
def __init__(self, section_name=None, config_file=None):
if not section_name:
section_name = self.get_default_section_name()
if not config_file:
config_file = self.get_default_config_file()
self.section_name = section_name
self.config_file = config_file
self._all_options = self.parse_file(filename=config_file) or {}
def get_values(self):
""" Returns a dict with all extra-options with the granted section_name and config_file
Results are in the form of::
{
'key': ["possible","values"]
}
"""
return self._all_options.get(self.section_name, {})
def get_default_section_name(self):
""" According to extra-opts standard, the default should be filename of check script being run """
return os.path.basename(sys.argv[0])
def get_default_config_file(self):
""" Return path to first readable extra-opt config-file found
According to the nagiosplugins extra-opts spec the search method is as follows:
1. Search for nagios.ini or nagios-plugins.ini in : splitted variable NAGIOS_CONFIG_PATH
2. Search in a predefined list of files
3. Return None if no config file is found
The method works as follows:
To quote the spec on NAGIOS_CONFIG_PATH:
*"To use a custom location, set a NAGIOS_CONFIG_PATH environment
variable to the set of directories that should be checked (this is a
colon-separated list just like PATH). The first plugins.ini or
nagios-plugins.ini file found in these directories will be used."*
"""
search_path = []
nagios_config_path = os.environ.get('NAGIOS_CONFIG_PATH', '')
for path in nagios_config_path.split(':'):
search_path.append(os.path.join(path, 'plugins.ini'))
search_path.append(os.path.join(path, 'nagios-plugins.ini'))
search_path += self.standard_locations
self.search_path = search_path
for path in search_path:
if os.path.isfile(path):
return path
return None
def get(self, option_name, default=_sentinel):
""" Return the value of one specific option
Args:
option_name: The value set to this option will be returned
Returns:
The value of `option_name`
Raises:
:py:class:`ValueError` when `option_name` cannot be found in options
"""
result = self.getlist(option_name, default)
# If option was not found, raise error
if result == _sentinel:
raise ValueError("Option named %s was not found" % (option_name))
elif result == default:
return result
elif not result:
# empty list
return result
else:
return result[0]
def getlist(self, option_name, default=_sentinel):
""" Return a list of all values for option_name
Args:
option_name: All the values set to this option will be returned
Returns:
List containing all the options set to `option_name`
Raises:
:py:class:`ValueError` when `option_name` cannot be found in options
"""
result = self.get_values().get(option_name, default)
if result == _sentinel:
raise ValueError("Option named %s was not found" % (option_name))
return result
def parse_file(self, filename):
""" Parses an ini-file and returns a dict of the ini values.
The datatype returned is a list of sections where each section is a
dict of values.
Args:
filename: Full path to the ini-file to be parsed.
Example the following the file::
[main]
name = this is a name
key = value
key = value2
Would return::
[
{'main':
{
'name': ['this is a name'],
'key': [value, value2]
}
},
]
"""
if filename is None:
return {}
f = open(filename)
try:
data = f.read()
return self.parse_string(data)
finally:
f.close()
def parse_string(self, string):
""" Parses a string that is supposed to be ini-style format.
See :py:meth:`parse_file` for more info
Args:
string: String to be parsed. Should be in ini-file format.
Returns:
Dictionnary containing all the sections of the ini-file and their
respective data.
Raises:
:py:class:`ParserError` when line does not follow the ini format.
"""
sections = {}
# When parsing inside a section, the name of it stored here.
section_name = None
current_section = pynag.Utils.defaultdict(dict)
for line_no, line, in enumerate(string.splitlines()):
line = line.strip()
# skip empty lines
if not line or line[0] in ('#', ';'):
continue
# Check if this is a new section
if line.startswith('[') and line.endswith(']'):
section_name = line.strip('[').strip(']').strip()
current_section = pynag.Utils.defaultdict(list)
sections[section_name] = current_section
continue
# All entries should have key=value format
if not '=' in line:
error = "Line %s should be in the form of key=value format (got '%s' instead)" % (line_no, line)
raise ParserError(error)
# If we reach here, we parse current line into key and a value section
key, value = line.split('=', 1)
key = key.strip()
value = value.strip()
sections[section_name][key].append(value)
return sections
class SshConfig(Config):
""" Parse object configuration files from remote host via ssh
Uses python-paramiko for ssh connections.
"""
def __init__(self, host, username, password=None, cfg_file=None):
""" Creates a SshConfig instance
Args:
host: Host to connect to
username: User to connect with
password: Password for `username`
cfg_file: Nagios main cfg file
"""
import paramiko
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(host, username=username, password=password)
self.ftp = self.ssh.open_sftp()
import cStringIO
c = cStringIO.StringIO()
self.tar = tarfile.open(mode='w', fileobj=c)
self.cached_stats = {}
super(SshConfig, self).__init__(cfg_file=cfg_file)
def open(self, filename, *args, **kwargs):
""" Behaves like file.open only, via ssh connection """
return self.tar.extractfile(filename)
tarinfo = self._get_file(filename)
string = tarinfo.tobuf()
print string
return StringIO.StringIO(string)
return self.tar.extractfile(tarinfo)
def add_to_tar(self, path):
"""
"""
print "Taring ", path
command = "find '{path}' -type f | tar -c -T - --to-stdout --absolute-names"
command = command.format(path=path)
print command
stdin, stdout, stderr = self.ssh.exec_command(command, bufsize=50000)
tar = tarfile.open(fileobj=stdout, mode='r|')
if not self.tar:
self.tar = tar
# return
else:
for i in tar:
self.tar.addfile(i)
def is_cached(self, filename):
if not self.tar:
return False
return filename in self.tar.getnames()
def _get_file(self, filename):
""" Download filename and return the TarInfo object """
if filename not in self.tar.getnames():
self.add_to_tar(filename)
return self.tar.getmember(filename)
def get_cfg_files(self):
cfg_files = []
for config_object, config_value in self.maincfg_values:
# Add cfg_file objects to cfg file list
if config_object == "cfg_file":
config_value = self.abspath(config_value)
if self.isfile(config_value):
cfg_files.append(config_value)
elif config_object == "cfg_dir":
absolut_path = self.abspath(config_value)
command = "find '%s' -type f -iname \*cfg" % (absolut_path)
stdin, stdout, stderr = self.ssh.exec_command(command)
raw_filelist = stdout.read().splitlines()
cfg_files += raw_filelist
else:
continue
if not self.is_cached(config_value):
self.add_to_tar(config_value)
return cfg_files
def isfile(self, path):
""" Behaves like os.path.isfile only, via ssh connection """
try:
copy = self._get_file(path)
return copy.isfile()
except IOError:
return False
def isdir(self, path):
""" Behaves like os.path.isdir only, via ssh connection """
try:
file_stat = self.stat(path)
return stat.S_ISDIR(file_stat.st_mode)
except IOError:
return False
def islink(self, path):
""" Behaves like os.path.islink only, via ssh connection """
try:
file_stat = self.stat(path)
return stat.S_ISLNK(file_stat.st_mode)
except IOError:
return False
def readlink(self, path):
""" Behaves like os.readlink only, via ssh connection """
return self.ftp.readlink(path)
def stat(self, *args, **kwargs):
""" Wrapper around os.stat only, via ssh connection """
path = args[0]
if not self.is_cached(path):
self.add_to_tar(path)
if path not in self.tar.getnames():
raise IOError("No such file or directory %s" % path)
member = self.tar.getmember(path)
member.st_mode = member.mode
member.st_mtime = member.mtime
return member
def access(self, *args, **kwargs):
""" Wrapper around os.access only, via ssh connection """
return os.access(*args, **kwargs)
def exists(self, path):
""" Wrapper around os.path.exists only, via ssh connection """
try:
self.ftp.stat(path)
return True
except IOError:
return False
def listdir(self, *args, **kwargs):
""" Wrapper around os.listdir but via ssh connection """
stats = self.ftp.listdir_attr(*args, **kwargs)
for i in stats:
self.cached_stats[args[0] + "/" + i.filename] = i
files = map(lambda x: x.filename, stats)
return files
class MultiSite(Livestatus):
""" Wrapps around multiple Livesatus instances and aggregates the results
of queries.
Example:
>>> m = MultiSite()
>>> m.add_backend(path='/var/spool/nagios/livestatus.socket', name='local')
>>> m.add_backend(path='127.0.0.1:5992', name='remote')
"""
def __init__(self, *args, **kwargs):
super(MultiSite, self).__init__(*args, **kwargs)
self.backends = {}
def add_backend(self, path, name):
""" Add a new livestatus backend to this instance.
Arguments:
path (str): Path to file socket or remote address
name (str): Friendly shortname for this backend
"""
backend = Livestatus(
livestatus_socket_path=path,
nagios_cfg_file=self.nagios_cfg_file,
authuser=self.authuser
)
self.backends[name] = backend
def get_backends(self):
""" Returns a list of mk_livestatus instances
Returns:
list. List of mk_livestatus instances
"""
return self.backends
def get_backend(self, backend_name):
""" Return one specific backend that has previously been added
"""
if not backend_name:
return self.backends.values()[0]
try:
return self.backends[backend_name]
except KeyError:
raise ParserError("No backend found with name='%s'" % backend_name)
def query(self, query, *args, **kwargs):
""" Behaves like mk_livestatus.query() except results are aggregated from multiple backends
Arguments:
backend (str): If specified, fetch only data from this backend (see add_backend())
*args: Passed directly to mk_livestatus.query()
**kwargs: Passed directly to mk_livestatus.query()
"""
result = []
backend = kwargs.pop('backend', None)
# Special hack, if 'Stats' argument was provided to livestatus
# We have to maintain compatibility with old versions of livestatus
# and return single list with all results instead of a list of dicts
doing_stats = any(map(lambda x: x.startswith('Stats:'), args + (query,)))
# Iterate though all backends and run the query
# TODO: Make this multithreaded
for name, backend_instance in self.backends.items():
# Skip if a specific backend was requested and this is not it
if backend and backend != name:
continue
query_result = backend_instance.query(query, *args, **kwargs)
if doing_stats:
result = self._merge_statistics(result, query_result)
else:
for row in query_result:
row['backend'] = name
result.append(row)
return result
def _merge_statistics(self, list1, list2):
""" Merges multiple livestatus results into one result
Arguments:
list1 (list): List of integers
list2 (list): List of integers
Returns:
list. Aggregated results of list1 + list2
Example:
>>> result1 = [1,1,1,1]
>>> result2 = [2,2,2,2]
>>> MultiSite()._merge_statistics(result1, result2)
[3, 3, 3, 3]
"""
if not list1:
return list2
if not list2:
return list1
number_of_columns = len(list1)
result = [0] * number_of_columns
for row in (list1, list2):
for i, column in enumerate(row):
result[i] += column
return result
def get_host(self, host_name, backend=None):
""" Same as Livestatus.get_host() """
backend = self.get_backend(backend)
return backend.get_host(host_name)
def get_service(self, host_name, service_description, backend=None):
""" Same as Livestatus.get_service() """
backend = self.get_backend(backend)
return backend.get_service(host_name, service_description)
def get_contact(self, contact_name, backend=None):
""" Same as Livestatus.get_contact() """
backend = self.get_backend(backend)
return backend.get_contact(contact_name)
def get_contactgroup(self, contactgroup_name, backend=None):
""" Same as Livestatus.get_contact() """
backend = self.get_backend(backend)
return backend.get_contactgroup(contactgroup_name)
def get_servicegroup(self, servicegroup_name, backend=None):
""" Same as Livestatus.get_servicegroup() """
backend = self.get_backend(backend)
return backend.get_servicegroup(servicegroup_name)
def get_hostgroup(self, hostgroup_name, backend=None):
""" Same as Livestatus.get_hostgroup() """
backend = self.get_backend(backend)
return backend.get_hostgroup(hostgroup_name)
class config(Config):
""" This class is here only for backwards compatibility. Use Config instead. """
class mk_livestatus(Livestatus):
""" This class is here only for backwards compatibility. Use Livestatus instead. """
class object_cache(ObjectCache):
""" This class is here only for backwards compatibility. Use ObjectCache instead. """
class status(StatusDat):
""" This class is here only for backwards compatibility. Use StatusDat instead. """
class retention(RetentionDat):
""" This class is here only for backwards compatibility. Use RetentionDat instead. """
if __name__ == '__main__':
import time
start = time.time()
ssh = SshConfig(host='status.adagios.org', username='palli')
ssh.ssh.get_transport().window_size = 3 * 1024 * 1024
ssh.ssh.get_transport().use_compression()
# ssh.add_to_tar('/etc/nagios')
# sys.exit()
# ssh.ssh.exec_command("/bin/ls")
print "before reset"
ssh.parse()
end = time.time()
print "duration=", end - start
bland = ssh.tar.getmember('/etc/nagios/okconfig/hosts/web-servers/bland.is-http.cfg')
print bland.tobuf()
sys.exit(0)
print "ssh up"
ssh_conn = FastTransport(('status.adagios.org', 22))
ssh_conn.connect(username='palli')
ftp = paramiko.SFTPClient.from_transport(ssh_conn)
print "connected" \
""
ssh.ssh = ssh_conn
ssh.ftp = ftp
print "starting parse"
print "done parsing"
| Java |
/*
FILE
tTemplate source code of unxsISP.cgi
Built by mysqlRAD2.cgi (C) Gary Wallis and Hugo Urquiza 2001-2009
svn ID removed
PURPOSE
Schema dependent RAD generated file.
Program app functionality in ttemplatefunc.h while
RAD is still to be used.
*/
#include "mysqlrad.h"
//Table Variables
//Table Variables
//uTemplate: Primary Key
static unsigned uTemplate=0;
//cLabel: Short label
static char cLabel[33]={""};
//uTemplateSet: Short label
static unsigned uTemplateSet=0;
static char cuTemplateSetPullDown[256]={""};
//uTemplateType: Short label
static unsigned uTemplateType=0;
static char cuTemplateTypePullDown[256]={""};
//cComment: About the template
static char *cComment={""};
//cTemplate: Template itself
static char *cTemplate={""};
//uOwner: Record owner
static unsigned uOwner=0;
//uCreatedBy: uClient for last insert
static unsigned uCreatedBy=0;
#define ISM3FIELDS
//uCreatedDate: Unix seconds date last insert
static time_t uCreatedDate=0;
//uModBy: uClient for last update
static unsigned uModBy=0;
//uModDate: Unix seconds date last update
static time_t uModDate=0;
#define VAR_LIST_tTemplate "tTemplate.uTemplate,tTemplate.cLabel,tTemplate.uTemplateSet,tTemplate.uTemplateType,tTemplate.cComment,tTemplate.cTemplate,tTemplate.uOwner,tTemplate.uCreatedBy,tTemplate.uCreatedDate,tTemplate.uModBy,tTemplate.uModDate"
//Local only
void Insert_tTemplate(void);
void Update_tTemplate(char *cRowid);
void ProcesstTemplateListVars(pentry entries[], int x);
//In tTemplatefunc.h file included below
void ExtProcesstTemplateVars(pentry entries[], int x);
void ExttTemplateCommands(pentry entries[], int x);
void ExttTemplateButtons(void);
void ExttTemplateNavBar(void);
void ExttTemplateGetHook(entry gentries[], int x);
void ExttTemplateSelect(void);
void ExttTemplateSelectRow(void);
void ExttTemplateListSelect(void);
void ExttTemplateListFilter(void);
void ExttTemplateAuxTable(void);
#include "ttemplatefunc.h"
//Table Variables Assignment Function
void ProcesstTemplateVars(pentry entries[], int x)
{
register int i;
for(i=0;i<x;i++)
{
if(!strcmp(entries[i].name,"uTemplate"))
sscanf(entries[i].val,"%u",&uTemplate);
else if(!strcmp(entries[i].name,"cLabel"))
sprintf(cLabel,"%.32s",entries[i].val);
else if(!strcmp(entries[i].name,"uTemplateSet"))
sscanf(entries[i].val,"%u",&uTemplateSet);
else if(!strcmp(entries[i].name,"cuTemplateSetPullDown"))
{
sprintf(cuTemplateSetPullDown,"%.255s",entries[i].val);
uTemplateSet=ReadPullDown("tTemplateSet","cLabel",cuTemplateSetPullDown);
}
else if(!strcmp(entries[i].name,"uTemplateType"))
sscanf(entries[i].val,"%u",&uTemplateType);
else if(!strcmp(entries[i].name,"cuTemplateTypePullDown"))
{
sprintf(cuTemplateTypePullDown,"%.255s",entries[i].val);
uTemplateType=ReadPullDown("tTemplateType","cLabel",cuTemplateTypePullDown);
}
else if(!strcmp(entries[i].name,"cComment"))
cComment=entries[i].val;
else if(!strcmp(entries[i].name,"cTemplate"))
cTemplate=entries[i].val;
else if(!strcmp(entries[i].name,"uOwner"))
sscanf(entries[i].val,"%u",&uOwner);
else if(!strcmp(entries[i].name,"uCreatedBy"))
sscanf(entries[i].val,"%u",&uCreatedBy);
else if(!strcmp(entries[i].name,"uCreatedDate"))
sscanf(entries[i].val,"%lu",&uCreatedDate);
else if(!strcmp(entries[i].name,"uModBy"))
sscanf(entries[i].val,"%u",&uModBy);
else if(!strcmp(entries[i].name,"uModDate"))
sscanf(entries[i].val,"%lu",&uModDate);
}
//After so we can overwrite form data if needed.
ExtProcesstTemplateVars(entries,x);
}//ProcesstTemplateVars()
void ProcesstTemplateListVars(pentry entries[], int x)
{
register int i;
for(i=0;i<x;i++)
{
if(!strncmp(entries[i].name,"ED",2))
{
sscanf(entries[i].name+2,"%u",&uTemplate);
guMode=2002;
tTemplate("");
}
}
}//void ProcesstTemplateListVars(pentry entries[], int x)
int tTemplateCommands(pentry entries[], int x)
{
ProcessControlVars(entries,x);
ExttTemplateCommands(entries,x);
if(!strcmp(gcFunction,"tTemplateTools"))
{
if(!strcmp(gcFind,LANG_NB_LIST))
{
tTemplateList();
}
//Default
ProcesstTemplateVars(entries,x);
tTemplate("");
}
else if(!strcmp(gcFunction,"tTemplateList"))
{
ProcessControlVars(entries,x);
ProcesstTemplateListVars(entries,x);
tTemplateList();
}
return(0);
}//tTemplateCommands()
void tTemplate(const char *cResult)
{
MYSQL_RES *res;
MYSQL_RES *res2;
MYSQL_ROW field;
//Internal skip reloading
if(!cResult[0])
{
if(guMode)
ExttTemplateSelectRow();
else
ExttTemplateSelect();
mysql_query(&gMysql,gcQuery);
if(mysql_errno(&gMysql))
{
if(strstr(mysql_error(&gMysql)," doesn't exist"))
{
CreatetTemplate();
unxsISP("New tTemplate table created");
}
else
{
htmlPlainTextError(mysql_error(&gMysql));
}
}
res=mysql_store_result(&gMysql);
if((guI=mysql_num_rows(res)))
{
if(guMode==6)
{
sprintf(gcQuery,"SELECT _rowid FROM tTemplate WHERE uTemplate=%u"
,uTemplate);
mysql_query(&gMysql,gcQuery);
res2=mysql_store_result(&gMysql);
field=mysql_fetch_row(res2);
sscanf(field[0],"%lu",&gluRowid);
gluRowid++;
}
PageMachine("",0,"");
if(!guMode) mysql_data_seek(res,gluRowid-1);
field=mysql_fetch_row(res);
sscanf(field[0],"%u",&uTemplate);
sprintf(cLabel,"%.32s",field[1]);
sscanf(field[2],"%u",&uTemplateSet);
sscanf(field[3],"%u",&uTemplateType);
cComment=field[4];
cTemplate=field[5];
sscanf(field[6],"%u",&uOwner);
sscanf(field[7],"%u",&uCreatedBy);
sscanf(field[8],"%lu",&uCreatedDate);
sscanf(field[9],"%u",&uModBy);
sscanf(field[10],"%lu",&uModDate);
}
}//Internal Skip
Header_ism3(":: tTemplate",1);
printf("<table width=100%% cellspacing=0 cellpadding=0>\n");
printf("<tr><td colspan=2 align=right valign=center>");
printf("<input type=hidden name=gcFunction value=tTemplateTools>");
printf("<input type=hidden name=gluRowid value=%lu>",gluRowid);
if(guI)
{
if(guMode==6)
//printf(" Found");
printf(LANG_NBR_FOUND);
else if(guMode==5)
//printf(" Modified");
printf(LANG_NBR_MODIFIED);
else if(guMode==4)
//printf(" New");
printf(LANG_NBR_NEW);
printf(LANG_NBRF_SHOWING,gluRowid,guI);
}
else
{
if(!cResult[0])
//printf(" No records found");
printf(LANG_NBR_NORECS);
}
if(cResult[0]) printf("%s",cResult);
printf("</td></tr>");
printf("<tr><td valign=top width=25%%>");
ExttTemplateButtons();
printf("</td><td valign=top>");
//
OpenFieldSet("tTemplate Record Data",100);
if(guMode==2000 || guMode==2002)
tTemplateInput(1);
else
tTemplateInput(0);
//
CloseFieldSet();
//Bottom table
printf("<tr><td colspan=2>");
ExttTemplateAuxTable();
Footer_ism3();
}//end of tTemplate();
void tTemplateInput(unsigned uMode)
{
//uTemplate
OpenRow(LANG_FL_tTemplate_uTemplate,"black");
printf("<input title='%s' type=text name=uTemplate value=%u size=16 maxlength=10 "
,LANG_FT_tTemplate_uTemplate,uTemplate);
if(guPermLevel>=20 && uMode)
{
printf("></td></tr>\n");
}
else
{
printf("disabled></td></tr>\n");
printf("<input type=hidden name=uTemplate value=%u >\n",uTemplate);
}
//cLabel
OpenRow(LANG_FL_tTemplate_cLabel,"black");
printf("<input title='%s' type=text name=cLabel value=\"%s\" size=40 maxlength=32 "
,LANG_FT_tTemplate_cLabel,EncodeDoubleQuotes(cLabel));
if(guPermLevel>=7 && uMode)
{
printf("></td></tr>\n");
}
else
{
printf("disabled></td></tr>\n");
printf("<input type=hidden name=cLabel value=\"%s\">\n",EncodeDoubleQuotes(cLabel));
}
//uTemplateSet
OpenRow(LANG_FL_tTemplate_uTemplateSet,"black");
if(guPermLevel>=7 && uMode)
tTablePullDown("tTemplateSet;cuTemplateSetPullDown","cLabel","cLabel",uTemplateSet,1);
else
tTablePullDown("tTemplateSet;cuTemplateSetPullDown","cLabel","cLabel",uTemplateSet,0);
//uTemplateType
OpenRow(LANG_FL_tTemplate_uTemplateType,"black");
if(guPermLevel>=7 && uMode)
tTablePullDown("tTemplateType;cuTemplateTypePullDown","cLabel","cLabel",uTemplateType,1);
else
tTablePullDown("tTemplateType;cuTemplateTypePullDown","cLabel","cLabel",uTemplateType,0);
//cComment
OpenRow(LANG_FL_tTemplate_cComment,"black");
printf("<textarea title='%s' cols=80 wrap=hard rows=16 name=cComment "
,LANG_FT_tTemplate_cComment);
if(guPermLevel>=7 && uMode)
{
printf(">%s</textarea></td></tr>\n",cComment);
}
else
{
printf("disabled>%s</textarea></td></tr>\n",cComment);
printf("<input type=hidden name=cComment value=\"%s\" >\n",EncodeDoubleQuotes(cComment));
}
//cTemplate
OpenRow(LANG_FL_tTemplate_cTemplate,"black");
printf("<textarea title='%s' cols=80 wrap=off rows=16 name=cTemplate "
,LANG_FT_tTemplate_cTemplate);
if(guPermLevel>=7 && uMode)
{
printf(">%s</textarea></td></tr>\n",cTemplate);
}
else
{
printf("disabled>%s</textarea></td></tr>\n",cTemplate);
printf("<input type=hidden name=cTemplate value=\"%s\" >\n",EncodeDoubleQuotes(cTemplate));
}
//uOwner
OpenRow(LANG_FL_tTemplate_uOwner,"black");
if(guPermLevel>=20 && uMode)
{
printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner);
}
else
{
printf("%s<input type=hidden name=uOwner value=%u >\n",ForeignKey(TCLIENT,"cLabel",uOwner),uOwner);
}
//uCreatedBy
OpenRow(LANG_FL_tTemplate_uCreatedBy,"black");
if(guPermLevel>=20 && uMode)
{
printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy);
}
else
{
printf("%s<input type=hidden name=uCreatedBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uCreatedBy),uCreatedBy);
}
//uCreatedDate
OpenRow(LANG_FL_tTemplate_uCreatedDate,"black");
if(uCreatedDate)
printf("%s\n\n",ctime(&uCreatedDate));
else
printf("---\n\n");
printf("<input type=hidden name=uCreatedDate value=%lu >\n",uCreatedDate);
//uModBy
OpenRow(LANG_FL_tTemplate_uModBy,"black");
if(guPermLevel>=20 && uMode)
{
printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy);
}
else
{
printf("%s<input type=hidden name=uModBy value=%u >\n",ForeignKey(TCLIENT,"cLabel",uModBy),uModBy);
}
//uModDate
OpenRow(LANG_FL_tTemplate_uModDate,"black");
if(uModDate)
printf("%s\n\n",ctime(&uModDate));
else
printf("---\n\n");
printf("<input type=hidden name=uModDate value=%lu >\n",uModDate);
printf("</tr>\n");
}//void tTemplateInput(unsigned uMode)
void NewtTemplate(unsigned uMode)
{
register int i=0;
MYSQL_RES *res;
sprintf(gcQuery,"SELECT uTemplate FROM tTemplate\
WHERE uTemplate=%u"
,uTemplate);
mysql_query(&gMysql,gcQuery);
if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
res=mysql_store_result(&gMysql);
i=mysql_num_rows(res);
if(i)
//tTemplate("<blink>Record already exists");
tTemplate(LANG_NBR_RECEXISTS);
//insert query
Insert_tTemplate();
if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
//sprintf(gcQuery,"New record %u added");
uTemplate=mysql_insert_id(&gMysql);
#ifdef ISM3FIELDS
uCreatedDate=luGetCreatedDate("tTemplate",uTemplate);
unxsISPLog(uTemplate,"tTemplate","New");
#endif
if(!uMode)
{
sprintf(gcQuery,LANG_NBR_NEWRECADDED,uTemplate);
tTemplate(gcQuery);
}
}//NewtTemplate(unsigned uMode)
void DeletetTemplate(void)
{
#ifdef ISM3FIELDS
sprintf(gcQuery,"DELETE FROM tTemplate WHERE uTemplate=%u AND ( uOwner=%u OR %u>9 )"
,uTemplate,guLoginClient,guPermLevel);
#else
sprintf(gcQuery,"DELETE FROM tTemplate WHERE uTemplate=%u"
,uTemplate);
#endif
mysql_query(&gMysql,gcQuery);
if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
//tTemplate("Record Deleted");
if(mysql_affected_rows(&gMysql)>0)
{
#ifdef ISM3FIELDS
unxsISPLog(uTemplate,"tTemplate","Del");
#endif
tTemplate(LANG_NBR_RECDELETED);
}
else
{
#ifdef ISM3FIELDS
unxsISPLog(uTemplate,"tTemplate","DelError");
#endif
tTemplate(LANG_NBR_RECNOTDELETED);
}
}//void DeletetTemplate(void)
void Insert_tTemplate(void)
{
//insert query
sprintf(gcQuery,"INSERT INTO tTemplate SET uTemplate=%u,cLabel='%s',uTemplateSet=%u,uTemplateType=%u,cComment='%s',cTemplate='%s',uOwner=%u,uCreatedBy=%u,uCreatedDate=UNIX_TIMESTAMP(NOW())",
uTemplate
,TextAreaSave(cLabel)
,uTemplateSet
,uTemplateType
,TextAreaSave(cComment)
,TextAreaSave(cTemplate)
,uOwner
,uCreatedBy
);
mysql_query(&gMysql,gcQuery);
}//void Insert_tTemplate(void)
void Update_tTemplate(char *cRowid)
{
//update query
sprintf(gcQuery,"UPDATE tTemplate SET uTemplate=%u,cLabel='%s',uTemplateSet=%u,uTemplateType=%u,cComment='%s',cTemplate='%s',uModBy=%u,uModDate=UNIX_TIMESTAMP(NOW()) WHERE _rowid=%s",
uTemplate
,TextAreaSave(cLabel)
,uTemplateSet
,uTemplateType
,TextAreaSave(cComment)
,TextAreaSave(cTemplate)
,uModBy
,cRowid);
mysql_query(&gMysql,gcQuery);
}//void Update_tTemplate(void)
void ModtTemplate(void)
{
register int i=0;
MYSQL_RES *res;
MYSQL_ROW field;
#ifdef ISM3FIELDS
unsigned uPreModDate=0;
sprintf(gcQuery,"SELECT uTemplate,uModDate FROM tTemplate WHERE uTemplate=%u"
,uTemplate);
#else
sprintf(gcQuery,"SELECT uTemplate FROM tTemplate\
WHERE uTemplate=%u"
,uTemplate);
#endif
mysql_query(&gMysql,gcQuery);
if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
res=mysql_store_result(&gMysql);
i=mysql_num_rows(res);
//if(i<1) tTemplate("<blink>Record does not exist");
if(i<1) tTemplate(LANG_NBR_RECNOTEXIST);
//if(i>1) tTemplate("<blink>Multiple rows!");
if(i>1) tTemplate(LANG_NBR_MULTRECS);
field=mysql_fetch_row(res);
#ifdef ISM3FIELDS
sscanf(field[1],"%u",&uPreModDate);
if(uPreModDate!=uModDate) tTemplate(LANG_NBR_EXTMOD);
#endif
Update_tTemplate(field[0]);
if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
//sprintf(query,"record %s modified",field[0]);
sprintf(gcQuery,LANG_NBRF_REC_MODIFIED,field[0]);
#ifdef ISM3FIELDS
uModDate=luGetModDate("tTemplate",uTemplate);
unxsISPLog(uTemplate,"tTemplate","Mod");
#endif
tTemplate(gcQuery);
}//ModtTemplate(void)
void tTemplateList(void)
{
MYSQL_RES *res;
MYSQL_ROW field;
ExttTemplateListSelect();
mysql_query(&gMysql,gcQuery);
if(mysql_error(&gMysql)[0]) htmlPlainTextError(mysql_error(&gMysql));
res=mysql_store_result(&gMysql);
guI=mysql_num_rows(res);
PageMachine("tTemplateList",1,"");//1 is auto header list guMode. Opens table!
//Filter select drop down
ExttTemplateListFilter();
printf("<input type=text size=16 name=gcCommand maxlength=98 value=\"%s\" >",gcCommand);
printf("</table>\n");
printf("<table bgcolor=#9BC1B3 border=0 width=100%%>\n");
printf("<tr bgcolor=black><td><font face=arial,helvetica color=white>uTemplate<td><font face=arial,helvetica color=white>cLabel<td><font face=arial,helvetica color=white>uTemplateSet<td><font face=arial,helvetica color=white>uTemplateType<td><font face=arial,helvetica color=white>cComment<td><font face=arial,helvetica color=white>cTemplate<td><font face=arial,helvetica color=white>uOwner<td><font face=arial,helvetica color=white>uCreatedBy<td><font face=arial,helvetica color=white>uCreatedDate<td><font face=arial,helvetica color=white>uModBy<td><font face=arial,helvetica color=white>uModDate</tr>");
mysql_data_seek(res,guStart-1);
for(guN=0;guN<(guEnd-guStart+1);guN++)
{
field=mysql_fetch_row(res);
if(!field)
{
printf("<tr><td><font face=arial,helvetica>End of data</table>");
Footer_ism3();
}
if(guN % 2)
printf("<tr bgcolor=#BBE1D3>");
else
printf("<tr>");
time_t luTime8=strtoul(field[8],NULL,10);
char cBuf8[32];
if(luTime8)
ctime_r(&luTime8,cBuf8);
else
sprintf(cBuf8,"---");
time_t luTime10=strtoul(field[10],NULL,10);
char cBuf10[32];
if(luTime10)
ctime_r(&luTime10,cBuf10);
else
sprintf(cBuf10,"---");
printf("<td><input type=submit name=ED%s value=Edit> %s<td>%s<td>%s<td>%s<td><textarea disabled>%s</textarea><td><textarea disabled>%s</textarea><td>%s<td>%s<td>%s<td>%s<td>%s</tr>"
,field[0]
,field[0]
,field[1]
,ForeignKey("tTemplateSet","cLabel",strtoul(field[2],NULL,10))
,ForeignKey("tTemplateType","cLabel",strtoul(field[3],NULL,10))
,field[4]
,field[5]
,ForeignKey(TCLIENT,"cLabel",strtoul(field[6],NULL,10))
,ForeignKey(TCLIENT,"cLabel",strtoul(field[7],NULL,10))
,cBuf8
,ForeignKey(TCLIENT,"cLabel",strtoul(field[9],NULL,10))
,cBuf10
);
}
printf("</table></form>\n");
Footer_ism3();
}//tTemplateList()
void CreatetTemplate(void)
{
sprintf(gcQuery,"CREATE TABLE IF NOT EXISTS tTemplate ( uTemplate INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, cLabel VARCHAR(32) NOT NULL DEFAULT '', uOwner INT UNSIGNED NOT NULL DEFAULT 0,index (uOwner), uCreatedBy INT UNSIGNED NOT NULL DEFAULT 0, uCreatedDate INT UNSIGNED NOT NULL DEFAULT 0, uModBy INT UNSIGNED NOT NULL DEFAULT 0, uModDate INT UNSIGNED NOT NULL DEFAULT 0, cComment TEXT NOT NULL DEFAULT '', cTemplate TEXT NOT NULL DEFAULT '', uTemplateSet INT UNSIGNED NOT NULL DEFAULT 0, uTemplateType INT UNSIGNED NOT NULL DEFAULT 0 )");
mysql_query(&gMysql,gcQuery);
if(mysql_errno(&gMysql))
htmlPlainTextError(mysql_error(&gMysql));
}//CreatetTemplate()
| Java |
<?php
/**
* also_purchased_products.php
*
* @package modules
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: also_purchased_products.php 5369 2006-12-23 10:55:52Z drbyte $
* Modified by Anne (Picaflor-Azul.com) Dover Fine v1.0
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (isset($_GET['products_id']) && SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS > 0 && MIN_DISPLAY_ALSO_PURCHASED > 0) {
$also_purchased_products = $db->Execute(sprintf(SQL_ALSO_PURCHASED, (int)$_GET['products_id'], (int)$_GET['products_id']));
$num_products_ordered = $also_purchased_products->RecordCount();
$row = 0;
$col = 0;
$list_box_contents = array();
$title = '';
// show only when 1 or more and equal to or greater than minimum set in admin
if ($num_products_ordered >= MIN_DISPLAY_ALSO_PURCHASED && $num_products_ordered > 0) {
if ($num_products_ordered < SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS) {
$col_width = floor(100/$num_products_ordered);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS);
}
while (!$also_purchased_products->EOF) {
$also_purchased_products->fields['products_name'] = zen_get_products_name($also_purchased_products->fields['products_id']);
$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsAlsoPurch"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($also_purchased_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($also_purchased_products->fields['products_id']), 'products_id=' . $also_purchased_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $also_purchased_products->fields['products_image'], $also_purchased_products->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><h3 class="itemTitle">') . '<a href="' . zen_href_link(zen_get_info_page($also_purchased_products->fields['products_id']), 'products_id=' . $also_purchased_products->fields['products_id']) . '">' . $also_purchased_products->fields['products_name'] . '</a></h3>');
$col ++;
if ($col > (SHOW_PRODUCT_INFO_COLUMNS_ALSO_PURCHASED_PRODUCTS - 1)) {
$col = 0;
$row ++;
}
$also_purchased_products->MoveNext();
}
}
if ($also_purchased_products->RecordCount() > 0 && $also_purchased_products->RecordCount() >= MIN_DISPLAY_ALSO_PURCHASED) {
$title = '<h2 class="centerBoxHeading">' . TEXT_ALSO_PURCHASED_PRODUCTS . '</h2>';
$zc_show_also_purchased = true;
}
}
?> | Java |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Css\PreProcessor\File\FileList;
use Magento\Framework\View\File\FileList\CollateInterface;
/**
* File list collator
*/
class Collator implements CollateInterface
{
/**
* Collate source files
*
* @param \Magento\Framework\View\File[] $files
* @param \Magento\Framework\View\File[] $filesOrigin
* @return \Magento\Framework\View\File[]
*/
public function collate($files, $filesOrigin)
{
foreach ($files as $file) {
$fileId = substr($file->getFileIdentifier(), strpos($file->getFileIdentifier(), '|'));
foreach (array_keys($filesOrigin) as $identifier) {
if (false !== strpos($identifier, $fileId)) {
unset($filesOrigin[$identifier]);
}
}
$filesOrigin[$file->getFileIdentifier()] = $file;
}
return $filesOrigin;
}
}
| Java |
package org.lastbamboo.common.util.mina.decode.binary;
import org.littleshoot.mina.common.ByteBuffer;
import org.littleshoot.mina.filter.codec.ProtocolDecoderOutput;
import org.littleshoot.util.mina.DecodingState;
/**
* Decoding state for reading a single unsigned int.
*/
public abstract class UnsignedIntDecodingState implements DecodingState
{
public DecodingState decode(final ByteBuffer in,
final ProtocolDecoderOutput out) throws Exception
{
if (in.remaining() > 3)
{
final long decoded = in.getUnsignedInt();
return finishDecode(decoded, out);
}
else
{
return this;
}
}
/**
* Called on the subclass when the unsigned int has been successfully
* decoded.
*
* @param decodedShort The decoded unsigned int.
* @param out The decoder output.
* @return The next state.
* @throws Exception If any unexpected error occurs.
*/
protected abstract DecodingState finishDecode(final long decodedShort,
final ProtocolDecoderOutput out) throws Exception;
}
| Java |
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2011-2012 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2012 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* OpenNMS(R) is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.config.datacollection;
import java.io.Reader;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.exolab.castor.xml.Validator;
import org.opennms.core.xml.ValidateUsing;
/**
* a MIB object
*
* @version $Revision$ $Date$
*/
@XmlRootElement(name="mibObj", namespace="http://xmlns.opennms.org/xsd/config/datacollection")
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(propOrder={"oid", "instance", "alias", "type", "maxval", "minval"})
@ValidateUsing("datacollection-config.xsd")
public class MibObj implements java.io.Serializable {
private static final long serialVersionUID = -7831201614734695268L;
/**
* object identifier
*/
private String m_oid;
/**
* instance identifier. Only valid instance identifier
* values are a positive integer value or the keyword
* "ifIndex" which
* indicates that the ifIndex of the interface is to be
* substituted for
* the instance value for each interface the oid is retrieved
* for.
*/
private String m_instance;
/**
* a human readable name for the object (such as
* "ifOctetsIn"). NOTE: This value is used as the RRD file
* name and
* data source name. RRD only supports data source names up to
* 19 chars
* in length. If the SNMP data collector encounters an alias
* which
* exceeds 19 characters it will be truncated.
*/
private String m_alias;
/**
* SNMP data type SNMP supported types: counter, gauge,
* timeticks, integer, octetstring, string. The SNMP type is
* mapped to
* one of two RRD supported data types COUNTER or GAUGE, or
* the
* string.properties file. The mapping is as follows: SNMP
* counter
* -> RRD COUNTER; SNMP gauge, timeticks, integer, octetstring
* ->
* RRD GAUGE; SNMP string -> String properties file
*/
private String m_type;
/**
* Maximum Value. In order to correctly manage counter
* wraps, it is possible to add a maximum value for a
* collection. For
* example, a 32-bit counter would have a max value of
* 4294967295.
*/
private String m_maxval;
/**
* Minimum Value. For completeness, adding the ability
* to use a minimum value.
*/
private String m_minval;
public MibObj() {
super();
}
public MibObj(final String oid, final String instance, final String alias, final String type) {
super();
m_oid = oid;
m_instance = instance;
m_alias = alias;
m_type = type;
}
/**
* Overrides the java.lang.Object.equals method.
*
* @param obj
* @return true if the objects are equal.
*/
@Override()
public boolean equals(final java.lang.Object obj) {
if ( this == obj )
return true;
if (obj instanceof MibObj) {
final MibObj temp = (MibObj)obj;
if (m_oid != null) {
if (temp.m_oid == null) return false;
else if (!(m_oid.equals(temp.m_oid)))
return false;
}
else if (temp.m_oid != null)
return false;
if (m_instance != null) {
if (temp.m_instance == null) return false;
else if (!(m_instance.equals(temp.m_instance)))
return false;
}
else if (temp.m_instance != null)
return false;
if (m_alias != null) {
if (temp.m_alias == null) return false;
else if (!(m_alias.equals(temp.m_alias)))
return false;
}
else if (temp.m_alias != null)
return false;
if (m_type != null) {
if (temp.m_type == null) return false;
else if (!(m_type.equals(temp.m_type)))
return false;
}
else if (temp.m_type != null)
return false;
if (m_maxval != null) {
if (temp.m_maxval == null) return false;
else if (!(m_maxval.equals(temp.m_maxval)))
return false;
}
else if (temp.m_maxval != null)
return false;
if (m_minval != null) {
if (temp.m_minval == null) return false;
else if (!(m_minval.equals(temp.m_minval)))
return false;
}
else if (temp.m_minval != null)
return false;
return true;
}
return false;
}
/**
* Returns the value of field 'alias'. The field 'alias' has
* the following description: a human readable name for the
* object (such as
* "ifOctetsIn"). NOTE: This value is used as the RRD file
* name and
* data source name. RRD only supports data source names up to
* 19 chars
* in length. If the SNMP data collector encounters an alias
* which
* exceeds 19 characters it will be truncated.
*
* @return the value of field 'Alias'.
*/
@XmlAttribute(name="alias", required=true)
public String getAlias() {
return m_alias;
}
/**
* Returns the value of field 'instance'. The field 'instance'
* has the following description: instance identifier. Only
* valid instance identifier
* values are a positive integer value or the keyword
* "ifIndex" which
* indicates that the ifIndex of the interface is to be
* substituted for
* the instance value for each interface the oid is retrieved
* for.
*
* @return the value of field 'Instance'.
*/
@XmlAttribute(name="instance", required=true)
public String getInstance() {
return m_instance;
}
/**
* Returns the value of field 'maxval'. The field 'maxval' has
* the following description: Maximum Value. In order to
* correctly manage counter
* wraps, it is possible to add a maximum value for a
* collection. For
* example, a 32-bit counter would have a max value of
* 4294967295.
*
* @return the value of field 'Maxval'.
*/
@XmlAttribute(name="maxval", required=false)
public String getMaxval() {
return m_maxval;
}
/**
* Returns the value of field 'minval'. The field 'minval' has
* the following description: Minimum Value. For completeness,
* adding the ability
* to use a minimum value.
*
* @return the value of field 'Minval'.
*/
@XmlAttribute(name="minval", required=false)
public String getMinval() {
return m_minval;
}
/**
* Returns the value of field 'oid'. The field 'oid' has the
* following description: object identifier
*
* @return the value of field 'Oid'.
*/
@XmlAttribute(name="oid", required=true)
public String getOid() {
return m_oid;
}
/**
* Returns the value of field 'type'. The field 'type' has the
* following description: SNMP data type SNMP supported types:
* counter, gauge,
* timeticks, integer, octetstring, string. The SNMP type is
* mapped to
* one of two RRD supported data types COUNTER or GAUGE, or
* the
* string.properties file. The mapping is as follows: SNMP
* counter
* -> RRD COUNTER; SNMP gauge, timeticks, integer, octetstring
* ->
* RRD GAUGE; SNMP string -> String properties file
*
* @return the value of field 'Type'.
*/
@XmlAttribute(name="type", required=true)
public String getType() {
return m_type;
}
/**
* Overrides the java.lang.Object.hashCode method.
* <p>
* The following steps came from <b>Effective Java Programming
* Language Guide</b> by Joshua Bloch, Chapter 3
*
* @return a hash code value for the object.
*/
public int hashCode() {
int result = 17;
if (m_oid != null) {
result = 37 * result + m_oid.hashCode();
}
if (m_instance != null) {
result = 37 * result + m_instance.hashCode();
}
if (m_alias != null) {
result = 37 * result + m_alias.hashCode();
}
if (m_type != null) {
result = 37 * result + m_type.hashCode();
}
if (m_maxval != null) {
result = 37 * result + m_maxval.hashCode();
}
if (m_minval != null) {
result = 37 * result + m_minval.hashCode();
}
return result;
}
/**
* Method isValid.
*
* @return true if this object is valid according to the schema
*/
@Deprecated
public boolean isValid() {
try {
validate();
} catch (ValidationException vex) {
return false;
}
return true;
}
/**
*
*
* @param out
* @throws MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws ValidationException if this
* object is an invalid instance according to the schema
*/
@Deprecated
public void marshal(final java.io.Writer out)
throws MarshalException, ValidationException {
Marshaller.marshal(this, out);
}
/**
*
*
* @param handler
* @throws java.io.IOException if an IOException occurs during
* marshaling
* @throws ValidationException if this
* object is an invalid instance according to the schema
* @throws MarshalException if object is
* null or if any SAXException is thrown during marshaling
*/
@Deprecated
public void marshal(final org.xml.sax.ContentHandler handler)
throws java.io.IOException, MarshalException, ValidationException {
Marshaller.marshal(this, handler);
}
/**
* Sets the value of field 'alias'. The field 'alias' has the
* following description: a human readable name for the object
* (such as
* "ifOctetsIn"). NOTE: This value is used as the RRD file
* name and
* data source name. RRD only supports data source names up to
* 19 chars
* in length. If the SNMP data collector encounters an alias
* which
* exceeds 19 characters it will be truncated.
*
* @param alias the value of field 'alias'.
*/
public void setAlias(final String alias) {
m_alias = alias.intern();
}
/**
* Sets the value of field 'instance'. The field 'instance' has
* the following description: instance identifier. Only valid
* instance identifier
* values are a positive integer value or the keyword
* "ifIndex" which
* indicates that the ifIndex of the interface is to be
* substituted for
* the instance value for each interface the oid is retrieved
* for.
*
* @param instance the value of field 'instance'.
*/
public void setInstance(final String instance) {
m_instance = instance.intern();
}
/**
* Sets the value of field 'maxval'. The field 'maxval' has the
* following description: Maximum Value. In order to correctly
* manage counter
* wraps, it is possible to add a maximum value for a
* collection. For
* example, a 32-bit counter would have a max value of
* 4294967295.
*
* @param maxval the value of field 'maxval'.
*/
public void setMaxval(final String maxval) {
m_maxval = maxval.intern();
}
/**
* Sets the value of field 'minval'. The field 'minval' has the
* following description: Minimum Value. For completeness,
* adding the ability
* to use a minimum value.
*
* @param minval the value of field 'minval'.
*/
public void setMinval(final String minval) {
m_minval = minval.intern();
}
/**
* Sets the value of field 'oid'. The field 'oid' has the
* following description: object identifier
*
* @param oid the value of field 'oid'.
*/
public void setOid(final String oid) {
m_oid = oid.intern();
}
/**
* Sets the value of field 'type'. The field 'type' has the
* following description: SNMP data type SNMP supported types:
* counter, gauge,
* timeticks, integer, octetstring, string. The SNMP type is
* mapped to
* one of two RRD supported data types COUNTER or GAUGE, or
* the
* string.properties file. The mapping is as follows: SNMP
* counter
* -> RRD COUNTER; SNMP gauge, timeticks, integer, octetstring
* ->
* RRD GAUGE; SNMP string -> String properties file
*
* @param type the value of field 'type'.
*/
public void setType(final String type) {
m_type = type.intern();
}
/**
* Method unmarshal.
*
* @param reader
* @throws MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws ValidationException if this
* object is an invalid instance according to the schema
* @return the unmarshaled
* MibObj
*/
@Deprecated
public static MibObj unmarshal(final Reader reader) throws MarshalException, ValidationException {
return (MibObj)Unmarshaller.unmarshal(MibObj.class, reader);
}
/**
*
*
* @throws ValidationException if this
* object is an invalid instance according to the schema
*/
public void validate() throws ValidationException {
Validator validator = new Validator();
validator.validate(this);
}
}
| Java |
<?php
/**
* @author Antonio Durán Terrés
* @package Joomdle
* @license GNU/GPL
*
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// Import Joomla! libraries
jimport( 'joomla.application.component.view');
require_once( JPATH_COMPONENT.'/helpers/content.php' );
require_once( JPATH_COMPONENT.'/helpers/profiletypes.php' );
class JoomdleViewCustomprofiletypes extends JViewLegacy {
protected $items;
protected $pagination;
protected $state;
function display($tpl = null) {
$mainframe = JFactory::getApplication();
$params = JComponentHelper::getParams( 'com_joomdle' );
$this->sidebar = JHtmlSidebar::render();
if (!$params->get( 'use_profiletypes' ))
{
JToolbarHelper::title(JText::_('COM_JOOMDLE_VIEW_PROFILETYPES_TITLE'), 'customprofiletypes');
$this->message = JText::_('COM_JOOMDLE_PROFILE_TYPES_INTEGRATION_NOT_ENABLED');
$tpl = "disabled";
parent::display($tpl);
return;
}
/* List of profiletypes */
$this->profiletypes = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->addToolbar();
parent::display($tpl);
}
protected function addToolbar()
{
JToolbarHelper::title(JText::_('COM_JOOMDLE_VIEW_PROFILETYPES_TITLE'), 'customprofiletypes');
JToolBarHelper::custom( 'create_profiletype_on_moodle', 'publish', 'publish', 'COM_JOOMDLE_CREATE_ON_MOODLE', true, false );
JToolBarHelper::custom( 'dont_create_profiletype_on_moodle', 'unpublish', 'unpublish', 'COM_JOOMDLE_NOT_CREATE_ON_MOODLE', true, false );
JHtmlSidebar::setAction('index.php?option=com_joomdle&view=customprofiletypes');
JHtmlSidebar::addFilter(
JText::_('COM_JOOMDLE_SELECT_STATE'),
'filter_state',
JHtml::_('select.options', JoomdleHelperProfiletypes::getStateOptions(), 'value', 'text', $this->state->get('filter.state'))
);
}
}
?>
| Java |
/*
* CUnit - A Unit testing framework library for C.
* Copyright (C) 2004-2006 Jerry St.Clair
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Support for unit tests of CUnit framework
*
* 12-Aug-2004 Initial implementation. (JDS)
*
* 02-May-2006 Added internationalization hooks. (JDS)
*/
/** @file
* CUnit internal testingfunctions (implementation).
*/
/** @addtogroup Internal
@{
*/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "../../Headers/CUnit.h"
#include "../../Headers/MyMem.h"
#include "../../Headers/Util.h"
#include "../../Headers/CUnit_intl.h"
#include "test_cunit.h"
static unsigned int f_nTests = 0;
static unsigned int f_nFailures = 0;
static unsigned int f_nTests_stored = 0;
static unsigned int f_nFails_stored = 0;
static clock_t f_start_time;
static void test_cunit_initialize(void);
static void test_cunit_report_results(void);
int main()
{
/* No line buffering. */
setbuf(stdout, NULL);
test_cunit_initialize();
fprintf(stdout, "\n%s", _("Testing CUnit internals..."));
/* individual module test functions go here */
test_cunit_CUError();
test_cunit_MyMem();
test_cunit_TestDB();
test_cunit_TestRun();
test_cunit_Util();
test_cunit_report_results();
CU_cleanup_registry();
return 0;
}
void test_cunit_start_tests(const char* strName)
{
fprintf(stdout, _("\n testing %s ... "), strName);
f_nTests_stored = f_nTests;
f_nFails_stored = f_nFailures;
}
void test_cunit_end_tests(void)
{
fprintf(stdout, _("%d assertions, %d failures"),
f_nTests - f_nTests_stored,
f_nFailures - f_nFails_stored);
}
void test_cunit_add_test(void)
{
++f_nTests;
}
void test_cunit_add_failure(void)
{
++f_nFailures;
}
unsigned int test_cunit_test_count(void)
{
return f_nTests;
}
unsigned int test_cunit_failure_count(void)
{
return f_nFailures;
}
void test_cunit_initialize(void)
{
f_nTests = 0;
f_nFailures = 0;
f_start_time = clock();
}
void test_cunit_report_results(void)
{
fprintf(stdout,
"\n\n---------------------------"
"\n%s"
"\n---------------------------"
"\n %s%d"
"\n %s%d"
"\n %s%d"
"\n\n%s%8.3f%s\n",
_("CUnit Internal Test Results"),
_("Total Number of Assertions: "),
f_nTests,
_("Successes: "),
f_nTests-f_nFailures,
_("Failures: "),
f_nFailures,
_("Total test time = "),
((double)clock() - (double)f_start_time)/(double)CLOCKS_PER_SEC,
_(" seconds."));
}
CU_BOOL test_cunit_assert_impl(CU_BOOL value,
const char* condition,
const char* file,
unsigned int line)
{
test_cunit_add_test();
if (CU_FALSE == value) {
test_cunit_add_failure();
printf(_("\nTEST FAILED: File '%s', Line %d, Condition '%s.'\n"),
file, line, condition);
}
return value;
}
| Java |
/*
File: pdisksel.h
Copyright (C) 2014 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _PDISKSEL_H
#define _PDISKSEL_H
#ifdef __cplusplus
extern "C" {
#endif
/*@
@ requires valid_read_string(cmd_device);
@ requires \valid_read(list_disk);
@ requires valid_disk(list_disk->disk);
@ requires \valid(list_search_space);
@ requires \separated(cmd_device, list_disk, list_search_space);
@ ensures valid_disk(\result);
@*/
disk_t *photorec_disk_selection_cli(const char *cmd_device, const list_disk_t *list_disk, alloc_data_t *list_search_space);
#ifdef __cplusplus
} /* closing brace for extern "C" */
#endif
#endif
| Java |
/***************************************************************************
* Copyright 2007 Robert Gruber <rgruber@users.sourceforge.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "test_cvs.h"
#include <QtTest/QtTest>
#include <QUrl>
#include <KIO/DeleteJob>
#include <cvsjob.h>
#include <cvsproxy.h>
#include <tests/autotestshell.h>
#include <tests/testcore.h>
#define CVSTEST_BASEDIR "/tmp/kdevcvs_testdir/"
#define CVS_REPO CVSTEST_BASEDIR "repo/"
#define CVS_IMPORT CVSTEST_BASEDIR "import/"
#define CVS_TESTFILE_NAME "testfile"
#define CVS_CHECKOUT CVSTEST_BASEDIR "working/"
// we need to add this since it is declared in cvsplugin.cpp which we don't compile here
Q_LOGGING_CATEGORY(PLUGIN_CVS, "kdevplatform.plugins.cvs")
void TestCvs::initTestCase()
{
KDevelop::AutoTestShell::init();
KDevelop::TestCore::initialize(KDevelop::Core::NoUi);
m_proxy = new CvsProxy;
// If the basedir for this cvs test exists from a
// previous run; remove it...
cleanup();
}
void TestCvs::cleanupTestCase()
{
KDevelop::TestCore::shutdown();
delete m_proxy;
}
void TestCvs::init()
{
// Now create the basic directory structure
QDir tmpdir("/tmp");
tmpdir.mkdir(CVSTEST_BASEDIR);
tmpdir.mkdir(CVS_REPO);
tmpdir.mkdir(CVS_IMPORT);
}
void TestCvs::cleanup()
{
if ( QFileInfo::exists(CVSTEST_BASEDIR) )
KIO::del(QUrl::fromLocalFile(QString(CVSTEST_BASEDIR)))->exec();
}
void TestCvs::repoInit()
{
// make job that creates the local repository
CvsJob* j = new CvsJob(0);
QVERIFY( j );
j->setDirectory(CVSTEST_BASEDIR);
*j << "cvs" << "-d" << CVS_REPO << "init";
// try to start the job
QVERIFY( j->exec() );
//check if the CVSROOT directory in the new local repository exists now
QVERIFY( QFileInfo::exists(QString(CVS_REPO "/CVSROOT")) );
}
void TestCvs::importTestData()
{
// create a file so we don't import an empty dir
QFile f(CVS_IMPORT "" CVS_TESTFILE_NAME);
if(f.open(QIODevice::WriteOnly)) {
QTextStream input( &f );
input << "HELLO WORLD";
}
f.flush();
CvsJob* j = m_proxy->import(QUrl::fromLocalFile(CVS_IMPORT), CVS_REPO,
"test", "vendor", "release",
"test import message");
QVERIFY( j );
// try to start the job
QVERIFY( j->exec() );
//check if the directory has been added to the repository
QString testdir(CVS_REPO "/test");
QVERIFY( QFileInfo::exists(testdir) );
//check if the file has been added to the repository
QString testfile(CVS_REPO "/test/" CVS_TESTFILE_NAME ",v");
QVERIFY( QFileInfo::exists(testfile) );
}
void TestCvs::checkoutTestData()
{
CvsJob* j = m_proxy->checkout(QUrl::fromLocalFile(CVS_CHECKOUT), CVS_REPO, "test");
QVERIFY( j );
// try to start the job
QVERIFY( j->exec() );
//check if the directory is there
QString testdir(CVS_CHECKOUT);
QVERIFY( QFileInfo::exists(testdir) );
//check if the file is there
QString testfile(CVS_CHECKOUT "" CVS_TESTFILE_NAME);
QVERIFY( QFileInfo::exists(testfile) );
}
void TestCvs::testInitAndImport()
{
repoInit();
importTestData();
checkoutTestData();
}
void TestCvs::testLogFolder()
{
repoInit();
importTestData();
checkoutTestData();
QString testdir(CVS_CHECKOUT);
KDevelop::VcsRevision rev = KDevelop::VcsRevision::createSpecialRevision(KDevelop::VcsRevision::Head);
CvsJob* job = m_proxy->log(QUrl::fromLocalFile(testdir), rev);
QVERIFY(job);
}
QTEST_MAIN(TestCvs)
| Java |
/*
Copyright (c) 2004 The Regents of the University of Michigan.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <unistd.h>
#include <dirent.h>
#include "gssd.h"
#include "err_util.h"
#include "nfslib.h"
extern struct pollfd *pollarray;
extern unsigned long pollsize;
#define POLL_MILLISECS 500
static volatile int dir_changed = 1;
static void dir_notify_handler(__attribute__((unused))int sig)
{
dir_changed = 1;
}
static void
scan_poll_results(int ret)
{
int i;
struct clnt_info *clp;
for (clp = clnt_list.tqh_first; clp != NULL; clp = clp->list.tqe_next)
{
i = clp->gssd_poll_index;
if (i >= 0 && pollarray[i].revents) {
if (pollarray[i].revents & POLLHUP) {
clp->gssd_close_me = 1;
dir_changed = 1;
}
if (pollarray[i].revents & POLLIN)
handle_gssd_upcall(clp);
pollarray[clp->gssd_poll_index].revents = 0;
ret--;
if (!ret)
break;
}
i = clp->krb5_poll_index;
if (i >= 0 && pollarray[i].revents) {
if (pollarray[i].revents & POLLHUP) {
clp->krb5_close_me = 1;
dir_changed = 1;
}
if (pollarray[i].revents & POLLIN)
handle_krb5_upcall(clp);
pollarray[clp->krb5_poll_index].revents = 0;
ret--;
if (!ret)
break;
}
}
}
static int
topdirs_add_entry(struct dirent *dent)
{
struct topdirs_info *tdi;
tdi = calloc(sizeof(struct topdirs_info), 1);
if (tdi == NULL) {
printerr(0, "ERROR: Couldn't allocate struct topdirs_info\n");
return -1;
}
tdi->dirname = malloc(PATH_MAX);
if (tdi->dirname == NULL) {
printerr(0, "ERROR: Couldn't allocate directory name\n");
free(tdi);
return -1;
}
snprintf(tdi->dirname, PATH_MAX, "%s/%s", pipefs_dir, dent->d_name);
tdi->fd = open(tdi->dirname, O_RDONLY);
if (tdi->fd == -1) {
printerr(0, "ERROR: failed to open %s\n", tdi->dirname);
free(tdi);
return -1;
}
fcntl(tdi->fd, F_SETSIG, DNOTIFY_SIGNAL);
fcntl(tdi->fd, F_NOTIFY, DN_CREATE|DN_DELETE|DN_MODIFY|DN_MULTISHOT);
TAILQ_INSERT_HEAD(&topdirs_list, tdi, list);
return 0;
}
static void
topdirs_free_list(void)
{
struct topdirs_info *tdi;
TAILQ_FOREACH(tdi, &topdirs_list, list) {
free(tdi->dirname);
if (tdi->fd != -1)
close(tdi->fd);
TAILQ_REMOVE(&topdirs_list, tdi, list);
free(tdi);
}
}
static int
topdirs_init_list(void)
{
DIR *pipedir;
struct dirent *dent;
int ret;
TAILQ_INIT(&topdirs_list);
pipedir = opendir(pipefs_dir);
if (pipedir == NULL) {
printerr(0, "ERROR: could not open rpc_pipefs directory '%s': "
"%s\n", pipefs_dir, strerror(errno));
return -1;
}
for (dent = readdir(pipedir); dent != NULL; dent = readdir(pipedir)) {
if (dent->d_type != DT_DIR ||
strcmp(dent->d_name, ".") == 0 ||
strcmp(dent->d_name, "..") == 0) {
continue;
}
ret = topdirs_add_entry(dent);
if (ret)
goto out_err;
}
closedir(pipedir);
return 0;
out_err:
topdirs_free_list();
return -1;
}
#ifdef HAVE_PPOLL
static void gssd_poll(struct pollfd *fds, unsigned long nfds)
{
sigset_t emptyset;
int ret;
sigemptyset(&emptyset);
ret = ppoll(fds, nfds, NULL, &emptyset);
if (ret < 0) {
if (errno != EINTR)
printerr(0, "WARNING: error return from poll\n");
} else if (ret == 0) {
printerr(0, "WARNING: unexpected timeout\n");
} else {
scan_poll_results(ret);
}
}
#else /* !HAVE_PPOLL */
static void gssd_poll(struct pollfd *fds, unsigned long nfds)
{
int ret;
/* race condition here: dir_changed could be set before we
* enter the poll, and we'd never notice if it weren't for the
* timeout. */
ret = poll(fds, nfds, POLL_MILLISECS);
if (ret < 0) {
if (errno != EINTR)
printerr(0, "WARNING: error return from poll\n");
} else if (ret == 0) {
/* timeout */
} else { /* ret > 0 */
scan_poll_results(ret);
}
}
#endif /* !HAVE_PPOLL */
void
gssd_run()
{
struct sigaction dn_act = {
.sa_handler = dir_notify_handler
};
sigset_t set;
sigemptyset(&dn_act.sa_mask);
sigaction(DNOTIFY_SIGNAL, &dn_act, NULL);
/* just in case the signal is blocked... */
sigemptyset(&set);
sigaddset(&set, DNOTIFY_SIGNAL);
sigprocmask(SIG_UNBLOCK, &set, NULL);
if (topdirs_init_list() != 0)
return;
init_client_list();
printerr(1, "beginning poll\n");
while (1) {
while (dir_changed) {
dir_changed = 0;
if (update_client_list()) {
/* Error msg is already printed */
exit(1);
}
/* release the parent after the initial dir scan */
release_parent(pipefds);
}
gssd_poll(pollarray, pollsize);
}
topdirs_free_list();
return;
}
| Java |
#!/usr/bin/env python
import unittest
from werkzeug.exceptions import NotFound, Forbidden
from tests.logic_t.layer.LogicLayer.util import generate_ll
class TaskPrioritizeBeforeLogicLayerTest(unittest.TestCase):
def setUp(self):
self.ll = generate_ll()
self.pl = self.ll.pl
def test_add_prioritize_before_adds_prioritize_before(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
# when
results = self.ll.do_add_prioritize_before_to_task(t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_if_already_added_still_succeeds(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
t1.prioritize_before.append(t2)
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
# when
results = self.ll.do_add_prioritize_before_to_task(t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_null_ids_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_before_to_task,
None, t2.id, user)
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_before_to_task,
t1.id, None, user)
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_before_to_task,
None, None, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
def test_null_user_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_before_to_task,
t1.id, t2.id, None)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
def test_user_not_authorized_for_task_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
# expect
self.assertRaises(Forbidden, self.ll.do_add_prioritize_before_to_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
def test_user_not_authorized_for_prioritize_before_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
# expect
self.assertRaises(Forbidden, self.ll.do_add_prioritize_before_to_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
def test_task_not_found_raises_exception(self):
# given
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNone(self.pl.get_task(t2.id + 1))
# expect
self.assertRaises(NotFound, self.ll.do_add_prioritize_before_to_task,
t2.id + 1, t2.id, user)
# then
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNone(self.pl.get_task(t2.id+1))
def test_prioritize_before_not_found_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
self.pl.add(t1)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertIsNone(self.pl.get_task(t1.id + 1))
# expect
self.assertRaises(NotFound, self.ll.do_add_prioritize_before_to_task,
t1.id, t1.id + 1, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertIsNone(self.pl.get_task(t1.id + 1))
def test_remove_prioritize_before_removes_prioritize_before(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
t1.prioritize_before.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
# when
results = self.ll.do_remove_prioritize_before_from_task(t1.id, t2.id,
user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_if_prioritize_before_already_removed_still_succeeds(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
# when
results = self.ll.do_remove_prioritize_before_from_task(t1.id, t2.id,
user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_remove_prioritize_before_with_null_ids_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
t1.prioritize_before.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_before_from_task,
None, t2.id, user)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_before_from_task,
t1.id, None, user)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_before_from_task,
None, None, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
def test_remove_prioritize_before_with_null_user_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
t1.prioritize_before.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_before_from_task,
t1.id, t2.id, None)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
def test_remove_prioritize_before_user_unauthd_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
t1.prioritize_before.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# note that this situation shouldn't happen anyways. a task shouldn't
# be prioritized before another task unless both share a common set of
# one or more authorized users
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
# expect
self.assertRaises(Forbidden,
self.ll.do_remove_prioritize_before_from_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
def test_remove_user_not_authd_for_prioritizebefore_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t1.prioritize_before.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# note that this situation shouldn't happen anyways. a task shouldn't
# be prioritized before another task unless both share a common set of
# one or more authorized users
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
# expect
self.assertRaises(Forbidden,
self.ll.do_remove_prioritize_before_from_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(1, len(t1.prioritize_before))
self.assertEqual(1, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertTrue(t2 in t1.prioritize_before)
self.assertTrue(t1 in t2.prioritize_after)
def test_remove_prioritize_before_task_not_found_raises_exception(self):
# given
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNone(self.pl.get_task(t2.id + 1))
# expect
self.assertRaises(NotFound,
self.ll.do_remove_prioritize_before_from_task,
t2.id + 1, t2.id, user)
# then
self.assertEqual(0, len(t2.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertIsNone(self.pl.get_task(t2.id+1))
def test_remove_prioritize_before_when_not_found_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
self.pl.add(t1)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertIsNone(self.pl.get_task(t1.id + 1))
# expect
self.assertRaises(NotFound,
self.ll.do_remove_prioritize_before_from_task,
t1.id, t1.id + 1, user)
# then
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t1.prioritize_before))
self.assertIsNone(self.pl.get_task(t1.id + 1))
class TaskPrioritizeAfterLogicLayerTest(unittest.TestCase):
def setUp(self):
self.ll = generate_ll()
self.pl = self.ll.pl
def test_add_prioritize_after_adds_prioritize_after(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
# when
results = self.ll.do_add_prioritize_after_to_task(t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_if_already_added_still_succeeds(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
t1.prioritize_after.append(t2)
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
# when
results = self.ll.do_add_prioritize_after_to_task(t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_null_ids_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_after_to_task,
None, t2.id, user)
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_after_to_task,
t1.id, None, user)
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_after_to_task,
None, None, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
def test_null_user_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
# expect
self.assertRaises(ValueError, self.ll.do_add_prioritize_after_to_task,
t1.id, t2.id, None)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
def test_user_not_authorized_for_task_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
# expect
self.assertRaises(Forbidden, self.ll.do_add_prioritize_after_to_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
def test_user_not_authorized_for_prioritize_after_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
# expect
self.assertRaises(Forbidden, self.ll.do_add_prioritize_after_to_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
def test_task_not_found_raises_exception(self):
# given
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertIsNone(self.pl.get_task(t2.id + 1))
# expect
self.assertRaises(NotFound, self.ll.do_add_prioritize_after_to_task,
t2.id + 1, t2.id, user)
# then
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertIsNone(self.pl.get_task(t2.id+1))
def test_prioritize_after_not_found_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
self.pl.add(t1)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertIsNone(self.pl.get_task(t1.id + 1))
# expect
self.assertRaises(NotFound, self.ll.do_add_prioritize_after_to_task,
t1.id, t1.id + 1, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertIsNone(self.pl.get_task(t1.id + 1))
def test_remove_prioritize_after_removes_prioritize_after(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
t1.prioritize_after.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
# when
results = self.ll.do_remove_prioritize_after_from_task(t1.id, t2.id,
user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_if_prioritize_after_already_removed_still_succeeds(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
# when
results = self.ll.do_remove_prioritize_after_from_task(t1.id, t2.id,
user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertIsNotNone(results)
self.assertEqual([t1, t2], list(results))
def test_remove_prioritize_after_with_null_ids_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
t1.prioritize_after.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_after_from_task,
None, t2.id, user)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_after_from_task,
t1.id, None, user)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_after_from_task,
None, None, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
def test_remove_prioritize_after_with_null_user_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t2.users.append(user)
t1.prioritize_after.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
# expect
self.assertRaises(ValueError,
self.ll.do_remove_prioritize_after_from_task,
t1.id, t2.id, None)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
def test_rem_prioritize_after_user_unauthd_for_task_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
t1.prioritize_after.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# note that this situation shouldn't happen anyways. a task shouldn't
# be prioritized before another task unless both share a common set of
# one or more authorized users
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
# expect
self.assertRaises(Forbidden,
self.ll.do_remove_prioritize_after_from_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
def test_remove_user_not_authd_for_prioritize_after_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
t1.prioritize_after.append(t2)
self.pl.add(t1)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# note that this situation shouldn't happen anyways. a task shouldn't
# be prioritized before another task unless both share a common set of
# one or more authorized users
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
# expect
self.assertRaises(Forbidden,
self.ll.do_remove_prioritize_after_from_task,
t1.id, t2.id, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(1, len(t1.prioritize_after))
self.assertEqual(1, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertTrue(t2 in t1.prioritize_after)
self.assertTrue(t1 in t2.prioritize_before)
def test_remove_prioritize_after_task_not_found_raises_exception(self):
# given
t2 = self.pl.create_task('t2')
user = self.pl.create_user('name@example.com')
t2.users.append(user)
self.pl.add(t2)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertIsNone(self.pl.get_task(t2.id + 1))
# expect
self.assertRaises(NotFound,
self.ll.do_remove_prioritize_after_from_task,
t2.id + 1, t2.id, user)
# then
self.assertEqual(0, len(t2.prioritize_before))
self.assertEqual(0, len(t2.prioritize_after))
self.assertIsNone(self.pl.get_task(t2.id+1))
def test_remove_prioritize_after_when_not_found_raises_exception(self):
# given
t1 = self.pl.create_task('t1')
user = self.pl.create_user('name@example.com')
t1.users.append(user)
self.pl.add(t1)
self.pl.add(user)
self.pl.commit()
# precondition
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertIsNone(self.pl.get_task(t1.id + 1))
# expect
self.assertRaises(NotFound,
self.ll.do_remove_prioritize_after_from_task,
t1.id, t1.id + 1, user)
# then
self.assertEqual(0, len(t1.prioritize_before))
self.assertEqual(0, len(t1.prioritize_after))
self.assertIsNone(self.pl.get_task(t1.id + 1))
| Java |
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Bundle\EzPublishLegacyBundle\Controller;
use eZ\Bundle\EzPublishLegacyBundle\LegacyResponse\LegacyResponseManager;
use eZ\Publish\Core\MVC\Legacy\Kernel\URIHelper;
use eZ\Publish\Core\MVC\Legacy\Templating\LegacyHelper;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use eZ\Publish\Core\MVC\ConfigResolverInterface;
use ezpKernelRedirect;
use Symfony\Component\Routing\RouterInterface;
/**
* Controller embedding legacy kernel.
*/
class LegacyKernelController
{
/**
* @var \Closure
*/
private $kernelClosure;
/**
* @var \eZ\Publish\Core\MVC\ConfigResolverInterface
*/
private $configResolver;
/**
* Template declaration to wrap legacy responses in a Twig pagelayout (optional)
* Either a template declaration string or null/false to use legacy pagelayout
* Default is null.
*
* @var mixed
*/
private $legacyLayout;
/**
* @var \eZ\Publish\Core\MVC\Legacy\Kernel\URIHelper
*/
private $uriHelper;
/**
* @var \eZ\Bundle\EzPublishLegacyBundle\LegacyResponse\LegacyResponseManager
*/
private $legacyResponseManager;
/**
* @var \eZ\Publish\Core\MVC\Legacy\Templating\LegacyHelper
*/
private $legacyHelper;
/**
* @var \Symfony\Component\Routing\RouterInterface
*/
private $router;
public function __construct(
\Closure $kernelClosure,
ConfigResolverInterface $configResolver,
URIHelper $uriHelper,
LegacyResponseManager $legacyResponseManager,
LegacyHelper $legacyHelper,
RouterInterface $router
) {
$this->kernelClosure = $kernelClosure;
$this->legacyLayout = $configResolver->getParameter('module_default_layout', 'ezpublish_legacy');
$this->configResolver = $configResolver;
$this->uriHelper = $uriHelper;
$this->legacyResponseManager = $legacyResponseManager;
$this->legacyHelper = $legacyHelper;
$this->router = $router;
}
/**
* Base fallback action.
* Will be basically used for every legacy module.
*
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return \eZ\Bundle\EzPublishLegacyBundle\LegacyResponse
*/
public function indexAction(Request $request)
{
$kernelClosure = $this->kernelClosure;
/** @var \eZ\Publish\Core\MVC\Legacy\Kernel $kernel */
$kernel = $kernelClosure();
$legacyMode = $this->configResolver->getParameter('legacy_mode');
$kernel->setUseExceptions(false);
// Fix up legacy URI with current request since we can be in a sub-request here.
$this->uriHelper->updateLegacyURI($request);
// If we have a layout for legacy AND we're not in legacy mode, we ask the legacy kernel not to generate layout.
if (isset($this->legacyLayout) && !$legacyMode) {
$kernel->setUsePagelayout(false);
}
$result = $kernel->run();
$kernel->setUseExceptions(true);
if ($result instanceof ezpKernelRedirect) {
return $this->legacyResponseManager->generateRedirectResponse($result);
}
$this->legacyHelper->loadDataFromModuleResult($result->getAttribute('module_result'));
$response = $this->legacyResponseManager->generateResponseFromModuleResult($result);
$this->legacyResponseManager->mapHeaders(headers_list(), $response);
return $response;
}
/**
* Generates a RedirectResponse to the appropriate login route.
*
* @return RedirectResponse
*/
public function loginAction()
{
return new RedirectResponse($this->router->generate('login'));
}
/**
* Generates a RedirectResponse to the appropriate logout route.
*
* @return RedirectResponse
*/
public function logoutAction()
{
return new RedirectResponse($this->router->generate('logout'));
}
}
| Java |
/*
* Universal power supply monitor class
*
* Copyright © 2007 Anton Vorontsov <cbou@mail.ru>
* Copyright © 2004 Szabolcs Gyurko
* Copyright © 2003 Ian Molton <spyro@f2s.com>
*
* Modified: 2004, Oct Szabolcs Gyurko
*
* You may use this code as per GPL version 2
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/notifier.h>
#include <linux/err.h>
#include <linux/power_supply.h>
#include <linux/thermal.h>
#include "power_supply.h"
/* exported for the APM Power driver, APM emulation */
struct class *power_supply_class;
EXPORT_SYMBOL_GPL(power_supply_class);
ATOMIC_NOTIFIER_HEAD(power_supply_notifier);
EXPORT_SYMBOL_GPL(power_supply_notifier);
static struct device_type power_supply_dev_type;
static bool __power_supply_is_supplied_by(struct power_supply *supplier,
struct power_supply *supply)
{
int i;
if (!supply->supplied_from && !supplier->supplied_to)
return false;
/* Support both supplied_to and supplied_from modes */
if (supply->supplied_from) {
if (!supplier->name)
return false;
for (i = 0; i < supply->num_supplies; i++)
if (!strcmp(supplier->name, supply->supplied_from[i]))
return true;
} else {
if (!supply->name)
return false;
for (i = 0; i < supplier->num_supplicants; i++)
if (!strcmp(supplier->supplied_to[i], supply->name))
return true;
}
return false;
}
/**
* power_supply_set_current_limit - set current limit
* @psy: the power supply to control
* @limit: current limit in uA from the power supply.
* 0 will disable the power supply.
*
* This function will set a maximum supply current from a source
* and it will disable the charger when limit is 0.
*/
int power_supply_set_current_limit(struct power_supply *psy, int limit)
{
const union power_supply_propval ret = {limit,};
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_CURRENT_MAX,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_current_limit);
/**
* power_supply_set_charging_enabled - enable or disable charging
* @psy: the power supply to control
* @enable: sets enable property of power supply
*/
int power_supply_set_charging_enabled(struct power_supply *psy, bool enable)
{
const union power_supply_propval ret = {enable,};
if (psy->set_property)
return psy->set_property(psy,
POWER_SUPPLY_PROP_CHARGING_ENABLED,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_charging_enabled);
/**
* power_supply_set_present - set present state of the power supply
* @psy: the power supply to control
* @enable: sets present property of power supply
*/
int power_supply_set_present(struct power_supply *psy, bool enable)
{
const union power_supply_propval ret = {enable,};
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_PRESENT,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_present);
/**
* power_supply_set_online - set online state of the power supply
* @psy: the power supply to control
* @enable: sets online property of power supply
*/
int power_supply_set_online(struct power_supply *psy, bool enable)
{
const union power_supply_propval ret = {enable,};
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_ONLINE,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_online);
/** power_supply_set_health_state - set health state of the power supply
* @psy: the power supply to control
* @health: sets health property of power supply
*/
int power_supply_set_health_state(struct power_supply *psy, int health)
{
const union power_supply_propval ret = {health,};
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_HEALTH,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL(power_supply_set_health_state);
/**
* power_supply_set_scope - set scope of the power supply
* @psy: the power supply to control
* @scope: value to set the scope property to, should be from
* the SCOPE enum in power_supply.h
*/
int power_supply_set_scope(struct power_supply *psy, int scope)
{
const union power_supply_propval ret = {scope, };
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_SCOPE,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_scope);
/**
* power_supply_set_supply_type - set type of the power supply
* @psy: the power supply to control
* @supply_type: sets type property of power supply
*/
int power_supply_set_supply_type(struct power_supply *psy,
enum power_supply_type supply_type)
{
const union power_supply_propval ret = {supply_type,};
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_TYPE,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_supply_type);
/**
* power_supply_set_charge_type - set charge type of the power supply
* @psy: the power supply to control
* @enable: sets charge type property of power supply
*/
int power_supply_set_charge_type(struct power_supply *psy, int charge_type)
{
const union power_supply_propval ret = {charge_type,};
if (psy->set_property)
return psy->set_property(psy, POWER_SUPPLY_PROP_CHARGE_TYPE,
&ret);
return -ENXIO;
}
EXPORT_SYMBOL_GPL(power_supply_set_charge_type);
static int __power_supply_changed_work(struct device *dev, void *data)
{
struct power_supply *psy = (struct power_supply *)data;
struct power_supply *pst = dev_get_drvdata(dev);
if (__power_supply_is_supplied_by(psy, pst)) {
if (pst->external_power_changed)
pst->external_power_changed(pst);
}
return 0;
}
static void power_supply_changed_work(struct work_struct *work)
{
unsigned long flags;
struct power_supply *psy = container_of(work, struct power_supply,
changed_work);
dev_dbg(psy->dev, "%s\n", __func__);
spin_lock_irqsave(&psy->changed_lock, flags);
if (psy->changed) {
psy->changed = false;
spin_unlock_irqrestore(&psy->changed_lock, flags);
class_for_each_device(power_supply_class, NULL, psy,
__power_supply_changed_work);
power_supply_update_leds(psy);
atomic_notifier_call_chain(&power_supply_notifier,
PSY_EVENT_PROP_CHANGED, psy);
kobject_uevent(&psy->dev->kobj, KOBJ_CHANGE);
spin_lock_irqsave(&psy->changed_lock, flags);
}
/*
* Dependent power supplies (e.g. battery) may have changed state
* as a result of this event, so poll again and hold the
* wakeup_source until all events are processed.
*/
if (!psy->changed)
pm_relax(psy->dev);
spin_unlock_irqrestore(&psy->changed_lock, flags);
}
void power_supply_changed(struct power_supply *psy)
{
unsigned long flags;
dev_dbg(psy->dev, "%s\n", __func__);
spin_lock_irqsave(&psy->changed_lock, flags);
psy->changed = true;
pm_stay_awake(psy->dev);
spin_unlock_irqrestore(&psy->changed_lock, flags);
schedule_work(&psy->changed_work);
}
EXPORT_SYMBOL_GPL(power_supply_changed);
#ifdef CONFIG_OF
#include <linux/of.h>
static int __power_supply_populate_supplied_from(struct device *dev,
void *data)
{
struct power_supply *psy = (struct power_supply *)data;
struct power_supply *epsy = dev_get_drvdata(dev);
struct device_node *np;
int i = 0;
do {
np = of_parse_phandle(psy->of_node, "power-supplies", i++);
if (!np)
continue;
if (np == epsy->of_node) {
dev_info(psy->dev, "%s: Found supply : %s\n",
psy->name, epsy->name);
psy->supplied_from[i-1] = (char *)epsy->name;
psy->num_supplies++;
of_node_put(np);
break;
}
of_node_put(np);
} while (np);
return 0;
}
static int power_supply_populate_supplied_from(struct power_supply *psy)
{
int error;
error = class_for_each_device(power_supply_class, NULL, psy,
__power_supply_populate_supplied_from);
dev_dbg(psy->dev, "%s %d\n", __func__, error);
return error;
}
static int __power_supply_find_supply_from_node(struct device *dev,
void *data)
{
struct device_node *np = (struct device_node *)data;
struct power_supply *epsy = dev_get_drvdata(dev);
/* return error breaks out of class_for_each_device loop */
if (epsy->of_node == np)
return -EINVAL;
return 0;
}
static int power_supply_find_supply_from_node(struct device_node *supply_node)
{
int error;
struct device *dev;
struct class_dev_iter iter;
/*
* Use iterator to see if any other device is registered.
* This is required since class_for_each_device returns 0
* if there are no devices registered.
*/
class_dev_iter_init(&iter, power_supply_class, NULL, NULL);
dev = class_dev_iter_next(&iter);
if (!dev)
return -EPROBE_DEFER;
/*
* We have to treat the return value as inverted, because if
* we return error on not found, then it won't continue looking.
* So we trick it by returning error on success to stop looking
* once the matching device is found.
*/
error = class_for_each_device(power_supply_class, NULL, supply_node,
__power_supply_find_supply_from_node);
return error ? 0 : -EPROBE_DEFER;
}
static int power_supply_check_supplies(struct power_supply *psy)
{
struct device_node *np;
int cnt = 0;
/* If there is already a list honor it */
if (psy->supplied_from && psy->num_supplies > 0)
return 0;
/* No device node found, nothing to do */
if (!psy->of_node)
return 0;
do {
int ret;
np = of_parse_phandle(psy->of_node, "power-supplies", cnt++);
if (!np)
continue;
ret = power_supply_find_supply_from_node(np);
if (ret) {
dev_dbg(psy->dev, "Failed to find supply, defer!\n");
of_node_put(np);
return -EPROBE_DEFER;
}
of_node_put(np);
} while (np);
/* All supplies found, allocate char ** array for filling */
psy->supplied_from = devm_kzalloc(psy->dev, sizeof(psy->supplied_from),
GFP_KERNEL);
if (!psy->supplied_from) {
dev_err(psy->dev, "Couldn't allocate memory for supply list\n");
return -ENOMEM;
}
*psy->supplied_from = devm_kzalloc(psy->dev, sizeof(char *) * cnt,
GFP_KERNEL);
if (!*psy->supplied_from) {
dev_err(psy->dev, "Couldn't allocate memory for supply list\n");
return -ENOMEM;
}
return power_supply_populate_supplied_from(psy);
}
#else
static inline int power_supply_check_supplies(struct power_supply *psy)
{
return 0;
}
#endif
static int __power_supply_am_i_supplied(struct device *dev, void *data)
{
union power_supply_propval ret = {0,};
struct power_supply *psy = (struct power_supply *)data;
struct power_supply *epsy = dev_get_drvdata(dev);
if (__power_supply_is_supplied_by(epsy, psy))
if (!epsy->get_property(epsy, POWER_SUPPLY_PROP_ONLINE, &ret)) {
if (ret.intval)
return ret.intval;
}
return 0;
}
int power_supply_am_i_supplied(struct power_supply *psy)
{
int error;
error = class_for_each_device(power_supply_class, NULL, psy,
__power_supply_am_i_supplied);
dev_dbg(psy->dev, "%s %d\n", __func__, error);
return error;
}
EXPORT_SYMBOL_GPL(power_supply_am_i_supplied);
static int __power_supply_is_system_supplied(struct device *dev, void *data)
{
union power_supply_propval ret = {0,};
struct power_supply *psy = dev_get_drvdata(dev);
unsigned int *count = data;
(*count)++;
if (psy->type != POWER_SUPPLY_TYPE_BATTERY) {
if (psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &ret))
return 0;
if (ret.intval)
return ret.intval;
}
return 0;
}
int power_supply_is_system_supplied(void)
{
int error;
unsigned int count = 0;
error = class_for_each_device(power_supply_class, NULL, &count,
__power_supply_is_system_supplied);
/*
* If no power class device was found at all, most probably we are
* running on a desktop system, so assume we are on mains power.
*/
if (count == 0)
return 1;
return error;
}
EXPORT_SYMBOL_GPL(power_supply_is_system_supplied);
int power_supply_set_battery_charged(struct power_supply *psy)
{
if (psy->type == POWER_SUPPLY_TYPE_BATTERY && psy->set_charged) {
psy->set_charged(psy);
return 0;
}
return -EINVAL;
}
EXPORT_SYMBOL_GPL(power_supply_set_battery_charged);
static int power_supply_match_device_by_name(struct device *dev, const void *data)
{
const char *name = data;
struct power_supply *psy = dev_get_drvdata(dev);
return strcmp(psy->name, name) == 0;
}
struct power_supply *power_supply_get_by_name(const char *name)
{
struct device *dev = class_find_device(power_supply_class, NULL, name,
power_supply_match_device_by_name);
return dev ? dev_get_drvdata(dev) : NULL;
}
EXPORT_SYMBOL_GPL(power_supply_get_by_name);
#ifdef CONFIG_OF
static int power_supply_match_device_node(struct device *dev, const void *data)
{
return dev->parent && dev->parent->of_node == data;
}
struct power_supply *power_supply_get_by_phandle(struct device_node *np,
const char *property)
{
struct device_node *power_supply_np;
struct device *dev;
power_supply_np = of_parse_phandle(np, property, 0);
if (!power_supply_np)
return ERR_PTR(-ENODEV);
dev = class_find_device(power_supply_class, NULL, power_supply_np,
power_supply_match_device_node);
of_node_put(power_supply_np);
return dev ? dev_get_drvdata(dev) : NULL;
}
EXPORT_SYMBOL_GPL(power_supply_get_by_phandle);
#endif /* CONFIG_OF */
int power_supply_powers(struct power_supply *psy, struct device *dev)
{
return sysfs_create_link(&psy->dev->kobj, &dev->kobj, "powers");
}
EXPORT_SYMBOL_GPL(power_supply_powers);
static void power_supply_dev_release(struct device *dev)
{
pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
kfree(dev);
}
int power_supply_reg_notifier(struct notifier_block *nb)
{
return atomic_notifier_chain_register(&power_supply_notifier, nb);
}
EXPORT_SYMBOL_GPL(power_supply_reg_notifier);
void power_supply_unreg_notifier(struct notifier_block *nb)
{
atomic_notifier_chain_unregister(&power_supply_notifier, nb);
}
EXPORT_SYMBOL_GPL(power_supply_unreg_notifier);
#ifdef CONFIG_THERMAL
static int power_supply_read_temp(struct thermal_zone_device *tzd,
unsigned long *temp)
{
struct power_supply *psy;
union power_supply_propval val;
int ret;
WARN_ON(tzd == NULL);
psy = tzd->devdata;
ret = psy->get_property(psy, POWER_SUPPLY_PROP_TEMP, &val);
/* Convert tenths of degree Celsius to milli degree Celsius. */
if (!ret)
*temp = val.intval * 100;
return ret;
}
static struct thermal_zone_device_ops psy_tzd_ops = {
.get_temp = power_supply_read_temp,
};
static int psy_register_thermal(struct power_supply *psy)
{
int i;
/* Register battery zone device psy reports temperature */
for (i = 0; i < psy->num_properties; i++) {
if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) {
psy->tzd = thermal_zone_device_register(psy->name, 0, 0,
psy, &psy_tzd_ops, NULL, 0, 0);
if (IS_ERR(psy->tzd))
return PTR_ERR(psy->tzd);
break;
}
}
return 0;
}
static void psy_unregister_thermal(struct power_supply *psy)
{
if (IS_ERR_OR_NULL(psy->tzd))
return;
thermal_zone_device_unregister(psy->tzd);
}
/* thermal cooling device callbacks */
static int ps_get_max_charge_cntl_limit(struct thermal_cooling_device *tcd,
unsigned long *state)
{
struct power_supply *psy;
union power_supply_propval val;
int ret;
psy = tcd->devdata;
ret = psy->get_property(psy,
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX, &val);
if (!ret)
*state = val.intval;
return ret;
}
static int ps_get_cur_chrage_cntl_limit(struct thermal_cooling_device *tcd,
unsigned long *state)
{
struct power_supply *psy;
union power_supply_propval val;
int ret;
psy = tcd->devdata;
ret = psy->get_property(psy,
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val);
if (!ret)
*state = val.intval;
return ret;
}
static int ps_set_cur_charge_cntl_limit(struct thermal_cooling_device *tcd,
unsigned long state)
{
struct power_supply *psy;
union power_supply_propval val;
int ret;
psy = tcd->devdata;
val.intval = state;
ret = psy->set_property(psy,
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT, &val);
return ret;
}
static struct thermal_cooling_device_ops psy_tcd_ops = {
.get_max_state = ps_get_max_charge_cntl_limit,
.get_cur_state = ps_get_cur_chrage_cntl_limit,
.set_cur_state = ps_set_cur_charge_cntl_limit,
};
static int psy_register_cooler(struct power_supply *psy)
{
int i;
/* Register for cooling device if psy can control charging */
for (i = 0; i < psy->num_properties; i++) {
if (psy->properties[i] ==
POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT) {
psy->tcd = thermal_cooling_device_register(
(char *)psy->name,
psy, &psy_tcd_ops);
if (IS_ERR(psy->tcd))
return PTR_ERR(psy->tcd);
break;
}
}
return 0;
}
static void psy_unregister_cooler(struct power_supply *psy)
{
if (IS_ERR_OR_NULL(psy->tcd))
return;
thermal_cooling_device_unregister(psy->tcd);
}
#else
static int psy_register_thermal(struct power_supply *psy)
{
return 0;
}
static void psy_unregister_thermal(struct power_supply *psy)
{
}
static int psy_register_cooler(struct power_supply *psy)
{
return 0;
}
static void psy_unregister_cooler(struct power_supply *psy)
{
}
#endif
int power_supply_register(struct device *parent, struct power_supply *psy)
{
struct device *dev;
int rc;
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
device_initialize(dev);
dev->class = power_supply_class;
dev->type = &power_supply_dev_type;
dev->parent = parent;
dev->release = power_supply_dev_release;
dev_set_drvdata(dev, psy);
psy->dev = dev;
rc = dev_set_name(dev, "%s", psy->name);
if (rc)
goto dev_set_name_failed;
INIT_WORK(&psy->changed_work, power_supply_changed_work);
rc = power_supply_check_supplies(psy);
if (rc) {
dev_info(dev, "Not all required supplies found, defer probe\n");
goto check_supplies_failed;
}
spin_lock_init(&psy->changed_lock);
rc = device_init_wakeup(dev, true);
if (rc)
goto wakeup_init_failed;
rc = device_add(dev);
if (rc)
goto device_add_failed;
rc = psy_register_thermal(psy);
if (rc)
goto register_thermal_failed;
rc = psy_register_cooler(psy);
if (rc)
goto register_cooler_failed;
rc = power_supply_create_triggers(psy);
if (rc)
goto create_triggers_failed;
power_supply_changed(psy);
goto success;
create_triggers_failed:
psy_unregister_cooler(psy);
register_cooler_failed:
psy_unregister_thermal(psy);
register_thermal_failed:
device_del(dev);
device_add_failed:
wakeup_init_failed:
check_supplies_failed:
dev_set_name_failed:
put_device(dev);
success:
return rc;
}
EXPORT_SYMBOL_GPL(power_supply_register);
void power_supply_unregister(struct power_supply *psy)
{
cancel_work_sync(&psy->changed_work);
sysfs_remove_link(&psy->dev->kobj, "powers");
power_supply_remove_triggers(psy);
psy_unregister_cooler(psy);
psy_unregister_thermal(psy);
device_init_wakeup(psy->dev, false);
device_unregister(psy->dev);
}
EXPORT_SYMBOL_GPL(power_supply_unregister);
static int __init power_supply_class_init(void)
{
power_supply_class = class_create(THIS_MODULE, "power_supply");
if (IS_ERR(power_supply_class))
return PTR_ERR(power_supply_class);
power_supply_class->dev_uevent = power_supply_uevent;
power_supply_init_attrs(&power_supply_dev_type);
return 0;
}
static void __exit power_supply_class_exit(void)
{
class_destroy(power_supply_class);
}
subsys_initcall(power_supply_class_init);
module_exit(power_supply_class_exit);
MODULE_DESCRIPTION("Universal power supply monitor class");
MODULE_AUTHOR("Ian Molton <spyro@f2s.com>, "
"Szabolcs Gyurko, "
"Anton Vorontsov <cbou@mail.ru>");
MODULE_LICENSE("GPL");
| Java |
<?php
/**
* @file
* Default theme implementation to display a single Drupal page.
*
* The doctype, html, head and body tags are not in this template. Instead they
* can be found in the html.tpl.php template in this directory.
*
* Available variables:
*
* General utility variables:
* - $base_path: The base URL path of the Drupal installation. At the very
* least, this will always default to /.
* - $directory: The directory the template is located in, e.g. modules/system
* or themes/bartik.
* - $is_front: TRUE if the current page is the front page.
* - $logged_in: TRUE if the user is registered and signed in.
* - $is_admin: TRUE if the user has permission to access administration pages.
*
* Site identity:
* - $front_page: The URL of the front page. Use this instead of $base_path,
* when linking to the front page. This includes the language domain or
* prefix.
* - $logo: The path to the logo image, as defined in theme configuration.
* - $site_name: The name of the site, empty when display has been disabled
* in theme settings.
* - $site_slogan: The slogan of the site, empty when display has been disabled
* in theme settings.
*
* Navigation:
* - $main_menu (array): An array containing the Main menu links for the
* site, if they have been configured.
* - $secondary_menu (array): An array containing the Secondary menu links for
* the site, if they have been configured.
* - $breadcrumb: The breadcrumb trail for the current page.
*
* Page content (in order of occurrence in the default page.tpl.php):
* - $title_prefix (array): An array containing additional output populated by
* modules, intended to be displayed in front of the main title tag that
* appears in the template.
* - $title: The page title, for use in the actual HTML content.
* - $title_suffix (array): An array containing additional output populated by
* modules, intended to be displayed after the main title tag that appears in
* the template.
* - $messages: HTML for status and error messages. Should be displayed
* prominently.
* - $tabs (array): Tabs linking to any sub-pages beneath the current page
* (e.g., the view and edit tabs when displaying a node).
* - $action_links (array): Actions local to the page, such as 'Add menu' on the
* menu administration interface.
* - $feed_icons: A string of all feed icons for the current page.
* - $node: The node object, if there is an automatically-loaded node
* associated with the page, and the node ID is the second argument
* in the page's path (e.g. node/12345 and node/12345/revisions, but not
* comment/reply/12345).
*
* Regions:
* - $page['help']: Dynamic help text, mostly for admin pages.
* - $page['highlighted']: Items for the highlighted content region.
* - $page['content']: The main content of the current page.
* - $page['sidebar_first']: Items for the first sidebar.
* - $page['sidebar_second']: Items for the second sidebar.
* - $page['header']: Items for the header region.
* - $page['footer']: Items for the footer region.
*
* @see template_preprocess()
* @see template_preprocess_page()
* @see template_process()
* @see html.tpl.php
*
* @ingroup themeable
*/
?>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<?php
$path = "";
if(theme_get_setting('default_logo', 'md_leaders')) {
$path = $logo;
}else{
if(theme_get_setting('logo_normal_upload','md_leaders')) {
$file_upload = theme_get_setting('logo_normal_upload','md_leaders');
if($file_upload['fid'] != 0) {
$file = file_load($file_upload['fid']);
if($file) {
$path = file_create_url($file->uri);
}
} else {
$path = '';
}
}
}
?>
<div id="header" class="color_section">
<div class="container"><div class="row">
<a class="navbar-brand" href="<?php print $front_page; ?>" title="<?php print $site_name; ?>">
<img src="<?php print $path; ?>" alt="<?php print $site_name; ?>" />
</a>
<?php if (theme_get_setting('toggle_name') || theme_get_setting('toggle_slogan')): ?>
<div id="name-and-slogan">
<?php if (theme_get_setting('toggle_name')): ?>
<?php if ($title): ?>
<div id="site-name"><strong>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</strong></div>
<?php else: /* Use h1 when the content title is empty */ ?>
<h1 id="site-name">
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>" rel="home"><span><?php print $site_name; ?></span></a>
</h1>
<?php endif; ?>
<?php endif; ?>
<?php if (theme_get_setting('toggle_slogan')): ?>
<div id="site-slogan"><?php print $site_slogan; ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php print render($page['header']); ?>
<?php print render($page['menu']); ?>
</div></div>
</div>
<?php print render($page['mainslider']); ?>
<?php print $messages; ?>
<!--<section class="darkgrey_section" id="abovecontent">
<div class="container"><div class="row">
<div class="block col-sm-12">
print $breadcrumb;
</div>
</div></div>
</section>-->
<section class="grey_section" id="middle">
<div class="container">
<?php print render($page['content']); ?>
</div>
</section>
<section class="light_section" id="copyright">
<div class="container">
<div class="row to_animate_child_blocks">
<div class="col-sm-12 text-center"><a href="/terms-conditions">Terms & Conditions</a></div>
</div>
</div>
</section>
<?php if (isset($preload)): ?>
<div class="preloader">
<div class="preloaderimg"></div>
</div>
<?php endif; ?>
| Java |
# zabbix-slack
Zabbix alert script for sending notifications to a Slack webhook (python requests)
| Java |
<?php
/**
* @package Surveyforce
* @version 1.1-modified
* @copyright JooPlce Team, 臺北市政府資訊局, Copyright (C) 2016. All rights reserved.
* @license GPL-2.0+
* @author JooPlace Team, 臺北市政府資訊局- http://doit.gov.taipei/
*/
defined('_JEXEC') or die('Restricted access');
/**
* Surveyforce Component Controller
*/
class SurveyforceController extends JControllerLegacy {
/**
* display task
*
* @return void
*/
public function __construct($config = array()){
parent::__construct($config);
}
public function display($cachable = false, $urlparams = array()){
$app = JFactory::getApplication();
$view = JFactory::getApplication()->input->getCmd('view', 'surveys');
switch($view){
case "surveys":
case "survey":
case "questions":
case "question":
case "review":
case "import":
case "result":
case "resultnote":
case "export":
case "getip":
case "autocheck":
case "print":
case "lottery":
case "addend":
case "analyzes":
case "analyze":
case "voted":
break;
default:
$app->redirect("index.php?option=com_surveyforce&view=surveys"); // 直接進入議題管理
}
JFactory::getApplication()->input->set('view', $view);
parent::display($cachable);
}
public function get_options(){
if(!class_exists('SfAppPlugins')){
include_once JPATH_COMPONENT_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'app_plugin.php';
$appsLib = SfAppPlugins::getInstance();
$appsLib->loadApplications();
}
$type = SurveyforceHelper::getQuestionType(JFactory::getApplication()->input->getCmd('sf_qtype'));
$data['quest_type'] = $type->sf_plg_name;
$data['quest_id'] = JFactory::getApplication()->input->get('quest_id');
$data['sf_qtype'] = JFactory::getApplication()->input->getCmd('sf_qtype');
$appsLib->triggerEvent('onGetAdminQuestionOptions', $data);
}
// 投票測試
public function testvote(){
$db = JFactory::getDBO();
$config = JFactory::getConfig();
$testsite_link = $config->get('testsite_link', false);
$app = JFactory::getApplication();
$survey_id = $app->input->getInt('test_survey_id', 0);
$api_request_url = $config->get('testsite_link', '') . "api/server_survey.php";
// 先刪除資料
$api_request_parameters = array('survey_id' => $survey_id);
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$api_request_url .= '?' . http_build_query($api_request_parameters);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_URL, $api_request_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$api_response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$message = curl_error($ch);
curl_close($ch);
if($code == 200){
$result_data = json_decode($api_response);
if($result_data->status == 0){
echo "無法匯入資料,請聯絡系統管理員。";
JHtml::_('utility.recordLog', "api_log.php", "投票測試無法刪除資料", JLog::ERROR);
jexit();
}
}else{ // 無法連線API
echo "無法連線API,請聯絡系統管理員。";
JHtml::_('utility.recordLog', "api_log.php", sprintf("Url:%s, Code:%d, Msg:%s", $api_request_url, $code, $message), JLog::ERROR);
jexit();
}
// 再新增資料
// 依序取得議題、題目、選項的資料
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__survey_force_survs_release');
$query->where('id = ' . $db->quote($survey_id));
$db->setQuery($query);
$survey_row = $db->loadAssoc();
// 取得題目
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__survey_force_quests');
$query->where('sf_survey = ' . $db->quote($survey_id));
$db->setQuery($query);
$question_rows = $db->loadAssocList();
unset($options_rows);
$options_rows = array();
unset($sub_options_rows);
$sub_options_rows = array();
unset($cats_rows);
$cats_rows = array();
if($question_rows){
$question_ids = array();
foreach($question_rows as $question_row){
$question_ids[] = $question_row["id"];
}
// 取得選項
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__survey_force_fields');
$query->where('quest_id IN (' . implode(",", $question_ids) . ')');
$db->setQuery($query);
$options_rows = $db->loadAssocList();
// 取得子選項
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__survey_force_sub_fields');
$query->where('quest_id IN (' . implode(",", $question_ids) . ')');
$db->setQuery($query);
$sub_options_rows = $db->loadAssocList();
// 取得分類
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__survey_force_quests_cat');
$query->where('question_id IN (' . implode(",", $question_ids) . ')');
$db->setQuery($query);
$cats_rows = $db->loadAssocList();
}
// assign_summary
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__assign_summary');
$query->where('survey_id = ' . $db->quote($survey_id));
$db->setQuery($query);
$assign_summary_rows = $db->loadAssocList();
// 寫至測試站台中,再將網頁導向測試站台
$api_request_parameters = array('survey_id' => $survey_id, 'survey_row' => json_encode($survey_row), 'question_rows' => json_encode($question_rows), 'options_rows' => json_encode($options_rows), 'sub_options_rows' => json_encode($sub_options_rows), 'assign_summary_rows' => json_encode($assign_summary_rows), 'cats_rows' => json_encode($cats_rows));
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($api_request_parameters));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
curl_setopt($ch, CURLOPT_URL, $api_request_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$api_response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$message = curl_error($ch);
curl_close($ch);
if($code == 200){
$result_data = json_decode($api_response);
if($result_data->status == 0){
echo "無法匯入議題資料,請聯絡系統管理員。";
JHtml::_('utility.recordLog', "api_log.php", "投票測試無法新增資料", JLog::ERROR);
jexit();
}else{
header("Location:" . $testsite_link . "index.php?option=com_surveyforce&view=intro&Itemid=120&sid=" . $survey_id);
jexit();
}
}else{ // 無法連線API
echo "無法連線API,請聯絡系統管理員。";
JHtml::_('utility.recordLog', "api_log.php", sprintf("Url:%s, Code:%d, Msg:%s", $api_request_url, $code, $message), JLog::ERROR);
jexit();
}
jexit();
}
}
| Java |
package org.mo.com.io;
public class FLinkInput
{
}
| Java |
<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
require_once CLASS_EX_REALDIR . 'page_extends/frontparts/bloc/LC_Page_FrontParts_Bloc_Ex.php';
/**
* ランキング のページクラス.
*
* @package Page
* @author Designup.jp
* @version 1.1
*/
class LC_Page_FrontParts_Bloc_BcRanking extends LC_Page_FrontParts_Bloc_Ex
{
/**
* Page を初期化する.
*
* @return void
*/
public function init()
{
parent::init();
}
/**
* Page のプロセス.
*
* @return void
*/
public function process()
{
$this->action();
$this->sendResponse();
}
/**
* Page のアクション.
*
* @return void
*/
public function action()
{
// 基本情報を渡す
// $objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData();
// $this->arrInfo = $objSiteInfo->data;
//売上ランキング取得
$this->arrBestProducts = $this->lfGetRanking();
//売上ランキング取得、8位まで
//$this->arrBestProducts8 = $this->lfGetRanking(8);
//商品レビュー情報を取得
//$this->arrReviewList = $this->getReviewList();
//メーカー情報を取得
//$this->arrMakerList = $this->getMakerList();
}
/**
* おすすめ商品検索.
*
* @return array $arrBestProducts 検索結果配列
*/
public function lfGetRanking($getNumber = 10)
{
// $objRecommend = new SC_Helper_BestProducts_Ex();
// 売上ランキング取得、デフォルトは5位まで取得
$arrRanking = $this->getList($getNumber);
$response = array();
if (count($arrRanking) > 0) {
// 商品一覧を取得
$objQuery =& SC_Query_Ex::getSingletonInstance();
$objProduct = new SC_Product_Ex();
// where条件生成&セット
$arrProductId = array();
foreach ($arrRanking as $key => $val) {
$arrProductId[] = $val['product_id'];
}
//$arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId);
$arrProducts = $objProduct->getListByProductIdsWithAgencyCode($objQuery, $arrProductId);
// 税込金額を設定する
SC_Product_Ex::setIncTaxToProducts($arrProducts);
// 売上ランキング情報にマージ
$i=0;
foreach ($arrRanking as $key => $value) {
if (isset($arrProducts[$value['product_id']])) {
$product = $arrProducts[$value['product_id']];
if ($product['status'] == 1 && (!NOSTOCK_HIDDEN || ($product['stock_max'] >= 1 || $product['stock_unlimited_max'] == 1))) {
if ($i == $getNumber ) {
break;
}
$response[] = array_merge($value, $arrProducts[$value['product_id']]);
$i++;
}
} else {
// 削除済み商品は除外
unset($arrRanking[$key]);
}
}
}
return $response;
}
/**
* 商品情報を取得
*
* @return array $arrNewProducts 検索結果配列
*/
public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = 'OD.product_id,OD.price,SUM(OD.quantity),SUM(OD.quantity)*OD.price';
$table = 'dtb_order as O, dtb_order_detail as OD';
$where = 'O.order_id = OD.order_id AND O.del_flg = 0';
$objQuery->setGroupBy('OD.product_id');
$objQuery->setOrder('SUM(OD.quantity) DESC');
/*
if ($dispNumber > 0) {
if ($pageNumber > 0) {
$objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber));
} else {
$objQuery->setLimit($dispNumber);
}
}
*/
$arrRet = $objQuery->select($col, $table, $where);
// データの中身の表示テスト
// echo "<pre>";
// var_dump($arrRet);
// echo "</pre>";
return $arrRet;
}
/*
public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = 'product_id,price,SUM(quantity),SUM(quantity)*price';
$table = 'dtb_order_detail';
$where = '';
$objQuery->setGroupBy('product_id,price');
$objQuery->setOrder('SUM(quantity)*price DESC');
if ($dispNumber > 0) {
if ($pageNumber > 0) {
$objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber));
} else {
$objQuery->setLimit($dispNumber);
}
}
$arrRet = $objQuery->select($col, $table, $where);
// データの中身の表示テスト
// echo "<pre>";
// var_dump($arrRet);
// echo "</pre>";
return $arrRet;
}
*/
/**
* 商品のレビューと商品情報を結合した情報を取得
* 商品ごとに集計、小数点以下切り捨て
*
* @return array $arrReviewList 検索結果配列
*/
public function getReviewList($dispNumber = 0, $pageNumber = 0, $has_deleted = false)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = 'product_id,TRUNC(AVG(recommend_level),0) AS recommend_level,COUNT(*) AS recommend_count';
$table = 'dtb_review';
$where = '';
$objQuery->setGroupBy('product_id');
$objQuery->setOrder('product_id DESC');
if ($dispNumber > 0) {
if ($pageNumber > 0) {
$objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber));
} else {
$objQuery->setLimit($dispNumber);
}
}
$arrRet = $objQuery->select($col, $table, $where);
// データの中身の表示テスト
// echo "<pre>";
// var_dump($arrRet);
// echo "</pre>";
return $arrRet;
}
/**
* メーカー情報の取得
*
* @return array $arrMakerList 検索結果配列
*/
public function getMakerList($dispNumber = 0, $pageNumber = 0, $has_deleted = false)
{
$objQuery =& SC_Query_Ex::getSingletonInstance();
$col = '*';
$table = 'dtb_maker';
$where = '';
if ($dispNumber > 0) {
if ($pageNumber > 0) {
$objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber));
} else {
$objQuery->setLimit($dispNumber);
}
}
$arrRet = $objQuery->select($col, $table, $where);
// データの中身の表示テスト
// echo "<pre>";
// var_dump($arrRet);
// echo "</pre>";
return $arrRet;
}
}
| Java |
/*
Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009 Mark Aylett <mark.aylett@gmail.com>
This file is part of Aug written by Mark Aylett.
Aug is released under the GPL with the additional exemption that compiling,
linking, and/or using OpenSSL is allowed.
Aug is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
Aug is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef AUGUTILPP_LOG_HPP
#define AUGUTILPP_LOG_HPP
#include "augutilpp/config.hpp"
#include "augctxpp/exception.hpp"
#include "augutil/log.h"
#include "augctx/defs.h" // AUG_MAXLINE
#include <string>
namespace aug {
inline void
vformatlog(char* buf, size_t& n, clockref clock, unsigned level,
const char* format, va_list args)
{
verify(aug_vformatlog(buf, &n, clock.get(), level, format, args));
}
inline void
formatlog(char* buf, size_t& n, clockref clock, unsigned level,
const char* format, ...)
{
va_list args;
va_start(args, format);
aug_result result(aug_vformatlog(buf, &n, clock.get(), level, format,
args));
va_end(args);
verify(result);
}
inline std::string
vformatlog(clockref clock, unsigned level, const char* format,
va_list args)
{
char buf[AUG_MAXLINE];
size_t n(sizeof(buf));
vformatlog(buf, n, clock, level, format, args);
return std::string(buf, n);
}
inline std::string
formatlog(clockref clock, unsigned level, const char* format, ...)
{
char buf[AUG_MAXLINE];
size_t n(sizeof(buf));
va_list args;
va_start(args, format);
aug_result result(aug_vformatlog(buf, &n, clock.get(), level, format,
args));
va_end(args);
verify(result);
return std::string(buf, n);
}
inline logptr
createdaemonlog(mpoolref mpool, clockref clock)
{
return object_attach<aug_log>
(aug_createdaemonlog(mpool.get(), clock.get()));
}
inline void
setdaemonlog(ctxref ctx)
{
verify(aug_setdaemonlog(ctx.get()));
}
}
#endif // AUGUTILPP_LOG_HPP
| Java |
<?php
/**
* Item Controller
*
* @package ReReplacer
* @version 5.4.4
*
* @author Peter van Westen <peter@nonumber.nl>
* @link http://www.nonumber.nl
* @copyright Copyright © 2012 NoNumber All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
jimport('joomla.application.component.controllerform');
/**
* Item Controller
*/
class ReReplacerControllerItem extends JControllerForm
{
/**
* @var string The prefix to use with controller messages.
*/
protected $text_prefix = 'NN';
// Parent class access checks are sufficient for this controller.
}
| Java |
/*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "c1/c1_Compilation.hpp"
#include "c1/c1_Instruction.hpp"
#include "c1/c1_InstructionPrinter.hpp"
#include "c1/c1_LIRAssembler.hpp"
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_ValueStack.hpp"
#include "ci/ciInstance.hpp"
#include "runtime/os.hpp"
void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
// We must have enough patching space so that call can be inserted.
// We cannot use fat nops here, since the concurrent code rewrite may transiently
// create the illegal instruction sequence.
while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeGeneralJump::instruction_size) {
_masm->nop();
}
patch->install(_masm, patch_code, obj, info);
append_code_stub(patch);
#ifdef ASSERT
Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());
if (patch->id() == PatchingStub::access_field_id) {
switch (code) {
case Bytecodes::_putstatic:
case Bytecodes::_getstatic:
case Bytecodes::_putfield:
case Bytecodes::_getfield:
break;
default:
ShouldNotReachHere();
}
} else if (patch->id() == PatchingStub::load_klass_id) {
switch (code) {
case Bytecodes::_new:
case Bytecodes::_anewarray:
case Bytecodes::_multianewarray:
case Bytecodes::_instanceof:
case Bytecodes::_checkcast:
break;
default:
ShouldNotReachHere();
}
} else if (patch->id() == PatchingStub::load_mirror_id) {
switch (code) {
case Bytecodes::_putstatic:
case Bytecodes::_getstatic:
case Bytecodes::_ldc:
case Bytecodes::_ldc_w:
break;
default:
ShouldNotReachHere();
}
} else if (patch->id() == PatchingStub::load_appendix_id) {
Bytecodes::Code bc_raw = info->scope()->method()->raw_code_at_bci(info->stack()->bci());
assert(Bytecodes::has_optional_appendix(bc_raw), "unexpected appendix resolution");
} else {
ShouldNotReachHere();
}
#endif
}
PatchingStub::PatchID LIR_Assembler::patching_id(CodeEmitInfo* info) {
IRScope* scope = info->scope();
Bytecodes::Code bc_raw = scope->method()->raw_code_at_bci(info->stack()->bci());
if (Bytecodes::has_optional_appendix(bc_raw)) {
return PatchingStub::load_appendix_id;
}
return PatchingStub::load_mirror_id;
}
//---------------------------------------------------------------
LIR_Assembler::LIR_Assembler(Compilation* c):
_compilation(c)
, _masm(c->masm())
, _bs(Universe::heap()->barrier_set())
, _frame_map(c->frame_map())
, _current_block(NULL)
, _pending_non_safepoint(NULL)
, _pending_non_safepoint_offset(0)
{
_slow_case_stubs = new CodeStubList();
}
LIR_Assembler::~LIR_Assembler() {
}
void LIR_Assembler::check_codespace() {
CodeSection* cs = _masm->code_section();
if (cs->remaining() < (int)(NOT_LP64(1*K)LP64_ONLY(2*K))) {
BAILOUT("CodeBuffer overflow");
}
}
void LIR_Assembler::append_code_stub(CodeStub* stub) {
_slow_case_stubs->append(stub);
}
void LIR_Assembler::emit_stubs(CodeStubList* stub_list) {
for (int m = 0; m < stub_list->length(); m++) {
CodeStub* s = (*stub_list)[m];
check_codespace();
CHECK_BAILOUT();
#ifndef PRODUCT
if (CommentedAssembly) {
stringStream st;
s->print_name(&st);
st.print(" slow case");
_masm->block_comment(st.as_string());
}
#endif
s->emit_code(this);
#ifdef ASSERT
s->assert_no_unbound_labels();
#endif
}
}
void LIR_Assembler::emit_slow_case_stubs() {
emit_stubs(_slow_case_stubs);
}
bool LIR_Assembler::needs_icache(ciMethod* method) const {
return !method->is_static();
}
int LIR_Assembler::code_offset() const {
return _masm->offset();
}
address LIR_Assembler::pc() const {
return _masm->pc();
}
// To bang the stack of this compiled method we use the stack size
// that the interpreter would need in case of a deoptimization. This
// removes the need to bang the stack in the deoptimization blob which
// in turn simplifies stack overflow handling.
int LIR_Assembler::bang_size_in_bytes() const {
return MAX2(initial_frame_size_in_bytes() + os::extra_bang_size_in_bytes(), _compilation->interpreter_frame_size());
}
void LIR_Assembler::emit_exception_entries(ExceptionInfoList* info_list) {
for (int i = 0; i < info_list->length(); i++) {
XHandlers* handlers = info_list->at(i)->exception_handlers();
for (int j = 0; j < handlers->length(); j++) {
XHandler* handler = handlers->handler_at(j);
assert(handler->lir_op_id() != -1, "handler not processed by LinearScan");
assert(handler->entry_code() == NULL ||
handler->entry_code()->instructions_list()->last()->code() == lir_branch ||
handler->entry_code()->instructions_list()->last()->code() == lir_delay_slot, "last operation must be branch");
if (handler->entry_pco() == -1) {
// entry code not emitted yet
if (handler->entry_code() != NULL && handler->entry_code()->instructions_list()->length() > 1) {
handler->set_entry_pco(code_offset());
if (CommentedAssembly) {
_masm->block_comment("Exception adapter block");
}
emit_lir_list(handler->entry_code());
} else {
handler->set_entry_pco(handler->entry_block()->exception_handler_pco());
}
assert(handler->entry_pco() != -1, "must be set now");
}
}
}
}
void LIR_Assembler::emit_code(BlockList* hir) {
if (PrintLIR) {
print_LIR(hir);
}
int n = hir->length();
for (int i = 0; i < n; i++) {
emit_block(hir->at(i));
CHECK_BAILOUT();
}
flush_debug_info(code_offset());
DEBUG_ONLY(check_no_unbound_labels());
}
void LIR_Assembler::emit_block(BlockBegin* block) {
if (block->is_set(BlockBegin::backward_branch_target_flag)) {
align_backward_branch_target();
}
// if this block is the start of an exception handler, record the
// PC offset of the first instruction for later construction of
// the ExceptionHandlerTable
if (block->is_set(BlockBegin::exception_entry_flag)) {
block->set_exception_handler_pco(code_offset());
}
#ifndef PRODUCT
if (PrintLIRWithAssembly) {
// don't print Phi's
InstructionPrinter ip(false);
block->print(ip);
}
#endif /* PRODUCT */
assert(block->lir() != NULL, "must have LIR");
X86_ONLY(assert(_masm->rsp_offset() == 0, "frame size should be fixed"));
#ifndef PRODUCT
if (CommentedAssembly) {
stringStream st;
st.print_cr(" block B%d [%d, %d]", block->block_id(), block->bci(), block->end()->printable_bci());
_masm->block_comment(st.as_string());
}
#endif
emit_lir_list(block->lir());
X86_ONLY(assert(_masm->rsp_offset() == 0, "frame size should be fixed"));
}
void LIR_Assembler::emit_lir_list(LIR_List* list) {
peephole(list);
int n = list->length();
for (int i = 0; i < n; i++) {
LIR_Op* op = list->at(i);
check_codespace();
CHECK_BAILOUT();
#ifndef PRODUCT
if (CommentedAssembly) {
// Don't record out every op since that's too verbose. Print
// branches since they include block and stub names. Also print
// patching moves since they generate funny looking code.
if (op->code() == lir_branch ||
(op->code() == lir_move && op->as_Op1()->patch_code() != lir_patch_none)) {
stringStream st;
op->print_on(&st);
_masm->block_comment(st.as_string());
}
}
if (PrintLIRWithAssembly) {
// print out the LIR operation followed by the resulting assembly
list->at(i)->print(); tty->cr();
}
#endif /* PRODUCT */
op->emit_code(this);
if (compilation()->debug_info_recorder()->recording_non_safepoints()) {
process_debug_info(op);
}
#ifndef PRODUCT
if (PrintLIRWithAssembly) {
_masm->code()->decode();
}
#endif /* PRODUCT */
}
}
#ifdef ASSERT
void LIR_Assembler::check_no_unbound_labels() {
CHECK_BAILOUT();
for (int i = 0; i < _branch_target_blocks.length() - 1; i++) {
if (!_branch_target_blocks.at(i)->label()->is_bound()) {
tty->print_cr("label of block B%d is not bound", _branch_target_blocks.at(i)->block_id());
assert(false, "unbound label");
}
}
}
#endif
//----------------------------------debug info--------------------------------
void LIR_Assembler::add_debug_info_for_branch(CodeEmitInfo* info) {
int pc_offset = code_offset();
flush_debug_info(pc_offset);
info->record_debug_info(compilation()->debug_info_recorder(), pc_offset);
if (info->exception_handlers() != NULL) {
compilation()->add_exception_handlers_for_pco(pc_offset, info->exception_handlers());
}
}
void LIR_Assembler::add_call_info(int pc_offset, CodeEmitInfo* cinfo) {
flush_debug_info(pc_offset);
cinfo->record_debug_info(compilation()->debug_info_recorder(), pc_offset);
if (cinfo->exception_handlers() != NULL) {
compilation()->add_exception_handlers_for_pco(pc_offset, cinfo->exception_handlers());
}
}
static ValueStack* debug_info(Instruction* ins) {
StateSplit* ss = ins->as_StateSplit();
if (ss != NULL) return ss->state();
return ins->state_before();
}
void LIR_Assembler::process_debug_info(LIR_Op* op) {
Instruction* src = op->source();
if (src == NULL) return;
int pc_offset = code_offset();
if (_pending_non_safepoint == src) {
_pending_non_safepoint_offset = pc_offset;
return;
}
ValueStack* vstack = debug_info(src);
if (vstack == NULL) return;
if (_pending_non_safepoint != NULL) {
// Got some old debug info. Get rid of it.
if (debug_info(_pending_non_safepoint) == vstack) {
_pending_non_safepoint_offset = pc_offset;
return;
}
if (_pending_non_safepoint_offset < pc_offset) {
record_non_safepoint_debug_info();
}
_pending_non_safepoint = NULL;
}
// Remember the debug info.
if (pc_offset > compilation()->debug_info_recorder()->last_pc_offset()) {
_pending_non_safepoint = src;
_pending_non_safepoint_offset = pc_offset;
}
}
// Index caller states in s, where 0 is the oldest, 1 its callee, etc.
// Return NULL if n is too large.
// Returns the caller_bci for the next-younger state, also.
static ValueStack* nth_oldest(ValueStack* s, int n, int& bci_result) {
ValueStack* t = s;
for (int i = 0; i < n; i++) {
if (t == NULL) break;
t = t->caller_state();
}
if (t == NULL) return NULL;
for (;;) {
ValueStack* tc = t->caller_state();
if (tc == NULL) return s;
t = tc;
bci_result = tc->bci();
s = s->caller_state();
}
}
void LIR_Assembler::record_non_safepoint_debug_info() {
int pc_offset = _pending_non_safepoint_offset;
ValueStack* vstack = debug_info(_pending_non_safepoint);
int bci = vstack->bci();
DebugInformationRecorder* debug_info = compilation()->debug_info_recorder();
assert(debug_info->recording_non_safepoints(), "sanity");
debug_info->add_non_safepoint(pc_offset);
// Visit scopes from oldest to youngest.
for (int n = 0; ; n++) {
int s_bci = bci;
ValueStack* s = nth_oldest(vstack, n, s_bci);
if (s == NULL) break;
IRScope* scope = s->scope();
//Always pass false for reexecute since these ScopeDescs are never used for deopt
methodHandle null_mh;
debug_info->describe_scope(pc_offset, null_mh, scope->method(), s->bci(), false/*reexecute*/);
}
debug_info->end_non_safepoint(pc_offset);
}
ImplicitNullCheckStub* LIR_Assembler::add_debug_info_for_null_check_here(CodeEmitInfo* cinfo) {
return add_debug_info_for_null_check(code_offset(), cinfo);
}
ImplicitNullCheckStub* LIR_Assembler::add_debug_info_for_null_check(int pc_offset, CodeEmitInfo* cinfo) {
ImplicitNullCheckStub* stub = new ImplicitNullCheckStub(pc_offset, cinfo);
append_code_stub(stub);
return stub;
}
void LIR_Assembler::add_debug_info_for_div0_here(CodeEmitInfo* info) {
add_debug_info_for_div0(code_offset(), info);
}
void LIR_Assembler::add_debug_info_for_div0(int pc_offset, CodeEmitInfo* cinfo) {
DivByZeroStub* stub = new DivByZeroStub(pc_offset, cinfo);
append_code_stub(stub);
}
void LIR_Assembler::emit_rtcall(LIR_OpRTCall* op) {
rt_call(op->result_opr(), op->addr(), op->arguments(), op->tmp(), op->info());
}
void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
verify_oop_map(op->info());
if (os::is_MP()) {
// must align calls sites, otherwise they can't be updated atomically on MP hardware
align_call(op->code());
}
// emit the static call stub stuff out of line
emit_static_call_stub();
CHECK_BAILOUT();
switch (op->code()) {
case lir_static_call:
case lir_dynamic_call:
call(op, relocInfo::static_call_type);
break;
case lir_optvirtual_call:
call(op, relocInfo::opt_virtual_call_type);
break;
case lir_icvirtual_call:
ic_call(op);
break;
case lir_virtual_call:
vtable_call(op);
break;
default:
fatal("unexpected op code: %s", op->name());
break;
}
// JSR 292
// Record if this method has MethodHandle invokes.
if (op->is_method_handle_invoke()) {
compilation()->set_has_method_handle_invokes(true);
}
#if defined(X86) && defined(TIERED)
// C2 leave fpu stack dirty clean it
if (UseSSE < 2) {
int i;
for ( i = 1; i <= 7 ; i++ ) {
ffree(i);
}
if (!op->result_opr()->is_float_kind()) {
ffree(0);
}
}
#endif // X86 && TIERED
}
void LIR_Assembler::emit_opLabel(LIR_OpLabel* op) {
_masm->bind (*(op->label()));
}
void LIR_Assembler::emit_op1(LIR_Op1* op) {
switch (op->code()) {
case lir_move:
if (op->move_kind() == lir_move_volatile) {
assert(op->patch_code() == lir_patch_none, "can't patch volatiles");
volatile_move_op(op->in_opr(), op->result_opr(), op->type(), op->info());
} else {
move_op(op->in_opr(), op->result_opr(), op->type(),
op->patch_code(), op->info(), op->pop_fpu_stack(),
op->move_kind() == lir_move_unaligned,
op->move_kind() == lir_move_wide);
}
break;
case lir_roundfp: {
LIR_OpRoundFP* round_op = op->as_OpRoundFP();
roundfp_op(round_op->in_opr(), round_op->tmp(), round_op->result_opr(), round_op->pop_fpu_stack());
break;
}
case lir_return:
return_op(op->in_opr());
break;
case lir_safepoint:
if (compilation()->debug_info_recorder()->last_pc_offset() == code_offset()) {
_masm->nop();
}
safepoint_poll(op->in_opr(), op->info());
break;
case lir_fxch:
fxch(op->in_opr()->as_jint());
break;
case lir_fld:
fld(op->in_opr()->as_jint());
break;
case lir_ffree:
ffree(op->in_opr()->as_jint());
break;
case lir_branch:
break;
case lir_push:
push(op->in_opr());
break;
case lir_pop:
pop(op->in_opr());
break;
case lir_neg:
negate(op->in_opr(), op->result_opr());
break;
case lir_leal:
leal(op->in_opr(), op->result_opr());
break;
case lir_null_check:
if (GenerateCompilerNullChecks) {
ImplicitNullCheckStub* stub = add_debug_info_for_null_check_here(op->info());
if (op->in_opr()->is_single_cpu()) {
_masm->null_check(op->in_opr()->as_register(), stub->entry());
} else {
Unimplemented();
}
}
break;
case lir_monaddr:
monitor_address(op->in_opr()->as_constant_ptr()->as_jint(), op->result_opr());
break;
#ifdef SPARC
case lir_pack64:
pack64(op->in_opr(), op->result_opr());
break;
case lir_unpack64:
unpack64(op->in_opr(), op->result_opr());
break;
#endif
case lir_unwind:
unwind_op(op->in_opr());
break;
default:
Unimplemented();
break;
}
}
void LIR_Assembler::emit_op0(LIR_Op0* op) {
switch (op->code()) {
case lir_word_align: {
_masm->align(BytesPerWord);
break;
}
case lir_nop:
assert(op->info() == NULL, "not supported");
_masm->nop();
break;
case lir_label:
Unimplemented();
break;
case lir_build_frame:
build_frame();
break;
case lir_std_entry:
// init offsets
offsets()->set_value(CodeOffsets::OSR_Entry, _masm->offset());
_masm->align(CodeEntryAlignment);
if (needs_icache(compilation()->method())) {
check_icache();
}
offsets()->set_value(CodeOffsets::Verified_Entry, _masm->offset());
_masm->verified_entry();
build_frame();
offsets()->set_value(CodeOffsets::Frame_Complete, _masm->offset());
break;
case lir_osr_entry:
offsets()->set_value(CodeOffsets::OSR_Entry, _masm->offset());
osr_entry();
break;
case lir_24bit_FPU:
set_24bit_FPU();
break;
case lir_reset_FPU:
reset_FPU();
break;
case lir_breakpoint:
breakpoint();
break;
case lir_fpop_raw:
fpop();
break;
case lir_membar:
membar();
break;
case lir_membar_acquire:
membar_acquire();
break;
case lir_membar_release:
membar_release();
break;
case lir_membar_loadload:
membar_loadload();
break;
case lir_membar_storestore:
membar_storestore();
break;
case lir_membar_loadstore:
membar_loadstore();
break;
case lir_membar_storeload:
membar_storeload();
break;
case lir_get_thread:
get_thread(op->result_opr());
break;
default:
ShouldNotReachHere();
break;
}
}
void LIR_Assembler::emit_op2(LIR_Op2* op) {
switch (op->code()) {
case lir_cmp:
if (op->info() != NULL) {
assert(op->in_opr1()->is_address() || op->in_opr2()->is_address(),
"shouldn't be codeemitinfo for non-address operands");
add_debug_info_for_null_check_here(op->info()); // exception possible
}
comp_op(op->condition(), op->in_opr1(), op->in_opr2(), op);
break;
case lir_cmp_l2i:
case lir_cmp_fd2i:
case lir_ucmp_fd2i:
comp_fl2i(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op);
break;
case lir_cmove:
cmove(op->condition(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->type());
break;
case lir_shl:
case lir_shr:
case lir_ushr:
if (op->in_opr2()->is_constant()) {
shift_op(op->code(), op->in_opr1(), op->in_opr2()->as_constant_ptr()->as_jint(), op->result_opr());
} else {
shift_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp1_opr());
}
break;
case lir_add:
case lir_sub:
case lir_mul:
case lir_mul_strictfp:
case lir_div:
case lir_div_strictfp:
case lir_rem:
assert(op->fpu_pop_count() < 2, "");
arith_op(
op->code(),
op->in_opr1(),
op->in_opr2(),
op->result_opr(),
op->info(),
op->fpu_pop_count() == 1);
break;
case lir_abs:
case lir_sqrt:
case lir_sin:
case lir_tan:
case lir_cos:
case lir_log10:
case lir_pow:
intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op);
break;
case lir_logic_and:
case lir_logic_or:
case lir_logic_xor:
logic_op(
op->code(),
op->in_opr1(),
op->in_opr2(),
op->result_opr());
break;
case lir_throw:
throw_op(op->in_opr1(), op->in_opr2(), op->info());
break;
case lir_xadd:
case lir_xchg:
atomic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp1_opr());
break;
default:
Unimplemented();
break;
}
}
void LIR_Assembler::build_frame() {
_masm->build_frame(initial_frame_size_in_bytes(), bang_size_in_bytes());
}
void LIR_Assembler::roundfp_op(LIR_Opr src, LIR_Opr tmp, LIR_Opr dest, bool pop_fpu_stack) {
assert((src->is_single_fpu() && dest->is_single_stack()) ||
(src->is_double_fpu() && dest->is_double_stack()),
"round_fp: rounds register -> stack location");
reg2stack (src, dest, src->type(), pop_fpu_stack);
}
void LIR_Assembler::move_op(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_PatchCode patch_code, CodeEmitInfo* info, bool pop_fpu_stack, bool unaligned, bool wide) {
if (src->is_register()) {
if (dest->is_register()) {
assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");
reg2reg(src, dest);
} else if (dest->is_stack()) {
assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");
reg2stack(src, dest, type, pop_fpu_stack);
} else if (dest->is_address()) {
reg2mem(src, dest, type, patch_code, info, pop_fpu_stack, wide, unaligned);
} else {
ShouldNotReachHere();
}
} else if (src->is_stack()) {
assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");
if (dest->is_register()) {
stack2reg(src, dest, type);
} else if (dest->is_stack()) {
stack2stack(src, dest, type);
} else {
ShouldNotReachHere();
}
} else if (src->is_constant()) {
if (dest->is_register()) {
const2reg(src, dest, patch_code, info); // patching is possible
} else if (dest->is_stack()) {
assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");
const2stack(src, dest);
} else if (dest->is_address()) {
assert(patch_code == lir_patch_none, "no patching allowed here");
const2mem(src, dest, type, info, wide);
} else {
ShouldNotReachHere();
}
} else if (src->is_address()) {
mem2reg(src, dest, type, patch_code, info, wide, unaligned);
} else {
ShouldNotReachHere();
}
}
void LIR_Assembler::verify_oop_map(CodeEmitInfo* info) {
#ifndef PRODUCT
if (VerifyOops) {
OopMapStream s(info->oop_map());
while (!s.is_done()) {
OopMapValue v = s.current();
if (v.is_oop()) {
VMReg r = v.reg();
if (!r->is_stack()) {
stringStream st;
st.print("bad oop %s at %d", r->as_Register()->name(), _masm->offset());
#ifdef SPARC
_masm->_verify_oop(r->as_Register(), os::strdup(st.as_string(), mtCompiler), __FILE__, __LINE__);
#else
_masm->verify_oop(r->as_Register());
#endif
} else {
_masm->verify_stack_oop(r->reg2stack() * VMRegImpl::stack_slot_size);
}
}
check_codespace();
CHECK_BAILOUT();
s.next();
}
}
#endif
}
| Java |
-- Unban a player banned with Punkbuster.
-- From kmod script.
-- params is parameters passed from et_ClientCommand function.
-- * params["arg1"] => guid
function execute_command(params)
params.say = "chat"
if params.nbArg < 2 then
printCmdMsg(params, "Useage: unban [guid]\n")
else
if tonumber(et.trap_Cvar_Get("sv_punkbuster")) == 1 then
et.trap_SendConsoleCommand(
et.EXEC_APPEND,
"pb_sv_unbanguid " .. params["arg1"] .. "\n"
)
et.trap_SendConsoleCommand(
et.EXEC_APPEND,
"pb_sv_UpdBanFile\n"
)
params.broadcast2allClients = true
params.noDisplayCmd = true
printCmdMsg(
params,
client[clientNum]["name"] .. " have been unbanned\n"
)
else
printCmdMsg(
params,
"Cannot unban with Punkbuster (Punkbuster is disable).\n"
)
end
end
return 1
end
| Java |
define(function () {
return {
customerAccount: ['CustomerAccountService', function (CustomerAccountService) {
return CustomerAccountService.getCurrent();
}]
};
});
| Java |
<ul class="lang-switch nav navbar-nav navbar-right">
<li role="heading"><span class="nav-plain-text">Language:</span></li>
<li><a {% if page.lang contains 'en' %} class="active-lang"{% endif %} href="
{% if page.url contains '/fr' %}{{ page.url | remove_first:'/fr' }}
{% elsif page.url contains '/es' %}{{ page.url | remove_first:'/es' }}
{% else %}{{ page.url }}
{% endif %}" title="English">En</a></li>
<li><a {% if page.lang contains 'fr' %} class="active-lang"{% endif %} href="
{% if page.url contains '/fr' %}{{ page.url }}
{% elsif page.url contains '/es' %}{{ page.url | replace_first:'/es','/fr' }}
{% else %}{{ page.url | prepend:'/fr' }}
{% endif %}" title="French">Fr</a></li>
<li><a {% if page.lang contains 'es' %} class="active-lang"{% endif %} href="
{% if page.url contains '/es' %}{{ page.url }}
{% elsif page.url contains '/fr' %}{{ page.url | replace_first:'/fr','/es' }}
{% else %}{{ page.url | prepend:'/es' }}
{% endif %}" title="Spanish">Es</a></li>
</ul>
| Java |
/*
Tests multidimensional numerical integration using cubature.
Copyright 2014 Ilja Honkonen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "array"
#include "cmath"
#include "cstdlib"
#include "iostream"
#include "limits"
#include "cubature.h"
bool good_solution(
const double integral,
const double exact,
const double max_relative_error
) {
if (
std::fabs(integral - exact)
> max_relative_error * std::max(std::fabs(integral), std::fabs(exact))
) {
return false;
}
return true;
}
int main()
{
constexpr double max_acceptable_error = 1e-9;
// integration range
const std::array<double, 3> start{1, 1, 1}, end{2, 2, 2};
double integral, error, exact;
/*
Returns x*y^2*z^3.
In dimension(s) over which pcubature is integrating, x, y or z
are given by r, the rest are given in extra_data. Format of
extra_data: std::pair<std::array<size_t, 3>, std::array<double, 3>>.
size_t tells the index of the dimension over which integration over
Nth dimension in r actually goes. The first r_dims of
size_t's contain valid data. For the rest the corresponding
double contains the coordinate at which to integrate over the
rest of dimensions of r.
For example when integrating x and z from 0 to 1 with y == -2
integrand could be called by cubature as (999's mark unused data):
f = integrand(
2,
std::array<double, 2>{0, 0}.data(),
std::pair<
std::array<size_t, 3>,
std::array<double, 3>
>{{0, 2, 999}, {999, -2, 999}}.data(),
1,
ret_val.data()
);
and when integrating y from -2 to -1 with x == 0.5 and z == 2/3:
f = integrand(
1,
std::array<double, 1>{-2}.data(),
std::pair<
std::array<size_t, 3>,
std::array<double, 3>
>{{1, 999, 999}, {0.5, 999, 2/3}}.data(),
1,
ret_val.data()
);
*/
auto integrand
= [](
unsigned r_dims,
const double* r,
void* extra_data,
unsigned f_dims,
double* f
) {
if (r_dims == 0) {
return -1;
}
if (f_dims != 1) {
return -2;
}
if (r == NULL) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
if (f == NULL) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
if (extra_data == NULL) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
const auto integration_info
= *static_cast<
std::pair<
std::array<size_t, 3>,
std::array<double, 3>
>*
>(extra_data);
std::array<double, 3> real_r = integration_info.second;
for (size_t i = 0; i < r_dims; i++) {
if (integration_info.first[i] > 3) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
real_r[integration_info.first[i]] = *(r + i);
}
*f
= std::pow(real_r[0], 1)
* std::pow(real_r[1], 2)
* std::pow(real_r[2], 3);
return 0;
};
std::pair<std::array<size_t, 3>, std::array<double, 3>> integration_parameters;
// 1d over x at y == 3/2 and z == 3/2
exact = std::pow(3./2., 6);
integration_parameters.first[0] = 0;
integration_parameters.first[1] = 999;
integration_parameters.first[2] = 999;
integration_parameters.second[0] = 999;
integration_parameters.second[1] = 3.0 / 2.0;
integration_parameters.second[2] = 3.0 / 2.0;
if (
pcubature(
1,
integrand,
&integration_parameters,
1,
start.data(),
end.data(),
0,
0,
1e-3,
ERROR_LINF,
&integral,
&error
) != 0
) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
if (not good_solution(integral, exact, max_acceptable_error)) {
std::cerr << __FILE__ << "(" << __LINE__ << "): "
<< "Too large relative error when integrating from " << start[0]
<< " to " << end[0]
<< ", exact: " << exact
<< ", numerical: " << integral
<< std::endl;
abort();
}
// 2d over y and z at x == 3/2
exact = 105.0 / 8.0;
integration_parameters.first[0] = 1;
integration_parameters.first[1] = 2;
integration_parameters.first[2] = 999;
integration_parameters.second[0] = 3.0 / 2.0;
integration_parameters.second[1] = 999;
integration_parameters.second[2] = 999;
if (
pcubature(
1,
integrand,
&integration_parameters,
2,
start.data(),
end.data(),
0,
0,
1e-3,
ERROR_LINF,
&integral,
&error
) != 0
) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
if (not good_solution(integral, exact, max_acceptable_error)) {
std::cerr << __FILE__ << "(" << __LINE__ << "): "
<< "Too large relative error when integrating from "
<< start[1] << "," << start[2]
<< " to " << end[1] << "," << end[2]
<< ", exact: " << exact
<< ", numerical: " << integral
<< std::endl;
abort();
}
// integrate over the edges of the unit cube from start to end
std::array<
std::pair<
// exact value for below integration parameters
double,
// same as in integration_parameters
std::pair<
std::array<size_t, 3>,
std::array<double, 3>
>
>,
12
> integration_params1d{{
// over x at min y, min z
{3.0 / 2.0, {{0, 999, 999}, {999, 1, 1}}},
// x at min y, max z
{12, {{0, 999, 999}, {999, 1, 2}}},
// x at max y, min z
{6, {{0, 999, 999}, {999, 2, 1}}},
// x at max y, max z
{48, {{0, 999, 999}, {999, 2, 2}}},
// over y at min x, min z
{7.0 / 3.0, {{1, 999, 999}, {1, 999, 1}}},
// y at min x, max z
{56.0 / 3.0, {{1, 999, 999}, {1, 999, 2}}},
// y at max y, min z
{14.0 / 3.0, {{1, 999, 999}, {2, 999, 1}}},
// y at max x, max z
{112.0 / 3.0, {{1, 999, 999}, {2, 999, 2}}},
// over z at min x, min y
{15.0 / 4.0, {{2, 999, 999}, {1, 1, 999}}},
// z at min x, max y
{15, {{2, 999, 999}, {1, 2, 999}}},
// z at max x, min y
{15.0 / 2.0, {{2, 999, 999}, {2, 1, 999}}},
// z at max x, max y
{30, {{2, 999, 999}, {2, 2, 999}}}
}};
for (auto& info: integration_params1d) {
const double exact = info.first;
if (
pcubature(
1,
integrand,
&info.second,
1,
start.data(),
end.data(),
0,
0,
1e-3,
ERROR_LINF,
&integral,
&error
) != 0
) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
if (not good_solution(integral, exact, max_acceptable_error)) {
std::cerr << __FILE__ << "(" << __LINE__ << "): "
<< "Too large relative error, exact: " << exact
<< ", numerical: " << integral
<< std::endl;
abort();
}
}
// integrate over the faces of the unit cube from start to end
std::array<
std::pair<
double,
std::pair<
std::array<size_t, 3>,
std::array<double, 3>
>
>,
6
> integration_params2d{{
// over x and y at min z
{7.0 / 2.0, {{0, 1, 999}, {999, 999, 1}}},
// x, y at max z
{28, {{0, 1, 999}, {999, 999, 2}}},
// x, z at min y
{45.0 / 8.0, {{0, 2, 999}, {999, 1, 999}}},
// x, z at max y
{45.0 / 2.0, {{0, 2, 999}, {999, 2, 999}}},
// y, z at min x
{35.0 / 4.0, {{1, 2, 999}, {1, 999, 999}}},
// y, z at max x
{35.0 / 2.0, {{1, 2, 999}, {2, 999, 999}}}
}};
for (auto& info: integration_params2d) {
const double exact = info.first;
if (
pcubature(
1,
integrand,
&info.second,
2,
start.data(),
end.data(),
0,
0,
1e-3,
ERROR_LINF,
&integral,
&error
) != 0
) {
std::cerr << __FILE__ << "(" << __LINE__ << ")" << std::endl;
abort();
}
if (not good_solution(integral, exact, max_acceptable_error)) {
std::cerr << __FILE__ << "(" << __LINE__ << "): "
<< "Too large relative error, exact: " << exact
<< ", numerical: " << integral
<< std::endl;
abort();
}
}
return EXIT_SUCCESS;
}
| Java |
/*
* linux/include/linux/jbd2.h
*
* Written by Stephen C. Tweedie <sct@redhat.com>
*
* Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
*
* This file is part of the Linux kernel and is made available under
* the terms of the GNU General Public License, version 2, or at your
* option, any later version, incorporated herein by reference.
*
* Definitions for transaction data structures for the buffer cache
* filesystem journaling support.
*/
#ifndef _LINUX_JBD2_H
#define _LINUX_JBD2_H
/* Allow this file to be included directly into e2fsprogs */
#ifndef __KERNEL__
#include "jfs_compat.h"
#define JBD2_DEBUG
#define jfs_debug jbd_debug
#else
#include <linux/types.h>
#include <linux/buffer_head.h>
#include <linux/journal-head.h>
#include <linux/stddef.h>
#include <linux/bit_spinlock.h>
#include <linux/mutex.h>
#include <linux/timer.h>
#endif
#define journal_oom_retry 1
/*
* Define JBD2_PARANIOD_IOFAIL to cause a kernel BUG() if ext4 finds
* certain classes of error which can occur due to failed IOs. Under
* normal use we want ext4 to continue after such errors, because
* hardware _can_ fail, but for debugging purposes when running tests on
* known-good hardware we may want to trap these errors.
*/
#undef JBD2_PARANOID_IOFAIL
/*
* The default maximum commit age, in seconds.
*/
#define JBD2_DEFAULT_MAX_COMMIT_AGE 5
#ifdef CONFIG_JBD2_DEBUG
/*
* Define JBD2_EXPENSIVE_CHECKING to enable more expensive internal
* consistency checks. By default we don't do this unless
* CONFIG_JBD2_DEBUG is on.
*/
#define JBD2_EXPENSIVE_CHECKING
extern u8 jbd2_journal_enable_debug;
#define jbd_debug(n, f, a...) \
do { \
if ((n) <= jbd2_journal_enable_debug) { \
printk (KERN_DEBUG "(%s, %d): %s: ", \
__FILE__, __LINE__, __FUNCTION__); \
printk (f, ## a); \
} \
} while (0)
#else
#define jbd_debug(f, a...) /**/
#endif
static inline void *jbd2_alloc(size_t size, gfp_t flags)
{
return (void *)__get_free_pages(flags, get_order(size));
}
static inline void jbd2_free(void *ptr, size_t size)
{
free_pages((unsigned long)ptr, get_order(size));
};
#define JBD2_MIN_JOURNAL_BLOCKS 1024
#ifdef __KERNEL__
/**
* typedef handle_t - The handle_t type represents a single atomic update being performed by some process.
*
* All filesystem modifications made by the process go
* through this handle. Recursive operations (such as quota operations)
* are gathered into a single update.
*
* The buffer credits field is used to account for journaled buffers
* being modified by the running process. To ensure that there is
* enough log space for all outstanding operations, we need to limit the
* number of outstanding buffers possible at any time. When the
* operation completes, any buffer credits not used are credited back to
* the transaction, so that at all times we know how many buffers the
* outstanding updates on a transaction might possibly touch.
*
* This is an opaque datatype.
**/
typedef struct handle_s handle_t; /* Atomic operation type */
/**
* typedef journal_t - The journal_t maintains all of the journaling state information for a single filesystem.
*
* journal_t is linked to from the fs superblock structure.
*
* We use the journal_t to keep track of all outstanding transaction
* activity on the filesystem, and to manage the state of the log
* writing process.
*
* This is an opaque datatype.
**/
typedef struct journal_s journal_t; /* Journal control structure */
#endif
/*
* Internal structures used by the logging mechanism:
*/
#define JBD2_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
/*
* On-disk structures
*/
/*
* Descriptor block types:
*/
#define JBD2_DESCRIPTOR_BLOCK 1
#define JBD2_COMMIT_BLOCK 2
#define JBD2_SUPERBLOCK_V1 3
#define JBD2_SUPERBLOCK_V2 4
#define JBD2_REVOKE_BLOCK 5
/*
* Standard header for all descriptor blocks:
*/
typedef struct journal_header_s
{
__be32 h_magic;
__be32 h_blocktype;
__be32 h_sequence;
} journal_header_t;
/*
* Checksum types.
*/
#define JBD2_CRC32_CHKSUM 1
#define JBD2_MD5_CHKSUM 2
#define JBD2_SHA1_CHKSUM 3
#define JBD2_CRC32_CHKSUM_SIZE 4
#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
/*
* Commit block header for storing transactional checksums:
*/
struct commit_header {
__be32 h_magic;
__be32 h_blocktype;
__be32 h_sequence;
unsigned char h_chksum_type;
unsigned char h_chksum_size;
unsigned char h_padding[2];
__be32 h_chksum[JBD2_CHECKSUM_BYTES];
__be64 h_commit_sec;
__be32 h_commit_nsec;
};
/*
* The block tag: used to describe a single buffer in the journal.
* t_blocknr_high is only used if INCOMPAT_64BIT is set, so this
* raw struct shouldn't be used for pointer math or sizeof() - use
* journal_tag_bytes(journal) instead to compute this.
*/
typedef struct journal_block_tag_s
{
__be32 t_blocknr; /* The on-disk block number */
__be32 t_flags; /* See below */
__be32 t_blocknr_high; /* most-significant high 32bits. */
} journal_block_tag_t;
#define JBD2_TAG_SIZE32 (offsetof(journal_block_tag_t, t_blocknr_high))
#define JBD2_TAG_SIZE64 (sizeof(journal_block_tag_t))
/*
* The revoke descriptor: used on disk to describe a series of blocks to
* be revoked from the log
*/
typedef struct jbd2_journal_revoke_header_s
{
journal_header_t r_header;
__be32 r_count; /* Count of bytes used in the block */
} jbd2_journal_revoke_header_t;
/* Definitions for the journal tag flags word: */
#define JBD2_FLAG_ESCAPE 1 /* on-disk block is escaped */
#define JBD2_FLAG_SAME_UUID 2 /* block has same uuid as previous */
#define JBD2_FLAG_DELETED 4 /* block deleted by this transaction */
#define JBD2_FLAG_LAST_TAG 8 /* last tag in this descriptor block */
/*
* The journal superblock. All fields are in big-endian byte order.
*/
typedef struct journal_superblock_s
{
/* 0x0000 */
journal_header_t s_header;
/* 0x000C */
/* Static information describing the journal */
__be32 s_blocksize; /* journal device blocksize */
__be32 s_maxlen; /* total blocks in journal file */
__be32 s_first; /* first block of log information */
/* 0x0018 */
/* Dynamic information describing the current state of the log */
__be32 s_sequence; /* first commit ID expected in log */
__be32 s_start; /* blocknr of start of log */
/* 0x0020 */
/* Error value, as set by jbd2_journal_abort(). */
__be32 s_errno;
/* 0x0024 */
/* Remaining fields are only valid in a version-2 superblock */
__be32 s_feature_compat; /* compatible feature set */
__be32 s_feature_incompat; /* incompatible feature set */
__be32 s_feature_ro_compat; /* readonly-compatible feature set */
/* 0x0030 */
__u8 s_uuid[16]; /* 128-bit uuid for journal */
/* 0x0040 */
__be32 s_nr_users; /* Nr of filesystems sharing log */
__be32 s_dynsuper; /* Blocknr of dynamic superblock copy*/
/* 0x0048 */
__be32 s_max_transaction; /* Limit of journal blocks per trans.*/
__be32 s_max_trans_data; /* Limit of data blocks per trans. */
/* 0x0050 */
__u32 s_padding[44];
/* 0x0100 */
__u8 s_users[16*48]; /* ids of all fs'es sharing the log */
/* 0x0400 */
} journal_superblock_t;
#define JBD2_HAS_COMPAT_FEATURE(j,mask) \
((j)->j_format_version >= 2 && \
((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
#define JBD2_HAS_RO_COMPAT_FEATURE(j,mask) \
((j)->j_format_version >= 2 && \
((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
#define JBD2_HAS_INCOMPAT_FEATURE(j,mask) \
((j)->j_format_version >= 2 && \
((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
/* Features known to this kernel version: */
#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
JBD2_FEATURE_INCOMPAT_64BIT | \
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
#ifdef __KERNEL__
#include <linux/fs.h>
#include <linux/sched.h>
#define J_ASSERT(assert) BUG_ON(!(assert))
#if defined(CONFIG_BUFFER_DEBUG)
void buffer_assertion_failure(struct buffer_head *bh);
#define J_ASSERT_BH(bh, expr) \
do { \
if (!(expr)) \
buffer_assertion_failure(bh); \
J_ASSERT(expr); \
} while (0)
#define J_ASSERT_JH(jh, expr) J_ASSERT_BH(jh2bh(jh), expr)
#else
#define J_ASSERT_BH(bh, expr) J_ASSERT(expr)
#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
#endif
#if defined(JBD2_PARANOID_IOFAIL)
#define J_EXPECT(expr, why...) J_ASSERT(expr)
#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
#define J_EXPECT_JH(jh, expr, why...) J_ASSERT_JH(jh, expr)
#else
#define __journal_expect(expr, why...) \
({ \
int val = (expr); \
if (!val) { \
printk(KERN_ERR \
"EXT3-fs unexpected failure: %s;\n",# expr); \
printk(KERN_ERR why "\n"); \
} \
val; \
})
#define J_EXPECT(expr, why...) __journal_expect(expr, ## why)
#define J_EXPECT_BH(bh, expr, why...) __journal_expect(expr, ## why)
#define J_EXPECT_JH(jh, expr, why...) __journal_expect(expr, ## why)
#endif
enum jbd_state_bits {
BH_JBD /* Has an attached ext3 journal_head */
= BH_PrivateStart,
BH_JWrite, /* Being written to log (@@@ DEBUGGING) */
BH_Freed, /* Has been freed (truncated) */
BH_Revoked, /* Has been revoked from the log */
BH_RevokeValid, /* Revoked flag is valid */
BH_JBDDirty, /* Is dirty but journaled */
BH_State, /* Pins most journal_head state */
BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
};
BUFFER_FNS(JBD, jbd)
BUFFER_FNS(JWrite, jwrite)
BUFFER_FNS(JBDDirty, jbddirty)
TAS_BUFFER_FNS(JBDDirty, jbddirty)
BUFFER_FNS(Revoked, revoked)
TAS_BUFFER_FNS(Revoked, revoked)
BUFFER_FNS(RevokeValid, revokevalid)
TAS_BUFFER_FNS(RevokeValid, revokevalid)
BUFFER_FNS(Freed, freed)
static inline struct buffer_head *jh2bh(struct journal_head *jh)
{
return jh->b_bh;
}
static inline struct journal_head *bh2jh(struct buffer_head *bh)
{
return bh->b_private;
}
static inline void jbd_lock_bh_state(struct buffer_head *bh)
{
bit_spin_lock(BH_State, &bh->b_state);
}
static inline int jbd_trylock_bh_state(struct buffer_head *bh)
{
return bit_spin_trylock(BH_State, &bh->b_state);
}
static inline int jbd_is_locked_bh_state(struct buffer_head *bh)
{
return bit_spin_is_locked(BH_State, &bh->b_state);
}
static inline void jbd_unlock_bh_state(struct buffer_head *bh)
{
bit_spin_unlock(BH_State, &bh->b_state);
}
static inline void jbd_lock_bh_journal_head(struct buffer_head *bh)
{
bit_spin_lock(BH_JournalHead, &bh->b_state);
}
static inline void jbd_unlock_bh_journal_head(struct buffer_head *bh)
{
bit_spin_unlock(BH_JournalHead, &bh->b_state);
}
/* Flags in jbd_inode->i_flags */
#define __JI_COMMIT_RUNNING 0
/* Commit of the inode data in progress. We use this flag to protect us from
* concurrent deletion of inode. We cannot use reference to inode for this
* since we cannot afford doing last iput() on behalf of kjournald
*/
#define JI_COMMIT_RUNNING (1 << __JI_COMMIT_RUNNING)
/**
* struct jbd_inode is the structure linking inodes in ordered mode
* present in a transaction so that we can sync them during commit.
*/
struct jbd2_inode {
/* Which transaction does this inode belong to? Either the running
* transaction or the committing one. [j_list_lock] */
transaction_t *i_transaction;
/* Pointer to the running transaction modifying inode's data in case
* there is already a committing transaction touching it. [j_list_lock] */
transaction_t *i_next_transaction;
/* List of inodes in the i_transaction [j_list_lock] */
struct list_head i_list;
/* VFS inode this inode belongs to [constant during the lifetime
* of the structure] */
struct inode *i_vfs_inode;
/* Flags of inode [j_list_lock] */
unsigned int i_flags;
};
struct jbd2_revoke_table_s;
/**
* struct handle_s - The handle_s type is the concrete type associated with
* handle_t.
* @h_transaction: Which compound transaction is this update a part of?
* @h_buffer_credits: Number of remaining buffers we are allowed to dirty.
* @h_ref: Reference count on this handle
* @h_err: Field for caller's use to track errors through large fs operations
* @h_sync: flag for sync-on-close
* @h_jdata: flag to force data journaling
* @h_aborted: flag indicating fatal error on handle
**/
/* Docbook can't yet cope with the bit fields, but will leave the documentation
* in so it can be fixed later.
*/
struct handle_s
{
/* Which compound transaction is this update a part of? */
transaction_t *h_transaction;
/* Number of remaining buffers we are allowed to dirty: */
int h_buffer_credits;
/* Reference count on this handle */
int h_ref;
/* Field for caller's use to track errors through large fs */
/* operations */
int h_err;
/* Flags [no locking] */
unsigned int h_sync: 1; /* sync-on-close */
unsigned int h_jdata: 1; /* force data journaling */
unsigned int h_aborted: 1; /* fatal error on handle */
#ifdef CONFIG_DEBUG_LOCK_ALLOC
struct lockdep_map h_lockdep_map;
#endif
};
/*
* Some stats for checkpoint phase
*/
struct transaction_chp_stats_s {
unsigned long cs_chp_time;
unsigned long cs_forced_to_close;
unsigned long cs_written;
unsigned long cs_dropped;
};
/* The transaction_t type is the guts of the journaling mechanism. It
* tracks a compound transaction through its various states:
*
* RUNNING: accepting new updates
* LOCKED: Updates still running but we don't accept new ones
* RUNDOWN: Updates are tidying up but have finished requesting
* new buffers to modify (state not used for now)
* FLUSH: All updates complete, but we are still writing to disk
* COMMIT: All data on disk, writing commit record
* FINISHED: We still have to keep the transaction for checkpointing.
*
* The transaction keeps track of all of the buffers modified by a
* running transaction, and all of the buffers committed but not yet
* flushed to home for finished transactions.
*/
/*
* Lock ranking:
*
* j_list_lock
* ->jbd_lock_bh_journal_head() (This is "innermost")
*
* j_state_lock
* ->jbd_lock_bh_state()
*
* jbd_lock_bh_state()
* ->j_list_lock
*
* j_state_lock
* ->t_handle_lock
*
* j_state_lock
* ->j_list_lock (journal_unmap_buffer)
*
*/
struct transaction_s
{
/* Pointer to the journal for this transaction. [no locking] */
journal_t *t_journal;
/* Sequence number for this transaction [no locking] */
tid_t t_tid;
/*
* Transaction's current state
* [no locking - only kjournald2 alters this]
* [j_list_lock] guards transition of a transaction into T_FINISHED
* state and subsequent call of __jbd2_journal_drop_transaction()
* FIXME: needs barriers
* KLUDGE: [use j_state_lock]
*/
enum {
T_RUNNING,
T_LOCKED,
T_RUNDOWN,
T_FLUSH,
T_COMMIT,
T_FINISHED
} t_state;
/*
* Where in the log does this transaction's commit start? [no locking]
*/
unsigned long t_log_start;
/* Number of buffers on the t_buffers list [j_list_lock] */
int t_nr_buffers;
/*
* Doubly-linked circular list of all buffers reserved but not yet
* modified by this transaction [j_list_lock]
*/
struct journal_head *t_reserved_list;
/*
* Doubly-linked circular list of all metadata buffers owned by this
* transaction [j_list_lock]
*/
struct journal_head *t_buffers;
/*
* Doubly-linked circular list of all forget buffers (superseded
* buffers which we can un-checkpoint once this transaction commits)
* [j_list_lock]
*/
struct journal_head *t_forget;
/*
* Doubly-linked circular list of all buffers still to be flushed before
* this transaction can be checkpointed. [j_list_lock]
*/
struct journal_head *t_checkpoint_list;
/*
* Doubly-linked circular list of all buffers submitted for IO while
* checkpointing. [j_list_lock]
*/
struct journal_head *t_checkpoint_io_list;
/*
* Doubly-linked circular list of temporary buffers currently undergoing
* IO in the log [j_list_lock]
*/
struct journal_head *t_iobuf_list;
/*
* Doubly-linked circular list of metadata buffers being shadowed by log
* IO. The IO buffers on the iobuf list and the shadow buffers on this
* list match each other one for one at all times. [j_list_lock]
*/
struct journal_head *t_shadow_list;
/*
* Doubly-linked circular list of control buffers being written to the
* log. [j_list_lock]
*/
struct journal_head *t_log_list;
/*
* List of inodes whose data we've modified in data=ordered mode.
* [j_list_lock]
*/
struct list_head t_inode_list;
/*
* Protects info related to handles
*/
spinlock_t t_handle_lock;
/*
* Longest time some handle had to wait for running transaction
*/
unsigned long t_max_wait;
/*
* When transaction started
*/
unsigned long t_start;
/*
* Checkpointing stats [j_checkpoint_sem]
*/
struct transaction_chp_stats_s t_chp_stats;
/*
* Number of outstanding updates running on this transaction
* [t_handle_lock]
*/
int t_updates;
/*
* Number of buffers reserved for use by all handles in this transaction
* handle but not yet modified. [t_handle_lock]
*/
int t_outstanding_credits;
/*
* Forward and backward links for the circular list of all transactions
* awaiting checkpoint. [j_list_lock]
*/
transaction_t *t_cpnext, *t_cpprev;
/*
* When will the transaction expire (become due for commit), in jiffies?
* [no locking]
*/
unsigned long t_expires;
/*
* How many handles used this transaction? [t_handle_lock]
*/
int t_handle_count;
};
struct transaction_run_stats_s {
unsigned long rs_wait;
unsigned long rs_running;
unsigned long rs_locked;
unsigned long rs_flushing;
unsigned long rs_logging;
unsigned long rs_handle_count;
unsigned long rs_blocks;
unsigned long rs_blocks_logged;
};
struct transaction_stats_s {
int ts_type;
unsigned long ts_tid;
union {
struct transaction_run_stats_s run;
struct transaction_chp_stats_s chp;
} u;
};
#define JBD2_STATS_RUN 1
#define JBD2_STATS_CHECKPOINT 2
static inline unsigned long
jbd2_time_diff(unsigned long start, unsigned long end)
{
if (end >= start)
return end - start;
return end + (MAX_JIFFY_OFFSET - start);
}
/**
* struct journal_s - The journal_s type is the concrete type associated with
* journal_t.
* @j_flags: General journaling state flags
* @j_errno: Is there an outstanding uncleared error on the journal (from a
* prior abort)?
* @j_sb_buffer: First part of superblock buffer
* @j_superblock: Second part of superblock buffer
* @j_format_version: Version of the superblock format
* @j_state_lock: Protect the various scalars in the journal
* @j_barrier_count: Number of processes waiting to create a barrier lock
* @j_barrier: The barrier lock itself
* @j_running_transaction: The current running transaction..
* @j_committing_transaction: the transaction we are pushing to disk
* @j_checkpoint_transactions: a linked circular list of all transactions
* waiting for checkpointing
* @j_wait_transaction_locked: Wait queue for waiting for a locked transaction
* to start committing, or for a barrier lock to be released
* @j_wait_logspace: Wait queue for waiting for checkpointing to complete
* @j_wait_done_commit: Wait queue for waiting for commit to complete
* @j_wait_checkpoint: Wait queue to trigger checkpointing
* @j_wait_commit: Wait queue to trigger commit
* @j_wait_updates: Wait queue to wait for updates to complete
* @j_checkpoint_mutex: Mutex for locking against concurrent checkpoints
* @j_head: Journal head - identifies the first unused block in the journal
* @j_tail: Journal tail - identifies the oldest still-used block in the
* journal.
* @j_free: Journal free - how many free blocks are there in the journal?
* @j_first: The block number of the first usable block
* @j_last: The block number one beyond the last usable block
* @j_dev: Device where we store the journal
* @j_blocksize: blocksize for the location where we store the journal.
* @j_blk_offset: starting block offset for into the device where we store the
* journal
* @j_fs_dev: Device which holds the client fs. For internal journal this will
* be equal to j_dev
* @j_maxlen: Total maximum capacity of the journal region on disk.
* @j_list_lock: Protects the buffer lists and internal buffer state.
* @j_inode: Optional inode where we store the journal. If present, all journal
* block numbers are mapped into this inode via bmap().
* @j_tail_sequence: Sequence number of the oldest transaction in the log
* @j_transaction_sequence: Sequence number of the next transaction to grant
* @j_commit_sequence: Sequence number of the most recently committed
* transaction
* @j_commit_request: Sequence number of the most recent transaction wanting
* commit
* @j_uuid: Uuid of client object.
* @j_task: Pointer to the current commit thread for this journal
* @j_max_transaction_buffers: Maximum number of metadata buffers to allow in a
* single compound commit transaction
* @j_commit_interval: What is the maximum transaction lifetime before we begin
* a commit?
* @j_commit_timer: The timer used to wakeup the commit thread
* @j_revoke_lock: Protect the revoke table
* @j_revoke: The revoke table - maintains the list of revoked blocks in the
* current transaction.
* @j_revoke_table: alternate revoke tables for j_revoke
* @j_wbuf: array of buffer_heads for jbd2_journal_commit_transaction
* @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
* number that will fit in j_blocksize
* @j_last_sync_writer: most recent pid which did a synchronous write
* @j_history: Buffer storing the transactions statistics history
* @j_history_max: Maximum number of transactions in the statistics history
* @j_history_cur: Current number of transactions in the statistics history
* @j_history_lock: Protect the transactions statistics history
* @j_proc_entry: procfs entry for the jbd statistics directory
* @j_stats: Overall statistics
* @j_private: An opaque pointer to fs-private information.
*/
struct journal_s
{
/* General journaling state flags [j_state_lock] */
unsigned long j_flags;
/*
* Is there an outstanding uncleared error on the journal (from a prior
* abort)? [j_state_lock]
*/
int j_errno;
/* The superblock buffer */
struct buffer_head *j_sb_buffer;
journal_superblock_t *j_superblock;
/* Version of the superblock format */
int j_format_version;
/*
* Protect the various scalars in the journal
*/
spinlock_t j_state_lock;
/*
* Number of processes waiting to create a barrier lock [j_state_lock]
*/
int j_barrier_count;
/* The barrier lock itself */
struct mutex j_barrier;
/*
* Transactions: The current running transaction...
* [j_state_lock] [caller holding open handle]
*/
transaction_t *j_running_transaction;
/*
* the transaction we are pushing to disk
* [j_state_lock] [caller holding open handle]
*/
transaction_t *j_committing_transaction;
/*
* ... and a linked circular list of all transactions waiting for
* checkpointing. [j_list_lock]
*/
transaction_t *j_checkpoint_transactions;
/*
* Wait queue for waiting for a locked transaction to start committing,
* or for a barrier lock to be released
*/
wait_queue_head_t j_wait_transaction_locked;
/* Wait queue for waiting for checkpointing to complete */
wait_queue_head_t j_wait_logspace;
/* Wait queue for waiting for commit to complete */
wait_queue_head_t j_wait_done_commit;
/* Wait queue to trigger checkpointing */
wait_queue_head_t j_wait_checkpoint;
/* Wait queue to trigger commit */
wait_queue_head_t j_wait_commit;
/* Wait queue to wait for updates to complete */
wait_queue_head_t j_wait_updates;
/* Semaphore for locking against concurrent checkpoints */
struct mutex j_checkpoint_mutex;
/*
* Journal head: identifies the first unused block in the journal.
* [j_state_lock]
*/
unsigned long j_head;
/*
* Journal tail: identifies the oldest still-used block in the journal.
* [j_state_lock]
*/
unsigned long j_tail;
/*
* Journal free: how many free blocks are there in the journal?
* [j_state_lock]
*/
unsigned long j_free;
/*
* Journal start and end: the block numbers of the first usable block
* and one beyond the last usable block in the journal. [j_state_lock]
*/
unsigned long j_first;
unsigned long j_last;
/*
* Device, blocksize and starting block offset for the location where we
* store the journal.
*/
struct block_device *j_dev;
int j_blocksize;
unsigned long long j_blk_offset;
char j_devname[BDEVNAME_SIZE+24];
/*
* Device which holds the client fs. For internal journal this will be
* equal to j_dev.
*/
struct block_device *j_fs_dev;
/* Total maximum capacity of the journal region on disk. */
unsigned int j_maxlen;
/*
* Protects the buffer lists and internal buffer state.
*/
spinlock_t j_list_lock;
/* Optional inode where we store the journal. If present, all */
/* journal block numbers are mapped into this inode via */
/* bmap(). */
struct inode *j_inode;
/*
* Sequence number of the oldest transaction in the log [j_state_lock]
*/
tid_t j_tail_sequence;
/*
* Sequence number of the next transaction to grant [j_state_lock]
*/
tid_t j_transaction_sequence;
/*
* Sequence number of the most recently committed transaction
* [j_state_lock].
*/
tid_t j_commit_sequence;
/*
* Sequence number of the most recent transaction wanting commit
* [j_state_lock]
*/
tid_t j_commit_request;
/*
* Journal uuid: identifies the object (filesystem, LVM volume etc)
* backed by this journal. This will eventually be replaced by an array
* of uuids, allowing us to index multiple devices within a single
* journal and to perform atomic updates across them.
*/
__u8 j_uuid[16];
/* Pointer to the current commit thread for this journal */
struct task_struct *j_task;
/*
* Maximum number of metadata buffers to allow in a single compound
* commit transaction
*/
int j_max_transaction_buffers;
/*
* What is the maximum transaction lifetime before we begin a commit?
*/
unsigned long j_commit_interval;
/* The timer used to wakeup the commit thread: */
struct timer_list j_commit_timer;
/*
* The revoke table: maintains the list of revoked blocks in the
* current transaction. [j_revoke_lock]
*/
spinlock_t j_revoke_lock;
struct jbd2_revoke_table_s *j_revoke;
struct jbd2_revoke_table_s *j_revoke_table[2];
/*
* array of bhs for jbd2_journal_commit_transaction
*/
struct buffer_head **j_wbuf;
int j_wbufsize;
pid_t j_last_sync_writer;
/*
* Journal statistics
*/
struct transaction_stats_s *j_history;
int j_history_max;
int j_history_cur;
/*
* Protect the transactions statistics history
*/
spinlock_t j_history_lock;
struct proc_dir_entry *j_proc_entry;
struct transaction_stats_s j_stats;
/* Failed journal commit ID */
unsigned int j_failed_commit;
/*
* An opaque pointer to fs-private information. ext3 puts its
* superblock pointer here
*/
void *j_private;
};
/*
* Journal flag definitions
*/
#define JBD2_UNMOUNT 0x001 /* Journal thread is being destroyed */
#define JBD2_ABORT 0x002 /* Journaling has been aborted for errors. */
#define JBD2_ACK_ERR 0x004 /* The errno in the sb has been acked */
#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */
#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */
#define JBD2_BARRIER 0x020 /* Use IDE barriers */
/*
* Function declarations for the journaling transaction and buffer
* management
*/
/* Filing buffers */
extern void jbd2_journal_unfile_buffer(journal_t *, struct journal_head *);
extern void __jbd2_journal_unfile_buffer(struct journal_head *);
extern void __jbd2_journal_refile_buffer(struct journal_head *);
extern void jbd2_journal_refile_buffer(journal_t *, struct journal_head *);
extern void __jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
extern void __journal_free_buffer(struct journal_head *bh);
extern void jbd2_journal_file_buffer(struct journal_head *, transaction_t *, int);
extern void __journal_clean_data_list(transaction_t *transaction);
/* Log buffer allocation */
extern struct journal_head * jbd2_journal_get_descriptor_buffer(journal_t *);
int jbd2_journal_next_log_block(journal_t *, unsigned long long *);
/* Commit management */
extern void jbd2_journal_commit_transaction(journal_t *);
/* Checkpoint list management */
int __jbd2_journal_clean_checkpoint_list(journal_t *journal);
int __jbd2_journal_remove_checkpoint(struct journal_head *);
void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
/* Buffer IO */
extern int
jbd2_journal_write_metadata_buffer(transaction_t *transaction,
struct journal_head *jh_in,
struct journal_head **jh_out,
unsigned long long blocknr);
/* Transaction locking */
extern void __wait_on_journal (journal_t *);
/*
* Journal locking.
*
* We need to lock the journal during transaction state changes so that nobody
* ever tries to take a handle on the running transaction while we are in the
* middle of moving it to the commit phase. j_state_lock does this.
*
* Note that the locking is completely interrupt unsafe. We never touch
* journal structures from interrupts.
*/
static inline handle_t *journal_current_handle(void)
{
return current->journal_info;
}
/* The journaling code user interface:
*
* Create and destroy handles
* Register buffer modifications against the current transaction.
*/
extern handle_t *jbd2_journal_start(journal_t *, int nblocks);
extern int jbd2_journal_restart (handle_t *, int nblocks);
extern int jbd2_journal_extend (handle_t *, int nblocks);
extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
extern void journal_sync_buffer (struct buffer_head *);
extern void jbd2_journal_invalidatepage(journal_t *,
struct page *, unsigned long);
extern int jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);
extern int jbd2_journal_stop(handle_t *);
extern int jbd2_journal_flush (journal_t *);
extern void jbd2_journal_lock_updates (journal_t *);
extern void jbd2_journal_unlock_updates (journal_t *);
extern journal_t * jbd2_journal_init_dev(struct block_device *bdev,
struct block_device *fs_dev,
unsigned long long start, int len, int bsize);
extern journal_t * jbd2_journal_init_inode (struct inode *);
extern int jbd2_journal_update_format (journal_t *);
extern int jbd2_journal_check_used_features
(journal_t *, unsigned long, unsigned long, unsigned long);
extern int jbd2_journal_check_available_features
(journal_t *, unsigned long, unsigned long, unsigned long);
extern int jbd2_journal_set_features
(journal_t *, unsigned long, unsigned long, unsigned long);
extern void jbd2_journal_clear_features
(journal_t *, unsigned long, unsigned long, unsigned long);
extern int jbd2_journal_create (journal_t *);
extern int jbd2_journal_load (journal_t *journal);
extern void jbd2_journal_destroy (journal_t *);
extern int jbd2_journal_recover (journal_t *journal);
extern int jbd2_journal_wipe (journal_t *, int);
extern int jbd2_journal_skip_recovery (journal_t *);
extern void jbd2_journal_update_superblock (journal_t *, int);
extern void __jbd2_journal_abort_hard (journal_t *);
extern void jbd2_journal_abort (journal_t *, int);
extern int jbd2_journal_errno (journal_t *);
extern void jbd2_journal_ack_err (journal_t *);
extern int jbd2_journal_clear_err (journal_t *);
extern int jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
extern int jbd2_journal_force_commit(journal_t *);
extern int jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
extern int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
extern void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
extern void jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
/*
* journal_head management
*/
struct journal_head *jbd2_journal_add_journal_head(struct buffer_head *bh);
struct journal_head *jbd2_journal_grab_journal_head(struct buffer_head *bh);
void jbd2_journal_remove_journal_head(struct buffer_head *bh);
void jbd2_journal_put_journal_head(struct journal_head *jh);
/*
* handle management
*/
extern struct kmem_cache *jbd2_handle_cache;
static inline handle_t *jbd2_alloc_handle(gfp_t gfp_flags)
{
return kmem_cache_alloc(jbd2_handle_cache, gfp_flags);
}
static inline void jbd2_free_handle(handle_t *handle)
{
kmem_cache_free(jbd2_handle_cache, handle);
}
/* Primary revoke support */
#define JOURNAL_REVOKE_DEFAULT_HASH 256
extern int jbd2_journal_init_revoke(journal_t *, int);
extern void jbd2_journal_destroy_revoke_caches(void);
extern int jbd2_journal_init_revoke_caches(void);
extern void jbd2_journal_destroy_revoke(journal_t *);
extern int jbd2_journal_revoke (handle_t *, unsigned long long, struct buffer_head *);
extern int jbd2_journal_cancel_revoke(handle_t *, struct journal_head *);
extern void jbd2_journal_write_revoke_records(journal_t *, transaction_t *);
/* Recovery revoke support */
extern int jbd2_journal_set_revoke(journal_t *, unsigned long long, tid_t);
extern int jbd2_journal_test_revoke(journal_t *, unsigned long long, tid_t);
extern void jbd2_journal_clear_revoke(journal_t *);
extern void jbd2_journal_switch_revoke_table(journal_t *journal);
/*
* The log thread user interface:
*
* Request space in the current transaction, and force transaction commit
* transitions on demand.
*/
int __jbd2_log_space_left(journal_t *); /* Called with journal locked */
int jbd2_log_start_commit(journal_t *journal, tid_t tid);
int __jbd2_log_start_commit(journal_t *journal, tid_t tid);
int jbd2_journal_start_commit(journal_t *journal, tid_t *tid);
int jbd2_journal_force_commit_nested(journal_t *journal);
int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
int jbd2_log_do_checkpoint(journal_t *journal);
void __jbd2_log_wait_for_space(journal_t *journal);
extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
extern int jbd2_cleanup_journal_tail(journal_t *);
/* Debugging code only: */
#define jbd_ENOSYS() \
do { \
printk (KERN_ERR "JBD unimplemented function %s\n", __FUNCTION__); \
current->state = TASK_UNINTERRUPTIBLE; \
schedule(); \
} while (1)
/*
* is_journal_abort
*
* Simple test wrapper function to test the JBD2_ABORT state flag. This
* bit, when set, indicates that we have had a fatal error somewhere,
* either inside the journaling layer or indicated to us by the client
* (eg. ext3), and that we and should not commit any further
* transactions.
*/
static inline int is_journal_aborted(journal_t *journal)
{
return journal->j_flags & JBD2_ABORT;
}
static inline int is_handle_aborted(handle_t *handle)
{
if (handle->h_aborted)
return 1;
return is_journal_aborted(handle->h_transaction->t_journal);
}
static inline void jbd2_journal_abort_handle(handle_t *handle)
{
handle->h_aborted = 1;
}
#endif /* __KERNEL__ */
/* Comparison functions for transaction IDs: perform comparisons using
* modulo arithmetic so that they work over sequence number wraps. */
static inline int tid_gt(tid_t x, tid_t y)
{
int difference = (x - y);
return (difference > 0);
}
static inline int tid_geq(tid_t x, tid_t y)
{
int difference = (x - y);
return (difference >= 0);
}
extern int jbd2_journal_blocks_per_page(struct inode *inode);
extern size_t journal_tag_bytes(journal_t *journal);
/*
* Return the minimum number of blocks which must be free in the journal
* before a new transaction may be started. Must be called under j_state_lock.
*/
static inline int jbd_space_needed(journal_t *journal)
{
int nblocks = journal->j_max_transaction_buffers;
if (journal->j_committing_transaction)
nblocks += journal->j_committing_transaction->
t_outstanding_credits;
return nblocks;
}
/*
* Definitions which augment the buffer_head layer
*/
/* journaling buffer types */
#define BJ_None 0 /* Not journaled */
#define BJ_Metadata 1 /* Normal journaled metadata */
#define BJ_Forget 2 /* Buffer superseded by this transaction */
#define BJ_IO 3 /* Buffer is for temporary IO use */
#define BJ_Shadow 4 /* Buffer contents being shadowed to the log */
#define BJ_LogCtl 5 /* Buffer contains log descriptors */
#define BJ_Reserved 6 /* Buffer is reserved for access by journal */
#define BJ_Types 7
extern int jbd_blocks_per_page(struct inode *inode);
#ifdef __KERNEL__
#define buffer_trace_init(bh) do {} while (0)
#define print_buffer_fields(bh) do {} while (0)
#define print_buffer_trace(bh) do {} while (0)
#define BUFFER_TRACE(bh, info) do {} while (0)
#define BUFFER_TRACE2(bh, bh2, info) do {} while (0)
#define JBUFFER_TRACE(jh, info) do {} while (0)
#endif /* __KERNEL__ */
#endif /* _LINUX_JBD2_H */
| Java |
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Components.Aphid.Parser
{
public class AphidExpressionBinder : SerializationBinder
{
private const string _prefix = "System.Collections.Generic.List`1[[";
public override Type BindToType(string assemblyName, string typeName)
{
if (typeName.StartsWith(_prefix))
{
var name = typeName.Substring(_prefix.Length).RemoveAtIndexOf(',');
return typeof(List<>).MakeGenericType(Type.GetType(name));
}
return Type.GetType(typeName);
}
}
}
| Java |
/****************************************************************************
**
** Jreen
**
** Copyright © 2011 Aleksey Sidorov <gorthauer87@yandex.ru>
**
*****************************************************************************
**
** $JREEN_BEGIN_LICENSE$
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see http://www.gnu.org/licenses/.
** $JREEN_END_LICENSE$
**
****************************************************************************/
#ifndef BOOKMARK_H
#define BOOKMARK_H
#include "stanzaextension.h"
#include "jid.h"
namespace Jreen {
//XEP-0048
//http://xmpp.org/extensions/xep-0048.html
class BookmarkPrivate;
/*! For ease-of-use in a Jabber client, it is desirable to have a way to store shortcuts
* to various services and resources (such as conference rooms and web pages) as "bookmarks"
* that can be displayed in the user's client.
* Several Jabber clients have already agreed on and implemented a method to provide this service;
* that informal agreement is documented and expanded upon in this document
*/
class JREEN_EXPORT Bookmark : public Payload
{
Q_DECLARE_PRIVATE(Bookmark)
J_PAYLOAD(Jreen::Bookmark) //dummy
public:
class ConferencePrivate;
class JREEN_EXPORT Conference
{
public:
Conference();
Conference(const QString &name, const JID &jid, const QString &nick,
const QString &password = QString(), bool autojoin = false);
Conference(const Conference &o);
Conference &operator =(const Conference &o);
~Conference();
bool operator ==(const Conference &o);
bool operator !=(const Conference &o);
bool isValid() const;
void setJid(const JID &jid);
void setName(const QString &name);
/*! set the user's preferred roomnick for the chatroom
*/
void setNick(const QString &nick);
/*! set an unencrypted string for the password needed to enter a password-protected room.
* \note For security reasons, use of this element is NOT RECOMMENDED.
*/
void setPassword(const QString &password);
/*! set autojoin attribute
*/
void setAutojoin(bool set);
/*! returns friendly name of bookmark
*/
QString name() const;
/*! returns friendly name of bookmark
*/
QString nick() const;
/*! returns the user's preferred roomnick for the chatroom
*/
QString password() const;
/*! returns JabberID of the chat room.
*/
JID jid() const;
/*! returns autojoin attribute
*/
bool autojoin() const;
private:
QExplicitlySharedDataPointer<ConferencePrivate> d_ptr;
};
/*! Default constructor \param jid - The JabberID of the chat room
* \param name - A friendly name for the bookmark(optional)
* \param nick - The user's preferred roomnick for the chatroom(optional).
*/
Bookmark();
/*! set friendly name of bookmark
*/
~Bookmark();
QList<Conference> conferences() const;
void addConference(const Conference &conf);
void setConferences(const QList<Conference> &conferences);
private:
QScopedPointer<BookmarkPrivate> d_ptr;
};
} // namespace Jreen
#endif // BOOKMARK_H
| Java |
# export AWS_ACCESS_KEY="Your-Access-Key"
# export AWS_SECRET_KEY="Your-Secret-Key"
today=`date +"%d-%m-%Y","%T"`
logfile="/awslog/automation-instances.log"
# Grab all Instance IDs for REBOOT action and export the IDs to a text file
sudo aws ec2 describe-instances --filters Name=tag:reboot-time,Values=18-00 Name=tag:bash-profile,Values=wd --query Reservations[*].Instances[*].[InstanceId] --output text > ~/tmp/reboot_wd_instance_info.txt 2>&1
# Take list of rebooting instances
for instance_id in $(cat ~/tmp/reboot_wd_instance_info.txt)
do
# Reboot instances
rebootresult=$(sudo aws ec2 reboot-instances --instance-ids $instance_id)
# Put info into log file
echo Atempt to reboot $today instances by AWS CLI with result $rebootresult --EMPTY FOR NO RESULT-- >> $logfile
done
| Java |
<?php
global $VISUAL_COMPOSER_EXTENSIONS;
?>
<div id="ts-settings-files" class="tab-content">
<div class="ts-vcsc-section-main">
<div class="ts-vcsc-section-title ts-vcsc-section-show"><i class="dashicons-download"></i>External Files Settings</div>
<div class="ts-vcsc-section-content">
<div class="ts-vcsc-notice-field ts-vcsc-critical" style="margin-top: 10px; font-size: 13px; text-align: justify; font-weight: bold;">
Changes to the default settings done in this section can severely impact the overall functionality of this add-on or WordPress itself. Only make changes if you really know what you are doing and if the add-on is not
working correctly with the default settings!
</div>
<p>
<h4>Force Load of jQuery:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to force a load of jQuery and jQuery Migrate:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadjQuery == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadjQuery" class="toggle-check ts_vcsc_extend_settings_loadjQuery" name="ts_vcsc_extend_settings_loadjQuery" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadjQuery); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadjQuery == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadjQuery == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadjQuery">Force Load of jQuery</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load ONLY Lightbox Files on ALL Pages:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the lightbox files on ALL pages, even if no shortcode has been detected:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadLightbox == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadLightbox" class="toggle-check ts_vcsc_extend_settings_loadLightbox" name="ts_vcsc_extend_settings_loadLightbox" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadLightbox); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadLightbox == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadLightbox == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadLightbox">Load Lightbox On All Pages</label></span>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load ONLY Tooltip Files on ALL Pages:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the tooltip files on ALL pages, even if no shortcode has been detected:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadTooltip == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadTooltip" class="toggle-check ts_vcsc_extend_settings_loadTooltip" name="ts_vcsc_extend_settings_loadTooltip" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadTooltip); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadTooltip == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadTooltip == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadTooltip">Load Tooltips On All Pages</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load ONLY Icon Font Files on ALL Pages:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the active Icon Font files on ALL pages, even if no shortcode has been detected:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadFonts == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadFonts" class="toggle-check ts_vcsc_extend_settings_loadFonts" name="ts_vcsc_extend_settings_loadFonts" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadFonts); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadFonts == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadFonts == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadFonts">Load active Icon Fonts On All Pages</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load ALL Files on ALL Pages:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load ALL of the plugin files on ALL pages, even if no shortcode has been detected:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadForcable == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadForcable" class="toggle-check ts_vcsc_extend_settings_loadForcable" name="ts_vcsc_extend_settings_loadForcable" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadForcable); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadForcable == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadForcable == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadForcable">Load ALL Files On All Pages</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load External Files in HEAD:</h4>
<p style="font-size: 12px; text-align: justify;">Please define where you want to load the JS Files:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadHeader == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadHeader" class="toggle-check ts_vcsc_extend_settings_loadHeader" name="ts_vcsc_extend_settings_loadHeader" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadHeader); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadHeader == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadHeader == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadHeader">Load all Files in HEAD</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load Files via WordPress Standard:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the script files via "wp_enqueue_script" and "wp_enqueue_style":</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadEnqueue == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadEnqueue" class="toggle-check ts_vcsc_extend_settings_loadEnqueue" name="ts_vcsc_extend_settings_loadEnqueue" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadEnqueue); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadEnqueue == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadEnqueue == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadEnqueue">Load Files with Standard Method</label>
</p>
<div class="ts-vcsc-notice-field ts-vcsc-warning" style="margin-top: 30px; margin-bottom: 30px; font-size: 13px; text-align: justify;">
This plugin will load some external CSS and JS files in order to make the content elements work on the front end. Your theme or another plugin might already load the same file, which in some cases
can cause problems. Use this page to enable/disable the files this plugin should be allowed to load on the front end.
</div>
<p>
<h4>Load Modernizr File:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the Modernizr file to ensure CSS3 compatibility for most browsers:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadModernizr == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadModernizr" class="toggle-check ts_vcsc_extend_settings_loadModernizr" name="ts_vcsc_extend_settings_loadModernizr" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadModernizr); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadModernizr == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadModernizr == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadModernizr">Load Modernizr</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load Waypoints File:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the Waypoints File for Viewport Animations:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadWaypoints == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadWaypoints" class="toggle-check ts_vcsc_extend_settings_loadWaypoints" name="ts_vcsc_extend_settings_loadWaypoints" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadWaypoints); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadWaypoints == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadWaypoints == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadWaypoints">Load WayPoints</label>
</p>
<hr class='style-six' style='margin-top: 20px;'>
<p>
<h4>Load CountTo File:</h4>
<p style="font-size: 12px; text-align: justify;">Please define if you want to load the CountTo File for the Icon Counter:</p>
<div class="ts-switch-button ts-composer-switch" data-value="<?php echo ($ts_vcsc_extend_settings_loadCountTo == 1 ? 'true' : 'false'); ?>" data-width="80" data-style="compact" data-on="Yes" data-off="No" style="float: left; margin-right: 10px;">
<input type="checkbox" style="display: none; " id="ts_vcsc_extend_settings_loadCountTo" class="toggle-check ts_vcsc_extend_settings_loadCountTo" name="ts_vcsc_extend_settings_loadCountTo" value="1" <?php echo checked('1', $ts_vcsc_extend_settings_loadCountTo); ?>/>
<div class="toggle toggle-light" style="width: 80px; height: 20px;">
<div class="toggle-slide">
<div class="toggle-inner">
<div class="toggle-on <?php echo ($ts_vcsc_extend_settings_loadCountTo == 1 ? 'active' : ''); ?>">Yes</div>
<div class="toggle-blob"></div>
<div class="toggle-off <?php echo ($ts_vcsc_extend_settings_loadCountTo == 0 ? 'active' : ''); ?>">No</div>
</div>
</div>
</div>
</div>
<label class="labelToggleBox" for="ts_vcsc_extend_settings_loadCountTo">Load CountTo</label>
</p>
</div>
</div>
</div> | Java |
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2019 MaNGOS project <https://getmangos.eu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef MANGOS_GRIDNOTIFIERS_H
#define MANGOS_GRIDNOTIFIERS_H
#include "ObjectGridLoader.h"
#include "UpdateData.h"
#include <iostream>
#include "Corpse.h"
#include "Object.h"
#include "DynamicObject.h"
#include "GameObject.h"
#include "Player.h"
#include "Unit.h"
namespace MaNGOS
{
struct VisibleNotifier
{
Camera& i_camera;
UpdateData i_data;
GuidSet i_clientGUIDs;
std::set<WorldObject*> i_visibleNow;
explicit VisibleNotifier(Camera& c) : i_camera(c), i_clientGUIDs(c.GetOwner()->m_clientGUIDs) {}
template<class T> void Visit(GridRefManager<T>& m);
void Visit(CameraMapType& /*m*/) {}
void Notify(void);
};
struct VisibleChangesNotifier
{
WorldObject& i_object;
explicit VisibleChangesNotifier(WorldObject& object) : i_object(object) {}
template<class T> void Visit(GridRefManager<T>&) {}
void Visit(CameraMapType&);
};
struct MessageDeliverer
{
Player const& i_player;
WorldPacket* i_message;
bool i_toSelf;
MessageDeliverer(Player const& pl, WorldPacket* msg, bool to_self) : i_player(pl), i_message(msg), i_toSelf(to_self) {}
void Visit(CameraMapType& m);
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
};
struct MessageDelivererExcept
{
uint32 i_phaseMask;
WorldPacket* i_message;
Player const* i_skipped_receiver;
MessageDelivererExcept(WorldObject const* obj, WorldPacket* msg, Player const* skipped)
: i_phaseMask(obj->GetPhaseMask()), i_message(msg), i_skipped_receiver(skipped) {}
void Visit(CameraMapType& m);
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
};
struct ObjectMessageDeliverer
{
uint32 i_phaseMask;
WorldPacket* i_message;
explicit ObjectMessageDeliverer(WorldObject const& obj, WorldPacket* msg)
: i_phaseMask(obj.GetPhaseMask()), i_message(msg) {}
void Visit(CameraMapType& m);
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
};
struct MessageDistDeliverer
{
Player const& i_player;
WorldPacket* i_message;
bool i_toSelf;
bool i_ownTeamOnly;
float i_dist;
MessageDistDeliverer(Player const& pl, WorldPacket* msg, float dist, bool to_self, bool ownTeamOnly)
: i_player(pl), i_message(msg), i_toSelf(to_self), i_ownTeamOnly(ownTeamOnly), i_dist(dist) {}
void Visit(CameraMapType& m);
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
};
struct ObjectMessageDistDeliverer
{
WorldObject const& i_object;
WorldPacket* i_message;
float i_dist;
ObjectMessageDistDeliverer(WorldObject const& obj, WorldPacket* msg, float dist) : i_object(obj), i_message(msg), i_dist(dist) {}
void Visit(CameraMapType& m);
template<class SKIP> void Visit(GridRefManager<SKIP>&) {}
};
struct ObjectUpdater
{
uint32 i_timeDiff;
explicit ObjectUpdater(const uint32& diff) : i_timeDiff(diff) {}
template<class T> void Visit(GridRefManager<T>& m);
void Visit(PlayerMapType&) {}
void Visit(CorpseMapType&) {}
void Visit(CameraMapType&) {}
void Visit(CreatureMapType&);
};
struct PlayerRelocationNotifier
{
Player& i_player;
PlayerRelocationNotifier(Player& pl) : i_player(pl) {}
template<class T> void Visit(GridRefManager<T>&) {}
void Visit(CreatureMapType&);
};
struct CreatureRelocationNotifier
{
Creature& i_creature;
CreatureRelocationNotifier(Creature& c) : i_creature(c) {}
template<class T> void Visit(GridRefManager<T>&) {}
#ifdef WIN32
template<> void Visit(PlayerMapType&);
#endif
};
struct DynamicObjectUpdater
{
DynamicObject& i_dynobject;
Unit* i_check;
bool i_positive;
DynamicObjectUpdater(DynamicObject& dynobject, Unit* caster, bool positive) : i_dynobject(dynobject), i_positive(positive)
{
i_check = caster;
Unit* owner = i_check->GetOwner();
if (owner)
{ i_check = owner; }
}
template<class T> inline void Visit(GridRefManager<T>&) {}
#ifdef WIN32
template<> inline void Visit<Player>(PlayerMapType&);
template<> inline void Visit<Creature>(CreatureMapType&);
#endif
void VisitHelper(Unit* target);
};
// SEARCHERS & LIST SEARCHERS & WORKERS
/* Model Searcher class:
template<class Check>
struct SomeSearcher
{
ResultType& i_result;
Check & i_check;
SomeSearcher(ResultType& result, Check & check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_result(result), i_check(check) {}
void Visit(CreatureMapType &m);
{
..some code fast return if result found
for(CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (!i_check(itr->getSource()))
continue;
..some code for update result and possible stop search
}
}
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
};
*/
// WorldObject searchers & workers
template<class Check>
struct WorldObjectSearcher
{
uint32 i_phaseMask;
WorldObject*& i_object;
Check& i_check;
WorldObjectSearcher(WorldObject*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType& m);
void Visit(PlayerMapType& m);
void Visit(CreatureMapType& m);
void Visit(CorpseMapType& m);
void Visit(DynamicObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Check>
struct WorldObjectLastSearcher
{
uint32 i_phaseMask;
WorldObject*& i_object;
Check& i_check;
WorldObjectLastSearcher(WorldObject* & result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(PlayerMapType& m);
void Visit(CreatureMapType& m);
void Visit(CorpseMapType& m);
void Visit(GameObjectMapType& m);
void Visit(DynamicObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Check>
struct WorldObjectListSearcher
{
uint32 i_phaseMask;
std::list<WorldObject*>& i_objects;
Check& i_check;
WorldObjectListSearcher(std::list<WorldObject*>& objects, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(PlayerMapType& m);
void Visit(CreatureMapType& m);
void Visit(CorpseMapType& m);
void Visit(GameObjectMapType& m);
void Visit(DynamicObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Do>
struct WorldObjectWorker
{
uint32 i_phaseMask;
Do const& i_do;
WorldObjectWorker(WorldObject const* searcher, Do const& _do)
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
void Visit(GameObjectMapType& m)
{
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(PlayerMapType& m)
{
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CreatureMapType& m)
{
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CorpseMapType& m)
{
for (CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(DynamicObjectMapType& m)
{
for (DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Gameobject searchers
template<class Check>
struct GameObjectSearcher
{
uint32 i_phaseMask;
GameObject*& i_object;
Check& i_check;
GameObjectSearcher(GameObject*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Last accepted by Check GO if any (Check can change requirements at each call)
template<class Check>
struct GameObjectLastSearcher
{
uint32 i_phaseMask;
GameObject*& i_object;
Check& i_check;
GameObjectLastSearcher(GameObject*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Check>
struct GameObjectListSearcher
{
uint32 i_phaseMask;
std::list<GameObject*>& i_objects;
Check& i_check;
GameObjectListSearcher(std::list<GameObject*>& objects, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(GameObjectMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Unit searchers
// First accepted by Check Unit if any
template<class Check>
struct UnitSearcher
{
uint32 i_phaseMask;
Unit*& i_object;
Check& i_check;
UnitSearcher(Unit*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(CreatureMapType& m);
void Visit(PlayerMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Last accepted by Check Unit if any (Check can change requirements at each call)
template<class Check>
struct UnitLastSearcher
{
uint32 i_phaseMask;
Unit*& i_object;
Check& i_check;
UnitLastSearcher(Unit*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(CreatureMapType& m);
void Visit(PlayerMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// All accepted by Check units if any
template<class Check>
struct UnitListSearcher
{
uint32 i_phaseMask;
std::list<Unit*>& i_objects;
Check& i_check;
UnitListSearcher(std::list<Unit*>& objects, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(PlayerMapType& m);
void Visit(CreatureMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Creature searchers
template<class Check>
struct CreatureSearcher
{
uint32 i_phaseMask;
Creature*& i_object;
Check& i_check;
CreatureSearcher(Creature*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(CreatureMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Last accepted by Check Creature if any (Check can change requirements at each call)
template<class Check>
struct CreatureLastSearcher
{
uint32 i_phaseMask;
Creature*& i_object;
Check& i_check;
CreatureLastSearcher(Creature*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(CreatureMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Check>
struct CreatureListSearcher
{
uint32 i_phaseMask;
std::list<Creature*>& i_objects;
Check& i_check;
CreatureListSearcher(std::list<Creature*>& objects, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(CreatureMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Do>
struct CreatureWorker
{
uint32 i_phaseMask;
Do& i_do;
CreatureWorker(WorldObject const* searcher, Do& _do)
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
void Visit(CreatureMapType& m)
{
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// Player searchers
template<class Check>
struct PlayerSearcher
{
uint32 i_phaseMask;
Player*& i_object;
Check& i_check;
PlayerSearcher(Player*& result, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(PlayerMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Check>
struct PlayerListSearcher
{
uint32 i_phaseMask;
std::list<Player*>& i_objects;
Check& i_check;
PlayerListSearcher(std::list<Player*>& objects, Check& check)
: i_phaseMask(check.GetFocusObject().GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(PlayerMapType& m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Do>
struct PlayerWorker
{
uint32 i_phaseMask;
Do& i_do;
PlayerWorker(WorldObject const* searcher, Do& _do)
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
void Visit(PlayerMapType& m)
{
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
template<class Do>
struct CameraDistWorker
{
WorldObject const* i_searcher;
float i_dist;
Do& i_do;
CameraDistWorker(WorldObject const* searcher, float _dist, Do& _do)
: i_searcher(searcher), i_dist(_dist), i_do(_do) {}
void Visit(CameraMapType& m)
{
for (CameraMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->GetBody()->InSamePhase(i_searcher) && itr->getSource()->GetBody()->IsWithinDist(i_searcher, i_dist))
i_do(itr->getSource()->GetOwner());
}
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED>&) {}
};
// CHECKS && DO classes
/* Model Check class:
class SomeCheck
{
public:
SomeCheck(SomeObjecType const* fobj, ..some other args) : i_fobj(fobj), ...other inits {}
WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Creature* u) and for other intresting typs (Player/GameObject/Camera
{
return ..(code return true if Object fit to requirenment);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
SomeObjecType const* i_fobj; // Focus object used for check distance from, phase, so place in world
..other values need for check
};
*/
// WorldObject check classes
class RaiseDeadObjectCheck
{
public:
RaiseDeadObjectCheck(Player const* fobj, float range) : i_fobj(fobj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Creature* u)
{
if (i_fobj->isHonorOrXPTarget(u) ||
u->getDeathState() != CORPSE || u->IsDeadByDefault() || u->IsTaxiFlying() ||
(u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID - 1))) == 0 ||
(u->GetDisplayId() != u->GetNativeDisplayId()))
return false;
return i_fobj->IsWithinDistInMap(u, i_range);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
Player const* i_fobj;
float i_range;
};
class ExplodeCorpseObjectCheck
{
public:
ExplodeCorpseObjectCheck(WorldObject const* fobj, float range) : i_fobj(fobj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Player* u)
{
if (u->getDeathState() != CORPSE || u->IsTaxiFlying() ||
u->HasAuraType(SPELL_AURA_GHOST) || (u->GetDisplayId() != u->GetNativeDisplayId()))
return false;
return i_fobj->IsWithinDistInMap(u, i_range);
}
bool operator()(Creature* u)
{
if (u->getDeathState() != CORPSE || u->IsTaxiFlying() || u->IsDeadByDefault() ||
(u->GetDisplayId() != u->GetNativeDisplayId()) ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) != 0)
return false;
return i_fobj->IsWithinDistInMap(u, i_range);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
WorldObject const* i_fobj;
float i_range;
};
class CannibalizeObjectCheck
{
public:
CannibalizeObjectCheck(WorldObject const* fobj, float range) : i_fobj(fobj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Player* u)
{
if (i_fobj->IsFriendlyTo(u) || u->IsAlive() || u->IsTaxiFlying())
{ return false; }
return i_fobj->IsWithinDistInMap(u, i_range);
}
bool operator()(Corpse* u);
bool operator()(Creature* u)
{
if (i_fobj->IsFriendlyTo(u) || u->IsAlive() || u->IsTaxiFlying() ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
{ return false; }
return i_fobj->IsWithinDistInMap(u, i_range);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
WorldObject const* i_fobj;
float i_range;
};
// WorldObject do classes
class RespawnDo
{
public:
RespawnDo() {}
void operator()(Creature* u) const;
void operator()(GameObject* u) const;
void operator()(WorldObject*) const {}
void operator()(Corpse*) const {}
};
// GameObject checks
class GameObjectFocusCheck
{
public:
GameObjectFocusCheck(Unit const* unit, uint32 focusId) : i_unit(unit), i_focusId(focusId) {}
WorldObject const& GetFocusObject() const { return *i_unit; }
bool operator()(GameObject* go) const
{
if (go->GetGOInfo()->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
{ return false; }
if (go->GetGOInfo()->spellFocus.focusId != i_focusId)
{ return false; }
float dist = (float)go->GetGOInfo()->spellFocus.dist;
return go->IsWithinDistInMap(i_unit, dist);
}
private:
Unit const* i_unit;
uint32 i_focusId;
};
// Find the nearest Fishing hole and return true only if source object is in range of hole
class NearestGameObjectFishingHoleCheck
{
public:
NearestGameObjectFishingHoleCheck(WorldObject const& obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_FISHINGHOLE && go->isSpawned() && i_obj.IsWithinDistInMap(go, i_range) && i_obj.IsWithinDistInMap(go, (float)go->GetGOInfo()->fishinghole.radius))
{
i_range = i_obj.GetDistance(go);
return true;
}
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
float i_range;
// prevent clone
NearestGameObjectFishingHoleCheck(NearestGameObjectFishingHoleCheck const&);
};
// Success at unit in range, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO)
class NearestGameObjectEntryInObjectRangeCheck
{
public:
NearestGameObjectEntryInObjectRangeCheck(WorldObject const& obj, uint32 entry, float range) : i_obj(obj), i_entry(entry), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range))
{
i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check
return true;
}
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
uint32 i_entry;
float i_range;
// prevent clone this object
NearestGameObjectEntryInObjectRangeCheck(NearestGameObjectEntryInObjectRangeCheck const&);
};
// Success at gameobject in range of xyz, range update for next check (this can be use with GameobjectLastSearcher to find nearest GO)
class NearestGameObjectEntryInPosRangeCheck
{
public:
NearestGameObjectEntryInPosRangeCheck(WorldObject const& obj, uint32 entry, float x, float y, float z, float range)
: i_obj(obj), i_entry(entry), i_x(x), i_y(y), i_z(z), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetEntry() == i_entry && go->IsWithinDist3d(i_x, i_y, i_z, i_range))
{
// use found GO range as new range limit for next check
i_range = go->GetDistance(i_x, i_y, i_z);
return true;
}
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
uint32 i_entry;
float i_x, i_y, i_z;
float i_range;
// prevent clone this object
NearestGameObjectEntryInPosRangeCheck(NearestGameObjectEntryInPosRangeCheck const&);
};
// Success at gameobject with entry in range of provided xyz
class GameObjectEntryInPosRangeCheck
{
public:
GameObjectEntryInPosRangeCheck(WorldObject const& obj, uint32 entry, float x, float y, float z, float range)
: i_obj(obj), i_entry(entry), i_x(x), i_y(y), i_z(z), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetEntry() == i_entry && go->IsWithinDist3d(i_x, i_y, i_z, i_range))
{ return true; }
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
uint32 i_entry;
float i_x, i_y, i_z;
float i_range;
// prevent clone this object
GameObjectEntryInPosRangeCheck(GameObjectEntryInPosRangeCheck const&);
};
// Success at gameobject of type in range of provided xyz
class GameObjectTypeInPosRangeCheck
{
public:
GameObjectTypeInPosRangeCheck(Unit const& obj, GameobjectTypes type, float x, float y, float z, float range, bool onlyHostile, bool onlyFriendly)
: i_obj(obj), i_type(type), i_x(x), i_y(y), i_z(z), i_range(range), i_onlyHostile(onlyHostile), i_onlyFriendly(onlyFriendly) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(GameObject* go)
{
if (go->GetGoType() == i_type
&& (!i_onlyHostile || go->IsHostileTo(&i_obj)) && (!i_onlyFriendly || go->IsFriendlyTo(&i_obj))
&& go->IsWithinDist3d(i_x, i_y, i_z, i_range))
return true;
return false;
}
float GetLastRange() const { return i_range; }
private:
Unit const& i_obj;
GameobjectTypes i_type;
float i_x, i_y, i_z;
float i_range;
bool i_onlyHostile, i_onlyFriendly;
// prevent clone this object
GameObjectTypeInPosRangeCheck(GameObjectTypeInPosRangeCheck const&);
};
// Unit checks
class MostHPMissingInRangeCheck
{
public:
MostHPMissingInRangeCheck(Unit const* obj, float range, uint32 hp) : i_obj(obj), i_range(range), i_hp(hp) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) && u->GetMaxHealth() - u->GetHealth() > i_hp)
{
i_hp = u->GetMaxHealth() - u->GetHealth();
return true;
}
return false;
}
private:
Unit const* i_obj;
float i_range;
uint32 i_hp;
};
class FriendlyCCedInRangeCheck
{
public:
FriendlyCCedInRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
(u->IsCharmed() || u->IsFrozen() || u->hasUnitState(UNIT_STAT_CAN_NOT_REACT)))
{
return true;
}
return false;
}
private:
WorldObject const* i_obj;
float i_range;
};
class FriendlyMissingBuffInRangeCheck
{
public:
FriendlyMissingBuffInRangeCheck(WorldObject const* obj, float range, uint32 spellid) : i_obj(obj), i_range(range), i_spell(spellid) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsAlive() && u->IsInCombat() && !i_obj->IsHostileTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
!(u->HasAura(i_spell, EFFECT_INDEX_0) || u->HasAura(i_spell, EFFECT_INDEX_1) || u->HasAura(i_spell, EFFECT_INDEX_2)))
{
return true;
}
return false;
}
private:
WorldObject const* i_obj;
float i_range;
uint32 i_spell;
};
class AnyUnfriendlyUnitInObjectRangeCheck
{
public:
AnyUnfriendlyUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range)
{
i_controlledByPlayer = obj->IsControlledByPlayer();
}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsAlive() && (i_controlledByPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u))
&& i_obj->IsWithinDistInMap(u, i_range))
{ return true; }
else
{ return false; }
}
private:
WorldObject const* i_obj;
bool i_controlledByPlayer;
float i_range;
};
class AnyUnfriendlyVisibleUnitInObjectRangeCheck
{
public:
AnyUnfriendlyVisibleUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range)
: i_obj(obj), i_funit(funit), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
return u->IsAlive()
&& i_obj->IsWithinDistInMap(u, i_range)
&& !i_funit->IsFriendlyTo(u)
&& u->IsVisibleForOrDetect(i_funit, i_funit, false);
}
private:
WorldObject const* i_obj;
Unit const* i_funit;
float i_range;
};
class AnyFriendlyUnitInObjectRangeCheck
{
public:
AnyFriendlyUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range) && i_obj->IsFriendlyTo(u))
{ return true; }
else
{ return false; }
}
private:
WorldObject const* i_obj;
float i_range;
};
class AnyUnitInObjectRangeCheck
{
public:
AnyUnitInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
{ return true; }
return false;
}
private:
WorldObject const* i_obj;
float i_range;
};
// Success at unit in range, range update for next check (this can be use with UnitLastSearcher to find nearest unit)
class NearestAttackableUnitInObjectRangeCheck
{
public:
NearestAttackableUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
if (u->IsTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) &&
!i_funit->IsFriendlyTo(u) && u->IsVisibleForOrDetect(i_funit, i_funit, false))
{
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
return true;
}
return false;
}
private:
WorldObject const* i_obj;
Unit const* i_funit;
float i_range;
// prevent clone this object
NearestAttackableUnitInObjectRangeCheck(NearestAttackableUnitInObjectRangeCheck const&);
};
class AnyAoEVisibleTargetUnitInObjectRangeCheck
{
public:
AnyAoEVisibleTargetUnitInObjectRangeCheck(WorldObject const* obj, WorldObject const* originalCaster, float range)
: i_obj(obj), i_originalCaster(originalCaster), i_range(range)
{
i_targetForUnit = i_originalCaster->isType(TYPEMASK_UNIT);
i_targetForPlayer = (i_originalCaster->GetTypeId() == TYPEID_PLAYER);
}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->IsTargetableForAttack())
{ return false; }
// ignore totems as AoE targets
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem())
{ return false; }
// check visibility only for unit-like original casters
if (i_targetForUnit && !u->IsVisibleForOrDetect((Unit const*)i_originalCaster, i_originalCaster, false))
{ return false; }
if ((i_targetForPlayer ? !i_originalCaster->IsFriendlyTo(u) : i_originalCaster->IsHostileTo(u)) && i_obj->IsWithinDistInMap(u, i_range))
{ return true; }
return false;
}
private:
WorldObject const* i_obj;
WorldObject const* i_originalCaster;
float i_range;
bool i_targetForUnit;
bool i_targetForPlayer;
};
class AnyAoETargetUnitInObjectRangeCheck
{
public:
AnyAoETargetUnitInObjectRangeCheck(WorldObject const* obj, float range)
: i_obj(obj), i_range(range)
{
i_targetForPlayer = i_obj->IsControlledByPlayer();
}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Unit* u)
{
// Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems
if (!u->IsTargetableForAttack())
{ return false; }
if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->IsTotem())
{ return false; }
if ((i_targetForPlayer ? !i_obj->IsFriendlyTo(u) : i_obj->IsHostileTo(u)) && i_obj->IsWithinDistInMap(u, i_range))
{ return true; }
return false;
}
private:
WorldObject const* i_obj;
float i_range;
bool i_targetForPlayer;
};
// do attack at call of help to friendly crearture
class CallOfHelpCreatureInRangeDo
{
public:
CallOfHelpCreatureInRangeDo(Unit* funit, Unit* enemy, float range)
: i_funit(funit), i_enemy(enemy), i_range(range)
{}
void operator()(Creature* u);
private:
Unit* const i_funit;
Unit* const i_enemy;
float i_range;
};
class AnyDeadUnitCheck
{
public:
explicit AnyDeadUnitCheck(WorldObject const* fobj) : i_fobj(fobj) {}
WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Unit* u) { return !u->IsAlive(); }
private:
WorldObject const* i_fobj;
};
class AnyStealthedCheck
{
public:
explicit AnyStealthedCheck(WorldObject const* fobj) : i_fobj(fobj) {}
WorldObject const& GetFocusObject() const { return *i_fobj; }
bool operator()(Unit* u) { return u->GetVisibility() == VISIBILITY_GROUP_STEALTH; }
private:
WorldObject const* i_fobj;
};
// Creature checks
class InAttackDistanceFromAnyHostileCreatureCheck
{
public:
explicit InAttackDistanceFromAnyHostileCreatureCheck(Unit* funit) : i_funit(funit) {}
WorldObject const& GetFocusObject() const { return *i_funit; }
bool operator()(Creature* u)
{
if (u->IsAlive() && u->IsHostileTo(i_funit) && i_funit->IsWithinDistInMap(u, u->GetAttackDistance(i_funit)))
{ return true; }
return false;
}
private:
Unit* const i_funit;
};
class AnyAssistCreatureInRangeCheck
{
public:
AnyAssistCreatureInRangeCheck(Unit* funit, Unit* enemy, float range)
: i_funit(funit), i_enemy(enemy), i_range(range)
{
}
WorldObject const& GetFocusObject() const { return *i_funit; }
bool operator()(Creature* u);
private:
Unit* const i_funit;
Unit* const i_enemy;
float i_range;
};
class NearestAssistCreatureInCreatureRangeCheck
{
public:
NearestAssistCreatureInCreatureRangeCheck(Creature* obj, Unit* enemy, float range)
: i_obj(obj), i_enemy(enemy), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Creature* u)
{
if (u == i_obj)
{ return false; }
if (!u->CanAssistTo(i_obj, i_enemy))
{ return false; }
if (!i_obj->IsWithinDistInMap(u, i_range))
{ return false; }
if (!i_obj->IsWithinLOSInMap(u))
{ return false; }
i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check
return true;
}
float GetLastRange() const { return i_range; }
private:
Creature* const i_obj;
Unit* const i_enemy;
float i_range;
// prevent clone this object
NearestAssistCreatureInCreatureRangeCheck(NearestAssistCreatureInCreatureRangeCheck const&);
};
// Success at unit in range, range update for next check (this can be use with CreatureLastSearcher to find nearest creature)
class NearestCreatureEntryWithLiveStateInObjectRangeCheck
{
public:
NearestCreatureEntryWithLiveStateInObjectRangeCheck(WorldObject const& obj, uint32 entry, bool onlyAlive, bool onlyDead, float range, bool excludeSelf = false)
: i_obj(obj), i_entry(entry), i_onlyAlive(onlyAlive), i_onlyDead(onlyDead), i_excludeSelf(excludeSelf), i_range(range) {}
WorldObject const& GetFocusObject() const { return i_obj; }
bool operator()(Creature* u)
{
if (u->GetEntry() == i_entry && ((i_onlyAlive && u->IsAlive()) || (i_onlyDead && u->IsCorpse()) || (!i_onlyAlive && !i_onlyDead))
&& (!i_excludeSelf || &i_obj != u) && i_obj.IsWithinDistInMap(u, i_range))
{
i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check
return true;
}
return false;
}
float GetLastRange() const { return i_range; }
private:
WorldObject const& i_obj;
uint32 i_entry;
bool i_onlyAlive;
bool i_onlyDead;
bool i_excludeSelf;
float i_range;
// prevent clone this object
NearestCreatureEntryWithLiveStateInObjectRangeCheck(NearestCreatureEntryWithLiveStateInObjectRangeCheck const&);
};
class AllCreaturesOfEntryInRangeCheck
{
public:
AllCreaturesOfEntryInRangeCheck(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
WorldObject const& GetFocusObject() const { return *m_pObject; }
bool operator()(Unit* pUnit)
{
if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit, m_fRange, false))
{ return true; }
return false;
}
private:
const WorldObject* m_pObject;
uint32 m_uiEntry;
float m_fRange;
// prevent clone this object
AllCreaturesOfEntryInRangeCheck(AllCreaturesOfEntryInRangeCheck const&);
};
// Player checks and do
class AnyPlayerInObjectRangeCheck
{
public:
AnyPlayerInObjectRangeCheck(WorldObject const* obj, float range) : i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Player* u)
{
if (u->IsAlive() && i_obj->IsWithinDistInMap(u, i_range))
{ return true; }
return false;
}
private:
WorldObject const* i_obj;
float i_range;
};
class AnyPlayerInObjectRangeWithAuraCheck
{
public:
AnyPlayerInObjectRangeWithAuraCheck(WorldObject const* obj, float range, uint32 spellId)
: i_obj(obj), i_range(range), i_spellId(spellId) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Player* u)
{
return u->IsAlive()
&& i_obj->IsWithinDistInMap(u, i_range)
&& u->HasAura(i_spellId);
}
private:
WorldObject const* i_obj;
float i_range;
uint32 i_spellId;
};
class AnyPlayerInCapturePointRange
{
public:
AnyPlayerInCapturePointRange(WorldObject const* obj, float range)
: i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Player* u)
{
return u->CanUseCapturePoint() &&
i_obj->IsWithinDistInMap(u, i_range);
}
private:
WorldObject const* i_obj;
float i_range;
};
// Prepare using Builder localized packets with caching and send to player
template<class Builder>
class LocalizedPacketDo
{
public:
explicit LocalizedPacketDo(Builder& builder) : i_builder(builder) {}
~LocalizedPacketDo()
{
for (size_t i = 0; i < i_data_cache.size(); ++i)
{ delete i_data_cache[i]; }
}
void operator()(Player* p);
private:
Builder& i_builder;
std::vector<WorldPacket*> i_data_cache; // 0 = default, i => i-1 locale index
};
// Prepare using Builder localized packets with caching and send to player
template<class Builder>
class LocalizedPacketListDo
{
public:
typedef std::vector<WorldPacket*> WorldPacketList;
explicit LocalizedPacketListDo(Builder& builder) : i_builder(builder) {}
~LocalizedPacketListDo()
{
for (size_t i = 0; i < i_data_cache.size(); ++i)
for (size_t j = 0; j < i_data_cache[i].size(); ++j)
{ delete i_data_cache[i][j]; }
}
void operator()(Player* p);
private:
Builder& i_builder;
std::vector<WorldPacketList> i_data_cache;
// 0 = default, i => i-1 locale index
};
#ifndef WIN32
template<> void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType&);
template<> void CreatureRelocationNotifier::Visit<Player>(PlayerMapType&);
template<> void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType&);
template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType&);
template<> inline void DynamicObjectUpdater::Visit<Player>(PlayerMapType&);
#endif
}
#endif
| Java |
#! /bin/sh
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Make sure empty calls to AC_CONFIG_FILES or AC_CONFIG_HEADERS are diagnosed.
. test-init.sh
# We avoid using configure.ac stub initialized by our testsuite setup, as
# we need to keep track of line numbers (to grep for error messages).
cat > configure.ac << END
AC_INIT([$me], [1.0])
AM_INIT_AUTOMAKE
AC_CONFIG_FILES ([oops])
AC_CONFIG_HEADERS
AC_OUTPUT
END
$ACLOCAL
AUTOMAKE_fails
grep 'configure\.ac:3:.* arguments .*AC_CONFIG_FILES' stderr
grep 'configure\.ac:4:.* arguments .*AC_CONFIG_HEADERS' stderr
:
| Java |
package com.app.labeli;
import com.app.labeli.member.Member;
import net.tools.*;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
/**
* > @FragmentConnection
*
* Fragment to create a connection between app
* and API.
*
* @author Florian "Aamu Lumi" Kauder
* for the project @Label[i]
*/
public class FragmentConnection extends Fragment {
private EditText editTextLogin, editTextPassword;
private Button button;
private ProgressDialog pDialog;
public FragmentConnection() {
}
public void connectToAPI(View v){
if (editTextLogin.length() == 0)
Toast.makeText(getActivity(), "Veuillez rentrer un identifiant", Toast.LENGTH_SHORT).show();
else if (editTextPassword.length() == 0)
Toast.makeText(getActivity(), "Veuillez rentrer un mot de passe", Toast.LENGTH_SHORT).show();
else {
new InitConnection(editTextLogin.getText().toString(), editTextPassword.getText().toString())
.execute();
}
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
getActivity().getActionBar().setTitle("Connexion");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_connection, container,
false);
editTextLogin = (EditText) v.findViewById(R.id.fragment_connection_edit_text_login);
editTextPassword = (EditText) v.findViewById(R.id.fragment_connection_edit_text_password);
button = (Button) v.findViewById(R.id.fragment_connection_button_connection);
button.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
connectToAPI(arg0);
}
});
return v;
}
private class InitConnection extends AsyncTask<Void, Void, String>
{
String username, password;
boolean success;
public InitConnection(String username, String password){
this.username = username;
this.password = password;
this.success = false;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
pDialog = new ProgressDialog(FragmentConnection.this.getActivity());
pDialog.setMessage("Connexion");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
pDialog.show();
}
@Override
protected String doInBackground(Void... params)
{
success = APIConnection.login(username, password);
return null;
}
@Override
protected void onPostExecute(String file_url) {
pDialog.dismiss();
if (!success)
Toast.makeText(getActivity(), "Mauvais identifiant / mot de passe", Toast.LENGTH_SHORT).show();
else {
Member loggedUser = APIConnection.getLoggedUser();
Toast.makeText(getActivity(), "Bonjour " + loggedUser.getFirstName() + " " + loggedUser.getLastName(), Toast.LENGTH_SHORT).show();
((MainActivity)getActivity()).loadLeftMenu();
Fragment fragment = new FragmentAccount();
Bundle args = new Bundle();
fragment.setArguments(args);
FragmentTransaction transaction = getActivity().getSupportFragmentManager().beginTransaction();
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
transaction.replace(R.id.activity_main_content_frame, fragment, fragment.getClass().getName());
transaction.addToBackStack(fragment.getClass().getName());
transaction.commit();
}
}
}
}
| Java |
/*
* This file implements the perfmon-2 subsystem which is used
* to program the IA-64 Performance Monitoring Unit (PMU).
*
* The initial version of perfmon.c was written by
* Ganesh Venkitachalam, IBM Corp.
*
* Then it was modified for perfmon-1.x by Stephane Eranian and
* David Mosberger, Hewlett Packard Co.
*
* Version Perfmon-2.x is a rewrite of perfmon-1.x
* by Stephane Eranian, Hewlett Packard Co.
*
* Copyright (C) 1999-2005 Hewlett Packard Co
* Stephane Eranian <eranian@hpl.hp.com>
* David Mosberger-Tang <davidm@hpl.hp.com>
*
* More information about perfmon available at:
* http://www.hpl.hp.com/research/linux/perfmon
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/sysctl.h>
#include <linux/list.h>
#include <linux/file.h>
#include <linux/poll.h>
#include <linux/vfs.h>
#include <linux/smp.h>
#include <linux/pagemap.h>
#include <linux/mount.h>
#include <linux/bitops.h>
#include <linux/capability.h>
#include <linux/rcupdate.h>
#include <linux/completion.h>
#include <linux/tracehook.h>
#include <linux/slab.h>
#include <asm/errno.h>
#include <asm/intrinsics.h>
#include <asm/page.h>
#include <asm/perfmon.h>
#include <asm/processor.h>
#include <asm/signal.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/delay.h>
#ifdef CONFIG_PERFMON
/*
* perfmon context state
*/
#define PFM_CTX_UNLOADED 1 /* context is not loaded onto any task */
#define PFM_CTX_LOADED 2 /* context is loaded onto a task */
#define PFM_CTX_MASKED 3 /* context is loaded but monitoring is masked due to overflow */
#define PFM_CTX_ZOMBIE 4 /* owner of the context is closing it */
#define PFM_INVALID_ACTIVATION (~0UL)
#define PFM_NUM_PMC_REGS 64 /* PMC save area for ctxsw */
#define PFM_NUM_PMD_REGS 64 /* PMD save area for ctxsw */
/*
* depth of message queue
*/
#define PFM_MAX_MSGS 32
#define PFM_CTXQ_EMPTY(g) ((g)->ctx_msgq_head == (g)->ctx_msgq_tail)
/*
* type of a PMU register (bitmask).
* bitmask structure:
* bit0 : register implemented
* bit1 : end marker
* bit2-3 : reserved
* bit4 : pmc has pmc.pm
* bit5 : pmc controls a counter (has pmc.oi), pmd is used as counter
* bit6-7 : register type
* bit8-31: reserved
*/
#define PFM_REG_NOTIMPL 0x0 /* not implemented at all */
#define PFM_REG_IMPL 0x1 /* register implemented */
#define PFM_REG_END 0x2 /* end marker */
#define PFM_REG_MONITOR (0x1<<4|PFM_REG_IMPL) /* a PMC with a pmc.pm field only */
#define PFM_REG_COUNTING (0x2<<4|PFM_REG_MONITOR) /* a monitor + pmc.oi+ PMD used as a counter */
#define PFM_REG_CONTROL (0x4<<4|PFM_REG_IMPL) /* PMU control register */
#define PFM_REG_CONFIG (0x8<<4|PFM_REG_IMPL) /* configuration register */
#define PFM_REG_BUFFER (0xc<<4|PFM_REG_IMPL) /* PMD used as buffer */
#define PMC_IS_LAST(i) (pmu_conf->pmc_desc[i].type & PFM_REG_END)
#define PMD_IS_LAST(i) (pmu_conf->pmd_desc[i].type & PFM_REG_END)
#define PMC_OVFL_NOTIFY(ctx, i) ((ctx)->ctx_pmds[i].flags & PFM_REGFL_OVFL_NOTIFY)
/* i assumed unsigned */
#define PMC_IS_IMPL(i) (i< PMU_MAX_PMCS && (pmu_conf->pmc_desc[i].type & PFM_REG_IMPL))
#define PMD_IS_IMPL(i) (i< PMU_MAX_PMDS && (pmu_conf->pmd_desc[i].type & PFM_REG_IMPL))
/* XXX: these assume that register i is implemented */
#define PMD_IS_COUNTING(i) ((pmu_conf->pmd_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
#define PMC_IS_COUNTING(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_COUNTING) == PFM_REG_COUNTING)
#define PMC_IS_MONITOR(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_MONITOR) == PFM_REG_MONITOR)
#define PMC_IS_CONTROL(i) ((pmu_conf->pmc_desc[i].type & PFM_REG_CONTROL) == PFM_REG_CONTROL)
#define PMC_DFL_VAL(i) pmu_conf->pmc_desc[i].default_value
#define PMC_RSVD_MASK(i) pmu_conf->pmc_desc[i].reserved_mask
#define PMD_PMD_DEP(i) pmu_conf->pmd_desc[i].dep_pmd[0]
#define PMC_PMD_DEP(i) pmu_conf->pmc_desc[i].dep_pmd[0]
#define PFM_NUM_IBRS IA64_NUM_DBG_REGS
#define PFM_NUM_DBRS IA64_NUM_DBG_REGS
#define CTX_OVFL_NOBLOCK(c) ((c)->ctx_fl_block == 0)
#define CTX_HAS_SMPL(c) ((c)->ctx_fl_is_sampling)
#define PFM_CTX_TASK(h) (h)->ctx_task
#define PMU_PMC_OI 5 /* position of pmc.oi bit */
/* XXX: does not support more than 64 PMDs */
#define CTX_USED_PMD(ctx, mask) (ctx)->ctx_used_pmds[0] |= (mask)
#define CTX_IS_USED_PMD(ctx, c) (((ctx)->ctx_used_pmds[0] & (1UL << (c))) != 0UL)
#define CTX_USED_MONITOR(ctx, mask) (ctx)->ctx_used_monitors[0] |= (mask)
#define CTX_USED_IBR(ctx,n) (ctx)->ctx_used_ibrs[(n)>>6] |= 1UL<< ((n) % 64)
#define CTX_USED_DBR(ctx,n) (ctx)->ctx_used_dbrs[(n)>>6] |= 1UL<< ((n) % 64)
#define CTX_USES_DBREGS(ctx) (((pfm_context_t *)(ctx))->ctx_fl_using_dbreg==1)
#define PFM_CODE_RR 0 /* requesting code range restriction */
#define PFM_DATA_RR 1 /* requestion data range restriction */
#define PFM_CPUINFO_CLEAR(v) pfm_get_cpu_var(pfm_syst_info) &= ~(v)
#define PFM_CPUINFO_SET(v) pfm_get_cpu_var(pfm_syst_info) |= (v)
#define PFM_CPUINFO_GET() pfm_get_cpu_var(pfm_syst_info)
#define RDEP(x) (1UL<<(x))
/*
* context protection macros
* in SMP:
* - we need to protect against CPU concurrency (spin_lock)
* - we need to protect against PMU overflow interrupts (local_irq_disable)
* in UP:
* - we need to protect against PMU overflow interrupts (local_irq_disable)
*
* spin_lock_irqsave()/spin_unlock_irqrestore():
* in SMP: local_irq_disable + spin_lock
* in UP : local_irq_disable
*
* spin_lock()/spin_lock():
* in UP : removed automatically
* in SMP: protect against context accesses from other CPU. interrupts
* are not masked. This is useful for the PMU interrupt handler
* because we know we will not get PMU concurrency in that code.
*/
#define PROTECT_CTX(c, f) \
do { \
DPRINT(("spinlock_irq_save ctx %p by [%d]\n", c, task_pid_nr(current))); \
spin_lock_irqsave(&(c)->ctx_lock, f); \
DPRINT(("spinlocked ctx %p by [%d]\n", c, task_pid_nr(current))); \
} while(0)
#define UNPROTECT_CTX(c, f) \
do { \
DPRINT(("spinlock_irq_restore ctx %p by [%d]\n", c, task_pid_nr(current))); \
spin_unlock_irqrestore(&(c)->ctx_lock, f); \
} while(0)
#define PROTECT_CTX_NOPRINT(c, f) \
do { \
spin_lock_irqsave(&(c)->ctx_lock, f); \
} while(0)
#define UNPROTECT_CTX_NOPRINT(c, f) \
do { \
spin_unlock_irqrestore(&(c)->ctx_lock, f); \
} while(0)
#define PROTECT_CTX_NOIRQ(c) \
do { \
spin_lock(&(c)->ctx_lock); \
} while(0)
#define UNPROTECT_CTX_NOIRQ(c) \
do { \
spin_unlock(&(c)->ctx_lock); \
} while(0)
#ifdef CONFIG_SMP
#define GET_ACTIVATION() pfm_get_cpu_var(pmu_activation_number)
#define INC_ACTIVATION() pfm_get_cpu_var(pmu_activation_number)++
#define SET_ACTIVATION(c) (c)->ctx_last_activation = GET_ACTIVATION()
#else /* !CONFIG_SMP */
#define SET_ACTIVATION(t) do {} while(0)
#define GET_ACTIVATION(t) do {} while(0)
#define INC_ACTIVATION(t) do {} while(0)
#endif /* CONFIG_SMP */
#define SET_PMU_OWNER(t, c) do { pfm_get_cpu_var(pmu_owner) = (t); pfm_get_cpu_var(pmu_ctx) = (c); } while(0)
#define GET_PMU_OWNER() pfm_get_cpu_var(pmu_owner)
#define GET_PMU_CTX() pfm_get_cpu_var(pmu_ctx)
#define LOCK_PFS(g) spin_lock_irqsave(&pfm_sessions.pfs_lock, g)
#define UNLOCK_PFS(g) spin_unlock_irqrestore(&pfm_sessions.pfs_lock, g)
#define PFM_REG_RETFLAG_SET(flags, val) do { flags &= ~PFM_REG_RETFL_MASK; flags |= (val); } while(0)
/*
* cmp0 must be the value of pmc0
*/
#define PMC0_HAS_OVFL(cmp0) (cmp0 & ~0x1UL)
#define PFMFS_MAGIC 0xa0b4d889
/*
* debugging
*/
#define PFM_DEBUGGING 1
#ifdef PFM_DEBUGGING
#define DPRINT(a) \
do { \
if (unlikely(pfm_sysctl.debug >0)) { printk("%s.%d: CPU%d [%d] ", __func__, __LINE__, smp_processor_id(), task_pid_nr(current)); printk a; } \
} while (0)
#define DPRINT_ovfl(a) \
do { \
if (unlikely(pfm_sysctl.debug > 0 && pfm_sysctl.debug_ovfl >0)) { printk("%s.%d: CPU%d [%d] ", __func__, __LINE__, smp_processor_id(), task_pid_nr(current)); printk a; } \
} while (0)
#endif
/*
* 64-bit software counter structure
*
* the next_reset_type is applied to the next call to pfm_reset_regs()
*/
typedef struct {
unsigned long val; /* virtual 64bit counter value */
unsigned long lval; /* last reset value */
unsigned long long_reset; /* reset value on sampling overflow */
unsigned long short_reset; /* reset value on overflow */
unsigned long reset_pmds[4]; /* which other pmds to reset when this counter overflows */
unsigned long smpl_pmds[4]; /* which pmds are accessed when counter overflow */
unsigned long seed; /* seed for random-number generator */
unsigned long mask; /* mask for random-number generator */
unsigned int flags; /* notify/do not notify */
unsigned long eventid; /* overflow event identifier */
} pfm_counter_t;
/*
* context flags
*/
typedef struct {
unsigned int block:1; /* when 1, task will blocked on user notifications */
unsigned int system:1; /* do system wide monitoring */
unsigned int using_dbreg:1; /* using range restrictions (debug registers) */
unsigned int is_sampling:1; /* true if using a custom format */
unsigned int excl_idle:1; /* exclude idle task in system wide session */
unsigned int going_zombie:1; /* context is zombie (MASKED+blocking) */
unsigned int trap_reason:2; /* reason for going into pfm_handle_work() */
unsigned int no_msg:1; /* no message sent on overflow */
unsigned int can_restart:1; /* allowed to issue a PFM_RESTART */
unsigned int reserved:22;
} pfm_context_flags_t;
#define PFM_TRAP_REASON_NONE 0x0 /* default value */
#define PFM_TRAP_REASON_BLOCK 0x1 /* we need to block on overflow */
#define PFM_TRAP_REASON_RESET 0x2 /* we need to reset PMDs */
/*
* perfmon context: encapsulates all the state of a monitoring session
*/
typedef struct pfm_context {
spinlock_t ctx_lock; /* context protection */
pfm_context_flags_t ctx_flags; /* bitmask of flags (block reason incl.) */
unsigned int ctx_state; /* state: active/inactive (no bitfield) */
struct task_struct *ctx_task; /* task to which context is attached */
unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */
struct completion ctx_restart_done; /* use for blocking notification mode */
unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */
unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */
unsigned long ctx_reload_pmds[4]; /* bitmask of force reload PMD on ctxsw in */
unsigned long ctx_all_pmcs[4]; /* bitmask of all accessible PMCs */
unsigned long ctx_reload_pmcs[4]; /* bitmask of force reload PMC on ctxsw in */
unsigned long ctx_used_monitors[4]; /* bitmask of monitor PMC being used */
unsigned long ctx_pmcs[PFM_NUM_PMC_REGS]; /* saved copies of PMC values */
unsigned int ctx_used_ibrs[1]; /* bitmask of used IBR (speedup ctxsw in) */
unsigned int ctx_used_dbrs[1]; /* bitmask of used DBR (speedup ctxsw in) */
unsigned long ctx_dbrs[IA64_NUM_DBG_REGS]; /* DBR values (cache) when not loaded */
unsigned long ctx_ibrs[IA64_NUM_DBG_REGS]; /* IBR values (cache) when not loaded */
pfm_counter_t ctx_pmds[PFM_NUM_PMD_REGS]; /* software state for PMDS */
unsigned long th_pmcs[PFM_NUM_PMC_REGS]; /* PMC thread save state */
unsigned long th_pmds[PFM_NUM_PMD_REGS]; /* PMD thread save state */
unsigned long ctx_saved_psr_up; /* only contains psr.up value */
unsigned long ctx_last_activation; /* context last activation number for last_cpu */
unsigned int ctx_last_cpu; /* CPU id of current or last CPU used (SMP only) */
unsigned int ctx_cpu; /* cpu to which perfmon is applied (system wide) */
int ctx_fd; /* file descriptor used my this context */
pfm_ovfl_arg_t ctx_ovfl_arg; /* argument to custom buffer format handler */
pfm_buffer_fmt_t *ctx_buf_fmt; /* buffer format callbacks */
void *ctx_smpl_hdr; /* points to sampling buffer header kernel vaddr */
unsigned long ctx_smpl_size; /* size of sampling buffer */
void *ctx_smpl_vaddr; /* user level virtual address of smpl buffer */
wait_queue_head_t ctx_msgq_wait;
pfm_msg_t ctx_msgq[PFM_MAX_MSGS];
int ctx_msgq_head;
int ctx_msgq_tail;
struct fasync_struct *ctx_async_queue;
wait_queue_head_t ctx_zombieq; /* termination cleanup wait queue */
} pfm_context_t;
/*
* magic number used to verify that structure is really
* a perfmon context
*/
#define PFM_IS_FILE(f) ((f)->f_op == &pfm_file_ops)
#define PFM_GET_CTX(t) ((pfm_context_t *)(t)->thread.pfm_context)
#ifdef CONFIG_SMP
#define SET_LAST_CPU(ctx, v) (ctx)->ctx_last_cpu = (v)
#define GET_LAST_CPU(ctx) (ctx)->ctx_last_cpu
#else
#define SET_LAST_CPU(ctx, v) do {} while(0)
#define GET_LAST_CPU(ctx) do {} while(0)
#endif
#define ctx_fl_block ctx_flags.block
#define ctx_fl_system ctx_flags.system
#define ctx_fl_using_dbreg ctx_flags.using_dbreg
#define ctx_fl_is_sampling ctx_flags.is_sampling
#define ctx_fl_excl_idle ctx_flags.excl_idle
#define ctx_fl_going_zombie ctx_flags.going_zombie
#define ctx_fl_trap_reason ctx_flags.trap_reason
#define ctx_fl_no_msg ctx_flags.no_msg
#define ctx_fl_can_restart ctx_flags.can_restart
#define PFM_SET_WORK_PENDING(t, v) do { (t)->thread.pfm_needs_checking = v; } while(0);
#define PFM_GET_WORK_PENDING(t) (t)->thread.pfm_needs_checking
/*
* global information about all sessions
* mostly used to synchronize between system wide and per-process
*/
typedef struct {
spinlock_t pfs_lock; /* lock the structure */
unsigned int pfs_task_sessions; /* number of per task sessions */
unsigned int pfs_sys_sessions; /* number of per system wide sessions */
unsigned int pfs_sys_use_dbregs; /* incremented when a system wide session uses debug regs */
unsigned int pfs_ptrace_use_dbregs; /* incremented when a process uses debug regs */
struct task_struct *pfs_sys_session[NR_CPUS]; /* point to task owning a system-wide session */
} pfm_session_t;
/*
* information about a PMC or PMD.
* dep_pmd[]: a bitmask of dependent PMD registers
* dep_pmc[]: a bitmask of dependent PMC registers
*/
typedef int (*pfm_reg_check_t)(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
typedef struct {
unsigned int type;
int pm_pos;
unsigned long default_value; /* power-on default value */
unsigned long reserved_mask; /* bitmask of reserved bits */
pfm_reg_check_t read_check;
pfm_reg_check_t write_check;
unsigned long dep_pmd[4];
unsigned long dep_pmc[4];
} pfm_reg_desc_t;
/* assume cnum is a valid monitor */
#define PMC_PM(cnum, val) (((val) >> (pmu_conf->pmc_desc[cnum].pm_pos)) & 0x1)
/*
* This structure is initialized at boot time and contains
* a description of the PMU main characteristics.
*
* If the probe function is defined, detection is based
* on its return value:
* - 0 means recognized PMU
* - anything else means not supported
* When the probe function is not defined, then the pmu_family field
* is used and it must match the host CPU family such that:
* - cpu->family & config->pmu_family != 0
*/
typedef struct {
unsigned long ovfl_val; /* overflow value for counters */
pfm_reg_desc_t *pmc_desc; /* detailed PMC register dependencies descriptions */
pfm_reg_desc_t *pmd_desc; /* detailed PMD register dependencies descriptions */
unsigned int num_pmcs; /* number of PMCS: computed at init time */
unsigned int num_pmds; /* number of PMDS: computed at init time */
unsigned long impl_pmcs[4]; /* bitmask of implemented PMCS */
unsigned long impl_pmds[4]; /* bitmask of implemented PMDS */
char *pmu_name; /* PMU family name */
unsigned int pmu_family; /* cpuid family pattern used to identify pmu */
unsigned int flags; /* pmu specific flags */
unsigned int num_ibrs; /* number of IBRS: computed at init time */
unsigned int num_dbrs; /* number of DBRS: computed at init time */
unsigned int num_counters; /* PMC/PMD counting pairs : computed at init time */
int (*probe)(void); /* customized probe routine */
unsigned int use_rr_dbregs:1; /* set if debug registers used for range restriction */
} pmu_config_t;
/*
* PMU specific flags
*/
#define PFM_PMU_IRQ_RESEND 1 /* PMU needs explicit IRQ resend */
/*
* debug register related type definitions
*/
typedef struct {
unsigned long ibr_mask:56;
unsigned long ibr_plm:4;
unsigned long ibr_ig:3;
unsigned long ibr_x:1;
} ibr_mask_reg_t;
typedef struct {
unsigned long dbr_mask:56;
unsigned long dbr_plm:4;
unsigned long dbr_ig:2;
unsigned long dbr_w:1;
unsigned long dbr_r:1;
} dbr_mask_reg_t;
typedef union {
unsigned long val;
ibr_mask_reg_t ibr;
dbr_mask_reg_t dbr;
} dbreg_t;
/*
* perfmon command descriptions
*/
typedef struct {
int (*cmd_func)(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
char *cmd_name;
int cmd_flags;
unsigned int cmd_narg;
size_t cmd_argsize;
int (*cmd_getsize)(void *arg, size_t *sz);
} pfm_cmd_desc_t;
#define PFM_CMD_FD 0x01 /* command requires a file descriptor */
#define PFM_CMD_ARG_READ 0x02 /* command must read argument(s) */
#define PFM_CMD_ARG_RW 0x04 /* command must read/write argument(s) */
#define PFM_CMD_STOP 0x08 /* command does not work on zombie context */
#define PFM_CMD_NAME(cmd) pfm_cmd_tab[(cmd)].cmd_name
#define PFM_CMD_READ_ARG(cmd) (pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_ARG_READ)
#define PFM_CMD_RW_ARG(cmd) (pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_ARG_RW)
#define PFM_CMD_USE_FD(cmd) (pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_FD)
#define PFM_CMD_STOPPED(cmd) (pfm_cmd_tab[(cmd)].cmd_flags & PFM_CMD_STOP)
#define PFM_CMD_ARG_MANY -1 /* cannot be zero */
typedef struct {
unsigned long pfm_spurious_ovfl_intr_count; /* keep track of spurious ovfl interrupts */
unsigned long pfm_replay_ovfl_intr_count; /* keep track of replayed ovfl interrupts */
unsigned long pfm_ovfl_intr_count; /* keep track of ovfl interrupts */
unsigned long pfm_ovfl_intr_cycles; /* cycles spent processing ovfl interrupts */
unsigned long pfm_ovfl_intr_cycles_min; /* min cycles spent processing ovfl interrupts */
unsigned long pfm_ovfl_intr_cycles_max; /* max cycles spent processing ovfl interrupts */
unsigned long pfm_smpl_handler_calls;
unsigned long pfm_smpl_handler_cycles;
char pad[SMP_CACHE_BYTES] ____cacheline_aligned;
} pfm_stats_t;
/*
* perfmon internal variables
*/
static pfm_stats_t pfm_stats[NR_CPUS];
static pfm_session_t pfm_sessions; /* global sessions information */
static DEFINE_SPINLOCK(pfm_alt_install_check);
static pfm_intr_handler_desc_t *pfm_alt_intr_handler;
static struct proc_dir_entry *perfmon_dir;
static pfm_uuid_t pfm_null_uuid = {0,};
static spinlock_t pfm_buffer_fmt_lock;
static LIST_HEAD(pfm_buffer_fmt_list);
static pmu_config_t *pmu_conf;
/* sysctl() controls */
pfm_sysctl_t pfm_sysctl;
EXPORT_SYMBOL(pfm_sysctl);
static ctl_table pfm_ctl_table[]={
{
.procname = "debug",
.data = &pfm_sysctl.debug,
.maxlen = sizeof(int),
.mode = 0666,
.proc_handler = proc_dointvec,
},
{
.procname = "debug_ovfl",
.data = &pfm_sysctl.debug_ovfl,
.maxlen = sizeof(int),
.mode = 0666,
.proc_handler = proc_dointvec,
},
{
.procname = "fastctxsw",
.data = &pfm_sysctl.fastctxsw,
.maxlen = sizeof(int),
.mode = 0600,
.proc_handler = proc_dointvec,
},
{
.procname = "expert_mode",
.data = &pfm_sysctl.expert_mode,
.maxlen = sizeof(int),
.mode = 0600,
.proc_handler = proc_dointvec,
},
{}
};
static ctl_table pfm_sysctl_dir[] = {
{
.procname = "perfmon",
.mode = 0555,
.child = pfm_ctl_table,
},
{}
};
static ctl_table pfm_sysctl_root[] = {
{
.procname = "kernel",
.mode = 0555,
.child = pfm_sysctl_dir,
},
{}
};
static struct ctl_table_header *pfm_sysctl_header;
static int pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
#define pfm_get_cpu_var(v) __ia64_per_cpu_var(v)
#define pfm_get_cpu_data(a,b) per_cpu(a, b)
static inline void
pfm_put_task(struct task_struct *task)
{
if (task != current) put_task_struct(task);
}
static inline void
pfm_reserve_page(unsigned long a)
{
SetPageReserved(vmalloc_to_page((void *)a));
}
static inline void
pfm_unreserve_page(unsigned long a)
{
ClearPageReserved(vmalloc_to_page((void*)a));
}
static inline unsigned long
pfm_protect_ctx_ctxsw(pfm_context_t *x)
{
spin_lock(&(x)->ctx_lock);
return 0UL;
}
static inline void
pfm_unprotect_ctx_ctxsw(pfm_context_t *x, unsigned long f)
{
spin_unlock(&(x)->ctx_lock);
}
static inline unsigned long
pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
{
return get_unmapped_area(file, addr, len, pgoff, flags);
}
/* forward declaration */
static const struct dentry_operations pfmfs_dentry_operations;
static struct dentry *
pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
{
return mount_pseudo(fs_type, "pfm:", NULL, &pfmfs_dentry_operations,
PFMFS_MAGIC);
}
static struct file_system_type pfm_fs_type = {
.name = "pfmfs",
.mount = pfmfs_mount,
.kill_sb = kill_anon_super,
};
DEFINE_PER_CPU(unsigned long, pfm_syst_info);
DEFINE_PER_CPU(struct task_struct *, pmu_owner);
DEFINE_PER_CPU(pfm_context_t *, pmu_ctx);
DEFINE_PER_CPU(unsigned long, pmu_activation_number);
EXPORT_PER_CPU_SYMBOL_GPL(pfm_syst_info);
/* forward declaration */
static const struct file_operations pfm_file_ops;
/*
* forward declarations
*/
#ifndef CONFIG_SMP
static void pfm_lazy_save_regs (struct task_struct *ta);
#endif
void dump_pmu_state(const char *);
static int pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
#include "perfmon_itanium.h"
#include "perfmon_mckinley.h"
#include "perfmon_montecito.h"
#include "perfmon_generic.h"
static pmu_config_t *pmu_confs[]={
&pmu_conf_mont,
&pmu_conf_mck,
&pmu_conf_ita,
&pmu_conf_gen, /* must be last */
NULL
};
static int pfm_end_notify_user(pfm_context_t *ctx);
static inline void
pfm_clear_psr_pp(void)
{
ia64_rsm(IA64_PSR_PP);
ia64_srlz_i();
}
static inline void
pfm_set_psr_pp(void)
{
ia64_ssm(IA64_PSR_PP);
ia64_srlz_i();
}
static inline void
pfm_clear_psr_up(void)
{
ia64_rsm(IA64_PSR_UP);
ia64_srlz_i();
}
static inline void
pfm_set_psr_up(void)
{
ia64_ssm(IA64_PSR_UP);
ia64_srlz_i();
}
static inline unsigned long
pfm_get_psr(void)
{
unsigned long tmp;
tmp = ia64_getreg(_IA64_REG_PSR);
ia64_srlz_i();
return tmp;
}
static inline void
pfm_set_psr_l(unsigned long val)
{
ia64_setreg(_IA64_REG_PSR_L, val);
ia64_srlz_i();
}
static inline void
pfm_freeze_pmu(void)
{
ia64_set_pmc(0,1UL);
ia64_srlz_d();
}
static inline void
pfm_unfreeze_pmu(void)
{
ia64_set_pmc(0,0UL);
ia64_srlz_d();
}
static inline void
pfm_restore_ibrs(unsigned long *ibrs, unsigned int nibrs)
{
int i;
for (i=0; i < nibrs; i++) {
ia64_set_ibr(i, ibrs[i]);
ia64_dv_serialize_instruction();
}
ia64_srlz_i();
}
static inline void
pfm_restore_dbrs(unsigned long *dbrs, unsigned int ndbrs)
{
int i;
for (i=0; i < ndbrs; i++) {
ia64_set_dbr(i, dbrs[i]);
ia64_dv_serialize_data();
}
ia64_srlz_d();
}
/*
* PMD[i] must be a counter. no check is made
*/
static inline unsigned long
pfm_read_soft_counter(pfm_context_t *ctx, int i)
{
return ctx->ctx_pmds[i].val + (ia64_get_pmd(i) & pmu_conf->ovfl_val);
}
/*
* PMD[i] must be a counter. no check is made
*/
static inline void
pfm_write_soft_counter(pfm_context_t *ctx, int i, unsigned long val)
{
unsigned long ovfl_val = pmu_conf->ovfl_val;
ctx->ctx_pmds[i].val = val & ~ovfl_val;
/*
* writing to unimplemented part is ignore, so we do not need to
* mask off top part
*/
ia64_set_pmd(i, val & ovfl_val);
}
static pfm_msg_t *
pfm_get_new_msg(pfm_context_t *ctx)
{
int idx, next;
next = (ctx->ctx_msgq_tail+1) % PFM_MAX_MSGS;
DPRINT(("ctx_fd=%p head=%d tail=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail));
if (next == ctx->ctx_msgq_head) return NULL;
idx = ctx->ctx_msgq_tail;
ctx->ctx_msgq_tail = next;
DPRINT(("ctx=%p head=%d tail=%d msg=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail, idx));
return ctx->ctx_msgq+idx;
}
static pfm_msg_t *
pfm_get_next_msg(pfm_context_t *ctx)
{
pfm_msg_t *msg;
DPRINT(("ctx=%p head=%d tail=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail));
if (PFM_CTXQ_EMPTY(ctx)) return NULL;
/*
* get oldest message
*/
msg = ctx->ctx_msgq+ctx->ctx_msgq_head;
/*
* and move forward
*/
ctx->ctx_msgq_head = (ctx->ctx_msgq_head+1) % PFM_MAX_MSGS;
DPRINT(("ctx=%p head=%d tail=%d type=%d\n", ctx, ctx->ctx_msgq_head, ctx->ctx_msgq_tail, msg->pfm_gen_msg.msg_type));
return msg;
}
static void
pfm_reset_msgq(pfm_context_t *ctx)
{
ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
DPRINT(("ctx=%p msgq reset\n", ctx));
}
static void *
pfm_rvmalloc(unsigned long size)
{
void *mem;
unsigned long addr;
size = PAGE_ALIGN(size);
mem = vzalloc(size);
if (mem) {
//printk("perfmon: CPU%d pfm_rvmalloc(%ld)=%p\n", smp_processor_id(), size, mem);
addr = (unsigned long)mem;
while (size > 0) {
pfm_reserve_page(addr);
addr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
}
return mem;
}
static void
pfm_rvfree(void *mem, unsigned long size)
{
unsigned long addr;
if (mem) {
DPRINT(("freeing physical buffer @%p size=%lu\n", mem, size));
addr = (unsigned long) mem;
while ((long) size > 0) {
pfm_unreserve_page(addr);
addr+=PAGE_SIZE;
size-=PAGE_SIZE;
}
vfree(mem);
}
return;
}
static pfm_context_t *
pfm_context_alloc(int ctx_flags)
{
pfm_context_t *ctx;
/*
* allocate context descriptor
* must be able to free with interrupts disabled
*/
ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL);
if (ctx) {
DPRINT(("alloc ctx @%p\n", ctx));
/*
* init context protection lock
*/
spin_lock_init(&ctx->ctx_lock);
/*
* context is unloaded
*/
ctx->ctx_state = PFM_CTX_UNLOADED;
/*
* initialization of context's flags
*/
ctx->ctx_fl_block = (ctx_flags & PFM_FL_NOTIFY_BLOCK) ? 1 : 0;
ctx->ctx_fl_system = (ctx_flags & PFM_FL_SYSTEM_WIDE) ? 1: 0;
ctx->ctx_fl_no_msg = (ctx_flags & PFM_FL_OVFL_NO_MSG) ? 1: 0;
/*
* will move to set properties
* ctx->ctx_fl_excl_idle = (ctx_flags & PFM_FL_EXCL_IDLE) ? 1: 0;
*/
/*
* init restart semaphore to locked
*/
init_completion(&ctx->ctx_restart_done);
/*
* activation is used in SMP only
*/
ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
SET_LAST_CPU(ctx, -1);
/*
* initialize notification message queue
*/
ctx->ctx_msgq_head = ctx->ctx_msgq_tail = 0;
init_waitqueue_head(&ctx->ctx_msgq_wait);
init_waitqueue_head(&ctx->ctx_zombieq);
}
return ctx;
}
static void
pfm_context_free(pfm_context_t *ctx)
{
if (ctx) {
DPRINT(("free ctx @%p\n", ctx));
kfree(ctx);
}
}
static void
pfm_mask_monitoring(struct task_struct *task)
{
pfm_context_t *ctx = PFM_GET_CTX(task);
unsigned long mask, val, ovfl_mask;
int i;
DPRINT_ovfl(("masking monitoring for [%d]\n", task_pid_nr(task)));
ovfl_mask = pmu_conf->ovfl_val;
/*
* monitoring can only be masked as a result of a valid
* counter overflow. In UP, it means that the PMU still
* has an owner. Note that the owner can be different
* from the current task. However the PMU state belongs
* to the owner.
* In SMP, a valid overflow only happens when task is
* current. Therefore if we come here, we know that
* the PMU state belongs to the current task, therefore
* we can access the live registers.
*
* So in both cases, the live register contains the owner's
* state. We can ONLY touch the PMU registers and NOT the PSR.
*
* As a consequence to this call, the ctx->th_pmds[] array
* contains stale information which must be ignored
* when context is reloaded AND monitoring is active (see
* pfm_restart).
*/
mask = ctx->ctx_used_pmds[0];
for (i = 0; mask; i++, mask>>=1) {
/* skip non used pmds */
if ((mask & 0x1) == 0) continue;
val = ia64_get_pmd(i);
if (PMD_IS_COUNTING(i)) {
/*
* we rebuild the full 64 bit value of the counter
*/
ctx->ctx_pmds[i].val += (val & ovfl_mask);
} else {
ctx->ctx_pmds[i].val = val;
}
DPRINT_ovfl(("pmd[%d]=0x%lx hw_pmd=0x%lx\n",
i,
ctx->ctx_pmds[i].val,
val & ovfl_mask));
}
/*
* mask monitoring by setting the privilege level to 0
* we cannot use psr.pp/psr.up for this, it is controlled by
* the user
*
* if task is current, modify actual registers, otherwise modify
* thread save state, i.e., what will be restored in pfm_load_regs()
*/
mask = ctx->ctx_used_monitors[0] >> PMU_FIRST_COUNTER;
for(i= PMU_FIRST_COUNTER; mask; i++, mask>>=1) {
if ((mask & 0x1) == 0UL) continue;
ia64_set_pmc(i, ctx->th_pmcs[i] & ~0xfUL);
ctx->th_pmcs[i] &= ~0xfUL;
DPRINT_ovfl(("pmc[%d]=0x%lx\n", i, ctx->th_pmcs[i]));
}
/*
* make all of this visible
*/
ia64_srlz_d();
}
/*
* must always be done with task == current
*
* context must be in MASKED state when calling
*/
static void
pfm_restore_monitoring(struct task_struct *task)
{
pfm_context_t *ctx = PFM_GET_CTX(task);
unsigned long mask, ovfl_mask;
unsigned long psr, val;
int i, is_system;
is_system = ctx->ctx_fl_system;
ovfl_mask = pmu_conf->ovfl_val;
if (task != current) {
printk(KERN_ERR "perfmon.%d: invalid task[%d] current[%d]\n", __LINE__, task_pid_nr(task), task_pid_nr(current));
return;
}
if (ctx->ctx_state != PFM_CTX_MASKED) {
printk(KERN_ERR "perfmon.%d: task[%d] current[%d] invalid state=%d\n", __LINE__,
task_pid_nr(task), task_pid_nr(current), ctx->ctx_state);
return;
}
psr = pfm_get_psr();
/*
* monitoring is masked via the PMC.
* As we restore their value, we do not want each counter to
* restart right away. We stop monitoring using the PSR,
* restore the PMC (and PMD) and then re-establish the psr
* as it was. Note that there can be no pending overflow at
* this point, because monitoring was MASKED.
*
* system-wide session are pinned and self-monitoring
*/
if (is_system && (PFM_CPUINFO_GET() & PFM_CPUINFO_DCR_PP)) {
/* disable dcr pp */
ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) & ~IA64_DCR_PP);
pfm_clear_psr_pp();
} else {
pfm_clear_psr_up();
}
/*
* first, we restore the PMD
*/
mask = ctx->ctx_used_pmds[0];
for (i = 0; mask; i++, mask>>=1) {
/* skip non used pmds */
if ((mask & 0x1) == 0) continue;
if (PMD_IS_COUNTING(i)) {
/*
* we split the 64bit value according to
* counter width
*/
val = ctx->ctx_pmds[i].val & ovfl_mask;
ctx->ctx_pmds[i].val &= ~ovfl_mask;
} else {
val = ctx->ctx_pmds[i].val;
}
ia64_set_pmd(i, val);
DPRINT(("pmd[%d]=0x%lx hw_pmd=0x%lx\n",
i,
ctx->ctx_pmds[i].val,
val));
}
/*
* restore the PMCs
*/
mask = ctx->ctx_used_monitors[0] >> PMU_FIRST_COUNTER;
for(i= PMU_FIRST_COUNTER; mask; i++, mask>>=1) {
if ((mask & 0x1) == 0UL) continue;
ctx->th_pmcs[i] = ctx->ctx_pmcs[i];
ia64_set_pmc(i, ctx->th_pmcs[i]);
DPRINT(("[%d] pmc[%d]=0x%lx\n",
task_pid_nr(task), i, ctx->th_pmcs[i]));
}
ia64_srlz_d();
/*
* must restore DBR/IBR because could be modified while masked
* XXX: need to optimize
*/
if (ctx->ctx_fl_using_dbreg) {
pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
}
/*
* now restore PSR
*/
if (is_system && (PFM_CPUINFO_GET() & PFM_CPUINFO_DCR_PP)) {
/* enable dcr pp */
ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) | IA64_DCR_PP);
ia64_srlz_i();
}
pfm_set_psr_l(psr);
}
static inline void
pfm_save_pmds(unsigned long *pmds, unsigned long mask)
{
int i;
ia64_srlz_d();
for (i=0; mask; i++, mask>>=1) {
if (mask & 0x1) pmds[i] = ia64_get_pmd(i);
}
}
/*
* reload from thread state (used for ctxw only)
*/
static inline void
pfm_restore_pmds(unsigned long *pmds, unsigned long mask)
{
int i;
unsigned long val, ovfl_val = pmu_conf->ovfl_val;
for (i=0; mask; i++, mask>>=1) {
if ((mask & 0x1) == 0) continue;
val = PMD_IS_COUNTING(i) ? pmds[i] & ovfl_val : pmds[i];
ia64_set_pmd(i, val);
}
ia64_srlz_d();
}
/*
* propagate PMD from context to thread-state
*/
static inline void
pfm_copy_pmds(struct task_struct *task, pfm_context_t *ctx)
{
unsigned long ovfl_val = pmu_conf->ovfl_val;
unsigned long mask = ctx->ctx_all_pmds[0];
unsigned long val;
int i;
DPRINT(("mask=0x%lx\n", mask));
for (i=0; mask; i++, mask>>=1) {
val = ctx->ctx_pmds[i].val;
/*
* We break up the 64 bit value into 2 pieces
* the lower bits go to the machine state in the
* thread (will be reloaded on ctxsw in).
* The upper part stays in the soft-counter.
*/
if (PMD_IS_COUNTING(i)) {
ctx->ctx_pmds[i].val = val & ~ovfl_val;
val &= ovfl_val;
}
ctx->th_pmds[i] = val;
DPRINT(("pmd[%d]=0x%lx soft_val=0x%lx\n",
i,
ctx->th_pmds[i],
ctx->ctx_pmds[i].val));
}
}
/*
* propagate PMC from context to thread-state
*/
static inline void
pfm_copy_pmcs(struct task_struct *task, pfm_context_t *ctx)
{
unsigned long mask = ctx->ctx_all_pmcs[0];
int i;
DPRINT(("mask=0x%lx\n", mask));
for (i=0; mask; i++, mask>>=1) {
/* masking 0 with ovfl_val yields 0 */
ctx->th_pmcs[i] = ctx->ctx_pmcs[i];
DPRINT(("pmc[%d]=0x%lx\n", i, ctx->th_pmcs[i]));
}
}
static inline void
pfm_restore_pmcs(unsigned long *pmcs, unsigned long mask)
{
int i;
for (i=0; mask; i++, mask>>=1) {
if ((mask & 0x1) == 0) continue;
ia64_set_pmc(i, pmcs[i]);
}
ia64_srlz_d();
}
static inline int
pfm_uuid_cmp(pfm_uuid_t a, pfm_uuid_t b)
{
return memcmp(a, b, sizeof(pfm_uuid_t));
}
static inline int
pfm_buf_fmt_exit(pfm_buffer_fmt_t *fmt, struct task_struct *task, void *buf, struct pt_regs *regs)
{
int ret = 0;
if (fmt->fmt_exit) ret = (*fmt->fmt_exit)(task, buf, regs);
return ret;
}
static inline int
pfm_buf_fmt_getsize(pfm_buffer_fmt_t *fmt, struct task_struct *task, unsigned int flags, int cpu, void *arg, unsigned long *size)
{
int ret = 0;
if (fmt->fmt_getsize) ret = (*fmt->fmt_getsize)(task, flags, cpu, arg, size);
return ret;
}
static inline int
pfm_buf_fmt_validate(pfm_buffer_fmt_t *fmt, struct task_struct *task, unsigned int flags,
int cpu, void *arg)
{
int ret = 0;
if (fmt->fmt_validate) ret = (*fmt->fmt_validate)(task, flags, cpu, arg);
return ret;
}
static inline int
pfm_buf_fmt_init(pfm_buffer_fmt_t *fmt, struct task_struct *task, void *buf, unsigned int flags,
int cpu, void *arg)
{
int ret = 0;
if (fmt->fmt_init) ret = (*fmt->fmt_init)(task, buf, flags, cpu, arg);
return ret;
}
static inline int
pfm_buf_fmt_restart(pfm_buffer_fmt_t *fmt, struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs)
{
int ret = 0;
if (fmt->fmt_restart) ret = (*fmt->fmt_restart)(task, ctrl, buf, regs);
return ret;
}
static inline int
pfm_buf_fmt_restart_active(pfm_buffer_fmt_t *fmt, struct task_struct *task, pfm_ovfl_ctrl_t *ctrl, void *buf, struct pt_regs *regs)
{
int ret = 0;
if (fmt->fmt_restart_active) ret = (*fmt->fmt_restart_active)(task, ctrl, buf, regs);
return ret;
}
static pfm_buffer_fmt_t *
__pfm_find_buffer_fmt(pfm_uuid_t uuid)
{
struct list_head * pos;
pfm_buffer_fmt_t * entry;
list_for_each(pos, &pfm_buffer_fmt_list) {
entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list);
if (pfm_uuid_cmp(uuid, entry->fmt_uuid) == 0)
return entry;
}
return NULL;
}
/*
* find a buffer format based on its uuid
*/
static pfm_buffer_fmt_t *
pfm_find_buffer_fmt(pfm_uuid_t uuid)
{
pfm_buffer_fmt_t * fmt;
spin_lock(&pfm_buffer_fmt_lock);
fmt = __pfm_find_buffer_fmt(uuid);
spin_unlock(&pfm_buffer_fmt_lock);
return fmt;
}
int
pfm_register_buffer_fmt(pfm_buffer_fmt_t *fmt)
{
int ret = 0;
/* some sanity checks */
if (fmt == NULL || fmt->fmt_name == NULL) return -EINVAL;
/* we need at least a handler */
if (fmt->fmt_handler == NULL) return -EINVAL;
/*
* XXX: need check validity of fmt_arg_size
*/
spin_lock(&pfm_buffer_fmt_lock);
if (__pfm_find_buffer_fmt(fmt->fmt_uuid)) {
printk(KERN_ERR "perfmon: duplicate sampling format: %s\n", fmt->fmt_name);
ret = -EBUSY;
goto out;
}
list_add(&fmt->fmt_list, &pfm_buffer_fmt_list);
printk(KERN_INFO "perfmon: added sampling format %s\n", fmt->fmt_name);
out:
spin_unlock(&pfm_buffer_fmt_lock);
return ret;
}
EXPORT_SYMBOL(pfm_register_buffer_fmt);
int
pfm_unregister_buffer_fmt(pfm_uuid_t uuid)
{
pfm_buffer_fmt_t *fmt;
int ret = 0;
spin_lock(&pfm_buffer_fmt_lock);
fmt = __pfm_find_buffer_fmt(uuid);
if (!fmt) {
printk(KERN_ERR "perfmon: cannot unregister format, not found\n");
ret = -EINVAL;
goto out;
}
list_del_init(&fmt->fmt_list);
printk(KERN_INFO "perfmon: removed sampling format: %s\n", fmt->fmt_name);
out:
spin_unlock(&pfm_buffer_fmt_lock);
return ret;
}
EXPORT_SYMBOL(pfm_unregister_buffer_fmt);
extern void update_pal_halt_status(int);
static int
pfm_reserve_session(struct task_struct *task, int is_syswide, unsigned int cpu)
{
unsigned long flags;
/*
* validity checks on cpu_mask have been done upstream
*/
LOCK_PFS(flags);
DPRINT(("in sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pfs_task_sessions,
pfm_sessions.pfs_sys_use_dbregs,
is_syswide,
cpu));
if (is_syswide) {
/*
* cannot mix system wide and per-task sessions
*/
if (pfm_sessions.pfs_task_sessions > 0UL) {
DPRINT(("system wide not possible, %u conflicting task_sessions\n",
pfm_sessions.pfs_task_sessions));
goto abort;
}
if (pfm_sessions.pfs_sys_session[cpu]) goto error_conflict;
DPRINT(("reserving system wide session on CPU%u currently on CPU%u\n", cpu, smp_processor_id()));
pfm_sessions.pfs_sys_session[cpu] = task;
pfm_sessions.pfs_sys_sessions++ ;
} else {
if (pfm_sessions.pfs_sys_sessions) goto abort;
pfm_sessions.pfs_task_sessions++;
}
DPRINT(("out sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pfs_task_sessions,
pfm_sessions.pfs_sys_use_dbregs,
is_syswide,
cpu));
/*
* disable default_idle() to go to PAL_HALT
*/
update_pal_halt_status(0);
UNLOCK_PFS(flags);
return 0;
error_conflict:
DPRINT(("system wide not possible, conflicting session [%d] on CPU%d\n",
task_pid_nr(pfm_sessions.pfs_sys_session[cpu]),
cpu));
abort:
UNLOCK_PFS(flags);
return -EBUSY;
}
static int
pfm_unreserve_session(pfm_context_t *ctx, int is_syswide, unsigned int cpu)
{
unsigned long flags;
/*
* validity checks on cpu_mask have been done upstream
*/
LOCK_PFS(flags);
DPRINT(("in sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pfs_task_sessions,
pfm_sessions.pfs_sys_use_dbregs,
is_syswide,
cpu));
if (is_syswide) {
pfm_sessions.pfs_sys_session[cpu] = NULL;
/*
* would not work with perfmon+more than one bit in cpu_mask
*/
if (ctx && ctx->ctx_fl_using_dbreg) {
if (pfm_sessions.pfs_sys_use_dbregs == 0) {
printk(KERN_ERR "perfmon: invalid release for ctx %p sys_use_dbregs=0\n", ctx);
} else {
pfm_sessions.pfs_sys_use_dbregs--;
}
}
pfm_sessions.pfs_sys_sessions--;
} else {
pfm_sessions.pfs_task_sessions--;
}
DPRINT(("out sys_sessions=%u task_sessions=%u dbregs=%u syswide=%d cpu=%u\n",
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pfs_task_sessions,
pfm_sessions.pfs_sys_use_dbregs,
is_syswide,
cpu));
/*
* if possible, enable default_idle() to go into PAL_HALT
*/
if (pfm_sessions.pfs_task_sessions == 0 && pfm_sessions.pfs_sys_sessions == 0)
update_pal_halt_status(1);
UNLOCK_PFS(flags);
return 0;
}
/*
* removes virtual mapping of the sampling buffer.
* IMPORTANT: cannot be called with interrupts disable, e.g. inside
* a PROTECT_CTX() section.
*/
static int
pfm_remove_smpl_mapping(void *vaddr, unsigned long size)
{
struct task_struct *task = current;
int r;
/* sanity checks */
if (task->mm == NULL || size == 0UL || vaddr == NULL) {
printk(KERN_ERR "perfmon: pfm_remove_smpl_mapping [%d] invalid context mm=%p\n", task_pid_nr(task), task->mm);
return -EINVAL;
}
DPRINT(("smpl_vaddr=%p size=%lu\n", vaddr, size));
/*
* does the actual unmapping
*/
r = vm_munmap((unsigned long)vaddr, size);
if (r !=0) {
printk(KERN_ERR "perfmon: [%d] unable to unmap sampling buffer @%p size=%lu\n", task_pid_nr(task), vaddr, size);
}
DPRINT(("do_unmap(%p, %lu)=%d\n", vaddr, size, r));
return 0;
}
/*
* free actual physical storage used by sampling buffer
*/
#if 0
static int
pfm_free_smpl_buffer(pfm_context_t *ctx)
{
pfm_buffer_fmt_t *fmt;
if (ctx->ctx_smpl_hdr == NULL) goto invalid_free;
/*
* we won't use the buffer format anymore
*/
fmt = ctx->ctx_buf_fmt;
DPRINT(("sampling buffer @%p size %lu vaddr=%p\n",
ctx->ctx_smpl_hdr,
ctx->ctx_smpl_size,
ctx->ctx_smpl_vaddr));
pfm_buf_fmt_exit(fmt, current, NULL, NULL);
/*
* free the buffer
*/
pfm_rvfree(ctx->ctx_smpl_hdr, ctx->ctx_smpl_size);
ctx->ctx_smpl_hdr = NULL;
ctx->ctx_smpl_size = 0UL;
return 0;
invalid_free:
printk(KERN_ERR "perfmon: pfm_free_smpl_buffer [%d] no buffer\n", task_pid_nr(current));
return -EINVAL;
}
#endif
static inline void
pfm_exit_smpl_buffer(pfm_buffer_fmt_t *fmt)
{
if (fmt == NULL) return;
pfm_buf_fmt_exit(fmt, current, NULL, NULL);
}
/*
* pfmfs should _never_ be mounted by userland - too much of security hassle,
* no real gain from having the whole whorehouse mounted. So we don't need
* any operations on the root directory. However, we need a non-trivial
* d_name - pfm: will go nicely and kill the special-casing in procfs.
*/
static struct vfsmount *pfmfs_mnt __read_mostly;
static int __init
init_pfm_fs(void)
{
int err = register_filesystem(&pfm_fs_type);
if (!err) {
pfmfs_mnt = kern_mount(&pfm_fs_type);
err = PTR_ERR(pfmfs_mnt);
if (IS_ERR(pfmfs_mnt))
unregister_filesystem(&pfm_fs_type);
else
err = 0;
}
return err;
}
static ssize_t
pfm_read(struct file *filp, char __user *buf, size_t size, loff_t *ppos)
{
pfm_context_t *ctx;
pfm_msg_t *msg;
ssize_t ret;
unsigned long flags;
DECLARE_WAITQUEUE(wait, current);
if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
return -EINVAL;
}
ctx = filp->private_data;
if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_read: NULL ctx [%d]\n", task_pid_nr(current));
return -EINVAL;
}
/*
* check even when there is no message
*/
if (size < sizeof(pfm_msg_t)) {
DPRINT(("message is too small ctx=%p (>=%ld)\n", ctx, sizeof(pfm_msg_t)));
return -EINVAL;
}
PROTECT_CTX(ctx, flags);
/*
* put ourselves on the wait queue
*/
add_wait_queue(&ctx->ctx_msgq_wait, &wait);
for(;;) {
/*
* check wait queue
*/
set_current_state(TASK_INTERRUPTIBLE);
DPRINT(("head=%d tail=%d\n", ctx->ctx_msgq_head, ctx->ctx_msgq_tail));
ret = 0;
if(PFM_CTXQ_EMPTY(ctx) == 0) break;
UNPROTECT_CTX(ctx, flags);
/*
* check non-blocking read
*/
ret = -EAGAIN;
if(filp->f_flags & O_NONBLOCK) break;
/*
* check pending signals
*/
if(signal_pending(current)) {
ret = -EINTR;
break;
}
/*
* no message, so wait
*/
schedule();
PROTECT_CTX(ctx, flags);
}
DPRINT(("[%d] back to running ret=%ld\n", task_pid_nr(current), ret));
set_current_state(TASK_RUNNING);
remove_wait_queue(&ctx->ctx_msgq_wait, &wait);
if (ret < 0) goto abort;
ret = -EINVAL;
msg = pfm_get_next_msg(ctx);
if (msg == NULL) {
printk(KERN_ERR "perfmon: pfm_read no msg for ctx=%p [%d]\n", ctx, task_pid_nr(current));
goto abort_locked;
}
DPRINT(("fd=%d type=%d\n", msg->pfm_gen_msg.msg_ctx_fd, msg->pfm_gen_msg.msg_type));
ret = -EFAULT;
if(copy_to_user(buf, msg, sizeof(pfm_msg_t)) == 0) ret = sizeof(pfm_msg_t);
abort_locked:
UNPROTECT_CTX(ctx, flags);
abort:
return ret;
}
static ssize_t
pfm_write(struct file *file, const char __user *ubuf,
size_t size, loff_t *ppos)
{
DPRINT(("pfm_write called\n"));
return -EINVAL;
}
static unsigned int
pfm_poll(struct file *filp, poll_table * wait)
{
pfm_context_t *ctx;
unsigned long flags;
unsigned int mask = 0;
if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_poll: bad magic [%d]\n", task_pid_nr(current));
return 0;
}
ctx = filp->private_data;
if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_poll: NULL ctx [%d]\n", task_pid_nr(current));
return 0;
}
DPRINT(("pfm_poll ctx_fd=%d before poll_wait\n", ctx->ctx_fd));
poll_wait(filp, &ctx->ctx_msgq_wait, wait);
PROTECT_CTX(ctx, flags);
if (PFM_CTXQ_EMPTY(ctx) == 0)
mask = POLLIN | POLLRDNORM;
UNPROTECT_CTX(ctx, flags);
DPRINT(("pfm_poll ctx_fd=%d mask=0x%x\n", ctx->ctx_fd, mask));
return mask;
}
static long
pfm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
DPRINT(("pfm_ioctl called\n"));
return -EINVAL;
}
/*
* interrupt cannot be masked when coming here
*/
static inline int
pfm_do_fasync(int fd, struct file *filp, pfm_context_t *ctx, int on)
{
int ret;
ret = fasync_helper (fd, filp, on, &ctx->ctx_async_queue);
DPRINT(("pfm_fasync called by [%d] on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
task_pid_nr(current),
fd,
on,
ctx->ctx_async_queue, ret));
return ret;
}
static int
pfm_fasync(int fd, struct file *filp, int on)
{
pfm_context_t *ctx;
int ret;
if (PFM_IS_FILE(filp) == 0) {
printk(KERN_ERR "perfmon: pfm_fasync bad magic [%d]\n", task_pid_nr(current));
return -EBADF;
}
ctx = filp->private_data;
if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_fasync NULL ctx [%d]\n", task_pid_nr(current));
return -EBADF;
}
/*
* we cannot mask interrupts during this call because this may
* may go to sleep if memory is not readily avalaible.
*
* We are protected from the conetxt disappearing by the get_fd()/put_fd()
* done in caller. Serialization of this function is ensured by caller.
*/
ret = pfm_do_fasync(fd, filp, ctx, on);
DPRINT(("pfm_fasync called on ctx_fd=%d on=%d async_queue=%p ret=%d\n",
fd,
on,
ctx->ctx_async_queue, ret));
return ret;
}
#ifdef CONFIG_SMP
/*
* this function is exclusively called from pfm_close().
* The context is not protected at that time, nor are interrupts
* on the remote CPU. That's necessary to avoid deadlocks.
*/
static void
pfm_syswide_force_stop(void *info)
{
pfm_context_t *ctx = (pfm_context_t *)info;
struct pt_regs *regs = task_pt_regs(current);
struct task_struct *owner;
unsigned long flags;
int ret;
if (ctx->ctx_cpu != smp_processor_id()) {
printk(KERN_ERR "perfmon: pfm_syswide_force_stop for CPU%d but on CPU%d\n",
ctx->ctx_cpu,
smp_processor_id());
return;
}
owner = GET_PMU_OWNER();
if (owner != ctx->ctx_task) {
printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected owner [%d] instead of [%d]\n",
smp_processor_id(),
task_pid_nr(owner), task_pid_nr(ctx->ctx_task));
return;
}
if (GET_PMU_CTX() != ctx) {
printk(KERN_ERR "perfmon: pfm_syswide_force_stop CPU%d unexpected ctx %p instead of %p\n",
smp_processor_id(),
GET_PMU_CTX(), ctx);
return;
}
DPRINT(("on CPU%d forcing system wide stop for [%d]\n", smp_processor_id(), task_pid_nr(ctx->ctx_task)));
/*
* the context is already protected in pfm_close(), we simply
* need to mask interrupts to avoid a PMU interrupt race on
* this CPU
*/
local_irq_save(flags);
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
DPRINT(("context_unload returned %d\n", ret));
}
/*
* unmask interrupts, PMU interrupts are now spurious here
*/
local_irq_restore(flags);
}
static void
pfm_syswide_cleanup_other_cpu(pfm_context_t *ctx)
{
int ret;
DPRINT(("calling CPU%d for cleanup\n", ctx->ctx_cpu));
ret = smp_call_function_single(ctx->ctx_cpu, pfm_syswide_force_stop, ctx, 1);
DPRINT(("called CPU%d for cleanup ret=%d\n", ctx->ctx_cpu, ret));
}
#endif /* CONFIG_SMP */
/*
* called for each close(). Partially free resources.
* When caller is self-monitoring, the context is unloaded.
*/
static int
pfm_flush(struct file *filp, fl_owner_t id)
{
pfm_context_t *ctx;
struct task_struct *task;
struct pt_regs *regs;
unsigned long flags;
unsigned long smpl_buf_size = 0UL;
void *smpl_buf_vaddr = NULL;
int state, is_system;
if (PFM_IS_FILE(filp) == 0) {
DPRINT(("bad magic for\n"));
return -EBADF;
}
ctx = filp->private_data;
if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_flush: NULL ctx [%d]\n", task_pid_nr(current));
return -EBADF;
}
/*
* remove our file from the async queue, if we use this mode.
* This can be done without the context being protected. We come
* here when the context has become unreachable by other tasks.
*
* We may still have active monitoring at this point and we may
* end up in pfm_overflow_handler(). However, fasync_helper()
* operates with interrupts disabled and it cleans up the
* queue. If the PMU handler is called prior to entering
* fasync_helper() then it will send a signal. If it is
* invoked after, it will find an empty queue and no
* signal will be sent. In both case, we are safe
*/
PROTECT_CTX(ctx, flags);
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
task = PFM_CTX_TASK(ctx);
regs = task_pt_regs(task);
DPRINT(("ctx_state=%d is_current=%d\n",
state,
task == current ? 1 : 0));
/*
* if state == UNLOADED, then task is NULL
*/
/*
* we must stop and unload because we are losing access to the context.
*/
if (task == current) {
#ifdef CONFIG_SMP
/*
* the task IS the owner but it migrated to another CPU: that's bad
* but we must handle this cleanly. Unfortunately, the kernel does
* not provide a mechanism to block migration (while the context is loaded).
*
* We need to release the resource on the ORIGINAL cpu.
*/
if (is_system && ctx->ctx_cpu != smp_processor_id()) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
/*
* keep context protected but unmask interrupt for IPI
*/
local_irq_restore(flags);
pfm_syswide_cleanup_other_cpu(ctx);
/*
* restore interrupt masking
*/
local_irq_save(flags);
/*
* context is unloaded at this point
*/
} else
#endif /* CONFIG_SMP */
{
DPRINT(("forcing unload\n"));
/*
* stop and unload, returning with state UNLOADED
* and session unreserved.
*/
pfm_context_unload(ctx, NULL, 0, regs);
DPRINT(("ctx_state=%d\n", ctx->ctx_state));
}
}
/*
* remove virtual mapping, if any, for the calling task.
* cannot reset ctx field until last user is calling close().
*
* ctx_smpl_vaddr must never be cleared because it is needed
* by every task with access to the context
*
* When called from do_exit(), the mm context is gone already, therefore
* mm is NULL, i.e., the VMA is already gone and we do not have to
* do anything here
*/
if (ctx->ctx_smpl_vaddr && current->mm) {
smpl_buf_vaddr = ctx->ctx_smpl_vaddr;
smpl_buf_size = ctx->ctx_smpl_size;
}
UNPROTECT_CTX(ctx, flags);
/*
* if there was a mapping, then we systematically remove it
* at this point. Cannot be done inside critical section
* because some VM function reenables interrupts.
*
*/
if (smpl_buf_vaddr) pfm_remove_smpl_mapping(smpl_buf_vaddr, smpl_buf_size);
return 0;
}
/*
* called either on explicit close() or from exit_files().
* Only the LAST user of the file gets to this point, i.e., it is
* called only ONCE.
*
* IMPORTANT: we get called ONLY when the refcnt on the file gets to zero
* (fput()),i.e, last task to access the file. Nobody else can access the
* file at this point.
*
* When called from exit_files(), the VMA has been freed because exit_mm()
* is executed before exit_files().
*
* When called from exit_files(), the current task is not yet ZOMBIE but we
* flush the PMU state to the context.
*/
static int
pfm_close(struct inode *inode, struct file *filp)
{
pfm_context_t *ctx;
struct task_struct *task;
struct pt_regs *regs;
DECLARE_WAITQUEUE(wait, current);
unsigned long flags;
unsigned long smpl_buf_size = 0UL;
void *smpl_buf_addr = NULL;
int free_possible = 1;
int state, is_system;
DPRINT(("pfm_close called private=%p\n", filp->private_data));
if (PFM_IS_FILE(filp) == 0) {
DPRINT(("bad magic\n"));
return -EBADF;
}
ctx = filp->private_data;
if (ctx == NULL) {
printk(KERN_ERR "perfmon: pfm_close: NULL ctx [%d]\n", task_pid_nr(current));
return -EBADF;
}
PROTECT_CTX(ctx, flags);
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
task = PFM_CTX_TASK(ctx);
regs = task_pt_regs(task);
DPRINT(("ctx_state=%d is_current=%d\n",
state,
task == current ? 1 : 0));
/*
* if task == current, then pfm_flush() unloaded the context
*/
if (state == PFM_CTX_UNLOADED) goto doit;
/*
* context is loaded/masked and task != current, we need to
* either force an unload or go zombie
*/
/*
* The task is currently blocked or will block after an overflow.
* we must force it to wakeup to get out of the
* MASKED state and transition to the unloaded state by itself.
*
* This situation is only possible for per-task mode
*/
if (state == PFM_CTX_MASKED && CTX_OVFL_NOBLOCK(ctx) == 0) {
/*
* set a "partial" zombie state to be checked
* upon return from down() in pfm_handle_work().
*
* We cannot use the ZOMBIE state, because it is checked
* by pfm_load_regs() which is called upon wakeup from down().
* In such case, it would free the context and then we would
* return to pfm_handle_work() which would access the
* stale context. Instead, we set a flag invisible to pfm_load_regs()
* but visible to pfm_handle_work().
*
* For some window of time, we have a zombie context with
* ctx_state = MASKED and not ZOMBIE
*/
ctx->ctx_fl_going_zombie = 1;
/*
* force task to wake up from MASKED state
*/
complete(&ctx->ctx_restart_done);
DPRINT(("waking up ctx_state=%d\n", state));
/*
* put ourself to sleep waiting for the other
* task to report completion
*
* the context is protected by mutex, therefore there
* is no risk of being notified of completion before
* begin actually on the waitq.
*/
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&ctx->ctx_zombieq, &wait);
UNPROTECT_CTX(ctx, flags);
/*
* XXX: check for signals :
* - ok for explicit close
* - not ok when coming from exit_files()
*/
schedule();
PROTECT_CTX(ctx, flags);
remove_wait_queue(&ctx->ctx_zombieq, &wait);
set_current_state(TASK_RUNNING);
/*
* context is unloaded at this point
*/
DPRINT(("after zombie wakeup ctx_state=%d for\n", state));
}
else if (task != current) {
#ifdef CONFIG_SMP
/*
* switch context to zombie state
*/
ctx->ctx_state = PFM_CTX_ZOMBIE;
DPRINT(("zombie ctx for [%d]\n", task_pid_nr(task)));
/*
* cannot free the context on the spot. deferred until
* the task notices the ZOMBIE state
*/
free_possible = 0;
#else
pfm_context_unload(ctx, NULL, 0, regs);
#endif
}
doit:
/* reload state, may have changed during opening of critical section */
state = ctx->ctx_state;
/*
* the context is still attached to a task (possibly current)
* we cannot destroy it right now
*/
/*
* we must free the sampling buffer right here because
* we cannot rely on it being cleaned up later by the
* monitored task. It is not possible to free vmalloc'ed
* memory in pfm_load_regs(). Instead, we remove the buffer
* now. should there be subsequent PMU overflow originally
* meant for sampling, the will be converted to spurious
* and that's fine because the monitoring tools is gone anyway.
*/
if (ctx->ctx_smpl_hdr) {
smpl_buf_addr = ctx->ctx_smpl_hdr;
smpl_buf_size = ctx->ctx_smpl_size;
/* no more sampling */
ctx->ctx_smpl_hdr = NULL;
ctx->ctx_fl_is_sampling = 0;
}
DPRINT(("ctx_state=%d free_possible=%d addr=%p size=%lu\n",
state,
free_possible,
smpl_buf_addr,
smpl_buf_size));
if (smpl_buf_addr) pfm_exit_smpl_buffer(ctx->ctx_buf_fmt);
/*
* UNLOADED that the session has already been unreserved.
*/
if (state == PFM_CTX_ZOMBIE) {
pfm_unreserve_session(ctx, ctx->ctx_fl_system , ctx->ctx_cpu);
}
/*
* disconnect file descriptor from context must be done
* before we unlock.
*/
filp->private_data = NULL;
/*
* if we free on the spot, the context is now completely unreachable
* from the callers side. The monitored task side is also cut, so we
* can freely cut.
*
* If we have a deferred free, only the caller side is disconnected.
*/
UNPROTECT_CTX(ctx, flags);
/*
* All memory free operations (especially for vmalloc'ed memory)
* MUST be done with interrupts ENABLED.
*/
if (smpl_buf_addr) pfm_rvfree(smpl_buf_addr, smpl_buf_size);
/*
* return the memory used by the context
*/
if (free_possible) pfm_context_free(ctx);
return 0;
}
static int
pfm_no_open(struct inode *irrelevant, struct file *dontcare)
{
DPRINT(("pfm_no_open called\n"));
return -ENXIO;
}
static const struct file_operations pfm_file_ops = {
.llseek = no_llseek,
.read = pfm_read,
.write = pfm_write,
.poll = pfm_poll,
.unlocked_ioctl = pfm_ioctl,
.open = pfm_no_open, /* special open code to disallow open via /proc */
.fasync = pfm_fasync,
.release = pfm_close,
.flush = pfm_flush
};
static int
pfmfs_delete_dentry(const struct dentry *dentry)
{
return 1;
}
static char *pfmfs_dname(struct dentry *dentry, char *buffer, int buflen)
{
return dynamic_dname(dentry, buffer, buflen, "pfm:[%lu]",
dentry->d_inode->i_ino);
}
static const struct dentry_operations pfmfs_dentry_operations = {
.d_delete = pfmfs_delete_dentry,
.d_dname = pfmfs_dname,
};
static struct file *
pfm_alloc_file(pfm_context_t *ctx)
{
struct file *file;
struct inode *inode;
struct path path;
struct qstr this = { .name = "" };
/*
* allocate a new inode
*/
inode = new_inode(pfmfs_mnt->mnt_sb);
if (!inode)
return ERR_PTR(-ENOMEM);
DPRINT(("new inode ino=%ld @%p\n", inode->i_ino, inode));
inode->i_mode = S_IFCHR|S_IRUGO;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
/*
* allocate a new dcache entry
*/
path.dentry = d_alloc(pfmfs_mnt->mnt_root, &this);
if (!path.dentry) {
iput(inode);
return ERR_PTR(-ENOMEM);
}
path.mnt = mntget(pfmfs_mnt);
d_add(path.dentry, inode);
file = alloc_file(&path, FMODE_READ, &pfm_file_ops);
if (!file) {
path_put(&path);
return ERR_PTR(-ENFILE);
}
file->f_flags = O_RDONLY;
file->private_data = ctx;
return file;
}
static int
pfm_remap_buffer(struct vm_area_struct *vma, unsigned long buf, unsigned long addr, unsigned long size)
{
DPRINT(("CPU%d buf=0x%lx addr=0x%lx size=%ld\n", smp_processor_id(), buf, addr, size));
while (size > 0) {
unsigned long pfn = ia64_tpa(buf) >> PAGE_SHIFT;
if (remap_pfn_range(vma, addr, pfn, PAGE_SIZE, PAGE_READONLY))
return -ENOMEM;
addr += PAGE_SIZE;
buf += PAGE_SIZE;
size -= PAGE_SIZE;
}
return 0;
}
/*
* allocate a sampling buffer and remaps it into the user address space of the task
*/
static int
pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t *ctx, unsigned long rsize, void **user_vaddr)
{
struct mm_struct *mm = task->mm;
struct vm_area_struct *vma = NULL;
unsigned long size;
void *smpl_buf;
/*
* the fixed header + requested size and align to page boundary
*/
size = PAGE_ALIGN(rsize);
DPRINT(("sampling buffer rsize=%lu size=%lu bytes\n", rsize, size));
/*
* check requested size to avoid Denial-of-service attacks
* XXX: may have to refine this test
* Check against address space limit.
*
* if ((mm->total_vm << PAGE_SHIFT) + len> task->rlim[RLIMIT_AS].rlim_cur)
* return -ENOMEM;
*/
if (size > task_rlimit(task, RLIMIT_MEMLOCK))
return -ENOMEM;
/*
* We do the easy to undo allocations first.
*
* pfm_rvmalloc(), clears the buffer, so there is no leak
*/
smpl_buf = pfm_rvmalloc(size);
if (smpl_buf == NULL) {
DPRINT(("Can't allocate sampling buffer\n"));
return -ENOMEM;
}
DPRINT(("smpl_buf @%p\n", smpl_buf));
/* allocate vma */
vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
if (!vma) {
DPRINT(("Cannot allocate vma\n"));
goto error_kmem;
}
INIT_LIST_HEAD(&vma->anon_vma_chain);
/*
* partially initialize the vma for the sampling buffer
*/
vma->vm_mm = mm;
vma->vm_file = filp;
vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED;
vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */
/*
* Now we have everything we need and we can initialize
* and connect all the data structures
*/
ctx->ctx_smpl_hdr = smpl_buf;
ctx->ctx_smpl_size = size; /* aligned size */
/*
* Let's do the difficult operations next.
*
* now we atomically find some area in the address space and
* remap the buffer in it.
*/
down_write(&task->mm->mmap_sem);
/* find some free area in address space, must have mmap sem held */
vma->vm_start = pfm_get_unmapped_area(NULL, 0, size, 0, MAP_PRIVATE|MAP_ANONYMOUS, 0);
if (vma->vm_start == 0UL) {
DPRINT(("Cannot find unmapped area for size %ld\n", size));
up_write(&task->mm->mmap_sem);
goto error;
}
vma->vm_end = vma->vm_start + size;
vma->vm_pgoff = vma->vm_start >> PAGE_SHIFT;
DPRINT(("aligned size=%ld, hdr=%p mapped @0x%lx\n", size, ctx->ctx_smpl_hdr, vma->vm_start));
/* can only be applied to current task, need to have the mm semaphore held when called */
if (pfm_remap_buffer(vma, (unsigned long)smpl_buf, vma->vm_start, size)) {
DPRINT(("Can't remap buffer\n"));
up_write(&task->mm->mmap_sem);
goto error;
}
get_file(filp);
/*
* now insert the vma in the vm list for the process, must be
* done with mmap lock held
*/
insert_vm_struct(mm, vma);
mm->total_vm += size >> PAGE_SHIFT;
vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
vma_pages(vma));
up_write(&task->mm->mmap_sem);
/*
* keep track of user level virtual address
*/
ctx->ctx_smpl_vaddr = (void *)vma->vm_start;
*(unsigned long *)user_vaddr = vma->vm_start;
return 0;
error:
kmem_cache_free(vm_area_cachep, vma);
error_kmem:
pfm_rvfree(smpl_buf, size);
return -ENOMEM;
}
/*
* XXX: do something better here
*/
static int
pfm_bad_permissions(struct task_struct *task)
{
const struct cred *tcred;
uid_t uid = current_uid();
gid_t gid = current_gid();
int ret;
rcu_read_lock();
tcred = __task_cred(task);
/* inspired by ptrace_attach() */
DPRINT(("cur: uid=%d gid=%d task: euid=%d suid=%d uid=%d egid=%d sgid=%d\n",
uid,
gid,
tcred->euid,
tcred->suid,
tcred->uid,
tcred->egid,
tcred->sgid));
ret = ((uid != tcred->euid)
|| (uid != tcred->suid)
|| (uid != tcred->uid)
|| (gid != tcred->egid)
|| (gid != tcred->sgid)
|| (gid != tcred->gid)) && !capable(CAP_SYS_PTRACE);
rcu_read_unlock();
return ret;
}
static int
pfarg_is_sane(struct task_struct *task, pfarg_context_t *pfx)
{
int ctx_flags;
/* valid signal */
ctx_flags = pfx->ctx_flags;
if (ctx_flags & PFM_FL_SYSTEM_WIDE) {
/*
* cannot block in this mode
*/
if (ctx_flags & PFM_FL_NOTIFY_BLOCK) {
DPRINT(("cannot use blocking mode when in system wide monitoring\n"));
return -EINVAL;
}
} else {
}
/* probably more to add here */
return 0;
}
static int
pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t *ctx, unsigned int ctx_flags,
unsigned int cpu, pfarg_context_t *arg)
{
pfm_buffer_fmt_t *fmt = NULL;
unsigned long size = 0UL;
void *uaddr = NULL;
void *fmt_arg = NULL;
int ret = 0;
#define PFM_CTXARG_BUF_ARG(a) (pfm_buffer_fmt_t *)(a+1)
/* invoke and lock buffer format, if found */
fmt = pfm_find_buffer_fmt(arg->ctx_smpl_buf_id);
if (fmt == NULL) {
DPRINT(("[%d] cannot find buffer format\n", task_pid_nr(task)));
return -EINVAL;
}
/*
* buffer argument MUST be contiguous to pfarg_context_t
*/
if (fmt->fmt_arg_size) fmt_arg = PFM_CTXARG_BUF_ARG(arg);
ret = pfm_buf_fmt_validate(fmt, task, ctx_flags, cpu, fmt_arg);
DPRINT(("[%d] after validate(0x%x,%d,%p)=%d\n", task_pid_nr(task), ctx_flags, cpu, fmt_arg, ret));
if (ret) goto error;
/* link buffer format and context */
ctx->ctx_buf_fmt = fmt;
ctx->ctx_fl_is_sampling = 1; /* assume record() is defined */
/*
* check if buffer format wants to use perfmon buffer allocation/mapping service
*/
ret = pfm_buf_fmt_getsize(fmt, task, ctx_flags, cpu, fmt_arg, &size);
if (ret) goto error;
if (size) {
/*
* buffer is always remapped into the caller's address space
*/
ret = pfm_smpl_buffer_alloc(current, filp, ctx, size, &uaddr);
if (ret) goto error;
/* keep track of user address of buffer */
arg->ctx_smpl_vaddr = uaddr;
}
ret = pfm_buf_fmt_init(fmt, task, ctx->ctx_smpl_hdr, ctx_flags, cpu, fmt_arg);
error:
return ret;
}
static void
pfm_reset_pmu_state(pfm_context_t *ctx)
{
int i;
/*
* install reset values for PMC.
*/
for (i=1; PMC_IS_LAST(i) == 0; i++) {
if (PMC_IS_IMPL(i) == 0) continue;
ctx->ctx_pmcs[i] = PMC_DFL_VAL(i);
DPRINT(("pmc[%d]=0x%lx\n", i, ctx->ctx_pmcs[i]));
}
/*
* PMD registers are set to 0UL when the context in memset()
*/
/*
* On context switched restore, we must restore ALL pmc and ALL pmd even
* when they are not actively used by the task. In UP, the incoming process
* may otherwise pick up left over PMC, PMD state from the previous process.
* As opposed to PMD, stale PMC can cause harm to the incoming
* process because they may change what is being measured.
* Therefore, we must systematically reinstall the entire
* PMC state. In SMP, the same thing is possible on the
* same CPU but also on between 2 CPUs.
*
* The problem with PMD is information leaking especially
* to user level when psr.sp=0
*
* There is unfortunately no easy way to avoid this problem
* on either UP or SMP. This definitively slows down the
* pfm_load_regs() function.
*/
/*
* bitmask of all PMCs accessible to this context
*
* PMC0 is treated differently.
*/
ctx->ctx_all_pmcs[0] = pmu_conf->impl_pmcs[0] & ~0x1;
/*
* bitmask of all PMDs that are accessible to this context
*/
ctx->ctx_all_pmds[0] = pmu_conf->impl_pmds[0];
DPRINT(("<%d> all_pmcs=0x%lx all_pmds=0x%lx\n", ctx->ctx_fd, ctx->ctx_all_pmcs[0],ctx->ctx_all_pmds[0]));
/*
* useful in case of re-enable after disable
*/
ctx->ctx_used_ibrs[0] = 0UL;
ctx->ctx_used_dbrs[0] = 0UL;
}
static int
pfm_ctx_getsize(void *arg, size_t *sz)
{
pfarg_context_t *req = (pfarg_context_t *)arg;
pfm_buffer_fmt_t *fmt;
*sz = 0;
if (!pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) return 0;
fmt = pfm_find_buffer_fmt(req->ctx_smpl_buf_id);
if (fmt == NULL) {
DPRINT(("cannot find buffer format\n"));
return -EINVAL;
}
/* get just enough to copy in user parameters */
*sz = fmt->fmt_arg_size;
DPRINT(("arg_size=%lu\n", *sz));
return 0;
}
/*
* cannot attach if :
* - kernel task
* - task not owned by caller
* - task incompatible with context mode
*/
static int
pfm_task_incompatible(pfm_context_t *ctx, struct task_struct *task)
{
/*
* no kernel task or task not owner by caller
*/
if (task->mm == NULL) {
DPRINT(("task [%d] has not memory context (kernel thread)\n", task_pid_nr(task)));
return -EPERM;
}
if (pfm_bad_permissions(task)) {
DPRINT(("no permission to attach to [%d]\n", task_pid_nr(task)));
return -EPERM;
}
/*
* cannot block in self-monitoring mode
*/
if (CTX_OVFL_NOBLOCK(ctx) == 0 && task == current) {
DPRINT(("cannot load a blocking context on self for [%d]\n", task_pid_nr(task)));
return -EINVAL;
}
if (task->exit_state == EXIT_ZOMBIE) {
DPRINT(("cannot attach to zombie task [%d]\n", task_pid_nr(task)));
return -EBUSY;
}
/*
* always ok for self
*/
if (task == current) return 0;
if (!task_is_stopped_or_traced(task)) {
DPRINT(("cannot attach to non-stopped task [%d] state=%ld\n", task_pid_nr(task), task->state));
return -EBUSY;
}
/*
* make sure the task is off any CPU
*/
wait_task_inactive(task, 0);
/* more to come... */
return 0;
}
static int
pfm_get_task(pfm_context_t *ctx, pid_t pid, struct task_struct **task)
{
struct task_struct *p = current;
int ret;
/* XXX: need to add more checks here */
if (pid < 2) return -EPERM;
if (pid != task_pid_vnr(current)) {
read_lock(&tasklist_lock);
p = find_task_by_vpid(pid);
/* make sure task cannot go away while we operate on it */
if (p) get_task_struct(p);
read_unlock(&tasklist_lock);
if (p == NULL) return -ESRCH;
}
ret = pfm_task_incompatible(ctx, p);
if (ret == 0) {
*task = p;
} else if (p != current) {
pfm_put_task(p);
}
return ret;
}
static int
pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
pfarg_context_t *req = (pfarg_context_t *)arg;
struct file *filp;
struct path path;
int ctx_flags;
int fd;
int ret;
/* let's check the arguments first */
ret = pfarg_is_sane(current, req);
if (ret < 0)
return ret;
ctx_flags = req->ctx_flags;
ret = -ENOMEM;
fd = get_unused_fd();
if (fd < 0)
return fd;
ctx = pfm_context_alloc(ctx_flags);
if (!ctx)
goto error;
filp = pfm_alloc_file(ctx);
if (IS_ERR(filp)) {
ret = PTR_ERR(filp);
goto error_file;
}
req->ctx_fd = ctx->ctx_fd = fd;
/*
* does the user want to sample?
*/
if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) {
ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req);
if (ret)
goto buffer_error;
}
DPRINT(("ctx=%p flags=0x%x system=%d notify_block=%d excl_idle=%d no_msg=%d ctx_fd=%d\n",
ctx,
ctx_flags,
ctx->ctx_fl_system,
ctx->ctx_fl_block,
ctx->ctx_fl_excl_idle,
ctx->ctx_fl_no_msg,
ctx->ctx_fd));
/*
* initialize soft PMU state
*/
pfm_reset_pmu_state(ctx);
fd_install(fd, filp);
return 0;
buffer_error:
path = filp->f_path;
put_filp(filp);
path_put(&path);
if (ctx->ctx_buf_fmt) {
pfm_buf_fmt_exit(ctx->ctx_buf_fmt, current, NULL, regs);
}
error_file:
pfm_context_free(ctx);
error:
put_unused_fd(fd);
return ret;
}
static inline unsigned long
pfm_new_counter_value (pfm_counter_t *reg, int is_long_reset)
{
unsigned long val = is_long_reset ? reg->long_reset : reg->short_reset;
unsigned long new_seed, old_seed = reg->seed, mask = reg->mask;
extern unsigned long carta_random32 (unsigned long seed);
if (reg->flags & PFM_REGFL_RANDOM) {
new_seed = carta_random32(old_seed);
val -= (old_seed & mask); /* counter values are negative numbers! */
if ((mask >> 32) != 0)
/* construct a full 64-bit random value: */
new_seed |= carta_random32(old_seed >> 32) << 32;
reg->seed = new_seed;
}
reg->lval = val;
return val;
}
static void
pfm_reset_regs_masked(pfm_context_t *ctx, unsigned long *ovfl_regs, int is_long_reset)
{
unsigned long mask = ovfl_regs[0];
unsigned long reset_others = 0UL;
unsigned long val;
int i;
/*
* now restore reset value on sampling overflowed counters
*/
mask >>= PMU_FIRST_COUNTER;
for(i = PMU_FIRST_COUNTER; mask; i++, mask >>= 1) {
if ((mask & 0x1UL) == 0UL) continue;
ctx->ctx_pmds[i].val = val = pfm_new_counter_value(ctx->ctx_pmds+ i, is_long_reset);
reset_others |= ctx->ctx_pmds[i].reset_pmds[0];
DPRINT_ovfl((" %s reset ctx_pmds[%d]=%lx\n", is_long_reset ? "long" : "short", i, val));
}
/*
* Now take care of resetting the other registers
*/
for(i = 0; reset_others; i++, reset_others >>= 1) {
if ((reset_others & 0x1) == 0) continue;
ctx->ctx_pmds[i].val = val = pfm_new_counter_value(ctx->ctx_pmds + i, is_long_reset);
DPRINT_ovfl(("%s reset_others pmd[%d]=%lx\n",
is_long_reset ? "long" : "short", i, val));
}
}
static void
pfm_reset_regs(pfm_context_t *ctx, unsigned long *ovfl_regs, int is_long_reset)
{
unsigned long mask = ovfl_regs[0];
unsigned long reset_others = 0UL;
unsigned long val;
int i;
DPRINT_ovfl(("ovfl_regs=0x%lx is_long_reset=%d\n", ovfl_regs[0], is_long_reset));
if (ctx->ctx_state == PFM_CTX_MASKED) {
pfm_reset_regs_masked(ctx, ovfl_regs, is_long_reset);
return;
}
/*
* now restore reset value on sampling overflowed counters
*/
mask >>= PMU_FIRST_COUNTER;
for(i = PMU_FIRST_COUNTER; mask; i++, mask >>= 1) {
if ((mask & 0x1UL) == 0UL) continue;
val = pfm_new_counter_value(ctx->ctx_pmds+ i, is_long_reset);
reset_others |= ctx->ctx_pmds[i].reset_pmds[0];
DPRINT_ovfl((" %s reset ctx_pmds[%d]=%lx\n", is_long_reset ? "long" : "short", i, val));
pfm_write_soft_counter(ctx, i, val);
}
/*
* Now take care of resetting the other registers
*/
for(i = 0; reset_others; i++, reset_others >>= 1) {
if ((reset_others & 0x1) == 0) continue;
val = pfm_new_counter_value(ctx->ctx_pmds + i, is_long_reset);
if (PMD_IS_COUNTING(i)) {
pfm_write_soft_counter(ctx, i, val);
} else {
ia64_set_pmd(i, val);
}
DPRINT_ovfl(("%s reset_others pmd[%d]=%lx\n",
is_long_reset ? "long" : "short", i, val));
}
ia64_srlz_d();
}
static int
pfm_write_pmcs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned long value, pmc_pm;
unsigned long smpl_pmds, reset_pmds, impl_pmds;
unsigned int cnum, reg_flags, flags, pmc_type;
int i, can_access_pmu = 0, is_loaded, is_system, expert_mode;
int is_monitor, is_counting, state;
int ret = -EINVAL;
pfm_reg_check_t wr_func;
#define PFM_CHECK_PMC_PM(x, y, z) ((x)->ctx_fl_system ^ PMC_PM(y, z))
state = ctx->ctx_state;
is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
is_system = ctx->ctx_fl_system;
task = ctx->ctx_task;
impl_pmds = pmu_conf->impl_pmds[0];
if (state == PFM_CTX_ZOMBIE) return -EINVAL;
if (is_loaded) {
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (is_system && ctx->ctx_cpu != smp_processor_id()) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
}
expert_mode = pfm_sysctl.expert_mode;
for (i = 0; i < count; i++, req++) {
cnum = req->reg_num;
reg_flags = req->reg_flags;
value = req->reg_value;
smpl_pmds = req->reg_smpl_pmds[0];
reset_pmds = req->reg_reset_pmds[0];
flags = 0;
if (cnum >= PMU_MAX_PMCS) {
DPRINT(("pmc%u is invalid\n", cnum));
goto error;
}
pmc_type = pmu_conf->pmc_desc[cnum].type;
pmc_pm = (value >> pmu_conf->pmc_desc[cnum].pm_pos) & 0x1;
is_counting = (pmc_type & PFM_REG_COUNTING) == PFM_REG_COUNTING ? 1 : 0;
is_monitor = (pmc_type & PFM_REG_MONITOR) == PFM_REG_MONITOR ? 1 : 0;
/*
* we reject all non implemented PMC as well
* as attempts to modify PMC[0-3] which are used
* as status registers by the PMU
*/
if ((pmc_type & PFM_REG_IMPL) == 0 || (pmc_type & PFM_REG_CONTROL) == PFM_REG_CONTROL) {
DPRINT(("pmc%u is unimplemented or no-access pmc_type=%x\n", cnum, pmc_type));
goto error;
}
wr_func = pmu_conf->pmc_desc[cnum].write_check;
/*
* If the PMC is a monitor, then if the value is not the default:
* - system-wide session: PMCx.pm=1 (privileged monitor)
* - per-task : PMCx.pm=0 (user monitor)
*/
if (is_monitor && value != PMC_DFL_VAL(cnum) && is_system ^ pmc_pm) {
DPRINT(("pmc%u pmc_pm=%lu is_system=%d\n",
cnum,
pmc_pm,
is_system));
goto error;
}
if (is_counting) {
/*
* enforce generation of overflow interrupt. Necessary on all
* CPUs.
*/
value |= 1 << PMU_PMC_OI;
if (reg_flags & PFM_REGFL_OVFL_NOTIFY) {
flags |= PFM_REGFL_OVFL_NOTIFY;
}
if (reg_flags & PFM_REGFL_RANDOM) flags |= PFM_REGFL_RANDOM;
/* verify validity of smpl_pmds */
if ((smpl_pmds & impl_pmds) != smpl_pmds) {
DPRINT(("invalid smpl_pmds 0x%lx for pmc%u\n", smpl_pmds, cnum));
goto error;
}
/* verify validity of reset_pmds */
if ((reset_pmds & impl_pmds) != reset_pmds) {
DPRINT(("invalid reset_pmds 0x%lx for pmc%u\n", reset_pmds, cnum));
goto error;
}
} else {
if (reg_flags & (PFM_REGFL_OVFL_NOTIFY|PFM_REGFL_RANDOM)) {
DPRINT(("cannot set ovfl_notify or random on pmc%u\n", cnum));
goto error;
}
/* eventid on non-counting monitors are ignored */
}
/*
* execute write checker, if any
*/
if (likely(expert_mode == 0 && wr_func)) {
ret = (*wr_func)(task, ctx, cnum, &value, regs);
if (ret) goto error;
ret = -EINVAL;
}
/*
* no error on this register
*/
PFM_REG_RETFLAG_SET(req->reg_flags, 0);
/*
* Now we commit the changes to the software state
*/
/*
* update overflow information
*/
if (is_counting) {
/*
* full flag update each time a register is programmed
*/
ctx->ctx_pmds[cnum].flags = flags;
ctx->ctx_pmds[cnum].reset_pmds[0] = reset_pmds;
ctx->ctx_pmds[cnum].smpl_pmds[0] = smpl_pmds;
ctx->ctx_pmds[cnum].eventid = req->reg_smpl_eventid;
/*
* Mark all PMDS to be accessed as used.
*
* We do not keep track of PMC because we have to
* systematically restore ALL of them.
*
* We do not update the used_monitors mask, because
* if we have not programmed them, then will be in
* a quiescent state, therefore we will not need to
* mask/restore then when context is MASKED.
*/
CTX_USED_PMD(ctx, reset_pmds);
CTX_USED_PMD(ctx, smpl_pmds);
/*
* make sure we do not try to reset on
* restart because we have established new values
*/
if (state == PFM_CTX_MASKED) ctx->ctx_ovfl_regs[0] &= ~1UL << cnum;
}
/*
* Needed in case the user does not initialize the equivalent
* PMD. Clearing is done indirectly via pfm_reset_pmu_state() so there is no
* possible leak here.
*/
CTX_USED_PMD(ctx, pmu_conf->pmc_desc[cnum].dep_pmd[0]);
/*
* keep track of the monitor PMC that we are using.
* we save the value of the pmc in ctx_pmcs[] and if
* the monitoring is not stopped for the context we also
* place it in the saved state area so that it will be
* picked up later by the context switch code.
*
* The value in ctx_pmcs[] can only be changed in pfm_write_pmcs().
*
* The value in th_pmcs[] may be modified on overflow, i.e., when
* monitoring needs to be stopped.
*/
if (is_monitor) CTX_USED_MONITOR(ctx, 1UL << cnum);
/*
* update context state
*/
ctx->ctx_pmcs[cnum] = value;
if (is_loaded) {
/*
* write thread state
*/
if (is_system == 0) ctx->th_pmcs[cnum] = value;
/*
* write hardware register if we can
*/
if (can_access_pmu) {
ia64_set_pmc(cnum, value);
}
#ifdef CONFIG_SMP
else {
/*
* per-task SMP only here
*
* we are guaranteed that the task is not running on the other CPU,
* we indicate that this PMD will need to be reloaded if the task
* is rescheduled on the CPU it ran last on.
*/
ctx->ctx_reload_pmcs[0] |= 1UL << cnum;
}
#endif
}
DPRINT(("pmc[%u]=0x%lx ld=%d apmu=%d flags=0x%x all_pmcs=0x%lx used_pmds=0x%lx eventid=%ld smpl_pmds=0x%lx reset_pmds=0x%lx reloads_pmcs=0x%lx used_monitors=0x%lx ovfl_regs=0x%lx\n",
cnum,
value,
is_loaded,
can_access_pmu,
flags,
ctx->ctx_all_pmcs[0],
ctx->ctx_used_pmds[0],
ctx->ctx_pmds[cnum].eventid,
smpl_pmds,
reset_pmds,
ctx->ctx_reload_pmcs[0],
ctx->ctx_used_monitors[0],
ctx->ctx_ovfl_regs[0]));
}
/*
* make sure the changes are visible
*/
if (can_access_pmu) ia64_srlz_d();
return 0;
error:
PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
return ret;
}
static int
pfm_write_pmds(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned long value, hw_value, ovfl_mask;
unsigned int cnum;
int i, can_access_pmu = 0, state;
int is_counting, is_loaded, is_system, expert_mode;
int ret = -EINVAL;
pfm_reg_check_t wr_func;
state = ctx->ctx_state;
is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
is_system = ctx->ctx_fl_system;
ovfl_mask = pmu_conf->ovfl_val;
task = ctx->ctx_task;
if (unlikely(state == PFM_CTX_ZOMBIE)) return -EINVAL;
/*
* on both UP and SMP, we can only write to the PMC when the task is
* the owner of the local PMU.
*/
if (likely(is_loaded)) {
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (unlikely(is_system && ctx->ctx_cpu != smp_processor_id())) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
}
expert_mode = pfm_sysctl.expert_mode;
for (i = 0; i < count; i++, req++) {
cnum = req->reg_num;
value = req->reg_value;
if (!PMD_IS_IMPL(cnum)) {
DPRINT(("pmd[%u] is unimplemented or invalid\n", cnum));
goto abort_mission;
}
is_counting = PMD_IS_COUNTING(cnum);
wr_func = pmu_conf->pmd_desc[cnum].write_check;
/*
* execute write checker, if any
*/
if (unlikely(expert_mode == 0 && wr_func)) {
unsigned long v = value;
ret = (*wr_func)(task, ctx, cnum, &v, regs);
if (ret) goto abort_mission;
value = v;
ret = -EINVAL;
}
/*
* no error on this register
*/
PFM_REG_RETFLAG_SET(req->reg_flags, 0);
/*
* now commit changes to software state
*/
hw_value = value;
/*
* update virtualized (64bits) counter
*/
if (is_counting) {
/*
* write context state
*/
ctx->ctx_pmds[cnum].lval = value;
/*
* when context is load we use the split value
*/
if (is_loaded) {
hw_value = value & ovfl_mask;
value = value & ~ovfl_mask;
}
}
/*
* update reset values (not just for counters)
*/
ctx->ctx_pmds[cnum].long_reset = req->reg_long_reset;
ctx->ctx_pmds[cnum].short_reset = req->reg_short_reset;
/*
* update randomization parameters (not just for counters)
*/
ctx->ctx_pmds[cnum].seed = req->reg_random_seed;
ctx->ctx_pmds[cnum].mask = req->reg_random_mask;
/*
* update context value
*/
ctx->ctx_pmds[cnum].val = value;
/*
* Keep track of what we use
*
* We do not keep track of PMC because we have to
* systematically restore ALL of them.
*/
CTX_USED_PMD(ctx, PMD_PMD_DEP(cnum));
/*
* mark this PMD register used as well
*/
CTX_USED_PMD(ctx, RDEP(cnum));
/*
* make sure we do not try to reset on
* restart because we have established new values
*/
if (is_counting && state == PFM_CTX_MASKED) {
ctx->ctx_ovfl_regs[0] &= ~1UL << cnum;
}
if (is_loaded) {
/*
* write thread state
*/
if (is_system == 0) ctx->th_pmds[cnum] = hw_value;
/*
* write hardware register if we can
*/
if (can_access_pmu) {
ia64_set_pmd(cnum, hw_value);
} else {
#ifdef CONFIG_SMP
/*
* we are guaranteed that the task is not running on the other CPU,
* we indicate that this PMD will need to be reloaded if the task
* is rescheduled on the CPU it ran last on.
*/
ctx->ctx_reload_pmds[0] |= 1UL << cnum;
#endif
}
}
DPRINT(("pmd[%u]=0x%lx ld=%d apmu=%d, hw_value=0x%lx ctx_pmd=0x%lx short_reset=0x%lx "
"long_reset=0x%lx notify=%c seed=0x%lx mask=0x%lx used_pmds=0x%lx reset_pmds=0x%lx reload_pmds=0x%lx all_pmds=0x%lx ovfl_regs=0x%lx\n",
cnum,
value,
is_loaded,
can_access_pmu,
hw_value,
ctx->ctx_pmds[cnum].val,
ctx->ctx_pmds[cnum].short_reset,
ctx->ctx_pmds[cnum].long_reset,
PMC_OVFL_NOTIFY(ctx, cnum) ? 'Y':'N',
ctx->ctx_pmds[cnum].seed,
ctx->ctx_pmds[cnum].mask,
ctx->ctx_used_pmds[0],
ctx->ctx_pmds[cnum].reset_pmds[0],
ctx->ctx_reload_pmds[0],
ctx->ctx_all_pmds[0],
ctx->ctx_ovfl_regs[0]));
}
/*
* make changes visible
*/
if (can_access_pmu) ia64_srlz_d();
return 0;
abort_mission:
/*
* for now, we have only one possibility for error
*/
PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
return ret;
}
/*
* By the way of PROTECT_CONTEXT(), interrupts are masked while we are in this function.
* Therefore we know, we do not have to worry about the PMU overflow interrupt. If an
* interrupt is delivered during the call, it will be kept pending until we leave, making
* it appears as if it had been generated at the UNPROTECT_CONTEXT(). At least we are
* guaranteed to return consistent data to the user, it may simply be old. It is not
* trivial to treat the overflow while inside the call because you may end up in
* some module sampling buffer code causing deadlocks.
*/
static int
pfm_read_pmds(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
unsigned long val = 0UL, lval, ovfl_mask, sval;
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned int cnum, reg_flags = 0;
int i, can_access_pmu = 0, state;
int is_loaded, is_system, is_counting, expert_mode;
int ret = -EINVAL;
pfm_reg_check_t rd_func;
/*
* access is possible when loaded only for
* self-monitoring tasks or in UP mode
*/
state = ctx->ctx_state;
is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
is_system = ctx->ctx_fl_system;
ovfl_mask = pmu_conf->ovfl_val;
task = ctx->ctx_task;
if (state == PFM_CTX_ZOMBIE) return -EINVAL;
if (likely(is_loaded)) {
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (unlikely(is_system && ctx->ctx_cpu != smp_processor_id())) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
/*
* this can be true when not self-monitoring only in UP
*/
can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
if (can_access_pmu) ia64_srlz_d();
}
expert_mode = pfm_sysctl.expert_mode;
DPRINT(("ld=%d apmu=%d ctx_state=%d\n",
is_loaded,
can_access_pmu,
state));
/*
* on both UP and SMP, we can only read the PMD from the hardware register when
* the task is the owner of the local PMU.
*/
for (i = 0; i < count; i++, req++) {
cnum = req->reg_num;
reg_flags = req->reg_flags;
if (unlikely(!PMD_IS_IMPL(cnum))) goto error;
/*
* we can only read the register that we use. That includes
* the one we explicitly initialize AND the one we want included
* in the sampling buffer (smpl_regs).
*
* Having this restriction allows optimization in the ctxsw routine
* without compromising security (leaks)
*/
if (unlikely(!CTX_IS_USED_PMD(ctx, cnum))) goto error;
sval = ctx->ctx_pmds[cnum].val;
lval = ctx->ctx_pmds[cnum].lval;
is_counting = PMD_IS_COUNTING(cnum);
/*
* If the task is not the current one, then we check if the
* PMU state is still in the local live register due to lazy ctxsw.
* If true, then we read directly from the registers.
*/
if (can_access_pmu){
val = ia64_get_pmd(cnum);
} else {
/*
* context has been saved
* if context is zombie, then task does not exist anymore.
* In this case, we use the full value saved in the context (pfm_flush_regs()).
*/
val = is_loaded ? ctx->th_pmds[cnum] : 0UL;
}
rd_func = pmu_conf->pmd_desc[cnum].read_check;
if (is_counting) {
/*
* XXX: need to check for overflow when loaded
*/
val &= ovfl_mask;
val += sval;
}
/*
* execute read checker, if any
*/
if (unlikely(expert_mode == 0 && rd_func)) {
unsigned long v = val;
ret = (*rd_func)(ctx->ctx_task, ctx, cnum, &v, regs);
if (ret) goto error;
val = v;
ret = -EINVAL;
}
PFM_REG_RETFLAG_SET(reg_flags, 0);
DPRINT(("pmd[%u]=0x%lx\n", cnum, val));
/*
* update register return value, abort all if problem during copy.
* we only modify the reg_flags field. no check mode is fine because
* access has been verified upfront in sys_perfmonctl().
*/
req->reg_value = val;
req->reg_flags = reg_flags;
req->reg_last_reset_val = lval;
}
return 0;
error:
PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
return ret;
}
int
pfm_mod_write_pmcs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
return pfm_write_pmcs(ctx, req, nreq, regs);
}
EXPORT_SYMBOL(pfm_mod_write_pmcs);
int
pfm_mod_read_pmds(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
return pfm_read_pmds(ctx, req, nreq, regs);
}
EXPORT_SYMBOL(pfm_mod_read_pmds);
/*
* Only call this function when a process it trying to
* write the debug registers (reading is always allowed)
*/
int
pfm_use_debug_registers(struct task_struct *task)
{
pfm_context_t *ctx = task->thread.pfm_context;
unsigned long flags;
int ret = 0;
if (pmu_conf->use_rr_dbregs == 0) return 0;
DPRINT(("called for [%d]\n", task_pid_nr(task)));
/*
* do it only once
*/
if (task->thread.flags & IA64_THREAD_DBG_VALID) return 0;
/*
* Even on SMP, we do not need to use an atomic here because
* the only way in is via ptrace() and this is possible only when the
* process is stopped. Even in the case where the ctxsw out is not totally
* completed by the time we come here, there is no way the 'stopped' process
* could be in the middle of fiddling with the pfm_write_ibr_dbr() routine.
* So this is always safe.
*/
if (ctx && ctx->ctx_fl_using_dbreg == 1) return -1;
LOCK_PFS(flags);
/*
* We cannot allow setting breakpoints when system wide monitoring
* sessions are using the debug registers.
*/
if (pfm_sessions.pfs_sys_use_dbregs> 0)
ret = -1;
else
pfm_sessions.pfs_ptrace_use_dbregs++;
DPRINT(("ptrace_use_dbregs=%u sys_use_dbregs=%u by [%d] ret = %d\n",
pfm_sessions.pfs_ptrace_use_dbregs,
pfm_sessions.pfs_sys_use_dbregs,
task_pid_nr(task), ret));
UNLOCK_PFS(flags);
return ret;
}
/*
* This function is called for every task that exits with the
* IA64_THREAD_DBG_VALID set. This indicates a task which was
* able to use the debug registers for debugging purposes via
* ptrace(). Therefore we know it was not using them for
* performance monitoring, so we only decrement the number
* of "ptraced" debug register users to keep the count up to date
*/
int
pfm_release_debug_registers(struct task_struct *task)
{
unsigned long flags;
int ret;
if (pmu_conf->use_rr_dbregs == 0) return 0;
LOCK_PFS(flags);
if (pfm_sessions.pfs_ptrace_use_dbregs == 0) {
printk(KERN_ERR "perfmon: invalid release for [%d] ptrace_use_dbregs=0\n", task_pid_nr(task));
ret = -1;
} else {
pfm_sessions.pfs_ptrace_use_dbregs--;
ret = 0;
}
UNLOCK_PFS(flags);
return ret;
}
static int
pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
pfm_buffer_fmt_t *fmt;
pfm_ovfl_ctrl_t rst_ctrl;
int state, is_system;
int ret = 0;
state = ctx->ctx_state;
fmt = ctx->ctx_buf_fmt;
is_system = ctx->ctx_fl_system;
task = PFM_CTX_TASK(ctx);
switch(state) {
case PFM_CTX_MASKED:
break;
case PFM_CTX_LOADED:
if (CTX_HAS_SMPL(ctx) && fmt->fmt_restart_active) break;
/* fall through */
case PFM_CTX_UNLOADED:
case PFM_CTX_ZOMBIE:
DPRINT(("invalid state=%d\n", state));
return -EBUSY;
default:
DPRINT(("state=%d, cannot operate (no active_restart handler)\n", state));
return -EINVAL;
}
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (is_system && ctx->ctx_cpu != smp_processor_id()) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
/* sanity check */
if (unlikely(task == NULL)) {
printk(KERN_ERR "perfmon: [%d] pfm_restart no task\n", task_pid_nr(current));
return -EINVAL;
}
if (task == current || is_system) {
fmt = ctx->ctx_buf_fmt;
DPRINT(("restarting self %d ovfl=0x%lx\n",
task_pid_nr(task),
ctx->ctx_ovfl_regs[0]));
if (CTX_HAS_SMPL(ctx)) {
prefetch(ctx->ctx_smpl_hdr);
rst_ctrl.bits.mask_monitoring = 0;
rst_ctrl.bits.reset_ovfl_pmds = 0;
if (state == PFM_CTX_LOADED)
ret = pfm_buf_fmt_restart_active(fmt, task, &rst_ctrl, ctx->ctx_smpl_hdr, regs);
else
ret = pfm_buf_fmt_restart(fmt, task, &rst_ctrl, ctx->ctx_smpl_hdr, regs);
} else {
rst_ctrl.bits.mask_monitoring = 0;
rst_ctrl.bits.reset_ovfl_pmds = 1;
}
if (ret == 0) {
if (rst_ctrl.bits.reset_ovfl_pmds)
pfm_reset_regs(ctx, ctx->ctx_ovfl_regs, PFM_PMD_LONG_RESET);
if (rst_ctrl.bits.mask_monitoring == 0) {
DPRINT(("resuming monitoring for [%d]\n", task_pid_nr(task)));
if (state == PFM_CTX_MASKED) pfm_restore_monitoring(task);
} else {
DPRINT(("keeping monitoring stopped for [%d]\n", task_pid_nr(task)));
// cannot use pfm_stop_monitoring(task, regs);
}
}
/*
* clear overflowed PMD mask to remove any stale information
*/
ctx->ctx_ovfl_regs[0] = 0UL;
/*
* back to LOADED state
*/
ctx->ctx_state = PFM_CTX_LOADED;
/*
* XXX: not really useful for self monitoring
*/
ctx->ctx_fl_can_restart = 0;
return 0;
}
/*
* restart another task
*/
/*
* When PFM_CTX_MASKED, we cannot issue a restart before the previous
* one is seen by the task.
*/
if (state == PFM_CTX_MASKED) {
if (ctx->ctx_fl_can_restart == 0) return -EINVAL;
/*
* will prevent subsequent restart before this one is
* seen by other task
*/
ctx->ctx_fl_can_restart = 0;
}
/*
* if blocking, then post the semaphore is PFM_CTX_MASKED, i.e.
* the task is blocked or on its way to block. That's the normal
* restart path. If the monitoring is not masked, then the task
* can be actively monitoring and we cannot directly intervene.
* Therefore we use the trap mechanism to catch the task and
* force it to reset the buffer/reset PMDs.
*
* if non-blocking, then we ensure that the task will go into
* pfm_handle_work() before returning to user mode.
*
* We cannot explicitly reset another task, it MUST always
* be done by the task itself. This works for system wide because
* the tool that is controlling the session is logically doing
* "self-monitoring".
*/
if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
DPRINT(("unblocking [%d]\n", task_pid_nr(task)));
complete(&ctx->ctx_restart_done);
} else {
DPRINT(("[%d] armed exit trap\n", task_pid_nr(task)));
ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_RESET;
PFM_SET_WORK_PENDING(task, 1);
set_notify_resume(task);
/*
* XXX: send reschedule if task runs on another CPU
*/
}
return 0;
}
static int
pfm_debug(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
unsigned int m = *(unsigned int *)arg;
pfm_sysctl.debug = m == 0 ? 0 : 1;
printk(KERN_INFO "perfmon debugging %s (timing reset)\n", pfm_sysctl.debug ? "on" : "off");
if (m == 0) {
memset(pfm_stats, 0, sizeof(pfm_stats));
for(m=0; m < NR_CPUS; m++) pfm_stats[m].pfm_ovfl_intr_cycles_min = ~0UL;
}
return 0;
}
/*
* arg can be NULL and count can be zero for this function
*/
static int
pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct thread_struct *thread = NULL;
struct task_struct *task;
pfarg_dbreg_t *req = (pfarg_dbreg_t *)arg;
unsigned long flags;
dbreg_t dbreg;
unsigned int rnum;
int first_time;
int ret = 0, state;
int i, can_access_pmu = 0;
int is_system, is_loaded;
if (pmu_conf->use_rr_dbregs == 0) return -EINVAL;
state = ctx->ctx_state;
is_loaded = state == PFM_CTX_LOADED ? 1 : 0;
is_system = ctx->ctx_fl_system;
task = ctx->ctx_task;
if (state == PFM_CTX_ZOMBIE) return -EINVAL;
/*
* on both UP and SMP, we can only write to the PMC when the task is
* the owner of the local PMU.
*/
if (is_loaded) {
thread = &task->thread;
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (unlikely(is_system && ctx->ctx_cpu != smp_processor_id())) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
can_access_pmu = GET_PMU_OWNER() == task || is_system ? 1 : 0;
}
/*
* we do not need to check for ipsr.db because we do clear ibr.x, dbr.r, and dbr.w
* ensuring that no real breakpoint can be installed via this call.
*
* IMPORTANT: regs can be NULL in this function
*/
first_time = ctx->ctx_fl_using_dbreg == 0;
/*
* don't bother if we are loaded and task is being debugged
*/
if (is_loaded && (thread->flags & IA64_THREAD_DBG_VALID) != 0) {
DPRINT(("debug registers already in use for [%d]\n", task_pid_nr(task)));
return -EBUSY;
}
/*
* check for debug registers in system wide mode
*
* If though a check is done in pfm_context_load(),
* we must repeat it here, in case the registers are
* written after the context is loaded
*/
if (is_loaded) {
LOCK_PFS(flags);
if (first_time && is_system) {
if (pfm_sessions.pfs_ptrace_use_dbregs)
ret = -EBUSY;
else
pfm_sessions.pfs_sys_use_dbregs++;
}
UNLOCK_PFS(flags);
}
if (ret != 0) return ret;
/*
* mark ourself as user of the debug registers for
* perfmon purposes.
*/
ctx->ctx_fl_using_dbreg = 1;
/*
* clear hardware registers to make sure we don't
* pick up stale state.
*
* for a system wide session, we do not use
* thread.dbr, thread.ibr because this process
* never leaves the current CPU and the state
* is shared by all processes running on it
*/
if (first_time && can_access_pmu) {
DPRINT(("[%d] clearing ibrs, dbrs\n", task_pid_nr(task)));
for (i=0; i < pmu_conf->num_ibrs; i++) {
ia64_set_ibr(i, 0UL);
ia64_dv_serialize_instruction();
}
ia64_srlz_i();
for (i=0; i < pmu_conf->num_dbrs; i++) {
ia64_set_dbr(i, 0UL);
ia64_dv_serialize_data();
}
ia64_srlz_d();
}
/*
* Now install the values into the registers
*/
for (i = 0; i < count; i++, req++) {
rnum = req->dbreg_num;
dbreg.val = req->dbreg_value;
ret = -EINVAL;
if ((mode == PFM_CODE_RR && rnum >= PFM_NUM_IBRS) || ((mode == PFM_DATA_RR) && rnum >= PFM_NUM_DBRS)) {
DPRINT(("invalid register %u val=0x%lx mode=%d i=%d count=%d\n",
rnum, dbreg.val, mode, i, count));
goto abort_mission;
}
/*
* make sure we do not install enabled breakpoint
*/
if (rnum & 0x1) {
if (mode == PFM_CODE_RR)
dbreg.ibr.ibr_x = 0;
else
dbreg.dbr.dbr_r = dbreg.dbr.dbr_w = 0;
}
PFM_REG_RETFLAG_SET(req->dbreg_flags, 0);
/*
* Debug registers, just like PMC, can only be modified
* by a kernel call. Moreover, perfmon() access to those
* registers are centralized in this routine. The hardware
* does not modify the value of these registers, therefore,
* if we save them as they are written, we can avoid having
* to save them on context switch out. This is made possible
* by the fact that when perfmon uses debug registers, ptrace()
* won't be able to modify them concurrently.
*/
if (mode == PFM_CODE_RR) {
CTX_USED_IBR(ctx, rnum);
if (can_access_pmu) {
ia64_set_ibr(rnum, dbreg.val);
ia64_dv_serialize_instruction();
}
ctx->ctx_ibrs[rnum] = dbreg.val;
DPRINT(("write ibr%u=0x%lx used_ibrs=0x%x ld=%d apmu=%d\n",
rnum, dbreg.val, ctx->ctx_used_ibrs[0], is_loaded, can_access_pmu));
} else {
CTX_USED_DBR(ctx, rnum);
if (can_access_pmu) {
ia64_set_dbr(rnum, dbreg.val);
ia64_dv_serialize_data();
}
ctx->ctx_dbrs[rnum] = dbreg.val;
DPRINT(("write dbr%u=0x%lx used_dbrs=0x%x ld=%d apmu=%d\n",
rnum, dbreg.val, ctx->ctx_used_dbrs[0], is_loaded, can_access_pmu));
}
}
return 0;
abort_mission:
/*
* in case it was our first attempt, we undo the global modifications
*/
if (first_time) {
LOCK_PFS(flags);
if (ctx->ctx_fl_system) {
pfm_sessions.pfs_sys_use_dbregs--;
}
UNLOCK_PFS(flags);
ctx->ctx_fl_using_dbreg = 0;
}
/*
* install error return flag
*/
PFM_REG_RETFLAG_SET(req->dbreg_flags, PFM_REG_RETFL_EINVAL);
return ret;
}
static int
pfm_write_ibrs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
return pfm_write_ibr_dbr(PFM_CODE_RR, ctx, arg, count, regs);
}
static int
pfm_write_dbrs(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
return pfm_write_ibr_dbr(PFM_DATA_RR, ctx, arg, count, regs);
}
int
pfm_mod_write_ibrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
return pfm_write_ibrs(ctx, req, nreq, regs);
}
EXPORT_SYMBOL(pfm_mod_write_ibrs);
int
pfm_mod_write_dbrs(struct task_struct *task, void *req, unsigned int nreq, struct pt_regs *regs)
{
pfm_context_t *ctx;
if (req == NULL) return -EINVAL;
ctx = GET_PMU_CTX();
if (ctx == NULL) return -EINVAL;
/*
* for now limit to current task, which is enough when calling
* from overflow handler
*/
if (task != current && ctx->ctx_fl_system == 0) return -EBUSY;
return pfm_write_dbrs(ctx, req, nreq, regs);
}
EXPORT_SYMBOL(pfm_mod_write_dbrs);
static int
pfm_get_features(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
pfarg_features_t *req = (pfarg_features_t *)arg;
req->ft_version = PFM_VERSION;
return 0;
}
static int
pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct pt_regs *tregs;
struct task_struct *task = PFM_CTX_TASK(ctx);
int state, is_system;
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
/*
* context must be attached to issue the stop command (includes LOADED,MASKED,ZOMBIE)
*/
if (state == PFM_CTX_UNLOADED) return -EINVAL;
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (is_system && ctx->ctx_cpu != smp_processor_id()) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
DPRINT(("task [%d] ctx_state=%d is_system=%d\n",
task_pid_nr(PFM_CTX_TASK(ctx)),
state,
is_system));
/*
* in system mode, we need to update the PMU directly
* and the user level state of the caller, which may not
* necessarily be the creator of the context.
*/
if (is_system) {
/*
* Update local PMU first
*
* disable dcr pp
*/
ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) & ~IA64_DCR_PP);
ia64_srlz_i();
/*
* update local cpuinfo
*/
PFM_CPUINFO_CLEAR(PFM_CPUINFO_DCR_PP);
/*
* stop monitoring, does srlz.i
*/
pfm_clear_psr_pp();
/*
* stop monitoring in the caller
*/
ia64_psr(regs)->pp = 0;
return 0;
}
/*
* per-task mode
*/
if (task == current) {
/* stop monitoring at kernel level */
pfm_clear_psr_up();
/*
* stop monitoring at the user level
*/
ia64_psr(regs)->up = 0;
} else {
tregs = task_pt_regs(task);
/*
* stop monitoring at the user level
*/
ia64_psr(tregs)->up = 0;
/*
* monitoring disabled in kernel at next reschedule
*/
ctx->ctx_saved_psr_up = 0;
DPRINT(("task=[%d]\n", task_pid_nr(task)));
}
return 0;
}
static int
pfm_start(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct pt_regs *tregs;
int state, is_system;
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
if (state != PFM_CTX_LOADED) return -EINVAL;
/*
* In system wide and when the context is loaded, access can only happen
* when the caller is running on the CPU being monitored by the session.
* It does not have to be the owner (ctx_task) of the context per se.
*/
if (is_system && ctx->ctx_cpu != smp_processor_id()) {
DPRINT(("should be running on CPU%d\n", ctx->ctx_cpu));
return -EBUSY;
}
/*
* in system mode, we need to update the PMU directly
* and the user level state of the caller, which may not
* necessarily be the creator of the context.
*/
if (is_system) {
/*
* set user level psr.pp for the caller
*/
ia64_psr(regs)->pp = 1;
/*
* now update the local PMU and cpuinfo
*/
PFM_CPUINFO_SET(PFM_CPUINFO_DCR_PP);
/*
* start monitoring at kernel level
*/
pfm_set_psr_pp();
/* enable dcr pp */
ia64_setreg(_IA64_REG_CR_DCR, ia64_getreg(_IA64_REG_CR_DCR) | IA64_DCR_PP);
ia64_srlz_i();
return 0;
}
/*
* per-process mode
*/
if (ctx->ctx_task == current) {
/* start monitoring at kernel level */
pfm_set_psr_up();
/*
* activate monitoring at user level
*/
ia64_psr(regs)->up = 1;
} else {
tregs = task_pt_regs(ctx->ctx_task);
/*
* start monitoring at the kernel level the next
* time the task is scheduled
*/
ctx->ctx_saved_psr_up = IA64_PSR_UP;
/*
* activate monitoring at user level
*/
ia64_psr(tregs)->up = 1;
}
return 0;
}
static int
pfm_get_pmc_reset(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
pfarg_reg_t *req = (pfarg_reg_t *)arg;
unsigned int cnum;
int i;
int ret = -EINVAL;
for (i = 0; i < count; i++, req++) {
cnum = req->reg_num;
if (!PMC_IS_IMPL(cnum)) goto abort_mission;
req->reg_value = PMC_DFL_VAL(cnum);
PFM_REG_RETFLAG_SET(req->reg_flags, 0);
DPRINT(("pmc_reset_val pmc[%u]=0x%lx\n", cnum, req->reg_value));
}
return 0;
abort_mission:
PFM_REG_RETFLAG_SET(req->reg_flags, PFM_REG_RETFL_EINVAL);
return ret;
}
static int
pfm_check_task_exist(pfm_context_t *ctx)
{
struct task_struct *g, *t;
int ret = -ESRCH;
read_lock(&tasklist_lock);
do_each_thread (g, t) {
if (t->thread.pfm_context == ctx) {
ret = 0;
goto out;
}
} while_each_thread (g, t);
out:
read_unlock(&tasklist_lock);
DPRINT(("pfm_check_task_exist: ret=%d ctx=%p\n", ret, ctx));
return ret;
}
static int
pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task;
struct thread_struct *thread;
struct pfm_context_t *old;
unsigned long flags;
#ifndef CONFIG_SMP
struct task_struct *owner_task = NULL;
#endif
pfarg_load_t *req = (pfarg_load_t *)arg;
unsigned long *pmcs_source, *pmds_source;
int the_cpu;
int ret = 0;
int state, is_system, set_dbregs = 0;
state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
/*
* can only load from unloaded or terminated state
*/
if (state != PFM_CTX_UNLOADED) {
DPRINT(("cannot load to [%d], invalid ctx_state=%d\n",
req->load_pid,
ctx->ctx_state));
return -EBUSY;
}
DPRINT(("load_pid [%d] using_dbreg=%d\n", req->load_pid, ctx->ctx_fl_using_dbreg));
if (CTX_OVFL_NOBLOCK(ctx) == 0 && req->load_pid == current->pid) {
DPRINT(("cannot use blocking mode on self\n"));
return -EINVAL;
}
ret = pfm_get_task(ctx, req->load_pid, &task);
if (ret) {
DPRINT(("load_pid [%d] get_task=%d\n", req->load_pid, ret));
return ret;
}
ret = -EINVAL;
/*
* system wide is self monitoring only
*/
if (is_system && task != current) {
DPRINT(("system wide is self monitoring only load_pid=%d\n",
req->load_pid));
goto error;
}
thread = &task->thread;
ret = 0;
/*
* cannot load a context which is using range restrictions,
* into a task that is being debugged.
*/
if (ctx->ctx_fl_using_dbreg) {
if (thread->flags & IA64_THREAD_DBG_VALID) {
ret = -EBUSY;
DPRINT(("load_pid [%d] task is debugged, cannot load range restrictions\n", req->load_pid));
goto error;
}
LOCK_PFS(flags);
if (is_system) {
if (pfm_sessions.pfs_ptrace_use_dbregs) {
DPRINT(("cannot load [%d] dbregs in use\n",
task_pid_nr(task)));
ret = -EBUSY;
} else {
pfm_sessions.pfs_sys_use_dbregs++;
DPRINT(("load [%d] increased sys_use_dbreg=%u\n", task_pid_nr(task), pfm_sessions.pfs_sys_use_dbregs));
set_dbregs = 1;
}
}
UNLOCK_PFS(flags);
if (ret) goto error;
}
/*
* SMP system-wide monitoring implies self-monitoring.
*
* The programming model expects the task to
* be pinned on a CPU throughout the session.
* Here we take note of the current CPU at the
* time the context is loaded. No call from
* another CPU will be allowed.
*
* The pinning via shed_setaffinity()
* must be done by the calling task prior
* to this call.
*
* systemwide: keep track of CPU this session is supposed to run on
*/
the_cpu = ctx->ctx_cpu = smp_processor_id();
ret = -EBUSY;
/*
* now reserve the session
*/
ret = pfm_reserve_session(current, is_system, the_cpu);
if (ret) goto error;
/*
* task is necessarily stopped at this point.
*
* If the previous context was zombie, then it got removed in
* pfm_save_regs(). Therefore we should not see it here.
* If we see a context, then this is an active context
*
* XXX: needs to be atomic
*/
DPRINT(("before cmpxchg() old_ctx=%p new_ctx=%p\n",
thread->pfm_context, ctx));
ret = -EBUSY;
old = ia64_cmpxchg(acq, &thread->pfm_context, NULL, ctx, sizeof(pfm_context_t *));
if (old != NULL) {
DPRINT(("load_pid [%d] already has a context\n", req->load_pid));
goto error_unres;
}
pfm_reset_msgq(ctx);
ctx->ctx_state = PFM_CTX_LOADED;
/*
* link context to task
*/
ctx->ctx_task = task;
if (is_system) {
/*
* we load as stopped
*/
PFM_CPUINFO_SET(PFM_CPUINFO_SYST_WIDE);
PFM_CPUINFO_CLEAR(PFM_CPUINFO_DCR_PP);
if (ctx->ctx_fl_excl_idle) PFM_CPUINFO_SET(PFM_CPUINFO_EXCL_IDLE);
} else {
thread->flags |= IA64_THREAD_PM_VALID;
}
/*
* propagate into thread-state
*/
pfm_copy_pmds(task, ctx);
pfm_copy_pmcs(task, ctx);
pmcs_source = ctx->th_pmcs;
pmds_source = ctx->th_pmds;
/*
* always the case for system-wide
*/
if (task == current) {
if (is_system == 0) {
/* allow user level control */
ia64_psr(regs)->sp = 0;
DPRINT(("clearing psr.sp for [%d]\n", task_pid_nr(task)));
SET_LAST_CPU(ctx, smp_processor_id());
INC_ACTIVATION();
SET_ACTIVATION(ctx);
#ifndef CONFIG_SMP
/*
* push the other task out, if any
*/
owner_task = GET_PMU_OWNER();
if (owner_task) pfm_lazy_save_regs(owner_task);
#endif
}
/*
* load all PMD from ctx to PMU (as opposed to thread state)
* restore all PMC from ctx to PMU
*/
pfm_restore_pmds(pmds_source, ctx->ctx_all_pmds[0]);
pfm_restore_pmcs(pmcs_source, ctx->ctx_all_pmcs[0]);
ctx->ctx_reload_pmcs[0] = 0UL;
ctx->ctx_reload_pmds[0] = 0UL;
/*
* guaranteed safe by earlier check against DBG_VALID
*/
if (ctx->ctx_fl_using_dbreg) {
pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
}
/*
* set new ownership
*/
SET_PMU_OWNER(task, ctx);
DPRINT(("context loaded on PMU for [%d]\n", task_pid_nr(task)));
} else {
/*
* when not current, task MUST be stopped, so this is safe
*/
regs = task_pt_regs(task);
/* force a full reload */
ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
SET_LAST_CPU(ctx, -1);
/* initial saved psr (stopped) */
ctx->ctx_saved_psr_up = 0UL;
ia64_psr(regs)->up = ia64_psr(regs)->pp = 0;
}
ret = 0;
error_unres:
if (ret) pfm_unreserve_session(ctx, ctx->ctx_fl_system, the_cpu);
error:
/*
* we must undo the dbregs setting (for system-wide)
*/
if (ret && set_dbregs) {
LOCK_PFS(flags);
pfm_sessions.pfs_sys_use_dbregs--;
UNLOCK_PFS(flags);
}
/*
* release task, there is now a link with the context
*/
if (is_system == 0 && task != current) {
pfm_put_task(task);
if (ret == 0) {
ret = pfm_check_task_exist(ctx);
if (ret) {
ctx->ctx_state = PFM_CTX_UNLOADED;
ctx->ctx_task = NULL;
}
}
}
return ret;
}
/*
* in this function, we do not need to increase the use count
* for the task via get_task_struct(), because we hold the
* context lock. If the task were to disappear while having
* a context attached, it would go through pfm_exit_thread()
* which also grabs the context lock and would therefore be blocked
* until we are here.
*/
static void pfm_flush_pmds(struct task_struct *, pfm_context_t *ctx);
static int
pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
{
struct task_struct *task = PFM_CTX_TASK(ctx);
struct pt_regs *tregs;
int prev_state, is_system;
int ret;
DPRINT(("ctx_state=%d task [%d]\n", ctx->ctx_state, task ? task_pid_nr(task) : -1));
prev_state = ctx->ctx_state;
is_system = ctx->ctx_fl_system;
/*
* unload only when necessary
*/
if (prev_state == PFM_CTX_UNLOADED) {
DPRINT(("ctx_state=%d, nothing to do\n", prev_state));
return 0;
}
/*
* clear psr and dcr bits
*/
ret = pfm_stop(ctx, NULL, 0, regs);
if (ret) return ret;
ctx->ctx_state = PFM_CTX_UNLOADED;
/*
* in system mode, we need to update the PMU directly
* and the user level state of the caller, which may not
* necessarily be the creator of the context.
*/
if (is_system) {
/*
* Update cpuinfo
*
* local PMU is taken care of in pfm_stop()
*/
PFM_CPUINFO_CLEAR(PFM_CPUINFO_SYST_WIDE);
PFM_CPUINFO_CLEAR(PFM_CPUINFO_EXCL_IDLE);
/*
* save PMDs in context
* release ownership
*/
pfm_flush_pmds(current, ctx);
/*
* at this point we are done with the PMU
* so we can unreserve the resource.
*/
if (prev_state != PFM_CTX_ZOMBIE)
pfm_unreserve_session(ctx, 1 , ctx->ctx_cpu);
/*
* disconnect context from task
*/
task->thread.pfm_context = NULL;
/*
* disconnect task from context
*/
ctx->ctx_task = NULL;
/*
* There is nothing more to cleanup here.
*/
return 0;
}
/*
* per-task mode
*/
tregs = task == current ? regs : task_pt_regs(task);
if (task == current) {
/*
* cancel user level control
*/
ia64_psr(regs)->sp = 1;
DPRINT(("setting psr.sp for [%d]\n", task_pid_nr(task)));
}
/*
* save PMDs to context
* release ownership
*/
pfm_flush_pmds(task, ctx);
/*
* at this point we are done with the PMU
* so we can unreserve the resource.
*
* when state was ZOMBIE, we have already unreserved.
*/
if (prev_state != PFM_CTX_ZOMBIE)
pfm_unreserve_session(ctx, 0 , ctx->ctx_cpu);
/*
* reset activation counter and psr
*/
ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
SET_LAST_CPU(ctx, -1);
/*
* PMU state will not be restored
*/
task->thread.flags &= ~IA64_THREAD_PM_VALID;
/*
* break links between context and task
*/
task->thread.pfm_context = NULL;
ctx->ctx_task = NULL;
PFM_SET_WORK_PENDING(task, 0);
ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_NONE;
ctx->ctx_fl_can_restart = 0;
ctx->ctx_fl_going_zombie = 0;
DPRINT(("disconnected [%d] from context\n", task_pid_nr(task)));
return 0;
}
/*
* called only from exit_thread(): task == current
* we come here only if current has a context attached (loaded or masked)
*/
void
pfm_exit_thread(struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long flags;
struct pt_regs *regs = task_pt_regs(task);
int ret, state;
int free_ok = 0;
ctx = PFM_GET_CTX(task);
PROTECT_CTX(ctx, flags);
DPRINT(("state=%d task [%d]\n", ctx->ctx_state, task_pid_nr(task)));
state = ctx->ctx_state;
switch(state) {
case PFM_CTX_UNLOADED:
/*
* only comes to this function if pfm_context is not NULL, i.e., cannot
* be in unloaded state
*/
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] ctx unloaded\n", task_pid_nr(task));
break;
case PFM_CTX_LOADED:
case PFM_CTX_MASKED:
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid_nr(task), state, ret);
}
DPRINT(("ctx unloaded for current state was %d\n", state));
pfm_end_notify_user(ctx);
break;
case PFM_CTX_ZOMBIE:
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] state=%d unload failed %d\n", task_pid_nr(task), state, ret);
}
free_ok = 1;
break;
default:
printk(KERN_ERR "perfmon: pfm_exit_thread [%d] unexpected state=%d\n", task_pid_nr(task), state);
break;
}
UNPROTECT_CTX(ctx, flags);
{ u64 psr = pfm_get_psr();
BUG_ON(psr & (IA64_PSR_UP|IA64_PSR_PP));
BUG_ON(GET_PMU_OWNER());
BUG_ON(ia64_psr(regs)->up);
BUG_ON(ia64_psr(regs)->pp);
}
/*
* All memory free operations (especially for vmalloc'ed memory)
* MUST be done with interrupts ENABLED.
*/
if (free_ok) pfm_context_free(ctx);
}
/*
* functions MUST be listed in the increasing order of their index (see permfon.h)
*/
#define PFM_CMD(name, flags, arg_count, arg_type, getsz) { name, #name, flags, arg_count, sizeof(arg_type), getsz }
#define PFM_CMD_S(name, flags) { name, #name, flags, 0, 0, NULL }
#define PFM_CMD_PCLRWS (PFM_CMD_FD|PFM_CMD_ARG_RW|PFM_CMD_STOP)
#define PFM_CMD_PCLRW (PFM_CMD_FD|PFM_CMD_ARG_RW)
#define PFM_CMD_NONE { NULL, "no-cmd", 0, 0, 0, NULL}
static pfm_cmd_desc_t pfm_cmd_tab[]={
/* 0 */PFM_CMD_NONE,
/* 1 */PFM_CMD(pfm_write_pmcs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_reg_t, NULL),
/* 2 */PFM_CMD(pfm_write_pmds, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_reg_t, NULL),
/* 3 */PFM_CMD(pfm_read_pmds, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_reg_t, NULL),
/* 4 */PFM_CMD_S(pfm_stop, PFM_CMD_PCLRWS),
/* 5 */PFM_CMD_S(pfm_start, PFM_CMD_PCLRWS),
/* 6 */PFM_CMD_NONE,
/* 7 */PFM_CMD_NONE,
/* 8 */PFM_CMD(pfm_context_create, PFM_CMD_ARG_RW, 1, pfarg_context_t, pfm_ctx_getsize),
/* 9 */PFM_CMD_NONE,
/* 10 */PFM_CMD_S(pfm_restart, PFM_CMD_PCLRW),
/* 11 */PFM_CMD_NONE,
/* 12 */PFM_CMD(pfm_get_features, PFM_CMD_ARG_RW, 1, pfarg_features_t, NULL),
/* 13 */PFM_CMD(pfm_debug, 0, 1, unsigned int, NULL),
/* 14 */PFM_CMD_NONE,
/* 15 */PFM_CMD(pfm_get_pmc_reset, PFM_CMD_ARG_RW, PFM_CMD_ARG_MANY, pfarg_reg_t, NULL),
/* 16 */PFM_CMD(pfm_context_load, PFM_CMD_PCLRWS, 1, pfarg_load_t, NULL),
/* 17 */PFM_CMD_S(pfm_context_unload, PFM_CMD_PCLRWS),
/* 18 */PFM_CMD_NONE,
/* 19 */PFM_CMD_NONE,
/* 20 */PFM_CMD_NONE,
/* 21 */PFM_CMD_NONE,
/* 22 */PFM_CMD_NONE,
/* 23 */PFM_CMD_NONE,
/* 24 */PFM_CMD_NONE,
/* 25 */PFM_CMD_NONE,
/* 26 */PFM_CMD_NONE,
/* 27 */PFM_CMD_NONE,
/* 28 */PFM_CMD_NONE,
/* 29 */PFM_CMD_NONE,
/* 30 */PFM_CMD_NONE,
/* 31 */PFM_CMD_NONE,
/* 32 */PFM_CMD(pfm_write_ibrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL),
/* 33 */PFM_CMD(pfm_write_dbrs, PFM_CMD_PCLRWS, PFM_CMD_ARG_MANY, pfarg_dbreg_t, NULL)
};
#define PFM_CMD_COUNT (sizeof(pfm_cmd_tab)/sizeof(pfm_cmd_desc_t))
static int
pfm_check_task_state(pfm_context_t *ctx, int cmd, unsigned long flags)
{
struct task_struct *task;
int state, old_state;
recheck:
state = ctx->ctx_state;
task = ctx->ctx_task;
if (task == NULL) {
DPRINT(("context %d no task, state=%d\n", ctx->ctx_fd, state));
return 0;
}
DPRINT(("context %d state=%d [%d] task_state=%ld must_stop=%d\n",
ctx->ctx_fd,
state,
task_pid_nr(task),
task->state, PFM_CMD_STOPPED(cmd)));
/*
* self-monitoring always ok.
*
* for system-wide the caller can either be the creator of the
* context (to one to which the context is attached to) OR
* a task running on the same CPU as the session.
*/
if (task == current || ctx->ctx_fl_system) return 0;
/*
* we are monitoring another thread
*/
switch(state) {
case PFM_CTX_UNLOADED:
/*
* if context is UNLOADED we are safe to go
*/
return 0;
case PFM_CTX_ZOMBIE:
/*
* no command can operate on a zombie context
*/
DPRINT(("cmd %d state zombie cannot operate on context\n", cmd));
return -EINVAL;
case PFM_CTX_MASKED:
/*
* PMU state has been saved to software even though
* the thread may still be running.
*/
if (cmd != PFM_UNLOAD_CONTEXT) return 0;
}
/*
* context is LOADED or MASKED. Some commands may need to have
* the task stopped.
*
* We could lift this restriction for UP but it would mean that
* the user has no guarantee the task would not run between
* two successive calls to perfmonctl(). That's probably OK.
* If this user wants to ensure the task does not run, then
* the task must be stopped.
*/
if (PFM_CMD_STOPPED(cmd)) {
if (!task_is_stopped_or_traced(task)) {
DPRINT(("[%d] task not in stopped state\n", task_pid_nr(task)));
return -EBUSY;
}
/*
* task is now stopped, wait for ctxsw out
*
* This is an interesting point in the code.
* We need to unprotect the context because
* the pfm_save_regs() routines needs to grab
* the same lock. There are danger in doing
* this because it leaves a window open for
* another task to get access to the context
* and possibly change its state. The one thing
* that is not possible is for the context to disappear
* because we are protected by the VFS layer, i.e.,
* get_fd()/put_fd().
*/
old_state = state;
UNPROTECT_CTX(ctx, flags);
wait_task_inactive(task, 0);
PROTECT_CTX(ctx, flags);
/*
* we must recheck to verify if state has changed
*/
if (ctx->ctx_state != old_state) {
DPRINT(("old_state=%d new_state=%d\n", old_state, ctx->ctx_state));
goto recheck;
}
}
return 0;
}
/*
* system-call entry point (must return long)
*/
asmlinkage long
sys_perfmonctl (int fd, int cmd, void __user *arg, int count)
{
struct file *file = NULL;
pfm_context_t *ctx = NULL;
unsigned long flags = 0UL;
void *args_k = NULL;
long ret; /* will expand int return types */
size_t base_sz, sz, xtra_sz = 0;
int narg, completed_args = 0, call_made = 0, cmd_flags;
int (*func)(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs);
int (*getsize)(void *arg, size_t *sz);
#define PFM_MAX_ARGSIZE 4096
/*
* reject any call if perfmon was disabled at initialization
*/
if (unlikely(pmu_conf == NULL)) return -ENOSYS;
if (unlikely(cmd < 0 || cmd >= PFM_CMD_COUNT)) {
DPRINT(("invalid cmd=%d\n", cmd));
return -EINVAL;
}
func = pfm_cmd_tab[cmd].cmd_func;
narg = pfm_cmd_tab[cmd].cmd_narg;
base_sz = pfm_cmd_tab[cmd].cmd_argsize;
getsize = pfm_cmd_tab[cmd].cmd_getsize;
cmd_flags = pfm_cmd_tab[cmd].cmd_flags;
if (unlikely(func == NULL)) {
DPRINT(("invalid cmd=%d\n", cmd));
return -EINVAL;
}
DPRINT(("cmd=%s idx=%d narg=0x%x argsz=%lu count=%d\n",
PFM_CMD_NAME(cmd),
cmd,
narg,
base_sz,
count));
/*
* check if number of arguments matches what the command expects
*/
if (unlikely((narg == PFM_CMD_ARG_MANY && count <= 0) || (narg > 0 && narg != count)))
return -EINVAL;
restart_args:
sz = xtra_sz + base_sz*count;
/*
* limit abuse to min page size
*/
if (unlikely(sz > PFM_MAX_ARGSIZE)) {
printk(KERN_ERR "perfmon: [%d] argument too big %lu\n", task_pid_nr(current), sz);
return -E2BIG;
}
/*
* allocate default-sized argument buffer
*/
if (likely(count && args_k == NULL)) {
args_k = kmalloc(PFM_MAX_ARGSIZE, GFP_KERNEL);
if (args_k == NULL) return -ENOMEM;
}
ret = -EFAULT;
/*
* copy arguments
*
* assume sz = 0 for command without parameters
*/
if (sz && copy_from_user(args_k, arg, sz)) {
DPRINT(("cannot copy_from_user %lu bytes @%p\n", sz, arg));
goto error_args;
}
/*
* check if command supports extra parameters
*/
if (completed_args == 0 && getsize) {
/*
* get extra parameters size (based on main argument)
*/
ret = (*getsize)(args_k, &xtra_sz);
if (ret) goto error_args;
completed_args = 1;
DPRINT(("restart_args sz=%lu xtra_sz=%lu\n", sz, xtra_sz));
/* retry if necessary */
if (likely(xtra_sz)) goto restart_args;
}
if (unlikely((cmd_flags & PFM_CMD_FD) == 0)) goto skip_fd;
ret = -EBADF;
file = fget(fd);
if (unlikely(file == NULL)) {
DPRINT(("invalid fd %d\n", fd));
goto error_args;
}
if (unlikely(PFM_IS_FILE(file) == 0)) {
DPRINT(("fd %d not related to perfmon\n", fd));
goto error_args;
}
ctx = file->private_data;
if (unlikely(ctx == NULL)) {
DPRINT(("no context for fd %d\n", fd));
goto error_args;
}
prefetch(&ctx->ctx_state);
PROTECT_CTX(ctx, flags);
/*
* check task is stopped
*/
ret = pfm_check_task_state(ctx, cmd, flags);
if (unlikely(ret)) goto abort_locked;
skip_fd:
ret = (*func)(ctx, args_k, count, task_pt_regs(current));
call_made = 1;
abort_locked:
if (likely(ctx)) {
DPRINT(("context unlocked\n"));
UNPROTECT_CTX(ctx, flags);
}
/* copy argument back to user, if needed */
if (call_made && PFM_CMD_RW_ARG(cmd) && copy_to_user(arg, args_k, base_sz*count)) ret = -EFAULT;
error_args:
if (file)
fput(file);
kfree(args_k);
DPRINT(("cmd=%s ret=%ld\n", PFM_CMD_NAME(cmd), ret));
return ret;
}
static void
pfm_resume_after_ovfl(pfm_context_t *ctx, unsigned long ovfl_regs, struct pt_regs *regs)
{
pfm_buffer_fmt_t *fmt = ctx->ctx_buf_fmt;
pfm_ovfl_ctrl_t rst_ctrl;
int state;
int ret = 0;
state = ctx->ctx_state;
/*
* Unlock sampling buffer and reset index atomically
* XXX: not really needed when blocking
*/
if (CTX_HAS_SMPL(ctx)) {
rst_ctrl.bits.mask_monitoring = 0;
rst_ctrl.bits.reset_ovfl_pmds = 0;
if (state == PFM_CTX_LOADED)
ret = pfm_buf_fmt_restart_active(fmt, current, &rst_ctrl, ctx->ctx_smpl_hdr, regs);
else
ret = pfm_buf_fmt_restart(fmt, current, &rst_ctrl, ctx->ctx_smpl_hdr, regs);
} else {
rst_ctrl.bits.mask_monitoring = 0;
rst_ctrl.bits.reset_ovfl_pmds = 1;
}
if (ret == 0) {
if (rst_ctrl.bits.reset_ovfl_pmds) {
pfm_reset_regs(ctx, &ovfl_regs, PFM_PMD_LONG_RESET);
}
if (rst_ctrl.bits.mask_monitoring == 0) {
DPRINT(("resuming monitoring\n"));
if (ctx->ctx_state == PFM_CTX_MASKED) pfm_restore_monitoring(current);
} else {
DPRINT(("stopping monitoring\n"));
//pfm_stop_monitoring(current, regs);
}
ctx->ctx_state = PFM_CTX_LOADED;
}
}
/*
* context MUST BE LOCKED when calling
* can only be called for current
*/
static void
pfm_context_force_terminate(pfm_context_t *ctx, struct pt_regs *regs)
{
int ret;
DPRINT(("entering for [%d]\n", task_pid_nr(current)));
ret = pfm_context_unload(ctx, NULL, 0, regs);
if (ret) {
printk(KERN_ERR "pfm_context_force_terminate: [%d] unloaded failed with %d\n", task_pid_nr(current), ret);
}
/*
* and wakeup controlling task, indicating we are now disconnected
*/
wake_up_interruptible(&ctx->ctx_zombieq);
/*
* given that context is still locked, the controlling
* task will only get access when we return from
* pfm_handle_work().
*/
}
static int pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds);
/*
* pfm_handle_work() can be called with interrupts enabled
* (TIF_NEED_RESCHED) or disabled. The down_interruptible
* call may sleep, therefore we must re-enable interrupts
* to avoid deadlocks. It is safe to do so because this function
* is called ONLY when returning to user level (pUStk=1), in which case
* there is no risk of kernel stack overflow due to deep
* interrupt nesting.
*/
void
pfm_handle_work(void)
{
pfm_context_t *ctx;
struct pt_regs *regs;
unsigned long flags, dummy_flags;
unsigned long ovfl_regs;
unsigned int reason;
int ret;
ctx = PFM_GET_CTX(current);
if (ctx == NULL) {
printk(KERN_ERR "perfmon: [%d] has no PFM context\n",
task_pid_nr(current));
return;
}
PROTECT_CTX(ctx, flags);
PFM_SET_WORK_PENDING(current, 0);
regs = task_pt_regs(current);
/*
* extract reason for being here and clear
*/
reason = ctx->ctx_fl_trap_reason;
ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_NONE;
ovfl_regs = ctx->ctx_ovfl_regs[0];
DPRINT(("reason=%d state=%d\n", reason, ctx->ctx_state));
/*
* must be done before we check for simple-reset mode
*/
if (ctx->ctx_fl_going_zombie || ctx->ctx_state == PFM_CTX_ZOMBIE)
goto do_zombie;
//if (CTX_OVFL_NOBLOCK(ctx)) goto skip_blocking;
if (reason == PFM_TRAP_REASON_RESET)
goto skip_blocking;
/*
* restore interrupt mask to what it was on entry.
* Could be enabled/diasbled.
*/
UNPROTECT_CTX(ctx, flags);
/*
* force interrupt enable because of down_interruptible()
*/
local_irq_enable();
DPRINT(("before block sleeping\n"));
/*
* may go through without blocking on SMP systems
* if restart has been received already by the time we call down()
*/
ret = wait_for_completion_interruptible(&ctx->ctx_restart_done);
DPRINT(("after block sleeping ret=%d\n", ret));
/*
* lock context and mask interrupts again
* We save flags into a dummy because we may have
* altered interrupts mask compared to entry in this
* function.
*/
PROTECT_CTX(ctx, dummy_flags);
/*
* we need to read the ovfl_regs only after wake-up
* because we may have had pfm_write_pmds() in between
* and that can changed PMD values and therefore
* ovfl_regs is reset for these new PMD values.
*/
ovfl_regs = ctx->ctx_ovfl_regs[0];
if (ctx->ctx_fl_going_zombie) {
do_zombie:
DPRINT(("context is zombie, bailing out\n"));
pfm_context_force_terminate(ctx, regs);
goto nothing_to_do;
}
/*
* in case of interruption of down() we don't restart anything
*/
if (ret < 0)
goto nothing_to_do;
skip_blocking:
pfm_resume_after_ovfl(ctx, ovfl_regs, regs);
ctx->ctx_ovfl_regs[0] = 0UL;
nothing_to_do:
/*
* restore flags as they were upon entry
*/
UNPROTECT_CTX(ctx, flags);
}
static int
pfm_notify_user(pfm_context_t *ctx, pfm_msg_t *msg)
{
if (ctx->ctx_state == PFM_CTX_ZOMBIE) {
DPRINT(("ignoring overflow notification, owner is zombie\n"));
return 0;
}
DPRINT(("waking up somebody\n"));
if (msg) wake_up_interruptible(&ctx->ctx_msgq_wait);
/*
* safe, we are not in intr handler, nor in ctxsw when
* we come here
*/
kill_fasync (&ctx->ctx_async_queue, SIGIO, POLL_IN);
return 0;
}
static int
pfm_ovfl_notify_user(pfm_context_t *ctx, unsigned long ovfl_pmds)
{
pfm_msg_t *msg = NULL;
if (ctx->ctx_fl_no_msg == 0) {
msg = pfm_get_new_msg(ctx);
if (msg == NULL) {
printk(KERN_ERR "perfmon: pfm_ovfl_notify_user no more notification msgs\n");
return -1;
}
msg->pfm_ovfl_msg.msg_type = PFM_MSG_OVFL;
msg->pfm_ovfl_msg.msg_ctx_fd = ctx->ctx_fd;
msg->pfm_ovfl_msg.msg_active_set = 0;
msg->pfm_ovfl_msg.msg_ovfl_pmds[0] = ovfl_pmds;
msg->pfm_ovfl_msg.msg_ovfl_pmds[1] = 0UL;
msg->pfm_ovfl_msg.msg_ovfl_pmds[2] = 0UL;
msg->pfm_ovfl_msg.msg_ovfl_pmds[3] = 0UL;
msg->pfm_ovfl_msg.msg_tstamp = 0UL;
}
DPRINT(("ovfl msg: msg=%p no_msg=%d fd=%d ovfl_pmds=0x%lx\n",
msg,
ctx->ctx_fl_no_msg,
ctx->ctx_fd,
ovfl_pmds));
return pfm_notify_user(ctx, msg);
}
static int
pfm_end_notify_user(pfm_context_t *ctx)
{
pfm_msg_t *msg;
msg = pfm_get_new_msg(ctx);
if (msg == NULL) {
printk(KERN_ERR "perfmon: pfm_end_notify_user no more notification msgs\n");
return -1;
}
/* no leak */
memset(msg, 0, sizeof(*msg));
msg->pfm_end_msg.msg_type = PFM_MSG_END;
msg->pfm_end_msg.msg_ctx_fd = ctx->ctx_fd;
msg->pfm_ovfl_msg.msg_tstamp = 0UL;
DPRINT(("end msg: msg=%p no_msg=%d ctx_fd=%d\n",
msg,
ctx->ctx_fl_no_msg,
ctx->ctx_fd));
return pfm_notify_user(ctx, msg);
}
/*
* main overflow processing routine.
* it can be called from the interrupt path or explicitly during the context switch code
*/
static void pfm_overflow_handler(struct task_struct *task, pfm_context_t *ctx,
unsigned long pmc0, struct pt_regs *regs)
{
pfm_ovfl_arg_t *ovfl_arg;
unsigned long mask;
unsigned long old_val, ovfl_val, new_val;
unsigned long ovfl_notify = 0UL, ovfl_pmds = 0UL, smpl_pmds = 0UL, reset_pmds;
unsigned long tstamp;
pfm_ovfl_ctrl_t ovfl_ctrl;
unsigned int i, has_smpl;
int must_notify = 0;
if (unlikely(ctx->ctx_state == PFM_CTX_ZOMBIE)) goto stop_monitoring;
/*
* sanity test. Should never happen
*/
if (unlikely((pmc0 & 0x1) == 0)) goto sanity_check;
tstamp = ia64_get_itc();
mask = pmc0 >> PMU_FIRST_COUNTER;
ovfl_val = pmu_conf->ovfl_val;
has_smpl = CTX_HAS_SMPL(ctx);
DPRINT_ovfl(("pmc0=0x%lx pid=%d iip=0x%lx, %s "
"used_pmds=0x%lx\n",
pmc0,
task ? task_pid_nr(task): -1,
(regs ? regs->cr_iip : 0),
CTX_OVFL_NOBLOCK(ctx) ? "nonblocking" : "blocking",
ctx->ctx_used_pmds[0]));
/*
* first we update the virtual counters
* assume there was a prior ia64_srlz_d() issued
*/
for (i = PMU_FIRST_COUNTER; mask ; i++, mask >>= 1) {
/* skip pmd which did not overflow */
if ((mask & 0x1) == 0) continue;
/*
* Note that the pmd is not necessarily 0 at this point as qualified events
* may have happened before the PMU was frozen. The residual count is not
* taken into consideration here but will be with any read of the pmd via
* pfm_read_pmds().
*/
old_val = new_val = ctx->ctx_pmds[i].val;
new_val += 1 + ovfl_val;
ctx->ctx_pmds[i].val = new_val;
/*
* check for overflow condition
*/
if (likely(old_val > new_val)) {
ovfl_pmds |= 1UL << i;
if (PMC_OVFL_NOTIFY(ctx, i)) ovfl_notify |= 1UL << i;
}
DPRINT_ovfl(("ctx_pmd[%d].val=0x%lx old_val=0x%lx pmd=0x%lx ovfl_pmds=0x%lx ovfl_notify=0x%lx\n",
i,
new_val,
old_val,
ia64_get_pmd(i) & ovfl_val,
ovfl_pmds,
ovfl_notify));
}
/*
* there was no 64-bit overflow, nothing else to do
*/
if (ovfl_pmds == 0UL) return;
/*
* reset all control bits
*/
ovfl_ctrl.val = 0;
reset_pmds = 0UL;
/*
* if a sampling format module exists, then we "cache" the overflow by
* calling the module's handler() routine.
*/
if (has_smpl) {
unsigned long start_cycles, end_cycles;
unsigned long pmd_mask;
int j, k, ret = 0;
int this_cpu = smp_processor_id();
pmd_mask = ovfl_pmds >> PMU_FIRST_COUNTER;
ovfl_arg = &ctx->ctx_ovfl_arg;
prefetch(ctx->ctx_smpl_hdr);
for(i=PMU_FIRST_COUNTER; pmd_mask && ret == 0; i++, pmd_mask >>=1) {
mask = 1UL << i;
if ((pmd_mask & 0x1) == 0) continue;
ovfl_arg->ovfl_pmd = (unsigned char )i;
ovfl_arg->ovfl_notify = ovfl_notify & mask ? 1 : 0;
ovfl_arg->active_set = 0;
ovfl_arg->ovfl_ctrl.val = 0; /* module must fill in all fields */
ovfl_arg->smpl_pmds[0] = smpl_pmds = ctx->ctx_pmds[i].smpl_pmds[0];
ovfl_arg->pmd_value = ctx->ctx_pmds[i].val;
ovfl_arg->pmd_last_reset = ctx->ctx_pmds[i].lval;
ovfl_arg->pmd_eventid = ctx->ctx_pmds[i].eventid;
/*
* copy values of pmds of interest. Sampling format may copy them
* into sampling buffer.
*/
if (smpl_pmds) {
for(j=0, k=0; smpl_pmds; j++, smpl_pmds >>=1) {
if ((smpl_pmds & 0x1) == 0) continue;
ovfl_arg->smpl_pmds_values[k++] = PMD_IS_COUNTING(j) ? pfm_read_soft_counter(ctx, j) : ia64_get_pmd(j);
DPRINT_ovfl(("smpl_pmd[%d]=pmd%u=0x%lx\n", k-1, j, ovfl_arg->smpl_pmds_values[k-1]));
}
}
pfm_stats[this_cpu].pfm_smpl_handler_calls++;
start_cycles = ia64_get_itc();
/*
* call custom buffer format record (handler) routine
*/
ret = (*ctx->ctx_buf_fmt->fmt_handler)(task, ctx->ctx_smpl_hdr, ovfl_arg, regs, tstamp);
end_cycles = ia64_get_itc();
/*
* For those controls, we take the union because they have
* an all or nothing behavior.
*/
ovfl_ctrl.bits.notify_user |= ovfl_arg->ovfl_ctrl.bits.notify_user;
ovfl_ctrl.bits.block_task |= ovfl_arg->ovfl_ctrl.bits.block_task;
ovfl_ctrl.bits.mask_monitoring |= ovfl_arg->ovfl_ctrl.bits.mask_monitoring;
/*
* build the bitmask of pmds to reset now
*/
if (ovfl_arg->ovfl_ctrl.bits.reset_ovfl_pmds) reset_pmds |= mask;
pfm_stats[this_cpu].pfm_smpl_handler_cycles += end_cycles - start_cycles;
}
/*
* when the module cannot handle the rest of the overflows, we abort right here
*/
if (ret && pmd_mask) {
DPRINT(("handler aborts leftover ovfl_pmds=0x%lx\n",
pmd_mask<<PMU_FIRST_COUNTER));
}
/*
* remove the pmds we reset now from the set of pmds to reset in pfm_restart()
*/
ovfl_pmds &= ~reset_pmds;
} else {
/*
* when no sampling module is used, then the default
* is to notify on overflow if requested by user
*/
ovfl_ctrl.bits.notify_user = ovfl_notify ? 1 : 0;
ovfl_ctrl.bits.block_task = ovfl_notify ? 1 : 0;
ovfl_ctrl.bits.mask_monitoring = ovfl_notify ? 1 : 0; /* XXX: change for saturation */
ovfl_ctrl.bits.reset_ovfl_pmds = ovfl_notify ? 0 : 1;
/*
* if needed, we reset all overflowed pmds
*/
if (ovfl_notify == 0) reset_pmds = ovfl_pmds;
}
DPRINT_ovfl(("ovfl_pmds=0x%lx reset_pmds=0x%lx\n", ovfl_pmds, reset_pmds));
/*
* reset the requested PMD registers using the short reset values
*/
if (reset_pmds) {
unsigned long bm = reset_pmds;
pfm_reset_regs(ctx, &bm, PFM_PMD_SHORT_RESET);
}
if (ovfl_notify && ovfl_ctrl.bits.notify_user) {
/*
* keep track of what to reset when unblocking
*/
ctx->ctx_ovfl_regs[0] = ovfl_pmds;
/*
* check for blocking context
*/
if (CTX_OVFL_NOBLOCK(ctx) == 0 && ovfl_ctrl.bits.block_task) {
ctx->ctx_fl_trap_reason = PFM_TRAP_REASON_BLOCK;
/*
* set the perfmon specific checking pending work for the task
*/
PFM_SET_WORK_PENDING(task, 1);
/*
* when coming from ctxsw, current still points to the
* previous task, therefore we must work with task and not current.
*/
set_notify_resume(task);
}
/*
* defer until state is changed (shorten spin window). the context is locked
* anyway, so the signal receiver would come spin for nothing.
*/
must_notify = 1;
}
DPRINT_ovfl(("owner [%d] pending=%ld reason=%u ovfl_pmds=0x%lx ovfl_notify=0x%lx masked=%d\n",
GET_PMU_OWNER() ? task_pid_nr(GET_PMU_OWNER()) : -1,
PFM_GET_WORK_PENDING(task),
ctx->ctx_fl_trap_reason,
ovfl_pmds,
ovfl_notify,
ovfl_ctrl.bits.mask_monitoring ? 1 : 0));
/*
* in case monitoring must be stopped, we toggle the psr bits
*/
if (ovfl_ctrl.bits.mask_monitoring) {
pfm_mask_monitoring(task);
ctx->ctx_state = PFM_CTX_MASKED;
ctx->ctx_fl_can_restart = 1;
}
/*
* send notification now
*/
if (must_notify) pfm_ovfl_notify_user(ctx, ovfl_notify);
return;
sanity_check:
printk(KERN_ERR "perfmon: CPU%d overflow handler [%d] pmc0=0x%lx\n",
smp_processor_id(),
task ? task_pid_nr(task) : -1,
pmc0);
return;
stop_monitoring:
/*
* in SMP, zombie context is never restored but reclaimed in pfm_load_regs().
* Moreover, zombies are also reclaimed in pfm_save_regs(). Therefore we can
* come here as zombie only if the task is the current task. In which case, we
* can access the PMU hardware directly.
*
* Note that zombies do have PM_VALID set. So here we do the minimal.
*
* In case the context was zombified it could not be reclaimed at the time
* the monitoring program exited. At this point, the PMU reservation has been
* returned, the sampiing buffer has been freed. We must convert this call
* into a spurious interrupt. However, we must also avoid infinite overflows
* by stopping monitoring for this task. We can only come here for a per-task
* context. All we need to do is to stop monitoring using the psr bits which
* are always task private. By re-enabling secure montioring, we ensure that
* the monitored task will not be able to re-activate monitoring.
* The task will eventually be context switched out, at which point the context
* will be reclaimed (that includes releasing ownership of the PMU).
*
* So there might be a window of time where the number of per-task session is zero
* yet one PMU might have a owner and get at most one overflow interrupt for a zombie
* context. This is safe because if a per-task session comes in, it will push this one
* out and by the virtue on pfm_save_regs(), this one will disappear. If a system wide
* session is force on that CPU, given that we use task pinning, pfm_save_regs() will
* also push our zombie context out.
*
* Overall pretty hairy stuff....
*/
DPRINT(("ctx is zombie for [%d], converted to spurious\n", task ? task_pid_nr(task): -1));
pfm_clear_psr_up();
ia64_psr(regs)->up = 0;
ia64_psr(regs)->sp = 1;
return;
}
static int
pfm_do_interrupt_handler(void *arg, struct pt_regs *regs)
{
struct task_struct *task;
pfm_context_t *ctx;
unsigned long flags;
u64 pmc0;
int this_cpu = smp_processor_id();
int retval = 0;
pfm_stats[this_cpu].pfm_ovfl_intr_count++;
/*
* srlz.d done before arriving here
*/
pmc0 = ia64_get_pmc(0);
task = GET_PMU_OWNER();
ctx = GET_PMU_CTX();
/*
* if we have some pending bits set
* assumes : if any PMC0.bit[63-1] is set, then PMC0.fr = 1
*/
if (PMC0_HAS_OVFL(pmc0) && task) {
/*
* we assume that pmc0.fr is always set here
*/
/* sanity check */
if (!ctx) goto report_spurious1;
if (ctx->ctx_fl_system == 0 && (task->thread.flags & IA64_THREAD_PM_VALID) == 0)
goto report_spurious2;
PROTECT_CTX_NOPRINT(ctx, flags);
pfm_overflow_handler(task, ctx, pmc0, regs);
UNPROTECT_CTX_NOPRINT(ctx, flags);
} else {
pfm_stats[this_cpu].pfm_spurious_ovfl_intr_count++;
retval = -1;
}
/*
* keep it unfrozen at all times
*/
pfm_unfreeze_pmu();
return retval;
report_spurious1:
printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d has no PFM context\n",
this_cpu, task_pid_nr(task));
pfm_unfreeze_pmu();
return -1;
report_spurious2:
printk(KERN_INFO "perfmon: spurious overflow interrupt on CPU%d: process %d, invalid flag\n",
this_cpu,
task_pid_nr(task));
pfm_unfreeze_pmu();
return -1;
}
static irqreturn_t
pfm_interrupt_handler(int irq, void *arg)
{
unsigned long start_cycles, total_cycles;
unsigned long min, max;
int this_cpu;
int ret;
struct pt_regs *regs = get_irq_regs();
this_cpu = get_cpu();
if (likely(!pfm_alt_intr_handler)) {
min = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min;
max = pfm_stats[this_cpu].pfm_ovfl_intr_cycles_max;
start_cycles = ia64_get_itc();
ret = pfm_do_interrupt_handler(arg, regs);
total_cycles = ia64_get_itc();
/*
* don't measure spurious interrupts
*/
if (likely(ret == 0)) {
total_cycles -= start_cycles;
if (total_cycles < min) pfm_stats[this_cpu].pfm_ovfl_intr_cycles_min = total_cycles;
if (total_cycles > max) pfm_stats[this_cpu].pfm_ovfl_intr_cycles_max = total_cycles;
pfm_stats[this_cpu].pfm_ovfl_intr_cycles += total_cycles;
}
}
else {
(*pfm_alt_intr_handler->handler)(irq, arg, regs);
}
put_cpu();
return IRQ_HANDLED;
}
/*
* /proc/perfmon interface, for debug only
*/
#define PFM_PROC_SHOW_HEADER ((void *)(long)nr_cpu_ids+1)
static void *
pfm_proc_start(struct seq_file *m, loff_t *pos)
{
if (*pos == 0) {
return PFM_PROC_SHOW_HEADER;
}
while (*pos <= nr_cpu_ids) {
if (cpu_online(*pos - 1)) {
return (void *)*pos;
}
++*pos;
}
return NULL;
}
static void *
pfm_proc_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return pfm_proc_start(m, pos);
}
static void
pfm_proc_stop(struct seq_file *m, void *v)
{
}
static void
pfm_proc_show_header(struct seq_file *m)
{
struct list_head * pos;
pfm_buffer_fmt_t * entry;
unsigned long flags;
seq_printf(m,
"perfmon version : %u.%u\n"
"model : %s\n"
"fastctxsw : %s\n"
"expert mode : %s\n"
"ovfl_mask : 0x%lx\n"
"PMU flags : 0x%x\n",
PFM_VERSION_MAJ, PFM_VERSION_MIN,
pmu_conf->pmu_name,
pfm_sysctl.fastctxsw > 0 ? "Yes": "No",
pfm_sysctl.expert_mode > 0 ? "Yes": "No",
pmu_conf->ovfl_val,
pmu_conf->flags);
LOCK_PFS(flags);
seq_printf(m,
"proc_sessions : %u\n"
"sys_sessions : %u\n"
"sys_use_dbregs : %u\n"
"ptrace_use_dbregs : %u\n",
pfm_sessions.pfs_task_sessions,
pfm_sessions.pfs_sys_sessions,
pfm_sessions.pfs_sys_use_dbregs,
pfm_sessions.pfs_ptrace_use_dbregs);
UNLOCK_PFS(flags);
spin_lock(&pfm_buffer_fmt_lock);
list_for_each(pos, &pfm_buffer_fmt_list) {
entry = list_entry(pos, pfm_buffer_fmt_t, fmt_list);
seq_printf(m, "format : %02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x %s\n",
entry->fmt_uuid[0],
entry->fmt_uuid[1],
entry->fmt_uuid[2],
entry->fmt_uuid[3],
entry->fmt_uuid[4],
entry->fmt_uuid[5],
entry->fmt_uuid[6],
entry->fmt_uuid[7],
entry->fmt_uuid[8],
entry->fmt_uuid[9],
entry->fmt_uuid[10],
entry->fmt_uuid[11],
entry->fmt_uuid[12],
entry->fmt_uuid[13],
entry->fmt_uuid[14],
entry->fmt_uuid[15],
entry->fmt_name);
}
spin_unlock(&pfm_buffer_fmt_lock);
}
static int
pfm_proc_show(struct seq_file *m, void *v)
{
unsigned long psr;
unsigned int i;
int cpu;
if (v == PFM_PROC_SHOW_HEADER) {
pfm_proc_show_header(m);
return 0;
}
/* show info for CPU (v - 1) */
cpu = (long)v - 1;
seq_printf(m,
"CPU%-2d overflow intrs : %lu\n"
"CPU%-2d overflow cycles : %lu\n"
"CPU%-2d overflow min : %lu\n"
"CPU%-2d overflow max : %lu\n"
"CPU%-2d smpl handler calls : %lu\n"
"CPU%-2d smpl handler cycles : %lu\n"
"CPU%-2d spurious intrs : %lu\n"
"CPU%-2d replay intrs : %lu\n"
"CPU%-2d syst_wide : %d\n"
"CPU%-2d dcr_pp : %d\n"
"CPU%-2d exclude idle : %d\n"
"CPU%-2d owner : %d\n"
"CPU%-2d context : %p\n"
"CPU%-2d activations : %lu\n",
cpu, pfm_stats[cpu].pfm_ovfl_intr_count,
cpu, pfm_stats[cpu].pfm_ovfl_intr_cycles,
cpu, pfm_stats[cpu].pfm_ovfl_intr_cycles_min,
cpu, pfm_stats[cpu].pfm_ovfl_intr_cycles_max,
cpu, pfm_stats[cpu].pfm_smpl_handler_calls,
cpu, pfm_stats[cpu].pfm_smpl_handler_cycles,
cpu, pfm_stats[cpu].pfm_spurious_ovfl_intr_count,
cpu, pfm_stats[cpu].pfm_replay_ovfl_intr_count,
cpu, pfm_get_cpu_data(pfm_syst_info, cpu) & PFM_CPUINFO_SYST_WIDE ? 1 : 0,
cpu, pfm_get_cpu_data(pfm_syst_info, cpu) & PFM_CPUINFO_DCR_PP ? 1 : 0,
cpu, pfm_get_cpu_data(pfm_syst_info, cpu) & PFM_CPUINFO_EXCL_IDLE ? 1 : 0,
cpu, pfm_get_cpu_data(pmu_owner, cpu) ? pfm_get_cpu_data(pmu_owner, cpu)->pid: -1,
cpu, pfm_get_cpu_data(pmu_ctx, cpu),
cpu, pfm_get_cpu_data(pmu_activation_number, cpu));
if (num_online_cpus() == 1 && pfm_sysctl.debug > 0) {
psr = pfm_get_psr();
ia64_srlz_d();
seq_printf(m,
"CPU%-2d psr : 0x%lx\n"
"CPU%-2d pmc0 : 0x%lx\n",
cpu, psr,
cpu, ia64_get_pmc(0));
for (i=0; PMC_IS_LAST(i) == 0; i++) {
if (PMC_IS_COUNTING(i) == 0) continue;
seq_printf(m,
"CPU%-2d pmc%u : 0x%lx\n"
"CPU%-2d pmd%u : 0x%lx\n",
cpu, i, ia64_get_pmc(i),
cpu, i, ia64_get_pmd(i));
}
}
return 0;
}
const struct seq_operations pfm_seq_ops = {
.start = pfm_proc_start,
.next = pfm_proc_next,
.stop = pfm_proc_stop,
.show = pfm_proc_show
};
static int
pfm_proc_open(struct inode *inode, struct file *file)
{
return seq_open(file, &pfm_seq_ops);
}
/*
* we come here as soon as local_cpu_data->pfm_syst_wide is set. this happens
* during pfm_enable() hence before pfm_start(). We cannot assume monitoring
* is active or inactive based on mode. We must rely on the value in
* local_cpu_data->pfm_syst_info
*/
void
pfm_syst_wide_update_task(struct task_struct *task, unsigned long info, int is_ctxswin)
{
struct pt_regs *regs;
unsigned long dcr;
unsigned long dcr_pp;
dcr_pp = info & PFM_CPUINFO_DCR_PP ? 1 : 0;
/*
* pid 0 is guaranteed to be the idle task. There is one such task with pid 0
* on every CPU, so we can rely on the pid to identify the idle task.
*/
if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) {
regs = task_pt_regs(task);
ia64_psr(regs)->pp = is_ctxswin ? dcr_pp : 0;
return;
}
/*
* if monitoring has started
*/
if (dcr_pp) {
dcr = ia64_getreg(_IA64_REG_CR_DCR);
/*
* context switching in?
*/
if (is_ctxswin) {
/* mask monitoring for the idle task */
ia64_setreg(_IA64_REG_CR_DCR, dcr & ~IA64_DCR_PP);
pfm_clear_psr_pp();
ia64_srlz_i();
return;
}
/*
* context switching out
* restore monitoring for next task
*
* Due to inlining this odd if-then-else construction generates
* better code.
*/
ia64_setreg(_IA64_REG_CR_DCR, dcr |IA64_DCR_PP);
pfm_set_psr_pp();
ia64_srlz_i();
}
}
#ifdef CONFIG_SMP
static void
pfm_force_cleanup(pfm_context_t *ctx, struct pt_regs *regs)
{
struct task_struct *task = ctx->ctx_task;
ia64_psr(regs)->up = 0;
ia64_psr(regs)->sp = 1;
if (GET_PMU_OWNER() == task) {
DPRINT(("cleared ownership for [%d]\n",
task_pid_nr(ctx->ctx_task)));
SET_PMU_OWNER(NULL, NULL);
}
/*
* disconnect the task from the context and vice-versa
*/
PFM_SET_WORK_PENDING(task, 0);
task->thread.pfm_context = NULL;
task->thread.flags &= ~IA64_THREAD_PM_VALID;
DPRINT(("force cleanup for [%d]\n", task_pid_nr(task)));
}
/*
* in 2.6, interrupts are masked when we come here and the runqueue lock is held
*/
void
pfm_save_regs(struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long flags;
u64 psr;
ctx = PFM_GET_CTX(task);
if (ctx == NULL) return;
/*
* we always come here with interrupts ALREADY disabled by
* the scheduler. So we simply need to protect against concurrent
* access, not CPU concurrency.
*/
flags = pfm_protect_ctx_ctxsw(ctx);
if (ctx->ctx_state == PFM_CTX_ZOMBIE) {
struct pt_regs *regs = task_pt_regs(task);
pfm_clear_psr_up();
pfm_force_cleanup(ctx, regs);
BUG_ON(ctx->ctx_smpl_hdr);
pfm_unprotect_ctx_ctxsw(ctx, flags);
pfm_context_free(ctx);
return;
}
/*
* save current PSR: needed because we modify it
*/
ia64_srlz_d();
psr = pfm_get_psr();
BUG_ON(psr & (IA64_PSR_I));
/*
* stop monitoring:
* This is the last instruction which may generate an overflow
*
* We do not need to set psr.sp because, it is irrelevant in kernel.
* It will be restored from ipsr when going back to user level
*/
pfm_clear_psr_up();
/*
* keep a copy of psr.up (for reload)
*/
ctx->ctx_saved_psr_up = psr & IA64_PSR_UP;
/*
* release ownership of this PMU.
* PM interrupts are masked, so nothing
* can happen.
*/
SET_PMU_OWNER(NULL, NULL);
/*
* we systematically save the PMD as we have no
* guarantee we will be schedule at that same
* CPU again.
*/
pfm_save_pmds(ctx->th_pmds, ctx->ctx_used_pmds[0]);
/*
* save pmc0 ia64_srlz_d() done in pfm_save_pmds()
* we will need it on the restore path to check
* for pending overflow.
*/
ctx->th_pmcs[0] = ia64_get_pmc(0);
/*
* unfreeze PMU if had pending overflows
*/
if (ctx->th_pmcs[0] & ~0x1UL) pfm_unfreeze_pmu();
/*
* finally, allow context access.
* interrupts will still be masked after this call.
*/
pfm_unprotect_ctx_ctxsw(ctx, flags);
}
#else /* !CONFIG_SMP */
void
pfm_save_regs(struct task_struct *task)
{
pfm_context_t *ctx;
u64 psr;
ctx = PFM_GET_CTX(task);
if (ctx == NULL) return;
/*
* save current PSR: needed because we modify it
*/
psr = pfm_get_psr();
BUG_ON(psr & (IA64_PSR_I));
/*
* stop monitoring:
* This is the last instruction which may generate an overflow
*
* We do not need to set psr.sp because, it is irrelevant in kernel.
* It will be restored from ipsr when going back to user level
*/
pfm_clear_psr_up();
/*
* keep a copy of psr.up (for reload)
*/
ctx->ctx_saved_psr_up = psr & IA64_PSR_UP;
}
static void
pfm_lazy_save_regs (struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long flags;
{ u64 psr = pfm_get_psr();
BUG_ON(psr & IA64_PSR_UP);
}
ctx = PFM_GET_CTX(task);
/*
* we need to mask PMU overflow here to
* make sure that we maintain pmc0 until
* we save it. overflow interrupts are
* treated as spurious if there is no
* owner.
*
* XXX: I don't think this is necessary
*/
PROTECT_CTX(ctx,flags);
/*
* release ownership of this PMU.
* must be done before we save the registers.
*
* after this call any PMU interrupt is treated
* as spurious.
*/
SET_PMU_OWNER(NULL, NULL);
/*
* save all the pmds we use
*/
pfm_save_pmds(ctx->th_pmds, ctx->ctx_used_pmds[0]);
/*
* save pmc0 ia64_srlz_d() done in pfm_save_pmds()
* it is needed to check for pended overflow
* on the restore path
*/
ctx->th_pmcs[0] = ia64_get_pmc(0);
/*
* unfreeze PMU if had pending overflows
*/
if (ctx->th_pmcs[0] & ~0x1UL) pfm_unfreeze_pmu();
/*
* now get can unmask PMU interrupts, they will
* be treated as purely spurious and we will not
* lose any information
*/
UNPROTECT_CTX(ctx,flags);
}
#endif /* CONFIG_SMP */
#ifdef CONFIG_SMP
/*
* in 2.6, interrupts are masked when we come here and the runqueue lock is held
*/
void
pfm_load_regs (struct task_struct *task)
{
pfm_context_t *ctx;
unsigned long pmc_mask = 0UL, pmd_mask = 0UL;
unsigned long flags;
u64 psr, psr_up;
int need_irq_resend;
ctx = PFM_GET_CTX(task);
if (unlikely(ctx == NULL)) return;
BUG_ON(GET_PMU_OWNER());
/*
* possible on unload
*/
if (unlikely((task->thread.flags & IA64_THREAD_PM_VALID) == 0)) return;
/*
* we always come here with interrupts ALREADY disabled by
* the scheduler. So we simply need to protect against concurrent
* access, not CPU concurrency.
*/
flags = pfm_protect_ctx_ctxsw(ctx);
psr = pfm_get_psr();
need_irq_resend = pmu_conf->flags & PFM_PMU_IRQ_RESEND;
BUG_ON(psr & (IA64_PSR_UP|IA64_PSR_PP));
BUG_ON(psr & IA64_PSR_I);
if (unlikely(ctx->ctx_state == PFM_CTX_ZOMBIE)) {
struct pt_regs *regs = task_pt_regs(task);
BUG_ON(ctx->ctx_smpl_hdr);
pfm_force_cleanup(ctx, regs);
pfm_unprotect_ctx_ctxsw(ctx, flags);
/*
* this one (kmalloc'ed) is fine with interrupts disabled
*/
pfm_context_free(ctx);
return;
}
/*
* we restore ALL the debug registers to avoid picking up
* stale state.
*/
if (ctx->ctx_fl_using_dbreg) {
pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
}
/*
* retrieve saved psr.up
*/
psr_up = ctx->ctx_saved_psr_up;
/*
* if we were the last user of the PMU on that CPU,
* then nothing to do except restore psr
*/
if (GET_LAST_CPU(ctx) == smp_processor_id() && ctx->ctx_last_activation == GET_ACTIVATION()) {
/*
* retrieve partial reload masks (due to user modifications)
*/
pmc_mask = ctx->ctx_reload_pmcs[0];
pmd_mask = ctx->ctx_reload_pmds[0];
} else {
/*
* To avoid leaking information to the user level when psr.sp=0,
* we must reload ALL implemented pmds (even the ones we don't use).
* In the kernel we only allow PFM_READ_PMDS on registers which
* we initialized or requested (sampling) so there is no risk there.
*/
pmd_mask = pfm_sysctl.fastctxsw ? ctx->ctx_used_pmds[0] : ctx->ctx_all_pmds[0];
/*
* ALL accessible PMCs are systematically reloaded, unused registers
* get their default (from pfm_reset_pmu_state()) values to avoid picking
* up stale configuration.
*
* PMC0 is never in the mask. It is always restored separately.
*/
pmc_mask = ctx->ctx_all_pmcs[0];
}
/*
* when context is MASKED, we will restore PMC with plm=0
* and PMD with stale information, but that's ok, nothing
* will be captured.
*
* XXX: optimize here
*/
if (pmd_mask) pfm_restore_pmds(ctx->th_pmds, pmd_mask);
if (pmc_mask) pfm_restore_pmcs(ctx->th_pmcs, pmc_mask);
/*
* check for pending overflow at the time the state
* was saved.
*/
if (unlikely(PMC0_HAS_OVFL(ctx->th_pmcs[0]))) {
/*
* reload pmc0 with the overflow information
* On McKinley PMU, this will trigger a PMU interrupt
*/
ia64_set_pmc(0, ctx->th_pmcs[0]);
ia64_srlz_d();
ctx->th_pmcs[0] = 0UL;
/*
* will replay the PMU interrupt
*/
if (need_irq_resend) ia64_resend_irq(IA64_PERFMON_VECTOR);
pfm_stats[smp_processor_id()].pfm_replay_ovfl_intr_count++;
}
/*
* we just did a reload, so we reset the partial reload fields
*/
ctx->ctx_reload_pmcs[0] = 0UL;
ctx->ctx_reload_pmds[0] = 0UL;
SET_LAST_CPU(ctx, smp_processor_id());
/*
* dump activation value for this PMU
*/
INC_ACTIVATION();
/*
* record current activation for this context
*/
SET_ACTIVATION(ctx);
/*
* establish new ownership.
*/
SET_PMU_OWNER(task, ctx);
/*
* restore the psr.up bit. measurement
* is active again.
* no PMU interrupt can happen at this point
* because we still have interrupts disabled.
*/
if (likely(psr_up)) pfm_set_psr_up();
/*
* allow concurrent access to context
*/
pfm_unprotect_ctx_ctxsw(ctx, flags);
}
#else /* !CONFIG_SMP */
/*
* reload PMU state for UP kernels
* in 2.5 we come here with interrupts disabled
*/
void
pfm_load_regs (struct task_struct *task)
{
pfm_context_t *ctx;
struct task_struct *owner;
unsigned long pmd_mask, pmc_mask;
u64 psr, psr_up;
int need_irq_resend;
owner = GET_PMU_OWNER();
ctx = PFM_GET_CTX(task);
psr = pfm_get_psr();
BUG_ON(psr & (IA64_PSR_UP|IA64_PSR_PP));
BUG_ON(psr & IA64_PSR_I);
/*
* we restore ALL the debug registers to avoid picking up
* stale state.
*
* This must be done even when the task is still the owner
* as the registers may have been modified via ptrace()
* (not perfmon) by the previous task.
*/
if (ctx->ctx_fl_using_dbreg) {
pfm_restore_ibrs(ctx->ctx_ibrs, pmu_conf->num_ibrs);
pfm_restore_dbrs(ctx->ctx_dbrs, pmu_conf->num_dbrs);
}
/*
* retrieved saved psr.up
*/
psr_up = ctx->ctx_saved_psr_up;
need_irq_resend = pmu_conf->flags & PFM_PMU_IRQ_RESEND;
/*
* short path, our state is still there, just
* need to restore psr and we go
*
* we do not touch either PMC nor PMD. the psr is not touched
* by the overflow_handler. So we are safe w.r.t. to interrupt
* concurrency even without interrupt masking.
*/
if (likely(owner == task)) {
if (likely(psr_up)) pfm_set_psr_up();
return;
}
/*
* someone else is still using the PMU, first push it out and
* then we'll be able to install our stuff !
*
* Upon return, there will be no owner for the current PMU
*/
if (owner) pfm_lazy_save_regs(owner);
/*
* To avoid leaking information to the user level when psr.sp=0,
* we must reload ALL implemented pmds (even the ones we don't use).
* In the kernel we only allow PFM_READ_PMDS on registers which
* we initialized or requested (sampling) so there is no risk there.
*/
pmd_mask = pfm_sysctl.fastctxsw ? ctx->ctx_used_pmds[0] : ctx->ctx_all_pmds[0];
/*
* ALL accessible PMCs are systematically reloaded, unused registers
* get their default (from pfm_reset_pmu_state()) values to avoid picking
* up stale configuration.
*
* PMC0 is never in the mask. It is always restored separately
*/
pmc_mask = ctx->ctx_all_pmcs[0];
pfm_restore_pmds(ctx->th_pmds, pmd_mask);
pfm_restore_pmcs(ctx->th_pmcs, pmc_mask);
/*
* check for pending overflow at the time the state
* was saved.
*/
if (unlikely(PMC0_HAS_OVFL(ctx->th_pmcs[0]))) {
/*
* reload pmc0 with the overflow information
* On McKinley PMU, this will trigger a PMU interrupt
*/
ia64_set_pmc(0, ctx->th_pmcs[0]);
ia64_srlz_d();
ctx->th_pmcs[0] = 0UL;
/*
* will replay the PMU interrupt
*/
if (need_irq_resend) ia64_resend_irq(IA64_PERFMON_VECTOR);
pfm_stats[smp_processor_id()].pfm_replay_ovfl_intr_count++;
}
/*
* establish new ownership.
*/
SET_PMU_OWNER(task, ctx);
/*
* restore the psr.up bit. measurement
* is active again.
* no PMU interrupt can happen at this point
* because we still have interrupts disabled.
*/
if (likely(psr_up)) pfm_set_psr_up();
}
#endif /* CONFIG_SMP */
/*
* this function assumes monitoring is stopped
*/
static void
pfm_flush_pmds(struct task_struct *task, pfm_context_t *ctx)
{
u64 pmc0;
unsigned long mask2, val, pmd_val, ovfl_val;
int i, can_access_pmu = 0;
int is_self;
/*
* is the caller the task being monitored (or which initiated the
* session for system wide measurements)
*/
is_self = ctx->ctx_task == task ? 1 : 0;
/*
* can access PMU is task is the owner of the PMU state on the current CPU
* or if we are running on the CPU bound to the context in system-wide mode
* (that is not necessarily the task the context is attached to in this mode).
* In system-wide we always have can_access_pmu true because a task running on an
* invalid processor is flagged earlier in the call stack (see pfm_stop).
*/
can_access_pmu = (GET_PMU_OWNER() == task) || (ctx->ctx_fl_system && ctx->ctx_cpu == smp_processor_id());
if (can_access_pmu) {
/*
* Mark the PMU as not owned
* This will cause the interrupt handler to do nothing in case an overflow
* interrupt was in-flight
* This also guarantees that pmc0 will contain the final state
* It virtually gives us full control on overflow processing from that point
* on.
*/
SET_PMU_OWNER(NULL, NULL);
DPRINT(("releasing ownership\n"));
/*
* read current overflow status:
*
* we are guaranteed to read the final stable state
*/
ia64_srlz_d();
pmc0 = ia64_get_pmc(0); /* slow */
/*
* reset freeze bit, overflow status information destroyed
*/
pfm_unfreeze_pmu();
} else {
pmc0 = ctx->th_pmcs[0];
/*
* clear whatever overflow status bits there were
*/
ctx->th_pmcs[0] = 0;
}
ovfl_val = pmu_conf->ovfl_val;
/*
* we save all the used pmds
* we take care of overflows for counting PMDs
*
* XXX: sampling situation is not taken into account here
*/
mask2 = ctx->ctx_used_pmds[0];
DPRINT(("is_self=%d ovfl_val=0x%lx mask2=0x%lx\n", is_self, ovfl_val, mask2));
for (i = 0; mask2; i++, mask2>>=1) {
/* skip non used pmds */
if ((mask2 & 0x1) == 0) continue;
/*
* can access PMU always true in system wide mode
*/
val = pmd_val = can_access_pmu ? ia64_get_pmd(i) : ctx->th_pmds[i];
if (PMD_IS_COUNTING(i)) {
DPRINT(("[%d] pmd[%d] ctx_pmd=0x%lx hw_pmd=0x%lx\n",
task_pid_nr(task),
i,
ctx->ctx_pmds[i].val,
val & ovfl_val));
/*
* we rebuild the full 64 bit value of the counter
*/
val = ctx->ctx_pmds[i].val + (val & ovfl_val);
/*
* now everything is in ctx_pmds[] and we need
* to clear the saved context from save_regs() such that
* pfm_read_pmds() gets the correct value
*/
pmd_val = 0UL;
/*
* take care of overflow inline
*/
if (pmc0 & (1UL << i)) {
val += 1 + ovfl_val;
DPRINT(("[%d] pmd[%d] overflowed\n", task_pid_nr(task), i));
}
}
DPRINT(("[%d] ctx_pmd[%d]=0x%lx pmd_val=0x%lx\n", task_pid_nr(task), i, val, pmd_val));
if (is_self) ctx->th_pmds[i] = pmd_val;
ctx->ctx_pmds[i].val = val;
}
}
static struct irqaction perfmon_irqaction = {
.handler = pfm_interrupt_handler,
.flags = IRQF_DISABLED,
.name = "perfmon"
};
static void
pfm_alt_save_pmu_state(void *data)
{
struct pt_regs *regs;
regs = task_pt_regs(current);
DPRINT(("called\n"));
/*
* should not be necessary but
* let's take not risk
*/
pfm_clear_psr_up();
pfm_clear_psr_pp();
ia64_psr(regs)->pp = 0;
/*
* This call is required
* May cause a spurious interrupt on some processors
*/
pfm_freeze_pmu();
ia64_srlz_d();
}
void
pfm_alt_restore_pmu_state(void *data)
{
struct pt_regs *regs;
regs = task_pt_regs(current);
DPRINT(("called\n"));
/*
* put PMU back in state expected
* by perfmon
*/
pfm_clear_psr_up();
pfm_clear_psr_pp();
ia64_psr(regs)->pp = 0;
/*
* perfmon runs with PMU unfrozen at all times
*/
pfm_unfreeze_pmu();
ia64_srlz_d();
}
int
pfm_install_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
{
int ret, i;
int reserve_cpu;
/* some sanity checks */
if (hdl == NULL || hdl->handler == NULL) return -EINVAL;
/* do the easy test first */
if (pfm_alt_intr_handler) return -EBUSY;
/* one at a time in the install or remove, just fail the others */
if (!spin_trylock(&pfm_alt_install_check)) {
return -EBUSY;
}
/* reserve our session */
for_each_online_cpu(reserve_cpu) {
ret = pfm_reserve_session(NULL, 1, reserve_cpu);
if (ret) goto cleanup_reserve;
}
/* save the current system wide pmu states */
ret = on_each_cpu(pfm_alt_save_pmu_state, NULL, 1);
if (ret) {
DPRINT(("on_each_cpu() failed: %d\n", ret));
goto cleanup_reserve;
}
/* officially change to the alternate interrupt handler */
pfm_alt_intr_handler = hdl;
spin_unlock(&pfm_alt_install_check);
return 0;
cleanup_reserve:
for_each_online_cpu(i) {
/* don't unreserve more than we reserved */
if (i >= reserve_cpu) break;
pfm_unreserve_session(NULL, 1, i);
}
spin_unlock(&pfm_alt_install_check);
return ret;
}
EXPORT_SYMBOL_GPL(pfm_install_alt_pmu_interrupt);
int
pfm_remove_alt_pmu_interrupt(pfm_intr_handler_desc_t *hdl)
{
int i;
int ret;
if (hdl == NULL) return -EINVAL;
/* cannot remove someone else's handler! */
if (pfm_alt_intr_handler != hdl) return -EINVAL;
/* one at a time in the install or remove, just fail the others */
if (!spin_trylock(&pfm_alt_install_check)) {
return -EBUSY;
}
pfm_alt_intr_handler = NULL;
ret = on_each_cpu(pfm_alt_restore_pmu_state, NULL, 1);
if (ret) {
DPRINT(("on_each_cpu() failed: %d\n", ret));
}
for_each_online_cpu(i) {
pfm_unreserve_session(NULL, 1, i);
}
spin_unlock(&pfm_alt_install_check);
return 0;
}
EXPORT_SYMBOL_GPL(pfm_remove_alt_pmu_interrupt);
/*
* perfmon initialization routine, called from the initcall() table
*/
static int init_pfm_fs(void);
static int __init
pfm_probe_pmu(void)
{
pmu_config_t **p;
int family;
family = local_cpu_data->family;
p = pmu_confs;
while(*p) {
if ((*p)->probe) {
if ((*p)->probe() == 0) goto found;
} else if ((*p)->pmu_family == family || (*p)->pmu_family == 0xff) {
goto found;
}
p++;
}
return -1;
found:
pmu_conf = *p;
return 0;
}
static const struct file_operations pfm_proc_fops = {
.open = pfm_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
int __init
pfm_init(void)
{
unsigned int n, n_counters, i;
printk("perfmon: version %u.%u IRQ %u\n",
PFM_VERSION_MAJ,
PFM_VERSION_MIN,
IA64_PERFMON_VECTOR);
if (pfm_probe_pmu()) {
printk(KERN_INFO "perfmon: disabled, there is no support for processor family %d\n",
local_cpu_data->family);
return -ENODEV;
}
/*
* compute the number of implemented PMD/PMC from the
* description tables
*/
n = 0;
for (i=0; PMC_IS_LAST(i) == 0; i++) {
if (PMC_IS_IMPL(i) == 0) continue;
pmu_conf->impl_pmcs[i>>6] |= 1UL << (i&63);
n++;
}
pmu_conf->num_pmcs = n;
n = 0; n_counters = 0;
for (i=0; PMD_IS_LAST(i) == 0; i++) {
if (PMD_IS_IMPL(i) == 0) continue;
pmu_conf->impl_pmds[i>>6] |= 1UL << (i&63);
n++;
if (PMD_IS_COUNTING(i)) n_counters++;
}
pmu_conf->num_pmds = n;
pmu_conf->num_counters = n_counters;
/*
* sanity checks on the number of debug registers
*/
if (pmu_conf->use_rr_dbregs) {
if (pmu_conf->num_ibrs > IA64_NUM_DBG_REGS) {
printk(KERN_INFO "perfmon: unsupported number of code debug registers (%u)\n", pmu_conf->num_ibrs);
pmu_conf = NULL;
return -1;
}
if (pmu_conf->num_dbrs > IA64_NUM_DBG_REGS) {
printk(KERN_INFO "perfmon: unsupported number of data debug registers (%u)\n", pmu_conf->num_ibrs);
pmu_conf = NULL;
return -1;
}
}
printk("perfmon: %s PMU detected, %u PMCs, %u PMDs, %u counters (%lu bits)\n",
pmu_conf->pmu_name,
pmu_conf->num_pmcs,
pmu_conf->num_pmds,
pmu_conf->num_counters,
ffz(pmu_conf->ovfl_val));
/* sanity check */
if (pmu_conf->num_pmds >= PFM_NUM_PMD_REGS || pmu_conf->num_pmcs >= PFM_NUM_PMC_REGS) {
printk(KERN_ERR "perfmon: not enough pmc/pmd, perfmon disabled\n");
pmu_conf = NULL;
return -1;
}
/*
* create /proc/perfmon (mostly for debugging purposes)
*/
perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops);
if (perfmon_dir == NULL) {
printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n");
pmu_conf = NULL;
return -1;
}
/*
* create /proc/sys/kernel/perfmon (for debugging purposes)
*/
pfm_sysctl_header = register_sysctl_table(pfm_sysctl_root);
/*
* initialize all our spinlocks
*/
spin_lock_init(&pfm_sessions.pfs_lock);
spin_lock_init(&pfm_buffer_fmt_lock);
init_pfm_fs();
for(i=0; i < NR_CPUS; i++) pfm_stats[i].pfm_ovfl_intr_cycles_min = ~0UL;
return 0;
}
__initcall(pfm_init);
/*
* this function is called before pfm_init()
*/
void
pfm_init_percpu (void)
{
static int first_time=1;
/*
* make sure no measurement is active
* (may inherit programmed PMCs from EFI).
*/
pfm_clear_psr_pp();
pfm_clear_psr_up();
/*
* we run with the PMU not frozen at all times
*/
pfm_unfreeze_pmu();
if (first_time) {
register_percpu_irq(IA64_PERFMON_VECTOR, &perfmon_irqaction);
first_time=0;
}
ia64_setreg(_IA64_REG_CR_PMV, IA64_PERFMON_VECTOR);
ia64_srlz_d();
}
/*
* used for debug purposes only
*/
void
dump_pmu_state(const char *from)
{
struct task_struct *task;
struct pt_regs *regs;
pfm_context_t *ctx;
unsigned long psr, dcr, info, flags;
int i, this_cpu;
local_irq_save(flags);
this_cpu = smp_processor_id();
regs = task_pt_regs(current);
info = PFM_CPUINFO_GET();
dcr = ia64_getreg(_IA64_REG_CR_DCR);
if (info == 0 && ia64_psr(regs)->pp == 0 && (dcr & IA64_DCR_PP) == 0) {
local_irq_restore(flags);
return;
}
printk("CPU%d from %s() current [%d] iip=0x%lx %s\n",
this_cpu,
from,
task_pid_nr(current),
regs->cr_iip,
current->comm);
task = GET_PMU_OWNER();
ctx = GET_PMU_CTX();
printk("->CPU%d owner [%d] ctx=%p\n", this_cpu, task ? task_pid_nr(task) : -1, ctx);
psr = pfm_get_psr();
printk("->CPU%d pmc0=0x%lx psr.pp=%d psr.up=%d dcr.pp=%d syst_info=0x%lx user_psr.up=%d user_psr.pp=%d\n",
this_cpu,
ia64_get_pmc(0),
psr & IA64_PSR_PP ? 1 : 0,
psr & IA64_PSR_UP ? 1 : 0,
dcr & IA64_DCR_PP ? 1 : 0,
info,
ia64_psr(regs)->up,
ia64_psr(regs)->pp);
ia64_psr(regs)->up = 0;
ia64_psr(regs)->pp = 0;
for (i=1; PMC_IS_LAST(i) == 0; i++) {
if (PMC_IS_IMPL(i) == 0) continue;
printk("->CPU%d pmc[%d]=0x%lx thread_pmc[%d]=0x%lx\n", this_cpu, i, ia64_get_pmc(i), i, ctx->th_pmcs[i]);
}
for (i=1; PMD_IS_LAST(i) == 0; i++) {
if (PMD_IS_IMPL(i) == 0) continue;
printk("->CPU%d pmd[%d]=0x%lx thread_pmd[%d]=0x%lx\n", this_cpu, i, ia64_get_pmd(i), i, ctx->th_pmds[i]);
}
if (ctx) {
printk("->CPU%d ctx_state=%d vaddr=%p addr=%p fd=%d ctx_task=[%d] saved_psr_up=0x%lx\n",
this_cpu,
ctx->ctx_state,
ctx->ctx_smpl_vaddr,
ctx->ctx_smpl_hdr,
ctx->ctx_msgq_head,
ctx->ctx_msgq_tail,
ctx->ctx_saved_psr_up);
}
local_irq_restore(flags);
}
/*
* called from process.c:copy_thread(). task is new child.
*/
void
pfm_inherit(struct task_struct *task, struct pt_regs *regs)
{
struct thread_struct *thread;
DPRINT(("perfmon: pfm_inherit clearing state for [%d]\n", task_pid_nr(task)));
thread = &task->thread;
/*
* cut links inherited from parent (current)
*/
thread->pfm_context = NULL;
PFM_SET_WORK_PENDING(task, 0);
/*
* the psr bits are already set properly in copy_threads()
*/
}
#else /* !CONFIG_PERFMON */
asmlinkage long
sys_perfmonctl (int fd, int cmd, void *arg, int count)
{
return -ENOSYS;
}
#endif /* CONFIG_PERFMON */
| Java |
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
given "a message exists" do
Message.all.destroy!
request(resource(:messages), :method => "POST",
:params => { :message => { :id => nil }})
end
describe "resource(:messages)" do
describe "GET" do
before(:each) do
@response = request(resource(:messages))
end
it "responds successfully" do
@response.should be_successful
end
it "contains a list of messages" do
pending
@response.should have_xpath("//ul")
end
end
describe "GET", :given => "a message exists" do
before(:each) do
@response = request(resource(:messages))
end
it "has a list of messages" do
pending
@response.should have_xpath("//ul/li")
end
end
describe "a successful POST" do
before(:each) do
Message.all.destroy!
@response = request(resource(:messages), :method => "POST",
:params => { :message => { :id => nil }})
end
it "redirects to resource(:messages)" do
@response.should redirect_to(resource(Message.first), :message => {:notice => "message was successfully created"})
end
end
end
describe "resource(@message)" do
describe "a successful DELETE", :given => "a message exists" do
before(:each) do
@response = request(resource(Message.first), :method => "DELETE")
end
it "should redirect to the index action" do
@response.should redirect_to(resource(:messages))
end
end
end
describe "resource(:messages, :new)" do
before(:each) do
@response = request(resource(:messages, :new))
end
it "responds successfully" do
@response.should be_successful
end
end
describe "resource(@message, :edit)", :given => "a message exists" do
before(:each) do
@response = request(resource(Message.first, :edit))
end
it "responds successfully" do
@response.should be_successful
end
end
describe "resource(@message)", :given => "a message exists" do
describe "GET" do
before(:each) do
@response = request(resource(Message.first))
end
it "responds successfully" do
@response.should be_successful
end
end
describe "PUT" do
before(:each) do
@message = Message.first
@response = request(resource(@message), :method => "PUT",
:params => { :message => {:id => @message.id} })
end
it "redirect to the article show action" do
@response.should redirect_to(resource(@message))
end
end
end
| Java |
<?php
if (isset($_POST['_wpcf7_mail_sent'])) {
$expire=time()+60*60*24*30*2;
setcookie("surveySent2", "true", $expire, '/');
}
/*************
!!!!!!!IMPORTANT!!!!!!!!
If you change the styles then edit the stylesheet querystring here!
*************/
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link rel="stylesheet" href="/wp-content/themes/aparatus/css.php?a=16" type="text/css" media="screen" />
<?php global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] );
}
} ?>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<!--[if gte IE 7]>
<link href="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_directory')); ?>/forie8.css" rel="stylesheet" type="text/css" media="screen" title="no title" charset="utf-8"/>
<![endif]-->
<!--[if lt IE 7]>
<link href="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_directory')); ?>/forie6.css" rel="stylesheet" type="text/css" media="screen" title="no title" charset="utf-8"/>
<![endif]-->
<!--[if IE 7]>
<link href="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_directory')); ?>/forie7.css" rel="stylesheet" type="text/css" media="screen" title="no title" charset="utf-8"/>
<![endif]-->
<!--Css SmoothGallery-->
<link rel="stylesheet" href="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_url')); ?>/gallery-css/jd.gallery.css" type="text/css" media="screen"/>
<?php wp_enqueue_script("jquery"); ?>
<script type="text/javascript" src="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_url')); ?>/scripts/mootools.js"></script>
<script type="text/javascript" src="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_url')); ?>/scripts/jd.gallery.js"></script>
<script type="text/javascript" src="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_url')); ?>/scripts/mootabs1.2.js"></script>
<script type="text/javascript" src="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_url'));; ?>/scripts/cufon-yui.js"></script>
<script type="text/javascript" src="<?php echo str_replace("http://www.thephotographyparlour.com/","/",get_bloginfo('template_url')); ?>/scripts/League_Gothic_400.font.js"></script>
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
<script type="text/javascript">/*<![CDATA[*/Cufon.replace('a#logo',{fontSize:'98px',lineHeight:'98px'});/*]]>*/</script>
<script type="text/javascript">/*<![CDATA[*/
jQuery(document).ready(function () {
jQuery('#nav2 ul li').each(function (i) {
jQuery(this).mouseenter(function () {
jQuery(this).addClass("sfhover");
});
jQuery(this).mouseleave(function () {
jQuery(this).removeClass("sfhover");
});
});
});
<?php /* old code
<?php } else { ?>
sfHover = function() {
var sfEls = document.getElementById("nav2").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhoverb"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
<?php } ?>
<?php */ ?>
/*]]>*/
</script>
<script type="text/javascript" charset="utf-8">/*<![CDATA[*/
window.addEvent('domready', init);
function init() {
myTabs1 = new mootabs('myTabs', {height: '320px', width: '300px', changeTransition: Fx.Transitions.Back.easeOut, mouseOverClass: 'over'});
}
/*]]>*/</script>
<meta name="google-site-verification" content="QlCldWYkiMZwNFqnwTJ-dPgrwhlKK7S8VXQniIfqoD8" />
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
<?php wp_head();flush(); ?>
</head>
<body>
<div class="bodywrapper">
<div id="header"><?php
/** header **/
?><div id="twitter-badge"><a href="http://twitter.com/<?php if ($apa_Twitter == ''){echo '_fearlessflyer';}else{echo $apa_Twitter;} ?>" onclick="pageTracker._trackEvent('Twitter', 'Follow me');" >follow</a></div><!--twitter-badge-->
<?php if (is_front_page()) { ?><h1><?php } ?><a id="logo" href="<?php bloginfo('url');?>"><?php bloginfo('name');?></a><?php if (is_front_page()) { ?></h1><?php } ?>
<?php if (is_front_page()) { ?><h2 style="float:left;margin:-20px 0 10px 10px;font-family:verdana,arial,helvetica;font-size:10px;font-weight:bold;">Where aspiring photographers <span style="font-size:11px;font-style:italic;color:#750000">click</span> with the pros</h2><?php } else { ?>
<p style="float:left;margin:-20px 0 10px 10px;font-family:verdana,arial,helvetica;font-size:10px;font-weight:bold;">Where aspiring photographers <span style="color:#750000;font-style:italic;font-size:11px;">click</span> with the pros</p>
<?php } ?>
<div id="navigation">
<div id="page-nav">
<ul>
<li id="welcome" class="current_page_item2"><a href="<?php bloginfo('url');?>" title="Home">Welcome</a></li>
<li class="cat-item cat-page<?php if (is_page('2')) { ?> current-cat<?php } ?>"><a href="/about/" title="About the Photography Parlour">About</a></li>
<li class="cat-item cat-page"><a href="/forum/" title="photography forum">Forum</a></li>
<li class="cat-item cat-page"><a href="/shop/" title="photography shop">Shop</a></li>
<li class="cat-item cat-page"><a href="/info-for-advertisers/" title="photography Advertising Information">Advertise</a></li>
<li class="cat-item cat-page"><a href="/media-center/" title="Photography Media Center">Media Center</a></li>
<li class="cat-item cat-page"><a href="/2010/05/contribute-to-the-photography-parlour/1937" title="Contribute to The Photography Parlour">Contribute</a></li>
<li class="cat-item cat-page"><a href="/contact/" title="contact the photography parlour team">Contact</a></li>
</ul>
<span id="login"><?php /* <a href="<?php echo get_option('home'); ?>/wp-admin/">Login to Site</a>
<a href="/info-for-advertisers/" title="Information for Advertisers">Advertising Info</a>*/ ?>
<a href="http://www.twitter.com/photoparlour/" onclick="pageTracker._trackEvent('Twitter', 'twitter sign up');" title="follow us on twitter" class="toptwitter"></a><a href="http://www.facebook.com/thephotographyparlour/" title="follow us on facebook" class="topfacebook" onclick="pageTracker._trackEvent('facebook', 'facebook sign up');"></a>
<a class="rss" href="http://feeds.feedburner.com/thephotographyparlour" onclick="pageTracker._trackEvent('RSS', 'RSS FEED sign up');"></a>
</span>
</div><!--page-nav-->
<script type="text/javascript">/*<![CDATA[*/Cufon.now();/*]]>*/</script>
<div id="cat-nav">
<ul id="nav2">
<?php wp_list_categories('title_li=&sort_column=menu_order&exclude=1,114,115');?>
</ul>
</div><!--cat-nav-->
</div><!--navigation-->
</div><!--header-->
<div id="wrap">
<?php
Forumticker();
| Java |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
/// <summary>
/// An AND gate class to store the correct image and
/// calculate the appropriate output
/// </summary>
public class AndGate : Gate
{
/// <summary>
/// Constructor
/// </summary>
public AndGate()
{
this.Input = new InputPoint[2];
this.Input[0] = new InputPoint(-45, -9, 10, this);
this.Input[1] = new InputPoint(-45, 8, 10, this);
this.Output = new OutputPoint(44, 0, 20, this);
this.Img[0] = CircuitSimLib.Properties.Resources.and;
}
/// <summary>
/// Calculates the output for an AND gate
/// </summary>
/// <returns>Returns a calculated int</returns>
public override bool CalculateOutput()
{
return Input[0].ConnectedElementsOutput() && Input[1].ConnectedElementsOutput();
}
}
| Java |
<?php
$social_channels = $view_data['settings']['right_tab']['social_channels'];
$bar_layout_design = $view_data['settings']['right_tab']['bar_layout_design'];
$call_to_action = $view_data['settings']['right_tab']['call_to_action'];
$visibility_settings = $view_data['settings']['right_tab']['visibility_settings'];
$channels = array(
'Facebook'=>'Facebook',
'Twitter'=>'Twitter',
'Google'=>'Google',
'Linkedin'=>'Linkedin',
'Pinterest'=>'Pinterest',
'Digg'=>'Digg',
'Myspace'=>'Myspace',
'Stumbleupon'=>'Stumbleupon',
'Bebo'=>'Bebo',
'Blogger'=>'Blogger',
'Delicious'=>'Delicious',
'Xing'=>'Xing',
'Tumblr'=>'Tumblr',
'Technorati'=>'Technorati',
'Reddit'=>'Reddit',
'Netlog'=>'Netlog',
'Identi'=>'Identi',
'Friendfeed'=>'Friendfeed',
'Evernote'=>'Evernote',
'Diigo'=>'Diigo',
'VK'=>'VK',
'Email'=>'Email',
);
?>
<div id="right_tab_social_channels" class="modal widget-settings" tabindex="-1" role="dialog" aria-labelledby="registerShareLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><?php echo $social_channels['settings_category']; ?></h3>
</div>
<div class="modal-body">
<div class="drag-links row">
<div class="col-md-5">
<h5>Active channels</h5>
<form class="form-horizontal" id="social-channels-right_tab" novalidate="novalidate" title="<?php echo $social_channels['settings_category']; ?>">
<ul id="socialsuse" class="connected list" style="margin:0;">
<?php
$socials = explode(',', $social_channels['socials']);
foreach($socials as $social){
echo '<li class="'.$social.'"><div class="share-icns"></div><span>'.$social.'</span><input type="hidden" id="socials" name="options[socials][]" value="'.$social.'" /></li>';
unset($channels["{$social}"]);
}
?>
</ul>
<div class="form-group" id="socials_target-group" style="margin-top: 20px;">
<h5>Open channel sharing in</h5>
<select class="selectpicker form-control" name="options[socials_target]" id="socials_target" data-style="btn-default">
<option value="window" <?php echo($social_channels['socials_target'] == 'window')? 'selected': ''; ?>>New window</option>
<option value="tab" <?php echo($social_channels['socials_target'] == 'tab')? 'selected': ''; ?>>New tab</option>
</select>
</div>
</form>
</div>
<div class="col-md-1">
<div class="between-connected">Drag to activate <span class="appz-point-left"></span></div>
</div>
<div class="col-md-5">
<h5>Inactive channels</h5>
<ul class="connected list no2" style="margin:0;">
<?php
foreach($channels as $channel){
echo '<li class="'.$channel.'"><div class="share-icns"></div><span>'.$channel.'</span><input type="hidden" id="socials" name="options[socials][]" value="'.$channel.'" /></li>';
}
?>
</ul>
</div>
</div>
<div style="clear:both;"></div>
</div>
<div class="modal-footer">
<button class="btn btn-icon btn-default circle_remove" data-dismiss="modal" aria-hidden="true"><i class="appz-close-3"></i> Close</button>
<button type="submit" class="btn btn-icon btn-primary circle_ok save-widget-settings" settings="#social-channels-right_tab" layout="right_tab" data-loading-text="loading..."><i class="appz-checkmark-circle-2"></i> Save</button>
</div>
</div>
</div>
</div><!--/Social Channels Settings-->
<div id="right_tab_bar_layout_design" class="modal widget-settings" tabindex="-1" role="dialog" aria-labelledby="registerShareLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><?php echo $bar_layout_design['settings_category']; ?></h3>
</div>
<div class="modal-body">
<form class="form-horizontal" id="bar-layout-right_tab" novalidate="novalidate" title="<?php echo $bar_layout_design['settings_category']; ?>">
<div class="row">
<div class="col-md-6">
<div class="form-group" id="bgcolor-group">
<h5>Background color</h5>
<div class="input-group">
<input type="text" id="bgcolor-right_tab" name="options[bgcolor]" value="<?php echo $bar_layout_design['bgcolor']; ?>" class="form-control"/>
<span class="input-group-btn">
<button href="javascript:void(0)" class="btn undo-color" target="#bgcolor-right_tab" original="<?php echo $bar_layout_design['bgcolor']; ?>"><i class="appz-undo"></i> Undo</button>
</span>
</div>
<br/><br/>
<div class="palette" target="#bgcolor-right_tab"></div>
</div>
<div class="form-group span11" id="icons-group">
<h5>Icons style</h5>
<select style="width: 100%;" id="icons" name="options[icons]" class="select-icons" layout="right_tab">
<option value="white" <?php echo($bar_layout_design['icons'] == 'white')? 'selected': ''; ?>>White</option>
<option value="black" <?php echo($bar_layout_design['icons'] == 'black')? 'selected': ''; ?>>Black</option>
<option value="icons" <?php echo($bar_layout_design['icons'] == 'icons')? 'selected': ''; ?>>Shiny</option>
<option value="variety" <?php echo($bar_layout_design['icons'] == 'variety')? 'selected': ''; ?>>Variety</option>
<option value="satin" <?php echo($bar_layout_design['icons'] == 'satin')? 'selected': ''; ?>>Satin</option>
<option value="shiny2" <?php echo($bar_layout_design['icons'] == 'shiny2')? 'selected': ''; ?>>Shiny 2</option>
<option value="elegant" <?php echo($bar_layout_design['icons'] == 'elegant')? 'selected': ''; ?>>Elegant</option>
<option value="metro" <?php echo($bar_layout_design['icons'] == 'metro')? 'selected': ''; ?>>Metro</option>
<option value="milky" <?php echo($bar_layout_design['icons'] == 'milky')? 'selected': ''; ?>>Milky</option>
<option value="bald" <?php echo($bar_layout_design['icons'] == 'bald')? 'selected': ''; ?>>Bald</option>
<option value="round" <?php echo($bar_layout_design['icons'] == 'round')? 'selected': ''; ?>>Round</option>
</select>
</div>
<div class="form-group" id="toolstyle-group">
<h5>Tooltip style</h5>
<select class="selectpicker form-control" name="options[toolstyle]" id="toolstyle" data-style="btn-default">
<option value="darkminimal" <?php echo($bar_layout_design['toolstyle'] == 'darkminimal')? 'selected': ''; ?>>Dark minimal</option>
<option value="lightminimal" <?php echo($bar_layout_design['toolstyle'] == 'lightminimal')? 'selected': ''; ?>>Light minimal</option>
<option value="darkgray" <?php echo($bar_layout_design['toolstyle'] == 'darkgray')? 'selected': ''; ?>>Dark gray</option>
</select>
</div>
</div><!--/span6-->
<div class="col-md-6">
<div class="form-group" id="textcolor-group">
<h5>Text color</h5>
<div class="input-group">
<input type="text" id="textcolor-right_tab" name="options[textcolor]" value="<?php echo $bar_layout_design['textcolor']; ?>" class="form-control"/>
<span class="input-group-btn">
<button href="javascript:void(0)" class="btn undo-color" target="#textcolor-right_tab" original="<?php echo $bar_layout_design['textcolor']; ?>"><i class="appz-undo"></i> Undo</button>
</span>
</div>
<br/><br/>
<div class="palette" target="#textcolor-right_tab"></div>
</div>
<div class="form-group" id="position-group">
<h5>Bar position</h5>
<select class="selectpicker form-control" name="options[position]" id="position" data-style="btn-default">
<option value="center" <?php echo($bar_layout_design['position'] == 'center')? 'selected': ''; ?>>Center</option>
<option value="top" <?php echo($bar_layout_design['position'] == 'top')? 'selected': ''; ?>>Top</option>
<option value="bottom" <?php echo($bar_layout_design['position'] == 'bottom')? 'selected': ''; ?>>Bottom</option>
</select>
</div>
</div><!--/span6-->
</div><!--/row-->
</form>
</div>
<div class="modal-footer">
<button class="btn btn-icon btn-default circle_remove" data-dismiss="modal" aria-hidden="true"><i class="appz-close-3"></i> Close</button>
<button type="submit" class="btn btn-icon btn-primary circle_ok save-widget-settings" settings="#bar-layout-right_tab" layout="right_tab" data-loading-text="loading..."><i class="appz-checkmark-circle-2"></i> Save</button>
</div>
</div>
</div>
</div><!--/Bar layout design Settings-->
<div id="right_tab_visibility_settings" class="modal widget-settings" tabindex="-1" role="dialog" aria-labelledby="registerShareLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3><?php echo $visibility_settings['settings_category']; ?></h3>
</div>
<div class="modal-body">
<form class="form-horizontal" id="visibility-settings-right_tab" novalidate="novalidate" title="Visibility settings">
<?php if( $view_data['site_list'] != NULL ): ?>
<div class="row">
<div class="col-md-12">
<div class="form-group span11" id="exclude_blogs-group">
<h5>WPMU - Hide widget on specific blogs</h5>
<select name="options[exclude_blogs][]" id="exclude_blogs" multiple ui_select style="width: 100%;" data-placeholder="Click to select blogs">
<?php
foreach ( $view_data['site_list'] as $bid ) {
$current_blog_details = get_blog_details( array( 'blog_id' => $bid->blog_id ) );
$option = '<option value="' . $bid->blog_id . '" '.((in_array($bid->blog_id, explode(',', $visibility_settings['exclude_blogs'])))? 'selected' : '').'>';
$option .= $current_blog_details->blogname;
$option .= '</option>';
echo $option;
}
?>
</select>
</div>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-md-6">
<div class="form-group span11" id="exclude_pages-group">
<h5>Hide widget on specific pages</h5>
<select name="options[exclude_pages][]" id="exclude_pages" multiple ui_select style="width: 100%;" <?php echo(($view_data['site_list'] != NULL)? 'disabled' : 'data-placeholder="Click to select pages"'); ?>>
<?php
if($view_data['site_list'] == NULL) {
$pages = get_pages();
foreach ( $pages as $page ) {
$option = '<option value="' . $page->ID . '" '.((in_array($page->ID, explode(',', $visibility_settings['exclude_pages'])))? 'selected' : '').'>';
$option .= $page->post_title;
$option .= '</option>';
echo $option;
}
}
else {
echo '<option selected="selected">Temporary disabled for WPMU</option>';
}
?>
</select>
</div>
<div class="form-group span11" id="on_home-group">
<h5>Show widget on Home page</h5>
<div class="toggle-button" data-toggleButton-style-enabled="info">
<input data-toggle="value" target_id="on_home-right_tab" target_name="options[on_home]" type="checkbox" value="1" <?php echo($visibility_settings['on_home'] == 0)? '': 'checked="checked"'; ?>/>
</div>
</div>
<div class="form-group span11" id="on_posts-group">
<h5>Show widget on posts</h5>
<div class="toggle-button" data-toggleButton-style-enabled="info">
<input data-toggle="value" target_id="on_posts-right_tab" target_name="options[on_posts]" type="checkbox" value="1" <?php echo($visibility_settings['on_posts'] == 0)? '': 'checked="checked"'; ?>/>
</div>
</div>
</div><!--/span6-->
<div class="col-md-6">
<div class="form-group span11" id="exclude_pages-group">
<h5>Hide widget on specific posts</h5>
<select name="options[exclude_posts][]" id="exclude_posts" multiple ui_select style="width: 100%;" <?php echo(($view_data['site_list'] != NULL)? 'disabled' : 'data-placeholder="Click to select posts"'); ?>>
<?php
if($view_data['site_list'] == NULL) {
$posts = get_posts();
foreach ( $posts as $post ) {
$option = '<option value="' . $post->ID . '" '.((in_array($post->ID, explode(',', $visibility_settings['exclude_posts'])))? 'selected' : '').'>';
$option .= $post->post_title;
$option .= '</option>';
echo $option;
}
}
else {
echo '<option selected="selected">Temporary disabled for WPMU</option>';
}
?>
</select>
</div>
<div class="form-group span11" id="on_pages-group">
<h5>Show widget on pages</h5>
<div class="toggle-button" data-toggleButton-style-enabled="info">
<input data-toggle="value" target_id="on_pages-bottom_tab" target_name="options[on_pages]" type="checkbox" value="1" <?php echo($visibility_settings['on_pages'] == 0)? '': 'checked="checked"'; ?>/>
</div>
</div>
<div class="form-group span11" id="on_custom-group">
<h5>Show widget on custom post types</h5>
<select name="options[on_custom][]" id="on_custom" multiple ui_select style="width: 100%;" <?php echo(($view_data['site_list'] != NULL)? 'disabled' : 'data-placeholder="Click to select post types"'); ?>>
<?php
if($view_data['site_list'] == NULL) {
$args=array(
'public' => true,
'_builtin' => false
);
$post_types=get_post_types($args,'names');
foreach ( $post_types as $post_type ) {
$option = '<option value="' . $post_type . '" '.((in_array($post_type, explode(',', $visibility_settings['on_custom'])))? 'selected' : '').'>';
$option .= $post_type;
$option .= '</option>';
echo $option;
}
}
else {
echo '<option selected="selected">Temporary disabled for WPMU</option>';
}
?>
</select>
</div>
</div><!--/span6-->
</div><!--/row-->
</form>
</div>
<div class="modal-footer">
<button class="btn btn-icon btn-default circle_remove" data-dismiss="modal" aria-hidden="true"><i class="appz-close-3"></i> Close</button>
<button type="submit" class="btn btn-icon btn-primary circle_ok save-widget-settings" settings="#visibility-settings-right_tab" layout="right_tab" data-loading-text="loading..."><i class="appz-checkmark-circle-2"></i> Save</button>
</div>
</div>
</div>
</div><!--/Visibility Settings-->
<!---Preview Widget--->
<div id="preview_right_tab" class="modal widget-preview-modal" tabindex="-1" role="dialog" wp_address="<?php echo get_site_url(); ?>/?cunjo=right_tab" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Preview</h3>
</div>
<div class="modal-body">
Preview here
</div>
<div class="modal-footer">
<button class="btn btn-icon btn-default circle_remove" data-dismiss="modal" aria-hidden="true"><i class="appz-close-3"></i> Close</button>
</div>
</div>
</div>
</div><!--/Preview Widget-->
<?php //echo '<pre>'.print_r($view_data, true).'</pre>'; ?> | Java |
import os
from collections import OrderedDict
from .sqldatabase import SqlDatabase
from .retrieve_core_info import retrieveCoreInfo
# Root class that all SQL table updaters derive from
class SqlTableUpdater():
def __init__(self, tableName, tableColumns=[], coreInfo={}):
self.tableName = tableName
self.columnsDict = OrderedDict(tableColumns)
self.dbFile = os.path.join(os.getcwd().replace("python", "metadata"), "libretro.sqlite")
self.dbFileExists = os.path.isfile(self.dbFile)
self.coreInfo = coreInfo
# self.filterUnusedCores()
def updateTable(self):
pass
def updateColumns(self, database, additionalStatement: str = ""):
if not self.dbFileExists:
database.createTable(self.tableName, self.columnsDict, additionalStatement)
else:
try:
database.deleteTable(self.tableName)
except:
database.createTable(self.tableName, self.columnsDict, additionalStatement)
def __del__(self):
print("Updated " + self.tableName + " table.")
def libretroSystemList(self):
systems = []
for k, v in self.coreInfo['cores'].items():
if "categories" not in v or v["categories"] != "Emulator":
continue
if "database" in v:
name = v["database"].split("|")
for n in name:
systems.append(n)
# Split console and manufacturer names
# Not really necessary for Libretro identifiers
#tup = n.split(" - ")
#
## "MAME"
#if len(tup) == 1:
# systems.append(tup[0])
#
## Nearly every one
#elif len(tup) == 2:
# systems.append(tup[1])
#
## Sega - Master System - Mark III
## Sega - Mega Drive - Genesis
#elif len(tup) == 3:
# systems.append(tup[1])
# There are some cores that do not have "database" defined
elif "systemname" in v:
systems.append(v["systemname"])
systems = list(set(systems))
systems.sort()
return systems
# This map defines all Libretro-based systems that Phoenix supports. If it isn't in here, it isn't supported by Phoenix!
# TODO: Place this information into an entirely separate database
# WARNING: Do NOT change Phoenix UUIDs (1st column), even if there are spelling mistakes. Change friendlyName if you really need to.
phoenixSystemDatabase = {
# friendlyName: North American console name without manufacturer
# shortName: Abbreviation (typically 3 letters)
# enabled: True iff a core is available, Phoenix can run it, and the game scanner can find it (extensions set)
# Everything else
"Arcade": {"enabled": False, "defaultCore": "mame_libretro", "friendlyName": "", "shortName": "", "manufacturer": "(Various)" },
# Conspicuously missing from No-Intro
"Amstrad - CPC": {"enabled": False, "defaultCore": "cap32_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Amstrad" },
"Atari - 2600": {"enabled": True, "defaultCore": "stella_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Atari" },
"Capcom - CP System I": {"enabled": False, "defaultCore": "fb_alpha_cps1_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Capcom" },
"Capcom - CP System II": {"enabled": False, "defaultCore": "fb_alpha_cps2_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Capcom" },
"Capcom - CP System III": {"enabled": False, "defaultCore": "fbalpha2012_cps3_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Capcom" },
"Capcom - CPS Changer": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Capcom" },
"CHIP-8": {"enabled": False, "defaultCore": "emux_chip8_libretro", "friendlyName": "", "shortName": "", "manufacturer": "(Various)" },
"DOS": {"enabled": False, "defaultCore": "dosbox_libretro", "friendlyName": "", "shortName": "", "manufacturer": "(Various)" },
"Mattel - Intellivision": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Mattel" },
"Nintendo - Game & Watch": {"enabled": False, "defaultCore": "gw_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Sinclair - ZX81": {"enabled": False, "defaultCore": "81_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sinclair" },
"SNK - Neo Geo": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "SNK" },
# No-Intro, both official and non-official (ROM-based games)
"Atari - 5200": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Atari" },
"Atari - 7800": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Atari" },
"Atari - Jaguar": {"enabled": True, "defaultCore": "virtualjaguar_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Atari" },
"Atari - Lynx": {"enabled": True, "defaultCore": "mednafen_lynx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Atari" },
"Atari - ST": {"enabled": True, "defaultCore": "hatari_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Atari" },
"Bandai - WonderSwan Color": {"enabled": True, "defaultCore": "mednafen_wswan_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Bandai" },
"Bandai - WonderSwan": {"enabled": True, "defaultCore": "mednafen_wswan_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Bandai" },
"Casio - Loopy": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Casio" },
"Casio - PV-1000": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Casio" },
"Coleco - ColecoVision": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Coleco" },
#"Commodore - 64 (PP)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
#"Commodore - 64 (Tapes)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Commodore - 64": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Commodore - Amiga": {"enabled": True, "defaultCore": "puae_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Commodore - Plus-4": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Commodore - VIC-20": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Emerson - Arcadia 2001": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Emerson" },
"Entex - Adventure Vision": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Entex" },
"Epoch - Super Cassette Vision": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Epoch" },
"Fairchild - Channel F": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Fairchild" },
"Funtech - Super Acan": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Funtech" },
"GamePark - GP32": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "GamePark" },
"GCE - Vectrex": {"enabled": True, "defaultCore": "vecx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "GCE" },
"Hartung - Game Master": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Hartung" },
"LeapFrog - Leapster Learning Game System": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "LeapFrog" },
"Magnavox - Odyssey2": {"enabled": False, "defaultCore": "o2em_libretro", "friendlyName": u"Odyssey²", "shortName": "", "manufacturer": "Magnavox" },
"Microsoft - MSX 2": {"enabled": False, "defaultCore": "bluemsx_libretro", "friendlyName": "MSX2", "shortName": "", "manufacturer": "Microsoft" },
"Microsoft - MSX": {"enabled": False, "defaultCore": "bluemsx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
#"Microsoft - XBOX 360 (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
#"Microsoft - XBOX 360 (Games on Demand)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
#"Microsoft - XBOX 360 (Title Updates)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
"NEC - PC Engine - TurboGrafx 16": {"enabled": True, "defaultCore": "mednafen_pce_fast_libretro", "friendlyName": "TurboGrafx 16", "shortName": "", "manufacturer": "NEC" },
"NEC - Super Grafx": {"enabled": True, "defaultCore": "mednafen_supergrafx_libretro", "friendlyName": "SuperGrafx", "shortName": "", "manufacturer": "NEC" },
#"Nintendo - Famicom Disk System": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Game Boy Advance (e-Cards)": {"enabled": True, "defaultCore": "vbam_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Game Boy Advance": {"enabled": True, "defaultCore": "vbam_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Game Boy Color": {"enabled": True, "defaultCore": "gambatte_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Game Boy": {"enabled": True, "defaultCore": "gambatte_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
#"Nintendo - New Nintendo 3DS (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - New Nintendo 3DS": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
#"Nintendo - Nintendo 3DS (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Nintendo 3DS": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Nintendo 64": {"enabled": True, "defaultCore": "mupen64plus_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
#"Nintendo - Nintendo DS (Download Play) (BETA)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Nintendo DS": {"enabled": True, "defaultCore": "desmume_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
#"Nintendo - Nintendo DSi (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Nintendo DSi": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Nintendo Entertainment System": {"enabled": True, "defaultCore": "fceumm_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
#"Nintendo - Nintendo Wii (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Pokemon Mini": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Satellaview": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Sufami Turbo": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Super Nintendo Entertainment System": {"enabled": True, "defaultCore": "bsnes_mercury_balanced_libretro", "friendlyName": "Super Nintendo", "shortName": "", "manufacturer": "Nintendo" },
"Nintendo - Virtual Boy": {"enabled": True, "defaultCore": "mednafen_vb_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Nokia - N-Gage": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nokia" },
"Philips - Videopac+": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Philips" },
"RCA - Studio II": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "RCA" },
"Sega - 32X": {"enabled": True, "defaultCore": "picodrive_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Game Gear": {"enabled": True, "defaultCore": "genesis_plus_gx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Master System - Mark III": {"enabled": False, "defaultCore": "emux_sms_libretro", "friendlyName": "Master System", "shortName": "", "manufacturer": "Sega" },
"Sega - Mega Drive - Genesis": {"enabled": True, "defaultCore": "genesis_plus_gx_libretro", "friendlyName": "Genesis", "shortName": "", "manufacturer": "Sega" },
"Sega - PICO": {"enabled": True, "defaultCore": "picodrive_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - SG-1000": {"enabled": True, "defaultCore": "genesis_plus_gx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sinclair - ZX Spectrum +3": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sinclair" },
"SNK - Neo Geo Pocket Color": {"enabled": True, "defaultCore": "mednafen_ngp_libretro", "friendlyName": "", "shortName": "", "manufacturer": "SNK" },
"SNK - Neo Geo Pocket": {"enabled": True, "defaultCore": "mednafen_ngp_libretro", "friendlyName": "", "shortName": "", "manufacturer": "SNK" },
#"Sony - PlayStation 3 (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation 3 (Downloadable)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation 3 (PSN)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation Portable (DLC)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation Portable (PSN)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation Portable (PSX2PSP)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation Portable (UMD Music)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
#"Sony - PlayStation Portable (UMD Video)": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
"Sony - PlayStation Portable": {"enabled": True, "defaultCore": "ppsspp_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
"Tiger - Game.com": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Tiger" },
"Tiger - Gizmondo": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Tiger" },
"VTech - CreatiVision": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "VTech" },
"VTech - V.Smile": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "VTech" },
"Watara - Supervision": {"enabled": True, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Watara" },
# Redump.org (disc-based games)
"Apple - Macintosh": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Apple" },
"Bandai - Playdia": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Bandai" },
"Bandai / Apple - Pippin": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Bandai / Apple" },
"Commodore - Amiga CD": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Commodore - Amiga CD32": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Commodore - Amiga CDTV": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Commodore" },
"Fujitsu - FM Towns series": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Fujitsu" },
"IBM PC compatible": {"enabled": False, "defaultCore": "", "friendlyName": "PC", "shortName": "", "manufacturer": "(Various)" },
"Mattel - HyperScan": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Mattel" },
"Microsoft - Xbox": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
"Namco / Sega / Nintendo - Triforce": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"NEC - PC Engine CD - TurboGrafx-CD": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "TurboGrafx-CD", "shortName": "", "manufacturer": "NEC" },
"NEC - PC-88 series": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "NEC" },
"NEC - PC-98 series": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "NEC" },
"NEC - PC-FX - PC-FXGA": {"enabled": False, "defaultCore": "mednafen_pcfx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "NEC" },
"Nintendo - GameCube": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Palm OS": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Palm" },
"Panasonic - 3DO Interactive Multiplayer": {"enabled": False, "defaultCore": "4do_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Panasonic" },
"Philips - CD-i": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Philips" },
"Photo - CD": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "(Various)" },
"Sega - Chihiro": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Dreamcast": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Lindbergh": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Mega-CD": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Naomi": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"Sega - Saturn": {"enabled": True, "defaultCore": "yabause_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sega" },
"SNK - Neo Geo CD": {"enabled": False, "defaultCore": "mess2014_libretro", "friendlyName": "", "shortName": "", "manufacturer": "SNK" },
"Sony - PlayStation 2": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
"Sony - PlayStation": {"enabled": True, "defaultCore": "mednafen_psx_libretro", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
"VTech - V.Flash": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "VTech" },
# Seventh-generation consoles (circa 2005)
"Microsoft - Xbox 360": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
"Nintendo - Wii": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Sony - PlayStation 3": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
# Eighth-generation consoles (circa 2012)
"Microsoft - Xbox One": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
"Nintendo - Wii U": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
"Sony - PlayStation 4": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Sony" },
# Ninth-generation consoles (circa 2017)
"Microsoft - Xbox One X": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Microsoft" },
"Nintendo - Switch": {"enabled": False, "defaultCore": "", "friendlyName": "", "shortName": "", "manufacturer": "Nintendo" },
}
def phoenixSystems(self):
return OrderedDict(sorted(self.phoenixSystemDatabase.items(), key=lambda t: t[0]))
def libretroToPhoenix(self, libretroSystem):
return self.libretroToPhoenixMap[libretroSystem]
# This map essentially says "Register this Libretro core for this (these) Phoenix system(s)" when a .info file claims support for that system
# If a core claims support for some Libretro ID, register that core for each Phoenix ID
libretroToPhoenixMap = {
"3DO": {"Panasonic - 3DO Interactive Multiplayer"},
"Arcade (various)": {"Arcade"},
"Atari - 2600": {"Atari - 2600"},
"Atari - 5200": {"Atari - 5200"},
"Atari - 7800": {"Atari - 7800"},
"Atari - Jaguar": {"Atari - Jaguar"},
"Atari - Lynx": {"Atari - Lynx"},
"Atari ST/STE/TT/Falcon": {"Atari - ST"},
"Bandai - WonderSwan Color": {"Bandai - WonderSwan Color"},
"Bandai - WonderSwan": {"Bandai - WonderSwan"},
"CHIP-8": {"CHIP-8"},
"Commodore Amiga": {"Commodore - Amiga"},
"Commodore - C128": {"Arcade"},
"Commodore - 64": {"Commodore - 64"},
"CP System I": {"Capcom - CP System I"},
"CP System II": {"Capcom - CP System II"},
"CP System III": {"Capcom - CP System III"},
"CPC": {"Amstrad - CPC"},
"DOS": {"DOS"},
"FB Alpha - Arcade Games": {"Arcade"},
"GCE - Vectrex": {"GCE - Vectrex"},
"Handheld Electronic Game": {"Nintendo - Game & Watch"},
"IBM PC compatible": {"IBM PC compatible"},
"Magnavox - Odyssey2": {"Magnavox - Odyssey2"},
"MAME": {"Arcade"},
"MAME2003": {"Arcade"},
"Microsoft - MSX 2": {"Microsoft - MSX 2"},
"Microsoft - MSX2": {"Microsoft - MSX 2"},
"Microsoft - MSX": {"Microsoft - MSX"},
# MESS and UME
# http://nonmame.retrogames.com/
"MULTI (various)": {
"Atari - 2600",
"Atari - 5200",
"Atari - 7800",
"Atari - Lynx",
"Bandai - WonderSwan Color"
"Bandai - WonderSwan",
"Capcom - CPS Changer",
"Coleco - ColecoVision",
"Fujitsu - FM Towns series",
"Magnavox - Odyssey2",
"Mattel - Intellivision",
"NEC - PC Engine - TurboGrafx 16",
"NEC - PC Engine CD - TurboGrafx-CD",
"NEC - Super Grafx",
"Nintendo - Game Boy Advance",
"Nintendo - Game Boy",
"Philips - Videopac+",
"RCA - Studio II",
"Sega - Game Gear",
"Sega - Master System - Mark III",
"Sega - Mega Drive - Genesis",
"Sega - PICO",
"Sega - SG-1000",
"SNK - Neo Geo CD",
"SNK - Neo Geo",
"Watara - Supervision",
},
"NEC - PC Engine - TurboGrafx 16": {"NEC - PC Engine - TurboGrafx 16"},
"NEC - PC Engine SuperGrafx": {"NEC - Super Grafx"},
"NEC - PC Engine CD - TurboGrafx-CD": {"NEC - Super Grafx"},
"NEC - PC-FX": {"NEC - PC-FX - PC-FXGA"},
"NEC - Super Grafx": {"NEC - Super Grafx"},
"Neo Geo": {"SNK - Neo Geo"},
"Nintendo - 3DS": {"Nintendo - Nintendo 3DS"},
"Nintendo - Family Computer Disk System": {"Nintendo - Nintendo Entertainment System"},
"Nintendo - Famicom Disk System": {"Nintendo - Nintendo Entertainment System"},
"Nintendo - Game & Watch": {"Nintendo - Game & Watch"},
"Nintendo - Game Boy Advance (e-Cards)": {"Nintendo - Game Boy Advance (e-Cards)"},
"Nintendo - Game Boy Advance": {"Nintendo - Game Boy Advance"},
"Nintendo - Game Boy Color": {"Nintendo - Game Boy Color"},
"Nintendo - Game Boy": {"Nintendo - Game Boy"},
"Nintendo - GameCube": {"Nintendo - GameCube"},
"Nintendo - Nintendo 64": {"Nintendo - Nintendo 64"},
"Nintendo - Nintendo 64DD": {"Nintendo - Nintendo 64"},
"Nintendo - Nintendo DS": {"Nintendo - Nintendo DS"},
"Nintendo - Nintendo DS (Download Play)": {"Nintendo - Nintendo DS"},
"Nintendo - Nintendo DS (Download Play) (BETA)": {"Nintendo - Nintendo DS"},
"Nintendo - Nintendo DS Decrypted": {"Nintendo - Nintendo DS"},
"Nintendo - Nintendo Entertainment System": {"Nintendo - Nintendo Entertainment System"},
"Nintendo - Pokemon Mini": {"Nintendo - Pokemon Mini"},
"Nintendo - Sufami Turbo": {"Nintendo - Sufami Turbo"},
"Nintendo - Super Nintendo Entertainment System": {"Nintendo - Super Nintendo Entertainment System"},
"Nintendo - Virtual Boy": {"Nintendo - Virtual Boy"},
"Nintendo - Wii": {"Nintendo - Wii"},
"PC": {"IBM PC compatible"},
"PC-FX": {"NEC - PC-FX - PC-FXGA"},
"PC-98": {"NEC - PC-98 series"},
"Phillips - Videopac+": {"Philips - Videopac+"},
"Sega - 32X": {"Sega - 32X"},
"Sega - Dreamcast": {"Sega - Dreamcast"},
"Sega - Game Gear": {"Sega - Game Gear"},
"Sega - Master System - Mark III": {"Sega - Master System - Mark III"},
"Sega - Mega Drive - Genesis": {"Sega - Mega Drive - Genesis"},
"Sega - Mega-CD - Sega CD": {"Sega - Mega-CD"},
"Sega - NAOMI": {"Sega - Naomi"},
"Sega - PICO": {"Sega - PICO"},
"Sega - Saturn": {"Sega - Saturn"},
"Sega - SG-1000": {"Sega - SG-1000"},
"Sharp - X68000": {"Arcade"},
"Sinclair - ZX 81": {"Sinclair - ZX81"},
"Sinclair - ZX Spectrum": {"Sinclair - ZX Spectrum +3"},
"Sinclair - ZX Spectrum +3": {"Sinclair - ZX Spectrum +3"},
"SNK - Neo Geo Pocket Color": {"SNK - Neo Geo Pocket Color"},
"SNK - Neo Geo Pocket": {"SNK - Neo Geo Pocket"},
"Sony - PlayStation Portable": {"Sony - PlayStation Portable"},
"Sony - PlayStation": {"Sony - PlayStation"},
"The 3DO Company - 3DO": {"Panasonic - 3DO Interactive Multiplayer"},
"Uzebox": {"Arcade"},
"ZX Spectrum (various)": {"Sinclair - ZX Spectrum +3"},
}
# Not all Phoenix IDs are availble in OpenVGDB, fail silently and gracefully if a match isn't found
def phoenixToOpenVGDB(self, phoenixID):
ret = ""
try:
ret = self.phoenixToOpenVGDBMap[phoenixID]
except KeyError:
ret = ""
return ret
phoenixToOpenVGDBMap = {
"Panasonic - 3DO Interactive Multiplayer": "3DO Interactive Multiplayer",
"Arcade": "Arcade",
"Atari - 2600": "Atari 2600",
"Atari - 5200": "Atari 5200",
"Atari - 7800": "Atari 7800",
"Atari - Jaguar": "Atari Jaguar CD",
"Atari - Jaguar": "Atari Jaguar",
"Atari - Lynx": "Atari Lynx",
"Bandai - WonderSwan Color": "Bandai WonderSwan Color",
"Bandai - WonderSwan": "Bandai WonderSwan",
"Coleco - ColecoVision": "Coleco ColecoVision",
"GCE - Vectrex": "GCE Vectrex",
"Mattel - Intellivision": "Intellivision",
"Magnavox - Odyssey2": "Magnavox Odyssey2",
"NEC - PC Engine CD - TurboGrafx-CD": "NEC PC Engine CD/TurboGrafx-CD",
"NEC - PC Engine - TurboGrafx 16": "NEC PC Engine/TurboGrafx-16",
"NEC - PC-FX - PC-FXGA": "NEC PC-FX",
"NEC - Super Grafx": "NEC SuperGrafx",
"Nintendo - Nintendo 64": "Nintendo 64",
"Nintendo - Nintendo DS": "Nintendo DS",
"Nintendo - Nintendo Entertainment System": "Nintendo Entertainment System",
"Nintendo - Nintendo Entertainment System": "Nintendo Famicom Disk System",
"Nintendo - Game Boy Advance": "Nintendo Game Boy Advance",
"Nintendo - Game Boy Color": "Nintendo Game Boy Color",
"Nintendo - Game Boy": "Nintendo Game Boy",
"Nintendo - GameCube": "Nintendo GameCube",
"Nintendo - Super Nintendo Entertainment System": "Nintendo Super Nintendo Entertainment System",
"Nintendo - Virtual Boy": "Nintendo Virtual Boy",
"Nintendo - Wii": "Nintendo Wii",
"Sega - 32X": "Sega 32X",
"Sega - Mega-CD": "Sega CD/Mega-CD",
"Sega - Game Gear": "Sega Game Gear",
"Sega - Mega Drive - Genesis": "Sega Genesis/Mega Drive",
"Sega - Master System - Mark III": "Sega Master System",
"Sega - Saturn": "Sega Saturn",
"Sega - SG-1000": "Sega SG-1000",
"SNK - Neo Geo Pocket Color": "SNK Neo Geo Pocket Color",
"SNK - Neo Geo Pocket": "SNK Neo Geo Pocket",
"Sony - PlayStation Portable": "Sony PlayStation Portable",
"Sony - PlayStation": "Sony PlayStation",
}
def getOpenVGDBToPhoenixMap(self):
return OrderedDict(sorted(self.openVGDBToPhoenixMap.items(), key=lambda t: t[0]))
openVGDBToPhoenixMap = {
"3DO Interactive Multiplayer": "Panasonic - 3DO Interactive Multiplayer",
"Arcade": "Arcade",
"Atari 2600": "Atari - 2600",
"Atari 5200": "Atari - 5200",
"Atari 7800": "Atari - 7800",
"Atari Jaguar CD": "Atari - Jaguar",
"Atari Jaguar": "Atari - Jaguar",
"Atari Lynx": "Atari - Lynx",
"Bandai WonderSwan Color": "Bandai - WonderSwan Color",
"Bandai WonderSwan": "Bandai - WonderSwan",
"Coleco ColecoVision": "Coleco - ColecoVision",
"GCE Vectrex": "GCE - Vectrex",
"Intellivision": "Mattel - Intellivision",
"Magnavox Odyssey2": "Magnavox - Odyssey2",
"NEC PC Engine CD/TurboGrafx-CD": "NEC - PC Engine CD - TurboGrafx-CD",
"NEC PC Engine/TurboGrafx-16": "NEC - PC Engine - TurboGrafx 16",
"NEC PC-FX": "NEC - PC-FX - PC-FXGA",
"NEC SuperGrafx": "NEC - Super Grafx",
"Nintendo 64": "Nintendo - Nintendo 64",
"Nintendo DS": "Nintendo - Nintendo DS",
"Nintendo Entertainment System": "Nintendo - Nintendo Entertainment System",
"Nintendo Famicom Disk System": "Nintendo - Nintendo Entertainment System",
"Nintendo Game Boy Advance": "Nintendo - Game Boy Advance",
"Nintendo Game Boy Color": "Nintendo - Game Boy Color",
"Nintendo Game Boy": "Nintendo - Game Boy",
"Nintendo GameCube": "Nintendo - GameCube",
"Nintendo Super Nintendo Entertainment System": "Nintendo - Super Nintendo Entertainment System",
"Nintendo Virtual Boy": "Nintendo - Virtual Boy",
"Nintendo Wii": "Nintendo - Wii",
"Sega 32X": "Sega - 32X",
"Sega CD/Mega-CD": "Sega - Mega-CD",
"Sega Game Gear": "Sega - Game Gear",
"Sega Genesis/Mega Drive": "Sega - Mega Drive - Genesis",
"Sega Master System": "Sega - Master System - Mark III",
"Sega Saturn": "Sega - Saturn",
"Sega SG-1000": "Sega - SG-1000",
"SNK Neo Geo Pocket Color": "SNK - Neo Geo Pocket Color",
"SNK Neo Geo Pocket": "SNK - Neo Geo Pocket",
"Sony PlayStation Portable": "Sony - PlayStation Portable",
"Sony PlayStation": "Sony - PlayStation",
}
def filterUnusedCores(self):
for key in self.coreInfo["cores"].keys():
if (
# No reason specified
#"4do_libretro" == key
# or "81_libretro" == key
# or "bluemsx_libretro" == key
# or "bsnes_accuracy_libretro" == key
# or "bsnes_balanced_libretro" == key
# or "bsnes_performance_libretro" == key
# or "cap32_libretro" == key
# or "catsfc_libretro" == key
# or "dosbox_libretro" == key
# or "emux_chip8_libretro" == key
# or "fb_alpha_cps1_libretro" == key
# or "fb_alpha_cps2_libretro" == key
# or "fmsx_libretro" == key
# or "gpsp_libretro" == key
# or "gw_libretro" == key
# or "handy_libretro" == key
# or "hatari_libretro" == key
# or "imame4all_libretro" == key
# or "mame078_libretro" == key
# or "mame2010_libretro" == key
# or "mame2014_libretro" == key
# or "meteor_libretro" == key
# or "o2em_libretro" == key
# or "prosystem_libretro" == key
# or "puae_libretro" == key
# or "ume2014_libretro" == key
# or "vecx_libretro" == key
# or "virtualjaguar_libretro" == key
# ARM cores
"pcsx" in key
or "pocketsnes_libretro" == key
):
del self.coreInfo["cores"][key]
| Java |
/* sd2iec - SD/MMC to Commodore serial bus interface/controller
Copyright (C) 2007-2015 Ingo Korb <ingo@akana.de>
Inspired by MMC2IEC by Lars Pontoppidan et al.
FAT filesystem access based on code from ChaN and Jim Brain, see ff.c|h.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License only.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
bus.h: Common IEC/IEEE bus definitions
*/
#ifndef BUS_H
#define BUS_H
extern uint8_t device_address;
void bus_interface_init(void);
void bus_init(void);
void __attribute__((noreturn)) bus_mainloop(void);
#endif
| Java |
// -*-C++ -*-
/** \file
********************************************************************
* Device shape base class for route window.
*
* \author Rüdiger Krauße,
* Tobias Schlemmer <keinstein@users.sourceforge.net>
* \license GPL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
********************************************************************
*\addtogroup GUIroute
*\{
********************************************************************/
#include "src/kernel/Defs.h"
#include "src/kernel/error.h"
#include "src/wxGUI/MutFrame.h"
#include "src/wxGUI/Routing/GUIRoute.h"
#include "src/wxGUI/Routing/DeviceShape.h"
#include "src/wxGUI/Routing/RouteIcons.h"
#include "src/wxGUI/Routing/DebugRoute.h"
#include "src/wxGUI/Routing/BoxChannelShape.h"
#include "src/wxGUI/Routing/BoxDlg.h"
#include "src/wxGUI/Routing/InputDevDlg.h"
#include "src/wxGUI/Routing/OutputDevDlg.h"
#include "src/wxGUI/Routing/GUIRoute-inlines.h"
#include <algorithm>
#include "wx/defs.h"
#include "wx/bmpbuttn.h"
#include "wx/msgdlg.h"
//#include "MutApp.h"
//#include "MutIcon.h"
//#include "MutRouteWnd.h"
//#include "InputDevDlg.h"
//#include "Device.h"
// common part of the macros below
#define wxIMPLEMENT_CLASS_COMMON_TEMPLATE1(name, basename, baseclsinfo2, func, T1) \
template<> \
wxClassInfo name<T1>::ms_classInfo(wxT(#name "<" #T1 ">"), \
&basename::ms_classInfo, \
baseclsinfo2, \
(int) sizeof(name<T1>), \
(wxObjectConstructorFn) func); \
template<> \
wxClassInfo *name<T1>::GetClassInfo() const \
{ return &name<T1>::ms_classInfo; }
#define wxIMPLEMENT_CLASS_COMMON1_TEMPLATE1(name, basename, func, T1) \
wxIMPLEMENT_CLASS_COMMON_TEMPLATE1(name, basename, NULL, func, T1)
// Single inheritance with one base class
#define IMPLEMENT_ABSTRACT_CLASS_TEMPLATE1(name, basename, T1) \
wxIMPLEMENT_CLASS_COMMON1_TEMPLATE1(name, basename, NULL, T1)
// Single inheritance with one base class
#define IMPLEMENT_DYNAMIC_CLASS_TEMPLATE1(name, basename, T1) \
template<> \
wxObject* name<T1>::wxCreateObject() \
{ return new name<T1>; } \
wxIMPLEMENT_CLASS_COMMON1_TEMPLATE1(name, basename, \
name<T1>::wxCreateObject, T1)
using namespace mutaborGUI;
using namespace mutabor;
BEGIN_EVENT_TABLE_TEMPLATE1(MutDeviceShape, MutIconShape, T)
EVT_KEY_DOWN(MutDeviceShape::OnKeyDown)
EVT_LEFT_DCLICK(MutDeviceShape::LeftDblClickEvent)
EVT_MENU(CM_MOVE_UP, MutDeviceShape::CmMoveIcon)
EVT_MENU(CM_MOVE_DOWN, MutDeviceShape::CmMoveIcon)
EVT_MENU(CM_DEVICE_STATE_CHANGED, MutDeviceShape::CmDeviceNotification)
EVT_BUTTON(CM_PLAYDEVICE, MutDeviceShape::PlayButtonPressed)
EVT_BUTTON(CM_PAUSEDEVICE, MutDeviceShape::PlayButtonPressed)
EVT_BUTTON(CM_STOPDEVICE, MutDeviceShape::PlayButtonPressed)
END_EVENT_TABLE()
MUTABOR_NAMESPACE(mutaborGUI)
template<class T>
MutDeviceShape<T>::~MutDeviceShape() {
TRACEC;
if (device) {
try {
disconnect(device,this);
TRACEC;
} catch (const mutabor::error::unreachable_exception & e) {
mutabor::unhandled_exception_handler();
}
}
if (playbuttons) delete playbuttons;
TRACEC;
}
template<class T>
bool MutDeviceShape<T>::Create (wxWindow * parent,
wxWindowID id,
devicetype & d)
{
if (!d) return false;
DEBUGLOG (other, ("Checking icon"));
mutASSERT(MidiInputDevBitmap.IsOk());
mutASSERT(MidiOutputDevBitmap.IsOk());
TRACEC;
bool fine =
Create (parent, id, d->GetName());
TRACEC;
if (fine)
connect(d,this);
TRACEC;
return fine;
}
template<class T>
void MutDeviceShape<T>::Add(MutBoxChannelShape * route)
{
#ifdef DEBUG
MutBoxChannelShapeList::iterator pos =
std::find(routes.begin(),routes.end(),route);
mutASSERT(pos == routes.end());
#endif
routes.push_back(route);
// ClearPerimeterPoints();
Refresh();
Update();
}
template<class T>
bool MutDeviceShape<T>::Replace(MutBoxChannelShape * oldroute,
MutBoxChannelShape * newroute)
{
#ifdef DEBUG
MutBoxChannelShapeList::iterator pos =
std::find(routes.begin(),routes.end(),oldroute);
mutASSERT(pos != routes.end());
#endif
bool retval = Remove(oldroute);
Add(newroute);
Recompute();
return retval;
}
template<class T>
bool MutDeviceShape<T>::Remove(MutBoxChannelShape * route)
{
MutBoxChannelShapeList::iterator pos =
std::find(routes.begin(),routes.end(),route);
if (pos == routes.end()) {
UNREACHABLEC;
return false;
} else {
routes.erase(pos);
}
Recompute();
return true;
}
template<class T>
bool MutDeviceShape<T>::MoveRoutes (MutDeviceShape * newclass)
{
routes.swap(newclass->routes);
Recompute();
return true;
}
template<class T>
bool MutDeviceShape<T>::Recompute()
{
// ClearPerimeterPoints();
SetIcon(GetMutIcon());
// SetLabel (filename.GetFullName());
return GetIcon().IsOk();
}
template<class T>
void MutDeviceShape<T>::ReadPanel(FilterPanel * panel,
MutBoxChannelShape * channel)
{
mutASSERT(panel);
mutASSERT(channel);
if (!panel || !channel) return;
bool active = panel->IsShown();
thistype * newShape = panel->GetCurrentSelection();
Route & route = channel->GetRoute();
if (!active) {
TRACEC;
disconnect(channel,this);
TRACEC;
return;
} else if (newShape != this) {
TRACEC;
reconnect(channel,this,newShape);
TRACEC;
}
if (newShape) {
wxWindow * subpanel = panel->GetCurrentDevicePage();
if (!panel) {
UNREACHABLEC;
return;
}
TRACEC;
newShape->ReadFilterPanel(subpanel,route);
}
TRACEC;
}
template<class T>
void MutDeviceShape<T>::OnKeyDown (wxKeyEvent & event) {
if (event.HasModifiers()) {
event.Skip();
return;
}
/* Other inspirations:
case WXK_DELETE:
// cursor keys
*/
switch (event.GetKeyCode()) {
case WXK_NUMPAD_ENTER:
case WXK_RETURN:
case WXK_SPACE:
case WXK_NUMPAD_SPACE:
case WXK_NUMPAD_ADD:
case WXK_ADD:
case WXK_WINDOWS_MENU:
case WXK_MENU:
{
wxCommandEvent command(wxEVT_COMMAND_MENU_SELECTED,
CM_LEFT_DOUBLE_CLICK);
wxPostEvent(this,command);
return;
}
default:
event.Skip();
}
}
/**
* Move the corresponding device in the device list and
* update the GUI according to the new order.
*
* \param event wxCommandEvent containing the request
*/
template <class T>
void MutDeviceShape<T>::CmMoveIcon (wxCommandEvent & event) {
switch (event.GetId()) {
case CM_MOVE_UP:
MoveDevice(-1);
break;
case CM_MOVE_DOWN:
MoveDevice(+1);
break;
}
}
template <class T>
void MutDeviceShape<T>::DoDeviceNotification(wxCommandEvent & mutUNUSED(event))
{
if (!device || !playbuttons) return;
MutaborModeType mode = device->GetMode();
bool open = device->IsOpen();
bool hidePlay = !open;
bool hidePause = hidePlay,
hideStop = hidePlay;
if (open) {
switch (mode) {
case DevicePlay:
hidePlay = true;
break;
case DeviceStop:
hideStop = true;
break;
case DevicePause:
hidePause = true;
break;
case DeviceKilled:
case DeviceUnregistered:
case DeviceInitializing:
case DeviceCompileError:
case DeviceTimingError:
return;
}
}
bool dolayout = false;
wxSizerItemList & playlist = playbuttons->GetChildren();
for (wxSizerItemList::iterator i = playlist.begin();
i != playlist.end(); i++) {
wxWindow * button = (*i)->GetWindow();
bool hide = !open;
switch (button -> GetId()) {
case CM_PLAYDEVICE:
hide = hidePlay;
break;
case CM_STOPDEVICE:
hide = hideStop;
break;
case CM_PAUSEDEVICE:
hide = hidePause;
break;
}
if (hide) {
if (playbuttons->IsShown(button)) {
playbuttons->Hide(button);
dolayout = true;
}
} else {
if (!playbuttons->IsShown(button)) {
playbuttons->Show(button);
dolayout = true;
}
}
}
if (dolayout) {
playbuttons->Layout();
wxSize size = playbuttons->GetMinSize();
playbuttons->SetDimension(0,0,size.GetWidth(),size.GetHeight());
Update();
}
}
template <class T>
void MutDeviceShape<T>::createPlayButtons()
{
mutASSERT(!playbuttons);
playbuttons = new wxBoxSizer(wxVERTICAL);
if (!playbuttons) return;
wxBitmapButton * button =
new wxBitmapButton(this,CM_PLAYDEVICE,DevicePlayBitmap);
playbuttons->Add(button);
button =
new wxBitmapButton(this,CM_PAUSEDEVICE,DevicePauseBitmap);
playbuttons->Add(button);
button =
new wxBitmapButton(this,CM_STOPDEVICE,DeviceStopBitmap);
playbuttons->Add(button);
playbuttons->Layout();
wxSize size = playbuttons->GetMinSize();
playbuttons->SetDimension(0,0,size.GetWidth(),size.GetHeight());
}
template <class T>
void MutDeviceShape<T>::createPauseButton()
{
mutASSERT(!playbuttons);
playbuttons = new wxBoxSizer(wxVERTICAL);
if (!playbuttons) return;
wxBitmapButton * button =
new wxBitmapButton(this,CM_PAUSEDEVICE,DevicePauseBitmap);
playbuttons->Add(button);
playbuttons->Layout();
wxSize size = playbuttons->GetMinSize();
playbuttons->SetDimension(0,0,size.GetWidth(),size.GetHeight());
}
template <class T>
void MutDeviceShape<T>::createRecordButtons()
{
mutASSERT(!playbuttons);
playbuttons = new wxBoxSizer(wxVERTICAL);
if (!playbuttons) return;
wxBitmapButton * button =
new wxBitmapButton(this,CM_PLAYDEVICE,DeviceRecordBitmap);
playbuttons->Add(button);
button =
new wxBitmapButton(this,CM_PAUSEDEVICE,DevicePauseBitmap);
playbuttons->Add(button);
button =
new wxBitmapButton(this,CM_STOPDEVICE,DeviceStopBitmap);
playbuttons->Add(button);
playbuttons->Layout();
wxSize size = playbuttons->GetMinSize();
playbuttons->SetDimension(0,0,size.GetWidth(),size.GetHeight());
}
template <class T>
void MutDeviceShape<T>::PlayButtonPressed(wxCommandEvent & event)
{
if (!device) return;
if (!device->IsOpen()) return;
switch (event.GetId()) {
case CM_PLAYDEVICE:
device -> Play();
break;
case CM_PAUSEDEVICE:
device -> Pause();
break;
case CM_STOPDEVICE:
device -> Stop();
break;
}
}
template <class T>
void MutDeviceShape<T>::DoLeftDblClick() {
TRACEC;
DeviceDialog * dlg = ShowDeviceDialog();
int Res = dlg->ShowModal();
TRACEC;
bool destroySelf = false;
wxWindow * parent = m_parent; // to be availlable after deleten.
TRACEC;
if (Res == wxID_OK) {
DevType type = dlg->GetType();
if (CanHandleType (type)) {
TRACEC;
readDialog (dlg);
} else if (type != DTNotSet) { // assure type is set.
TRACEC;
devicetype dev =
DeviceFactory::Create<devicetype>(type);
if (dev) {
TRACEC;
thistype * newdev =
GUIDeviceFactory::CreateShape (dev,
GetParent());
if (! newdev) {
dlg->Destroy();
UNREACHABLEC;
return;
}
mutASSERT(newdev->device);
TRACEC;
newdev -> readDialog (dlg);
if (LogicOn && !(newdev->device->IsOpen()))
newdev->device->Open();
TRACEC;
destroySelf = replaceSelfBy (newdev);
}
}
} else if (Res == ::wxID_REMOVE) {
TRACEC;
device -> Destroy();
}
// Now, we may be deleted.
dlg->Destroy();
DebugCheckRoutes();
TRACEC;
if (Res != ::wxID_REMOVE && !destroySelf) {
Layout();
InvalidateBestSize();
Fit();
Refresh();
}
if (parent) {
parent->InvalidateBestSize();
parent->Layout();
parent->FitInside();
parent->Refresh();
parent->Update();
} else if (Res != ::wxID_REMOVE && !destroySelf) Update();
/* we don't need to destroy this control.
This should have been done during device destruction
*/
TRACE;
}
template<class T>
typename MutDeviceShape<T>::DeviceDialog * MutDeviceShape<T>::ShowDeviceDialog() {
ABSTRACT_FUNCTIONC;
abort();
}
template <class T>
bool MutDeviceShape<T>::DetachDevice ()
{
wxWindow * parent = m_parent;
wxSizer * sizer = GetContainingSizer();
Hide();
if (sizer) {
sizer -> Detach(this);
}
if (parent) {
parent->Layout();
parent->FitInside();
parent->SetVirtualSize(wxDefaultSize);
parent->Refresh();
parent->Update();
}
TRACEC;
device->Destroy();
TRACEC;
return true;
}
template<class T>
bool MutDeviceShape<T>::replaceSelfBy (thistype * newshape)
{
/** \todo transfer this function to GUIRoute */
mutASSERT (newshape);
mutASSERT (newshape->device);
TRACEC;
if (device) // might be zero as in MutNewInputDeviceShape
device->MoveRoutes(newshape->GetDevice());
TRACEC;
newshape->MoveBeforeInTabOrder (this);
wxSizer * sizer = GetContainingSizer();
sizer -> Replace (this, newshape, false);
newshape->SetFocus();
Hide();
wxWindow * parent = m_parent;
parent->RemoveChild(this);
parent->Layout();
parent->FitInside();
parent->SetVirtualSize(wxDefaultSize);
TRACEC;
device->Destroy();
// at this moment this points to invalid memory
TRACET(MutInputDeviceShape);
return true;
}
// instantiate MutInputDeviceShape
template<>
InputDevDlg * MutInputDeviceShape::ShowDeviceDialog() {
InputDevDlg * in = new InputDevDlg (m_parent);
#ifdef RTMIDI
if (rtmidiin) {
try {
rtmidi::PortList ports = rtmidiin->getPortList();
if (ports.empty()) {
in->AppendPortChoiceNoDevice();
}
else for (rtmidi::PortList::iterator i = ports.begin();
i != ports.end();
++i) {
in->AppendPortChoice(*i);
}
} catch (const rtmidi::Error &error) {
error.printMessage();
in->AppendPortChoiceNoDevice();
}
}
#else
STUBC;
#endif
// in->SetType(DTUnknown);
in->SelectMidiDevice(0);
in->SetMidiFile(wxEmptyString);
in->SetGUIDOFile(wxEmptyString);
InitializeDialog(in);
in->Fit();
return in;
}
template<>
OutputDevDlg * MutOutputDeviceShape::ShowDeviceDialog()
{
OutputDevDlg * out = new OutputDevDlg (m_parent);
#ifdef RTMIDI
if (rtmidiout) {
try {
rtmidi::PortList ports = rtmidiout->getPortList();
if (ports.empty()) {
out->AppendPortChoiceNoDevice();
}
else for (rtmidi::PortList::iterator i = ports.begin();
i != ports.end();
++i) {
out->AppendPortChoice(*i);
}
} catch (const rtmidi::Error &error) {
wxMessageBox(error.getMessage());
error.printMessage();
out->AppendPortChoiceNoDevice();
}
}
#else
/* nMidi = midiInGetNumDevs();
if ( nMidi )
{
for (int i = 0; i < nMidi; i++)
{
MIDIINCAPS miin;
midiInGetDevCaps(i, &miin, sizeof(MIDIINCAPS));
DataR0.Device.AddString(miin.szPname);
}
}
else
DataR0.Device.AddString("no device");*/
#endif
// in->SetType(DTUnknown);
out->SelectMidiDevice(0);
out->SetMidiFile(wxEmptyString);
out->SetGUIDOFile(wxEmptyString);
out->SetMidiBendingRange(2);
out->SetMidiFileBendingRange(2);
InitializeDialog(out);
out->Fit();
return out;
}
IMPLEMENT_ABSTRACT_CLASS_TEMPLATE1(MutDeviceShape, MutIconShape, inputdevicetypes)
IMPLEMENT_ABSTRACT_CLASS_TEMPLATE1(MutDeviceShape, MutIconShape, outputdevicetypes)
template class MutDeviceShape<inputdevicetypes>;
template class MutDeviceShape<outputdevicetypes>;
MUTABOR_NAMESPACE_END(mutaborGUI)
template class std::list<mutaborGUI::MutInputDeviceShape *>;
template class std::list<mutaborGUI::MutOutputDeviceShape *>;
/*
* \}
*/
| Java |
/* iCalByDayMask.h - this file is part of SOPE
*
* Copyright (C) 2010-2015 Inverse inc.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef ICALBYDAYMASK_H
#define ICALBYDAYMASK_H
#import <Foundation/NSObject.h>
#import "iCalRecurrenceRule.h"
typedef enum {
iCalWeekOccurrenceFirst = 0x001, // order
iCalWeekOccurrenceSecond = 0x002, // 2^(order - 1)
iCalWeekOccurrenceThird = 0x004,
iCalWeekOccurrenceFourth = 0x008,
iCalWeekOccurrenceFifth = 0x010,
iCalWeekOccurrenceAll = 0x3ff,
iCalWeekOccurrenceLast = 0x020, // 2^(order - 1) >> 5
iCalWeekOccurrenceSecondLast = 0x040,
iCalWeekOccurrenceThirdLast = 0x080,
iCalWeekOccurrenceFourthLast = 0x100,
iCalWeekOccurrenceFifthLast = 0x200,
} iCalWeekOccurrence;
typedef iCalWeekOccurrence iCalWeekOccurrences[7];
// extern NSString *iCalWeekOccurrenceString[];
@interface iCalByDayMask : NSObject
{
iCalWeekOccurrences days;
}
+ (id) byDayMaskWithDays: (iCalWeekOccurrences) theDays;
+ (id) byDayMaskWithWeekDays;
- (id) initWithDays: (iCalWeekOccurrences) theDays;
+ (id) byDayMaskWithRuleString: (NSString *) byDayRule;
- (id) initWithRuleString: (NSString *) byDayRule;
+ (id) byDayMaskWithDaysAndOccurrences: (NSArray *) values;
- (id) initWithDaysAndOccurrences: (NSArray *) values;
- (BOOL) occursOnDay: (iCalWeekDay) weekDay;
- (BOOL) occursOnDay: (iCalWeekDay) weekDay
withWeekOccurrence: (iCalWeekOccurrence) occurrence;
- (BOOL) occursOnDay: (iCalWeekDay) weekDay
withWeekNumber: (int) week;
- (BOOL) isWeekDays;
//- (iCalWeekOccurrences *) allDays;
- (iCalWeekDay) firstDay;
- (int) firstOccurrence;
- (iCalWeekOccurrences *) weekDayOccurrences;
- (NSString *) asRuleString;
- (NSString *) asRuleStringWithIntegers;
- (NSArray *) asRuleArray;
@end
#endif /* ICALBYDAYMASK_H */
| Java |
package teammates.test.cases.action;
import org.testng.annotations.Test;
import teammates.common.datatransfer.DataBundle;
import teammates.common.datatransfer.attributes.FeedbackQuestionAttributes;
import teammates.common.datatransfer.attributes.FeedbackResponseAttributes;
import teammates.common.datatransfer.attributes.FeedbackSessionAttributes;
import teammates.common.datatransfer.attributes.InstructorAttributes;
import teammates.common.datatransfer.questions.FeedbackNumericalScaleQuestionDetails;
import teammates.common.exception.NullPostParameterException;
import teammates.common.util.Const;
import teammates.common.util.EmailType;
import teammates.common.util.EmailWrapper;
import teammates.common.util.StringHelper;
import teammates.common.util.TimeHelper;
import teammates.logic.core.CoursesLogic;
import teammates.storage.api.FeedbackQuestionsDb;
import teammates.storage.api.FeedbackResponsesDb;
import teammates.storage.api.FeedbackSessionsDb;
import teammates.ui.controller.InstructorFeedbackSubmissionEditSaveAction;
import teammates.ui.controller.RedirectResult;
/**
* SUT: {@link InstructorFeedbackSubmissionEditSaveAction}.
*/
public class InstructorFeedbackSubmissionEditSaveActionTest extends BaseActionTest {
private static final CoursesLogic coursesLogic = CoursesLogic.inst();
private final FeedbackSessionsDb fsDb = new FeedbackSessionsDb();
@Override
protected String getActionUri() {
return Const.ActionURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT_SAVE;
}
@Override
protected void prepareTestData() {
super.prepareTestData();
dataBundle = loadDataBundle("/InstructorFeedbackSubmissionEditSaveActionTest.json");
removeAndRestoreDataBundle(dataBundle);
}
@Override
@Test
public void testExecuteAndPostProcess() {
prepareTestData();
InstructorAttributes instructor1InCourse1 = dataBundle.getInstructors().get("instructor1InCourse1");
gaeSimulation.loginAsInstructor(instructor1InCourse1.googleId);
______TS("Unsuccessful case: test empty feedback session name parameter");
String[] submissionParams = new String[]{
Const.ParamsNames.COURSE_ID, dataBundle.getFeedbackResponses().get("response1ForQ1S1C1").courseId
};
InstructorFeedbackSubmissionEditSaveAction a;
RedirectResult r;
try {
a = getAction(submissionParams);
r = getRedirectResult(a);
signalFailureToDetectException("Did not detect that parameters are null.");
} catch (NullPostParameterException e) {
assertEquals(String.format(Const.StatusCodes.NULL_POST_PARAMETER,
Const.ParamsNames.FEEDBACK_SESSION_NAME), e.getMessage());
}
______TS("Unsuccessful case: test empty course id parameter");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_SESSION_NAME,
dataBundle.getFeedbackResponses().get("response1ForQ1S1C1").feedbackSessionName
};
try {
a = getAction(submissionParams);
r = getRedirectResult(a);
signalFailureToDetectException("Did not detect that parameters are null.");
} catch (NullPostParameterException e) {
assertEquals(String.format(Const.StatusCodes.NULL_POST_PARAMETER,
Const.ParamsNames.COURSE_ID), e.getMessage());
}
______TS("Successful case: edit existing answer");
FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
FeedbackQuestionAttributes fq = fqDb.getFeedbackQuestion("First Session", "idOfCourse1", 1);
assertNotNull("Feedback question not found in database", fq);
FeedbackResponsesDb frDb = new FeedbackResponsesDb();
FeedbackResponseAttributes fr = dataBundle.getFeedbackResponses().get("response1ForQ1S1C1");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
instructor1InCourse1 = dataBundle.getInstructors().get("instructor1InCourse1");
gaeSimulation.loginAsInstructor(instructor1InCourse1.googleId);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "Edited" + fr.getResponseDetails().getAnswerString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
// submission confirmation email not sent if parameter does not exist
verifyNoEmailsSent(a);
______TS("Successful case: deleted response");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "",
Const.ParamsNames.SEND_SUBMISSION_EMAIL, "on"
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
// submission confirmation email sent
verifyNumberOfEmailsSent(a, 1);
EmailWrapper email = getEmailsSent(a).get(0);
String courseName = coursesLogic.getCourse(fr.courseId).getName();
assertEquals(String.format(EmailType.FEEDBACK_SUBMISSION_CONFIRMATION.getSubject(), courseName,
fr.feedbackSessionName),
email.getSubject());
assertEquals(instructor1InCourse1.email, email.getRecipient());
______TS("Successful case: skipped question");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "",
Const.ParamsNames.SEND_SUBMISSION_EMAIL, "off"
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
// submission confirmation email not sent if parameter is not "on"
verifyNoEmailsSent(a);
______TS("Successful case: new response");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "New " + fr.getResponseDetails().getAnswerString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: edit response, did not specify recipient");
fq = fqDb.getFeedbackQuestion("First Session", "idOfCourse1", 2);
assertNotNull("Feedback question not found in database", fq);
fr = dataBundle.getFeedbackResponses().get("response1ForQ2S1C1");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-2", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-2-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-2", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-2-0", "student1InCourse1@gmail.tmt",
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-2", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-2-0", "Edited" + fr.getResponseDetails().getAnswerString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: new response, did not specify recipient");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-2", "1",
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-2", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-2-0", "student1InCourse1@gmail.tmt",
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-2", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-2-0", fr.getResponseDetails().getAnswerString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: private session");
fq = fqDb.getFeedbackQuestion("Private Session", "idOfCourse1", 1);
assertNotNull("Feedback question not found in database", fq);
fr = dataBundle.getFeedbackResponses().get("response1ForPrivateSession");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "Edited" + fr.getResponseDetails().getAnswerString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Unsuccessful case: modified recipient to invalid recipient");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", "invalid_recipient_email",
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", fr.getResponseDetails().getAnswerString(),
Const.ParamsNames.SEND_SUBMISSION_EMAIL, "on"
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertTrue(r.isError);
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "instructor1InCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, "invalid_recipient_email"));
// submission confirmation email not sent if the action is an error, even with submission parameter "on"
verifyNoEmailsSent(a);
______TS("Successful case: mcq: typical case");
DataBundle dataBundle = loadDataBundle("/FeedbackSessionQuestionTypeTest.json");
removeAndRestoreDataBundle(dataBundle);
fq = fqDb.getFeedbackQuestion("MCQ Session", "FSQTT.idOfTypicalCourse1", 2);
assertNotNull("Feedback question not found in database", fq);
fr = dataBundle.getFeedbackResponses().get("response1ForQ2S1C1");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
instructor1InCourse1 = dataBundle.getInstructors().get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1InCourse1.googleId);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "It's perfect"
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: mcq: question skipped");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: msq: typical case");
fq = fqDb.getFeedbackQuestion("MSQ Session", "FSQTT.idOfTypicalCourse1", 2);
assertNotNull("Feedback question not found in database", fq);
fr = dataBundle.getFeedbackResponses().get("response1ForQ2S2C1");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
instructor1InCourse1 = dataBundle.getInstructors().get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1InCourse1.googleId);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "It's perfect"
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful csae: msq: question skipped");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString()
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: numerical scale: typical case");
fq = fqDb.getFeedbackQuestion("NUMSCALE Session", "FSQTT.idOfTypicalCourse1", 2);
assertNotNull("Feedback question not found in database", fq);
FeedbackNumericalScaleQuestionDetails fqd =
(FeedbackNumericalScaleQuestionDetails) fq.getQuestionDetails();
fr = dataBundle.getFeedbackResponses().get("response1ForQ2S3C1");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
instructor1InCourse1 = dataBundle.getInstructors().get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1InCourse1.googleId);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "3.5",
Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN + "-1-0", Integer.toString(fqd.getMinScale()),
Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX + "-1-0", Integer.toString(fqd.getMaxScale()),
Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP + "-1-0", StringHelper.toDecimalFormatString(fqd.getStep())
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: numerical scale: question skipped");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "",
Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN + "-1-0", Integer.toString(fqd.getMinScale()),
Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX + "-1-0", Integer.toString(fqd.getMaxScale()),
Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP + "-1-0", StringHelper.toDecimalFormatString(fqd.getStep())
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: const sum: typical case");
fq = fqDb.getFeedbackQuestion("CONSTSUM Session", "FSQTT.idOfTypicalCourse1", 2);
assertNotNull("Feedback question not found in database", fq);
fr = dataBundle.getFeedbackResponses().get("response1ForQ2S4C1");
// necessary to get the correct responseId
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
FeedbackResponseAttributes fr2 = dataBundle.getFeedbackResponses().get("response2ForQ2S4C1");
// necessary to get the correct responseId
fr2 = frDb.getFeedbackResponse(fq.getId(), fr2.giver, fr2.recipient);
assertNotNull("Feedback response not found in database", fr2);
instructor1InCourse1 = dataBundle.getInstructors().get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1InCourse1.googleId);
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "2",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "150",
//Const sum question needs response to each recipient to sum up properly.
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-1", fr2.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr2.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr2.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr2.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-1", fr2.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr2.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-1", "50",
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertFalse(r.isError);
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr2.giver, fr2.recipient));
______TS("Successful case: const sum: question skipped");
submissionParams = new String[]{
Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1",
Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName,
Const.ParamsNames.COURSE_ID, fr.courseId,
Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId,
Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient,
Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(),
Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", ""
};
a = getAction(submissionParams);
r = getRedirectResult(a);
assertFalse(r.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, r.isError, "FSQTT.idOfInstructor1OfCourse1"),
r.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("Successful case: contrib qn: typical case");
// No tests since contrib qn can only be answered by students to own team members including self.
}
@Test
public void testGracePeriodExecuteAndPostProcess() throws Exception {
dataBundle = loadDataBundle("/InstructorFeedbackSubmissionEditSaveActionTest.json");
FeedbackSessionsDb feedbackSessionDb = new FeedbackSessionsDb();
FeedbackSessionAttributes fs = dataBundle.getFeedbackSessions().get("Grace Period Session");
InstructorAttributes instructor = dataBundle.getInstructors().get("instructor1InCourse1");
gaeSimulation.loginAsInstructor(instructor.googleId);
String[] submissionParams = new String[]{
Const.ParamsNames.COURSE_ID, fs.getCourseId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName()
};
______TS("opened");
fs.setEndTime(TimeHelper.getDateOffsetToCurrentTime(1));
feedbackSessionDb.updateFeedbackSession(fs);
assertTrue(fs.isOpened());
assertFalse(fs.isInGracePeriod());
InstructorFeedbackSubmissionEditSaveAction a = getAction(submissionParams);
RedirectResult r = getRedirectResult(a);
assertEquals(
getPageResultDestination(
Const.ActionURIs.INSTRUCTOR_HOME_PAGE, false, "instructor1InCourse1"),
r.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertFalse(r.isError);
______TS("during grace period");
fs.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0));
feedbackSessionDb.updateFeedbackSession(fs);
assertFalse(fs.isOpened());
assertTrue(fs.isInGracePeriod());
a = getAction(submissionParams);
r = getRedirectResult(a);
assertEquals(
getPageResultDestination(Const.ActionURIs.INSTRUCTOR_HOME_PAGE, false, "instructor1InCourse1"),
r.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, r.getStatusMessage());
assertFalse(r.isError);
______TS("after grace period");
fs.setEndTime(TimeHelper.getDateOffsetToCurrentTime(-10));
feedbackSessionDb.updateFeedbackSession(fs);
assertFalse(fs.isOpened());
assertFalse(fs.isInGracePeriod());
a = getAction(submissionParams);
r = getRedirectResult(a);
assertEquals(Const.StatusMessages.FEEDBACK_SUBMISSIONS_NOT_OPEN, r.getStatusMessage());
}
@Override
protected InstructorFeedbackSubmissionEditSaveAction getAction(String... params) {
return (InstructorFeedbackSubmissionEditSaveAction) gaeSimulation.getActionObject(getActionUri(), params);
}
@Override
@Test
protected void testAccessControl() throws Exception {
dataBundle = getTypicalDataBundle();
FeedbackSessionAttributes fs = dataBundle.getFeedbackSessions().get("session1InCourse1");
String[] submissionParams = new String[]{
Const.ParamsNames.COURSE_ID, fs.getCourseId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName()
};
verifyUnaccessibleWithoutSubmitSessionInSectionsPrivilege(submissionParams);
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
testGracePeriodAccessControlForInstructors();
}
private void testGracePeriodAccessControlForInstructors() throws Exception {
dataBundle = getTypicalDataBundle();
FeedbackSessionAttributes fs = dataBundle.getFeedbackSessions().get("gracePeriodSession");
closeSession(fs);
assertFalse(fs.isOpened());
assertTrue(fs.isInGracePeriod());
assertFalse(fs.isClosed());
String[] submissionParams = new String[]{
Const.ParamsNames.COURSE_ID, fs.getCourseId(),
Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName()
};
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
}
private void closeSession(FeedbackSessionAttributes fs) throws Exception {
fs.setEndTime(TimeHelper.getDateOffsetToCurrentTime(0));
fsDb.updateFeedbackSession(fs);
}
}
| Java |
/*
* Copyright (c) 2001-2006 TIBCO Software Inc.
* All rights reserved.
* For more information, please contact:
* TIBCO Software Inc., Palo Alto, California, USA
*
* $Id: emserr.h 23734 2006-11-21 20:02:10Z $
*
*/
#ifndef _INCLUDED_emserr_h
#define _INCLUDED_emserr_h
#include "types.h"
#include "status.h"
#if defined(__cplusplus)
extern "C" {
#endif
extern tibems_status
tibemsErrorContext_Create(
tibemsErrorContext* errorContext);
extern tibems_status
tibemsErrorContext_Close(
tibemsErrorContext errorContext);
extern tibems_status
tibemsErrorContext_GetLastErrorString(
tibemsErrorContext errorContext,
const char** string);
extern tibems_status
tibemsErrorContext_GetLastErrorStackTrace(
tibemsErrorContext errorContext,
const char** string);
#ifdef __cplusplus
}
#endif
#endif
| Java |
# accounts/authentication.py
import requests
import logging
from django.conf import settings
from django.contrib.auth import get_user_model
logger = logging.getLogger(__name__)
User = get_user_model()
PERSONA_VERIFY_URL = 'https://verifier.login.persona.org/verify'
#DOMAIN = 'localhost'
#DOMAIN = 'http://hotzenplotz.pythonanywhere.com'
class PersonaAuthenticationBackend(object):
def authenticate(self, assertion):
logging.warning('entering authenticate function')
response = requests.post(
PERSONA_VERIFY_URL,
data = {'assertion': assertion, 'audience': settings.DOMAIN}
)
logging.warning('got response from persona')
logging.warning(response.content.decode())
if response.ok and response.json()['status'] == 'okay':
email = response.json()['email']
try:
return User.objects.get(email=email)
except User.DoesNotExist:
return User.objects.create(email=email)
else:
logger.warning(
'Persona says no. Json was: {}'.format(response.json())
)
def get_user(self, email):
try:
return User.objects.get(email=email)
except User.DoesNotExist:
return None
| Java |
#!/bin/bash
for jobdir in $(ls -l|grep ^d|awk '{print $9}');do
# Determine job type
jobtype=$(echo $jobdir|cut -d '-' -f4)
case $jobtype in
absperm)
sub="qsub -lwalltime=08:00:00 -lnodes=1:ppn=8 -N $jobdir -M tor@numericalrocks.com /home/steel/runscript-absperm.sh"
;;
rwabsperm)
sub="qsub -lwalltime=08:00:00 -lnodes=1:ppn=8 -N $jobdir -M tor@numericalrocks.com /home/steel/rwabsperm.sh"
;;
rwff)
sub="qsub -lwalltime=08:00:00 -lnodes=1:ppn=8 -N $jobdir -M tor@numericalrocks.com /home/steel/rwformationfactor.sh"
;;
esac
# Submit the job if jobdir has no .out files
if (( $(ls -l $jobdir|grep -c .out) == 0 ));then
cd $jobdir
$sub
cd ..
fi
done
| Java |
/***************************************************************************
* Copyright (C) 2009 by Andrey Afletdinov <fheroes2@gmail.com> *
* *
* Part of the Free Heroes2 Engine: *
* http://sourceforge.net/projects/fheroes2 *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef MIDI_CHUNK_H
#define MIDI_CHUNK_H
#include <ostream>
#include <istream>
#include <vector>
#include "midi.h"
namespace MIDI
{
class Chunk
{
public:
char id[4];
u32 size;
u8* data;
Chunk();
Chunk(const char *i, const u32 s, const u8 *p = NULL);
Chunk(std::istream & i);
Chunk(const u8 *p);
Chunk(const Chunk & c);
~Chunk();
Chunk & operator= (const Chunk & c);
bool Write(std::ostream & o) const;
bool Write(u8 *p) const;
bool Read(std::istream & i);
bool Read(const u8 *p);
bool Read(const std::vector<u8> & b);
void Dump(void) const;
};
}
#endif
| Java |
#include <iostream>
#include <fstream>
#include <iterator>
#include <string>
#include <set>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef unsigned long long U64;
typedef int S32;
typedef unsigned int U32;
typedef struct tag_things
{
U64 nCode; // 编码
S32 nLongitude; // 经度
S32 nLatitude; // 纬度
U32 nType:8;
U32 nGender: 2; // 性别,1男2女
U32 nSub:8;
U32 nFish:7; //投放的鱼克数(最大100g)
U32 nGears:3; //投放档位
#define _Gear_L0 0 // 无限制
#define _Gear_L1 1 // 1公里
#define _Gear_L2 2 // 4公里
#define _Gear_L3 3 // 8公里
#define _Gear_L4 4 // 20公里
U32 nRe:4; // 保留
U32 nRe2;
} Record_Things;
bool operator<(const tag_things &lhs, const tag_things &rhs)
{
if (lhs.nCode != rhs.nCode)
{
return lhs.nCode < rhs.nCode;
}
if (lhs.nLatitude != rhs.nLatitude)
{
return lhs.nLatitude < rhs.nLatitude;
}
if (lhs.nLongitude != rhs.nLongitude)
{
return lhs.nLongitude < rhs.nLongitude;
}
return false;
}
int main(int argc, char *argv[])
{
if (argc != 2)
{
cerr << "No input file!" << endl;
return -1;
}
FILE *fp = fopen(argv[1], "r");
int num = 0;
int cnt = 0;
fread(&num, sizeof(int), 1, fp);
printf("num: %d\n", num);
Record_Things thing;
set<Record_Things> rec_set;
while (!feof(fp) && cnt < num)
{
fread(&thing, sizeof(Record_Things), 1, fp);
rec_set.insert(thing);
// printf("%lld, %d, %d, %d\n", thing.nCode, thing.nLongitude,
// thing.nLatitude, thing.nRe2);
++cnt;
}
fclose(fp);
// ofstream out_file("1.dat");
// out_file << num;
// ostream_iterator<Record_Things> out_it(out_file, "");
// copy(rec_set.begin(), rec_set.end(), out_it);
// out.close();
fp = fopen("1.dat", "wb");
fwrite(&num, sizeof(int), 1, fp);
cout << sizeof(Record_Things) << endl;
for (auto it = rec_set.begin(); it != rec_set.end(); ++it)
{
// cout << it->nCode << ", " << it->nLongitude << ", " << it->nLatitude
// << ", " << it->nRe2 << endl;
// out_file << *it;
fwrite(&*it, sizeof(Record_Things), 1, fp);
cout << sizeof(*it) << endl;
}
// out_file.close();
return 0;
} | Java |
import os
import sys
import subprocess
testP = {
"2005": [
{
"date": "2005-10-17",
"videos": [
"http://thecolbertreport.cc.com/videos/61f6xj/intro---10-17-05",
"http://thecolbertreport.cc.com/videos/w9dr6d/first-show",
"http://thecolbertreport.cc.com/videos/63ite2/the-word---truthiness",
"http://thecolbertreport.cc.com/videos/2hvbwp/threatdown---bird-flu",
"http://thecolbertreport.cc.com/videos/ydz3a0/stone-phillips",
"http://thecolbertreport.cc.com/videos/4ewylv/gravitas-off-with-stone-phillips",
"http://thecolbertreport.cc.com/videos/e3mrnm/sign-off---commemorating-chewbacca-s-american-citizenship"
],
"guest": "Stone Phillips"
},
{
"date": "2005-10-18",
"videos": [
"http://thecolbertreport.cc.com/videos/u39l6v/intro---10-18-05",
"http://thecolbertreport.cc.com/videos/kzin67/the-word---bacchanalia",
"http://thecolbertreport.cc.com/videos/5icgst/all-you-need-to-know---illegal-immigration",
"http://thecolbertreport.cc.com/videos/fydq17/lesley-stahl",
"http://thecolbertreport.cc.com/videos/235ftw/better-know-a-district---georgia-s-1st---jack-kingston",
"http://thecolbertreport.cc.com/videos/joj31r/sign-off---a-fax-from-james-brady"
],
"guest": "Lesley Stahl"
},
{
"date": "2005-10-19",
"videos": [
"http://thecolbertreport.cc.com/videos/vmoc19/intro---10-19-05",
"http://thecolbertreport.cc.com/videos/gpmykq/the-word---disappointed",
"http://thecolbertreport.cc.com/videos/95k30i/stephen-settles-the-debate---whales-and-cod-vs--polar-bears-and-seal-hunters",
"http://thecolbertreport.cc.com/videos/p42ju6/on-notice---bobby-s-candy-apples",
"http://thecolbertreport.cc.com/videos/malmcz/tip-wag---teen-pregnancy---katie-s-no-lady",
"http://thecolbertreport.cc.com/videos/db0w9q/fareed-zakaria",
"http://thecolbertreport.cc.com/videos/8kkcau/sign-off---the-in-box---you-re-great"
],
"guest": "Fareed Zakaria"
},
{
"date": "2005-10-20",
"videos": [
"http://thecolbertreport.cc.com/videos/rwhdnt/intro---10-20-05",
"http://thecolbertreport.cc.com/videos/p1n8k4/avian-flu",
"http://thecolbertreport.cc.com/videos/mk7yrx/russ-lieber---candy-and-air",
"http://thecolbertreport.cc.com/videos/cz3euw/un-american-news---the-foreign-press",
"http://thecolbertreport.cc.com/videos/j1b7vj/jim-cramer",
"http://thecolbertreport.cc.com/videos/rohluc/sign-off---credit-cards",
"http://thecolbertreport.cc.com/videos/24lb41/the-word---love-handles"
],
"guest": "Jim Cramer"
},
{
"date": "2005-10-24",
"videos": [
"http://thecolbertreport.cc.com/videos/67cs19/intro---10-24-05",
"http://thecolbertreport.cc.com/videos/gv2cjs/the-word---pussy",
"http://thecolbertreport.cc.com/videos/i491tt/lou-dobbs",
"http://thecolbertreport.cc.com/videos/dd1sbx/fract---the-wright-brothers",
"http://thecolbertreport.cc.com/videos/wtqx4r/bring--em-back-or-leave--em-dead---inquisition",
"http://thecolbertreport.cc.com/videos/qgvny1/mug-shot",
"http://thecolbertreport.cc.com/videos/vuftif/against-the-pundocracy"
],
"guest": "Lou Dobbs"
},
{
"date": "2005-10-25",
"videos": [
"http://thecolbertreport.cc.com/videos/lldiq0/intro---10-25-05",
"http://thecolbertreport.cc.com/videos/whvmzj/benjamin-shalom-bernanke",
"http://thecolbertreport.cc.com/videos/iqvyat/the-word---overrated",
"http://thecolbertreport.cc.com/videos/qwe0c7/threatdown---anti-bacterial-soap",
"http://thecolbertreport.cc.com/videos/7ioxmq/greg-behrendt",
"http://thecolbertreport.cc.com/videos/nwkm8y/greg-behrendt-fields-calls",
"http://thecolbertreport.cc.com/videos/vzk1ho/yet-another-day---soup-and-pets"
],
"guest": "Greg Behrendt"
},
{
"date": "2005-10-26",
"videos": [
"http://thecolbertreport.cc.com/videos/nxsljd/intro---10-26-05",
"http://thecolbertreport.cc.com/videos/39lnsj/outsourcing",
"http://thecolbertreport.cc.com/videos/7o86ff/the-word---perspective",
"http://thecolbertreport.cc.com/videos/yuq4bm/neil-degrasse-tyson",
"http://thecolbertreport.cc.com/videos/5fyjl2/tip-wag---public-nudity-advice",
"http://thecolbertreport.cc.com/videos/wsfpru/the-pulse"
],
"guest": "Neil deGrasse Tyson"
},
{
"date": "2005-10-27",
"videos": [
"http://thecolbertreport.cc.com/videos/ap807f/intro---10-27-05",
"http://thecolbertreport.cc.com/videos/nb6dxf/lieber---white-pumpkins",
"http://thecolbertreport.cc.com/videos/llj5fu/the-word---quitter",
"http://thecolbertreport.cc.com/videos/1vbs16/bookshelf-of-broken-dreams",
"http://thecolbertreport.cc.com/videos/ynldrg/fract---the-states",
"http://thecolbertreport.cc.com/videos/zyop79/better-know-a-district---massachusetts--4th---barney-frank",
"http://thecolbertreport.cc.com/videos/h9zw2j/jeff-daniels",
"http://thecolbertreport.cc.com/videos/3eb29d/yet-another-day---checking-in-with-christina-and-ernesto"
],
"guest": "Jeff Daniels"
},
{
"date": "2005-10-31",
"videos": [
"http://thecolbertreport.cc.com/videos/11fva6/intro---10-31-05",
"http://thecolbertreport.cc.com/videos/mqoacz/criminal-intent",
"http://thecolbertreport.cc.com/videos/p3782h/patrick-fitzgerald-s-press-conference",
"http://thecolbertreport.cc.com/videos/ey4w8s/the-word---alito",
"http://thecolbertreport.cc.com/videos/jfbl04/monica-crowley",
"http://thecolbertreport.cc.com/videos/sxj08u/fract---greatest-lakes",
"http://thecolbertreport.cc.com/videos/5d63df/stephen-settles-the-debate---ramadan-or-halloween-",
"http://thecolbertreport.cc.com/videos/qc29ld/rocktober"
],
"guest": "Monica Crowley"
},
{
"date": "2005-11-01",
"videos": [
"http://thecolbertreport.cc.com/videos/1zu9d3/intro---11-1-05",
"http://thecolbertreport.cc.com/videos/r7fmyb/the-word---camilla-mania",
"http://thecolbertreport.cc.com/videos/ufgobt/emergency-evacuation-plan",
"http://thecolbertreport.cc.com/videos/b7u1wy/ken-burns",
"http://thecolbertreport.cc.com/videos/kpjrtm/formidable-opponent---charity"
],
"guest": "Ken Burns"
},
{
"date": "2005-11-02",
"videos": [
"http://thecolbertreport.cc.com/videos/1kskdq/intro---11-2-05",
"http://thecolbertreport.cc.com/videos/xp1gbs/fatwa",
"http://thecolbertreport.cc.com/videos/8e6qo8/c-span-coverage",
"http://thecolbertreport.cc.com/videos/ayw8g9/the-word---cat",
"http://thecolbertreport.cc.com/videos/ey3oos/fract---civil-war",
"http://thecolbertreport.cc.com/videos/9438aw/the-war-on-wal-mart",
"http://thecolbertreport.cc.com/videos/nvopei/bruce-feiler",
"http://thecolbertreport.cc.com/videos/6v0azb/lieber---one-testicle"
],
"guest": "Bruce Feiler"
},
{
"date": "2005-11-03",
"videos": [
"http://thecolbertreport.cc.com/videos/4g6fdp/intro---11-3-05",
"http://thecolbertreport.cc.com/videos/9lmjfq/the-word---shhhh----",
"http://thecolbertreport.cc.com/videos/tq3k8n/bradley-whitford",
"http://thecolbertreport.cc.com/videos/wwof8g/fract---karl-marx",
"http://thecolbertreport.cc.com/videos/cxtvxm/better-know-a-district---ohio-s-11th---stephanie-tubbs-jones",
"http://thecolbertreport.cc.com/videos/86juj9/judge-tubbs",
"http://thecolbertreport.cc.com/videos/mkig56/the-in-box---kicking-ass"
],
"guest": "Bradley Whitford"
},
{
"date": "2005-11-07",
"videos": [
"http://thecolbertreport.cc.com/videos/lbtbtl/intro---11-7-05",
"http://thecolbertreport.cc.com/videos/s0yn8n/rioting-do-s-and-don-ts",
"http://thecolbertreport.cc.com/videos/2iezg1/the-word---hoser",
"http://thecolbertreport.cc.com/videos/dzis1b/fract---frnap--the-freedom-snap",
"http://thecolbertreport.cc.com/videos/1xhewi/threatdown---pirates",
"http://thecolbertreport.cc.com/videos/fjfr4z/eliot-spitzer",
"http://thecolbertreport.cc.com/videos/ufqqpc/rock--em-sock--em-robots"
],
"guest": "Eliot Spitzer"
},
{
"date": "2005-11-08",
"videos": [
"http://thecolbertreport.cc.com/videos/2lgs12/intro---11-8-05",
"http://thecolbertreport.cc.com/videos/5lxdom/america-doesn-t-torture",
"http://thecolbertreport.cc.com/videos/xul3qa/intercepted-satellite-feed",
"http://thecolbertreport.cc.com/videos/huzs1z/the-word---t-o-",
"http://thecolbertreport.cc.com/videos/7nl1pw/fract---franagram--american-patriot",
"http://thecolbertreport.cc.com/videos/wgvsjo/tip-wag---convicted-murderers",
"http://thecolbertreport.cc.com/videos/0l19is/catherine-crier",
"http://thecolbertreport.cc.com/videos/6zdr9d/wilford-brimley-calls---cocoon",
"http://thecolbertreport.cc.com/videos/ykxirt/yet-another-day---flesh-eating-virus"
],
"guest": "Catherine Crier"
},
{
"date": "2005-11-09",
"videos": [
"http://thecolbertreport.cc.com/videos/s6miz8/intro---11-9-05",
"http://thecolbertreport.cc.com/videos/5fvmyv/next-question",
"http://thecolbertreport.cc.com/videos/bcmkct/the-word---willy-loman",
"http://thecolbertreport.cc.com/videos/43es16/all-you-need-to-know---kansas-education",
"http://thecolbertreport.cc.com/videos/nzfogn/mary-roach",
"http://thecolbertreport.cc.com/videos/gqeqrk/better-know-a-district---florida-s-7th---john-mica"
],
"guest": "Mary Roach"
},
{
"date": "2005-11-10",
"videos": [
"http://thecolbertreport.cc.com/videos/jqfk3o/intro---11-10-05",
"http://thecolbertreport.cc.com/videos/8c7dra/swear-to-god",
"http://thecolbertreport.cc.com/videos/9kcrqk/the-word---armistice",
"http://thecolbertreport.cc.com/videos/o63fqi/cokie-roberts",
"http://thecolbertreport.cc.com/videos/bd1uuq/the-in-box---asian-stereotypes",
"http://thecolbertreport.cc.com/videos/c0bksd/the-dacolbert-code---samuel-alito"
],
"guest": "Cokie Roberts"
},
{
"date": "2005-11-14",
"videos": [
"http://thecolbertreport.cc.com/videos/e5zymg/intro---11-14-05",
"http://thecolbertreport.cc.com/videos/gfzikt/cma-buzz",
"http://thecolbertreport.cc.com/videos/jaukv1/the-word---testosterone",
"http://thecolbertreport.cc.com/videos/oel1ef/bob-kerrey",
"http://thecolbertreport.cc.com/videos/2lpp85/tip-line---flag-sticker",
"http://thecolbertreport.cc.com/videos/1wb4cs/un-american-news---shame-cotton",
"http://thecolbertreport.cc.com/videos/kuqe6u/internets-anniversary"
],
"guest": "Sen. Bob Kerrey"
},
{
"date": "2005-11-15",
"videos": [
"http://thecolbertreport.cc.com/videos/c8h749/intro---11-15-05",
"http://thecolbertreport.cc.com/videos/9jy462/sayako-s-wedding",
"http://thecolbertreport.cc.com/videos/yctr24/the-word---the-orient",
"http://thecolbertreport.cc.com/videos/4z4p4o/bring--em-back-or-leave--em-dead---asian-history",
"http://thecolbertreport.cc.com/videos/94g5r1/al-sharpton",
"http://thecolbertreport.cc.com/videos/9disf3/fract---mt--rushmore",
"http://thecolbertreport.cc.com/videos/w11pi7/formidable-opponent---torture"
],
"guest": "Rev. Al Sharpton"
},
{
"date": "2005-11-16",
"videos": [
"http://thecolbertreport.cc.com/videos/nl3o0c/intro---11-16-05",
"http://thecolbertreport.cc.com/videos/ebxyv5/the-word---information",
"http://thecolbertreport.cc.com/videos/eh69qj/on-notice-dead-to-me---juan-gabriel",
"http://thecolbertreport.cc.com/videos/h1e498/better-know-a-district---colorado-s-2nd---mark-udall",
"http://thecolbertreport.cc.com/videos/ddef4x/matt-taibbi",
"http://thecolbertreport.cc.com/videos/4kvhir/america--sleep-safe"
],
"guest": "Matt Taibbi"
},
{
"date": "2005-11-17",
"videos": [
"http://thecolbertreport.cc.com/videos/zl8rtq/intro---11-17-05",
"http://thecolbertreport.cc.com/videos/f8fusi/no-good-deed",
"http://thecolbertreport.cc.com/videos/pxeto4/the-word---mcconaughey-",
"http://thecolbertreport.cc.com/videos/bypiaq/threatdown---children",
"http://thecolbertreport.cc.com/videos/smm3x9/tim-robbins",
"http://thecolbertreport.cc.com/videos/wk6dps/here-today--more-tomorrow",
"http://thecolbertreport.cc.com/videos/8sxlv8/thanksgiving-vacation"
],
"guest": "Tim Robbins"
},
{
"date": "2005-11-28",
"videos": [
"http://thecolbertreport.cc.com/videos/sf87bf/intro---11-28-05",
"http://thecolbertreport.cc.com/videos/nrf3km/cyber-monday",
"http://thecolbertreport.cc.com/videos/sqsdz6/the-word---never",
"http://thecolbertreport.cc.com/videos/r6xqra/viewer-phone-calls",
"http://thecolbertreport.cc.com/videos/vdncvg/stephen-settles-the-debate---science-vs--faith",
"http://thecolbertreport.cc.com/videos/507rw4/brian-greene",
"http://thecolbertreport.cc.com/videos/ngo5nh/sign-off---check-your-local-listings"
],
"guest": "Brian Greene"
},
{
"date": "2005-11-29",
"videos": [
"http://thecolbertreport.cc.com/videos/4yku0o/intro---11-29-05",
"http://thecolbertreport.cc.com/videos/zaot6p/better-know-a-district---california-s-50th---randy--duke--cunningham",
"http://thecolbertreport.cc.com/videos/o2kdz0/the-word---confidence",
"http://thecolbertreport.cc.com/videos/6f1i25/was-it-really-that-bad----black-death",
"http://thecolbertreport.cc.com/videos/75dr62/the--duke-s--things",
"http://thecolbertreport.cc.com/videos/rtbpes/richard-preston"
],
"guest": "Richard Preston"
},
{
"date": "2005-11-30",
"videos": [
"http://thecolbertreport.cc.com/videos/951mir/intro---11-30-05",
"http://thecolbertreport.cc.com/videos/jsl09o/the-word---gay-gay-gay-gay-gay",
"http://thecolbertreport.cc.com/videos/h7okp1/fract---nobody-messes-with-house",
"http://thecolbertreport.cc.com/videos/ut6y25/katrina-vanden-heuvel",
"http://thecolbertreport.cc.com/videos/0frx2n/around-the-world-in-11-6-seconds---media"
],
"guest": "Katrina Vanden Heuvel"
},
{
"date": "2005-12-01",
"videos": [
"http://thecolbertreport.cc.com/videos/j4tan3/intro---12-1-05",
"http://thecolbertreport.cc.com/videos/bocj8y/giant-gold-washer",
"http://thecolbertreport.cc.com/videos/w4dblj/the-word---spectacle",
"http://thecolbertreport.cc.com/videos/3yvygm/tip-wag---seattle",
"http://thecolbertreport.cc.com/videos/idpn3b/richard-clarke",
"http://thecolbertreport.cc.com/videos/9icneu/face-transplant"
],
"guest": "Richard Clarke"
},
{
"date": "2005-12-05",
"videos": [
"http://thecolbertreport.cc.com/videos/0yxnmj/intro---12-5-05",
"http://thecolbertreport.cc.com/videos/utqsnp/kennedy-center-honors",
"http://thecolbertreport.cc.com/videos/278dqm/the-word---xmas",
"http://thecolbertreport.cc.com/videos/6ulwwh/apology",
"http://thecolbertreport.cc.com/videos/sg4wi3/this-week-in-history---december-4th-10th",
"http://thecolbertreport.cc.com/videos/p01a0h/colbert-nation-citizen-award",
"http://thecolbertreport.cc.com/videos/djl273/maureen-dowd"
],
"guest": "Maureen Dowd"
},
{
"date": "2005-12-06",
"videos": [
"http://thecolbertreport.cc.com/videos/ad0e3u/intro---12-6-05",
"http://thecolbertreport.cc.com/videos/l23e5t/the-word---backsies",
"http://thecolbertreport.cc.com/videos/c6b939/better-know-a-district---virginia-s-8th---jim-moran",
"http://thecolbertreport.cc.com/videos/bgq83k/fract---the-star-spangled-banner",
"http://thecolbertreport.cc.com/videos/mjqiqk/anderson-cooper",
"http://thecolbertreport.cc.com/videos/jo01oi/season-of-giving"
],
"guest": "Anderson Cooper"
},
{
"date": "2005-12-07",
"videos": [
"http://thecolbertreport.cc.com/videos/uvfu4h/intro---12-7-05",
"http://thecolbertreport.cc.com/videos/k5nni4/burritos-happy-holidays",
"http://thecolbertreport.cc.com/videos/rmm1zo/the-word---hell--no-",
"http://thecolbertreport.cc.com/videos/5ti5hp/threatdown---threats",
"http://thecolbertreport.cc.com/videos/1buius/craig-crawford"
],
"guest": "Craig Crawford"
},
{
"date": "2005-12-08",
"videos": [
"http://thecolbertreport.cc.com/videos/muvtpz/intro---12-8-07",
"http://thecolbertreport.cc.com/videos/zo8qem/the-mallomar",
"http://thecolbertreport.cc.com/videos/9zltfz/the-word---satisfied-",
"http://thecolbertreport.cc.com/videos/zc6wzp/papa-bear-nailed-him",
"http://thecolbertreport.cc.com/videos/0k58ru/movies-that-are-destroying-america---christmas",
"http://thecolbertreport.cc.com/videos/f63xob/peggy-noonan",
"http://thecolbertreport.cc.com/videos/huxiwh/nationwide-secret-santa"
],
"guest": "Peggy Noonan"
},
{
"date": "2005-12-12",
"videos": [
"http://thecolbertreport.cc.com/videos/26ln5h/intro---12-12-05",
"http://thecolbertreport.cc.com/videos/th38l3/the-real-christmas",
"http://thecolbertreport.cc.com/videos/xld8bn/the-word---belly-achin-",
"http://thecolbertreport.cc.com/videos/4qrc6w/un-american-news---tootsie",
"http://thecolbertreport.cc.com/videos/gljaa1/fract---war",
"http://thecolbertreport.cc.com/videos/tos96b/harry-smith",
"http://thecolbertreport.cc.com/videos/onf96q/the-in-box---custom-stamps"
],
"guest": "Harry Smith"
},
{
"date": "2005-12-13",
"videos": [
"http://thecolbertreport.cc.com/videos/hh6w14/intro---12-13-05",
"http://thecolbertreport.cc.com/videos/f3vpvn/the-de-ballification-of-the-american-sportscape",
"http://thecolbertreport.cc.com/videos/omscph/the-word---lombardi",
"http://thecolbertreport.cc.com/videos/53a836/sports-update",
"http://thecolbertreport.cc.com/videos/reee2h/formidable-opponent---steroids",
"http://thecolbertreport.cc.com/videos/raw18i/fract---nba",
"http://thecolbertreport.cc.com/videos/mopfat/bob-costas",
"http://thecolbertreport.cc.com/videos/97uhmb/sign-off---excellence-in-everything"
],
"guest": "Bob Costas"
},
{
"date": "2005-12-14",
"videos": [
"http://thecolbertreport.cc.com/videos/irtzij/intro---12-14-05",
"http://thecolbertreport.cc.com/videos/rxzsfq/king-kong",
"http://thecolbertreport.cc.com/videos/g7vs24/the-word---travolta",
"http://thecolbertreport.cc.com/videos/j8pyop/tip-wag---redefining-cruel-and-unusual",
"http://thecolbertreport.cc.com/videos/po8ta2/dermot-mulroney",
"http://thecolbertreport.cc.com/videos/nf6l8d/sign-off---three-stockings"
],
"guest": "Dermot Mulroney"
},
{
"date": "2005-12-15",
"videos": [
"http://thecolbertreport.cc.com/videos/12ie90/intro---12-15-05",
"http://thecolbertreport.cc.com/videos/7x2gjd/war-on-holiday",
"http://thecolbertreport.cc.com/videos/1286w8/the-word---jetpack",
"http://thecolbertreport.cc.com/videos/4epy8c/better-know-a-district---new-york-s-11th---major-owens",
"http://thecolbertreport.cc.com/videos/gn64jt/mark-cuban",
"http://thecolbertreport.cc.com/videos/9d08kf/tax-deductions"
],
"guest": "Mark Cuban"
}
],
"2006": [
{
"date": "2006-01-09",
"videos": [
"http://thecolbertreport.cc.com/videos/ccm8j9/intro---1-9-2006",
"http://thecolbertreport.cc.com/videos/gfhklq/merry-christmas",
"http://thecolbertreport.cc.com/videos/k2b0t4/going-at-it",
"http://thecolbertreport.cc.com/videos/tfsnjk/the-lusk-alito-connection",
"http://thecolbertreport.cc.com/videos/zvszwh/the-word---there-is-no-word",
"http://thecolbertreport.cc.com/videos/wm808s/tip-wag---addicted-to-cute",
"http://thecolbertreport.cc.com/videos/fx17nm/fract---columbus",
"http://thecolbertreport.cc.com/videos/nctzb0/nancy-grace",
"http://thecolbertreport.cc.com/videos/vt9veh/on-notice-dead-to-me---word-of-the-year"
],
"guest": "Nancy Grace"
},
{
"date": "2006-01-10",
"videos": [
"http://thecolbertreport.cc.com/videos/zffhux/intro---1-10-02",
"http://thecolbertreport.cc.com/videos/znlsxv/off-notice---the-e-street-band",
"http://thecolbertreport.cc.com/videos/jz3vjq/the-word---sleeper-cell",
"http://thecolbertreport.cc.com/videos/fzr3d5/balls-for-kidz---bear-hunting",
"http://thecolbertreport.cc.com/videos/uk2dty/carl-bernstein",
"http://thecolbertreport.cc.com/videos/lppcfe/the-in-box---taking-a-bullet"
],
"guest": "Carl Bernstein"
},
{
"date": "2006-01-11",
"videos": [
"http://thecolbertreport.cc.com/videos/yq13d1/intro---1-11-06",
"http://thecolbertreport.cc.com/videos/kci614/colbert-report-consumer-alert",
"http://thecolbertreport.cc.com/videos/ho8xgd/alito-haters",
"http://thecolbertreport.cc.com/videos/vko8sm/the-word---whatever",
"http://thecolbertreport.cc.com/videos/bbh162/threatdown---fathers-and-sons",
"http://thecolbertreport.cc.com/videos/o71qa3/fract---colbert-trivia",
"http://thecolbertreport.cc.com/videos/4z25yz/john-stossel",
"http://thecolbertreport.cc.com/videos/gsuxni/sign-off---future-money"
],
"guest": "John Stossel"
},
{
"date": "2006-01-12",
"videos": [
"http://thecolbertreport.cc.com/videos/vkw0ea/intro---1-12-06",
"http://thecolbertreport.cc.com/videos/smz33e/the-oscars",
"http://thecolbertreport.cc.com/videos/hldbza/the-word---double-stick-tape",
"http://thecolbertreport.cc.com/videos/ycx56p/better-know-a-district---new-jersey-s-9th---steven-rothman",
"http://thecolbertreport.cc.com/videos/4huh6w/fract---frnap--monarchy",
"http://thecolbertreport.cc.com/videos/2qbk3w/kenneth-miller",
"http://thecolbertreport.cc.com/videos/393ez5/michael-adams--apology"
],
"guest": "Ken Miller"
},
{
"date": "2006-01-16",
"videos": [
"http://thecolbertreport.cc.com/videos/hk33gu/intro---1-16-06",
"http://thecolbertreport.cc.com/videos/sfiw6u/martin-luther-king-jr--day",
"http://thecolbertreport.cc.com/videos/a3wcdf/the-word---cerrado-",
"http://thecolbertreport.cc.com/videos/7te5id/movies-that-are-destroying-america---transamerica",
"http://thecolbertreport.cc.com/videos/2zgm7q/fract---captain-north-korea",
"http://thecolbertreport.cc.com/videos/39qjdh/george-stephanopoulos",
"http://thecolbertreport.cc.com/videos/1jvqfi/sign-off---i-have-a-dreamsicle"
],
"guest": "George Stephanopoulos"
},
{
"date": "2006-01-17",
"videos": [
"http://thecolbertreport.cc.com/videos/btjtm2/intro---1-17-2006",
"http://thecolbertreport.cc.com/videos/uhh2bv/the-golden-globes",
"http://thecolbertreport.cc.com/videos/lqd06o/age-defying-pancakes",
"http://thecolbertreport.cc.com/videos/pxy8xm/the-word---old-school",
"http://thecolbertreport.cc.com/videos/3wpryl/tip-wag---eminem",
"http://thecolbertreport.cc.com/videos/l2yoxp/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/lpdbmt/wilford-brimley-calls---oatmeal"
],
"guest": "Andrew Sullivan"
},
{
"date": "2006-01-18",
"videos": [
"http://thecolbertreport.cc.com/videos/nh5ji3/intro---1-18-06",
"http://thecolbertreport.cc.com/videos/z3vrpl/the-de-edumacation-of-the-american-brainscape",
"http://thecolbertreport.cc.com/videos/ti5lsj/the-word---smarterer",
"http://thecolbertreport.cc.com/videos/92rf9j/bring--em-back-or-leave--em-dead---teacher-s-edition",
"http://thecolbertreport.cc.com/videos/rnpcxp/frank-mccourt",
"http://thecolbertreport.cc.com/videos/86d7fs/sign-off---the-bully-system"
],
"guest": "Frank McCourt"
},
{
"date": "2006-01-19",
"videos": [
"http://thecolbertreport.cc.com/videos/1ibsf9/intro---1-19-06",
"http://thecolbertreport.cc.com/videos/9s67zo/who-s-attacking-me-now----humane-society",
"http://thecolbertreport.cc.com/videos/xguuix/the-word---public-see",
"http://thecolbertreport.cc.com/videos/lidn3n/better-know-a-district---new-york-s-17th---eliot-engel",
"http://thecolbertreport.cc.com/videos/11mx9e/nina-totenberg",
"http://thecolbertreport.cc.com/videos/9g8c9i/sign-off---drink-on"
],
"guest": "Nina Totenberg"
},
{
"date": "2006-01-23",
"videos": [
"http://thecolbertreport.cc.com/videos/rnxq1m/intro---1-23-06",
"http://thecolbertreport.cc.com/videos/k046s8/oprah-s-book-club",
"http://thecolbertreport.cc.com/videos/ruzjfq/the-word---charlie-daniels",
"http://thecolbertreport.cc.com/videos/0wj0h7/threatdown---hamas",
"http://thecolbertreport.cc.com/videos/puj7cw/david-gregory",
"http://thecolbertreport.cc.com/videos/ipkxy5/dr--love"
],
"guest": "David Gregory"
},
{
"date": "2006-01-24",
"videos": [
"http://thecolbertreport.cc.com/videos/4cxurq/intro---1-24-06",
"http://thecolbertreport.cc.com/videos/63ywy8/most-depressing-day-of-the-year",
"http://thecolbertreport.cc.com/videos/xpxm3x/the-word---chernobyl",
"http://thecolbertreport.cc.com/videos/bpx4o0/formidable-opponent---superpowers",
"http://thecolbertreport.cc.com/videos/44x8vn/robin-givhan",
"http://thecolbertreport.cc.com/videos/meshre/the-in-box---dvds"
],
"guest": "Robin Givhan"
},
{
"date": "2006-01-25",
"videos": [
"http://thecolbertreport.cc.com/videos/fcwdw2/intro---1-25-06",
"http://thecolbertreport.cc.com/videos/sc546i/bill-o-reilly--fan-of-the-show",
"http://thecolbertreport.cc.com/videos/dg5r31/the-word---remote-control",
"http://thecolbertreport.cc.com/videos/d7q9f6/better-know-a-district---new-jersey-s-8th---bill-pascrell",
"http://thecolbertreport.cc.com/videos/e7x760/norah-vincent"
],
"guest": "Norah Vincent"
},
{
"date": "2006-01-26",
"videos": [
"http://thecolbertreport.cc.com/videos/lquo7k/intro---1-26-06",
"http://thecolbertreport.cc.com/videos/xh484k/thundersnow",
"http://thecolbertreport.cc.com/videos/qdqpdn/who-s-attacking-me-now----marina-core",
"http://thecolbertreport.cc.com/videos/9v3sqy/the-word---wham-o",
"http://thecolbertreport.cc.com/videos/qnlt2s/one-of-the-heroes--lily-s-",
"http://thecolbertreport.cc.com/videos/lca5rm/colbert-cruise---write-off",
"http://thecolbertreport.cc.com/videos/gimvpm/paul-begala"
],
"guest": "Paul Begala"
},
{
"date": "2006-01-30",
"videos": [
"http://thecolbertreport.cc.com/videos/fhkpsg/intro---1-30-06",
"http://thecolbertreport.cc.com/videos/vbdym4/james-frey-s-truthiness",
"http://thecolbertreport.cc.com/videos/e6nijq/the-word---abortion",
"http://thecolbertreport.cc.com/videos/5se9xj/tip-wag---google",
"http://thecolbertreport.cc.com/videos/3f4m4d/annie-duke"
],
"guest": "Annie Duke"
},
{
"date": "2006-01-31",
"videos": [
"http://thecolbertreport.cc.com/videos/2cxabn/intro---1-31-06",
"http://thecolbertreport.cc.com/videos/d5gebw/the-word---jesi",
"http://thecolbertreport.cc.com/videos/fo1pme/all-you-need-to-know---samuel-alito",
"http://thecolbertreport.cc.com/videos/165jzf/fract---the-american-flag",
"http://thecolbertreport.cc.com/videos/2uduhl/david-maresh",
"http://thecolbertreport.cc.com/videos/iddejj/sign-off---god-bless",
"http://thecolbertreport.cc.com/videos/2na088/craziest-f--king-thing-i-ve-ever-heard---snake-and-hamster"
],
"guest": "Dave Marash"
},
{
"date": "2006-02-01",
"videos": [
"http://thecolbertreport.cc.com/videos/dk9yev/intro---2-1-06",
"http://thecolbertreport.cc.com/videos/y6qr8t/the-american-worker--a-hero-s-salute-to-the-besieged-heroes-of-the-american-jobscape",
"http://thecolbertreport.cc.com/videos/u7tnek/the-word---you-re-welcome",
"http://thecolbertreport.cc.com/videos/zfo99j/lieber---minimum-wage",
"http://thecolbertreport.cc.com/videos/qm6xwf/emily-yoffe",
"http://thecolbertreport.cc.com/videos/359g3f/sign-off---blue-collar-workday"
],
"guest": "Emily Yoffe"
},
{
"date": "2006-02-02",
"videos": [
"http://thecolbertreport.cc.com/videos/1dag2u/intro---2-2-06",
"http://thecolbertreport.cc.com/videos/ad4eb4/groundhog-day-forecast",
"http://thecolbertreport.cc.com/videos/3bftnm/stephen-s-famous-five-meat-chili",
"http://thecolbertreport.cc.com/videos/xbb82c/the-word---aggravated-assault",
"http://thecolbertreport.cc.com/videos/lggm23/better-know-a-district---new-york-s-8th---jerrold-nadler",
"http://thecolbertreport.cc.com/videos/waxwaq/christine-todd-whitman",
"http://thecolbertreport.cc.com/videos/1q178e/sign-off---tivo"
],
"guest": "Gov. Christine Todd Whitman"
},
{
"date": "2006-02-06",
"videos": [
"http://thecolbertreport.cc.com/videos/dpnfel/intro---2-6-06",
"http://thecolbertreport.cc.com/videos/x1tmbw/birth-day-off",
"http://thecolbertreport.cc.com/videos/1gk1h5/the-golden-corner",
"http://thecolbertreport.cc.com/videos/r9ih4w/the-word---metaphorically",
"http://thecolbertreport.cc.com/videos/4xxw86/threatdown---killer-bees",
"http://thecolbertreport.cc.com/videos/kckjlf/fract---native-american-state-names",
"http://thecolbertreport.cc.com/videos/lynt84/barbara-boxer",
"http://thecolbertreport.cc.com/videos/xaj1wb/to-be-continued"
],
"guest": "Barbara Boxer"
},
{
"date": "2006-02-07",
"videos": [
"http://thecolbertreport.cc.com/videos/aa2a90/intro---2-7-06",
"http://thecolbertreport.cc.com/videos/nzdokc/math-is-hard",
"http://thecolbertreport.cc.com/videos/iwl7g4/the-word---kidding",
"http://thecolbertreport.cc.com/videos/pc9syn/fract---frnap--royalty",
"http://thecolbertreport.cc.com/videos/uvx8kk/james-woolsey",
"http://thecolbertreport.cc.com/videos/xx0m7n/western-union"
],
"guest": "R. James Woolsey"
},
{
"date": "2006-02-08",
"videos": [
"http://thecolbertreport.cc.com/videos/3vblh5/intro---2-8-06",
"http://thecolbertreport.cc.com/videos/zmpne2/b-b-b-l-t-",
"http://thecolbertreport.cc.com/videos/0qolhd/electronic-surveillance",
"http://thecolbertreport.cc.com/videos/pi8m0r/the-word---eureka",
"http://thecolbertreport.cc.com/videos/29usyw/better-know-a-district---pennsylvania-s-2nd---chaka-fattah",
"http://thecolbertreport.cc.com/videos/flyja7/fract---bush-s-height",
"http://thecolbertreport.cc.com/videos/6jmw8z/alan-dershowitz",
"http://thecolbertreport.cc.com/videos/96mt5f/the-in-box---terry"
],
"guest": "Alan Dershowitz"
},
{
"date": "2006-02-09",
"videos": [
"http://thecolbertreport.cc.com/videos/afiwhq/intro---2-9-06",
"http://thecolbertreport.cc.com/videos/qryfzw/big-brass-balls-award",
"http://thecolbertreport.cc.com/videos/c00cpa/the-word---u-s-a---u-s-a--",
"http://thecolbertreport.cc.com/videos/wpi1k4/stephen-s-laws-of-love",
"http://thecolbertreport.cc.com/videos/8rwy8k/george-packer",
"http://thecolbertreport.cc.com/videos/33a8tw/charlene--i-m-right-behind-you-"
],
"guest": "George Packer"
},
{
"date": "2006-02-21",
"videos": [
"http://thecolbertreport.cc.com/videos/z5opi6/intro---2-21-06",
"http://thecolbertreport.cc.com/videos/uo23hp/accidental-shooting",
"http://thecolbertreport.cc.com/videos/loo817/the-word---u-s-a---u-s-a--",
"http://thecolbertreport.cc.com/videos/u7vgjy/better-know-a-district---new-jersey-s-13th",
"http://thecolbertreport.cc.com/videos/gb5q2m/fract---americana",
"http://thecolbertreport.cc.com/videos/zyrf0h/lama-surya-das",
"http://thecolbertreport.cc.com/videos/501uix/sign-off---dna"
],
"guest": "Lama Surya Das"
},
{
"date": "2006-02-22",
"videos": [
"http://thecolbertreport.cc.com/videos/i0btk9/intro---2-22-06",
"http://thecolbertreport.cc.com/videos/9a1fo6/speed-skating-debacle",
"http://thecolbertreport.cc.com/videos/0g837q/the-word---absolutely-maybe",
"http://thecolbertreport.cc.com/videos/mvtu98/threatdown---gay-adoption",
"http://thecolbertreport.cc.com/videos/jkkvih/michael-eric-dyson"
],
"guest": "Michael Eric Dyson"
},
{
"date": "2006-02-23",
"videos": [
"http://thecolbertreport.cc.com/videos/v60d4d/intro---2-23-06",
"http://thecolbertreport.cc.com/videos/rr6syc/threatdown---bears",
"http://thecolbertreport.cc.com/videos/754igf/presidential-visions",
"http://thecolbertreport.cc.com/videos/s0zne3/the-word---hippocratical",
"http://thecolbertreport.cc.com/videos/kftjaw/pharmaceuticals--prescription-for-progress",
"http://thecolbertreport.cc.com/videos/rsogzl/david-brooks",
"http://thecolbertreport.cc.com/videos/azjwel/sign-off---pause-your-tvs"
],
"guest": "David Brooks"
},
{
"date": "2006-02-27",
"videos": [
"http://thecolbertreport.cc.com/videos/te5not/intro---2-27-06",
"http://thecolbertreport.cc.com/videos/a6q20s/the-de-deification-of-the-american-faithscape",
"http://thecolbertreport.cc.com/videos/opnyg5/who-hates-whom-in-the-name-of-god",
"http://thecolbertreport.cc.com/videos/2hdt17/the-word---trial-separation",
"http://thecolbertreport.cc.com/videos/5ggers/pick-your-apocalypse",
"http://thecolbertreport.cc.com/videos/oop06i/tony-campolo",
"http://thecolbertreport.cc.com/videos/14uaa2/confess-your-sins-to-stephen"
],
"guest": "Tony Campolo"
},
{
"date": "2006-02-28",
"videos": [
"http://thecolbertreport.cc.com/videos/cebyqr/intro---2-28-06",
"http://thecolbertreport.cc.com/videos/roej3y/who-s-attacking-me-now----anderson-cooper",
"http://thecolbertreport.cc.com/videos/bdairu/the-word---laissez-les-bons-temps-rouler-",
"http://thecolbertreport.cc.com/videos/2v3htj/tip-wag---wheeled-transportation",
"http://thecolbertreport.cc.com/videos/sz96fe/brett-o-donnell"
],
"guest": "Brett O'Donnell"
},
{
"date": "2006-03-01",
"videos": [
"http://thecolbertreport.cc.com/videos/ldd32b/intro---3-1-06",
"http://thecolbertreport.cc.com/videos/jndc1b/better-know-a-district---california-s-50th",
"http://thecolbertreport.cc.com/videos/4j8lfp/the-word---faith",
"http://thecolbertreport.cc.com/videos/1bozfl/better-know-a-founder---benjamin-franklin",
"http://thecolbertreport.cc.com/videos/11m5ii/arianna-huffington"
],
"guest": "Arianna Huffington"
},
{
"date": "2006-03-02",
"videos": [
"http://thecolbertreport.cc.com/videos/ubq51o/intro---3-2-06",
"http://thecolbertreport.cc.com/videos/stez1k/the-word---homo-sapien-agenda",
"http://thecolbertreport.cc.com/videos/3k2tf6/the-dacolbert-code---the-oscars",
"http://thecolbertreport.cc.com/videos/gltobj/jeffrey-sachs",
"http://thecolbertreport.cc.com/videos/wx4nw0/sign-off---end-of-an-era"
],
"guest": "Jeffrey Sachs"
},
{
"date": "2006-03-06",
"videos": [
"http://thecolbertreport.cc.com/videos/404ffy/intro---3-6-06",
"http://thecolbertreport.cc.com/videos/l42kmx/hollywood-decontamination",
"http://thecolbertreport.cc.com/videos/tsfsdu/never-say-die",
"http://thecolbertreport.cc.com/videos/5tdn6m/the-word---spoiler-alert-",
"http://thecolbertreport.cc.com/videos/tua61a/threatdown---non-blondes",
"http://thecolbertreport.cc.com/videos/rlta2z/bob-schieffer",
"http://thecolbertreport.cc.com/videos/iwpji5/sign-off---narnia"
],
"guest": "Bob Schieffer"
},
{
"date": "2006-03-07",
"videos": [
"http://thecolbertreport.cc.com/videos/ca0riz/intro---3-7-06",
"http://thecolbertreport.cc.com/videos/4cutks/colbert-manor",
"http://thecolbertreport.cc.com/videos/mtcb44/the-word---the-long-war",
"http://thecolbertreport.cc.com/videos/g0hyvn/all-you-need-to-know---video-games",
"http://thecolbertreport.cc.com/videos/8n27zq/norman-ornstein"
],
"guest": "Norman Ornstean"
},
{
"date": "2006-03-08",
"videos": [
"http://thecolbertreport.cc.com/videos/xbwofw/intro---3-8-06",
"http://thecolbertreport.cc.com/videos/x1smyo/colbert-manor-revisited",
"http://thecolbertreport.cc.com/videos/to3c41/the-word---monopoly",
"http://thecolbertreport.cc.com/videos/qhlrjh/stephen-s-sound-advice---civil-war-do-s---don-ts",
"http://thecolbertreport.cc.com/videos/1ggda8/fract---america-rocks",
"http://thecolbertreport.cc.com/videos/ovaery/james-webb",
"http://thecolbertreport.cc.com/videos/vggdk5/used-flag-offer"
],
"guest": "James Webb"
},
{
"date": "2006-03-09",
"videos": [
"http://thecolbertreport.cc.com/videos/vaflyt/intro---3-9-06",
"http://thecolbertreport.cc.com/videos/dx0yti/canadian-baseball-",
"http://thecolbertreport.cc.com/videos/6l67tv/the-word---d-i-y-",
"http://thecolbertreport.cc.com/videos/7oy8db/better-know-a-district---california-s-39th-district---linda-sanchez",
"http://thecolbertreport.cc.com/videos/15d41c/lorraine-bracco"
],
"guest": "Lorraine Bracco"
},
{
"date": "2006-03-13",
"videos": [
"http://thecolbertreport.cc.com/videos/d7ebhg/intro---3-13-06",
"http://thecolbertreport.cc.com/videos/lmy7oh/predictions",
"http://thecolbertreport.cc.com/videos/lykn1c/not-gay",
"http://thecolbertreport.cc.com/videos/so8v2i/the-word---sidney-poitier",
"http://thecolbertreport.cc.com/videos/ufh2rw/christopher-buckley",
"http://thecolbertreport.cc.com/videos/k79bmy/sign-off---mad-magazine"
],
"guest": "Christopher Buckley"
},
{
"date": "2006-03-14",
"videos": [
"http://thecolbertreport.cc.com/videos/9rlemm/intro---3-14-06",
"http://thecolbertreport.cc.com/videos/i3ouk4/trusting-the-media",
"http://thecolbertreport.cc.com/videos/i5bwzw/the-word---scapegoat",
"http://thecolbertreport.cc.com/videos/kiwto1/was-it-really-that-bad----before-unions",
"http://thecolbertreport.cc.com/videos/402x36/fract---hawaii",
"http://thecolbertreport.cc.com/videos/loh9en/keith-olbermann",
"http://thecolbertreport.cc.com/videos/8vssl2/hiphopketball-ii--the-rejazzebration-remix--06"
],
"guest": "Keith Olbermann"
},
{
"date": "2006-03-15",
"videos": [
"http://thecolbertreport.cc.com/videos/wt5xpw/intro---3-15-06",
"http://thecolbertreport.cc.com/videos/u8eaqc/sperm-donor",
"http://thecolbertreport.cc.com/videos/g4bu6e/the-word---none-of-the-above",
"http://thecolbertreport.cc.com/videos/kruphn/al-franken",
"http://thecolbertreport.cc.com/videos/usnoo7/al-franken-fields-calls",
"http://thecolbertreport.cc.com/videos/z5ir97/craziest-f--king-thing-i-ve-ever-heard---bear-wrestling"
],
"guest": "Al Franken"
},
{
"date": "2006-03-16",
"videos": [
"http://thecolbertreport.cc.com/videos/yna7fv/intro---3-16-06",
"http://thecolbertreport.cc.com/videos/ecjm4u/who-s-attacking-me-now----commander-coconut",
"http://thecolbertreport.cc.com/videos/2m2cs5/the-word---sweet-dreams",
"http://thecolbertreport.cc.com/videos/kgsuha/better-know-a-protectorate---the-virgin-islands---donna-christensen",
"http://thecolbertreport.cc.com/videos/6o7ym9/frank-vincent",
"http://thecolbertreport.cc.com/videos/cycayo/sign-off---i-ll-miss-you"
],
"guest": "Frank Vincent"
},
{
"date": "2006-03-20",
"videos": [
"http://thecolbertreport.cc.com/videos/nnadg0/intro---3-20-06",
"http://thecolbertreport.cc.com/videos/isowuv/movies-that-are-destroying-america---post-oscar-wrap-up",
"http://thecolbertreport.cc.com/videos/vr4vvt/connie-chung",
"http://thecolbertreport.cc.com/videos/yuth1j/jessica-simpson-turns-down-gop",
"http://thecolbertreport.cc.com/videos/6xoiww/war-in-iraq---third-anniversary",
"http://thecolbertreport.cc.com/videos/b7697r/the-word---stop-it"
],
"guest": "Connie Chung"
},
{
"date": "2006-03-21",
"videos": [
"http://thecolbertreport.cc.com/videos/xvs8w8/intro---3-21-06",
"http://thecolbertreport.cc.com/videos/zze24r/world-baseball-classic",
"http://thecolbertreport.cc.com/videos/teon93/the-word---eat-it",
"http://thecolbertreport.cc.com/videos/eh7h1y/employee-performance-reviews",
"http://thecolbertreport.cc.com/videos/nbiu6f/steve-kroft",
"http://thecolbertreport.cc.com/videos/jt1thw/the-in-box---corrections"
],
"guest": "Steve Kroft"
},
{
"date": "2006-03-22",
"videos": [
"http://thecolbertreport.cc.com/videos/70ntar/intro---3-22-06",
"http://thecolbertreport.cc.com/videos/nw6pi6/advice-for-jennifer-anniston",
"http://thecolbertreport.cc.com/videos/gx67le/better-know-a-district---california-s-27th---brad-sherman",
"http://thecolbertreport.cc.com/videos/c3fb4g/the-word---i-am-the-great-and-powerful-oz",
"http://thecolbertreport.cc.com/videos/uqd7r1/dan-senor",
"http://thecolbertreport.cc.com/videos/qay3pj/sign-off---thank-you--america"
],
"guest": "Dan Senor"
},
{
"date": "2006-03-23",
"videos": [
"http://thecolbertreport.cc.com/videos/ou0ql7/intro---3-23-06",
"http://thecolbertreport.cc.com/videos/rxxsf1/home--hearth--heart-and-heartland---this-land-is-your-land",
"http://thecolbertreport.cc.com/videos/1q0pl8/miss-manners",
"http://thecolbertreport.cc.com/videos/jeurtc/stephen-s-sound-advice---how-to-raise-a-hero",
"http://thecolbertreport.cc.com/videos/3x5mhp/john-kasich",
"http://thecolbertreport.cc.com/videos/tgvvyb/sign-off---the-reason-for-the-hearth"
],
"guest": "John Kasich"
},
{
"date": "2006-03-27",
"videos": [
"http://thecolbertreport.cc.com/videos/yvu55b/intro---3-27-06",
"http://thecolbertreport.cc.com/videos/lu2x91/off-the-market",
"http://thecolbertreport.cc.com/videos/b1jlbx/immigration-protests",
"http://thecolbertreport.cc.com/videos/hizymr/exercise-routine",
"http://thecolbertreport.cc.com/videos/fafxll/the-word---tense",
"http://thecolbertreport.cc.com/videos/jmwqn6/letter-to-the-judge",
"http://thecolbertreport.cc.com/videos/6zqqyf/threatdown---drug-candy",
"http://thecolbertreport.cc.com/videos/hx3fbe/fract---bald-eagle",
"http://thecolbertreport.cc.com/videos/i44o34/gary-hart",
"http://thecolbertreport.cc.com/videos/bwhjyd/sign-off---tomorrow-s-guest"
],
"guest": "Gary Hart"
},
{
"date": "2006-03-28",
"videos": [
"http://thecolbertreport.cc.com/videos/9tw416/intro---3-28-06",
"http://thecolbertreport.cc.com/videos/wm4vs8/baby-eagle",
"http://thecolbertreport.cc.com/videos/4s1h3q/the-word---easter-under-attack---marketing",
"http://thecolbertreport.cc.com/videos/erxj6i/lieber---school-vouchers",
"http://thecolbertreport.cc.com/videos/3ejtt4/fract---commemorative-spoons",
"http://thecolbertreport.cc.com/videos/tyfnef/michael-brown",
"http://thecolbertreport.cc.com/videos/t4qaaf/sign-off---goodnight--stephen-jr-"
],
"guest": "Michael Brown"
},
{
"date": "2006-03-29",
"videos": [
"http://thecolbertreport.cc.com/videos/4mdlim/intro---3-29-06",
"http://thecolbertreport.cc.com/videos/r9z4ro/eclipse",
"http://thecolbertreport.cc.com/videos/mqt5m8/the-word---merrier",
"http://thecolbertreport.cc.com/videos/3xpeh4/better-know-a-district---california-s-29th---adam-schiff",
"http://thecolbertreport.cc.com/videos/k1c0hq/bruce-bartlett"
],
"guest": "Bruce Bartlett"
},
{
"date": "2006-03-30",
"videos": [
"http://thecolbertreport.cc.com/videos/uaktnl/intro---3-30-06",
"http://thecolbertreport.cc.com/videos/89u375/what-jill-carroll-missed",
"http://thecolbertreport.cc.com/videos/nuwaus/women-s-history-month---soledad-o-brien",
"http://thecolbertreport.cc.com/videos/smbaky/tip-wag---the-templeton-prize",
"http://thecolbertreport.cc.com/videos/n7sm3g/fract---drug-testing-standards",
"http://thecolbertreport.cc.com/videos/b95nrh/robert-greenwald",
"http://thecolbertreport.cc.com/videos/0vbmc1/million-man-march",
"http://thecolbertreport.cc.com/videos/zcqswd/the-word---f--k"
],
"guest": "Robert Greenwald"
},
{
"date": "2006-04-03",
"videos": [
"http://thecolbertreport.cc.com/videos/r2tcqv/intro---4-3-06",
"http://thecolbertreport.cc.com/videos/cckn97/who-s-honoring-me-now----southern-poverty-law-center",
"http://thecolbertreport.cc.com/videos/j51p1g/the-word---stay-the-course",
"http://thecolbertreport.cc.com/videos/mq3zja/stephen-s-sound-advice---taxes",
"http://thecolbertreport.cc.com/videos/ci41dt/michael-smerconish",
"http://thecolbertreport.cc.com/videos/716068/sign-off---nutz"
],
"guest": "Michael Smerconish"
},
{
"date": "2006-04-04",
"videos": [
"http://thecolbertreport.cc.com/videos/9ew48u/intro---4-4-06",
"http://thecolbertreport.cc.com/videos/ouryux/delay-retires",
"http://thecolbertreport.cc.com/videos/3pmhdv/the-word---birdie",
"http://thecolbertreport.cc.com/videos/fgj62q/balls-for-kidz---plastic-surgery",
"http://thecolbertreport.cc.com/videos/3sqfo3/jesse-jackson"
],
"guest": "Jesse Jackson"
},
{
"date": "2006-04-05",
"videos": [
"http://thecolbertreport.cc.com/videos/pxrtxy/intro---4-5-06",
"http://thecolbertreport.cc.com/videos/1sxrid/crying",
"http://thecolbertreport.cc.com/videos/alac6s/the-word---martyr",
"http://thecolbertreport.cc.com/videos/6ythy9/formidable-opponent---immigration",
"http://thecolbertreport.cc.com/videos/4ipowz/fract---russian-girls",
"http://thecolbertreport.cc.com/videos/7hiane/harvey-mansfield",
"http://thecolbertreport.cc.com/videos/7q90hr/sign-off---en-espanol"
],
"guest": "Harvey Mansfield"
},
{
"date": "2006-04-06",
"videos": [
"http://thecolbertreport.cc.com/videos/4p2khi/intro---4-6-06",
"http://thecolbertreport.cc.com/videos/yy1ecn/who-s-not-honoring-me-now----peabody-award",
"http://thecolbertreport.cc.com/videos/wh4nku/easter-under-attack---recalled-eggs",
"http://thecolbertreport.cc.com/videos/h6f8ks/the-word---nazis",
"http://thecolbertreport.cc.com/videos/hqbc11/better-know-a-district---oregon-s-5th---darlene-hooley",
"http://thecolbertreport.cc.com/videos/2v5yd4/markos-moulitsas",
"http://thecolbertreport.cc.com/videos/a2gy6a/sign-off---spring-break"
],
"guest": "Markos Moulitsas"
},
{
"date": "2006-04-17",
"videos": [
"http://thecolbertreport.cc.com/videos/rho2b5/intro---4-17-06",
"http://thecolbertreport.cc.com/videos/jh0t6d/dime-boycott",
"http://thecolbertreport.cc.com/videos/nyextq/on-notice---journal-of-paleolimnology",
"http://thecolbertreport.cc.com/videos/swdzeg/was-it-really-that-bad----san-francisco-earthquake",
"http://thecolbertreport.cc.com/videos/8ydrv2/reza-aslan",
"http://thecolbertreport.cc.com/videos/nfyuyx/craziest-f--king-thing-i-ve-ever-heard---fly-glasses"
],
"guest": "Reza Aslan"
},
{
"date": "2006-04-18",
"videos": [
"http://thecolbertreport.cc.com/videos/mwy60m/intro---4-18-06",
"http://thecolbertreport.cc.com/videos/8zlfj4/stephen-jr--hatches-",
"http://thecolbertreport.cc.com/videos/gi0de7/the-word---sir--yes--sir",
"http://thecolbertreport.cc.com/videos/6epoa4/threatdown---pooh",
"http://thecolbertreport.cc.com/videos/5peygv/anthony-romero",
"http://thecolbertreport.cc.com/videos/9g88m0/baby-monitor",
"http://thecolbertreport.cc.com/videos/sdky8q/who-s-not-honoring-me-now----pulitzer-prize"
],
"guest": "Anthony Romero"
},
{
"date": "2006-04-19",
"videos": [
"http://thecolbertreport.cc.com/videos/msbasq/intro---4-19-06",
"http://thecolbertreport.cc.com/videos/8e53yj/white-house-press-secretary",
"http://thecolbertreport.cc.com/videos/usn2co/global-warming-tv",
"http://thecolbertreport.cc.com/videos/ai2zb9/the-word---save-it",
"http://thecolbertreport.cc.com/videos/0nrquc/tip-wag---tom-cruise-and-katie-holmes",
"http://thecolbertreport.cc.com/videos/x40hn2/caitlin-flanagan"
],
"guest": "Caitlin Flanagan"
},
{
"date": "2006-04-20",
"videos": [
"http://thecolbertreport.cc.com/videos/ejbl27/intro---4-20-06",
"http://thecolbertreport.cc.com/videos/qw6of6/protecting-kids-from-papers",
"http://thecolbertreport.cc.com/videos/agw4nc/the-word---bard",
"http://thecolbertreport.cc.com/videos/yrza7w/better-know-a-district---maryland-s-4th---albert-wynn",
"http://thecolbertreport.cc.com/videos/isrl05/ralph-nader"
],
"guest": "Ralph Nader"
},
{
"date": "2006-04-24",
"videos": [
"http://thecolbertreport.cc.com/videos/ed2ifv/intro---4-24-06",
"http://thecolbertreport.cc.com/videos/yd10jl/wok-this-way",
"http://thecolbertreport.cc.com/videos/nhj8qv/money---politics--the-machine-that-ain-t-broke",
"http://thecolbertreport.cc.com/videos/z1f4bz/duke-obilia-auction",
"http://thecolbertreport.cc.com/videos/svw55c/hugh-hewitt",
"http://thecolbertreport.cc.com/videos/qzp0e4/sign-off---chatty-cathy"
],
"guest": "Hugh Hewitt"
},
{
"date": "2006-04-25",
"videos": [
"http://thecolbertreport.cc.com/videos/h6j9ry/intro---4-25-06",
"http://thecolbertreport.cc.com/videos/y1ry7v/contacting-john-lennon",
"http://thecolbertreport.cc.com/videos/ef5fdk/the-word---panama",
"http://thecolbertreport.cc.com/videos/6iaobq/threatdown---tom-hanks",
"http://thecolbertreport.cc.com/videos/6smo0z/fract---middle-name",
"http://thecolbertreport.cc.com/videos/gael38/sam-harris",
"http://thecolbertreport.cc.com/videos/f00cpp/sign-off---bush-clock"
],
"guest": "Sam Harris"
},
{
"date": "2006-04-26",
"videos": [
"http://thecolbertreport.cc.com/videos/xo40za/intro---4-26-06",
"http://thecolbertreport.cc.com/videos/pjxlyg/armed-and-ready",
"http://thecolbertreport.cc.com/videos/hhuez9/the-word---english",
"http://thecolbertreport.cc.com/videos/ydqtim/better-know-a-district---georgia-s-11th---phil-gingrey",
"http://thecolbertreport.cc.com/videos/thlh72/sebastian-junger",
"http://thecolbertreport.cc.com/videos/8puf3y/sign-off---yellowcake"
],
"guest": "Sebastian Junger"
},
{
"date": "2006-04-27",
"videos": [
"http://thecolbertreport.cc.com/videos/5ry4l9/intro---4-27-06",
"http://thecolbertreport.cc.com/videos/z7tcn4/snow--informer",
"http://thecolbertreport.cc.com/videos/6lr3t0/the-word---white-gloves",
"http://thecolbertreport.cc.com/videos/b4nnko/plagiarism",
"http://thecolbertreport.cc.com/videos/g4i72k/all-you-need-to-know---sleight-of-hand",
"http://thecolbertreport.cc.com/videos/u54lrz/bill-kristol",
"http://thecolbertreport.cc.com/videos/efk2x7/sign-off---the-nfl-draft"
],
"guest": "Bill Kristol"
},
{
"date": "2006-05-01",
"videos": [
"http://thecolbertreport.cc.com/videos/w2hp62/intro---5-1-06",
"http://thecolbertreport.cc.com/videos/7jined/white-house-correspondents--dinner",
"http://thecolbertreport.cc.com/videos/8uzt2n/the-word---drug-fueled-sex-crime",
"http://thecolbertreport.cc.com/videos/yzcgdu/tip-wag---exxon",
"http://thecolbertreport.cc.com/videos/5ptkiy/jon-meacham",
"http://thecolbertreport.cc.com/videos/i3oqoh/sign-off---spam"
],
"guest": "Jon Meacham"
},
{
"date": "2006-05-02",
"videos": [
"http://thecolbertreport.cc.com/videos/341pc6/intro---5-2-06",
"http://thecolbertreport.cc.com/videos/y9f7ks/magic-",
"http://thecolbertreport.cc.com/videos/fdtzal/the-word---healthy-appetite",
"http://thecolbertreport.cc.com/videos/hl6b8d/stephen-for-press-secretary",
"http://thecolbertreport.cc.com/videos/lh3j87/mike-huckabee"
],
"guest": "Governor Mike Huckabee"
},
{
"date": "2006-05-03",
"videos": [
"http://thecolbertreport.cc.com/videos/wjeu9g/intro---5-3-06",
"http://thecolbertreport.cc.com/videos/72mru6/alan-town",
"http://thecolbertreport.cc.com/videos/gdu7ux/the-word---name-game",
"http://thecolbertreport.cc.com/videos/f8iv5g/stephen-s-sound-advice---gas-prices",
"http://thecolbertreport.cc.com/videos/3pdcz2/paul-rieckhoff",
"http://thecolbertreport.cc.com/videos/65gltn/betterer-know-a-district---georgia-s-11th---phil-gingrey-bonus-edition"
],
"guest": "Paul Rieckhoff"
},
{
"date": "2006-05-04",
"videos": [
"http://thecolbertreport.cc.com/videos/mtzlgi/exclusive---better-know-a-district---oregon-s-3rd---earl-blumenauer",
"http://thecolbertreport.cc.com/videos/pgiz58/intro---5-4-06",
"http://thecolbertreport.cc.com/videos/ox5eqb/national-day-of-prayer",
"http://thecolbertreport.cc.com/videos/38ws3t/the-word---indulgence",
"http://thecolbertreport.cc.com/videos/h6w8h9/better-know-a-district---oregon-s-3rd---earl-blumenauer",
"http://thecolbertreport.cc.com/videos/71jv5y/rick-reilly",
"http://thecolbertreport.cc.com/videos/4uy12b/stephen-s-keys"
],
"guest": "Rick Reilly"
},
{
"date": "2006-05-08",
"videos": [
"http://thecolbertreport.cc.com/videos/6p8qc0/intro---5-8-06",
"http://thecolbertreport.cc.com/videos/gk0182/stegul",
"http://thecolbertreport.cc.com/videos/fyqj80/porter-goss-resignation",
"http://thecolbertreport.cc.com/videos/3ig0g8/the-word---not",
"http://thecolbertreport.cc.com/videos/zdkg2i/shere-hite",
"http://thecolbertreport.cc.com/videos/7581zo/sign-off---thank-you--stephen-"
],
"guest": "Shere Hite"
},
{
"date": "2006-05-09",
"videos": [
"http://thecolbertreport.cc.com/videos/v9p03c/intro---5-9-06",
"http://thecolbertreport.cc.com/videos/t6b1ke/double-or-nothing",
"http://thecolbertreport.cc.com/videos/mjq9vh/the-word---superegomaniac",
"http://thecolbertreport.cc.com/videos/9w4u9e/movies-that-are-destroying-america---summer-movies",
"http://thecolbertreport.cc.com/videos/s2q4vq/frank-rich",
"http://thecolbertreport.cc.com/videos/hofw72/sign-off---closing-credits-contest"
],
"guest": "Frank Rich"
},
{
"date": "2006-05-10",
"videos": [
"http://thecolbertreport.cc.com/videos/j0109g/exclusive---better-know-a-district---nebraska-s-2nd---lee-terry",
"http://thecolbertreport.cc.com/videos/z0wmkf/intro---5-10-06",
"http://thecolbertreport.cc.com/videos/pc9isx/the-bird-flu",
"http://thecolbertreport.cc.com/videos/6olwle/the-word---athletes-are-above-the-law",
"http://thecolbertreport.cc.com/videos/m1vdpp/better-know-a-district---nebraska-s-2nd---lee-terry",
"http://thecolbertreport.cc.com/videos/kuohzs/william-bastone",
"http://thecolbertreport.cc.com/videos/pksza0/sign-off---what-you-deserve"
],
"guest": "Bill Bastone"
},
{
"date": "2006-05-11",
"videos": [
"http://thecolbertreport.cc.com/videos/3oo94k/intro---5-11-06",
"http://thecolbertreport.cc.com/videos/jn8cw4/the-west-wing",
"http://thecolbertreport.cc.com/videos/j7pjuz/the-word---fill--er-up",
"http://thecolbertreport.cc.com/videos/yy27qi/madeleine-albright",
"http://thecolbertreport.cc.com/videos/8nl4m3/tip-wag---gold"
],
"guest": "Madeleine Albright"
},
{
"date": "2006-05-15",
"videos": [
"http://thecolbertreport.cc.com/videos/uhk7yp/intro---5-15-06",
"http://thecolbertreport.cc.com/videos/nxszdr/ahmadinejad-s-letter",
"http://thecolbertreport.cc.com/videos/g2h9yx/the-word---lunchables",
"http://thecolbertreport.cc.com/videos/pn3k09/summaries-of-summaries",
"http://thecolbertreport.cc.com/videos/f5iuwt/all-you-need-to-know---dick-cheney",
"http://thecolbertreport.cc.com/videos/qrt5tg/kevin-phillips",
"http://thecolbertreport.cc.com/videos/lww1s9/craziest-f--king-thing-i-ve-ever-heard---gas-prices"
],
"guest": "Kevin Phillips"
},
{
"date": "2006-05-16",
"videos": [
"http://thecolbertreport.cc.com/videos/x3193a/intro---5-16-06",
"http://thecolbertreport.cc.com/videos/swctyt/the-word---inoculation",
"http://thecolbertreport.cc.com/videos/5qdvts/billboard",
"http://thecolbertreport.cc.com/videos/r5u8hp/body-parts-for-sale",
"http://thecolbertreport.cc.com/videos/kdtmpm/tyson-slocum",
"http://thecolbertreport.cc.com/videos/53mwdm/search-for-a-new-black-friend"
],
"guest": "Tyson Slocum"
},
{
"date": "2006-05-17",
"videos": [
"http://thecolbertreport.cc.com/videos/8b6qml/exclusive---better-know-a-president---theodore-roosevelt",
"http://thecolbertreport.cc.com/videos/x3193a/intro---5-16-06",
"http://thecolbertreport.cc.com/videos/swctyt/the-word---inoculation",
"http://thecolbertreport.cc.com/videos/5qdvts/billboard",
"http://thecolbertreport.cc.com/videos/r5u8hp/body-parts-for-sale",
"http://thecolbertreport.cc.com/videos/kdtmpm/tyson-slocum",
"http://thecolbertreport.cc.com/videos/53mwdm/search-for-a-new-black-friend"
],
"guest": "Jonathan Alter"
},
{
"date": "2006-05-17",
"videos": [
"http://thecolbertreport.cc.com/videos/wnj4cc/intro---5-17-06",
"http://thecolbertreport.cc.com/videos/xie8nv/the-word---democrats",
"http://thecolbertreport.cc.com/videos/3w6t72/better-know-a-president---theodore-roosevelt",
"http://thecolbertreport.cc.com/videos/1pm4i8/jonathan-alter",
"http://thecolbertreport.cc.com/videos/3f6dmg/boycott",
"http://thecolbertreport.cc.com/videos/bqqkk9/reagan-dimes"
],
"guest": "Jonathan Alter"
},
{
"date": "2006-05-18",
"videos": [
"http://thecolbertreport.cc.com/videos/ddjyzq/intro---5-18-06",
"http://thecolbertreport.cc.com/videos/q374t3/stephen-colbert-s-guardian-eagles",
"http://thecolbertreport.cc.com/videos/91osyo/the-word---libya",
"http://thecolbertreport.cc.com/videos/rvxfth/difference-makers---tim-donnelly",
"http://thecolbertreport.cc.com/videos/lga95g/fract---this-day-in-stephen-history",
"http://thecolbertreport.cc.com/videos/jl63dd/ted-daeschler",
"http://thecolbertreport.cc.com/videos/ddobv8/bears-eat-monkey"
],
"guest": "Ted Daeschler"
},
{
"date": "2006-06-05",
"videos": [
"http://thecolbertreport.cc.com/videos/63cmgz/my-first-100-shows--how-i-changed-the-world",
"http://thecolbertreport.cc.com/videos/dk29ec/the-word---me",
"http://thecolbertreport.cc.com/videos/sygeud/stone-phillips",
"http://thecolbertreport.cc.com/videos/oqbssv/helium-balloon-drop",
"http://thecolbertreport.cc.com/videos/n2keyu/the-in-box---100th-episode"
],
"guest": "Stone Phillips"
},
{
"date": "2006-06-06",
"videos": [
"http://thecolbertreport.cc.com/videos/0jvvnp/intro---6-6-06",
"http://thecolbertreport.cc.com/videos/zo00tb/666",
"http://thecolbertreport.cc.com/videos/fvrhwv/the-word---military",
"http://thecolbertreport.cc.com/videos/ohdrye/stephen-s-sound-advice---graduation",
"http://thecolbertreport.cc.com/videos/j42g38/christiane-amanpour",
"http://thecolbertreport.cc.com/videos/5pxetf/sign-off---666-almost-over"
],
"guest": "Christiane Amanpour"
},
{
"date": "2006-06-07",
"videos": [
"http://thecolbertreport.cc.com/videos/4y1ae4/intro---6-7-06",
"http://thecolbertreport.cc.com/videos/krcfjp/balrog",
"http://thecolbertreport.cc.com/videos/8enhyk/search-for-a-new-black-friend---first-submissions",
"http://thecolbertreport.cc.com/videos/b9ck5g/the-word---big-deal",
"http://thecolbertreport.cc.com/videos/q5rrxq/threatdown---bad-heroin",
"http://thecolbertreport.cc.com/videos/g6gwcq/steve-squyres",
"http://thecolbertreport.cc.com/videos/l4kbi3/sign-off---vaughniston"
],
"guest": "Steve Squyres"
},
{
"date": "2006-06-08",
"videos": [
"http://thecolbertreport.cc.com/videos/s8vv3c/intro---6-8-06",
"http://thecolbertreport.cc.com/videos/5h2hdf/good-news-about-terror",
"http://thecolbertreport.cc.com/videos/9s5g2f/the-word---goooooaaaaaal-",
"http://thecolbertreport.cc.com/videos/tb1qzm/better-know-a-district---texas--22nd---tom-delay",
"http://thecolbertreport.cc.com/videos/l9x3is/steve-johnson",
"http://thecolbertreport.cc.com/videos/irk0rv/honorary-doctor"
],
"guest": "Steve Johnson"
},
{
"date": "2006-06-12",
"videos": [
"http://thecolbertreport.cc.com/videos/kjiw2u/intro---6-12-06",
"http://thecolbertreport.cc.com/videos/6ev021/tony-awards",
"http://thecolbertreport.cc.com/videos/m292m0/on-notice---mort-zuckerman",
"http://thecolbertreport.cc.com/videos/g6su9g/the-word---tom-delay-s-farewell-address",
"http://thecolbertreport.cc.com/videos/e9sys9/tip-wag---college-students",
"http://thecolbertreport.cc.com/videos/1zagcw/robert-f--kennedy-jr-",
"http://thecolbertreport.cc.com/videos/rklfpc/a-tip-from-stephen-colbert-s-gardening-almanac"
],
"guest": "Robert F. Kennedy Jr."
},
{
"date": "2006-06-13",
"videos": [
"http://thecolbertreport.cc.com/videos/04ejnu/intro---6-13-06",
"http://thecolbertreport.cc.com/videos/g9ijaq/stephen-jr--update",
"http://thecolbertreport.cc.com/videos/qieya3/the-word---great-f---ing-idea",
"http://thecolbertreport.cc.com/videos/c3pmq2/nsa-wiretapping",
"http://thecolbertreport.cc.com/videos/2z4g9m/tim-flannery",
"http://thecolbertreport.cc.com/videos/15yb0t/feline-bravery"
],
"guest": "Tim Flannery"
},
{
"date": "2006-06-14",
"videos": [
"http://thecolbertreport.cc.com/videos/6tm6zq/exclusive---better-know-a-district---georgia-s-8th---lynn-westmoreland",
"http://thecolbertreport.cc.com/videos/ddmy1c/intro---6-14-06",
"http://thecolbertreport.cc.com/videos/3lnns6/surprise-visit-to-iraq",
"http://thecolbertreport.cc.com/videos/l28ig3/the-word---license-renewal",
"http://thecolbertreport.cc.com/videos/tlf8t3/better-know-a-district---georgia-s-8th---lynn-westmoreland",
"http://thecolbertreport.cc.com/videos/4xe4qw/david-sirota",
"http://thecolbertreport.cc.com/videos/g3hppv/sign-off---disappearing-act"
],
"guest": "David Sirota"
},
{
"date": "2006-06-15",
"videos": [
"http://thecolbertreport.cc.com/videos/b9zn8f/intro---6-15-06",
"http://thecolbertreport.cc.com/videos/69j400/search-for-a-new-black-friend----miami-vice--premiere",
"http://thecolbertreport.cc.com/videos/kt2s9v/the-word---lock---load",
"http://thecolbertreport.cc.com/videos/mqgxig/formidable-opponent---guantanamo-bay",
"http://thecolbertreport.cc.com/videos/p118td/michael-pollan",
"http://thecolbertreport.cc.com/videos/avxgi1/biggie-ness"
],
"guest": "Michael Pollan"
},
{
"date": "2006-06-19",
"videos": [
"http://thecolbertreport.cc.com/videos/1zww1j/intro---6-19-06",
"http://thecolbertreport.cc.com/videos/hsj6mj/bill-gates",
"http://thecolbertreport.cc.com/videos/dattp1/the-word---risky-business",
"http://thecolbertreport.cc.com/videos/q5w5ph/threatdown---the-homo-sexy-edition",
"http://thecolbertreport.cc.com/videos/vaw7tx/gustavo-arellano"
],
"guest": "Gustavo Arellano"
},
{
"date": "2006-06-20",
"videos": [
"http://thecolbertreport.cc.com/videos/wanyh5/intro---6-20-06",
"http://thecolbertreport.cc.com/videos/t2udf0/marrying-snakes",
"http://thecolbertreport.cc.com/videos/5kkfzf/the-word---everything-must-go",
"http://thecolbertreport.cc.com/videos/m05b1x/american-goal",
"http://thecolbertreport.cc.com/videos/qitmnq/stephen-makes-it-simple---government",
"http://thecolbertreport.cc.com/videos/yji71b/bart-ehrman",
"http://thecolbertreport.cc.com/videos/cahdxo/sign-off---i-ll-call-you"
],
"guest": "Bart Ehrman"
},
{
"date": "2006-06-21",
"videos": [
"http://thecolbertreport.cc.com/videos/ghd1lj/intro---6-21-06",
"http://thecolbertreport.cc.com/videos/sx1i4m/truthiness-cheer",
"http://thecolbertreport.cc.com/videos/o652yy/don-t-mess-with-jesus",
"http://thecolbertreport.cc.com/videos/alty3q/world-cup-trash-talk---alexi-lalas",
"http://thecolbertreport.cc.com/videos/n3wvrq/tip-wag---episcopal-church",
"http://thecolbertreport.cc.com/videos/qjlwml/bay-buchanan",
"http://thecolbertreport.cc.com/videos/k5qunl/sign-off---insane-clown"
],
"guest": "Bay Buchanan"
},
{
"date": "2006-06-22",
"videos": [
"http://thecolbertreport.cc.com/videos/q057ll/exclusive---better-know-a-district---colorado-s-1st---diana-degette",
"http://thecolbertreport.cc.com/videos/wjjbzb/intro---6-22-06",
"http://thecolbertreport.cc.com/videos/f4jomt/stephen-s-fault",
"http://thecolbertreport.cc.com/videos/21iu1g/stephen-hawking-is-an-a-hole",
"http://thecolbertreport.cc.com/videos/hfgyhs/the-word---cut-and-run",
"http://thecolbertreport.cc.com/videos/abdpyq/better-know-a-district---colorado-s-1st---diana-degette",
"http://thecolbertreport.cc.com/videos/2oh72f/douglas-brinkley",
"http://thecolbertreport.cc.com/videos/vh4cyy/sign-off---not-winning-prizes"
],
"guest": "Doug Brinkley"
},
{
"date": "2006-06-26",
"videos": [
"http://thecolbertreport.cc.com/videos/nxwjfg/intro---6-26-06",
"http://thecolbertreport.cc.com/videos/0au60f/buffett-hires-gates",
"http://thecolbertreport.cc.com/videos/7xr6qc/medal-of-audacity",
"http://thecolbertreport.cc.com/videos/wzsdxf/the-word---class-warfare",
"http://thecolbertreport.cc.com/videos/gb7vwl/all-you-need-to-know---hot-planet",
"http://thecolbertreport.cc.com/videos/ny0s7o/mark-bowden",
"http://thecolbertreport.cc.com/videos/7zeule/sign-off---highlights-magazine"
],
"guest": "Mark Bowden"
},
{
"date": "2006-06-27",
"videos": [
"http://thecolbertreport.cc.com/videos/fqk84n/intro---6-27-06",
"http://thecolbertreport.cc.com/videos/wmi0fy/flammo-mcburny",
"http://thecolbertreport.cc.com/videos/jgpsp4/greatest-conservative-rock-songs",
"http://thecolbertreport.cc.com/videos/5xzyo9/the-word---cold--dead-fingers",
"http://thecolbertreport.cc.com/videos/nnrjlz/movies-that-are-destroying-america---a-scanner-darkly",
"http://thecolbertreport.cc.com/videos/360rgd/chris-matthews",
"http://thecolbertreport.cc.com/videos/iiom30/sign-off---rubber-mop"
],
"guest": "Chris Matthews"
},
{
"date": "2006-06-28",
"videos": [
"http://thecolbertreport.cc.com/videos/iehmr9/intro---6-28-06",
"http://thecolbertreport.cc.com/videos/mdix0g/the-smoking-side-dish",
"http://thecolbertreport.cc.com/videos/luor1n/american-flags",
"http://thecolbertreport.cc.com/videos/ygvw1r/the-word---superman",
"http://thecolbertreport.cc.com/videos/9i4qz9/citizens-in-action---fondue-it-yourself",
"http://thecolbertreport.cc.com/videos/pt4qqj/robert-baer",
"http://thecolbertreport.cc.com/videos/h13p5y/sign-off---mr--potato-head"
],
"guest": "Robert Baer"
},
{
"date": "2006-06-29",
"videos": [
"http://thecolbertreport.cc.com/videos/edzwgb/intro---6-29-06",
"http://thecolbertreport.cc.com/videos/voqmme/farewell--supreme-court",
"http://thecolbertreport.cc.com/videos/z39ivs/the-president-s-bff",
"http://thecolbertreport.cc.com/videos/qzor72/the-word---monkey-butter",
"http://thecolbertreport.cc.com/videos/ncmucg/difference-makers---steve-pelkey",
"http://thecolbertreport.cc.com/videos/facpb9/christopher-noxon",
"http://thecolbertreport.cc.com/videos/9y1lrr/star-jones"
],
"guest": "Christopher Noxon"
},
{
"date": "2006-07-10",
"videos": [
"http://thecolbertreport.cc.com/videos/lp1b85/intro---7-10-06",
"http://thecolbertreport.cc.com/videos/fweavv/world-cup-co-champions",
"http://thecolbertreport.cc.com/videos/gud4ld/the-word---silver-foxes",
"http://thecolbertreport.cc.com/videos/ul4u7x/stephen-s-sound-advice---avoiding-wildfires",
"http://thecolbertreport.cc.com/videos/hfxzg3/amy-sedaris",
"http://thecolbertreport.cc.com/videos/izyjak/wilford-brimley-calls---mexico"
],
"guest": "Amy Sedaris"
},
{
"date": "2006-07-11",
"videos": [
"http://thecolbertreport.cc.com/videos/2clwx9/intro---7-11-06",
"http://thecolbertreport.cc.com/videos/iqeepf/coddling-our-kids",
"http://thecolbertreport.cc.com/videos/d006ym/the-word---psychopharmaparenting",
"http://thecolbertreport.cc.com/videos/0go470/stephen-r-a-p-s----talkin--to-kids",
"http://thecolbertreport.cc.com/videos/wpkhsp/tony-hawk",
"http://thecolbertreport.cc.com/videos/0eibi7/stephen-colbert-s-world-of-colbertcraft"
],
"guest": "Tony Hawk"
},
{
"date": "2006-07-12",
"videos": [
"http://thecolbertreport.cc.com/videos/ov83sj/exclusive---better-know-a-district---washington-s-2nd---rick-larsen",
"http://thecolbertreport.cc.com/videos/xl7bdt/intro---7-12-06",
"http://thecolbertreport.cc.com/videos/t0dd3g/massachusetts---gaysrael",
"http://thecolbertreport.cc.com/videos/pey6is/the-word---the-america-conventions",
"http://thecolbertreport.cc.com/videos/67j2yk/better-know-a-district---washington-s-2nd---rick-larsen",
"http://thecolbertreport.cc.com/videos/pabesh/mort-zuckerman",
"http://thecolbertreport.cc.com/videos/c4tuhx/sign-off---space-open"
],
"guest": "Mort Zuckerman"
},
{
"date": "2006-07-13",
"videos": [
"http://thecolbertreport.cc.com/videos/rlgq2q/intro---7-13-06",
"http://thecolbertreport.cc.com/videos/d3xq4i/tv-s-new-low",
"http://thecolbertreport.cc.com/videos/d45lww/the-word---inquisition",
"http://thecolbertreport.cc.com/videos/mu9fov/threatdown---gay-clones",
"http://thecolbertreport.cc.com/videos/42xxhd/ron-suskind"
],
"guest": "Ron Suskind"
},
{
"date": "2006-07-17",
"videos": [
"http://thecolbertreport.cc.com/videos/q6xn0v/intro---7-17-06",
"http://thecolbertreport.cc.com/videos/8g7ft7/microphone-on",
"http://thecolbertreport.cc.com/videos/9s23g8/one-american-dollar",
"http://thecolbertreport.cc.com/videos/ne3cif/the-word---t---a",
"http://thecolbertreport.cc.com/videos/mn3izi/tip-wag---arizona",
"http://thecolbertreport.cc.com/videos/udm6or/lee-silver",
"http://thecolbertreport.cc.com/videos/yz4kpe/sign-off---lemons"
],
"guest": "Lee Silver"
},
{
"date": "2006-07-18",
"videos": [
"http://thecolbertreport.cc.com/videos/6nca03/intro---7-18-06",
"http://thecolbertreport.cc.com/videos/zipmr4/column-width",
"http://thecolbertreport.cc.com/videos/r9fvrq/wwiii",
"http://thecolbertreport.cc.com/videos/y08094/the-word---solidarity",
"http://thecolbertreport.cc.com/videos/dz7igl/stephen-colbert-s-problems-without-solutions---bears",
"http://thecolbertreport.cc.com/videos/j9c7t7/dhani-jones",
"http://thecolbertreport.cc.com/videos/eaenq6/try-at-goodbye"
],
"guest": "Dhani Jones"
},
{
"date": "2006-07-19",
"videos": [
"http://thecolbertreport.cc.com/videos/2v2a4w/intro---7-19-06",
"http://thecolbertreport.cc.com/videos/wzyudz/veto-virginity",
"http://thecolbertreport.cc.com/videos/vmqv4k/oprah-and-gayle",
"http://thecolbertreport.cc.com/videos/zjmkqr/the-word---r-e-s-p-e-c-t",
"http://thecolbertreport.cc.com/videos/yluk0n/the-convenientest-truth",
"http://thecolbertreport.cc.com/videos/xndme2/joe-scarborough",
"http://thecolbertreport.cc.com/videos/3os5ld/sign-off---buck-o-neil"
],
"guest": "Joe Scarborough"
},
{
"date": "2006-07-20",
"videos": [
"http://thecolbertreport.cc.com/videos/vx02e0/exclusive---better-know-a-district---florida-s-19th---robert-wexler",
"http://thecolbertreport.cc.com/videos/e2w8gi/intro---7-20-06",
"http://thecolbertreport.cc.com/videos/bpcz93/search-for-a-new-black-friend---friend-exchange-rate",
"http://thecolbertreport.cc.com/videos/flwcdv/julian-bond",
"http://thecolbertreport.cc.com/videos/8oaiw2/better-know-a-district---florida-s-19th---robert-wexler",
"http://thecolbertreport.cc.com/videos/naagf7/tom-brokaw",
"http://thecolbertreport.cc.com/videos/8yx1of/one-regret"
],
"guest": "Tom Brokaw"
},
{
"date": "2006-07-24",
"videos": [
"http://thecolbertreport.cc.com/videos/8l2dhx/intro---7-24-06",
"http://thecolbertreport.cc.com/videos/b9z8jn/celebrating-america-s-kick-assedness",
"http://thecolbertreport.cc.com/videos/mchynh/war---",
"http://thecolbertreport.cc.com/videos/qpue58/the-word---moral-minority",
"http://thecolbertreport.cc.com/videos/zo2o8b/threatdown---camp",
"http://thecolbertreport.cc.com/videos/0xazqv/howell-raines",
"http://thecolbertreport.cc.com/videos/530hq6/sign-off---proud"
],
"guest": "Howell Raines"
},
{
"date": "2006-07-25",
"videos": [
"http://thecolbertreport.cc.com/videos/3bdqam/intro---7-25-06",
"http://thecolbertreport.cc.com/videos/qik373/all-red-states",
"http://thecolbertreport.cc.com/videos/mdzpjk/morning-shows",
"http://thecolbertreport.cc.com/videos/e4fmv9/the-word---opposite-day",
"http://thecolbertreport.cc.com/videos/bqr3op/formidable-opponent---stem-cell-research",
"http://thecolbertreport.cc.com/videos/6xp57g/william-donohue",
"http://thecolbertreport.cc.com/videos/wfh0qw/sign-off---food-for-thought"
],
"guest": "William Donohue"
},
{
"date": "2006-07-26",
"videos": [
"http://thecolbertreport.cc.com/videos/sz2q6w/intro---7-26-06",
"http://thecolbertreport.cc.com/videos/a62j0l/stephen-s-family-tree",
"http://thecolbertreport.cc.com/videos/nxih1e/rescue-stephen-jr-",
"http://thecolbertreport.cc.com/videos/b9kj0d/the-word---democrazy",
"http://thecolbertreport.cc.com/videos/2wr9gw/stephen-s-sound-advice---blackouts",
"http://thecolbertreport.cc.com/videos/ym3t0d/neal-katyal",
"http://thecolbertreport.cc.com/videos/9nk4r7/sign-off---super-hero-stamps"
],
"guest": "Neal Katyal"
},
{
"date": "2006-07-27",
"videos": [
"http://thecolbertreport.cc.com/videos/bgxe8v/exclusive---better-know-a-district---district-of-columbia---eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/jdsi7h/intro---7-27-06",
"http://thecolbertreport.cc.com/videos/2pti2w/floyd-landis--balls",
"http://thecolbertreport.cc.com/videos/0qi0dm/the-word---secretary-general-bolton",
"http://thecolbertreport.cc.com/videos/6quypd/better-know-a-district---district-of-columbia---eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/a2w76v/joe-quesada"
],
"guest": "Joe Quesada"
},
{
"date": "2006-07-31",
"videos": [
"http://thecolbertreport.cc.com/videos/2k66vv/intro---7-31-06",
"http://thecolbertreport.cc.com/videos/ipm2dm/book-club",
"http://thecolbertreport.cc.com/videos/3jl3pu/bicycle-theft",
"http://thecolbertreport.cc.com/videos/z1aahs/the-word---wikiality",
"http://thecolbertreport.cc.com/videos/zqod1f/tip-wag---lance-bass",
"http://thecolbertreport.cc.com/videos/6tak7c/ned-lamont"
],
"guest": "Ned Lamont"
},
{
"date": "2006-08-01",
"videos": [
"http://thecolbertreport.cc.com/videos/b1r2b5/intro---8-1-06",
"http://thecolbertreport.cc.com/videos/advrej/courting-joe-lieberman",
"http://thecolbertreport.cc.com/videos/n4ao8r/cuba-libre",
"http://thecolbertreport.cc.com/videos/uqnkmr/the-word---uncool",
"http://thecolbertreport.cc.com/videos/kxcfet/balls-for-kidz---carnivals",
"http://thecolbertreport.cc.com/videos/pcfi97/peter-beinart",
"http://thecolbertreport.cc.com/videos/wm5ib9/sign-off---energy"
],
"guest": "Peter Beinart"
},
{
"date": "2006-08-02",
"videos": [
"http://thecolbertreport.cc.com/videos/7ofk8i/intro---8-2-06",
"http://thecolbertreport.cc.com/videos/1jctl5/chair-for-joe-lieberman",
"http://thecolbertreport.cc.com/videos/tc2zff/on-notice---how-the-on-notice-board-is-made",
"http://thecolbertreport.cc.com/videos/9f950b/the-word---single-serving",
"http://thecolbertreport.cc.com/videos/1gkx3r/no-joe-lieberman",
"http://thecolbertreport.cc.com/videos/m7siat/linda-hirshman",
"http://thecolbertreport.cc.com/videos/kx6zql/sign-off---cocoa-puffs"
],
"guest": "Linda Hirshman"
},
{
"date": "2006-08-03",
"videos": [
"http://thecolbertreport.cc.com/videos/dij1sw/war--what-it-s-good-for---intro",
"http://thecolbertreport.cc.com/videos/gdp73x/war--what-it-s-good-for---russ-lieber",
"http://thecolbertreport.cc.com/videos/xzhg3v/meet-an-ally---palau",
"http://thecolbertreport.cc.com/videos/o6s4zb/paul-hackett",
"http://thecolbertreport.cc.com/videos/cujsej/war--what-it-s-good-for---the-eternal-flame"
],
"guest": "Paul Hackett"
},
{
"date": "2006-08-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ggdajm/intro---8-8-06",
"http://thecolbertreport.cc.com/videos/oafdpt/lieberman-no-show",
"http://thecolbertreport.cc.com/videos/kend9g/press-room-renovations",
"http://thecolbertreport.cc.com/videos/cru76e/the-word---ten-hut-",
"http://thecolbertreport.cc.com/videos/ywy5cq/tek-jansen---operation--heart-of-the-phoenix---dead-or-alive",
"http://thecolbertreport.cc.com/videos/y3ycer/bill-rhoden",
"http://thecolbertreport.cc.com/videos/h498ah/sign-off---toss-to-jon"
],
"guest": "Bill Rhoden"
},
{
"date": "2006-08-09",
"videos": [
"http://thecolbertreport.cc.com/videos/8ku3ic/intro---8-9-06",
"http://thecolbertreport.cc.com/videos/m3m7kz/lieberman-loses",
"http://thecolbertreport.cc.com/videos/coxidl/delay-and-jesus",
"http://thecolbertreport.cc.com/videos/9jopn4/the-word---pencils-down",
"http://thecolbertreport.cc.com/videos/hpijh0/tip-wag---hungarian-bridge",
"http://thecolbertreport.cc.com/videos/p3g7eb/alexandra-robbins"
],
"guest": "Alexandra Robbins"
},
{
"date": "2006-08-10",
"videos": [
"http://thecolbertreport.cc.com/videos/75wf4h/exclusive---better-know-a-district---california-s-6th---lynn-woolsey-pt--1",
"http://thecolbertreport.cc.com/videos/m276r1/exclusive---better-know-a-district---california-s-6th---lynn-woolsey-pt--2",
"http://thecolbertreport.cc.com/videos/8ku3ic/intro---8-9-06",
"http://thecolbertreport.cc.com/videos/m3m7kz/lieberman-loses",
"http://thecolbertreport.cc.com/videos/coxidl/delay-and-jesus",
"http://thecolbertreport.cc.com/videos/9jopn4/the-word---pencils-down",
"http://thecolbertreport.cc.com/videos/hpijh0/tip-wag---hungarian-bridge",
"http://thecolbertreport.cc.com/videos/p3g7eb/alexandra-robbins"
],
"guest": "Eli Pariser"
},
{
"date": "2006-08-10",
"videos": [
"http://thecolbertreport.cc.com/videos/qehfxb/intro---8-10-06",
"http://thecolbertreport.cc.com/videos/6kvez0/liquids-on-planes",
"http://thecolbertreport.cc.com/videos/b2svxe/the-word---cappuccino",
"http://thecolbertreport.cc.com/videos/fyj6zj/better-know-a-district---california-s-6th---lynn-woolsey",
"http://thecolbertreport.cc.com/videos/d573ty/eli-pariser",
"http://thecolbertreport.cc.com/videos/hjpfzb/sign-off---remedy-for-insomnia"
],
"guest": "Eli Pariser"
},
{
"date": "2006-08-14",
"videos": [
"http://thecolbertreport.cc.com/videos/voo1ci/intro---8-14-06",
"http://thecolbertreport.cc.com/videos/8c9998/peaceland",
"http://thecolbertreport.cc.com/videos/mjxd75/french-fries",
"http://thecolbertreport.cc.com/videos/bghbjx/jon-s-apology",
"http://thecolbertreport.cc.com/videos/ozm5pk/stephen-s-sound-advice---protecting-your-online-identity",
"http://thecolbertreport.cc.com/videos/u393jw/ramesh-ponnuru",
"http://thecolbertreport.cc.com/videos/2b5c2u/sign-off---e-mail-password"
],
"guest": "Ramesh Ponnuru"
},
{
"date": "2006-08-15",
"videos": [
"http://thecolbertreport.cc.com/videos/s8rzc5/intro---8-15-06",
"http://thecolbertreport.cc.com/videos/95fbpq/sharing-the-spotlight-with-ahmadinejad",
"http://thecolbertreport.cc.com/videos/6qb0k5/the-word---dumb-ocracy",
"http://thecolbertreport.cc.com/videos/2evzvd/hungarian-bridge-progress-report",
"http://thecolbertreport.cc.com/videos/mjhnvj/all-you-need-to-know---proper-condom-use",
"http://thecolbertreport.cc.com/videos/jdgp1k/david-gergen"
],
"guest": "David Gergen"
},
{
"date": "2006-08-16",
"videos": [
"http://thecolbertreport.cc.com/videos/5nmn6o/intro---8-16-06",
"http://thecolbertreport.cc.com/videos/ic96lx/alan-schlesinger",
"http://thecolbertreport.cc.com/videos/lsglfu/the-word---el-comandante",
"http://thecolbertreport.cc.com/videos/gb4665/let-s-make-this-happen",
"http://thecolbertreport.cc.com/videos/2ap7v2/was-it-really-that-bad----cold-war",
"http://thecolbertreport.cc.com/videos/5uanam/morgan-spurlock",
"http://thecolbertreport.cc.com/videos/9nqss3/sign-off---historic-hoax"
],
"guest": "Morgan Spurlock"
},
{
"date": "2006-08-17",
"videos": [
"http://thecolbertreport.cc.com/videos/b66unq/intro---8-17-06",
"http://thecolbertreport.cc.com/videos/xzzu7h/continuity",
"http://thecolbertreport.cc.com/videos/75yefr/neil-degrasse-tyson",
"http://thecolbertreport.cc.com/videos/kc21ru/better-know-a-district---california-s-31st",
"http://thecolbertreport.cc.com/videos/8n3z7e/better-know-a-district---california-s-31st---javier-becerra",
"http://thecolbertreport.cc.com/videos/nsqwib/neil-young"
],
"guest": "Neil Young"
},
{
"date": "2006-08-21",
"videos": [
"http://thecolbertreport.cc.com/videos/uz7rxo/intro---8-21-06",
"http://thecolbertreport.cc.com/videos/vzigy3/green-screen-challenge---the-announcement",
"http://thecolbertreport.cc.com/videos/u468bk/atheists-in-foxholes",
"http://thecolbertreport.cc.com/videos/pqlyj1/the-word---side-effects",
"http://thecolbertreport.cc.com/videos/euqtan/threatdown---drivers-eat",
"http://thecolbertreport.cc.com/videos/btgfsr/geoffrey-nunberg",
"http://thecolbertreport.cc.com/videos/6p8hy2/sign-off---pants-off"
],
"guest": "Geoffrey Nunberg"
},
{
"date": "2006-08-22",
"videos": [
"http://thecolbertreport.cc.com/videos/h5huhm/intro---8-22-06",
"http://thecolbertreport.cc.com/videos/xr6owy/cheating-death---fields-medal",
"http://thecolbertreport.cc.com/videos/p4wf5t/the-word---99-problems",
"http://thecolbertreport.cc.com/videos/8t1wv1/stephen-colbert-salutes-hungary",
"http://thecolbertreport.cc.com/videos/6iv4i1/paul-krugman"
],
"guest": "Paul Krugman"
},
{
"date": "2006-08-23",
"videos": [
"http://thecolbertreport.cc.com/videos/rsqkbw/american-pop-culture--it-s-crumbelievable----intro",
"http://thecolbertreport.cc.com/videos/85w92g/american-pop-culture--it-s-crumbelievable----pop-culture-icons",
"http://thecolbertreport.cc.com/videos/l7z3b3/damian-kulash",
"http://thecolbertreport.cc.com/videos/19r90f/american-pop-culture--it-s-crumbelievable----cable-tv-vs--the-american-family",
"http://thecolbertreport.cc.com/videos/9h0pam/gideon-yago",
"http://thecolbertreport.cc.com/videos/l29lto/american-pop-culture--it-s-crumbelievable----stephen-steps-up"
],
"guest": "Gideon Yago"
},
{
"date": "2006-08-24",
"videos": [
"http://thecolbertreport.cc.com/videos/86h1lx/intro---8-24-06",
"http://thecolbertreport.cc.com/videos/j3gjfh/national-peach-month",
"http://thecolbertreport.cc.com/videos/8avj2z/fart-jokes",
"http://thecolbertreport.cc.com/videos/ejrivu/the-word---bad-boys",
"http://thecolbertreport.cc.com/videos/sui137/30-days-with-the-colbert-report",
"http://thecolbertreport.cc.com/videos/dw0hc5/janna-levin",
"http://thecolbertreport.cc.com/videos/8v6ak5/green-screen-challenge---socialized-medicine"
],
"guest": "Janna Levin"
},
{
"date": "2006-09-11",
"videos": [
"http://thecolbertreport.cc.com/videos/e2o0vm/intro---9-11-06",
"http://thecolbertreport.cc.com/videos/ryb1sd/manilow-s-emmy",
"http://thecolbertreport.cc.com/videos/vnwrl5/the-word---shall",
"http://thecolbertreport.cc.com/videos/epkjf1/the-path-to-9-11",
"http://thecolbertreport.cc.com/videos/dpqisf/martin-short",
"http://thecolbertreport.cc.com/videos/0giino/sign-off---lullaby-clap"
],
"guest": "Martin Short"
},
{
"date": "2006-09-12",
"videos": [
"http://thecolbertreport.cc.com/videos/zj5aco/exclusive---better-know-a-challenger---new-jersey-s-3rd---richard-sexton",
"http://thecolbertreport.cc.com/videos/2vdm17/intro---9-12-06",
"http://thecolbertreport.cc.com/videos/fuhxnz/green-screen-challenge---entry",
"http://thecolbertreport.cc.com/videos/464nde/the-word---missed-opportunity",
"http://thecolbertreport.cc.com/videos/03wv59/better-know-a-challenger---new-jersey-s-3rd---richard-sexton",
"http://thecolbertreport.cc.com/videos/uyjgfx/toby-keith",
"http://thecolbertreport.cc.com/videos/df7axm/sign-off---special-episode"
],
"guest": "Toby Keith"
},
{
"date": "2006-09-13",
"videos": [
"http://thecolbertreport.cc.com/videos/9h47r2/intro---9-13-06",
"http://thecolbertreport.cc.com/videos/a7pf2u/the-colmandos",
"http://thecolbertreport.cc.com/videos/fftk8t/the-word---caveat-emptor",
"http://thecolbertreport.cc.com/videos/yr3sze/formidable-opponent---iraq-withdrawal",
"http://thecolbertreport.cc.com/videos/io94jl/ken-jennings",
"http://thecolbertreport.cc.com/videos/m6mk95/sign-off---cigarettes"
],
"guest": "Ken Jennings"
},
{
"date": "2006-09-14",
"videos": [
"http://thecolbertreport.cc.com/videos/3i56pi/intro---9-14-06",
"http://thecolbertreport.cc.com/videos/m82cj5/sexy-photo",
"http://thecolbertreport.cc.com/videos/39njye/george-allen",
"http://thecolbertreport.cc.com/videos/dmk6s2/hungarian-bridge---andras-simonyi",
"http://thecolbertreport.cc.com/videos/ogtff2/tip-wag---nasa",
"http://thecolbertreport.cc.com/videos/6xq5fv/bill-simmons",
"http://thecolbertreport.cc.com/videos/czqyfe/sign-off---get-on-it--nation",
"http://thecolbertreport.cc.com/videos/g844xc/bridge-contest"
],
"guest": "Bill Simmons"
},
{
"date": "2006-09-18",
"videos": [
"http://thecolbertreport.cc.com/videos/wteen9/intro---9-18-06",
"http://thecolbertreport.cc.com/videos/51grfw/whitney-houston",
"http://thecolbertreport.cc.com/videos/82m3g9/the-word---wiper-fluid",
"http://thecolbertreport.cc.com/videos/cyd2um/tek-jansen---operation--destiny-s-underbelly--entrapped-",
"http://thecolbertreport.cc.com/videos/r7b7p1/will-power",
"http://thecolbertreport.cc.com/videos/j44oq1/sign-off---bust"
],
"guest": "Will Power"
},
{
"date": "2006-09-19",
"videos": [
"http://thecolbertreport.cc.com/videos/spzrjp/intro---9-19-06",
"http://thecolbertreport.cc.com/videos/dbmjaj/u-n--week",
"http://thecolbertreport.cc.com/videos/5v40iy/the-word---tribalism",
"http://thecolbertreport.cc.com/videos/qloab5/threatdown---toby-keith",
"http://thecolbertreport.cc.com/videos/kf8re4/frank-rich",
"http://thecolbertreport.cc.com/videos/ezwrh0/sign-off---fantasy-colbert-report-league"
],
"guest": "Frank Rich"
},
{
"date": "2006-09-20",
"videos": [
"http://thecolbertreport.cc.com/videos/lj5z86/green-screen-challenge---the-challenge-continues",
"http://thecolbertreport.cc.com/videos/o1qorx/who-s-not-honoring-me-now----the-macarthur-foundation",
"http://thecolbertreport.cc.com/videos/pz60rq/green-screen-challenge---typical-democrats",
"http://thecolbertreport.cc.com/videos/vkr39r/stephen-s-sound-advice---high-school",
"http://thecolbertreport.cc.com/videos/fn9d5q/james-carville",
"http://thecolbertreport.cc.com/videos/g7hl0x/the-word---lose"
],
"guest": "James Carville"
},
{
"date": "2006-09-21",
"videos": [
"http://thecolbertreport.cc.com/videos/yujezq/intro---9-21-06",
"http://thecolbertreport.cc.com/videos/tvrtdg/days-of-repentance-hotline",
"http://thecolbertreport.cc.com/videos/kxvydq/better-know-a-challenger---new-jersey-s-5th---paul-aronsohn",
"http://thecolbertreport.cc.com/videos/u1txo4/daniel-ellsberg",
"http://thecolbertreport.cc.com/videos/42tk7e/sign-off---pentagon-papers",
"http://thecolbertreport.cc.com/videos/yxzh84/daniel-golden"
],
"guest": "Daniel Ellsberg"
},
{
"date": "2006-09-25",
"videos": [
"http://thecolbertreport.cc.com/videos/ubu45l/intro---9-25-06",
"http://thecolbertreport.cc.com/videos/918nqn/heritage",
"http://thecolbertreport.cc.com/videos/s08yij/buy-this-book",
"http://thecolbertreport.cc.com/videos/1tds5k/the-word---opposition-party",
"http://thecolbertreport.cc.com/videos/az74i4/green-screen-challenge---goodbye--darth-maul-",
"http://thecolbertreport.cc.com/videos/te8evq/fun-in-the-sun",
"http://thecolbertreport.cc.com/videos/c88j0x/arianna-huffington"
],
"guest": "Arianna Huffington"
},
{
"date": "2006-09-26",
"videos": [
"http://thecolbertreport.cc.com/videos/13qtu2/intro---9-26-06",
"http://thecolbertreport.cc.com/videos/76ov53/frank-rich-calls-in",
"http://thecolbertreport.cc.com/videos/navjpx/the-word---good-morning",
"http://thecolbertreport.cc.com/videos/22kzkk/four-horsemen-of-the-a-pop-calypse---justin-timberlake",
"http://thecolbertreport.cc.com/videos/kertmr/ted-danson",
"http://thecolbertreport.cc.com/videos/en1nzg/alpha-dog-of-the-week---tom-selleck"
],
"guest": "Ted Danson"
},
{
"date": "2006-09-27",
"videos": [
"http://thecolbertreport.cc.com/videos/dkn6is/intro---9-27-06",
"http://thecolbertreport.cc.com/videos/w75za8/oprah-and-friends",
"http://thecolbertreport.cc.com/videos/2zj0db/mort-zuckerman-dials-the-atone-phone",
"http://thecolbertreport.cc.com/videos/wq2mkf/the-word---iraq",
"http://thecolbertreport.cc.com/videos/p20mpr/tip-wag---george-clooney",
"http://thecolbertreport.cc.com/videos/g1anyj/lowell-bergman",
"http://thecolbertreport.cc.com/videos/8v25i1/sign-off---world-of-colbertcraft"
],
"guest": "Lowell Bergman"
},
{
"date": "2006-09-28",
"videos": [
"http://thecolbertreport.cc.com/videos/b0od22/intro---9-28-06",
"http://thecolbertreport.cc.com/videos/mechk8/green-screen-challenge---ipod---colbert",
"http://thecolbertreport.cc.com/videos/jl58qd/blitzkrieg-on-grinchitude---santa-claus--in",
"http://thecolbertreport.cc.com/videos/a23i2j/jon-stewart-calls-in",
"http://thecolbertreport.cc.com/videos/kby4hb/un-american-news---spain",
"http://thecolbertreport.cc.com/videos/c2vyau/steve-wozniak"
],
"guest": "Steve Wozniak"
},
{
"date": "2006-10-02",
"videos": [
"http://thecolbertreport.cc.com/videos/vaflyc/intro---10-2-06",
"http://thecolbertreport.cc.com/videos/ak0wmf/mark-foley",
"http://thecolbertreport.cc.com/videos/clzwmu/the-word---copycat",
"http://thecolbertreport.cc.com/videos/0f7zu5/threatdown---saudi-arabia",
"http://thecolbertreport.cc.com/videos/6cuxj4/michael-lewis",
"http://thecolbertreport.cc.com/videos/gwcer9/sign-off---actual-apologies"
],
"guest": "Michael Lewis"
},
{
"date": "2006-10-03",
"videos": [
"http://thecolbertreport.cc.com/videos/fkksjm/intro---10-3-06",
"http://thecolbertreport.cc.com/videos/85po0w/drunk-dialing",
"http://thecolbertreport.cc.com/videos/hnt52c/lucifer",
"http://thecolbertreport.cc.com/videos/ap05bd/the-word---experience",
"http://thecolbertreport.cc.com/videos/oojn49/steagle-colbeagle-the-eagle---mascot",
"http://thecolbertreport.cc.com/videos/xqpdbq/andy-stern",
"http://thecolbertreport.cc.com/videos/tbnr4f/sign-off---retire-the-jersey"
],
"guest": "Andy Stern"
},
{
"date": "2006-10-04",
"videos": [
"http://thecolbertreport.cc.com/videos/pi53om/intro---10-4-06",
"http://thecolbertreport.cc.com/videos/t3hp8a/mark-foley-the-rino",
"http://thecolbertreport.cc.com/videos/2n2oat/the-word---must-not-see-tv",
"http://thecolbertreport.cc.com/videos/536mbt/nobel-prize-sweep",
"http://thecolbertreport.cc.com/videos/ga8yja/green-screen-challenge---d-d",
"http://thecolbertreport.cc.com/videos/ps5fh4/byron-dorgan",
"http://thecolbertreport.cc.com/videos/vbbgif/-20-million-victory-party"
],
"guest": "Byron Dorgan"
},
{
"date": "2006-10-05",
"videos": [
"http://thecolbertreport.cc.com/videos/r5fn7m/intro---10-5-06",
"http://thecolbertreport.cc.com/videos/t7lg5x/handling-sex-scandals",
"http://thecolbertreport.cc.com/videos/2pcxy7/behavioral-profiling",
"http://thecolbertreport.cc.com/videos/6qs8dt/maz-jobrani",
"http://thecolbertreport.cc.com/videos/8vhk9f/better-know-a-district---florida-s-16th---mark-foley",
"http://thecolbertreport.cc.com/videos/cg4ud6/amy-goodman",
"http://thecolbertreport.cc.com/videos/mex37x/starbucks-price-hike"
],
"guest": "Amy Goodman"
},
{
"date": "2006-10-09",
"videos": [
"http://thecolbertreport.cc.com/videos/uz4y5r/intro---10-9-06",
"http://thecolbertreport.cc.com/videos/vcdu14/stephen-greets-kim-jong-il",
"http://thecolbertreport.cc.com/videos/94jsyv/the-word---safety",
"http://thecolbertreport.cc.com/videos/oqybt6/sport-report---saginaw-spirit-3-0-with-steagle-colbeagle",
"http://thecolbertreport.cc.com/videos/sxcbbt/randy-newman"
],
"guest": "Randy Newman"
},
{
"date": "2006-10-10",
"videos": [
"http://thecolbertreport.cc.com/videos/7x9ixq/a-salute-to-the-american-lady",
"http://thecolbertreport.cc.com/videos/2jugk2/stephen-r-a-p-s----gender-issues",
"http://thecolbertreport.cc.com/videos/tab5oc/jane-fonda-and-gloria-steinem",
"http://thecolbertreport.cc.com/videos/vglnl3/ariel-levy",
"http://thecolbertreport.cc.com/videos/6ooly1/sign-off---mrs--colbert"
],
"guest": "Ariel Levy"
},
{
"date": "2006-10-11",
"videos": [
"http://thecolbertreport.cc.com/videos/m063rn/intro---10-11-06",
"http://thecolbertreport.cc.com/videos/bmktr8/shout-out----from-baghdad-to-the-report",
"http://thecolbertreport.cc.com/videos/lbop8f/stephen-cashes-in",
"http://thecolbertreport.cc.com/videos/kpo74v/green-screen-challenge---the-final-cut",
"http://thecolbertreport.cc.com/videos/fxyspp/green-screen-challenge---the-finalists",
"http://thecolbertreport.cc.com/videos/n67d6e/green-screen-challenge---the-winner",
"http://thecolbertreport.cc.com/videos/pkbxv2/tek-jansen---space-station-theta-zeus-aquarius",
"http://thecolbertreport.cc.com/videos/8hq3dq/lightsaber-duel",
"http://thecolbertreport.cc.com/videos/nkr8wo/green-screen---george-lucas"
],
"guest": "Andrew Sullivan"
},
{
"date": "2006-10-12",
"videos": [
"http://thecolbertreport.cc.com/videos/d5jz3y/exclusive---better-know-a-challenger---new-jersey-s-4th---carol-gay",
"http://thecolbertreport.cc.com/videos/yw8t41/intro---10-12-06",
"http://thecolbertreport.cc.com/videos/dikrto/congratulatory-mail",
"http://thecolbertreport.cc.com/videos/9dfgke/north-korean-weapons-test-scare",
"http://thecolbertreport.cc.com/videos/htaz1s/gay-republicans---andrew-sullivan",
"http://thecolbertreport.cc.com/videos/gtnan5/better-know-a-challenger---new-jersey-s-4th---carol-gay",
"http://thecolbertreport.cc.com/videos/f57spg/brian-schweitzer",
"http://thecolbertreport.cc.com/videos/o1sfrf/sign-off---revved-up"
],
"guest": "Larry Miller"
},
{
"date": "2006-10-16",
"videos": [
"http://thecolbertreport.cc.com/videos/plp18s/intro---10-16-06",
"http://thecolbertreport.cc.com/videos/q81oyv/bush-impersonator-impersonator",
"http://thecolbertreport.cc.com/videos/3yuat5/cbgb-s",
"http://thecolbertreport.cc.com/videos/7i1kaz/the-word---russian-dolls",
"http://thecolbertreport.cc.com/videos/rxjbs7/tip-wag---midterm-elections-edition",
"http://thecolbertreport.cc.com/videos/2he8tk/barry-scheck",
"http://thecolbertreport.cc.com/videos/xuvjmp/the-wave"
],
"guest": "Barry Scheck"
},
{
"date": "2006-10-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ae5ru6/intro---10-17-06",
"http://thecolbertreport.cc.com/videos/fo3bt3/one-year-anniversary",
"http://thecolbertreport.cc.com/videos/r8tksi/descending-screen",
"http://thecolbertreport.cc.com/videos/18nq18/the-word---irreconcilable-differences",
"http://thecolbertreport.cc.com/videos/hlfrbf/anniversary-cake",
"http://thecolbertreport.cc.com/videos/is87vo/judge-tubbs",
"http://thecolbertreport.cc.com/videos/7fe2ut/richard-dawkins",
"http://thecolbertreport.cc.com/videos/g41j5d/second-year-portrait"
],
"guest": "Richard Dawkins"
},
{
"date": "2006-10-18",
"videos": [
"http://thecolbertreport.cc.com/videos/nm42tm/intro---10-18-06",
"http://thecolbertreport.cc.com/videos/szo4co/elephant-vasectomies",
"http://thecolbertreport.cc.com/videos/bl7nra/the-word---sherlock",
"http://thecolbertreport.cc.com/videos/jpgqk0/jeopardy",
"http://thecolbertreport.cc.com/videos/wu6d7x/sport-report---smack-talk",
"http://thecolbertreport.cc.com/videos/0usw0u/david-kuo",
"http://thecolbertreport.cc.com/videos/pun0an/santorum-s-iraqi-lord-of-the-rings"
],
"guest": "Deepak Chopra"
},
{
"date": "2006-10-19",
"videos": [
"http://thecolbertreport.cc.com/videos/63h5y0/exclusive---better-know-a-challenger---new-york-s-19th---john-hall",
"http://thecolbertreport.cc.com/videos/simwwd/intro---10-19-06",
"http://thecolbertreport.cc.com/videos/zzoxmj/ebay-portrait-bid",
"http://thecolbertreport.cc.com/videos/55o9xl/jim-gilchrist",
"http://thecolbertreport.cc.com/videos/eh02b8/better-know-a-challenger---new-york-s-19th---john-hall",
"http://thecolbertreport.cc.com/videos/484q7z/peter-agre"
],
"guest": "Matthew Dowd"
},
{
"date": "2006-10-30",
"videos": [
"http://thecolbertreport.cc.com/videos/xsr78j/intro---10-30-06",
"http://thecolbertreport.cc.com/videos/501yrw/get-ready-for-barry",
"http://thecolbertreport.cc.com/videos/fokcta/stay-the-course",
"http://thecolbertreport.cc.com/videos/2ffwy9/the-word---shameless",
"http://thecolbertreport.cc.com/videos/3644s2/threatdown---greatdown",
"http://thecolbertreport.cc.com/videos/h5ly2o/barry-manilow"
],
"guest": "Barry Manilow"
},
{
"date": "2006-10-31",
"videos": [
"http://thecolbertreport.cc.com/videos/vll3lh/intro---10-31-06",
"http://thecolbertreport.cc.com/videos/ixb36k/costumes-for-the-girls",
"http://thecolbertreport.cc.com/videos/qrw2en/the-word---thanks--gays-",
"http://thecolbertreport.cc.com/videos/ya17xq/portrait-auction",
"http://thecolbertreport.cc.com/videos/crxtpi/welcome-to-the-house-of-horrors---nancy-pelosi",
"http://thecolbertreport.cc.com/videos/2g6dhj/tim-robbins",
"http://thecolbertreport.cc.com/videos/9z7u1s/freak-show---log-cabin-republican"
],
"guest": "Tim Robbins"
},
{
"date": "2006-11-01",
"videos": [
"http://thecolbertreport.cc.com/videos/fio9x5/exclusive---better-know-a-challenger---california-s-30th---david-nelson-jones",
"http://thecolbertreport.cc.com/videos/ngeqml/intro---11-1-06",
"http://thecolbertreport.cc.com/videos/07l6jg/john-kerry",
"http://thecolbertreport.cc.com/videos/5a62pu/the-word---rip-off",
"http://thecolbertreport.cc.com/videos/j449s5/better-know-a-challenger---california-s-30th---david-nelson-jones",
"http://thecolbertreport.cc.com/videos/80bjyk/penn-jillette",
"http://thecolbertreport.cc.com/videos/7w23zw/big-in--06"
],
"guest": "Penn Jillette"
},
{
"date": "2006-11-02",
"videos": [
"http://thecolbertreport.cc.com/videos/c1jp7z/intro---11-2-06",
"http://thecolbertreport.cc.com/videos/ryl8xd/a-historidocufictiomentary-of-george-allen",
"http://thecolbertreport.cc.com/videos/ypv3hz/p-k--winsome---black-republican",
"http://thecolbertreport.cc.com/videos/e8pbai/sport-report---the-spirit-shop",
"http://thecolbertreport.cc.com/videos/o5x0ja/chad-walldorf--portrait-winner",
"http://thecolbertreport.cc.com/videos/vchsrw/ron-reagan"
],
"guest": "Ron Reagan Jr."
},
{
"date": "2006-11-06",
"videos": [
"http://thecolbertreport.cc.com/videos/5l9ww2/intro---11-6-06",
"http://thecolbertreport.cc.com/videos/3x1o1e/saddam-s-hanging",
"http://thecolbertreport.cc.com/videos/mfycn0/vote-your-conscience",
"http://thecolbertreport.cc.com/videos/xjsetj/the-word---happy-ending",
"http://thecolbertreport.cc.com/videos/yu4stw/ted-haggard-s-media-field-day",
"http://thecolbertreport.cc.com/videos/qtoavw/what-to-expect-when-you-re-electing",
"http://thecolbertreport.cc.com/videos/de4hy0/mark-halperin",
"http://thecolbertreport.cc.com/videos/iuqlez/absentee-voting"
],
"guest": "Mark Halperin"
},
{
"date": "2006-11-07",
"videos": [
"http://thecolbertreport.cc.com/videos/rdhken/midterm-midtacular---beatty---bening-confirmation-call",
"http://thecolbertreport.cc.com/videos/vmt5dv/better-know-a-district---midterm-midtacular",
"http://thecolbertreport.cc.com/videos/42n9bh/midterm-midtacular---update-from-the-daily-show",
"http://thecolbertreport.cc.com/videos/gmknl3/midterm-midtacular---democrat-majority",
"http://thecolbertreport.cc.com/videos/1qhm06/stephen-s-final-thoughts",
"http://thecolbertreport.cc.com/videos/3fzd37/robert-wexler-and-eleanor-holmes-norton"
],
"guest": "Election Night Live Show"
},
{
"date": "2006-11-08",
"videos": [
"http://thecolbertreport.cc.com/videos/veyf2a/intro---11-8-06",
"http://thecolbertreport.cc.com/videos/0085n8/the-word---sigh",
"http://thecolbertreport.cc.com/videos/8tjdnz/better-know-a-district---new-york-s-19th---john-hall",
"http://thecolbertreport.cc.com/videos/n1c32a/tek-jansen---theme-song",
"http://thecolbertreport.cc.com/videos/vzb4w6/jeff-greenfield",
"http://thecolbertreport.cc.com/videos/3yplp6/special-memories"
],
"guest": "Jeff Greenfield"
},
{
"date": "2006-11-09",
"videos": [
"http://thecolbertreport.cc.com/videos/vsle8s/intro---11-9-06",
"http://thecolbertreport.cc.com/videos/ec6t9w/shout-out----michael-rehm",
"http://thecolbertreport.cc.com/videos/0osdbo/the-word---putin--08",
"http://thecolbertreport.cc.com/videos/ro28cv/p-k--winsome---a-journey-home",
"http://thecolbertreport.cc.com/videos/sff21j/dean-kamen",
"http://thecolbertreport.cc.com/videos/y6jo9b/sign-off---buy-american"
],
"guest": "Dean Kamen"
},
{
"date": "2006-11-13",
"videos": [
"http://thecolbertreport.cc.com/videos/xhi69f/intro---11-13-06",
"http://thecolbertreport.cc.com/videos/tq9pyg/mccain-s-depression",
"http://thecolbertreport.cc.com/videos/wze0m8/the-word---back-off--old-man",
"http://thecolbertreport.cc.com/videos/3l0etr/tip-wag---quitters-edition",
"http://thecolbertreport.cc.com/videos/v04ko8/dan-rather",
"http://thecolbertreport.cc.com/videos/39thdv/alpha-dog-of-the-week---ronald-reagan"
],
"guest": "Dan Rather"
},
{
"date": "2006-11-14",
"videos": [
"http://thecolbertreport.cc.com/videos/2xysq8/intro---10-14-06",
"http://thecolbertreport.cc.com/videos/41uzjx/lesbian-roles",
"http://thecolbertreport.cc.com/videos/njn4f1/stephen-jr--in-canada",
"http://thecolbertreport.cc.com/videos/x9bnw7/the-word---expecting",
"http://thecolbertreport.cc.com/videos/mx7sjh/vote-for-gail-jingle",
"http://thecolbertreport.cc.com/videos/xokq2b/jeff-swartz",
"http://thecolbertreport.cc.com/videos/cnxqlb/kid-activity-corner---nancy-pelosi-hand-turkeys"
],
"guest": "Jeff Swartz"
},
{
"date": "2006-11-15",
"videos": [
"http://thecolbertreport.cc.com/videos/9sc11a/exclusive---better-know-a-founder---thomas-jefferson",
"http://thecolbertreport.cc.com/videos/2xysq8/intro---10-14-06",
"http://thecolbertreport.cc.com/videos/41uzjx/lesbian-roles",
"http://thecolbertreport.cc.com/videos/njn4f1/stephen-jr--in-canada",
"http://thecolbertreport.cc.com/videos/x9bnw7/the-word---expecting",
"http://thecolbertreport.cc.com/videos/mx7sjh/vote-for-gail-jingle",
"http://thecolbertreport.cc.com/videos/xokq2b/jeff-swartz",
"http://thecolbertreport.cc.com/videos/cnxqlb/kid-activity-corner---nancy-pelosi-hand-turkeys"
],
"guest": "Al Franken, Dr. Michael Novacek"
},
{
"date": "2006-11-15",
"videos": [
"http://thecolbertreport.cc.com/videos/zmp3r0/intro---11-15-06",
"http://thecolbertreport.cc.com/videos/kl1xl0/rush-limbaugh-s-comments",
"http://thecolbertreport.cc.com/videos/w5bgh2/democrats--victory-dance---al-franken",
"http://thecolbertreport.cc.com/videos/47a505/better-know-a-founder---thomas-jefferson",
"http://thecolbertreport.cc.com/videos/cnf5lf/mike-novacek"
],
"guest": "Al Franken, Dr. Michael Novacek"
},
{
"date": "2006-11-16",
"videos": [
"http://thecolbertreport.cc.com/videos/hstabl/intro---11-16-06",
"http://thecolbertreport.cc.com/videos/zyzp0g/minority-whip",
"http://thecolbertreport.cc.com/videos/euzyuf/sexiest-man-alive",
"http://thecolbertreport.cc.com/videos/olggdr/the-word---play-ball-",
"http://thecolbertreport.cc.com/videos/oplysq/movies-that-are-destroying-america---xmas",
"http://thecolbertreport.cc.com/videos/3il1eo/richard-linklater",
"http://thecolbertreport.cc.com/videos/s716ap/sign-off---strawberry"
],
"guest": "Richard Linklater"
},
{
"date": "2006-11-27",
"videos": [
"http://thecolbertreport.cc.com/videos/1xjoh6/intro---11-27-06",
"http://thecolbertreport.cc.com/videos/z4h5jm/putin--08",
"http://thecolbertreport.cc.com/videos/k3p09y/tivo-cleaning",
"http://thecolbertreport.cc.com/videos/dg34l1/the-word---jacksquat",
"http://thecolbertreport.cc.com/videos/ckqxms/threatdown---100-hoops",
"http://thecolbertreport.cc.com/videos/lqdkhe/jim-lehrer",
"http://thecolbertreport.cc.com/videos/y3zgee/sign-off---love"
],
"guest": "Jim Lehrer"
},
{
"date": "2006-11-28",
"videos": [
"http://thecolbertreport.cc.com/videos/0tspod/intro---11-28-06",
"http://thecolbertreport.cc.com/videos/47xxe1/who-s-honoring-me-now----gq",
"http://thecolbertreport.cc.com/videos/voj40k/the-word---ecu-menace",
"http://thecolbertreport.cc.com/videos/fenw0v/alabama-miracle---helen-keller-museum",
"http://thecolbertreport.cc.com/videos/xi41md/harry-shearer",
"http://thecolbertreport.cc.com/videos/iate4s/sign-off---exceptional-audience"
],
"guest": "Harry Shearer"
},
{
"date": "2006-11-29",
"videos": [
"http://thecolbertreport.cc.com/videos/mr063e/intro---11-29-06",
"http://thecolbertreport.cc.com/videos/wanzdw/who-s-riding-my-coattails-now----jeopardy",
"http://thecolbertreport.cc.com/videos/bp43w6/the-word---killing-two-birds",
"http://thecolbertreport.cc.com/videos/49jjmd/alabama-miracle---the-stephen-colbert-museum---gift-shop--grand-opening",
"http://thecolbertreport.cc.com/videos/8rjs2g/nora-ephron"
],
"guest": "Nora Ephron"
},
{
"date": "2006-11-30",
"videos": [
"http://thecolbertreport.cc.com/videos/wzpzqs/intro---11-30-06",
"http://thecolbertreport.cc.com/videos/4c2tdv/vilsack-attack",
"http://thecolbertreport.cc.com/videos/z88s3n/p-k--winsome---if-p-k--winsome-did-it",
"http://thecolbertreport.cc.com/videos/0inrmr/colbert-nation-merchandise",
"http://thecolbertreport.cc.com/videos/jotybg/alabama-miracle---the-morning-after",
"http://thecolbertreport.cc.com/videos/hv1lim/mike-lupica",
"http://thecolbertreport.cc.com/videos/k1wdp2/sign-off---wall-notch"
],
"guest": "Mike Lupica"
},
{
"date": "2006-12-04",
"videos": [
"http://thecolbertreport.cc.com/videos/9s5cs9/intro---12-4-06",
"http://thecolbertreport.cc.com/videos/ozd0a8/sherman-wedding",
"http://thecolbertreport.cc.com/videos/sjup2k/the-word---american-orthodox",
"http://thecolbertreport.cc.com/videos/shtpb9/tip-wag---christmas",
"http://thecolbertreport.cc.com/videos/tc5d1m/will-wright",
"http://thecolbertreport.cc.com/videos/xpx8ua/sign-off---extra-special-comment---tie-stain"
],
"guest": "Will Wright"
},
{
"date": "2006-12-05",
"videos": [
"http://thecolbertreport.cc.com/videos/z40k91/intro---12-5-06",
"http://thecolbertreport.cc.com/videos/6ixmt6/-return--to-the-moon",
"http://thecolbertreport.cc.com/videos/mz0h4p/robert-gates--confirmation",
"http://thecolbertreport.cc.com/videos/msrwcg/the-word---honest-injun",
"http://thecolbertreport.cc.com/videos/3odbkp/sport-report---coach-mancini",
"http://thecolbertreport.cc.com/videos/tjdbeu/sign-off---number-one-source",
"http://thecolbertreport.cc.com/videos/c1sa92/steven-levitt"
],
"guest": "Steven D. Leavitt"
},
{
"date": "2006-12-06",
"videos": [
"http://thecolbertreport.cc.com/videos/fe08hq/intro---12-6-06",
"http://thecolbertreport.cc.com/videos/oamjbp/life-size-nativity",
"http://thecolbertreport.cc.com/videos/ikcmp0/mary-cheney",
"http://thecolbertreport.cc.com/videos/4fr9o9/the-word---words",
"http://thecolbertreport.cc.com/videos/76wnkt/tek-jansen---tek-the-halls",
"http://thecolbertreport.cc.com/videos/0wqkww/john-sexton",
"http://thecolbertreport.cc.com/videos/8suoui/sign-off---cardboard-box"
],
"guest": "John Sexton"
},
{
"date": "2006-12-07",
"videos": [
"http://thecolbertreport.cc.com/videos/k9wcbv/intro---12-7-06",
"http://thecolbertreport.cc.com/videos/ebabt9/david-gregory",
"http://thecolbertreport.cc.com/videos/kvccyn/the-word---case-closed",
"http://thecolbertreport.cc.com/videos/tk750r/elizabeth-de-la-vega",
"http://thecolbertreport.cc.com/videos/dntxcy/green-screen-challenge---counter-challenge",
"http://thecolbertreport.cc.com/videos/4koanp/alpha-dog-of-the-week---john-bolton",
"http://thecolbertreport.cc.com/videos/dqyz7h/francis-collins",
"http://thecolbertreport.cc.com/videos/rqe98q/sign-off---tgit"
],
"guest": "Dr. Francis S. Collins"
},
{
"date": "2006-12-11",
"videos": [
"http://thecolbertreport.cc.com/videos/ri4vbo/intro---12-11-06",
"http://thecolbertreport.cc.com/videos/t0abnh/defending-rosie",
"http://thecolbertreport.cc.com/videos/uea9ov/jack-kingston",
"http://thecolbertreport.cc.com/videos/k0a3hu/the-white-christmas-album",
"http://thecolbertreport.cc.com/videos/2cea2e/threatdown---christmas-style",
"http://thecolbertreport.cc.com/videos/bqpkoy/peter-singer",
"http://thecolbertreport.cc.com/videos/5alg6c/got-your-back"
],
"guest": "Dr. Peter Singer"
},
{
"date": "2006-12-12",
"videos": [
"http://thecolbertreport.cc.com/videos/35u0ts/intro---12-12-06",
"http://thecolbertreport.cc.com/videos/kn0mlp/augusto-pinochet-s-coup",
"http://thecolbertreport.cc.com/videos/dctycd/shout-out----beef-hammer-flag",
"http://thecolbertreport.cc.com/videos/1o4xvk/the-word---casualty-of-war",
"http://thecolbertreport.cc.com/videos/e1504w/who-s-honoring-me-now----merriam-webster-s-word-of-the-year",
"http://thecolbertreport.cc.com/videos/xd9itr/better-know-a-district---new-members-of-congress-at-the-kennedy-school",
"http://thecolbertreport.cc.com/videos/j01zz1/dan-savage",
"http://thecolbertreport.cc.com/videos/s3gs7u/sign-off---post-show-taco-bell-chalupa-chow-down"
],
"guest": "Dan Savage"
},
{
"date": "2006-12-13",
"videos": [
"http://thecolbertreport.cc.com/videos/6ohkja/intro---12-13-06",
"http://thecolbertreport.cc.com/videos/yl018s/stephen-jr--s-christmas-miracle",
"http://thecolbertreport.cc.com/videos/suc40d/the-word---it-s-a-small-world",
"http://thecolbertreport.cc.com/videos/5uk9gs/replenishing-the-eggnog-supply",
"http://thecolbertreport.cc.com/videos/d0ml1u/sea-tac-s-christmas-trees-restored",
"http://thecolbertreport.cc.com/videos/x1f8dg/doris-kearns-goodwin",
"http://thecolbertreport.cc.com/videos/0kcywr/charge-me-twice-for-stephen"
],
"guest": "Doris Kearns Goodwin"
},
{
"date": "2006-12-14",
"videos": [
"http://thecolbertreport.cc.com/videos/lwojc9/intro---12-14-06",
"http://thecolbertreport.cc.com/videos/3moulc/finger-strengthening",
"http://thecolbertreport.cc.com/videos/5dvej7/the-american-people-are-to-blame",
"http://thecolbertreport.cc.com/videos/60ds73/the-word---clarity",
"http://thecolbertreport.cc.com/videos/klp05i/blood-in-the-water---bruce-tinsley-s-dui",
"http://thecolbertreport.cc.com/videos/wauy3f/caesar-honeybee-or-tyrone-hunnibi-",
"http://thecolbertreport.cc.com/videos/yaoen5/daniel-pinchbeck",
"http://thecolbertreport.cc.com/videos/ua9gte/letter-to-representative-jack-kingston"
],
"guest": "Daniel Pinchbeck"
},
{
"date": "2006-12-18",
"videos": [
"http://thecolbertreport.cc.com/videos/t66x66/intro---12-18-06",
"http://thecolbertreport.cc.com/videos/j56gn9/diy-cold-medicine",
"http://thecolbertreport.cc.com/videos/ndrsqu/profiles-in-balls",
"http://thecolbertreport.cc.com/videos/mv0dai/the-word---the-draft",
"http://thecolbertreport.cc.com/videos/c4vji3/tip-wag---art-edition",
"http://thecolbertreport.cc.com/videos/nnpc32/jack-welch",
"http://thecolbertreport.cc.com/videos/yy82av/the-jingle-terns"
],
"guest": "Jack Welch"
},
{
"date": "2006-12-19",
"videos": [
"http://thecolbertreport.cc.com/videos/an4q7j/intro---12-19-06",
"http://thecolbertreport.cc.com/videos/q9o6sw/person-of-the-year",
"http://thecolbertreport.cc.com/videos/qh5kz9/stephen-goes-to-harvard",
"http://thecolbertreport.cc.com/videos/v81egv/deepak-chopra",
"http://thecolbertreport.cc.com/videos/3fhkpv/face-off-preview",
"http://thecolbertreport.cc.com/videos/kza2d8/the-word---tit-for-tat"
],
"guest": "Deepak Chopra"
},
{
"date": "2006-12-20",
"videos": [
"http://thecolbertreport.cc.com/videos/ouau0r/intro---12-20-06",
"http://thecolbertreport.cc.com/videos/8t5vas/rock-and-awe--countdown-to-guitarmageddon",
"http://thecolbertreport.cc.com/videos/lyahfg/shreddown",
"http://thecolbertreport.cc.com/videos/iocz1g/chris-funk",
"http://thecolbertreport.cc.com/videos/4hpbzt/peter-frampton",
"http://thecolbertreport.cc.com/videos/m75mj9/shreddown---the-judgment"
],
"guest": "Howard Zinn"
}
],
"2007": [
{
"date": "2007-01-08",
"videos": [
"http://thecolbertreport.cc.com/videos/35rb23/intro---1-8-07",
"http://thecolbertreport.cc.com/videos/liauyt/the-gallotastic-executacular---hangin--with-mr--hussein",
"http://thecolbertreport.cc.com/videos/2eciiy/the-word---facts",
"http://thecolbertreport.cc.com/videos/vfxu06/who-s-attacking-me-now----lake-superior-state-university",
"http://thecolbertreport.cc.com/videos/ya0sji/who-s-honoring-me-now----gay-com",
"http://thecolbertreport.cc.com/videos/uuhxlg/stephen-s-sound-advice---surviving-the-winter-blues",
"http://thecolbertreport.cc.com/videos/duytly/ethan-nadelmann"
],
"guest": "Ethan Nadelmann"
},
{
"date": "2007-01-09",
"videos": [
"http://thecolbertreport.cc.com/videos/oxq1cl/not-a-sex-scandal",
"http://thecolbertreport.cc.com/videos/rsuyoo/intro---1-9-07",
"http://thecolbertreport.cc.com/videos/a9e13e/the-word---texas-hold--em",
"http://thecolbertreport.cc.com/videos/bmmv86/ohio-state-loses",
"http://thecolbertreport.cc.com/videos/1yhdmp/we-the-mediator---celebrity-feuds",
"http://thecolbertreport.cc.com/videos/ezqjm4/jim-cramer",
"http://thecolbertreport.cc.com/videos/q6rkb3/sign-off---farewell--james-brown"
],
"guest": "Jim Cramer"
},
{
"date": "2007-01-10",
"videos": [
"http://thecolbertreport.cc.com/videos/b3d5l1/intro---1-10-07",
"http://thecolbertreport.cc.com/videos/j5htgu/president-s-speech",
"http://thecolbertreport.cc.com/videos/crgbvq/invasion-of-the-country-snatchers",
"http://thecolbertreport.cc.com/videos/ie5gtu/the-word---worry",
"http://thecolbertreport.cc.com/videos/048s3c/tek-jansen---hounds-of-hell--ragtime-billy-peaches",
"http://thecolbertreport.cc.com/videos/ku9y06/david-kamp",
"http://thecolbertreport.cc.com/videos/9nuye7/sign-off---thawing-meat"
],
"guest": "David Kamp"
},
{
"date": "2007-01-11",
"videos": [
"http://thecolbertreport.cc.com/videos/21xsg9/intro---1-11-07",
"http://thecolbertreport.cc.com/videos/nhwjcd/what-number-is-stephen-thinking-of----doubled-up",
"http://thecolbertreport.cc.com/videos/7v6i3c/ken-roth",
"http://thecolbertreport.cc.com/videos/jxfsrm/tip-wag---science-and-technology",
"http://thecolbertreport.cc.com/videos/fxnp1o/judy-woodruff"
],
"guest": "Judy Woodruff"
},
{
"date": "2007-01-15",
"videos": [
"http://thecolbertreport.cc.com/videos/tpjoll/intro---1-15-07",
"http://thecolbertreport.cc.com/videos/bemyqb/inspired-by-dr--king",
"http://thecolbertreport.cc.com/videos/ni7g5j/a-man-s-touch",
"http://thecolbertreport.cc.com/videos/xb55y0/the-word---victory-",
"http://thecolbertreport.cc.com/videos/eamlaf/bears---balls---gas",
"http://thecolbertreport.cc.com/videos/o7xhwp/alex-kuczynski"
],
"guest": "Alex Kuczynski"
},
{
"date": "2007-01-16",
"videos": [
"http://thecolbertreport.cc.com/videos/795pdp/intro---1-16-07",
"http://thecolbertreport.cc.com/videos/ycpx4s/squeaky-chair",
"http://thecolbertreport.cc.com/videos/r7kinv/pesos-for-pizza",
"http://thecolbertreport.cc.com/videos/hwlhus/the-word---symbolic",
"http://thecolbertreport.cc.com/videos/6q6sy0/sport-report---bend-it-like-beckham",
"http://thecolbertreport.cc.com/videos/2tdkm8/dinesh-d-souza"
],
"guest": "Dinesh D'Souza"
},
{
"date": "2007-01-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ufcy26/intro---1-17-07",
"http://thecolbertreport.cc.com/videos/8amkmh/200th-episode",
"http://thecolbertreport.cc.com/videos/wjuko4/lynn-swann",
"http://thecolbertreport.cc.com/videos/xv8tlv/better-know-a-district---washington-s-3rd---brian-baird",
"http://thecolbertreport.cc.com/videos/1qdsbp/richard-clarke"
],
"guest": "Richard Clarke"
},
{
"date": "2007-01-18",
"videos": [
"http://thecolbertreport.cc.com/videos/z0tcp1/intro---1-18-07",
"http://thecolbertreport.cc.com/videos/kyc2cd/the-advent-of-o-reilly",
"http://thecolbertreport.cc.com/videos/qtrfgo/the-word---go-it-alone",
"http://thecolbertreport.cc.com/videos/dre6df/we-the-mediator---trump-v--o-donnell",
"http://thecolbertreport.cc.com/videos/9seimt/bill-o-reilly",
"http://thecolbertreport.cc.com/videos/cuouel/o-reilly-s-microwave"
],
"guest": "Bill O'Reilly"
},
{
"date": "2007-01-22",
"videos": [
"http://thecolbertreport.cc.com/videos/9vl9tx/intro---1-22-07",
"http://thecolbertreport.cc.com/videos/1t56vq/the-bears",
"http://thecolbertreport.cc.com/videos/itbxtv/who-s-riding-my-coattails-now----terence-koh",
"http://thecolbertreport.cc.com/videos/mfzk22/the-word---exact-words",
"http://thecolbertreport.cc.com/videos/opisk9/balls-for-kidz---gambling",
"http://thecolbertreport.cc.com/videos/rnd3lf/tom-schaller",
"http://thecolbertreport.cc.com/videos/6mgw6m/sign-off---zeppelin-reunion"
],
"guest": "Tom Schaller"
},
{
"date": "2007-01-23",
"videos": [
"http://thecolbertreport.cc.com/videos/xjsnlx/intro---1-23-07",
"http://thecolbertreport.cc.com/videos/ebff8o/pre-tape",
"http://thecolbertreport.cc.com/videos/vm00zm/lieber-vs--lieber",
"http://thecolbertreport.cc.com/videos/jv328p/threatdown---the-weather-channel",
"http://thecolbertreport.cc.com/videos/y849ls/michael-steele",
"http://thecolbertreport.cc.com/videos/xxwpqf/wednesday-today"
],
"guest": "Michael Steele"
},
{
"date": "2007-01-24",
"videos": [
"http://thecolbertreport.cc.com/videos/goh39c/intro---1-24-07",
"http://thecolbertreport.cc.com/videos/gzqy8i/state-of-the-union---cheney-wins",
"http://thecolbertreport.cc.com/videos/e17mq9/the-word---great-news",
"http://thecolbertreport.cc.com/videos/3525mn/better-know-a-district---pennsylvania-s-4th---jason-altmire",
"http://thecolbertreport.cc.com/videos/r5j10b/lou-dobbs"
],
"guest": "Lou Dobbs"
},
{
"date": "2007-01-25",
"videos": [
"http://thecolbertreport.cc.com/videos/n139mj/intro---1-25-07",
"http://thecolbertreport.cc.com/videos/7z0x1m/right-away-",
"http://thecolbertreport.cc.com/videos/5rmbin/the-word---smafu",
"http://thecolbertreport.cc.com/videos/hkzk11/sport-report---more-with-coach-mancini",
"http://thecolbertreport.cc.com/videos/tufln6/mike-wallace"
],
"guest": "Mike Wallace"
},
{
"date": "2007-01-29",
"videos": [
"http://thecolbertreport.cc.com/videos/o0maxx/intro---1-29-07",
"http://thecolbertreport.cc.com/videos/1m6mdm/new-york-grieves",
"http://thecolbertreport.cc.com/videos/z0b9vz/stephen-colbert-day",
"http://thecolbertreport.cc.com/videos/6p6df7/the-word---wikilobbying",
"http://thecolbertreport.cc.com/videos/11js13/tip-wag---tom-cruise",
"http://thecolbertreport.cc.com/videos/zqi973/barry-lando"
],
"guest": "Barry M. Lando"
},
{
"date": "2007-01-30",
"videos": [
"http://thecolbertreport.cc.com/videos/np3o3k/intro---1-30-07",
"http://thecolbertreport.cc.com/videos/j1sd5a/new-military-weapon",
"http://thecolbertreport.cc.com/videos/cv6q8o/david-leonhardt",
"http://thecolbertreport.cc.com/videos/ttzs6x/caviar-omelets-for-the-troops",
"http://thecolbertreport.cc.com/videos/bsbad5/judge--jury---executioner---adultery",
"http://thecolbertreport.cc.com/videos/eyhp38/donna-shalala",
"http://thecolbertreport.cc.com/videos/dwv24s/sign-off---microwave-gift-to-o-reilly"
],
"guest": "Donna Shalala"
},
{
"date": "2007-01-31",
"videos": [
"http://thecolbertreport.cc.com/videos/84e6zh/exclusive---better-know-a-district---new-york-s-6th---gregory-meeks",
"http://thecolbertreport.cc.com/videos/4mp2yh/intro---1-31-07",
"http://thecolbertreport.cc.com/videos/v1la3q/global-warming",
"http://thecolbertreport.cc.com/videos/3emlxq/on-notice---jane-fonda-fantasies",
"http://thecolbertreport.cc.com/videos/qg7l5c/the-word---black-sheep",
"http://thecolbertreport.cc.com/videos/4lodkc/better-know-a-district---new-york-s-6th---gregory-meeks",
"http://thecolbertreport.cc.com/videos/npjb41/jed-babbin"
],
"guest": "Jed Babbin"
},
{
"date": "2007-02-01",
"videos": [
"http://thecolbertreport.cc.com/videos/89lmed/intro---2-1-07",
"http://thecolbertreport.cc.com/videos/mzq0ue/cartoon-terrorism",
"http://thecolbertreport.cc.com/videos/492fjx/ending-racism",
"http://thecolbertreport.cc.com/videos/rbb68f/the-word---we-shall-overcome",
"http://thecolbertreport.cc.com/videos/2m3ntu/movies-that-are-destroying-america---oscars-edition",
"http://thecolbertreport.cc.com/videos/s2k3ll/chuck-schumer",
"http://thecolbertreport.cc.com/videos/b1j62r/the-most-poetic-f--king-thing-i-ve-ever-heard"
],
"guest": "Sen. Chuck Schumer"
},
{
"date": "2007-02-05",
"videos": [
"http://thecolbertreport.cc.com/videos/qonzal/intro---2-5-07",
"http://thecolbertreport.cc.com/videos/raqy45/peyton-manseed",
"http://thecolbertreport.cc.com/videos/1ppbxw/save-stephen-jr-",
"http://thecolbertreport.cc.com/videos/pkx5sp/the-word---second-opinion",
"http://thecolbertreport.cc.com/videos/cu6q1h/threatdown---giant-mexican-babies",
"http://thecolbertreport.cc.com/videos/qj7ov5/wendy-kopp"
],
"guest": "Wendy Kopp"
},
{
"date": "2007-02-06",
"videos": [
"http://thecolbertreport.cc.com/videos/irg0ck/exclusive---better-know-a-district---ohio-s-18th---zack-space-pt--1",
"http://thecolbertreport.cc.com/videos/7vpqnl/exclusive---better-know-a-district---ohio-s-18th---zack-space-pt--2",
"http://thecolbertreport.cc.com/videos/w05aan/intro---2-6-07",
"http://thecolbertreport.cc.com/videos/rirgzz/pray-for-stephen",
"http://thecolbertreport.cc.com/videos/ronvu0/the-word---making-a-killing",
"http://thecolbertreport.cc.com/videos/sh2kz6/better-know-a-district---ohio-s-18th---zack-space",
"http://thecolbertreport.cc.com/videos/vnbq6e/charles-leduff"
],
"guest": "Charlie LeDuff"
},
{
"date": "2007-02-07",
"videos": [
"http://thecolbertreport.cc.com/videos/lh3p6z/intro---2-7-07",
"http://thecolbertreport.cc.com/videos/skowle/the-san-francisco-treat",
"http://thecolbertreport.cc.com/videos/hx3kkt/california-values-watch",
"http://thecolbertreport.cc.com/videos/fykjnf/the-word---silence",
"http://thecolbertreport.cc.com/videos/pp2kiz/tek-jansen---from-the-future",
"http://thecolbertreport.cc.com/videos/n36pgb/steven-pinker"
],
"guest": "Steven Pinker"
},
{
"date": "2007-02-08",
"videos": [
"http://thecolbertreport.cc.com/videos/5l6ygo/intro---2-8-07",
"http://thecolbertreport.cc.com/videos/btxrus/space-madness",
"http://thecolbertreport.cc.com/videos/q5bcg9/stephen-for-president---a-sign",
"http://thecolbertreport.cc.com/videos/12d71h/debra-dickerson",
"http://thecolbertreport.cc.com/videos/ls3y3l/was-it-really-that-bad----salem-witch-trials",
"http://thecolbertreport.cc.com/videos/m5tx4f/chris-hedges"
],
"guest": "Chris Hedges"
},
{
"date": "2007-02-12",
"videos": [
"http://thecolbertreport.cc.com/videos/sudz5h/intro---2-12-07",
"http://thecolbertreport.cc.com/videos/cvs0b4/the-word---inappropriate",
"http://thecolbertreport.cc.com/videos/wetex5/tip-wag---john-howard",
"http://thecolbertreport.cc.com/videos/ovmu6y/michael-oppenheimer",
"http://thecolbertreport.cc.com/videos/gbc95s/alpha-dog-of-the-week---amitabh-bachchan"
],
"guest": "Michael Oppenheimer"
},
{
"date": "2007-02-13",
"videos": [
"http://thecolbertreport.cc.com/videos/7zlyvc/the-word---apocalypse-mao--murdered-by-the-orient-s-success---frenemy",
"http://thecolbertreport.cc.com/videos/dh1nxa/apocalypse-mao--murdered-by-the-orient-s-success---take-the-pulse",
"http://thecolbertreport.cc.com/videos/cbgmhg/sheryl-wudunn",
"http://thecolbertreport.cc.com/videos/rewkbj/apocalypse-mao--murdered-by-the-orient-s-success---eight-child-policy"
],
"guest": "Sheryl WuDunn"
},
{
"date": "2007-02-14",
"videos": [
"http://thecolbertreport.cc.com/videos/0unos7/catching-up-with-china",
"http://thecolbertreport.cc.com/videos/sv6om5/safe-sex-for-senior-citizens",
"http://thecolbertreport.cc.com/videos/qngp8d/the-word---bad-medicine",
"http://thecolbertreport.cc.com/videos/e7leqz/stephen-protects-valentine-s-day",
"http://thecolbertreport.cc.com/videos/npsgvg/sport-report---westminster-kennel-club-dog-show",
"http://thecolbertreport.cc.com/videos/tv0pg5/lance-armstrong",
"http://thecolbertreport.cc.com/videos/4zrnjn/intro---2-14-07"
],
"guest": "Lance Armstrong"
},
{
"date": "2007-02-15",
"videos": [
"http://thecolbertreport.cc.com/videos/bemh6r/intro---2-15-07",
"http://thecolbertreport.cc.com/videos/5h0hc1/the-365-most-influential-cultural-figures-of-2007---j-j--abrams",
"http://thecolbertreport.cc.com/videos/dv94hn/helen-thomas-s-chair",
"http://thecolbertreport.cc.com/videos/xsukru/the-365-most-influential-cultural-figures-of-2007---candice-bergen",
"http://thecolbertreport.cc.com/videos/gxjtk4/better-know-a-district---arkansas--2nd---vic-snyder",
"http://thecolbertreport.cc.com/videos/htsqly/shashi-tharoor"
],
"guest": "Shashi Tharoor"
},
{
"date": "2007-02-26",
"videos": [
"http://thecolbertreport.cc.com/videos/7kzllg/intro---2-26-07",
"http://thecolbertreport.cc.com/videos/6q3fey/the-word---success",
"http://thecolbertreport.cc.com/videos/liy97p/stephen-s-sound-advice---avoiding-humiliation-on-the-campaign-trail",
"http://thecolbertreport.cc.com/videos/rj64v2/zev-chafets",
"http://thecolbertreport.cc.com/videos/lto66u/sign-off---the-stupidest-person-in-the-world"
],
"guest": "Zev Chafets"
},
{
"date": "2007-02-27",
"videos": [
"http://thecolbertreport.cc.com/videos/m6llmb/intro---2-27-07",
"http://thecolbertreport.cc.com/videos/4q8yqr/gore-s-garbage",
"http://thecolbertreport.cc.com/videos/08vl33/the-word---recoil",
"http://thecolbertreport.cc.com/videos/kyuvud/dead-to-me---raptors",
"http://thecolbertreport.cc.com/videos/a5eovz/tip-wag---bilk",
"http://thecolbertreport.cc.com/videos/xtu2o9/craig-venter"
],
"guest": "Dr. Craig Venter"
},
{
"date": "2007-02-28",
"videos": [
"http://thecolbertreport.cc.com/videos/k64d0x/intro---2-28-07",
"http://thecolbertreport.cc.com/videos/94efgl/david-geffen-the-intern-",
"http://thecolbertreport.cc.com/videos/ax1yhn/obama-vs--colbert",
"http://thecolbertreport.cc.com/videos/2j1fug/profiles-in-quitters---tom-vilsack",
"http://thecolbertreport.cc.com/videos/2w1ttr/problems-without-solutions--stay-at-home-dads",
"http://thecolbertreport.cc.com/videos/rjcwpq/nina-jablonski"
],
"guest": "Nina Jablonski"
},
{
"date": "2007-03-01",
"videos": [
"http://thecolbertreport.cc.com/videos/uvhlbh/intro---3-1-07",
"http://thecolbertreport.cc.com/videos/dnoicn/jesus--1-",
"http://thecolbertreport.cc.com/videos/09pfnw/the-word---bury-the-lead",
"http://thecolbertreport.cc.com/videos/xp8ghf/better-know-a-district---tennessee-s-9th---steve-cohen",
"http://thecolbertreport.cc.com/videos/hdb72u/larry-king",
"http://thecolbertreport.cc.com/videos/din9ey/sign-off---all-the-time"
],
"guest": "Larry King"
},
{
"date": "2007-03-05",
"videos": [
"http://thecolbertreport.cc.com/videos/s5zpws/intro---3-5-07",
"http://thecolbertreport.cc.com/videos/f0veng/stop-the-war-in-congress",
"http://thecolbertreport.cc.com/videos/9rmkm6/ben-and-jerry---introducing-americone-dream",
"http://thecolbertreport.cc.com/videos/erco0p/bears---balls---bees",
"http://thecolbertreport.cc.com/videos/w9i285/mara-vanderslice",
"http://thecolbertreport.cc.com/videos/u5x46t/sign-off---you-get-a-pint-"
],
"guest": "Mara Vanderslice, Ben and Jerry"
},
{
"date": "2007-03-06",
"videos": [
"http://thecolbertreport.cc.com/videos/jokvk3/intro---3-6-07",
"http://thecolbertreport.cc.com/videos/987dug/stephen-wins-the-lottery",
"http://thecolbertreport.cc.com/videos/5xpqn0/libby-verdict",
"http://thecolbertreport.cc.com/videos/yjwisn/the-word---wwjd",
"http://thecolbertreport.cc.com/videos/ryt5zt/threatdown---cheney-s-clot",
"http://thecolbertreport.cc.com/videos/d9k0w9/mark-frauenfelder"
],
"guest": "Mark Frauenfelder"
},
{
"date": "2007-03-07",
"videos": [
"http://thecolbertreport.cc.com/videos/t3l2qk/intro---3-7-07",
"http://thecolbertreport.cc.com/videos/o5rj01/mega-millions",
"http://thecolbertreport.cc.com/videos/f4wilr/the-word---don-t",
"http://thecolbertreport.cc.com/videos/mw47n3/easter-under-attack---bunny",
"http://thecolbertreport.cc.com/videos/k8n6ln/michael-spector",
"http://thecolbertreport.cc.com/videos/eu60l7/sign-off---colbert-savings-time"
],
"guest": "Michael Specter"
},
{
"date": "2007-03-08",
"videos": [
"http://thecolbertreport.cc.com/videos/hdanpb/exclusive---better-know-a-district---kentucky-s-3rd---john-yarmuth-pt--1",
"http://thecolbertreport.cc.com/videos/1fsr4r/exclusive---better-know-a-district---kentucky-s-3rd---john-yarmuth-pt--2",
"http://thecolbertreport.cc.com/videos/v9pxbp/intro---3-8-07",
"http://thecolbertreport.cc.com/videos/fkezkh/jesus-libby",
"http://thecolbertreport.cc.com/videos/kf01z4/the-word---comic-justice",
"http://thecolbertreport.cc.com/videos/gfi7dr/better-know-a-district---kentucky-s-3rd---john-yarmuth",
"http://thecolbertreport.cc.com/videos/na2cwe/ted-koppel"
],
"guest": "Ted Koppel"
},
{
"date": "2007-03-12",
"videos": [
"http://thecolbertreport.cc.com/videos/eoubiy/intro---3-12-07",
"http://thecolbertreport.cc.com/videos/cxle7m/newt-gingrich-s-extramarital-affair",
"http://thecolbertreport.cc.com/videos/qs3d07/the-word---home-field-advantage",
"http://thecolbertreport.cc.com/videos/rp8fy7/tip-wag---u-s--mint",
"http://thecolbertreport.cc.com/videos/0z68wk/nicholas-kristof",
"http://thecolbertreport.cc.com/videos/paedah/sign-off---captain-america-shield"
],
"guest": "Nicholas D. Kristof"
},
{
"date": "2007-03-13",
"videos": [
"http://thecolbertreport.cc.com/videos/3gv9du/intro---3-13-07",
"http://thecolbertreport.cc.com/videos/n1695w/time-travel",
"http://thecolbertreport.cc.com/videos/o93g04/willie-nelson-s-cobbler",
"http://thecolbertreport.cc.com/videos/aln9gt/donald-shields",
"http://thecolbertreport.cc.com/videos/nebseq/four-horsemen-of-the-a-pop-calypse---300",
"http://thecolbertreport.cc.com/videos/pajwaw/michael-eric-dyson",
"http://thecolbertreport.cc.com/videos/goeagu/the-word---goodnight"
],
"guest": "Michael Eric Dyson"
},
{
"date": "2007-03-14",
"videos": [
"http://thecolbertreport.cc.com/videos/gjg322/intro---3-14-07",
"http://thecolbertreport.cc.com/videos/mi3odp/when-ancestors-attack---barack-obama",
"http://thecolbertreport.cc.com/videos/jdieqt/the-word---high-fidelity",
"http://thecolbertreport.cc.com/videos/6t5ydk/rocky-mountain-high",
"http://thecolbertreport.cc.com/videos/xy5mon/sport-report---ncaa",
"http://thecolbertreport.cc.com/videos/3w6h8k/ed-viesturs",
"http://thecolbertreport.cc.com/videos/x40idi/sign-off---united-we-lick"
],
"guest": "Ed Viesturs"
},
{
"date": "2007-03-15",
"videos": [
"http://thecolbertreport.cc.com/videos/3yjwcu/exclusive---better-know-a-district---illinois--17th---phil-hare-pt--1",
"http://thecolbertreport.cc.com/videos/l2j89r/exclusive---better-know-a-district---illinois--17th---phil-hare-pt--2",
"http://thecolbertreport.cc.com/videos/gjg322/intro---3-14-07",
"http://thecolbertreport.cc.com/videos/mi3odp/when-ancestors-attack---barack-obama",
"http://thecolbertreport.cc.com/videos/jdieqt/the-word---high-fidelity",
"http://thecolbertreport.cc.com/videos/6t5ydk/rocky-mountain-high",
"http://thecolbertreport.cc.com/videos/xy5mon/sport-report---ncaa",
"http://thecolbertreport.cc.com/videos/3w6h8k/ed-viesturs",
"http://thecolbertreport.cc.com/videos/x40idi/sign-off---united-we-lick"
],
"guest": "Ayaan Hirsi Ali"
},
{
"date": "2007-03-15",
"videos": [
"http://thecolbertreport.cc.com/videos/in8gsh/intro---3-15-07",
"http://thecolbertreport.cc.com/videos/ojcmho/st--patrick-s-day",
"http://thecolbertreport.cc.com/videos/9wsh6f/better-know-a-district---illinois--17th---phil-hare",
"http://thecolbertreport.cc.com/videos/pvxlng/ayaan-hirsi-ali",
"http://thecolbertreport.cc.com/videos/nfjx5l/sign-off---candy"
],
"guest": "Ayaan Hirsi Ali"
},
{
"date": "2007-03-19",
"videos": [
"http://thecolbertreport.cc.com/videos/akdm39/intro---3-19-07",
"http://thecolbertreport.cc.com/videos/zfhuml/emanuel-attacks-stephen",
"http://thecolbertreport.cc.com/videos/ichd6m/the-word---pound-of-flesh",
"http://thecolbertreport.cc.com/videos/ovsoy3/willie-nelson-tomorrow",
"http://thecolbertreport.cc.com/videos/i34oa7/threatdown---seniors",
"http://thecolbertreport.cc.com/videos/nby1fe/jerome-groopman",
"http://thecolbertreport.cc.com/videos/woj3kf/alpha-dog-of-the-week---pennies"
],
"guest": "Jerome Groopman"
},
{
"date": "2007-03-20",
"videos": [
"http://thecolbertreport.cc.com/videos/nepea4/intro---3-20-07",
"http://thecolbertreport.cc.com/videos/p3nkju/willie-recall",
"http://thecolbertreport.cc.com/videos/8w2rhi/the-word---supernatural",
"http://thecolbertreport.cc.com/videos/4fyygp/threatdown---polar-bear-cub",
"http://thecolbertreport.cc.com/videos/rn79kl/stephen-colbert-day---honor",
"http://thecolbertreport.cc.com/videos/fxdmt0/willie-nelson"
],
"guest": "Willie Nelson"
},
{
"date": "2007-03-21",
"videos": [
"http://thecolbertreport.cc.com/videos/b4r6li/intro---3-21-07",
"http://thecolbertreport.cc.com/videos/r7dj9j/stephen-s-stoned-friend",
"http://thecolbertreport.cc.com/videos/wyig4v/impeach-bush",
"http://thecolbertreport.cc.com/videos/js464k/the-word---sex",
"http://thecolbertreport.cc.com/videos/6b13mn/better-know-a-district---new-york-s-22nd---maurice-hinchey",
"http://thecolbertreport.cc.com/videos/4jygnv/benjamin-barber",
"http://thecolbertreport.cc.com/videos/psro3f/sign-off---goodnights"
],
"guest": "Benjamin Barber"
},
{
"date": "2007-03-22",
"videos": [
"http://thecolbertreport.cc.com/videos/rf90w7/intro---3-22-07",
"http://thecolbertreport.cc.com/videos/yic3o0/infomosexual-graphics",
"http://thecolbertreport.cc.com/videos/ez9npn/eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/xgjo8q/face-reading-expert",
"http://thecolbertreport.cc.com/videos/pd3hdf/sport-report---ncaa-final-four",
"http://thecolbertreport.cc.com/videos/i2wwym/katie-couric",
"http://thecolbertreport.cc.com/videos/k6m8na/sign-off---future"
],
"guest": "Katie Couric"
},
{
"date": "2007-03-26",
"videos": [
"http://thecolbertreport.cc.com/videos/k1iiew/intro---3-26-07",
"http://thecolbertreport.cc.com/videos/t9n8i2/mummy",
"http://thecolbertreport.cc.com/videos/t7x0xg/torture-gonzales",
"http://thecolbertreport.cc.com/videos/hc58hq/for-your-editing-pleasure",
"http://thecolbertreport.cc.com/videos/r6ez6r/stephen-colbert-day",
"http://thecolbertreport.cc.com/videos/a19udk/john-perry-barlow",
"http://thecolbertreport.cc.com/videos/dc5qfy/sign-off---photo-op"
],
"guest": "John Perry Barlow"
},
{
"date": "2007-03-27",
"videos": [
"http://thecolbertreport.cc.com/videos/9hzwxa/intro---3-2707",
"http://thecolbertreport.cc.com/videos/ct77qc/sean-penn-unleashes-on-president-bush",
"http://thecolbertreport.cc.com/videos/y05sqg/madeleine-albright",
"http://thecolbertreport.cc.com/videos/ac6sto/tip-wag---drug-dealers",
"http://thecolbertreport.cc.com/videos/z3a4ow/james-fallows"
],
"guest": "Madeleine Albright, James Fallows"
},
{
"date": "2007-03-28",
"videos": [
"http://thecolbertreport.cc.com/videos/c3lbed/intro---3-28-07",
"http://thecolbertreport.cc.com/videos/8b58j1/dancing-with-the-stars",
"http://thecolbertreport.cc.com/videos/eoe8d4/claim-to-the-arctic",
"http://thecolbertreport.cc.com/videos/e6rbbg/the-word---monkey-business",
"http://thecolbertreport.cc.com/videos/7t7l7y/the-axis-of-evil-of-the-week",
"http://thecolbertreport.cc.com/videos/oval1w/jabari-asim",
"http://thecolbertreport.cc.com/videos/tffkup/sign-off---going-to-bed-angry"
],
"guest": "Jabari Asim"
},
{
"date": "2007-03-29",
"videos": [
"http://thecolbertreport.cc.com/videos/82ki4g/intro---3-29-07",
"http://thecolbertreport.cc.com/videos/yp03mv/equal-rights",
"http://thecolbertreport.cc.com/videos/bwtu8b/strolling-in-baghdad",
"http://thecolbertreport.cc.com/videos/m1iokb/the-word---lemon-raid",
"http://thecolbertreport.cc.com/videos/rmylpg/alpha-dog-of-the-week---toby",
"http://thecolbertreport.cc.com/videos/dune0v/nightgown-novel-model",
"http://thecolbertreport.cc.com/videos/gp6vcm/clive-james",
"http://thecolbertreport.cc.com/videos/cnmwu7/sign-off---it-s-been-real"
],
"guest": "Clive James"
},
{
"date": "2007-04-09",
"videos": [
"http://thecolbertreport.cc.com/videos/2secqi/intro---4-9-07",
"http://thecolbertreport.cc.com/videos/c2ss4c/end-of-lent",
"http://thecolbertreport.cc.com/videos/jdh0qr/colin-beavan",
"http://thecolbertreport.cc.com/videos/p1vkhv/ethnic-slurs",
"http://thecolbertreport.cc.com/videos/uyodpo/formula-401k",
"http://thecolbertreport.cc.com/videos/d7vjve/katrina-vanden-heuvel",
"http://thecolbertreport.cc.com/videos/vx3kr4/sign-off---goodnight--ladies"
],
"guest": "Colin Beavan, Katrina vanden Heuvel"
},
{
"date": "2007-04-10",
"videos": [
"http://thecolbertreport.cc.com/videos/gqey9e/intro---4-10-07",
"http://thecolbertreport.cc.com/videos/t52s2y/stiff-upper-lip",
"http://thecolbertreport.cc.com/videos/7xhdfc/the-word---hip-replacement",
"http://thecolbertreport.cc.com/videos/a6j19l/stephen-s-racial-slurs",
"http://thecolbertreport.cc.com/videos/mmtey6/bears---balls---home",
"http://thecolbertreport.cc.com/videos/niryzs/jeannette-walls",
"http://thecolbertreport.cc.com/videos/tjfkfk/the-apology"
],
"guest": "Jeannette Walls"
},
{
"date": "2007-04-11",
"videos": [
"http://thecolbertreport.cc.com/videos/ikived/intro---4-11-07",
"http://thecolbertreport.cc.com/videos/rndpay/the-great-turtle-race",
"http://thecolbertreport.cc.com/videos/o57n2d/the-word---season-pass",
"http://thecolbertreport.cc.com/videos/y3z7pz/anna-nicole-s-baby-daddy",
"http://thecolbertreport.cc.com/videos/qk7xuu/sport-report---spirit-loses",
"http://thecolbertreport.cc.com/videos/6ombuy/vali-nasr",
"http://thecolbertreport.cc.com/videos/py0zro/sign-off---not-literally"
],
"guest": "Vali Nasr"
},
{
"date": "2007-04-12",
"videos": [
"http://thecolbertreport.cc.com/videos/tvo9j1/intro---4-12-07",
"http://thecolbertreport.cc.com/videos/44wpo2/the-pope-and-iraq",
"http://thecolbertreport.cc.com/videos/i2w6da/the-word---body-armor",
"http://thecolbertreport.cc.com/videos/rp5qr3/a-girl-for-stephen-jr-",
"http://thecolbertreport.cc.com/videos/szc2kp/dr--richard-land",
"http://thecolbertreport.cc.com/videos/z4a9cf/sign-off---french-canadian-viewers"
],
"guest": "Dr. Richard Land"
},
{
"date": "2007-04-16",
"videos": [
"http://thecolbertreport.cc.com/videos/opgo7c/intro---4-16-07",
"http://thecolbertreport.cc.com/videos/ow68vg/mope-retraction",
"http://thecolbertreport.cc.com/videos/ndyxmi/the-metaphor-off-is-on",
"http://thecolbertreport.cc.com/videos/fiwckw/the-word---clean-slate",
"http://thecolbertreport.cc.com/videos/vsf7vy/paulina-likes-stephen",
"http://thecolbertreport.cc.com/videos/le9tdo/alpha-dog-of-the-week---paul-wolfowitz",
"http://thecolbertreport.cc.com/videos/yq2yld/sign-off---fondest-memories",
"http://thecolbertreport.cc.com/videos/1dnqiw/john-kerry"
],
"guest": "Sen. John Kerry"
},
{
"date": "2007-04-17",
"videos": [
"http://thecolbertreport.cc.com/videos/35u6vo/metaphor-off-training",
"http://thecolbertreport.cc.com/videos/ctnp41/turtle-race-update",
"http://thecolbertreport.cc.com/videos/k0gjix/the-word---plan-b",
"http://thecolbertreport.cc.com/videos/1ca1nf/tip-wag---fake-sperm",
"http://thecolbertreport.cc.com/videos/ofyxod/elaine-pagels",
"http://thecolbertreport.cc.com/videos/ka39h6/sign-off---stephen-s-taxes",
"http://thecolbertreport.cc.com/videos/28ne1f/intro---4-17-07"
],
"guest": "Elaine Pagels"
},
{
"date": "2007-04-18",
"videos": [
"http://thecolbertreport.cc.com/videos/xjlfa3/intro---4-18-07",
"http://thecolbertreport.cc.com/videos/z7yfgh/who-s-not-honoring-me-now----pulitzer",
"http://thecolbertreport.cc.com/videos/y8uyv4/the-word---branding",
"http://thecolbertreport.cc.com/videos/d5i37n/national-library-week---frank-mccourt",
"http://thecolbertreport.cc.com/videos/hr8hfi/milk---hormones",
"http://thecolbertreport.cc.com/videos/edyu8c/national-library-week---sebastian-junger",
"http://thecolbertreport.cc.com/videos/ebje1q/national-library-week---david-remnick",
"http://thecolbertreport.cc.com/videos/33tv9j/paulina-porizkova",
"http://thecolbertreport.cc.com/videos/tn0cbn/sign-off---upcoming-metaphor-off"
],
"guest": "William Cohen"
},
{
"date": "2007-04-19",
"videos": [
"http://thecolbertreport.cc.com/videos/wh0xf2/intro---4-19-07",
"http://thecolbertreport.cc.com/videos/luoh3l/god-s-pet-chimp",
"http://thecolbertreport.cc.com/videos/goj3np/the-word----400-haircut",
"http://thecolbertreport.cc.com/videos/tv447i/sean-penn",
"http://thecolbertreport.cc.com/videos/iowvf0/meta-free-phor-all--shall-i-nail-thee-to-a-summer-s-day-",
"http://thecolbertreport.cc.com/videos/nzuytf/hyperbole-off"
],
"guest": "Gov. Mike Huckabee"
},
{
"date": "2007-04-23",
"videos": [
"http://thecolbertreport.cc.com/videos/e9s3wp/intro---4-23-07",
"http://thecolbertreport.cc.com/videos/tuitvp/gonzales-forgot",
"http://thecolbertreport.cc.com/videos/xgp7gj/stephanie-s-winning-",
"http://thecolbertreport.cc.com/videos/bsgdkg/mike-huckabee---running-mate-bid",
"http://thecolbertreport.cc.com/videos/mksggb/threatdown---myspace",
"http://thecolbertreport.cc.com/videos/25567u/russell-simmons",
"http://thecolbertreport.cc.com/videos/75z88c/colbert-nation-online-discussion-group"
],
"guest": "Russell Simmons"
},
{
"date": "2007-04-24",
"videos": [
"http://thecolbertreport.cc.com/videos/6edbk9/intro---4-24-07",
"http://thecolbertreport.cc.com/videos/9lfdmb/bye-bye-to-boris",
"http://thecolbertreport.cc.com/videos/zf1m9m/d-c--voting-rights---eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/zebgor/the-word---act-globally",
"http://thecolbertreport.cc.com/videos/o4vs3o/60--good-news",
"http://thecolbertreport.cc.com/videos/63paz7/alpha-dog-of-the-week---uncle-ben",
"http://thecolbertreport.cc.com/videos/i6gv9q/dr--andrew-weil",
"http://thecolbertreport.cc.com/videos/858p8x/sign-off---captain-lead"
],
"guest": "Dr. Andrew Weil"
},
{
"date": "2007-04-25",
"videos": [
"http://thecolbertreport.cc.com/videos/939oo7/intro---4-25-07",
"http://thecolbertreport.cc.com/videos/9cksb2/dead-to-me---long-war",
"http://thecolbertreport.cc.com/videos/uixydp/the-word---sacrifice",
"http://thecolbertreport.cc.com/videos/xlgsnw/new-issue-of-gq",
"http://thecolbertreport.cc.com/videos/vsu32z/four-horsemen-of-the-a-pop-calypse---prayer",
"http://thecolbertreport.cc.com/videos/877wu4/david-walker",
"http://thecolbertreport.cc.com/videos/dqbrsh/sign-off---promises"
],
"guest": "David Walker"
},
{
"date": "2007-04-26",
"videos": [
"http://thecolbertreport.cc.com/videos/uxgeoh/exclusive---better-know-a-protectorate---guam---madeleine-bordallo-pt--1",
"http://thecolbertreport.cc.com/videos/nfu1lw/exclusive---better-know-a-protectorate---guam---madeleine-bordallo-pt--2",
"http://thecolbertreport.cc.com/videos/tioqro/intro---4-26-07",
"http://thecolbertreport.cc.com/videos/ph7bwx/stephanie-lost",
"http://thecolbertreport.cc.com/videos/nn2tor/the-word---mending-wall",
"http://thecolbertreport.cc.com/videos/7ibt5q/better-know-a-protectorate---guam---madeleine-bordallo",
"http://thecolbertreport.cc.com/videos/wax9na/tom-wolfe",
"http://thecolbertreport.cc.com/videos/4y1aqm/sign-off---yuri-kuklachev"
],
"guest": "Tom Wolfe"
},
{
"date": "2007-04-30",
"videos": [
"http://thecolbertreport.cc.com/videos/qiwo3g/intro---4-30-07",
"http://thecolbertreport.cc.com/videos/hpmi3p/first-democratic-debate-for--08",
"http://thecolbertreport.cc.com/videos/lv3s81/neil-degrasse-tyson",
"http://thecolbertreport.cc.com/videos/o5hsha/tip-wag---shrek",
"http://thecolbertreport.cc.com/videos/iwnuxq/bill-bradley"
],
"guest": "Bill Bradley"
},
{
"date": "2007-05-01",
"videos": [
"http://thecolbertreport.cc.com/videos/qd26kv/intro---5-1-07",
"http://thecolbertreport.cc.com/videos/scarky/mitt-s-favorite-book",
"http://thecolbertreport.cc.com/videos/oh320q/npr-correction",
"http://thecolbertreport.cc.com/videos/q45jin/the-word---who-cares-",
"http://thecolbertreport.cc.com/videos/cgfptc/stephen-s-horse",
"http://thecolbertreport.cc.com/videos/m9pls7/malcolm-gladwell",
"http://thecolbertreport.cc.com/videos/zj4aga/sign-off---lutefisk"
],
"guest": "Malcolm Gladwell"
},
{
"date": "2007-05-02",
"videos": [
"http://thecolbertreport.cc.com/videos/zxhw8e/intro---5-2-07",
"http://thecolbertreport.cc.com/videos/vvfvju/hr-1591",
"http://thecolbertreport.cc.com/videos/a3d8vy/the-word---better-safe-than-sorry",
"http://thecolbertreport.cc.com/videos/oo27ij/mike-gravel",
"http://thecolbertreport.cc.com/videos/u82od0/gina-kolata"
],
"guest": "Gina Kolata"
},
{
"date": "2007-05-03",
"videos": [
"http://thecolbertreport.cc.com/videos/33wl1k/exclusive---better-know-a-district---virginia-s-11th---tom-davis",
"http://thecolbertreport.cc.com/videos/42iy2c/intro---5-3-07",
"http://thecolbertreport.cc.com/videos/wsiuq8/battle-of-the-surfaces",
"http://thecolbertreport.cc.com/videos/0wtt0d/the-word---the-unquisition",
"http://thecolbertreport.cc.com/videos/2iymfl/better-know-a-district---virginia-s-11th---tom-davis",
"http://thecolbertreport.cc.com/videos/6azbk5/conn-iggulden",
"http://thecolbertreport.cc.com/videos/dblp9v/sign-off---impatiens"
],
"guest": "Conn Iggulden"
},
{
"date": "2007-05-07",
"videos": [
"http://thecolbertreport.cc.com/videos/re08sm/intro---5-7-07",
"http://thecolbertreport.cc.com/videos/5ra6xp/bonjour--mon-frere",
"http://thecolbertreport.cc.com/videos/o0gs8q/republican-debate---diversity",
"http://thecolbertreport.cc.com/videos/ojz8he/the-word---the-intolerant",
"http://thecolbertreport.cc.com/videos/x5zaaj/cheating-death---vaxadrin",
"http://thecolbertreport.cc.com/videos/1i1xa2/richard-preston"
],
"guest": "Richard Preston"
},
{
"date": "2007-05-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ah3swk/intro---5-8-07",
"http://thecolbertreport.cc.com/videos/4vb9ha/shout-out----uss-rhode-island",
"http://thecolbertreport.cc.com/videos/v2jrqr/the-word---rendered-moot",
"http://thecolbertreport.cc.com/videos/bkd3bl/threatdown---oprah",
"http://thecolbertreport.cc.com/videos/296em4/nassim-nicholas-taleb"
],
"guest": "Nassim Nicholas Taleb"
},
{
"date": "2007-05-09",
"videos": [
"http://thecolbertreport.cc.com/videos/bbia54/intro---5-9-07",
"http://thecolbertreport.cc.com/videos/hs4hrn/mother-s-day",
"http://thecolbertreport.cc.com/videos/01nwrp/formal-request",
"http://thecolbertreport.cc.com/videos/ijt89t/salman-rushdie",
"http://thecolbertreport.cc.com/videos/y81ejs/kiss-the-host",
"http://thecolbertreport.cc.com/videos/4mwns0/thompson-fuss",
"http://thecolbertreport.cc.com/videos/8ixf7m/jane-fonda",
"http://thecolbertreport.cc.com/videos/bhwtjj/sign-off---bedtime-recipe"
],
"guest": "Salman Rushdie, Jane Fonda"
},
{
"date": "2007-05-10",
"videos": [
"http://thecolbertreport.cc.com/videos/h5fw40/intro---5-10-07",
"http://thecolbertreport.cc.com/videos/5mohm3/the-word---illusion",
"http://thecolbertreport.cc.com/videos/6mm58j/hometown-hero-town---naperville--il",
"http://thecolbertreport.cc.com/videos/1yenb5/the-in-box---doctor-colbert",
"http://thecolbertreport.cc.com/videos/ya8jd7/jann-wenner",
"http://thecolbertreport.cc.com/videos/tbehsa/sign-off---time-capsule",
"http://thecolbertreport.cc.com/videos/59lqle/he-s-singing-in-korean"
],
"guest": "Jann Wenner"
},
{
"date": "2007-05-14",
"videos": [
"http://thecolbertreport.cc.com/videos/q3z8ca/intro---5-14-07",
"http://thecolbertreport.cc.com/videos/2wmvq0/ferrari-list",
"http://thecolbertreport.cc.com/videos/ji8vnp/the-word---supporting-role",
"http://thecolbertreport.cc.com/videos/62strl/tip-wag---mitt-romney",
"http://thecolbertreport.cc.com/videos/324045/william-langewiesche",
"http://thecolbertreport.cc.com/videos/70la8y/stealing-lincoln-s-body"
],
"guest": "William Langewiesche"
},
{
"date": "2007-05-15",
"videos": [
"http://thecolbertreport.cc.com/videos/458uob/intro---5-15-07",
"http://thecolbertreport.cc.com/videos/0oyxpf/mcnulty-guilty",
"http://thecolbertreport.cc.com/videos/c0yfoq/pasadena--india",
"http://thecolbertreport.cc.com/videos/lda912/the-word---heated-debate",
"http://thecolbertreport.cc.com/videos/7heoq8/bonus-wag---bush-graphic",
"http://thecolbertreport.cc.com/videos/yqaslk/alpha-dog-of-the-week---michael-wiley",
"http://thecolbertreport.cc.com/videos/q5o3oe/walter-isaacson",
"http://thecolbertreport.cc.com/videos/3mglju/r-i-p--ted-maiman"
],
"guest": "Walter Isaacson"
},
{
"date": "2007-05-16",
"videos": [
"http://thecolbertreport.cc.com/videos/l9r090/intro---5-16-07",
"http://thecolbertreport.cc.com/videos/9nd4g1/second-republican-debate",
"http://thecolbertreport.cc.com/videos/lqz6xp/the-word---level-playing-field",
"http://thecolbertreport.cc.com/videos/vb25tk/formidable-opponent---peanuts",
"http://thecolbertreport.cc.com/videos/vd7dcd/howard-dean",
"http://thecolbertreport.cc.com/videos/west8f/sign-off---name-of-city-here"
],
"guest": "Howard Dean"
},
{
"date": "2007-05-17",
"videos": [
"http://thecolbertreport.cc.com/videos/j0njxq/intro---5-17-07",
"http://thecolbertreport.cc.com/videos/xbgufk/the-hammer-is-here-",
"http://thecolbertreport.cc.com/videos/g57yti/baby-gun-permit",
"http://thecolbertreport.cc.com/videos/wqfqxb/tom-delay",
"http://thecolbertreport.cc.com/videos/nfhqh3/randy-kearse",
"http://thecolbertreport.cc.com/videos/vz0202/sign-off---rafters"
],
"guest": "Randy Kearse, Rep. Tom DeLay"
},
{
"date": "2007-05-21",
"videos": [
"http://thecolbertreport.cc.com/videos/43r84a/intro---5-21-07",
"http://thecolbertreport.cc.com/videos/j7bshe/god-loves-a-big-screen-tv",
"http://thecolbertreport.cc.com/videos/s5odvt/presidential-fraternity",
"http://thecolbertreport.cc.com/videos/w89fii/the-word---his-way",
"http://thecolbertreport.cc.com/videos/zg6n7b/cheating-death---internal-decapitation",
"http://thecolbertreport.cc.com/videos/zhetqf/jared-diamond"
],
"guest": "Jared Diamond"
},
{
"date": "2007-05-22",
"videos": [
"http://thecolbertreport.cc.com/videos/vn2u9p/intro---5-22-07",
"http://thecolbertreport.cc.com/videos/pp3dmv/popularity-contest",
"http://thecolbertreport.cc.com/videos/szr9pb/barack-s-a-liar",
"http://thecolbertreport.cc.com/videos/4wuift/the-word---party-of-change",
"http://thecolbertreport.cc.com/videos/7bglee/threatdown---environmentalists",
"http://thecolbertreport.cc.com/videos/661huh/john-amaechi",
"http://thecolbertreport.cc.com/videos/ivskf6/sign-off---lesson-forgotten"
],
"guest": "John Amaechi"
},
{
"date": "2007-05-23",
"videos": [
"http://thecolbertreport.cc.com/videos/pwwndq/intro---5-23-07",
"http://thecolbertreport.cc.com/videos/ac7obb/bush-is-back-",
"http://thecolbertreport.cc.com/videos/2t0qn4/illegal-immigration---bay-buchanan",
"http://thecolbertreport.cc.com/videos/m6d100/threatdown---pellicano-",
"http://thecolbertreport.cc.com/videos/0v2e97/bob-deans",
"http://thecolbertreport.cc.com/videos/1kaqcp/sign-off---hi-def"
],
"guest": "Bay Buchanan, Bob Deans"
},
{
"date": "2007-05-24",
"videos": [
"http://thecolbertreport.cc.com/videos/fc4ao7/intro---5-24-07",
"http://thecolbertreport.cc.com/videos/ihom0u/fleet-week",
"http://thecolbertreport.cc.com/videos/5d38de/big-loud-flag",
"http://thecolbertreport.cc.com/videos/oxz2g4/up-in-smoke",
"http://thecolbertreport.cc.com/videos/brpu8j/better-know-a-district---arizona-s-7th---raul-grijalva",
"http://thecolbertreport.cc.com/videos/vylxk3/jimmy-wales",
"http://thecolbertreport.cc.com/videos/xj2s00/speaking-fee"
],
"guest": "Jimmy Wales"
},
{
"date": "2007-06-04",
"videos": [
"http://thecolbertreport.cc.com/videos/38wiug/intro---6-4-07",
"http://thecolbertreport.cc.com/videos/oujnzk/uneventful-vacation",
"http://thecolbertreport.cc.com/videos/5475j4/democratic-presidential-debate---venue",
"http://thecolbertreport.cc.com/videos/3bhuju/jan-schakowsky",
"http://thecolbertreport.cc.com/videos/svome1/better-know-a-district---illinois--9th---jan-schakowsky",
"http://thecolbertreport.cc.com/videos/o9kyh0/leon-botstein",
"http://thecolbertreport.cc.com/videos/kaun5v/sign-off---mardi-gras-mask"
],
"guest": "Rep. Jan Schakowsky, Leon Botstein"
},
{
"date": "2007-06-05",
"videos": [
"http://thecolbertreport.cc.com/videos/7sdcg5/intro---6-5-07",
"http://thecolbertreport.cc.com/videos/cvm31h/you-ve-been-scootered-",
"http://thecolbertreport.cc.com/videos/j3ieeu/yahoo-korea---rain",
"http://thecolbertreport.cc.com/videos/8226p8/the-word---mission-control",
"http://thecolbertreport.cc.com/videos/n0lk8c/the-god-machine-",
"http://thecolbertreport.cc.com/videos/l7y8g1/when-animals-attack-our-morals---flamingos",
"http://thecolbertreport.cc.com/videos/rsex2i/jessica-valenti"
],
"guest": "Jessica Valenti"
},
{
"date": "2007-06-06",
"videos": [
"http://thecolbertreport.cc.com/videos/jorp7o/intro---6-6-07",
"http://thecolbertreport.cc.com/videos/h69756/sinner-edwards",
"http://thecolbertreport.cc.com/videos/5mthf9/the-word---airogance",
"http://thecolbertreport.cc.com/videos/cujedg/tip-wag---deep-purple",
"http://thecolbertreport.cc.com/videos/ngt9bf/carl-bernstein",
"http://thecolbertreport.cc.com/videos/xd82es/craziest-f--king-thing-i-ve-ever-heard---octopi"
],
"guest": "Carl Bernstein"
},
{
"date": "2007-06-07",
"videos": [
"http://thecolbertreport.cc.com/videos/b0xqmj/intro---6-7-07",
"http://thecolbertreport.cc.com/videos/w1jmjp/pope-jump",
"http://thecolbertreport.cc.com/videos/ovs97y/the-word---rodham",
"http://thecolbertreport.cc.com/videos/tl388o/better-know-a-district---washington-s-9th---adam-smith",
"http://thecolbertreport.cc.com/videos/ty2mfm/cullen-murphy",
"http://thecolbertreport.cc.com/videos/sitbn5/sign-off---vomitorium"
],
"guest": "Cullen Murphy"
},
{
"date": "2007-06-11",
"videos": [
"http://thecolbertreport.cc.com/videos/1yiwr5/intro---6-11-07",
"http://thecolbertreport.cc.com/videos/dufa3e/commencement-speeches",
"http://thecolbertreport.cc.com/videos/2k0q1b/the-word---easy-a",
"http://thecolbertreport.cc.com/videos/kd0cks/revenge-on-knox-college",
"http://thecolbertreport.cc.com/videos/qrkfud/albania-greets-president-bush",
"http://thecolbertreport.cc.com/videos/zpjdcg/michael-gershon"
],
"guest": "Dr. Michael D. Gershon"
},
{
"date": "2007-06-12",
"videos": [
"http://thecolbertreport.cc.com/videos/b08r7k/intro---6-12-07",
"http://thecolbertreport.cc.com/videos/8dqxf0/bush-s-missing-watch",
"http://thecolbertreport.cc.com/videos/sse01t/mr--dyachenko--tear-down-this-wall",
"http://thecolbertreport.cc.com/videos/lhl8km/tommy-chong--commentator",
"http://thecolbertreport.cc.com/videos/ey1hjm/mr--dyachenko--tear-down-this-watermelon",
"http://thecolbertreport.cc.com/videos/2krcmy/colbert-platinum---butler-shortage",
"http://thecolbertreport.cc.com/videos/gdyajn/josh-wolf",
"http://thecolbertreport.cc.com/videos/r2b64h/mr--dyachenko--tear-me-off-a-piece-of-this-cake"
],
"guest": "Josh Wolf"
},
{
"date": "2007-06-13",
"videos": [
"http://thecolbertreport.cc.com/videos/onm1u4/intro---6-13-07",
"http://thecolbertreport.cc.com/videos/fytk75/ruined-anniversary",
"http://thecolbertreport.cc.com/videos/6nklj9/freezing-cold-case-files--otzi",
"http://thecolbertreport.cc.com/videos/tnydpx/the-word---pathophysiology",
"http://thecolbertreport.cc.com/videos/2bu2sn/threatdown---robots",
"http://thecolbertreport.cc.com/videos/o2ywub/ron-paul",
"http://thecolbertreport.cc.com/videos/cakp5s/sign-off---crispy-deliciousness"
],
"guest": "Rep. Ron Paul"
},
{
"date": "2007-06-14",
"videos": [
"http://thecolbertreport.cc.com/videos/oa9gd7/intro---6-14-07",
"http://thecolbertreport.cc.com/videos/6uc0h1/fred-thompson-on-fire",
"http://thecolbertreport.cc.com/videos/g52jco/stephen-benjamin",
"http://thecolbertreport.cc.com/videos/0agktt/bears---balls---summer-vacation-edition",
"http://thecolbertreport.cc.com/videos/a0p792/daniel-b--smith",
"http://thecolbertreport.cc.com/videos/llk3nk/sign-off---the-land-of-nod"
],
"guest": "Daniel B. Smith"
},
{
"date": "2007-06-18",
"videos": [
"http://thecolbertreport.cc.com/videos/rwup1e/intro---6-18-07",
"http://thecolbertreport.cc.com/videos/k3t99j/papal-encounter",
"http://thecolbertreport.cc.com/videos/rbx9fh/the-price-is-right",
"http://thecolbertreport.cc.com/videos/w0pe9q/the-word---mcconaughey",
"http://thecolbertreport.cc.com/videos/yfclcj/stephen-on-itunes",
"http://thecolbertreport.cc.com/videos/7jalja/tip-wag---arnold-schwarzenegger",
"http://thecolbertreport.cc.com/videos/ozfwje/toby-keith"
],
"guest": "Toby Keith"
},
{
"date": "2007-06-19",
"videos": [
"http://thecolbertreport.cc.com/videos/ndbsf6/intro---6-19-07",
"http://thecolbertreport.cc.com/videos/qxyadz/secret-clapton-concert",
"http://thecolbertreport.cc.com/videos/0y4kih/marybeth-garrigan",
"http://thecolbertreport.cc.com/videos/mzxikb/countdown-to-armageddon",
"http://thecolbertreport.cc.com/videos/ij3mgr/alpha-dog-of-the-week---robert-bork",
"http://thecolbertreport.cc.com/videos/u1dk1e/anne-marie-slaughter",
"http://thecolbertreport.cc.com/videos/kxk02d/sign-off---manifesto"
],
"guest": "Harriet the Eagle with handler, Anne-Marie Slaughter"
},
{
"date": "2007-06-20",
"videos": [
"http://thecolbertreport.cc.com/videos/jbdbyq/intro---6-20-07",
"http://thecolbertreport.cc.com/videos/beccdu/bloomberg-for-president",
"http://thecolbertreport.cc.com/videos/xe5j30/the-word---justice",
"http://thecolbertreport.cc.com/videos/4yziuf/cheating-death---colgate",
"http://thecolbertreport.cc.com/videos/7m9bgr/will-schwalbe",
"http://thecolbertreport.cc.com/videos/glo9c6/sign-off---job-well-done"
],
"guest": "Will Schwalbe"
},
{
"date": "2007-06-21",
"videos": [
"http://thecolbertreport.cc.com/videos/um7qsm/intro---6-21-07",
"http://thecolbertreport.cc.com/videos/psamg7/ron-paul-s-colbert-bump",
"http://thecolbertreport.cc.com/videos/38xzef/difference-makers---tim-donnelly",
"http://thecolbertreport.cc.com/videos/2oyfu8/vincent-bugliosi",
"http://thecolbertreport.cc.com/videos/dlqbr6/sign-off---goodbye-to-mr--wizard",
"http://thecolbertreport.cc.com/videos/35278z/the-word---porking"
],
"guest": "Vincent Bugliosi"
},
{
"date": "2007-06-25",
"videos": [
"http://thecolbertreport.cc.com/videos/wvrrio/intro---6-25-07",
"http://thecolbertreport.cc.com/videos/xvrdq7/the-freegans",
"http://thecolbertreport.cc.com/videos/dqezp0/the-word---fourth-branch",
"http://thecolbertreport.cc.com/videos/oldt6o/threatdown---coral-reefs",
"http://thecolbertreport.cc.com/videos/mhjtgw/tom-hayden",
"http://thecolbertreport.cc.com/videos/5zivhy/sign-off---contract"
],
"guest": "Tom Hayden"
},
{
"date": "2007-06-26",
"videos": [
"http://thecolbertreport.cc.com/videos/2dxfpk/intro---6-26-07",
"http://thecolbertreport.cc.com/videos/id2z8d/christmas-in-june",
"http://thecolbertreport.cc.com/videos/eelu64/tony-blair-s-conversion",
"http://thecolbertreport.cc.com/videos/tpff57/the-word---elsewhere",
"http://thecolbertreport.cc.com/videos/0t819z/christmas-presents",
"http://thecolbertreport.cc.com/videos/5awnum/alpha-dog-of-the-week---fred-thompson",
"http://thecolbertreport.cc.com/videos/1uvv46/david-france",
"http://thecolbertreport.cc.com/videos/96ew1f/sign-off---visions-of-sugarplums"
],
"guest": "David France"
},
{
"date": "2007-06-27",
"videos": [
"http://thecolbertreport.cc.com/videos/47zhcv/intro---6-27-07",
"http://thecolbertreport.cc.com/videos/y34h2c/give-stephen-an-iphone",
"http://thecolbertreport.cc.com/videos/wepdgq/tom-blanton",
"http://thecolbertreport.cc.com/videos/f6in26/four-horsemen-of-the-a-pop-calypse---shaq",
"http://thecolbertreport.cc.com/videos/msuhoe/daniel-gilbert"
],
"guest": "Tom Blanton, Daniel Gilbert"
},
{
"date": "2007-06-28",
"videos": [
"http://thecolbertreport.cc.com/videos/ftc2tr/intro---6-28-07",
"http://thecolbertreport.cc.com/videos/2o9nj2/spot-the-difference",
"http://thecolbertreport.cc.com/videos/kb8br0/civil-unrest-in-iran",
"http://thecolbertreport.cc.com/videos/0lfyqf/the-word---profiles-in-timing",
"http://thecolbertreport.cc.com/videos/owh6vd/colbert-platinum---luxury-car-wrecks",
"http://thecolbertreport.cc.com/videos/f9y6wb/doug-bailey",
"http://thecolbertreport.cc.com/videos/oxeeoj/sign-off---going-on-vacation"
],
"guest": "Doug Bailey"
},
{
"date": "2007-07-16",
"videos": [
"http://thecolbertreport.cc.com/videos/rsv8g9/intro---7-16-07",
"http://thecolbertreport.cc.com/videos/bwablo/tunneling-to-free-scooter-libby",
"http://thecolbertreport.cc.com/videos/lnroz7/richard-florida",
"http://thecolbertreport.cc.com/videos/scrz03/difference-makers---johnna-mink",
"http://thecolbertreport.cc.com/videos/r0qxf5/ben-nelson",
"http://thecolbertreport.cc.com/videos/zabqma/sign-off---take-five"
],
"guest": "Richard Florida, Sen. Ben Nelson"
},
{
"date": "2007-07-17",
"videos": [
"http://thecolbertreport.cc.com/videos/cliw91/intro---7-17-07",
"http://thecolbertreport.cc.com/videos/zl176l/all-night-senate-session",
"http://thecolbertreport.cc.com/videos/depupc/the-word---victimcrite",
"http://thecolbertreport.cc.com/videos/hdn59k/1-428-minutes-to-go",
"http://thecolbertreport.cc.com/videos/gafa5t/tip-wag---michael-chertoff-s-gut-o-meter",
"http://thecolbertreport.cc.com/videos/ev6dp9/mark-moffett",
"http://thecolbertreport.cc.com/videos/1jb3qq/threatdown---500-threat-marathon"
],
"guest": "Mark Moffett"
},
{
"date": "2007-07-18",
"videos": [
"http://thecolbertreport.cc.com/videos/uf8wpk/intro---7-18-07",
"http://thecolbertreport.cc.com/videos/gn1bt7/2007-filibustacular",
"http://thecolbertreport.cc.com/videos/hqa77b/the-word---smiley-face",
"http://thecolbertreport.cc.com/videos/ysfdjx/pope-goes-green",
"http://thecolbertreport.cc.com/videos/artj1e/alpha-dog-of-the-week---david-beckham",
"http://thecolbertreport.cc.com/videos/ga3vsc/john-mellencamp"
],
"guest": "John Mellencamp"
},
{
"date": "2007-07-19",
"videos": [
"http://thecolbertreport.cc.com/videos/19mw0q/intro---7-19-07",
"http://thecolbertreport.cc.com/videos/1esv0i/republican-candidates--suffering",
"http://thecolbertreport.cc.com/videos/a9zoea/michael-moore",
"http://thecolbertreport.cc.com/videos/bn2nox/march-to-enslavement---stephen-gets-an-iphone",
"http://thecolbertreport.cc.com/videos/9p0lhk/frank-sulloway",
"http://thecolbertreport.cc.com/videos/qhp9z3/sign-off---length-of-the-show-contest"
],
"guest": "Frank Sulloway"
},
{
"date": "2007-07-23",
"videos": [
"http://thecolbertreport.cc.com/videos/nc8xh3/intro---7-23-07",
"http://thecolbertreport.cc.com/videos/fkxqbr/stephen-s-fountain-of-youth",
"http://thecolbertreport.cc.com/videos/4rqgp5/the-word---premium-package",
"http://thecolbertreport.cc.com/videos/l0ig1p/colbert-platinum---private-submarines",
"http://thecolbertreport.cc.com/videos/6e6gd1/simon-schama",
"http://thecolbertreport.cc.com/videos/vfxa7p/sign-off---just-about-out-of-time"
],
"guest": "Simon Schama"
},
{
"date": "2007-07-24",
"videos": [
"http://thecolbertreport.cc.com/videos/15l5ov/intro---7-24-07",
"http://thecolbertreport.cc.com/videos/d9v0fp/bush-s-butt",
"http://thecolbertreport.cc.com/videos/nvdygh/the-word---modest-porpoisal",
"http://thecolbertreport.cc.com/videos/e5420t/movies-that-are-destroying-america--chuck-and-larry",
"http://thecolbertreport.cc.com/videos/yqgj2h/anthony-romero",
"http://thecolbertreport.cc.com/videos/alsjeo/joining-the-illuminati"
],
"guest": "Anthony D. Romero"
},
{
"date": "2007-07-25",
"videos": [
"http://thecolbertreport.cc.com/videos/shyero/intro---7-25-07",
"http://thecolbertreport.cc.com/videos/4md3eg/daily-kos",
"http://thecolbertreport.cc.com/videos/ikcdyi/the-word---no-regrets",
"http://thecolbertreport.cc.com/videos/bdjzxb/thompson-campaign",
"http://thecolbertreport.cc.com/videos/bc0mf3/hometown-hero-town---bryce-canyon-city",
"http://thecolbertreport.cc.com/videos/2f2r58/charles-kaiser"
],
"guest": "Charles Kaiser"
},
{
"date": "2007-07-26",
"videos": [
"http://thecolbertreport.cc.com/videos/wth3ve/intro---7-26-07",
"http://thecolbertreport.cc.com/videos/3or3gc/how-did-stephen-break-his-wrist-",
"http://thecolbertreport.cc.com/videos/if6h6s/industrial-hemp---medical-marijuana---aaron-houston",
"http://thecolbertreport.cc.com/videos/8p2na8/advice-to-the-gods---nepalese-pre-teen-goddesses",
"http://thecolbertreport.cc.com/videos/kcb6kk/bob-shrum"
],
"guest": "Robert Shrum"
},
{
"date": "2007-07-30",
"videos": [
"http://thecolbertreport.cc.com/videos/8m5y0f/intro---7-30-07",
"http://thecolbertreport.cc.com/videos/tyo2os/wrist-violence---glorification",
"http://thecolbertreport.cc.com/videos/9e0vz0/pollution-immigration",
"http://thecolbertreport.cc.com/videos/brdooe/the-word---solidarity",
"http://thecolbertreport.cc.com/videos/ii5xvp/threatdown---scottish-surgeons",
"http://thecolbertreport.cc.com/videos/o55kxd/evan-osnos"
],
"guest": "Evan Osnos"
},
{
"date": "2007-07-31",
"videos": [
"http://thecolbertreport.cc.com/videos/01xv20/intro---7-31-07",
"http://thecolbertreport.cc.com/videos/bgyn76/wrist-violence-epidemic",
"http://thecolbertreport.cc.com/videos/aryder/smokin--pole---arc--who-goes-there-",
"http://thecolbertreport.cc.com/videos/tg3umi/the-word---special-prosecutor",
"http://thecolbertreport.cc.com/videos/egvqvt/rupert-murdoch-purchases-the-wall-street-journal",
"http://thecolbertreport.cc.com/videos/i9cr44/sport-report---barry-bonds",
"http://thecolbertreport.cc.com/videos/3tom79/kathleen-kennedy-townsend"
],
"guest": "Kathleen Kennedy Townsend"
},
{
"date": "2007-08-01",
"videos": [
"http://thecolbertreport.cc.com/videos/jtpqex/intro---8-1-07",
"http://thecolbertreport.cc.com/videos/b8kbe8/dr--jerry-vizzone",
"http://thecolbertreport.cc.com/videos/zd2nvn/the-word---college-credit",
"http://thecolbertreport.cc.com/videos/nlqwhc/when-animals-attack-our-morals---hollywood-pigeons",
"http://thecolbertreport.cc.com/videos/agisiu/michael-beschloss",
"http://thecolbertreport.cc.com/videos/a0yv9l/30-minute-anniversary"
],
"guest": "Michael Beschloss"
},
{
"date": "2007-08-02",
"videos": [
"http://thecolbertreport.cc.com/videos/qjky5n/farewell-ingmar-bergman",
"http://thecolbertreport.cc.com/videos/jtpqex/intro---8-1-07",
"http://thecolbertreport.cc.com/videos/b8kbe8/dr--jerry-vizzone",
"http://thecolbertreport.cc.com/videos/zd2nvn/the-word---college-credit",
"http://thecolbertreport.cc.com/videos/nlqwhc/when-animals-attack-our-morals---hollywood-pigeons",
"http://thecolbertreport.cc.com/videos/agisiu/michael-beschloss",
"http://thecolbertreport.cc.com/videos/a0yv9l/30-minute-anniversary"
],
"guest": "Michael J. Behe"
},
{
"date": "2007-08-02",
"videos": [
"http://thecolbertreport.cc.com/videos/tqb1ek/intro---8-2-07",
"http://thecolbertreport.cc.com/videos/4fa4lg/superhighway",
"http://thecolbertreport.cc.com/videos/sg9xg3/rick-macarthur",
"http://thecolbertreport.cc.com/videos/vc3b3c/thighmasters-for-the-troops",
"http://thecolbertreport.cc.com/videos/ptvqa7/sport-report---barry-smash",
"http://thecolbertreport.cc.com/videos/z81ulz/michael-behe"
],
"guest": "Michael J. Behe"
},
{
"date": "2007-08-07",
"videos": [
"http://thecolbertreport.cc.com/videos/7r677j/intro---8-7-07",
"http://thecolbertreport.cc.com/videos/4kw9z4/yearly-kos-convention",
"http://thecolbertreport.cc.com/videos/f3w2rh/the-word---the-dark-side",
"http://thecolbertreport.cc.com/videos/zwnri3/better-know-a-protectorate---american-samoa---eni-faleomavaega",
"http://thecolbertreport.cc.com/videos/d21xmf/ian-bogost",
"http://thecolbertreport.cc.com/videos/kzlukl/sign-off---colbert-commonsensicals"
],
"guest": "Ian Bogost"
},
{
"date": "2007-08-08",
"videos": [
"http://thecolbertreport.cc.com/videos/4f7upv/intro---8-8-07",
"http://thecolbertreport.cc.com/videos/oxms8d/wrist-watch---fighting-back",
"http://thecolbertreport.cc.com/videos/jtqjr6/jim-cramer",
"http://thecolbertreport.cc.com/videos/nveh3o/bears---balls---bootlegging",
"http://thecolbertreport.cc.com/videos/7zavlx/tina-brown"
],
"guest": "Jim Cramer, Tina Brown"
},
{
"date": "2007-08-09",
"videos": [
"http://thecolbertreport.cc.com/videos/hutdl7/intro---8-9-07",
"http://thecolbertreport.cc.com/videos/3abho5/the-word---clarity",
"http://thecolbertreport.cc.com/videos/qp6xha/tip-wag---bloomberg",
"http://thecolbertreport.cc.com/videos/h9y997/judd-apatow",
"http://thecolbertreport.cc.com/videos/161mvg/sign-off---toenails"
],
"guest": "Judd Apatow"
},
{
"date": "2007-08-13",
"videos": [
"http://thecolbertreport.cc.com/videos/1833p0/intro---8-13-07",
"http://thecolbertreport.cc.com/videos/gavjew/rove-resigns",
"http://thecolbertreport.cc.com/videos/qu995y/the-word---white-guy",
"http://thecolbertreport.cc.com/videos/bruhc9/threatdown---bats",
"http://thecolbertreport.cc.com/videos/fk3k31/michael-jacobson",
"http://thecolbertreport.cc.com/videos/dnjitq/sign-off---americone-dream"
],
"guest": "Michael Jacobson"
},
{
"date": "2007-08-14",
"videos": [
"http://thecolbertreport.cc.com/videos/0imzs4/dna--could-it-happen-to-you----jackknife",
"http://thecolbertreport.cc.com/videos/n35y17/jerry-miller",
"http://thecolbertreport.cc.com/videos/5o7ie1/dr--spencer-wells",
"http://thecolbertreport.cc.com/videos/x03vyw/dna--could-it-happen-to-you----incrimination"
],
"guest": "Jerry Miller, Spencer Wells"
},
{
"date": "2007-08-15",
"videos": [
"http://thecolbertreport.cc.com/videos/6o4ihx/intro---8-15-07",
"http://thecolbertreport.cc.com/videos/rv9k9s/jewish-colbert-ancestry",
"http://thecolbertreport.cc.com/videos/3zlayh/markos-moulitsas",
"http://thecolbertreport.cc.com/videos/6mvd9x/monkey-on-the-lam---oliver",
"http://thecolbertreport.cc.com/videos/zp4iw7/the-word---potential",
"http://thecolbertreport.cc.com/videos/734nxn/michael-wallis",
"http://thecolbertreport.cc.com/videos/z4d4y4/sign-off---doctor-s-orders"
],
"guest": "Michael Wallis"
},
{
"date": "2007-08-16",
"videos": [
"http://thecolbertreport.cc.com/videos/ns0g26/intro---8-16-07",
"http://thecolbertreport.cc.com/videos/14jprr/colbert-branson-trainwreck",
"http://thecolbertreport.cc.com/videos/kgguey/mike-huckabee",
"http://thecolbertreport.cc.com/videos/fnrvrc/cheating-death---gene-therapy",
"http://thecolbertreport.cc.com/videos/u8nc37/andrew-keen"
],
"guest": "Andrew Keen"
},
{
"date": "2007-08-20",
"videos": [
"http://thecolbertreport.cc.com/videos/tfnhsy/intro---8-20-07",
"http://thecolbertreport.cc.com/videos/xo98yh/wriststrong-bracelets",
"http://thecolbertreport.cc.com/videos/us6itk/the-word---made-in-iraq",
"http://thecolbertreport.cc.com/videos/9a8i9h/nailed--em---northern-border",
"http://thecolbertreport.cc.com/videos/o9ho2y/nathan-sawaya"
],
"guest": "Nathan Sawaya"
},
{
"date": "2007-08-21",
"videos": [
"http://thecolbertreport.cc.com/videos/2gjr3w/intro---8-21-07",
"http://thecolbertreport.cc.com/videos/bcfeni/smokin--pole---global-warming",
"http://thecolbertreport.cc.com/videos/7gfsui/the-word---self-determination",
"http://thecolbertreport.cc.com/videos/v4twhy/formidable-opponent---terrorism",
"http://thecolbertreport.cc.com/videos/4o129i/michael-shermer"
],
"guest": "Michael Shermer"
},
{
"date": "2007-08-22",
"videos": [
"http://thecolbertreport.cc.com/videos/v8cwuz/intro---8-22-07",
"http://thecolbertreport.cc.com/videos/k7oqos/foreshadowing",
"http://thecolbertreport.cc.com/videos/9snnh5/the-word---november-surprise",
"http://thecolbertreport.cc.com/videos/ymi1da/where-in-the-world-is-matt-lauer-s-wriststrong-bracelet-",
"http://thecolbertreport.cc.com/videos/r18bn4/colbert-platinum---san-tropez",
"http://thecolbertreport.cc.com/videos/xxwsh0/richard-branson",
"http://thecolbertreport.cc.com/videos/eb410v/doused"
],
"guest": "Richard Branson"
},
{
"date": "2007-08-23",
"videos": [
"http://thecolbertreport.cc.com/videos/w3z5w0/intro---8-23-07",
"http://thecolbertreport.cc.com/videos/uc4umy/cheney-s-pre-emptive-strike",
"http://thecolbertreport.cc.com/videos/en1mx1/thomas-ricks",
"http://thecolbertreport.cc.com/videos/xjgukn/fractured-freedom",
"http://thecolbertreport.cc.com/videos/0arcqm/wrist-cast-signatories",
"http://thecolbertreport.cc.com/videos/3xfbbo/free-at-last",
"http://thecolbertreport.cc.com/videos/qta5f5/the-auction-begins-"
],
"guest": "Thomas Ricks"
},
{
"date": "2007-09-10",
"videos": [
"http://thecolbertreport.cc.com/videos/844a7k/intro---9-10-07",
"http://thecolbertreport.cc.com/videos/vdvpmz/kicking-the-habit",
"http://thecolbertreport.cc.com/videos/p14g3t/the-word---honor-bound",
"http://thecolbertreport.cc.com/videos/2qi5qf/cast-auction",
"http://thecolbertreport.cc.com/videos/u1yamr/bjorn-lomborg"
],
"guest": "Bjorn Lomborg"
},
{
"date": "2007-09-11",
"videos": [
"http://thecolbertreport.cc.com/videos/hy8je4/intro---9-11-07",
"http://thecolbertreport.cc.com/videos/3l7k3j/general-betray-us",
"http://thecolbertreport.cc.com/videos/5yaj4x/indecision-2008--don-t-f--k-this-up-america---the-kickoff",
"http://thecolbertreport.cc.com/videos/mjzhz2/the-word---southsourcing",
"http://thecolbertreport.cc.com/videos/5z4esb/katie-bruggeman---exclusive",
"http://thecolbertreport.cc.com/videos/o07u14/garrison-keillor"
],
"guest": "Garrison Keillor"
},
{
"date": "2007-09-12",
"videos": [
"http://thecolbertreport.cc.com/videos/h5njj1/intro---9-12-07",
"http://thecolbertreport.cc.com/videos/8lpy3i/1-888-mops-key",
"http://thecolbertreport.cc.com/videos/7hc8lx/the-word---re-run",
"http://thecolbertreport.cc.com/videos/r6x2pm/michael-bloomberg",
"http://thecolbertreport.cc.com/videos/3rano7/tek-jansen---beginning-s-first-dawn--episode-one",
"http://thecolbertreport.cc.com/videos/n46uq9/joel-klein",
"http://thecolbertreport.cc.com/videos/pc4v8w/klein-s-penance"
],
"guest": "Joel Klein"
},
{
"date": "2007-09-13",
"videos": [
"http://thecolbertreport.cc.com/videos/tduyob/intro---9-13-07",
"http://thecolbertreport.cc.com/videos/rvio16/the-emmys",
"http://thecolbertreport.cc.com/videos/g1gps7/father-james-martin",
"http://thecolbertreport.cc.com/videos/9unkmu/wriststrong",
"http://thecolbertreport.cc.com/videos/5c8kig/ed-begley-jr-",
"http://thecolbertreport.cc.com/videos/9mwknn/stephen-for-president---answering-the-call"
],
"guest": "Ed Begley Jr."
},
{
"date": "2007-09-18",
"videos": [
"http://thecolbertreport.cc.com/videos/tr81w4/intro---9-18-07",
"http://thecolbertreport.cc.com/videos/6l9i7j/the-word---let-my-people-go",
"http://thecolbertreport.cc.com/videos/6we8r4/difference-makers---nitro-girl",
"http://thecolbertreport.cc.com/videos/jx6a68/susan-sarandon"
],
"guest": "Susan Sarandon"
},
{
"date": "2007-09-19",
"videos": [
"http://thecolbertreport.cc.com/videos/lv4fuw/intro---9-19-07",
"http://thecolbertreport.cc.com/videos/zeoen2/ed-asner-dials-the-atone-phone",
"http://thecolbertreport.cc.com/videos/0aau1u/the-word---solitarity",
"http://thecolbertreport.cc.com/videos/7ooxuh/colbert-platinum---green-edition",
"http://thecolbertreport.cc.com/videos/nnhbey/naomi-wolf"
],
"guest": "Naomi Wolf"
},
{
"date": "2007-09-20",
"videos": [
"http://thecolbertreport.cc.com/videos/fojlm8/intro---9-20-07",
"http://thecolbertreport.cc.com/videos/0ek76n/rabbi-fish",
"http://thecolbertreport.cc.com/videos/2h18lo/blistering-rebuttal",
"http://thecolbertreport.cc.com/videos/z6i9oa/the-word---market-forces",
"http://thecolbertreport.cc.com/videos/b5qfpk/threatdown---us",
"http://thecolbertreport.cc.com/videos/wthvm9/jeffrey-toobin",
"http://thecolbertreport.cc.com/videos/1pktzf/craziest-f--king-thing-i-ve-ever-heard---mayo-kitchen"
],
"guest": "Jeffrey Toobin"
},
{
"date": "2007-09-24",
"videos": [
"http://thecolbertreport.cc.com/videos/tgxkym/intro---9-24-07",
"http://thecolbertreport.cc.com/videos/kwfydk/the-word---na-na-na-na-na-na",
"http://thecolbertreport.cc.com/videos/zztck4/alpha-dog-of-the-week---honniball",
"http://thecolbertreport.cc.com/videos/l00qbc/the-metric-system",
"http://thecolbertreport.cc.com/videos/pkz7i5/thomas-l--friedman",
"http://thecolbertreport.cc.com/videos/emtni3/sign-off---stephen-accepts-your-apologies"
],
"guest": "Thomas Friedman"
},
{
"date": "2007-09-25",
"videos": [
"http://thecolbertreport.cc.com/videos/yrize5/intro---9-25-07",
"http://thecolbertreport.cc.com/videos/cminr7/no-nuclear-iran",
"http://thecolbertreport.cc.com/videos/2g01er/indecision-2008--don-t-f--k-this-up-america---giuliani",
"http://thecolbertreport.cc.com/videos/bjhu7f/k--david-harrison",
"http://thecolbertreport.cc.com/videos/b5cc0e/tip-wag---muslim-hipsters",
"http://thecolbertreport.cc.com/videos/5ny4ja/john-grisham"
],
"guest": "John Grisham"
},
{
"date": "2007-09-26",
"videos": [
"http://thecolbertreport.cc.com/videos/ups73z/intro---9-26-07",
"http://thecolbertreport.cc.com/videos/rn3hke/forgiving-bennett",
"http://thecolbertreport.cc.com/videos/agyblq/canadian-dollar",
"http://thecolbertreport.cc.com/videos/nj93xu/the-word---a-word-from-our-sponsors",
"http://thecolbertreport.cc.com/videos/0iswbv/sam-waterston",
"http://thecolbertreport.cc.com/videos/79m504/tony-bennett"
],
"guest": "Tony Bennett"
},
{
"date": "2007-09-27",
"videos": [
"http://thecolbertreport.cc.com/videos/i67egh/intro---9-27-07",
"http://thecolbertreport.cc.com/videos/o502gv/king-tut",
"http://thecolbertreport.cc.com/videos/mhmga5/democratic-presidential-debate---the-clintons",
"http://thecolbertreport.cc.com/videos/th2rny/the-word---early-immunization",
"http://thecolbertreport.cc.com/videos/ev9qqd/david-schwartz",
"http://thecolbertreport.cc.com/videos/q0vng8/sign-off---bear-in-the-woods"
],
"guest": "David Schwartz"
},
{
"date": "2007-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/4vmpg2/intro---10-1-07",
"http://thecolbertreport.cc.com/videos/s3koea/on-notice---dennis-kucinich",
"http://thecolbertreport.cc.com/videos/e5dl9b/the-word---evitable",
"http://thecolbertreport.cc.com/videos/7s7h6l/cheating-death---sleep",
"http://thecolbertreport.cc.com/videos/5wkeol/charlie-savage",
"http://thecolbertreport.cc.com/videos/g86mf6/sign-off---all-night-date"
],
"guest": "Charlie Savage"
},
{
"date": "2007-10-02",
"videos": [
"http://thecolbertreport.cc.com/videos/5ycsxc/intro---10-2-07",
"http://thecolbertreport.cc.com/videos/ws1a9l/end-of-the-universe",
"http://thecolbertreport.cc.com/videos/boxkhr/the-real-showdown",
"http://thecolbertreport.cc.com/videos/f1ovth/the-word---troops-out-now",
"http://thecolbertreport.cc.com/videos/berne3/nailed--em---cyberrorists",
"http://thecolbertreport.cc.com/videos/non4mf/john-mearsheimer",
"http://thecolbertreport.cc.com/videos/yxngw7/what-number-is-stephen-thinking-of----between-one-and-ten"
],
"guest": "John Mearsheimer"
},
{
"date": "2007-10-03",
"videos": [
"http://thecolbertreport.cc.com/videos/77zwpl/intro---10-3-07",
"http://thecolbertreport.cc.com/videos/rsugzz/krugman-correction",
"http://thecolbertreport.cc.com/videos/ujxs1h/gay-roundup---dan-savage",
"http://thecolbertreport.cc.com/videos/ttvyxm/alpha-dog-of-the-week---president-bush",
"http://thecolbertreport.cc.com/videos/bohex1/monkey-on-the-lam---missouri",
"http://thecolbertreport.cc.com/videos/1scf3a/jim-lovell"
],
"guest": "Jim Lovell"
},
{
"date": "2007-10-04",
"videos": [
"http://thecolbertreport.cc.com/videos/6takag/intro---10-4-07",
"http://thecolbertreport.cc.com/videos/9ie5cp/fred-thompson-s-lackluster-candidacy",
"http://thecolbertreport.cc.com/videos/t9j9vd/the-word---catastrophe",
"http://thecolbertreport.cc.com/videos/ze1fvk/threatdown---science-and-technology-edition",
"http://thecolbertreport.cc.com/videos/i58e8l/john-kao",
"http://thecolbertreport.cc.com/videos/jy5aw2/an--i-am-america--and-so-can-you----success-story"
],
"guest": "John Kao"
},
{
"date": "2007-10-08",
"videos": [
"http://thecolbertreport.cc.com/videos/zjbyqa/intro---10-8-07",
"http://thecolbertreport.cc.com/videos/pw4m4c/doggie-co-author",
"http://thecolbertreport.cc.com/videos/xkdwvy/the-word---medium-matters",
"http://thecolbertreport.cc.com/videos/56gzq7/balls-for-kidz---schip",
"http://thecolbertreport.cc.com/videos/og377e/george-saunders",
"http://thecolbertreport.cc.com/videos/p6057q/sign-off---i-am-america--and-so-can-you---day"
],
"guest": "George Saunders"
},
{
"date": "2007-10-09",
"videos": [
"http://thecolbertreport.cc.com/videos/q3jijk/intro---10-9-07",
"http://thecolbertreport.cc.com/videos/plzp6y/i-am-america-on-sale-now-",
"http://thecolbertreport.cc.com/videos/ubbze1/new-reagan-coin",
"http://thecolbertreport.cc.com/videos/597azm/the-word---mighty-duck",
"http://thecolbertreport.cc.com/videos/1znjlb/obama-s-lapel",
"http://thecolbertreport.cc.com/videos/x1wzb3/the-stephen-colbert-interview",
"http://thecolbertreport.cc.com/videos/r0xdzt/sign-off---lead-free-ink"
],
"guest": "Stephen Colbert"
},
{
"date": "2007-10-10",
"videos": [
"http://thecolbertreport.cc.com/videos/vsm7hv/intro---10-10-07",
"http://thecolbertreport.cc.com/videos/4ht7gm/dead-to-me---pocketmaster",
"http://thecolbertreport.cc.com/videos/79ara8/the-word---americon-dream",
"http://thecolbertreport.cc.com/videos/dzvdm0/tip-wag---bruce-springsteen",
"http://thecolbertreport.cc.com/videos/97z30b/wesley-clark"
],
"guest": "Gen. Wesley Clark"
},
{
"date": "2007-10-11",
"videos": [
"http://thecolbertreport.cc.com/videos/sprkvb/intro---10-11-07",
"http://thecolbertreport.cc.com/videos/a27soa/black-haired-guy-who-isn-t-steve-doocy",
"http://thecolbertreport.cc.com/videos/o6xiyi/frank-gaffney",
"http://thecolbertreport.cc.com/videos/zipx3v/colbert-platinum---kidz-edition",
"http://thecolbertreport.cc.com/videos/zv1po1/chris-jordan"
],
"guest": "Chris Jordan"
},
{
"date": "2007-10-15",
"videos": [
"http://thecolbertreport.cc.com/videos/56sadv/intro---10-15-07",
"http://thecolbertreport.cc.com/videos/9esznw/who-s-honoring-me-now----marie-claire",
"http://thecolbertreport.cc.com/videos/oogvcb/the-word---enviro-medal-disaster",
"http://thecolbertreport.cc.com/videos/cmpb1d/kucinich-s-pockets",
"http://thecolbertreport.cc.com/videos/biff8k/paul-glastris"
],
"guest": "Dennis Kucinich, Paul Glastris"
},
{
"date": "2007-10-16",
"videos": [
"http://thecolbertreport.cc.com/videos/6k009y/intro---10-16-07",
"http://thecolbertreport.cc.com/videos/0pl61p/planet-in-peril",
"http://thecolbertreport.cc.com/videos/f97ynd/indecision-2008--don-t-f--k-this-up-america---presidential-bid",
"http://thecolbertreport.cc.com/videos/9phoww/jeff-greenfield",
"http://thecolbertreport.cc.com/videos/9j5u2v/bob-drogin"
],
"guest": "Bob Drogin, Jeff Greenfield"
},
{
"date": "2007-10-17",
"videos": [
"http://thecolbertreport.cc.com/videos/e6jgx6/intro---10-17-07",
"http://thecolbertreport.cc.com/videos/el4ceo/the-big-news",
"http://thecolbertreport.cc.com/videos/ps9172/hail-to-the-cheese---filing-papers",
"http://thecolbertreport.cc.com/videos/duz61o/threatdown---anniversary",
"http://thecolbertreport.cc.com/videos/dvoers/garry-kasparov",
"http://thecolbertreport.cc.com/videos/e0223g/sign-off---revenge-is-sweet"
],
"guest": "Garry Kasparov"
},
{
"date": "2007-10-18",
"videos": [
"http://thecolbertreport.cc.com/videos/i4a6fg/intro---10-18-07",
"http://thecolbertreport.cc.com/videos/z3kzwl/pumpkin-shortage",
"http://thecolbertreport.cc.com/videos/6o9coa/global-scrunching---anderson-cooper",
"http://thecolbertreport.cc.com/videos/p1wo65/hail-to-the-cheese---campaign-coverage-finance",
"http://thecolbertreport.cc.com/videos/rcmqef/craig-newmark",
"http://thecolbertreport.cc.com/videos/i2rw4t/sign-off---portrait-unveiled"
],
"guest": "Craig Newmark, Anderson Cooper"
},
{
"date": "2007-10-29",
"videos": [
"http://thecolbertreport.cc.com/videos/3xfeo5/intro---10-29-07",
"http://thecolbertreport.cc.com/videos/oqlp6f/the-last-infographic",
"http://thecolbertreport.cc.com/videos/2hfe9b/hail-to-the-cheese---branded-killings",
"http://thecolbertreport.cc.com/videos/wli1tg/the-word---absinthetinence",
"http://thecolbertreport.cc.com/videos/49my1v/tip-wag---sleep-deprivation",
"http://thecolbertreport.cc.com/videos/pmtsjp/richard-berman",
"http://thecolbertreport.cc.com/videos/1yeaa0/sign-off---rocktober"
],
"guest": "Richard Berman"
},
{
"date": "2007-10-30",
"videos": [
"http://thecolbertreport.cc.com/videos/6130g5/intro---10-30-07",
"http://thecolbertreport.cc.com/videos/f3dddn/massie-ritsch",
"http://thecolbertreport.cc.com/videos/rrhz2o/earth-attacks---georgia-drought",
"http://thecolbertreport.cc.com/videos/czdur4/j--craig-venter"
],
"guest": "Massie Ritsch, Craig Venter"
},
{
"date": "2007-10-31",
"videos": [
"http://thecolbertreport.cc.com/videos/fjrl1d/intro---10-31-07",
"http://thecolbertreport.cc.com/videos/iwuly8/hallo-weening",
"http://thecolbertreport.cc.com/videos/lshob0/democra-see--democra-do---elections",
"http://thecolbertreport.cc.com/videos/pcplr6/the-word---job-description",
"http://thecolbertreport.cc.com/videos/hpr411/obama-s-grit-off-challenge",
"http://thecolbertreport.cc.com/videos/s7cadq/monkey-on-the-lam---lobster-edition",
"http://thecolbertreport.cc.com/videos/4uxxf3/lawrence-wilkerson"
],
"guest": "Col. Lawrence Wilkerson"
},
{
"date": "2007-11-01",
"videos": [
"http://thecolbertreport.cc.com/videos/we8h5v/intro---11-1-07",
"http://thecolbertreport.cc.com/videos/dzscg7/hail-to-the-cheese---ballot-issues",
"http://thecolbertreport.cc.com/videos/9d4e78/hail-to-the-cheese---democratic-executive-council",
"http://thecolbertreport.cc.com/videos/tcxqui/walter-kirn",
"http://thecolbertreport.cc.com/videos/zymn63/hail-to-the-cheese---donors-choose"
],
"guest": "Walter Kirn"
}
],
"2008": [
{
"date": "2008-01-07",
"videos": [
"http://thecolbertreport.cc.com/videos/3q3gby/intro---1-7-08",
"http://thecolbertreport.cc.com/videos/cva2to/applause",
"http://thecolbertreport.cc.com/videos/mdmdd0/nothing-in-the-prompters",
"http://thecolbertreport.cc.com/videos/lp7qsd/2008-election",
"http://thecolbertreport.cc.com/videos/ku5oni/the-word--------",
"http://thecolbertreport.cc.com/videos/mbip8q/democratic-change---andrew-sullivan",
"http://thecolbertreport.cc.com/videos/v60qiq/richard-freeman",
"http://thecolbertreport.cc.com/videos/ckwp47/first-wrap-up"
],
"guest": "Andrew Sullivan, Richard Freeman"
},
{
"date": "2008-01-08",
"videos": [
"http://thecolbertreport.cc.com/videos/8ws9bh/self-driving-car",
"http://thecolbertreport.cc.com/videos/2785cy/bush-absolutely-optimistic",
"http://thecolbertreport.cc.com/videos/2hhoxp/meteorite-market",
"http://thecolbertreport.cc.com/videos/ljxmh2/chris-beam",
"http://thecolbertreport.cc.com/videos/tl8ofm/gary-rosen",
"http://thecolbertreport.cc.com/videos/m7kpci/note-to-strikers"
],
"guest": "Chris Beam, Gary Rosen"
},
{
"date": "2008-01-09",
"videos": [
"http://thecolbertreport.cc.com/videos/33bwbo/she-won-",
"http://thecolbertreport.cc.com/videos/fu1w6p/new-hampshire-wrap-up",
"http://thecolbertreport.cc.com/videos/weeodm/mike-huckabee",
"http://thecolbertreport.cc.com/videos/d0g8tk/matt-taibbi",
"http://thecolbertreport.cc.com/videos/je02b9/studio-on-fire"
],
"guest": "Gov. Mike Huckabee, Matt Taibbi"
},
{
"date": "2008-01-10",
"videos": [
"http://thecolbertreport.cc.com/videos/613lgd/un-american-news---primaries",
"http://thecolbertreport.cc.com/videos/s269t4/norman-ornstein",
"http://thecolbertreport.cc.com/videos/y7lisr/national-treasure-pt--1",
"http://thecolbertreport.cc.com/videos/x10j2p/muhammad-yunus",
"http://thecolbertreport.cc.com/videos/ypiss3/to-the-writers"
],
"guest": "Norman Ornstein, Muhammad Yunus"
},
{
"date": "2008-01-14",
"videos": [
"http://thecolbertreport.cc.com/videos/pm5v1p/papa-bear-takes-note",
"http://thecolbertreport.cc.com/videos/1vwzy6/around-the-world-in-11-6-seconds---lo-mein",
"http://thecolbertreport.cc.com/videos/7k6fkq/indecision-2008--don-t-f--k-this-up-america---trustworthy-manner",
"http://thecolbertreport.cc.com/videos/dytre7/national-treasure-pt--2",
"http://thecolbertreport.cc.com/videos/xgsf42/neil-shubin",
"http://thecolbertreport.cc.com/videos/tmke9w/digesting-lo-mein"
],
"guest": "Neil Shubin"
},
{
"date": "2008-01-15",
"videos": [
"http://thecolbertreport.cc.com/videos/4wimo2/who-s-riding-my-coattails-now----vince-vaughn",
"http://thecolbertreport.cc.com/videos/hrzpve/peter-hopkins",
"http://thecolbertreport.cc.com/videos/1m3t4h/national-treasure-pt--3",
"http://thecolbertreport.cc.com/videos/b0e6w3/jared-cohen",
"http://thecolbertreport.cc.com/videos/4f2fw9/parting-shot"
],
"guest": "Peter Hopkins, Jared Cohen"
},
{
"date": "2008-01-16",
"videos": [
"http://thecolbertreport.cc.com/videos/6mjra2/primary-update",
"http://thecolbertreport.cc.com/videos/ng3cbb/political-roulette-pt--1",
"http://thecolbertreport.cc.com/videos/v0glj4/back-off-mike-huckabee",
"http://thecolbertreport.cc.com/videos/zlpayq/deborah-tannen"
],
"guest": "Deborah Tannen"
},
{
"date": "2008-01-17",
"videos": [
"http://thecolbertreport.cc.com/videos/0tl5ul/push-polling",
"http://thecolbertreport.cc.com/videos/phko2g/political-roulette-pt--2",
"http://thecolbertreport.cc.com/videos/xj86rv/lou-dobbs",
"http://thecolbertreport.cc.com/videos/ykpl7i/david-levy"
],
"guest": "Lou Dobbs, David Levy"
},
{
"date": "2008-01-21",
"videos": [
"http://thecolbertreport.cc.com/videos/3xkco0/nevada-caucus",
"http://thecolbertreport.cc.com/videos/qznknb/huckabee-s-message",
"http://thecolbertreport.cc.com/videos/i2josd/allan-sloan",
"http://thecolbertreport.cc.com/videos/wjtmux/better-know-a-governor---mark-sanford",
"http://thecolbertreport.cc.com/videos/ia8xzl/eric-weiner"
],
"guest": "Allan Sloan, Eric Weiner"
},
{
"date": "2008-01-22",
"videos": [
"http://thecolbertreport.cc.com/videos/8q1hh4/dow-drop",
"http://thecolbertreport.cc.com/videos/7cp97e/malcolm-gladwell",
"http://thecolbertreport.cc.com/videos/xw3v9i/andrew-young",
"http://thecolbertreport.cc.com/videos/5tvl4o/let-my-people-go"
],
"guest": "Malcolm Gladwell, Andrew Young"
},
{
"date": "2008-01-23",
"videos": [
"http://thecolbertreport.cc.com/videos/1vjtzq/fred-thompson-out",
"http://thecolbertreport.cc.com/videos/1fbgf9/sport-report---tom-brady-s-injury",
"http://thecolbertreport.cc.com/videos/08lghg/big-check",
"http://thecolbertreport.cc.com/videos/wmftq8/jeb-corliss",
"http://thecolbertreport.cc.com/videos/rp759h/andrew-mclean"
],
"guest": "Marie Wood, Jeb Corliss, Andrew McLean"
},
{
"date": "2008-01-24",
"videos": [
"http://thecolbertreport.cc.com/videos/7uwyyh/rudy-in-florida",
"http://thecolbertreport.cc.com/videos/xoh710/clinton-s-hero",
"http://thecolbertreport.cc.com/videos/swzg9r/debra-dickerson",
"http://thecolbertreport.cc.com/videos/0wz55a/south-carolina-debate",
"http://thecolbertreport.cc.com/videos/bpcnyw/charles-nesson"
],
"guest": "Debra Dickerson, Charles Nesson"
},
{
"date": "2008-01-28",
"videos": [
"http://thecolbertreport.cc.com/videos/na6amv/obama-just-like-jfk",
"http://thecolbertreport.cc.com/videos/zvtkxx/gordon-b--hinckley-died",
"http://thecolbertreport.cc.com/videos/07hrs5/marjane-satrapi",
"http://thecolbertreport.cc.com/videos/wrdlsf/south-carolina---what-could-have-been-",
"http://thecolbertreport.cc.com/videos/l1477t/rick-warren"
],
"guest": "Marjane Satrapi, Rick Warren"
},
{
"date": "2008-01-29",
"videos": [
"http://thecolbertreport.cc.com/videos/aeooxe/googley-eyed-clams",
"http://thecolbertreport.cc.com/videos/laposi/joe-quesada",
"http://thecolbertreport.cc.com/videos/xw6ugs/french-clam",
"http://thecolbertreport.cc.com/videos/38i4eg/alex-ross"
],
"guest": "Joe Quesada, Alex Ross"
},
{
"date": "2008-01-30",
"videos": [
"http://thecolbertreport.cc.com/videos/akx9de/exclusive---better-know-a-district---south-carolina-s-4th---bob-inglis",
"http://thecolbertreport.cc.com/videos/t6sflk/florida-primary",
"http://thecolbertreport.cc.com/videos/vb4t2x/carl-hiaasen",
"http://thecolbertreport.cc.com/videos/n87g1n/better-know-a-district---south-carolina-s-4th---bob-inglis",
"http://thecolbertreport.cc.com/videos/m4iax5/frans-de-waal"
],
"guest": "Carl Hiaasen, Frans de Waal"
},
{
"date": "2008-01-31",
"videos": [
"http://thecolbertreport.cc.com/videos/z0raub/timetables",
"http://thecolbertreport.cc.com/videos/8l0ndt/ron-paul-sounds-alarm",
"http://thecolbertreport.cc.com/videos/2lwxda/tim-harford",
"http://thecolbertreport.cc.com/videos/0d4uq9/people-who-are-destroying-america---pick-up-trucks",
"http://thecolbertreport.cc.com/videos/kgrty6/andrew-napolitano"
],
"guest": "Tim Harford, Andrew Napolitano"
},
{
"date": "2008-02-04",
"videos": [
"http://thecolbertreport.cc.com/videos/pwg4p2/conan-and-jon",
"http://thecolbertreport.cc.com/videos/y5zzyu/tony-campolo",
"http://thecolbertreport.cc.com/videos/tmuhtk/jacob-weisberg",
"http://thecolbertreport.cc.com/videos/7r0nt2/post-show-ass-kicking"
],
"guest": "Tony Campolo, Jacob Weisberg"
},
{
"date": "2008-02-05",
"videos": [
"http://thecolbertreport.cc.com/videos/yvxknz/happy-super-tuesday-",
"http://thecolbertreport.cc.com/videos/nqwcui/hillary-is-a-target",
"http://thecolbertreport.cc.com/videos/xonm3y/angelo-falcon",
"http://thecolbertreport.cc.com/videos/xq9nc4/mukasey-on-torture",
"http://thecolbertreport.cc.com/videos/gjwjsl/bob-dole"
],
"guest": "Angelo Falcon, Bob Dole"
},
{
"date": "2008-02-06",
"videos": [
"http://thecolbertreport.cc.com/videos/j3dp2u/late-night-fight",
"http://thecolbertreport.cc.com/videos/gqstf6/clap-clap-point-point",
"http://thecolbertreport.cc.com/videos/yxx0w5/richard-brookhiser",
"http://thecolbertreport.cc.com/videos/ammxmv/better-know-a-lobby---human-rights-campaign-pt--1",
"http://thecolbertreport.cc.com/videos/nhkpwj/tad-devine"
],
"guest": "Tad Devine"
},
{
"date": "2008-02-07",
"videos": [
"http://thecolbertreport.cc.com/videos/ctzo98/stephen-s-ethnic-minute",
"http://thecolbertreport.cc.com/videos/v43el0/huckabee-s-still-in",
"http://thecolbertreport.cc.com/videos/negp2q/better-know-a-lobby---human-rights-campaign-pt--2",
"http://thecolbertreport.cc.com/videos/oxf63b/mark-moffett"
],
"guest": "Mark Moffett"
},
{
"date": "2008-02-11",
"videos": [
"http://thecolbertreport.cc.com/videos/bs8egm/obama-wins-a-grammy",
"http://thecolbertreport.cc.com/videos/lnkbna/goodbye-mitt",
"http://thecolbertreport.cc.com/videos/myptag/aubrey-de-grey",
"http://thecolbertreport.cc.com/videos/in3tg3/portrait-check-in",
"http://thecolbertreport.cc.com/videos/8sjpoa/philip-zimbardo"
],
"guest": "Aubrey de Grey, Philip Zimbardo"
},
{
"date": "2008-02-12",
"videos": [
"http://thecolbertreport.cc.com/videos/gucgvs/huckabee-s-obligation",
"http://thecolbertreport.cc.com/videos/6g98j7/eliot-spitzer",
"http://thecolbertreport.cc.com/videos/udbv19/eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/ekpicq/lisa-randall"
],
"guest": "Gov. Eliot Spitzer, Eleanor Holmes Norton, Lisa Randall"
},
{
"date": "2008-02-13",
"videos": [
"http://thecolbertreport.cc.com/videos/r9rjo5/intro---2-13-08",
"http://thecolbertreport.cc.com/videos/mvp1nc/the-writers-return-",
"http://thecolbertreport.cc.com/videos/n3dwin/david-gracer",
"http://thecolbertreport.cc.com/videos/aebxex/neil-de-grasse-tyson",
"http://thecolbertreport.cc.com/videos/n39iqt/richard-thompson-ford"
],
"guest": "David Gracer, Richard Thompson Ford"
},
{
"date": "2008-02-14",
"videos": [
"http://thecolbertreport.cc.com/videos/5hf18t/intro---2-14-08",
"http://thecolbertreport.cc.com/videos/qg63hg/who-s-riding-my-coattails-now----oliver-pocher",
"http://thecolbertreport.cc.com/videos/slbgcr/clemens-hearing",
"http://thecolbertreport.cc.com/videos/0i3hg8/john-feinstein",
"http://thecolbertreport.cc.com/videos/dmxs6z/people-who-are-destroying-america---happy-meal",
"http://thecolbertreport.cc.com/videos/hxt6mo/leonard-nimoy"
],
"guest": "John Feinstein, Leonard Nimoy"
},
{
"date": "2008-02-26",
"videos": [
"http://thecolbertreport.cc.com/videos/t6xzxc/intro---2-26-08",
"http://thecolbertreport.cc.com/videos/cexk3g/obama-s-photo",
"http://thecolbertreport.cc.com/videos/x6h69l/the-word---good-bad-journalism",
"http://thecolbertreport.cc.com/videos/4s0owa/henry-louis-gates-jr-"
],
"guest": "Henry Louis Gates Jr."
},
{
"date": "2008-02-27",
"videos": [
"http://thecolbertreport.cc.com/videos/3uzan2/exclusive---guitar-heroes",
"http://thecolbertreport.cc.com/videos/spigs3/intro---2-27-08",
"http://thecolbertreport.cc.com/videos/fb142a/mccain-rally",
"http://thecolbertreport.cc.com/videos/717g03/threatdown---air-colbert",
"http://thecolbertreport.cc.com/videos/ni7mzt/tony-snow"
],
"guest": "Tony Snow"
},
{
"date": "2008-02-28",
"videos": [
"http://thecolbertreport.cc.com/videos/upjayy/the-music-man",
"http://thecolbertreport.cc.com/videos/80mnx9/intro---2-28-08",
"http://thecolbertreport.cc.com/videos/wq9qga/russian-billboard",
"http://thecolbertreport.cc.com/videos/c64r8o/cold-war-update",
"http://thecolbertreport.cc.com/videos/zrhp7w/richard-brookhiser",
"http://thecolbertreport.cc.com/videos/n7g9t0/ingrid-newkirk",
"http://thecolbertreport.cc.com/videos/zsj0rq/sign-off---shoe-phone"
],
"guest": "Richard Brookhiser, Ingrid Newkirk"
},
{
"date": "2008-03-03",
"videos": [
"http://thecolbertreport.cc.com/videos/laopsy/intro---3-3-08",
"http://thecolbertreport.cc.com/videos/1gyoec/the-coveted-colbert-bump",
"http://thecolbertreport.cc.com/videos/do24ht/das-booty---hitler-s-gold-pt--1",
"http://thecolbertreport.cc.com/videos/dvfqt3/maestro-lorin-maazel",
"http://thecolbertreport.cc.com/videos/8llta1/shashi-tharoor",
"http://thecolbertreport.cc.com/videos/beqjns/leap-day"
],
"guest": "Lorin Maazel, Shashi Tharoor"
},
{
"date": "2008-03-04",
"videos": [
"http://thecolbertreport.cc.com/videos/1d4djp/intro---3-4-08",
"http://thecolbertreport.cc.com/videos/509s01/william-donohue",
"http://thecolbertreport.cc.com/videos/myyov6/howard-dean",
"http://thecolbertreport.cc.com/videos/wvt9ny/nailed--em---graffiti-punk",
"http://thecolbertreport.cc.com/videos/86yukf/jennifer-8--lee",
"http://thecolbertreport.cc.com/videos/10okbb/to-howard-dean",
"http://thecolbertreport.cc.com/videos/q08fbb/the-word---experience"
],
"guest": "William Donohue, Howard Dean, Jennifer 8. Lee"
},
{
"date": "2008-03-05",
"videos": [
"http://thecolbertreport.cc.com/videos/9o2e4d/intro---3-5-08",
"http://thecolbertreport.cc.com/videos/d60bre/farewell-brett-favre",
"http://thecolbertreport.cc.com/videos/q038rv/hucka-bye",
"http://thecolbertreport.cc.com/videos/6296yb/robert-reich",
"http://thecolbertreport.cc.com/videos/lrlzri/difference-makers---free-implants",
"http://thecolbertreport.cc.com/videos/z6yixf/gregory-rodriguez",
"http://thecolbertreport.cc.com/videos/p6i1w8/r-i-p--gary-gygax"
],
"guest": "Robert Reich, Gregory Rodriguez"
},
{
"date": "2008-03-06",
"videos": [
"http://thecolbertreport.cc.com/videos/zoimd4/intro---3-6-08",
"http://thecolbertreport.cc.com/videos/m9ob1y/hot-dog-with-the-president",
"http://thecolbertreport.cc.com/videos/i9idne/the-word---at---treason",
"http://thecolbertreport.cc.com/videos/0ih0ea/cheating-death---surgery",
"http://thecolbertreport.cc.com/videos/cv6bwa/john-legend"
],
"guest": "John Legend"
},
{
"date": "2008-03-10",
"videos": [
"http://thecolbertreport.cc.com/videos/mahtb2/intro---3-10-08",
"http://thecolbertreport.cc.com/videos/3a9bum/whores-",
"http://thecolbertreport.cc.com/videos/8p3t8b/the-word---size-matters",
"http://thecolbertreport.cc.com/videos/fdo5yd/the--72-democrats",
"http://thecolbertreport.cc.com/videos/7m46n6/george-mcgovern"
],
"guest": "George McGovern"
},
{
"date": "2008-03-11",
"videos": [
"http://thecolbertreport.cc.com/videos/3ybl08/intro---3-11-08",
"http://thecolbertreport.cc.com/videos/me89dy/spitzer-greeting-cards",
"http://thecolbertreport.cc.com/videos/twuo43/the-word---mr--right-now",
"http://thecolbertreport.cc.com/videos/f7ltv5/colbert-platinum---liechtenstein",
"http://thecolbertreport.cc.com/videos/gcwzrr/geraldo-rivera",
"http://thecolbertreport.cc.com/videos/8h6jvx/sign-off---show-s-over--america"
],
"guest": "Geraldo Rivera"
},
{
"date": "2008-03-12",
"videos": [
"http://thecolbertreport.cc.com/videos/tvzv05/intro---3-12-08",
"http://thecolbertreport.cc.com/videos/ntzxtt/spitzer-sandwich",
"http://thecolbertreport.cc.com/videos/ippftn/smokin--pole---alaska",
"http://thecolbertreport.cc.com/videos/50a47x/better-know-a-lobby---drug-policy-alliance",
"http://thecolbertreport.cc.com/videos/nouiem/howard-kurtz"
],
"guest": "Howard Kurtz"
},
{
"date": "2008-03-13",
"videos": [
"http://thecolbertreport.cc.com/videos/gpd5cu/intro---3-13-08",
"http://thecolbertreport.cc.com/videos/k8bsjv/airborne-lawsuit",
"http://thecolbertreport.cc.com/videos/d51tqz/democralypse-now---ferraro",
"http://thecolbertreport.cc.com/videos/tvjvip/hussein-ibish",
"http://thecolbertreport.cc.com/videos/oe7yd2/difference-makers---doug-jackson",
"http://thecolbertreport.cc.com/videos/mzut29/sudhir-venkatesh"
],
"guest": "Hussein Ibish, Sudhir Venkatesh"
},
{
"date": "2008-03-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ck2j7u/exclusive---spitzer",
"http://thecolbertreport.cc.com/videos/8zfc9q/intro---3-17-08",
"http://thecolbertreport.cc.com/videos/v28dea/stephen-in-philly",
"http://thecolbertreport.cc.com/videos/rxdrv8/the-word---the-audacity-of-hopelessness",
"http://thecolbertreport.cc.com/videos/tw4jo4/people-who-are-destroying-america---st--patrick-s-day",
"http://thecolbertreport.cc.com/videos/5j8sg4/samantha-power"
],
"guest": "Samantha Power"
},
{
"date": "2008-03-18",
"videos": [
"http://thecolbertreport.cc.com/videos/vgwiie/intro---3-18-08",
"http://thecolbertreport.cc.com/videos/wsz08m/yes-we-can-",
"http://thecolbertreport.cc.com/videos/xtwx8p/spicy-sweet-coverage",
"http://thecolbertreport.cc.com/videos/mogf73/das-booty---hitler-s-gold-pt--2",
"http://thecolbertreport.cc.com/videos/5boih5/carole-king"
],
"guest": "Carole King"
},
{
"date": "2008-03-19",
"videos": [
"http://thecolbertreport.cc.com/videos/hcafrk/intro---3-19-08",
"http://thecolbertreport.cc.com/videos/hrjm1z/patterson-affair",
"http://thecolbertreport.cc.com/videos/scqdwy/the-word---the-gospel-of-john",
"http://thecolbertreport.cc.com/videos/y6aybj/pennsylvania-primary",
"http://thecolbertreport.cc.com/videos/037ygf/tip-wag---afghanistan",
"http://thecolbertreport.cc.com/videos/vk922m/dee-dee-myers"
],
"guest": "Dee Dee Myers"
},
{
"date": "2008-03-20",
"videos": [
"http://thecolbertreport.cc.com/videos/vq76dq/watershift-down--getting-the-sea-monkey-off-america-s-aqua-back",
"http://thecolbertreport.cc.com/videos/wkdrt1/aqua-colbert",
"http://thecolbertreport.cc.com/videos/l1sl1c/water-is-life",
"http://thecolbertreport.cc.com/videos/3mtvfm/dean-kamen",
"http://thecolbertreport.cc.com/videos/4y9sds/setting-water-on-fire"
],
"guest": "Dean Kamen"
},
{
"date": "2008-03-31",
"videos": [
"http://thecolbertreport.cc.com/videos/f3rbbv/intro---3-31-08",
"http://thecolbertreport.cc.com/videos/aqkiox/opening-day",
"http://thecolbertreport.cc.com/videos/0fo1qd/bowling-in-pa",
"http://thecolbertreport.cc.com/videos/2ii77j/eric-alterman",
"http://thecolbertreport.cc.com/videos/b149k1/tek-jansen---beginning-s-first-dawn--episode-one-revisited",
"http://thecolbertreport.cc.com/videos/3p6caw/michael-reynolds"
],
"guest": "Eric Alterman, Michael Reynolds"
},
{
"date": "2008-04-01",
"videos": [
"http://thecolbertreport.cc.com/videos/ayieu5/intro---4-1-08",
"http://thecolbertreport.cc.com/videos/irlo9m/portrait-update",
"http://thecolbertreport.cc.com/videos/inwuqm/the-word---pick-sicks",
"http://thecolbertreport.cc.com/videos/fpyy9k/bears---balls---rat-rakes",
"http://thecolbertreport.cc.com/videos/700kdb/van-jones",
"http://thecolbertreport.cc.com/videos/lrepiq/portrait-displayed"
],
"guest": "Van Jones"
},
{
"date": "2008-04-02",
"videos": [
"http://thecolbertreport.cc.com/videos/46s8py/intro---4-2-08",
"http://thecolbertreport.cc.com/videos/sbidx5/stephen-wins-a-peabody",
"http://thecolbertreport.cc.com/videos/3fc86e/threatdown---nipples",
"http://thecolbertreport.cc.com/videos/n3f5qh/r-e-m-"
],
"guest": "R.E.M."
},
{
"date": "2008-04-03",
"videos": [
"http://thecolbertreport.cc.com/videos/aj43z8/intro---4-3-08",
"http://thecolbertreport.cc.com/videos/tyapiy/peabody-credit",
"http://thecolbertreport.cc.com/videos/xwlefp/the-word---let-the-games-begin",
"http://thecolbertreport.cc.com/videos/gx1oov/tek-jansen---beginning-s-first-dawn--episode-two",
"http://thecolbertreport.cc.com/videos/dm9a7h/clay-shirky",
"http://thecolbertreport.cc.com/videos/jsqez9/tek-jansen---you-are-the-best"
],
"guest": "Clay Shirky"
},
{
"date": "2008-04-07",
"videos": [
"http://thecolbertreport.cc.com/videos/7lye0f/intro---4-7-08",
"http://thecolbertreport.cc.com/videos/we6e20/r-i-p--charlton-heston",
"http://thecolbertreport.cc.com/videos/xh2gv1/trevor-paglen",
"http://thecolbertreport.cc.com/videos/3xlgs3/democralypse-now---3am",
"http://thecolbertreport.cc.com/videos/82gipv/jesse-ventura"
],
"guest": "Trevor Paglen, Jesse Ventura"
},
{
"date": "2008-04-08",
"videos": [
"http://thecolbertreport.cc.com/videos/54jfl6/intro---4-8-08",
"http://thecolbertreport.cc.com/videos/yme30m/pope-coming-to-nyc",
"http://thecolbertreport.cc.com/videos/g0ke6u/children-s-drawings",
"http://thecolbertreport.cc.com/videos/0dimmt/wilford-brimley-calls---donation",
"http://thecolbertreport.cc.com/videos/elawer/madeleine-albright"
],
"guest": "Madeleine Albright"
},
{
"date": "2008-04-09",
"videos": [
"http://thecolbertreport.cc.com/videos/bdme3x/intro---4-9-08",
"http://thecolbertreport.cc.com/videos/iekisu/olympic-torch",
"http://thecolbertreport.cc.com/videos/ypse7c/the-word---starter-country",
"http://thecolbertreport.cc.com/videos/jycq7p/cheating-death---sexual-health",
"http://thecolbertreport.cc.com/videos/nlvpn4/jeff-gore"
],
"guest": "Jeff Gore"
},
{
"date": "2008-04-10",
"videos": [
"http://thecolbertreport.cc.com/videos/zsmonm/intro---4-10-08",
"http://thecolbertreport.cc.com/videos/6sdfwa/petraeus-hearings",
"http://thecolbertreport.cc.com/videos/x8pxwi/more-drawings-from-kids",
"http://thecolbertreport.cc.com/videos/z2z65o/the-word---black-and-white",
"http://thecolbertreport.cc.com/videos/v1k50e/tip-wag---rain",
"http://thecolbertreport.cc.com/videos/torkh7/robin-wright"
],
"guest": "Robin Wright"
},
{
"date": "2008-04-14",
"videos": [
"http://thecolbertreport.cc.com/videos/qfrdo9/from-philadelphia",
"http://thecolbertreport.cc.com/videos/5phute/pennsylvania-primary-history",
"http://thecolbertreport.cc.com/videos/1b60fj/chris-matthews"
],
"guest": "Chris Matthews"
},
{
"date": "2008-04-15",
"videos": [
"http://thecolbertreport.cc.com/videos/oj9blc/intro---4-15-08",
"http://thecolbertreport.cc.com/videos/3aqwqx/nice-roomba",
"http://thecolbertreport.cc.com/videos/ad5qga/the-word---tradition",
"http://thecolbertreport.cc.com/videos/7unrts/independence-park",
"http://thecolbertreport.cc.com/videos/upl7xe/michelle-obama"
],
"guest": "Michelle Obama, The Roots"
},
{
"date": "2008-04-16",
"videos": [
"http://thecolbertreport.cc.com/videos/h0lfw9/intro---4-16-08",
"http://thecolbertreport.cc.com/videos/pi51oz/jackie-o--amendment",
"http://thecolbertreport.cc.com/videos/9z3000/democralypse-now---the-boss",
"http://thecolbertreport.cc.com/videos/9zm7cy/national-constitution-center",
"http://thecolbertreport.cc.com/videos/51r39w/ed-rendell",
"http://thecolbertreport.cc.com/videos/1bzrgk/benjamin-franklin-s-news"
],
"guest": "Philadelphia Eagles Cheerleaders, Gov. Ed Rendell"
},
{
"date": "2008-04-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ky7oxg/benjamin-franklin-s-latest-invention",
"http://thecolbertreport.cc.com/videos/uzusr0/hillary-clinton-takes-on-technical-difficulties",
"http://thecolbertreport.cc.com/videos/1i62sd/clinton-vs--obama-philadelphia-debate-review",
"http://thecolbertreport.cc.com/videos/ew5t9y/patrick-murphy",
"http://thecolbertreport.cc.com/videos/x3zme5/the-ed-words---valued-voter",
"http://thecolbertreport.cc.com/videos/ol0nn3/on-notice---barack-obama-against-distractions"
],
"guest": "Hillary Clinton, John Edwards, Barack Obama"
},
{
"date": "2008-04-21",
"videos": [
"http://thecolbertreport.cc.com/videos/i6ihlp/intro---4-21-08",
"http://thecolbertreport.cc.com/videos/foffke/philly-loves-colbert-nation",
"http://thecolbertreport.cc.com/videos/5jm58y/global-food-shortage",
"http://thecolbertreport.cc.com/videos/ehgxth/father-james-martin",
"http://thecolbertreport.cc.com/videos/oo6wpp/bernie-sanders",
"http://thecolbertreport.cc.com/videos/e7gpah/farewell-to-bobby"
],
"guest": "Fr. James Martin, Sen. Bernie Sanders"
},
{
"date": "2008-04-22",
"videos": [
"http://thecolbertreport.cc.com/videos/ah79bq/intro---4-22-08",
"http://thecolbertreport.cc.com/videos/tp640v/earth-is-awesome",
"http://thecolbertreport.cc.com/videos/uyxyc7/obama-copycattery",
"http://thecolbertreport.cc.com/videos/a2ha6c/indecision-cheesesteaks",
"http://thecolbertreport.cc.com/videos/0nsiap/better-know-a-district---pennsylvania-s-7th---joe-sestak",
"http://thecolbertreport.cc.com/videos/5427ng/susan-jacoby",
"http://thecolbertreport.cc.com/videos/l34czb/exclusive---better-know-a-district---pennsylvania-s-7th---joe-sestak"
],
"guest": "Susan Jacoby"
},
{
"date": "2008-04-23",
"videos": [
"http://thecolbertreport.cc.com/videos/lxpsri/intro---4-23-08",
"http://thecolbertreport.cc.com/videos/6wperh/rain-rivalry-challenge",
"http://thecolbertreport.cc.com/videos/hpr26d/the-word---iraq-the-vote",
"http://thecolbertreport.cc.com/videos/fqo64s/colbert-platinum---cat-pooped-coffee",
"http://thecolbertreport.cc.com/videos/5azl7m/mitch-albom",
"http://thecolbertreport.cc.com/videos/qdf6zq/the-lost-o-reilly-tapes-pt--1"
],
"guest": "Mitch Albom"
},
{
"date": "2008-04-24",
"videos": [
"http://thecolbertreport.cc.com/videos/6kux9r/intro---4-24-08",
"http://thecolbertreport.cc.com/videos/a1qle2/petraeus--promotion",
"http://thecolbertreport.cc.com/videos/uddwea/threatdown---juicing-bulls",
"http://thecolbertreport.cc.com/videos/e3l9yt/difference-makers---bumbot",
"http://thecolbertreport.cc.com/videos/lr9uai/maria-shriver"
],
"guest": "Maria Shriver"
},
{
"date": "2008-04-28",
"videos": [
"http://thecolbertreport.cc.com/videos/3fwic4/intro---4-28-08",
"http://thecolbertreport.cc.com/videos/244o0l/miley-cyrus-photo-shoot",
"http://thecolbertreport.cc.com/videos/9v4qwg/electability",
"http://thecolbertreport.cc.com/videos/ejbmnx/the-word---kernel-of-truth",
"http://thecolbertreport.cc.com/videos/3osshb/sport-report---timbersports",
"http://thecolbertreport.cc.com/videos/222rjo/feist"
],
"guest": "Feist"
},
{
"date": "2008-04-29",
"videos": [
"http://thecolbertreport.cc.com/videos/a1muh6/intro---4-29-08",
"http://thecolbertreport.cc.com/videos/vc3sa7/obama-breaks-with-wright",
"http://thecolbertreport.cc.com/videos/uk74h6/mccain-s-superstitions",
"http://thecolbertreport.cc.com/videos/ry65tk/the-word---separation-of-church---plate",
"http://thecolbertreport.cc.com/videos/cy9dmw/tip-wag---barbie",
"http://thecolbertreport.cc.com/videos/s3buaq/anne-lamott"
],
"guest": "Anne Lamott"
},
{
"date": "2008-04-30",
"videos": [
"http://thecolbertreport.cc.com/videos/byoxj1/intro---4-30-08",
"http://thecolbertreport.cc.com/videos/xju86c/salinger-watch",
"http://thecolbertreport.cc.com/videos/1rdkem/donna-brazile-on-the-democratic-campaign",
"http://thecolbertreport.cc.com/videos/4ngs9u/better-know-a-protectorate---guam---madeleine-bordallo-update",
"http://thecolbertreport.cc.com/videos/vjk2cd/noah-feldman"
],
"guest": "Donna Brazile, Noah Feldman"
},
{
"date": "2008-05-01",
"videos": [
"http://thecolbertreport.cc.com/videos/1zd3gn/intro---5-01-08",
"http://thecolbertreport.cc.com/videos/clfbo3/jenna-bush-wedding",
"http://thecolbertreport.cc.com/videos/sctmlw/trailers-destroying-america---summer-movie-edition",
"http://thecolbertreport.cc.com/videos/aka0f3/formidable-opponent---electability",
"http://thecolbertreport.cc.com/videos/zck6ux/james-howard-kunstler"
],
"guest": "James Kunstler"
},
{
"date": "2008-05-05",
"videos": [
"http://thecolbertreport.cc.com/videos/nhsr7z/intro---5-05-08",
"http://thecolbertreport.cc.com/videos/wtbn4l/time-s-2008-top-100-most-influential",
"http://thecolbertreport.cc.com/videos/x20ttg/the-word---free-gas-",
"http://thecolbertreport.cc.com/videos/oov14y/speed-racer",
"http://thecolbertreport.cc.com/videos/91hddq/alpha-dog-of-the-week---911-operator",
"http://thecolbertreport.cc.com/videos/2uj60r/carl-hiaasen",
"http://thecolbertreport.cc.com/videos/k44vbf/rain-dance-off"
],
"guest": "Carl Hiaasen"
},
{
"date": "2008-05-06",
"videos": [
"http://thecolbertreport.cc.com/videos/e38w0k/intro---5-06-08",
"http://thecolbertreport.cc.com/videos/e3fb1q/sexy-voice-study",
"http://thecolbertreport.cc.com/videos/qy6hoq/the-word---collateral-friendage",
"http://thecolbertreport.cc.com/videos/byyq8n/stephen-s-sound-advice---karl-s-advice",
"http://thecolbertreport.cc.com/videos/y777b4/nathan-gunn"
],
"guest": "Nathan Gunn"
},
{
"date": "2008-05-07",
"videos": [
"http://thecolbertreport.cc.com/videos/fk83lx/intro---5-07-08",
"http://thecolbertreport.cc.com/videos/20qjta/stephen-colbert-s-shockettes",
"http://thecolbertreport.cc.com/videos/su4v1v/terrorist-nelson-mandela",
"http://thecolbertreport.cc.com/videos/07p71k/hasan-elahi",
"http://thecolbertreport.cc.com/videos/bc4u9e/democralypse-now---justin-myers",
"http://thecolbertreport.cc.com/videos/av0o9p/george-johnson"
],
"guest": "Hasan Elahi, George Johnson"
},
{
"date": "2008-05-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ey98z2/exclusive---stephen-vs--rain",
"http://thecolbertreport.cc.com/videos/6wn8i5/garrett-reisman",
"http://thecolbertreport.cc.com/videos/qnk6x8/gas-dollar",
"http://thecolbertreport.cc.com/videos/txq3hp/arianna-huffington",
"http://thecolbertreport.cc.com/videos/uafvva/r-i-p--albert-hoffman"
],
"guest": "Arianna Huffington"
},
{
"date": "2008-05-12",
"videos": [
"http://thecolbertreport.cc.com/videos/da4u0g/intro---5-12-08",
"http://thecolbertreport.cc.com/videos/tj7sih/big-russ",
"http://thecolbertreport.cc.com/videos/kdeptj/cold-war-update---russia",
"http://thecolbertreport.cc.com/videos/k7k3ke/threatdown---cute-bears",
"http://thecolbertreport.cc.com/videos/3i279j/dr--mehmet-oz"
],
"guest": "Dr. Mehmet Oz"
},
{
"date": "2008-05-13",
"videos": [
"http://thecolbertreport.cc.com/videos/oycul0/exclusive---better-know-a-lobby---brady-campaign-to-prevent-gun-violence",
"http://thecolbertreport.cc.com/videos/1siped/intro---5-13-08",
"http://thecolbertreport.cc.com/videos/mpq03a/hillary-drop-out",
"http://thecolbertreport.cc.com/videos/qxr59r/bill-o-reilly-inside-edition",
"http://thecolbertreport.cc.com/videos/np2mes/better-know-a-lobby---brady-campaign-to-prevent-gun-violence",
"http://thecolbertreport.cc.com/videos/24b8xh/jennifer-hooper-mccarty"
],
"guest": "Jennifer Hooper McCarty"
},
{
"date": "2008-05-14",
"videos": [
"http://thecolbertreport.cc.com/videos/suewpq/intro---5-14-08",
"http://thecolbertreport.cc.com/videos/fygt2g/edwards-supports-obama",
"http://thecolbertreport.cc.com/videos/ry9ff3/who-s-not-honoring-me-now----science",
"http://thecolbertreport.cc.com/videos/xnkjrq/the-word---declaration-of-warming",
"http://thecolbertreport.cc.com/videos/gxghyw/laura-dern",
"http://thecolbertreport.cc.com/videos/4tldfc/grover-norquist",
"http://thecolbertreport.cc.com/videos/zujfq0/the-show-comes-to-an-end"
],
"guest": "Laura Dern, Grover Norquist"
},
{
"date": "2008-05-15",
"videos": [
"http://thecolbertreport.cc.com/videos/nkmoxa/intro---5-15-08",
"http://thecolbertreport.cc.com/videos/ekfqs4/american-craft-beer-week",
"http://thecolbertreport.cc.com/videos/wy0c00/edwards-endorses-obama",
"http://thecolbertreport.cc.com/videos/scm34l/the-word---jail-sweet-jail",
"http://thecolbertreport.cc.com/videos/ak0o7t/bears---balls---dollar-stores",
"http://thecolbertreport.cc.com/videos/rarvxz/andrei-cherny"
],
"guest": "Andrei Cherny"
},
{
"date": "2008-05-27",
"videos": [
"http://thecolbertreport.cc.com/videos/v79z0o/intro---5-27-08",
"http://thecolbertreport.cc.com/videos/k0kiom/fleet-week",
"http://thecolbertreport.cc.com/videos/xuhumb/mccain-s-preachers",
"http://thecolbertreport.cc.com/videos/dxmleo/tony-perkins",
"http://thecolbertreport.cc.com/videos/o5c67w/brian-greene"
],
"guest": "Tony Perkins, Brian Greene"
},
{
"date": "2008-05-28",
"videos": [
"http://thecolbertreport.cc.com/videos/tuxwuw/intro---5-28-08",
"http://thecolbertreport.cc.com/videos/euhkkf/microbe-beat-",
"http://thecolbertreport.cc.com/videos/z1nl4c/the-word---brushback-pitch",
"http://thecolbertreport.cc.com/videos/jhmlmk/cheating-death---liquid-launch",
"http://thecolbertreport.cc.com/videos/ngaz1d/claire-mccaskill"
],
"guest": "Sen. Claire McCaskill"
},
{
"date": "2008-05-29",
"videos": [
"http://thecolbertreport.cc.com/videos/6wfa6q/intro---5-29-08",
"http://thecolbertreport.cc.com/videos/79u1cf/shout-out----broken-space-toilet",
"http://thecolbertreport.cc.com/videos/6735i1/democralypse-now---florida-and-michigan",
"http://thecolbertreport.cc.com/videos/ug78n1/tad-devine",
"http://thecolbertreport.cc.com/videos/lhma93/tip-wag---monetary-discrimination",
"http://thecolbertreport.cc.com/videos/3qprbm/david-sirota",
"http://thecolbertreport.cc.com/videos/g0kftc/sneak-preview"
],
"guest": "Tad Devine, David Sirota"
},
{
"date": "2008-06-02",
"videos": [
"http://thecolbertreport.cc.com/videos/hrlfp0/intro---6-02-08",
"http://thecolbertreport.cc.com/videos/dvmsby/obama-s-church",
"http://thecolbertreport.cc.com/videos/38jpc2/fire-at-universal",
"http://thecolbertreport.cc.com/videos/jlvsj6/the-word---media-culpa",
"http://thecolbertreport.cc.com/videos/8cygn0/colbert-platinum---private-jets",
"http://thecolbertreport.cc.com/videos/p0u6f8/jon-paskowitz",
"http://thecolbertreport.cc.com/videos/piym7c/final-thought"
],
"guest": "Jon Paskowitz"
},
{
"date": "2008-06-03",
"videos": [
"http://thecolbertreport.cc.com/videos/4vr7xb/intro---6-03-08",
"http://thecolbertreport.cc.com/videos/o005k6/democratic-primaries-over",
"http://thecolbertreport.cc.com/videos/viwun3/the-word---unhealthy-competition",
"http://thecolbertreport.cc.com/videos/po30h9/stephen-s-sound-advice---summer-jobs",
"http://thecolbertreport.cc.com/videos/xhigi4/george-will"
],
"guest": "George Will"
},
{
"date": "2008-06-04",
"videos": [
"http://thecolbertreport.cc.com/videos/0w2khv/intro---6-04-08",
"http://thecolbertreport.cc.com/videos/hfq15q/john-mccain-s-green-screen-challenge",
"http://thecolbertreport.cc.com/videos/wsbc0i/libertarian-party---bob-barr",
"http://thecolbertreport.cc.com/videos/sn90ui/salman-rushdie",
"http://thecolbertreport.cc.com/videos/uji4o5/the-lost-o-reilly-tapes-pt--2"
],
"guest": "Rep. Bob Barr, Salman Rushdie"
},
{
"date": "2008-06-05",
"videos": [
"http://thecolbertreport.cc.com/videos/yv02dd/intro---6-05-08",
"http://thecolbertreport.cc.com/videos/n90wjr/the-andromeda-strain",
"http://thecolbertreport.cc.com/videos/ugt12v/the-word---oh--the-places-you-ll-stay",
"http://thecolbertreport.cc.com/videos/6nrkel/sport-report---mike-forrester",
"http://thecolbertreport.cc.com/videos/ibt0j9/pat-buchanan"
],
"guest": "Pat Buchanan"
},
{
"date": "2008-06-09",
"videos": [
"http://thecolbertreport.cc.com/videos/qowh4f/intro---6-09-08",
"http://thecolbertreport.cc.com/videos/icuy8o/democralypse-now---hillary-concedes",
"http://thecolbertreport.cc.com/videos/numnri/the-word---if-at-first-you-don-t-secede",
"http://thecolbertreport.cc.com/videos/vlab0d/threatdown---secret-negro-presidents",
"http://thecolbertreport.cc.com/videos/gv27al/philip-weiss"
],
"guest": "Phil Weiss"
},
{
"date": "2008-06-10",
"videos": [
"http://thecolbertreport.cc.com/videos/705tqw/intro---6-10-08",
"http://thecolbertreport.cc.com/videos/cbjixz/new-giant-iphone",
"http://thecolbertreport.cc.com/videos/w5you4/tickling-the-rocks",
"http://thecolbertreport.cc.com/videos/skw5sl/the-elitist-menace-among-us",
"http://thecolbertreport.cc.com/videos/qhpj5f/smokin--pole---canada-s-hockey-theme",
"http://thecolbertreport.cc.com/videos/9bdggo/alan-rabinowitz"
],
"guest": "Alan Rabinowitz"
},
{
"date": "2008-06-11",
"videos": [
"http://thecolbertreport.cc.com/videos/373j1n/intro---6-11-08",
"http://thecolbertreport.cc.com/videos/gbgmuk/israel-s-new-bird",
"http://thecolbertreport.cc.com/videos/twddgu/the-word---u-s--airweighs",
"http://thecolbertreport.cc.com/videos/pp8c40/un-american-news---u-s--election-edition",
"http://thecolbertreport.cc.com/videos/zudzs0/david-hajdu",
"http://thecolbertreport.cc.com/videos/idly59/memorized-script"
],
"guest": "David Hajdu"
},
{
"date": "2008-06-12",
"videos": [
"http://thecolbertreport.cc.com/videos/mpfrre/intro---6-12-08",
"http://thecolbertreport.cc.com/videos/nsgvgc/stephen-colbert-s-make-mccain-exciting-challenge-",
"http://thecolbertreport.cc.com/videos/86su5q/winona-laduke",
"http://thecolbertreport.cc.com/videos/qrbimj/we-the-mediator",
"http://thecolbertreport.cc.com/videos/t6nh85/dickson-despommier"
],
"guest": "Winona LaDuke, Dixon Despommier"
},
{
"date": "2008-06-16",
"videos": [
"http://thecolbertreport.cc.com/videos/vnwwom/intro---6-16-08",
"http://thecolbertreport.cc.com/videos/6vk2ye/tim-russert-tribute",
"http://thecolbertreport.cc.com/videos/mpqoje/the-word---ploy-cott",
"http://thecolbertreport.cc.com/videos/cqvvlk/the-enemy-within---wizard-teachers",
"http://thecolbertreport.cc.com/videos/8xg385/kenneth-miller"
],
"guest": "Kenneth R. Miller"
},
{
"date": "2008-06-17",
"videos": [
"http://thecolbertreport.cc.com/videos/jfofbj/intro---6-17-08",
"http://thecolbertreport.cc.com/videos/kwlu8o/peabody-award",
"http://thecolbertreport.cc.com/videos/tapfcu/neal-katyal",
"http://thecolbertreport.cc.com/videos/fuhy6f/sport-report---timbersports-championship",
"http://thecolbertreport.cc.com/videos/vcz3hv/jonathan-zittrain",
"http://thecolbertreport.cc.com/videos/ci1ljt/peabody-on-mantel"
],
"guest": "Neal Katyal, Jonathan Zittrain"
},
{
"date": "2008-06-18",
"videos": [
"http://thecolbertreport.cc.com/videos/b2ddmd/intro---6-18-08",
"http://thecolbertreport.cc.com/videos/prx5o1/the-new-smurfs-movie",
"http://thecolbertreport.cc.com/videos/ciovvr/the-word---lexicon-artist",
"http://thecolbertreport.cc.com/videos/vtx5qc/barack-obama-s-church-search---dr--uma-mysorekar",
"http://thecolbertreport.cc.com/videos/ir7gne/junot-diaz"
],
"guest": "Dr. Uma Mysorekar, Junot Diaz"
},
{
"date": "2008-06-19",
"videos": [
"http://thecolbertreport.cc.com/videos/d6b6nb/intro---6-19-08",
"http://thecolbertreport.cc.com/videos/6sj17e/shout-out---peabody-awards",
"http://thecolbertreport.cc.com/videos/mr1053/sean-hannity-loves-america",
"http://thecolbertreport.cc.com/videos/zcd35g/cookie-monster",
"http://thecolbertreport.cc.com/videos/aytt4h/make-mccain-exciting-challenge---the-secret-of-mccain-s-brain",
"http://thecolbertreport.cc.com/videos/m7daav/bishop-n-t--wright",
"http://thecolbertreport.cc.com/videos/der3el/stephen-s-missing-peabody"
],
"guest": "Bishop N.T. Wright"
},
{
"date": "2008-06-23",
"videos": [
"http://thecolbertreport.cc.com/videos/ua8qbe/intro---6-23-08",
"http://thecolbertreport.cc.com/videos/a4nt5i/wriststrong-anniversary",
"http://thecolbertreport.cc.com/videos/kj72hq/the-word---black-and-white",
"http://thecolbertreport.cc.com/videos/vlidof/tip-wag---barack-obama",
"http://thecolbertreport.cc.com/videos/ymze92/barbara-ehrenreich",
"http://thecolbertreport.cc.com/videos/1f40by/sign-off---time-for-stephen-to-watch"
],
"guest": "Barbara Ehrenreich"
},
{
"date": "2008-06-24",
"videos": [
"http://thecolbertreport.cc.com/videos/mhd7wr/intro---6-24-08",
"http://thecolbertreport.cc.com/videos/n11h6w/hollywood-face-violence",
"http://thecolbertreport.cc.com/videos/ov4362/oil-crisis",
"http://thecolbertreport.cc.com/videos/hxtoyj/the-word---bleep",
"http://thecolbertreport.cc.com/videos/f5yznc/dr--jason-bond",
"http://thecolbertreport.cc.com/videos/ilejmp/will-smith"
],
"guest": "Jason Bond, Will Smith"
},
{
"date": "2008-06-25",
"videos": [
"http://thecolbertreport.cc.com/videos/mdtg3q/intro---6-25-08",
"http://thecolbertreport.cc.com/videos/q0qc77/paul-goldberger",
"http://thecolbertreport.cc.com/videos/ajsxzq/judge--jury---executioner---whales",
"http://thecolbertreport.cc.com/videos/zucjth/neil-degrasse-tyson",
"http://thecolbertreport.cc.com/videos/2r47v6/stephen-s-gun"
],
"guest": "Paul Goldberger, Neil deGrasse Tyson"
},
{
"date": "2008-06-26",
"videos": [
"http://thecolbertreport.cc.com/videos/gvc60t/intro---6-26-08",
"http://thecolbertreport.cc.com/videos/038ej3/stephen-and-sweetness",
"http://thecolbertreport.cc.com/videos/txteih/the-tank-is-half-full---criminals",
"http://thecolbertreport.cc.com/videos/hdan1z/difference-makers---steve-pelkey",
"http://thecolbertreport.cc.com/videos/6vucxh/robert-wexler",
"http://thecolbertreport.cc.com/videos/s7cul5/stephen-packs-for-his-trip"
],
"guest": "Rep. Robert Wexler"
},
{
"date": "2008-07-14",
"videos": [
"http://thecolbertreport.cc.com/videos/a4vl00/intro---7-14-08",
"http://thecolbertreport.cc.com/videos/t1ic5h/belgians-buy-budweiser",
"http://thecolbertreport.cc.com/videos/e8zxmm/the-word---priceless",
"http://thecolbertreport.cc.com/videos/6fnysv/barack-obama-s-church-search---lama-surya-das",
"http://thecolbertreport.cc.com/videos/iuafl5/daniel-c--esty",
"http://thecolbertreport.cc.com/videos/zeelo6/one-last-sip"
],
"guest": "Lama Surya Das, Daniel C. Esty"
},
{
"date": "2008-07-15",
"videos": [
"http://thecolbertreport.cc.com/videos/btd58c/intro---7-15-08",
"http://thecolbertreport.cc.com/videos/iojfbw/the-new-yorker-cover",
"http://thecolbertreport.cc.com/videos/4r3fs4/julia-e--sweig",
"http://thecolbertreport.cc.com/videos/slbivd/difference-makers---donald-trump",
"http://thecolbertreport.cc.com/videos/w3v1ei/jason-riley"
],
"guest": "Julia E. Sweig, Jason Riley"
},
{
"date": "2008-07-16",
"videos": [
"http://thecolbertreport.cc.com/videos/apzepe/intro---7-16-08",
"http://thecolbertreport.cc.com/videos/nxgrjc/rush-is-here",
"http://thecolbertreport.cc.com/videos/u9v0kj/the-word---placebo",
"http://thecolbertreport.cc.com/videos/r6ylvr/alpha-dog-of-the-week---george-w--bush"
],
"guest": "Rush"
},
{
"date": "2008-07-17",
"videos": [
"http://thecolbertreport.cc.com/videos/fv156w/intro---7-17-08",
"http://thecolbertreport.cc.com/videos/hy6e1y/ofec",
"http://thecolbertreport.cc.com/videos/fdazma/tip-wag---9-11-billboard",
"http://thecolbertreport.cc.com/videos/75y9kg/green-screen-challenge---bill-o-reilly-rant",
"http://thecolbertreport.cc.com/videos/ti6y23/elizabeth-edwards",
"http://thecolbertreport.cc.com/videos/2i4pii/esquire-cover"
],
"guest": "Elizabeth Edwards"
},
{
"date": "2008-07-21",
"videos": [
"http://thecolbertreport.cc.com/videos/ypasrv/exclusive---better-know-a-lobby---sierra-club",
"http://thecolbertreport.cc.com/videos/298hev/intro---7-21-08",
"http://thecolbertreport.cc.com/videos/2uxo91/barack-obama-s-elitist-summer-abroad",
"http://thecolbertreport.cc.com/videos/ytt7lh/better-know-a-lobby---sierra-club",
"http://thecolbertreport.cc.com/videos/7zt9o1/jim-webb"
],
"guest": "Sen. Jim Webb"
},
{
"date": "2008-07-22",
"videos": [
"http://thecolbertreport.cc.com/videos/isgn6o/intro---7-22-08",
"http://thecolbertreport.cc.com/videos/5us80y/obama-s-trip",
"http://thecolbertreport.cc.com/videos/twxrmk/the-word---fight-to-the-furnish",
"http://thecolbertreport.cc.com/videos/g536lz/elton-john-s-new-ice-cream",
"http://thecolbertreport.cc.com/videos/dqvjy7/south-carolina-is-so-gay",
"http://thecolbertreport.cc.com/videos/ypbiy1/margaret-spellings"
],
"guest": "Margaret Spellings"
},
{
"date": "2008-07-23",
"videos": [
"http://thecolbertreport.cc.com/videos/ephzov/intro---7-23-08",
"http://thecolbertreport.cc.com/videos/008wql/starbucks-closings",
"http://thecolbertreport.cc.com/videos/ckerul/the-word---join-the-european-union",
"http://thecolbertreport.cc.com/videos/p099m0/colorofchange-org-petition",
"http://thecolbertreport.cc.com/videos/ef4747/nas-pt--1"
],
"guest": "Nas"
},
{
"date": "2008-07-24",
"videos": [
"http://thecolbertreport.cc.com/videos/9e4ipx/intro---7-24-08",
"http://thecolbertreport.cc.com/videos/mzk1jw/john-mccain-s-sausage-party",
"http://thecolbertreport.cc.com/videos/y6db2n/laurie-goodstein",
"http://thecolbertreport.cc.com/videos/oyh9ck/threatdown---greek-courts",
"http://thecolbertreport.cc.com/videos/qkxsxv/garrett-reisman",
"http://thecolbertreport.cc.com/videos/my4p2n/decoder-rings"
],
"guest": "Laurie Goodstein, Garrett Reisman"
},
{
"date": "2008-07-28",
"videos": [
"http://thecolbertreport.cc.com/videos/5mv6ij/intro---7-28-08",
"http://thecolbertreport.cc.com/videos/ahi7x5/obama-returns",
"http://thecolbertreport.cc.com/videos/n5o1z2/heroic-refusal-to-discuss-robert-novak",
"http://thecolbertreport.cc.com/videos/wksh33/trigger-happy---d-c--v--heller",
"http://thecolbertreport.cc.com/videos/2fxv2r/toby-keith"
],
"guest": "Toby Keith"
},
{
"date": "2008-07-29",
"videos": [
"http://thecolbertreport.cc.com/videos/8y4ush/intro---7-29-08",
"http://thecolbertreport.cc.com/videos/ft9iza/mccain-s-mustache",
"http://thecolbertreport.cc.com/videos/je97nz/the-word---honest-belief",
"http://thecolbertreport.cc.com/videos/079fu3/better-know-a-district---new-york-s-14th---carolyn-maloney",
"http://thecolbertreport.cc.com/videos/4pok23/eric-roston"
],
"guest": "Eric Roston"
},
{
"date": "2008-07-30",
"videos": [
"http://thecolbertreport.cc.com/videos/aej937/intro---7-30-08",
"http://thecolbertreport.cc.com/videos/0igq3j/fat-cat",
"http://thecolbertreport.cc.com/videos/z8lld1/the-word---save-ferris",
"http://thecolbertreport.cc.com/videos/77hd54/spiders-for-stephen-",
"http://thecolbertreport.cc.com/videos/9riu8g/canton-apology",
"http://thecolbertreport.cc.com/videos/paplnu/crosby--stills---nash-pt--1"
],
"guest": "Crosby, Stills & Nash"
},
{
"date": "2008-07-31",
"videos": [
"http://thecolbertreport.cc.com/videos/2yeaq8/intro---7-31-08",
"http://thecolbertreport.cc.com/videos/cy7kpu/starbucks-cuts-jobs",
"http://thecolbertreport.cc.com/videos/evgv9c/brendan-koerner",
"http://thecolbertreport.cc.com/videos/3pi9ch/cheating-death---swimming-safety",
"http://thecolbertreport.cc.com/videos/k8sku2/buzz-aldrin",
"http://thecolbertreport.cc.com/videos/xrkpup/thanks-to-the-guests"
],
"guest": "Brendan I. Koerner, Buzz Aldrin"
},
{
"date": "2008-08-04",
"videos": [
"http://thecolbertreport.cc.com/videos/y56p3h/intro---8-4-08",
"http://thecolbertreport.cc.com/videos/j7c1ly/democrats--five-week-recess",
"http://thecolbertreport.cc.com/videos/n4qhgk/the-word---we-the-people",
"http://thecolbertreport.cc.com/videos/gjy6co/ryan-seacrest-s-shark-attack",
"http://thecolbertreport.cc.com/videos/j0iwzv/lucas-conley"
],
"guest": "Lucas Conley, The Apples in Stereo"
},
{
"date": "2008-08-05",
"videos": [
"http://thecolbertreport.cc.com/videos/0b9ndt/intro---8-5-08",
"http://thecolbertreport.cc.com/videos/a60qui/starbucks-promotion",
"http://thecolbertreport.cc.com/videos/ts3set/obama-s-energy-plan---tire-gauges",
"http://thecolbertreport.cc.com/videos/c8orpt/the-word---divided-we-win",
"http://thecolbertreport.cc.com/videos/u7dbu9/canton--kansas-apology",
"http://thecolbertreport.cc.com/videos/sw0u58/david-carr",
"http://thecolbertreport.cc.com/videos/zghj54/obsessive-compulsive-checklist"
],
"guest": "David Carr"
},
{
"date": "2008-08-06",
"videos": [
"http://thecolbertreport.cc.com/videos/j12mau/intro---8-6-08",
"http://thecolbertreport.cc.com/videos/ad4cbz/ignorance-history-month",
"http://thecolbertreport.cc.com/videos/v2zmtk/spida-of-love---jason-bond",
"http://thecolbertreport.cc.com/videos/luli3g/colbert-platinum---the-dribble-down-effect",
"http://thecolbertreport.cc.com/videos/3pe5h3/kevin-costner",
"http://thecolbertreport.cc.com/videos/ot8cw0/spanish-audio"
],
"guest": "Jason Bond, Kevin Costner"
},
{
"date": "2008-08-07",
"videos": [
"http://thecolbertreport.cc.com/videos/bxoz3a/intro---8-7-08",
"http://thecolbertreport.cc.com/videos/e6qhsv/osama-bin-laden-s-driver-guilty",
"http://thecolbertreport.cc.com/videos/f3opxi/sport-report---devin-gordon",
"http://thecolbertreport.cc.com/videos/6u4m61/tip-wag---exxon-s-record-profits",
"http://thecolbertreport.cc.com/videos/dmymte/thomas-frank",
"http://thecolbertreport.cc.com/videos/iwrdpe/reading-newsweek"
],
"guest": "Devin Gordon, Thomas Frank"
},
{
"date": "2008-08-11",
"videos": [
"http://thecolbertreport.cc.com/videos/jk0e27/intro---8-11-08",
"http://thecolbertreport.cc.com/videos/riwpa4/esteban-loves-jorge-ramos",
"http://thecolbertreport.cc.com/videos/bfwvvn/the-word---catharsis",
"http://thecolbertreport.cc.com/videos/txv0gu/nailed--em---medical-marijuana",
"http://thecolbertreport.cc.com/videos/8j40t0/jorge-ramos",
"http://thecolbertreport.cc.com/videos/b7houz/stephen-wants-snacks"
],
"guest": "Jorge Ramos"
},
{
"date": "2008-08-12",
"videos": [
"http://thecolbertreport.cc.com/videos/kt49i5/intro---8-12-08",
"http://thecolbertreport.cc.com/videos/zgupdj/unsubstantiated-rumors",
"http://thecolbertreport.cc.com/videos/6d57uu/olympic-opening-ceremony",
"http://thecolbertreport.cc.com/videos/5njkui/joey-cheek",
"http://thecolbertreport.cc.com/videos/jhg2wn/canton--south-dakota-apology",
"http://thecolbertreport.cc.com/videos/bv3152/jane-mayer",
"http://thecolbertreport.cc.com/videos/dwnfyl/reading-the-national-enquirer"
],
"guest": "Joey Cheek, Jane Mayer"
},
{
"date": "2008-08-13",
"videos": [
"http://thecolbertreport.cc.com/videos/o7nbb7/intro---8-13-08",
"http://thecolbertreport.cc.com/videos/zewvls/stephen-s-world-record",
"http://thecolbertreport.cc.com/videos/3ae93q/john-mccain-steals-from-wikipedia",
"http://thecolbertreport.cc.com/videos/htzkd9/the-word---blame-monica-goodling",
"http://thecolbertreport.cc.com/videos/1clyqz/formidable-opponent---offshore-drilling",
"http://thecolbertreport.cc.com/videos/yplzsy/dick-meyer",
"http://thecolbertreport.cc.com/videos/x9tyb8/goodbye-from-wprg"
],
"guest": "Dick Meyer"
},
{
"date": "2008-08-14",
"videos": [
"http://thecolbertreport.cc.com/videos/481cqy/intro---8-14-08",
"http://thecolbertreport.cc.com/videos/0gs1a9/jeopardy-shout-out",
"http://thecolbertreport.cc.com/videos/s99fxp/threatdown---killer-iphones",
"http://thecolbertreport.cc.com/videos/9x55ta/the-1952-helsinki-games---the-reindeer-roars",
"http://thecolbertreport.cc.com/videos/ebnqyp/bing-west",
"http://thecolbertreport.cc.com/videos/h0yxjt/gold-medals"
],
"guest": "Bing West"
},
{
"date": "2008-08-26",
"videos": [
"http://thecolbertreport.cc.com/videos/r6ivli/intro---8-26-08",
"http://thecolbertreport.cc.com/videos/zpxtn2/burning-man-festival-confusion",
"http://thecolbertreport.cc.com/videos/ez5jp1/michelle-obama-s-speech",
"http://thecolbertreport.cc.com/videos/tojy8p/anniversary-pandering",
"http://thecolbertreport.cc.com/videos/ax1v4e/bob-barr",
"http://thecolbertreport.cc.com/videos/f120f5/scott-mcclellan",
"http://thecolbertreport.cc.com/videos/twqqkj/up-next"
],
"guest": "Rep. Bob Barr, Scott McClellan"
},
{
"date": "2008-08-27",
"videos": [
"http://thecolbertreport.cc.com/videos/mb4pgm/intro---8-27-08",
"http://thecolbertreport.cc.com/videos/63yvi3/live-from-dynasty",
"http://thecolbertreport.cc.com/videos/xfzios/hillary-clinton-supports-barack-obama",
"http://thecolbertreport.cc.com/videos/m1mag5/repo-man",
"http://thecolbertreport.cc.com/videos/402muh/mike-huckabee",
"http://thecolbertreport.cc.com/videos/llvqjv/stephanie-tubbs-jones-tribute"
],
"guest": "Gov. Mike Huckabee"
},
{
"date": "2008-08-28",
"videos": [
"http://thecolbertreport.cc.com/videos/ua1ppo/intro---8-28-08",
"http://thecolbertreport.cc.com/videos/9lke5e/high-altitude-brownies",
"http://thecolbertreport.cc.com/videos/53s26i/the-word---acid-flashback",
"http://thecolbertreport.cc.com/videos/kmna3f/dnc-formal-roll-call",
"http://thecolbertreport.cc.com/videos/eifqog/richard-brookhiser",
"http://thecolbertreport.cc.com/videos/c42fhd/stephen-s-brownies"
],
"guest": "Rick Brookhiser"
},
{
"date": "2008-08-29",
"videos": [
"http://thecolbertreport.cc.com/videos/7p5vgn/intro---8-29-08",
"http://thecolbertreport.cc.com/videos/ctsiz5/sarah-palin-for-vp",
"http://thecolbertreport.cc.com/videos/9os3w0/better-know-a-lobby---secular-coalition-for-america",
"http://thecolbertreport.cc.com/videos/rufbl6/john-mcwhorter",
"http://thecolbertreport.cc.com/videos/bzvjxb/revenge-of-the-styrofoam-cups"
],
"guest": "John McWhorter"
},
{
"date": "2008-09-02",
"videos": [
"http://thecolbertreport.cc.com/videos/hp450x/intro---9-2-08",
"http://thecolbertreport.cc.com/videos/8tw46w/stephen-from-four-years-ago",
"http://thecolbertreport.cc.com/videos/rf8uos/the-word---that-s-the-ticket",
"http://thecolbertreport.cc.com/videos/gmnlx9/green-screen-challenge---last-shot",
"http://thecolbertreport.cc.com/videos/f81p33/laura-d-andrea-tyson",
"http://thecolbertreport.cc.com/videos/xhysj6/blowing-your-mind"
],
"guest": "Laura D'Andrea Tyson"
},
{
"date": "2008-09-03",
"videos": [
"http://thecolbertreport.cc.com/videos/gujtwh/intro---9-3-08",
"http://thecolbertreport.cc.com/videos/kepht9/stephen-is-in-new-orleans",
"http://thecolbertreport.cc.com/videos/sbatmc/rnc-tuesday",
"http://thecolbertreport.cc.com/videos/awnw4i/susan-eisenhower-endorses-obama",
"http://thecolbertreport.cc.com/videos/4cdiam/john-mccain--her-story",
"http://thecolbertreport.cc.com/videos/x8u7qp/doris-kearns-goodwin",
"http://thecolbertreport.cc.com/videos/rk1eeg/who-wants-beads-"
],
"guest": "Doris Kearns Goodwin"
},
{
"date": "2008-09-04",
"videos": [
"http://thecolbertreport.cc.com/videos/nvj1zq/intro---9-4-08",
"http://thecolbertreport.cc.com/videos/1cwp12/stuck-in-atlanta-airport",
"http://thecolbertreport.cc.com/videos/kyo8u3/adam-brickley",
"http://thecolbertreport.cc.com/videos/c6ux4z/tip-wag---rnc-edition",
"http://thecolbertreport.cc.com/videos/yywrwl/ron-paul",
"http://thecolbertreport.cc.com/videos/kwoupb/flight-out-of-atlanta"
],
"guest": "Adam Brickley, Ron Paul"
},
{
"date": "2008-09-05",
"videos": [
"http://thecolbertreport.cc.com/videos/pg1oxm/intro---9-5-08",
"http://thecolbertreport.cc.com/videos/2rjlbj/stephen-missed-the-convention",
"http://thecolbertreport.cc.com/videos/njb4bu/green-screen-challenge---john-mccain-s-acceptance-speech",
"http://thecolbertreport.cc.com/videos/zk7gig/better-know-a-district---georgia-s-8th---lynn-westmoreland-update",
"http://thecolbertreport.cc.com/videos/xeizbt/david-paterson",
"http://thecolbertreport.cc.com/videos/u3k61y/green-screen-challenge---go-nuts"
],
"guest": "Gov. David Paterson"
},
{
"date": "2008-09-15",
"videos": [
"http://thecolbertreport.cc.com/videos/jshk87/exclusive---charlene--i-m-right-behind-you----rock-band-2",
"http://thecolbertreport.cc.com/videos/jfwpwo/intro---9-15-08",
"http://thecolbertreport.cc.com/videos/7yzozt/colbert-shopping-network",
"http://thecolbertreport.cc.com/videos/f9h01l/the-word---how-dare-you-",
"http://thecolbertreport.cc.com/videos/r0u91k/colbert-platinum---supermodel-statue",
"http://thecolbertreport.cc.com/videos/ihx562/peter-j--gomes",
"http://thecolbertreport.cc.com/videos/4ebszq/another-episode"
],
"guest": "Rev. Peter J. Gomes"
},
{
"date": "2008-09-16",
"videos": [
"http://thecolbertreport.cc.com/videos/urn1ti/intro---9-16-08",
"http://thecolbertreport.cc.com/videos/k0bsca/financial-advice-from-gorlock",
"http://thecolbertreport.cc.com/videos/mkpl4k/tyson-slocum",
"http://thecolbertreport.cc.com/videos/75xh2f/threatdown---icebergs-",
"http://thecolbertreport.cc.com/videos/3tm40j/rick-reilly",
"http://thecolbertreport.cc.com/videos/vnf5o3/thirty-minutes"
],
"guest": "Tyson Slocum, Rick Reilly"
},
{
"date": "2008-09-17",
"videos": [
"http://thecolbertreport.cc.com/videos/4l5nqm/intro---9-17-08",
"http://thecolbertreport.cc.com/videos/y012iz/mccain-attacks-obama",
"http://thecolbertreport.cc.com/videos/kyb0cu/the-word---powerless",
"http://thecolbertreport.cc.com/videos/n6eo9j/country-first",
"http://thecolbertreport.cc.com/videos/uwjjvf/bob-lutz",
"http://thecolbertreport.cc.com/videos/3odd8c/stephen---the-colberts--music-video"
],
"guest": "Bob Lutz"
},
{
"date": "2008-09-18",
"videos": [
"http://thecolbertreport.cc.com/videos/crbm2j/intro---9-18-08",
"http://thecolbertreport.cc.com/videos/1jklj8/stephen-wants-an-emmy",
"http://thecolbertreport.cc.com/videos/j1rb59/smokin--pole---american-arctic-expert",
"http://thecolbertreport.cc.com/videos/jgr23t/richard-garriott-takes-stephen-to-space",
"http://thecolbertreport.cc.com/videos/r2z9cm/maria-bartiromo",
"http://thecolbertreport.cc.com/videos/f0iah5/off-to-the-emmys"
],
"guest": "Maria Bartiromo"
},
{
"date": "2008-09-23",
"videos": [
"http://thecolbertreport.cc.com/videos/s3o9jz/intro---9-23-08",
"http://thecolbertreport.cc.com/videos/ikji5j/stephen-loses-to-don-rickles",
"http://thecolbertreport.cc.com/videos/vj8wko/the-word---ohmygodsocietyiscollapsing---",
"http://thecolbertreport.cc.com/videos/bna75w/peter-grosz-insults",
"http://thecolbertreport.cc.com/videos/iscpss/john-mccain-s-theme-song",
"http://thecolbertreport.cc.com/videos/8uwmb0/jackson-browne"
],
"guest": "Jackson Browne"
},
{
"date": "2008-09-24",
"videos": [
"http://thecolbertreport.cc.com/videos/5k16zp/intro---9-24-08",
"http://thecolbertreport.cc.com/videos/zxun4o/stephen-suspends-the-show",
"http://thecolbertreport.cc.com/videos/y03i0s/joe-nocera",
"http://thecolbertreport.cc.com/videos/ug1eaa/alpha-dog-of-the-week---bill-bennett",
"http://thecolbertreport.cc.com/videos/m77ip1/cornel-west",
"http://thecolbertreport.cc.com/videos/5lq5u2/colbertnation-com"
],
"guest": "Joe Nocera, Cornel West"
},
{
"date": "2008-09-25",
"videos": [
"http://thecolbertreport.cc.com/videos/c2lklm/intro---9-25-08",
"http://thecolbertreport.cc.com/videos/n6lmpg/stephen-settles-the-debate---fdr-vs--tr",
"http://thecolbertreport.cc.com/videos/k6o1ga/now-s-presidential-endorsement---kim-gandy",
"http://thecolbertreport.cc.com/videos/bqde8h/nicholas-carr",
"http://thecolbertreport.cc.com/videos/c44c8h/one-more-thing"
],
"guest": "Nicholas Carr"
},
{
"date": "2008-09-29",
"videos": [
"http://thecolbertreport.cc.com/videos/1c54hn/intro---9-29-08",
"http://thecolbertreport.cc.com/videos/05f4cg/the-first-debate-winner",
"http://thecolbertreport.cc.com/videos/bweuwc/the-word---ye-of-little-faith",
"http://thecolbertreport.cc.com/videos/cgij7r/cheating-death---car-bacteria",
"http://thecolbertreport.cc.com/videos/vp621m/paul-begala",
"http://thecolbertreport.cc.com/videos/gpa8yw/good-night"
],
"guest": "Paul Begala"
},
{
"date": "2008-09-30",
"videos": [
"http://thecolbertreport.cc.com/videos/y8hkhe/intro---9-30-08",
"http://thecolbertreport.cc.com/videos/9st6mt/partisanship-kills-the-bailout",
"http://thecolbertreport.cc.com/videos/f9oh9q/prescott-oil-loves-the-earth",
"http://thecolbertreport.cc.com/videos/d0zdru/tip-wag---wall-street-jagoffs",
"http://thecolbertreport.cc.com/videos/j67wur/out-of-time"
],
"guest": "James Taylor"
},
{
"date": "2008-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/t7tnvd/exclusive---nas-plays-rock-band",
"http://thecolbertreport.cc.com/videos/y8hkhe/intro---9-30-08",
"http://thecolbertreport.cc.com/videos/9st6mt/partisanship-kills-the-bailout",
"http://thecolbertreport.cc.com/videos/f9oh9q/prescott-oil-loves-the-earth",
"http://thecolbertreport.cc.com/videos/d0zdru/tip-wag---wall-street-jagoffs",
"http://thecolbertreport.cc.com/videos/j67wur/out-of-time"
],
"guest": "Dave Levin"
},
{
"date": "2008-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/eqbu4l/intro---10-01-08",
"http://thecolbertreport.cc.com/videos/ovyu4c/campbell-s-soup-stock",
"http://thecolbertreport.cc.com/videos/bhfa94/the-word---future-perfect",
"http://thecolbertreport.cc.com/videos/86s1x0/colbert-teen-talk---voter-abstinence",
"http://thecolbertreport.cc.com/videos/1v6olb/dave-levin",
"http://thecolbertreport.cc.com/videos/e5ngk1/you-snooze--you-lose"
],
"guest": "Dave Levin"
},
{
"date": "2008-10-02",
"videos": [
"http://thecolbertreport.cc.com/videos/zc7pti/intro---10-02-08",
"http://thecolbertreport.cc.com/videos/jwi5c6/stephen-shoots-an-audience-member",
"http://thecolbertreport.cc.com/videos/nkfn9g/shakespearean-candidates---stephen-greenblatt",
"http://thecolbertreport.cc.com/videos/9cm5sl/formidable-opponent---business-syphilis",
"http://thecolbertreport.cc.com/videos/kvfh5w/naomi-klein",
"http://thecolbertreport.cc.com/videos/xsttzx/that-s-all-she-wrote"
],
"guest": "Stephen Greenblatt, Naomi Klein"
},
{
"date": "2008-10-06",
"videos": [
"http://thecolbertreport.cc.com/videos/xxiviw/intro---10-6-08",
"http://thecolbertreport.cc.com/videos/1hb3kb/oj-simpson-guilty",
"http://thecolbertreport.cc.com/videos/qlbk95/the-word---maverick-without-a-cause",
"http://thecolbertreport.cc.com/videos/qnwvgs/un-american-news---financial-edition",
"http://thecolbertreport.cc.com/videos/tn9q1r/jim-cramer",
"http://thecolbertreport.cc.com/videos/gpjjik/life-drawing-lesson"
],
"guest": "Jim Cramer"
},
{
"date": "2008-10-07",
"videos": [
"http://thecolbertreport.cc.com/videos/lr7n1e/intro---10-7-08",
"http://thecolbertreport.cc.com/videos/ehcjcu/stephen-s-town-hall",
"http://thecolbertreport.cc.com/videos/yulr8u/threatdown---zombies",
"http://thecolbertreport.cc.com/videos/e56sfz/the-red-lending-menace",
"http://thecolbertreport.cc.com/videos/xoy3ny/nate-silver",
"http://thecolbertreport.cc.com/videos/0t800l/phone-book"
],
"guest": "Nate Silver"
},
{
"date": "2008-10-08",
"videos": [
"http://thecolbertreport.cc.com/videos/wnllod/intro---10-08-08",
"http://thecolbertreport.cc.com/videos/rb63v8/town-hall-fashion-apology",
"http://thecolbertreport.cc.com/videos/pmvhoi/the-second-presidential-debate",
"http://thecolbertreport.cc.com/videos/r8hb9t/atone-phone---gilbert-gottfried",
"http://thecolbertreport.cc.com/videos/7943ea/joe-scarborough",
"http://thecolbertreport.cc.com/videos/02dsh7/stephen-s-post-show-routine"
],
"guest": "Joe Scarborough"
},
{
"date": "2008-10-09",
"videos": [
"http://thecolbertreport.cc.com/videos/cbxmlr/intro---10-09-08",
"http://thecolbertreport.cc.com/videos/l3uq93/dismayed-stockbroker-photos",
"http://thecolbertreport.cc.com/videos/pqsng6/campaign-personal-attacks---david-gergen",
"http://thecolbertreport.cc.com/videos/f6283x/who-s-not-honoring-me-now----nepal",
"http://thecolbertreport.cc.com/videos/ge3feb/oliver-stone",
"http://thecolbertreport.cc.com/videos/w87c40/bad-news"
],
"guest": "David Gergen, Oliver Stone"
},
{
"date": "2008-10-13",
"videos": [
"http://thecolbertreport.cc.com/videos/5c0f2m/intro---10-13-08",
"http://thecolbertreport.cc.com/videos/fnytnd/mccain-crossword-clue",
"http://thecolbertreport.cc.com/videos/1jl5yn/the-computer-menace---bethany-mclean",
"http://thecolbertreport.cc.com/videos/1goeih/bears---balls---salt-based-economy",
"http://thecolbertreport.cc.com/videos/gyyaxy/kathleen-parker",
"http://thecolbertreport.cc.com/videos/6y4q65/happy-birthday"
],
"guest": "Bethany McLean, Kathleen Parker"
},
{
"date": "2008-10-14",
"videos": [
"http://thecolbertreport.cc.com/videos/n5hrc3/intro---10-14-08",
"http://thecolbertreport.cc.com/videos/7pd7zc/paul-krugman-s-nobel-prize",
"http://thecolbertreport.cc.com/videos/r0q5ve/the-word---p-o-w-",
"http://thecolbertreport.cc.com/videos/pfbd0x/tip-wag---palin-s-newsweek-cover",
"http://thecolbertreport.cc.com/videos/usq8wp/joseph-stiglitz",
"http://thecolbertreport.cc.com/videos/lvn4rk/good-night"
],
"guest": "Joseph Stiglitz"
},
{
"date": "2008-10-15",
"videos": [
"http://thecolbertreport.cc.com/videos/zwbmit/intro---10-15-08",
"http://thecolbertreport.cc.com/videos/9308mk/kfc-snacker",
"http://thecolbertreport.cc.com/videos/l7yb6p/the-word---freaky-three-way-calling",
"http://thecolbertreport.cc.com/videos/4e7lhp/sport-report---lame-sports-edition",
"http://thecolbertreport.cc.com/videos/38m5c1/tina-brown",
"http://thecolbertreport.cc.com/videos/8g4g6k/chest-tivo"
],
"guest": "Tina Brown"
},
{
"date": "2008-10-16",
"videos": [
"http://thecolbertreport.cc.com/videos/wiiett/intro---10-16-08",
"http://thecolbertreport.cc.com/videos/clx1g3/the-final-debate",
"http://thecolbertreport.cc.com/videos/irar1b/portrait-accepted---brent-glass",
"http://thecolbertreport.cc.com/videos/vhpq80/robert-greenwald",
"http://thecolbertreport.cc.com/videos/dtl1jb/a-new-portrait"
],
"guest": "Brent Glass, Robert Greenwald"
},
{
"date": "2008-10-20",
"videos": [
"http://thecolbertreport.cc.com/videos/icr62o/intro---10-20-08",
"http://thecolbertreport.cc.com/videos/hztig3/colin-powell-endorses-barack-obama",
"http://thecolbertreport.cc.com/videos/m2bwgq/fareed-zakaria",
"http://thecolbertreport.cc.com/videos/f1sjmz/colbert-aluminum---paris",
"http://thecolbertreport.cc.com/videos/ihme7b/wynton-marsalis",
"http://thecolbertreport.cc.com/videos/1zx8mm/good-night"
],
"guest": "Fareed Zakaria, Wynton Marsalis"
},
{
"date": "2008-10-21",
"videos": [
"http://thecolbertreport.cc.com/videos/ipzwmk/intro---10-21-08",
"http://thecolbertreport.cc.com/videos/1q0lgd/stephen-jr--campaigns-for-mccain",
"http://thecolbertreport.cc.com/videos/6mt8jf/the-word---fantasyland",
"http://thecolbertreport.cc.com/videos/yf6nbq/battle-of-the-gods",
"http://thecolbertreport.cc.com/videos/ajdj8y/atone-phone---the-pony-down",
"http://thecolbertreport.cc.com/videos/2f3tuj/michael-farris",
"http://thecolbertreport.cc.com/videos/gsnyc0/another-one-tomorrow"
],
"guest": "Michael Farris"
},
{
"date": "2008-10-22",
"videos": [
"http://thecolbertreport.cc.com/videos/zfo3j9/intro---10-22-08",
"http://thecolbertreport.cc.com/videos/bnfehb/mccain-loves-the-middle-class",
"http://thecolbertreport.cc.com/videos/2fhvot/too-much-political-knowledge",
"http://thecolbertreport.cc.com/videos/l9sa9k/movies-that-are-destroying-america---quantum-of-solace",
"http://thecolbertreport.cc.com/videos/bfif72/david-frum",
"http://thecolbertreport.cc.com/videos/zijniy/thanks-to-cedric-the-entertainer"
],
"guest": "David Frum"
},
{
"date": "2008-10-23",
"videos": [
"http://thecolbertreport.cc.com/videos/4fsdf9/intro---10-23-08",
"http://thecolbertreport.cc.com/videos/mxdemq/the-palins-in-people-magazine",
"http://thecolbertreport.cc.com/videos/9r8mtw/threatdown---who-s-nailin--paylin",
"http://thecolbertreport.cc.com/videos/d9d59e/difference-makers---the-national-hummer-club",
"http://thecolbertreport.cc.com/videos/vu40sp/jonathan-alter",
"http://thecolbertreport.cc.com/videos/4q4n65/a-short-goodbye"
],
"guest": "Jonathan Alter"
},
{
"date": "2008-10-27",
"videos": [
"http://thecolbertreport.cc.com/videos/59kvnn/intro---10-27-08",
"http://thecolbertreport.cc.com/videos/o5x5iu/mccain-guarantees-victory",
"http://thecolbertreport.cc.com/videos/05r6nq/the-word---it-s-alive-",
"http://thecolbertreport.cc.com/videos/7g8kx1/alpha-dog-of-the-week---mark-ciptak",
"http://thecolbertreport.cc.com/videos/fnuvdv/yo-yo-ma"
],
"guest": "Yo-Yo Ma"
},
{
"date": "2008-10-28",
"videos": [
"http://thecolbertreport.cc.com/videos/ghj64m/intro---10-28-08",
"http://thecolbertreport.cc.com/videos/xk09yu/ted-stevens-is-found-guilty",
"http://thecolbertreport.cc.com/videos/7j217q/obama-the-socialist",
"http://thecolbertreport.cc.com/videos/bxzmkn/socialist-candidate-for-president---brian-moore",
"http://thecolbertreport.cc.com/videos/wz2u1e/canton--ohio",
"http://thecolbertreport.cc.com/videos/ytg04i/sherman-alexie",
"http://thecolbertreport.cc.com/videos/jz4m1g/tickets-to-canada"
],
"guest": "Brian Moore, Sherman Alexie"
},
{
"date": "2008-10-29",
"videos": [
"http://thecolbertreport.cc.com/videos/ix1wn7/intro---10-29-08",
"http://thecolbertreport.cc.com/videos/ks5pt8/john-mccain-s-big-prank",
"http://thecolbertreport.cc.com/videos/7qwbk4/the-word---i-endorse-barack-obama",
"http://thecolbertreport.cc.com/videos/k5qv33/was-it-really-that-bad----the-great-depression",
"http://thecolbertreport.cc.com/videos/cxwcsb/david-simon",
"http://thecolbertreport.cc.com/videos/prhqai/colbert-completists"
],
"guest": "David Simon"
},
{
"date": "2008-10-30",
"videos": [
"http://thecolbertreport.cc.com/videos/9sqk1r/intro---10-30-08",
"http://thecolbertreport.cc.com/videos/b7m8ic/obama-infomercial",
"http://thecolbertreport.cc.com/videos/7mbhhk/tip-wag---apple-computers",
"http://thecolbertreport.cc.com/videos/tiopht/the-dacolbert-code---the-election",
"http://thecolbertreport.cc.com/videos/ugfx1s/wilco-interview"
],
"guest": "Wilco"
},
{
"date": "2008-11-03",
"videos": [
"http://thecolbertreport.cc.com/videos/gc439u/intro---11-03-08",
"http://thecolbertreport.cc.com/videos/jtvn9v/2008-campaign-winners-and-losers",
"http://thecolbertreport.cc.com/videos/q31c3b/charlie-cook",
"http://thecolbertreport.cc.com/videos/syw57q/how-to-be-a-maverick",
"http://thecolbertreport.cc.com/videos/3lix4b/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/5snsio/election-eve-prayer"
],
"guest": "Charlie Cook, Andrew Sullivan"
},
{
"date": "2008-11-05",
"videos": [
"http://thecolbertreport.cc.com/videos/deihkn/intro---11-05-08",
"http://thecolbertreport.cc.com/videos/ek3v6r/president-obama",
"http://thecolbertreport.cc.com/videos/p698of/the-word---change",
"http://thecolbertreport.cc.com/videos/b3gurg/threatdown---black-presidents",
"http://thecolbertreport.cc.com/videos/1bpyxl/andrew-young",
"http://thecolbertreport.cc.com/videos/wmwkia/note-to-gorlock"
],
"guest": "Ambassador Andrew Young"
},
{
"date": "2008-11-06",
"videos": [
"http://thecolbertreport.cc.com/videos/jvmllx/intro---11-06-08",
"http://thecolbertreport.cc.com/videos/8cjwkf/obama-s-spider-battle",
"http://thecolbertreport.cc.com/videos/91wunt/un-american-news---obama-edition",
"http://thecolbertreport.cc.com/videos/aedolr/fallback-position---peter-earnest-pt--1",
"http://thecolbertreport.cc.com/videos/tp44lf/rachel-maddow"
],
"guest": "Rachel Maddow"
},
{
"date": "2008-11-11",
"videos": [
"http://thecolbertreport.cc.com/videos/3vbqce/intro---11-11-08",
"http://thecolbertreport.cc.com/videos/t0o0ln/the-obamas-meet-the-bushes",
"http://thecolbertreport.cc.com/videos/cf9i7o/proposition-8-protests---dan-savage",
"http://thecolbertreport.cc.com/videos/a4htau/fallback-position---peter-earnest-pt--2",
"http://thecolbertreport.cc.com/videos/97cxi9/kevin-johnson",
"http://thecolbertreport.cc.com/videos/knwq1k/gay-black-violence"
],
"guest": "Dan Savage, Kevin Johnson"
},
{
"date": "2008-11-12",
"videos": [
"http://thecolbertreport.cc.com/videos/jxnavl/intro---11-12-08",
"http://thecolbertreport.cc.com/videos/hs06sa/formula-4ou1",
"http://thecolbertreport.cc.com/videos/jdc5wl/the-word---pity-party",
"http://thecolbertreport.cc.com/videos/vq5z69/cheating-death---women-s-health",
"http://thecolbertreport.cc.com/videos/h8pdku/bob-woodward",
"http://thecolbertreport.cc.com/videos/yj3fvl/good-night"
],
"guest": "Bob Woodward"
},
{
"date": "2008-11-13",
"videos": [
"http://thecolbertreport.cc.com/videos/iy78xf/intro---11-13-08",
"http://thecolbertreport.cc.com/videos/ws4itq/imaginary-gay-black-warfare",
"http://thecolbertreport.cc.com/videos/54gy81/tip-wag---marvel-comics",
"http://thecolbertreport.cc.com/videos/9so57k/rahm-emanuel-s-finger",
"http://thecolbertreport.cc.com/videos/84locu/stephen-moore",
"http://thecolbertreport.cc.com/videos/kwiam8/obama-spider-man-comic-bribe"
],
"guest": "Stephen Moore"
},
{
"date": "2008-11-17",
"videos": [
"http://thecolbertreport.cc.com/videos/edyiaw/intro---11-17-08",
"http://thecolbertreport.cc.com/videos/vfh1d7/stephen-s-gma-appearance",
"http://thecolbertreport.cc.com/videos/tyr5yf/barack-obama-is-hiring",
"http://thecolbertreport.cc.com/videos/xubttj/obama-s-cabinet---tom-brokaw",
"http://thecolbertreport.cc.com/videos/okezd5/soup-war",
"http://thecolbertreport.cc.com/videos/lu8hmu/malcolm-gladwell",
"http://thecolbertreport.cc.com/videos/f67l6s/stephen-drinks-soup"
],
"guest": "Tom Brokaw, Malcolm Gladwell"
},
{
"date": "2008-11-18",
"videos": [
"http://thecolbertreport.cc.com/videos/cpar3w/intro---11-18-08",
"http://thecolbertreport.cc.com/videos/gpyfhe/joe-lieberman-learns-his-fate",
"http://thecolbertreport.cc.com/videos/tda4m3/the-word---love-lost",
"http://thecolbertreport.cc.com/videos/rfqomg/stephen-s-vetting-process---cliff-sloan-pt--1"
],
"guest": "Paul Simon"
},
{
"date": "2008-11-19",
"videos": [
"http://thecolbertreport.cc.com/videos/a4gbi9/intro---11-19-08",
"http://thecolbertreport.cc.com/videos/3ebcnc/the-word---mad-men",
"http://thecolbertreport.cc.com/videos/hjm6c3/stephen-s-vetting-process---cliff-sloan-pt--2",
"http://thecolbertreport.cc.com/videos/p1vjk5/michael-lewis",
"http://thecolbertreport.cc.com/videos/5n2dbq/tearful-apology"
],
"guest": "Michael Lewis"
},
{
"date": "2008-11-20",
"videos": [
"http://thecolbertreport.cc.com/videos/cbvik4/intro---11-20-08",
"http://thecolbertreport.cc.com/videos/ag7dg1/racism-is-over---cory-booker",
"http://thecolbertreport.cc.com/videos/2frm4q/metunes---chinese-democracy",
"http://thecolbertreport.cc.com/videos/c48nk9/thomas-friedman",
"http://thecolbertreport.cc.com/videos/bd8wju/christmas-special-dvd-warning"
],
"guest": "Cory Booker, Thomas L. Friedman"
},
{
"date": "2008-12-01",
"videos": [
"http://thecolbertreport.cc.com/videos/rpma6e/intro---12-01-08",
"http://thecolbertreport.cc.com/videos/tq2nxp/operation-humble-kanye",
"http://thecolbertreport.cc.com/videos/qarmhd/war-in-afghanistan",
"http://thecolbertreport.cc.com/videos/rven6i/khaled-hosseini",
"http://thecolbertreport.cc.com/videos/36dgrv/tip-wag---all-wag-christmas-edition",
"http://thecolbertreport.cc.com/videos/7058uf/roland-fryer",
"http://thecolbertreport.cc.com/videos/n1in3i/good-night"
],
"guest": "Khaled Hosseini, Roland Fryer"
},
{
"date": "2008-12-02",
"videos": [
"http://thecolbertreport.cc.com/videos/cj7hhg/intro---12-02-08",
"http://thecolbertreport.cc.com/videos/qvwoip/operation-humble-kanye---buy-stephen-s-album",
"http://thecolbertreport.cc.com/videos/ztjt9g/the-word---a-man-named-plaxico",
"http://thecolbertreport.cc.com/videos/fic3d1/colbert-platinum---christmas-edition",
"http://thecolbertreport.cc.com/videos/bshkcz/jeffrey-goldberg",
"http://thecolbertreport.cc.com/videos/utntlq/buy-stephen-s-boots-on-ebay"
],
"guest": "Jeffrey Goldberg"
},
{
"date": "2008-12-03",
"videos": [
"http://thecolbertreport.cc.com/videos/il4wbl/intro---12-03-08",
"http://thecolbertreport.cc.com/videos/owefww/nasa-spider-escapes",
"http://thecolbertreport.cc.com/videos/z33t4w/the-word---barack-handed-compliment",
"http://thecolbertreport.cc.com/videos/mcfi82/nailed--em---radical-knitting",
"http://thecolbertreport.cc.com/videos/2karre/barbara-walters",
"http://thecolbertreport.cc.com/videos/r6ufyo/the-end--not-the-beginning"
],
"guest": "Barbara Walters"
},
{
"date": "2008-12-04",
"videos": [
"http://thecolbertreport.cc.com/videos/d118oe/intro---12-04-08",
"http://thecolbertreport.cc.com/videos/2fjry6/operation-humble-kanye---stephen-beats-kanye",
"http://thecolbertreport.cc.com/videos/2d2zn0/pakistani-threat---bob-graham",
"http://thecolbertreport.cc.com/videos/d5jif7/movies-that-are-destroying-america---holiday-movie-edition",
"http://thecolbertreport.cc.com/videos/n7jvhg/nicholas-wade",
"http://thecolbertreport.cc.com/videos/sugr09/returning-monday"
],
"guest": "Sen. Bob Graham, Nicholas Wade"
},
{
"date": "2008-12-08",
"videos": [
"http://thecolbertreport.cc.com/videos/7u2bhk/intro---12-08-08",
"http://thecolbertreport.cc.com/videos/ao9vg7/bush-kisses-streisand",
"http://thecolbertreport.cc.com/videos/gctknh/the-word---season-of-giving",
"http://thecolbertreport.cc.com/videos/6153k5/barry---the-stump",
"http://thecolbertreport.cc.com/videos/hpitea/geoffrey-canada",
"http://thecolbertreport.cc.com/videos/0r2h5l/stephen-on-conan"
],
"guest": "Geoffrey Canada"
},
{
"date": "2008-12-09",
"videos": [
"http://thecolbertreport.cc.com/videos/4g9cia/intro---12-09-08",
"http://thecolbertreport.cc.com/videos/onbk9a/rod-blagojevich-is-arrested",
"http://thecolbertreport.cc.com/videos/600m6s/nixmas-tree-trimming---kevin-bacon",
"http://thecolbertreport.cc.com/videos/yflimf/tek-jansen---beginning-s-first-dawn--episode-two-revisited",
"http://thecolbertreport.cc.com/videos/srrck8/charlie-kaufman",
"http://thecolbertreport.cc.com/videos/zkndmq/nixon-angel"
],
"guest": "Kevin Bacon, Charlie Kaufman"
},
{
"date": "2008-12-10",
"videos": [
"http://thecolbertreport.cc.com/videos/u8ghsg/intro---12-10-08",
"http://thecolbertreport.cc.com/videos/f9io4y/rod-blagojevich-s-birthday",
"http://thecolbertreport.cc.com/videos/imth2d/threatdown---happiness",
"http://thecolbertreport.cc.com/videos/jnn2lb/on-notice---forgiveness",
"http://thecolbertreport.cc.com/videos/i1wzcc/richard-haass",
"http://thecolbertreport.cc.com/videos/uw87dl/good-night"
],
"guest": "Richard Haass"
},
{
"date": "2008-12-11",
"videos": [
"http://thecolbertreport.cc.com/videos/y3mqae/intro---12-11-08",
"http://thecolbertreport.cc.com/videos/djirpd/michael-phelps",
"http://thecolbertreport.cc.com/videos/j11gba/stephen-eats-ghost-ribs",
"http://thecolbertreport.cc.com/videos/zc9rq9/the-ghost-of-stage-manager-bobby",
"http://thecolbertreport.cc.com/videos/1756ia/the-word---the-unbearable-lightness-of-supreme-being"
],
"guest": "Michael Phelps"
}
],
"2009": [
{
"date": "2009-01-05",
"videos": [
"http://thecolbertreport.cc.com/videos/9k2tbm/intro---1-05-09",
"http://thecolbertreport.cc.com/videos/za98w3/colbert-and-colmes---roland-burris-appointment",
"http://thecolbertreport.cc.com/videos/hq4p9o/tek-jansen---beginning-s-first-dawn--episode-three",
"http://thecolbertreport.cc.com/videos/nrlhy0/john-king",
"http://thecolbertreport.cc.com/videos/5hoaoz/colbert-and-colmes---colmes-gets-fired"
],
"guest": "Riley Crane"
},
{
"date": "2009-01-06",
"videos": [
"http://thecolbertreport.cc.com/videos/sn2rhf/ponzi-schemes",
"http://thecolbertreport.cc.com/videos/k6j6as/hiding-gold---david-leonhardt",
"http://thecolbertreport.cc.com/videos/4zhwch/better-know-a-district---utah-s-3rd---jason-chaffetz",
"http://thecolbertreport.cc.com/videos/g9ppzt/matt-miller",
"http://thecolbertreport.cc.com/videos/yys5yk/thank-you--stephen"
],
"guest": "Capt. Charles Moore"
},
{
"date": "2009-01-07",
"videos": [
"http://thecolbertreport.cc.com/videos/z8rm3b/intro---01-07-09",
"http://thecolbertreport.cc.com/videos/92yx1q/che-stadium",
"http://thecolbertreport.cc.com/videos/d1e1eu/dr--gupta-s-penis-pyramid",
"http://thecolbertreport.cc.com/videos/nqulkz/the-word---statute-of-liberty",
"http://thecolbertreport.cc.com/videos/amgd80/tip-wag---cocaine-honey",
"http://thecolbertreport.cc.com/videos/yau33c/benicio-del-toro"
],
"guest": "James Fowler"
},
{
"date": "2009-01-08",
"videos": [
"http://thecolbertreport.cc.com/videos/88kvmz/intro---01-08-09",
"http://thecolbertreport.cc.com/videos/wcgnr1/new-york-times-abandons-dignity",
"http://thecolbertreport.cc.com/videos/926dzf/yahweh-or-no-way---roland-burris",
"http://thecolbertreport.cc.com/videos/fk4a9c/leg-wrestling-rematch",
"http://thecolbertreport.cc.com/videos/gteixg/a-really-good-book",
"http://thecolbertreport.cc.com/videos/6428p8/pro-commie-epic"
],
"guest": "Lawrence Lessig"
},
{
"date": "2009-01-12",
"videos": [
"http://thecolbertreport.cc.com/videos/kni4vi/intro---01-12-09",
"http://thecolbertreport.cc.com/videos/9c4f03/bush-s-last-press-conference",
"http://thecolbertreport.cc.com/videos/bwmns5/the-word---sweet-smell-of-success",
"http://thecolbertreport.cc.com/videos/0o1xwh/stephen-jr--on-christmas-eve",
"http://thecolbertreport.cc.com/videos/dkx1ya/anthony-romero",
"http://thecolbertreport.cc.com/videos/by8gkb/a-lot-more-to-say"
],
"guest": "Anthony Romero"
},
{
"date": "2009-01-13",
"videos": [
"http://thecolbertreport.cc.com/videos/32ytiz/intro---01-13-09",
"http://thecolbertreport.cc.com/videos/fmzudp/bush-presidency-aged-us",
"http://thecolbertreport.cc.com/videos/9et79a/cold-war-update---cuba",
"http://thecolbertreport.cc.com/videos/m3x3ok/on-notice---limey-squirrel-eaters",
"http://thecolbertreport.cc.com/videos/k1og3a/niall-ferguson",
"http://thecolbertreport.cc.com/videos/5px40o/that-s-all-the-time-we-have"
],
"guest": "Niall Ferguson"
},
{
"date": "2009-01-14",
"videos": [
"http://thecolbertreport.cc.com/videos/oyml2f/intro---01-14-09",
"http://thecolbertreport.cc.com/videos/34mj4v/the-last-bush-effigy",
"http://thecolbertreport.cc.com/videos/y0f472/p-k--winsome---obama-collectibles",
"http://thecolbertreport.cc.com/videos/ur3zl1/little-victories---america-s-galaxy-is-big",
"http://thecolbertreport.cc.com/videos/gizrjk/alan-khazei",
"http://thecolbertreport.cc.com/videos/9hlcm3/commemorative-plates"
],
"guest": "Alan Khazei"
},
{
"date": "2009-01-15",
"videos": [
"http://thecolbertreport.cc.com/videos/q7vz1i/intro---01-15-09",
"http://thecolbertreport.cc.com/videos/95lbi6/bush-and-the-press",
"http://thecolbertreport.cc.com/videos/sy3mow/bush-s-romance-with-the-media---david-gregory",
"http://thecolbertreport.cc.com/videos/7iuuwa/tip-wag---monkey-on-the-lam",
"http://thecolbertreport.cc.com/videos/ux2atw/shepard-fairey",
"http://thecolbertreport.cc.com/videos/wfge8o/spay-and-neuter-your-pets"
],
"guest": "David Gregory, Shepard Fairey"
},
{
"date": "2009-01-19",
"videos": [
"http://thecolbertreport.cc.com/videos/r1uwlh/intro---01-19-09",
"http://thecolbertreport.cc.com/videos/ul1a7j/mlk-day-mascot",
"http://thecolbertreport.cc.com/videos/lypf68/the-word---sacrifice",
"http://thecolbertreport.cc.com/videos/ydvpvb/frank-rich",
"http://thecolbertreport.cc.com/videos/52s3oy/boiling-frog-metaphor"
],
"guest": "Frank Rich"
},
{
"date": "2009-01-20",
"videos": [
"http://thecolbertreport.cc.com/videos/ymrs37/stephen-s-inauguration-breakdown",
"http://thecolbertreport.cc.com/videos/301bds/p-k--winsome---inauguration-merchandise",
"http://thecolbertreport.cc.com/videos/9hjhcy/stephen-s-sound-advice---how-to-be-like-lincoln",
"http://thecolbertreport.cc.com/videos/mmoodw/jabari-asim",
"http://thecolbertreport.cc.com/videos/kai9la/stephen-realizes-he-s-black"
],
"guest": "Jabari Asim"
},
{
"date": "2009-01-21",
"videos": [
"http://thecolbertreport.cc.com/videos/dl8i2q/intro---01-21-09",
"http://thecolbertreport.cc.com/videos/l2d6st/president-yo-yo-ma",
"http://thecolbertreport.cc.com/videos/axsw46/election-2012---chuck-todd",
"http://thecolbertreport.cc.com/videos/xkmfex/stephen-s-remix-challenge",
"http://thecolbertreport.cc.com/videos/8l6srp/elizabeth-alexander",
"http://thecolbertreport.cc.com/videos/a3p8mj/good-night"
],
"guest": "Elizabeth Alexander"
},
{
"date": "2009-01-22",
"videos": [
"http://thecolbertreport.cc.com/videos/0zgr4t/intro---01-22-09",
"http://thecolbertreport.cc.com/videos/t6meak/near-president-obama",
"http://thecolbertreport.cc.com/videos/mtzrkq/un-american-news---president-obama-edition",
"http://thecolbertreport.cc.com/videos/689o7m/better-know-a-lobby---naacp",
"http://thecolbertreport.cc.com/videos/8awmoy/jon-meacham",
"http://thecolbertreport.cc.com/videos/ili9if/refreshing-sierra-mist"
],
"guest": "Jon Meacham"
},
{
"date": "2009-01-26",
"videos": [
"http://thecolbertreport.cc.com/videos/7nxt06/intro---01-26-09",
"http://thecolbertreport.cc.com/videos/4oz085/stephen-s-secret-prison",
"http://thecolbertreport.cc.com/videos/cw8n8j/obama-s-new-science-policy---chris-mooney",
"http://thecolbertreport.cc.com/videos/yxtpn8/tip-wag---john-yarmuth-s-holiday-card",
"http://thecolbertreport.cc.com/videos/uj76wp/ed-young",
"http://thecolbertreport.cc.com/videos/49ccbt/1-877-sean-930"
],
"guest": "Chris Mooney, Ed Young"
},
{
"date": "2009-01-27",
"videos": [
"http://thecolbertreport.cc.com/videos/rwx1ie/intro---01-27-09",
"http://thecolbertreport.cc.com/videos/8ws8hw/al-arabiya-kidnaps-obama",
"http://thecolbertreport.cc.com/videos/ei15xx/cheating-death---lung-health",
"http://thecolbertreport.cc.com/videos/yzw1s5/bill-o-reilly-doesn-t-report-rumors",
"http://thecolbertreport.cc.com/videos/7ljyqd/philippe-petit",
"http://thecolbertreport.cc.com/videos/qx6mra/omar-returns"
],
"guest": "Philippe Petit"
},
{
"date": "2009-01-28",
"videos": [
"http://thecolbertreport.cc.com/videos/mrairj/exclusive---better-know-a-beatle---paul-mccartney",
"http://thecolbertreport.cc.com/videos/qfnuqn/intro---01-28-09",
"http://thecolbertreport.cc.com/videos/4c854b/countdown-to-atomic-disaster---the-wing-ageddon",
"http://thecolbertreport.cc.com/videos/m2fb3c/denis-dutton",
"http://thecolbertreport.cc.com/videos/x3yxrz/call-1-877-sean-930"
],
"guest": "Paul McCartney, Denis Dutton"
},
{
"date": "2009-01-29",
"videos": [
"http://thecolbertreport.cc.com/videos/s0jwx0/intro---01-29-09",
"http://thecolbertreport.cc.com/videos/7k3noc/rod-blagojevich-is-impeached",
"http://thecolbertreport.cc.com/videos/05hiht/the-word---the-audacity-of-nope",
"http://thecolbertreport.cc.com/videos/ra6q6v/sport-report---chicken-wing-spokesman-richard-lobb",
"http://thecolbertreport.cc.com/videos/n7s40p/john-podesta",
"http://thecolbertreport.cc.com/videos/t92qhf/goodnight-illinois-gov--patrick-quinn"
],
"guest": "John Podesta"
},
{
"date": "2009-02-02",
"videos": [
"http://thecolbertreport.cc.com/videos/2e9hx6/intro---02-02-09",
"http://thecolbertreport.cc.com/videos/qx0vt7/the-lilly-ledbetter-fair-pay-act",
"http://thecolbertreport.cc.com/videos/3n4xx4/it-could-be-worse---iceland",
"http://thecolbertreport.cc.com/videos/9kc6le/nailed--em---amtrak-photographer",
"http://thecolbertreport.cc.com/videos/1tdafu/dan-zaccagnino",
"http://thecolbertreport.cc.com/videos/z0ddpw/so-long--farewell"
],
"guest": "Dan Zaccagnino"
},
{
"date": "2009-02-03",
"videos": [
"http://thecolbertreport.cc.com/videos/5d9tuo/intro---02-03-09",
"http://thecolbertreport.cc.com/videos/cfzmri/tom-daschle-steps-down",
"http://thecolbertreport.cc.com/videos/b8o45v/the-word---army-of-one",
"http://thecolbertreport.cc.com/videos/eo7n2c/colbert-platinum---ass-covering-edition",
"http://thecolbertreport.cc.com/videos/lr21yl/henry-louis-gates--jr-",
"http://thecolbertreport.cc.com/videos/fz6ra7/all-the-show-we-have-time-for"
],
"guest": "Henry Louis Gates Jr."
},
{
"date": "2009-02-04",
"videos": [
"http://thecolbertreport.cc.com/videos/hm493e/intro---02-04-09",
"http://thecolbertreport.cc.com/videos/7z1jvo/stephen-verbally-thrashes-steve-martin",
"http://thecolbertreport.cc.com/videos/1t7nor/yahweh-or-no-way---the-super-bowl",
"http://thecolbertreport.cc.com/videos/vtzs6d/who-s-not-honoring-me-now----the-newberry-awards",
"http://thecolbertreport.cc.com/videos/7z3biy/tell-your-friends"
],
"guest": "Steve Martin"
},
{
"date": "2009-02-05",
"videos": [
"http://thecolbertreport.cc.com/videos/oqo6m1/intro---02-05-09",
"http://thecolbertreport.cc.com/videos/hkvbbb/stelephant-colbert-the-elephant-seal",
"http://thecolbertreport.cc.com/videos/7v0jg2/economic-stimulus-debate",
"http://thecolbertreport.cc.com/videos/9xbuuq/economic-stimulus-bill---james-surowiecki",
"http://thecolbertreport.cc.com/videos/e378n6/alpha-dog-of-the-week---boy-scouts-of-america",
"http://thecolbertreport.cc.com/videos/avti1a/jonah-lehrer",
"http://thecolbertreport.cc.com/videos/qj4lmo/keep-your-friends-close"
],
"guest": "James Surowiecki, Jonah Lehrer"
},
{
"date": "2009-02-09",
"videos": [
"http://thecolbertreport.cc.com/videos/vp4fvu/intro---02-09-09",
"http://thecolbertreport.cc.com/videos/it28fw/the-new-word-czar",
"http://thecolbertreport.cc.com/videos/13lrs0/threatdown---gay-divorce",
"http://thecolbertreport.cc.com/videos/hr5hvl/al-gore-steals-stephen-s-grammy"
],
"guest": "TV on the Radio"
},
{
"date": "2009-02-10",
"videos": [
"http://thecolbertreport.cc.com/videos/fv48bo/intro---02-10-09",
"http://thecolbertreport.cc.com/videos/mj9pcq/the-visa-black-card",
"http://thecolbertreport.cc.com/videos/l6kty8/the-word---loyal-opposition",
"http://thecolbertreport.cc.com/videos/nj38bb/shout-out---honey--counterterrorism---an-old-guard-flag",
"http://thecolbertreport.cc.com/videos/9w33a7/robert-ballard",
"http://thecolbertreport.cc.com/videos/gissod/you-look-like-stephen"
],
"guest": "Robert Ballard"
},
{
"date": "2009-02-11",
"videos": [
"http://thecolbertreport.cc.com/videos/smxfup/intro---02-11-09",
"http://thecolbertreport.cc.com/videos/l5ealo/westminster-dog-show-snub---formula-40-woof",
"http://thecolbertreport.cc.com/videos/jxgbb9/dc-voting-rights-act---eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/wfrwar/truth-from-the-gut",
"http://thecolbertreport.cc.com/videos/42vhyq/steven-pinker",
"http://thecolbertreport.cc.com/videos/tpb22v/good-night----except-for-the-west-coast"
],
"guest": "Eleanor Holmes Norton, Steven Pinker"
},
{
"date": "2009-02-12",
"videos": [
"http://thecolbertreport.cc.com/videos/m1tx5d/exclusive---stephen-s-sexiest-moments",
"http://thecolbertreport.cc.com/videos/f0688o/obama-poster-debate---david-ross-and-ed-colbert",
"http://thecolbertreport.cc.com/videos/vgbtpp/the-dacolbert-code---oscar-predictions",
"http://thecolbertreport.cc.com/videos/tbf4y6/adam-gopnik",
"http://thecolbertreport.cc.com/videos/okmu84/goodbye--conan-o-brien"
],
"guest": "David Ross, Ed Colbert, Adam Gopnik"
},
{
"date": "2009-02-23",
"videos": [
"http://thecolbertreport.cc.com/videos/9ynh43/intro---02-23-09",
"http://thecolbertreport.cc.com/videos/xlgfrl/stephen-s-prayer-day",
"http://thecolbertreport.cc.com/videos/legx6j/stephen-s-moral-dimension",
"http://thecolbertreport.cc.com/videos/om9959/helen-fisher"
],
"guest": "Father James Martin, Helen Fisher"
},
{
"date": "2009-02-24",
"videos": [
"http://thecolbertreport.cc.com/videos/mngx54/mardi-gras-celebrations",
"http://thecolbertreport.cc.com/videos/9jcm4g/1997-flashback",
"http://thecolbertreport.cc.com/videos/pljjhc/nailed--em---buffet-crime",
"http://thecolbertreport.cc.com/videos/n75sz3/cliff-sloan",
"http://thecolbertreport.cc.com/videos/yg82dj/happy-mardi-gras",
"http://thecolbertreport.cc.com/videos/823sva/turning-to-religion---jim-martin",
"http://thecolbertreport.cc.com/videos/gks8m8/breaded-fish-sticks"
],
"guest": "Cliff Sloan"
},
{
"date": "2009-02-25",
"videos": [
"http://thecolbertreport.cc.com/videos/4v3vka/intro---02-25-09",
"http://thecolbertreport.cc.com/videos/fbot0q/obama-s-congressional-address---jindal-s-response",
"http://thecolbertreport.cc.com/videos/o1f5mr/tip-wag---gorilla-crabs-and-gandhi-s-shoes",
"http://thecolbertreport.cc.com/videos/jyyb0h/john-fetterman",
"http://thecolbertreport.cc.com/videos/10ufmk/bears---balls---company-bailouts"
],
"guest": "John Fetterman"
},
{
"date": "2009-02-26",
"videos": [
"http://thecolbertreport.cc.com/videos/lvfhs2/intro---02-26-09",
"http://thecolbertreport.cc.com/videos/1q3zjs/claire-mccaskill-s-twittering",
"http://thecolbertreport.cc.com/videos/5j9jjo/conservative-rap-battle---stephen-challenges-michael-steele",
"http://thecolbertreport.cc.com/videos/831wm1/kris-kristofferson",
"http://thecolbertreport.cc.com/videos/lh0vwj/the-word---ablacknophobia",
"http://thecolbertreport.cc.com/videos/um02qq/analog-tv"
],
"guest": "Kris Kristofferson"
},
{
"date": "2009-03-02",
"videos": [
"http://thecolbertreport.cc.com/videos/tfciz3/conservative-rap-battle---michael-steele-gets-served",
"http://thecolbertreport.cc.com/videos/xtntgt/snow-in-the-studio",
"http://thecolbertreport.cc.com/videos/52t6yh/p-k--winsome---defective-obama-collectibles",
"http://thecolbertreport.cc.com/videos/j78ngs/david-byrne"
],
"guest": "David Byrne"
},
{
"date": "2009-03-03",
"videos": [
"http://thecolbertreport.cc.com/videos/qs5iv1/beer-pong-herpes-outbreak",
"http://thecolbertreport.cc.com/videos/0c92nb/guns-for-roses",
"http://thecolbertreport.cc.com/videos/l9p0ah/space-module--colbert---name-nasa-s-node-3-after-stephen",
"http://thecolbertreport.cc.com/videos/oayyzq/mark-bittman",
"http://thecolbertreport.cc.com/videos/tfciz3/conservative-rap-battle---michael-steele-gets-served"
],
"guest": "Mark Bittman"
},
{
"date": "2009-03-04",
"videos": [
"http://thecolbertreport.cc.com/videos/n8kt9r/intro---03-04-09",
"http://thecolbertreport.cc.com/videos/kob10w/space-module--colbert---scientology-s-new-galactic-overlord",
"http://thecolbertreport.cc.com/videos/9opkqc/doom-bunker---jack-jacobs-and-stephen-moore",
"http://thecolbertreport.cc.com/videos/sx98t6/carl-wilson",
"http://thecolbertreport.cc.com/videos/239tij/goodnight",
"http://thecolbertreport.cc.com/videos/1kkbbd/intro---03-03-09",
"http://thecolbertreport.cc.com/videos/00d1sm/the-word---share-the-wealth",
"http://thecolbertreport.cc.com/videos/nhjls5/the-murderer-was-derek"
],
"guest": "Carl Wilson"
},
{
"date": "2009-03-05",
"videos": [
"http://thecolbertreport.cc.com/videos/ej854l/intro---03-05-09",
"http://thecolbertreport.cc.com/videos/w194ds/obama-s-swing-set",
"http://thecolbertreport.cc.com/videos/a7l1re/tip-wag---rush-limbaugh",
"http://thecolbertreport.cc.com/videos/n8dlml/steven-johnson",
"http://thecolbertreport.cc.com/videos/nfx4fy/leave-you-wanting-more",
"http://thecolbertreport.cc.com/videos/1y41q9/doom-bunker---glenn-beck-s--war-room-"
],
"guest": "Steven Johnson"
},
{
"date": "2009-03-09",
"videos": [
"http://thecolbertreport.cc.com/videos/itgd4m/intro---03-09-09",
"http://thecolbertreport.cc.com/videos/4bvnlr/new-baby-abraham-carter-grosz",
"http://thecolbertreport.cc.com/videos/z9c9ak/better-know-a-district---wyoming-s-at-large---cynthia-lummis",
"http://thecolbertreport.cc.com/videos/54ad8f/lisa-hannigan"
],
"guest": "Lisa Hannigan"
},
{
"date": "2009-03-10",
"videos": [
"http://thecolbertreport.cc.com/videos/1h7cfe/intro---03-10-09",
"http://thecolbertreport.cc.com/videos/i1w6au/conservative-rap-battle---droppin--science-on-michael-steele",
"http://thecolbertreport.cc.com/videos/858jnr/coffee-induced-hallucinations",
"http://thecolbertreport.cc.com/videos/ogsw1c/jay-keasling",
"http://thecolbertreport.cc.com/videos/ovf9hb/sick-three-way",
"http://thecolbertreport.cc.com/videos/mtwuig/exclusive---better-know-a-district---wyoming-s-at-large---cynthia-lummis",
"http://thecolbertreport.cc.com/videos/psylhz/the-word---locked-and-loathed",
"http://thecolbertreport.cc.com/videos/dw94ms/sleep-tight--abraham"
],
"guest": "William Gerstenmaier, Dr. Jay Keasling"
},
{
"date": "2009-03-11",
"videos": [
"http://thecolbertreport.cc.com/videos/sa3out/intro---03-11-09",
"http://thecolbertreport.cc.com/videos/4sbc36/earmarks-abuse-ends-tomorrow",
"http://thecolbertreport.cc.com/videos/7bt4s0/cheating-death---legal--sweat---pre-natal-health",
"http://thecolbertreport.cc.com/videos/rovggj/howard-fineman",
"http://thecolbertreport.cc.com/videos/vpswgr/stephen-s-encore",
"http://thecolbertreport.cc.com/videos/m6st31/space-module--colbert---william-gerstenmaier"
],
"guest": "Howard Fineman"
},
{
"date": "2009-03-12",
"videos": [
"http://thecolbertreport.cc.com/videos/xum4x8/intro---03-12-09",
"http://thecolbertreport.cc.com/videos/uvfw3m/mahmoud-s-non-consensual-endorsement-deal",
"http://thecolbertreport.cc.com/videos/p4j2xc/craziest-f--king-thing-i-ve-ever-heard---barreleye-fish",
"http://thecolbertreport.cc.com/videos/8nmnda/peter-singer",
"http://thecolbertreport.cc.com/videos/8tqo3i/goodnight",
"http://thecolbertreport.cc.com/videos/xjpl01/the-word---rand-illusion"
],
"guest": "Simon Johnson, Peter Singer"
},
{
"date": "2009-03-16",
"videos": [
"http://thecolbertreport.cc.com/videos/8zwa7x/intro---03-16-09",
"http://thecolbertreport.cc.com/videos/yz9sik/stephen-s-angry-mob-will-crush-aig",
"http://thecolbertreport.cc.com/videos/pe3tou/better-know-a-governor---mark-sanford-update",
"http://thecolbertreport.cc.com/videos/ck0fd5/neil-gaiman",
"http://thecolbertreport.cc.com/videos/qxrsxr/stephen-wants-to-hug-you"
],
"guest": "Jonathan Chait, Neil Gaiman"
},
{
"date": "2009-03-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ogmrdd/intro---03-17-09",
"http://thecolbertreport.cc.com/videos/v1zxe6/shout-out---the-colbert-report-overseas",
"http://thecolbertreport.cc.com/videos/bsv6p7/world-of-nahlej---shmeat",
"http://thecolbertreport.cc.com/videos/7byrkj/david-grann",
"http://thecolbertreport.cc.com/videos/zrpt32/persian-gulf-countdown-clock",
"http://thecolbertreport.cc.com/videos/59sfdt/the-new-deal---jonathan-chait"
],
"guest": "David Grann"
},
{
"date": "2009-03-18",
"videos": [
"http://thecolbertreport.cc.com/videos/u70zrc/intro---03-18-09",
"http://thecolbertreport.cc.com/videos/an5849/predator-x-discovery",
"http://thecolbertreport.cc.com/videos/fnlgez/tip-wag---mississippi--talk-shows---syfy",
"http://thecolbertreport.cc.com/videos/5hu17z/juan-cole",
"http://thecolbertreport.cc.com/videos/bokh2r/sam-s-club-time",
"http://thecolbertreport.cc.com/videos/3i8x9a/colbert-aluminum---cigar-nubs--faux-poor---blixseth"
],
"guest": "Juan Cole"
},
{
"date": "2009-03-19",
"videos": [
"http://thecolbertreport.cc.com/videos/ntnm0v/intro---03-19-09",
"http://thecolbertreport.cc.com/videos/tkjk8k/bill-posey-alligator-rumors",
"http://thecolbertreport.cc.com/videos/oi2fxr/when-animals-attack-our-morals---chimps--lizards---spiders",
"http://thecolbertreport.cc.com/videos/m9oys8/john-mccardell",
"http://thecolbertreport.cc.com/videos/f189zq/space-module--colbert---vote-now",
"http://thecolbertreport.cc.com/videos/wa8cs2/the-word---keeping-our-heads"
],
"guest": "John McCardell"
},
{
"date": "2009-03-30",
"videos": [
"http://thecolbertreport.cc.com/videos/hta8xf/intro---03-30-09",
"http://thecolbertreport.cc.com/videos/04agpr/violence-in-mexico",
"http://thecolbertreport.cc.com/videos/ttpqpq/me-time---emily-yoffe-on-narcissistic-personality-disorder",
"http://thecolbertreport.cc.com/videos/y6yflv/space-module--colbert---democracy-in-orbit",
"http://thecolbertreport.cc.com/videos/yz8bqz/derrick-pitts"
],
"guest": "Derrick Pitts"
},
{
"date": "2009-03-31",
"videos": [
"http://thecolbertreport.cc.com/videos/prw3dp/intro---03-31-09",
"http://thecolbertreport.cc.com/videos/ga9h1c/obama-s-epic-dog-quest",
"http://thecolbertreport.cc.com/videos/19bdth/better-know-a-lobby---newspaper-association-of-america",
"http://thecolbertreport.cc.com/videos/fkt6tu/david-plotz",
"http://thecolbertreport.cc.com/videos/ch71k9/sudoku-answers",
"http://thecolbertreport.cc.com/videos/7l6w83/me-time---american-narcissism",
"http://thecolbertreport.cc.com/videos/k0knxh/30-minute-applause"
],
"guest": "David Plotz"
},
{
"date": "2009-04-01",
"videos": [
"http://thecolbertreport.cc.com/videos/du0pk9/intro---04-01-09",
"http://thecolbertreport.cc.com/videos/1o1nya/french-worker-protests",
"http://thecolbertreport.cc.com/videos/5t3340/cheating-death---sperm-sale---colonoscopies",
"http://thecolbertreport.cc.com/videos/wol3qg/dambisa-moyo",
"http://thecolbertreport.cc.com/videos/vof9z5/hide-and-seek",
"http://thecolbertreport.cc.com/videos/jt0f3j/the-10-31-project"
],
"guest": "Dambisa Moyo"
},
{
"date": "2009-04-02",
"videos": [
"http://thecolbertreport.cc.com/videos/scsjxw/intro---04-02-09",
"http://thecolbertreport.cc.com/videos/78s5oz/cheney-s-secret-assassination-squad",
"http://thecolbertreport.cc.com/videos/mkb4ls/merriam-webster-s-word-s-worth",
"http://thecolbertreport.cc.com/videos/4qhn4o/biz-stone",
"http://thecolbertreport.cc.com/videos/5uxqom/let-your-gps-be-your-guide",
"http://thecolbertreport.cc.com/videos/idkq46/the-word---fine-line"
],
"guest": "Biz Stone"
},
{
"date": "2009-04-06",
"videos": [
"http://thecolbertreport.cc.com/videos/d5ju1a/colbert-s-easter-parade",
"http://thecolbertreport.cc.com/videos/v1ybgk/intro---04-06-09",
"http://thecolbertreport.cc.com/videos/f3bajc/body-loss",
"http://thecolbertreport.cc.com/videos/y3ocaq/space-module--colbert---urine-recycling-room",
"http://thecolbertreport.cc.com/videos/2zq8u0/rich-lowry",
"http://thecolbertreport.cc.com/videos/k9vxpy/make-lemonade"
],
"guest": "Tom Brokaw, Rich Lowry"
},
{
"date": "2009-04-07",
"videos": [
"http://thecolbertreport.cc.com/videos/168lgg/intro---04-07-09",
"http://thecolbertreport.cc.com/videos/9kk3jy/queen-noor-s-royal-treatment",
"http://thecolbertreport.cc.com/videos/6uykwu/better-know-a-district---new-york-s-25th---dan-maffei",
"http://thecolbertreport.cc.com/videos/31tszu/queen-noor",
"http://thecolbertreport.cc.com/videos/pqumra/hiccup-free",
"http://thecolbertreport.cc.com/videos/njp3xz/un-american-news---rest-of-the-world",
"http://thecolbertreport.cc.com/videos/u5yf3y/obama-s-european-trip---tom-brokaw"
],
"guest": "Queen Noor"
},
{
"date": "2009-04-08",
"videos": [
"http://thecolbertreport.cc.com/videos/f1gjz4/intro---04-08-09",
"http://thecolbertreport.cc.com/videos/lyeuyj/birkat-hachama---stephen-frees-his-jews",
"http://thecolbertreport.cc.com/videos/10cwvc/alpha-dog-of-the-week---ted-stevens",
"http://thecolbertreport.cc.com/videos/eknw52/phil-bronstein",
"http://thecolbertreport.cc.com/videos/jmb43t/electronic-edition",
"http://thecolbertreport.cc.com/videos/7jw15b/the-word---morally-bankrupt"
],
"guest": "Phil Bronstein"
},
{
"date": "2009-04-09",
"videos": [
"http://thecolbertreport.cc.com/videos/ly7fhn/workers--comp-temptation",
"http://thecolbertreport.cc.com/videos/1adwqk/threatdown---robert-gates--dog-seders---obama",
"http://thecolbertreport.cc.com/videos/lywaay/bart-ehrman",
"http://thecolbertreport.cc.com/videos/vd2m1k/stephen-s-severed-head",
"http://thecolbertreport.cc.com/videos/4wgqsm/where-and-when-is-stephen-going-to-the-persian-gulf----bahrain"
],
"guest": "Bart Ehrman"
},
{
"date": "2009-04-14",
"videos": [
"http://thecolbertreport.cc.com/videos/uvnlz3/intro---04-14-09",
"http://thecolbertreport.cc.com/videos/1tgxfo/clarence-thomas--new-job",
"http://thecolbertreport.cc.com/videos/bz4xly/space-module--colbert---sunita-williams",
"http://thecolbertreport.cc.com/videos/gxfl4g/susie-orbach",
"http://thecolbertreport.cc.com/videos/5m2sci/goodnight--helen"
],
"guest": "Sunita L. Williams, Susie Orbach"
},
{
"date": "2009-04-15",
"videos": [
"http://thecolbertreport.cc.com/videos/2t8bkw/intro---04-15-09",
"http://thecolbertreport.cc.com/videos/whfbdu/obama-denies-habeas-corpus",
"http://thecolbertreport.cc.com/videos/xkxq0s/better-know-a-district---illinois--18th---aaron-schock",
"http://thecolbertreport.cc.com/videos/0ca7u5/jim-lehrer",
"http://thecolbertreport.cc.com/videos/g6fu2q/homework-assignment",
"http://thecolbertreport.cc.com/videos/5rzknc/the-word---have-your-cake-and-eat-it--too"
],
"guest": "Jim Lehrer"
},
{
"date": "2009-04-16",
"videos": [
"http://thecolbertreport.cc.com/videos/t8chps/intro---04-16-09",
"http://thecolbertreport.cc.com/videos/abfalc/teabagging-protests",
"http://thecolbertreport.cc.com/videos/npq9t7/indian-elections---kanishk-tharoor",
"http://thecolbertreport.cc.com/videos/btde8y/douglas-kmiec",
"http://thecolbertreport.cc.com/videos/gu6q0n/goodnight-salute",
"http://thecolbertreport.cc.com/videos/a8qba2/tax-atax"
],
"guest": "Kanishk Tharoor, Doug Kmiec"
},
{
"date": "2009-04-20",
"videos": [
"http://thecolbertreport.cc.com/videos/b06wzj/intro---04-20-09",
"http://thecolbertreport.cc.com/videos/3g58oe/castro-death-wish-list",
"http://thecolbertreport.cc.com/videos/pzg5id/maersk-alabama---ken-quinn",
"http://thecolbertreport.cc.com/videos/b1hfbd/tip-wag---texas-secession---maca",
"http://thecolbertreport.cc.com/videos/qi09sh/joe-arpaio"
],
"guest": "Ken Quinn, Sheriff Joe Arpaio"
},
{
"date": "2009-04-21",
"videos": [
"http://thecolbertreport.cc.com/videos/fll3xv/intro---04-21-09",
"http://thecolbertreport.cc.com/videos/mnalwu/george-will-s-demon-denim",
"http://thecolbertreport.cc.com/videos/hezs49/who-s-riding-my-coattails-now----blown-away-by-the-usa",
"http://thecolbertreport.cc.com/videos/7lqvgy/mike-krzyzewski",
"http://thecolbertreport.cc.com/videos/4dj3xs/special-dvd-commentary",
"http://thecolbertreport.cc.com/videos/g9ilpe/anger-s-aweigh",
"http://thecolbertreport.cc.com/videos/h6pabb/stephen-s-only-regrets"
],
"guest": "Coach Mike Kryzewski"
},
{
"date": "2009-04-22",
"videos": [
"http://thecolbertreport.cc.com/videos/licvuz/intro---04-22-09",
"http://thecolbertreport.cc.com/videos/g6q0sp/-the-price-is-right--goes-green",
"http://thecolbertreport.cc.com/videos/7ax5b6/where-and-when-is-stephen-going-to-the-persian-gulf----qatar",
"http://thecolbertreport.cc.com/videos/ui31iq/ira-glass",
"http://thecolbertreport.cc.com/videos/77b5v5/never-go-to-bed-angry",
"http://thecolbertreport.cc.com/videos/zbqudz/the-word---stressed-position"
],
"guest": "Ira Glass"
},
{
"date": "2009-04-23",
"videos": [
"http://thecolbertreport.cc.com/videos/gj1jdr/intro---04-23-09",
"http://thecolbertreport.cc.com/videos/16z7m7/america-does-not-swear-on-camera",
"http://thecolbertreport.cc.com/videos/dbshcz/illegitimate-grandson-of-an-alligator",
"http://thecolbertreport.cc.com/videos/2tn51j/elizabeth-bintliff",
"http://thecolbertreport.cc.com/videos/ylolny/goodnight--daisy",
"http://thecolbertreport.cc.com/videos/g1doyw/summit-of-all-fears"
],
"guest": "Elizabeth Bintliff"
},
{
"date": "2009-04-27",
"videos": [
"http://thecolbertreport.cc.com/videos/ak2bbq/intro---04-27-09",
"http://thecolbertreport.cc.com/videos/u3yqqg/days-of-swine-and-doses",
"http://thecolbertreport.cc.com/videos/ioe7hh/craziest-f--king-thing-i-ve-ever-heard---fir-tree-lung",
"http://thecolbertreport.cc.com/videos/6ywn6l/a-rare-correction---stephen-eats-an-ewok",
"http://thecolbertreport.cc.com/videos/jlx2r1/the-decemberists"
],
"guest": "The Decemberists"
},
{
"date": "2009-04-28",
"videos": [
"http://thecolbertreport.cc.com/videos/5phyy1/intro---04-28-09",
"http://thecolbertreport.cc.com/videos/pwdiki/arlen-specter-contracts-donkey-flu",
"http://thecolbertreport.cc.com/videos/14mfow/foreign-reporting---richard-engel",
"http://thecolbertreport.cc.com/videos/u40xb8/daniel-gross",
"http://thecolbertreport.cc.com/videos/l8q5cp/shout-out---kids-edition"
],
"guest": "Richard Engel, Daniel Gross"
},
{
"date": "2009-04-29",
"videos": [
"http://thecolbertreport.cc.com/videos/we8zzj/intro---04-29-09",
"http://thecolbertreport.cc.com/videos/0gktuh/ahmadinejad-steals-obama-s-slogan",
"http://thecolbertreport.cc.com/videos/ou4xko/enemy-swine--a-pigcalypse-now",
"http://thecolbertreport.cc.com/videos/i5hw2i/david-kessler",
"http://thecolbertreport.cc.com/videos/seesef/feet-teeth",
"http://thecolbertreport.cc.com/videos/5kllsr/where-and-when-is-stephen-going-to-the-persian-gulf----correspondents",
"http://thecolbertreport.cc.com/videos/ewzt0z/no-animals-were-harmed"
],
"guest": "David Kessler"
},
{
"date": "2009-04-30",
"videos": [
"http://thecolbertreport.cc.com/videos/4ncl78/intro---04-30-09",
"http://thecolbertreport.cc.com/videos/hr47fj/president-obama---the-first-14-mondays",
"http://thecolbertreport.cc.com/videos/zhiu9l/ethan-nadelmann",
"http://thecolbertreport.cc.com/videos/1e83az/the-after-show",
"http://thecolbertreport.cc.com/videos/dnh80p/i-s-on-edjukashun---textbooks--americorps---strip-search"
],
"guest": "Jonathan Alter, Ethan Nadelman"
},
{
"date": "2009-05-04",
"videos": [
"http://thecolbertreport.cc.com/videos/ithaxo/code-word---empathy",
"http://thecolbertreport.cc.com/videos/e4d421/the-prescott-group-bailout",
"http://thecolbertreport.cc.com/videos/57pcxy/j-j--abrams",
"http://thecolbertreport.cc.com/videos/3q06z6/sign-off---colbert-nation-home"
],
"guest": "J.J. Abrams"
},
{
"date": "2009-05-05",
"videos": [
"http://thecolbertreport.cc.com/videos/1yb1cp/intro---05-05-09",
"http://thecolbertreport.cc.com/videos/daeu0o/cinco-de-mayo-precautions",
"http://thecolbertreport.cc.com/videos/73g8ui/the-word---captain-kangaroo-court",
"http://thecolbertreport.cc.com/videos/sye42t/paul-rieckhoff",
"http://thecolbertreport.cc.com/videos/xul98m/sign-off---iteam",
"http://thecolbertreport.cc.com/videos/0a05it/movies-that-are-destroying-america---summer-movie-edition"
],
"guest": "Cliff Sloan, Paul Rieckhoff"
},
{
"date": "2009-05-06",
"videos": [
"http://thecolbertreport.cc.com/videos/4aqttz/intro---05-06-09",
"http://thecolbertreport.cc.com/videos/k97z53/colbert-branson-duel",
"http://thecolbertreport.cc.com/videos/4h8qcx/where-and-when-is-stephen-going-to-the-persian-gulf----saudi-arabia",
"http://thecolbertreport.cc.com/videos/q7lfqg/laurie-garrett",
"http://thecolbertreport.cc.com/videos/2y8ihh/hug-your-television",
"http://thecolbertreport.cc.com/videos/mekuw6/picking-a-new-supreme-court-justice---cliff-sloan"
],
"guest": "Laurie Garrett"
},
{
"date": "2009-05-07",
"videos": [
"http://thecolbertreport.cc.com/videos/nqr22g/intro---05-07-09",
"http://thecolbertreport.cc.com/videos/40ivqy/sean-hannity-s-liberty-tree",
"http://thecolbertreport.cc.com/videos/ednx54/smokin--pole---the-fight-for-arctic-riches--inuit-nation",
"http://thecolbertreport.cc.com/videos/as8qiu/mitchell-joachim",
"http://thecolbertreport.cc.com/videos/4bas9p/spay-and-neuter-your-pets",
"http://thecolbertreport.cc.com/videos/686y3f/tip-wag---forced-smoking---grizzly-best-man"
],
"guest": "Mitchell Joachim"
},
{
"date": "2009-05-11",
"videos": [
"http://thecolbertreport.cc.com/videos/imn21t/intro---05-11-09",
"http://thecolbertreport.cc.com/videos/cctfpl/stephen-s-fancy-feast",
"http://thecolbertreport.cc.com/videos/bwc8x1/credit-card-industry-regulation---tamara-draut",
"http://thecolbertreport.cc.com/videos/cguksk/alpha-dog-of-the-week---erik-slye",
"http://thecolbertreport.cc.com/videos/3ttm11/jeff-daniels"
],
"guest": "Tamara Draut"
},
{
"date": "2009-05-12",
"videos": [
"http://thecolbertreport.cc.com/videos/wr98c1/intro---05-12-09",
"http://thecolbertreport.cc.com/videos/zy5zj6/howard-s-end",
"http://thecolbertreport.cc.com/videos/n89zl7/cuba-us-trade-relations---julia-sweig",
"http://thecolbertreport.cc.com/videos/hs7gtm/stephen-s-sound-advice---how-to-re-brand-the-gop",
"http://thecolbertreport.cc.com/videos/a0bgn9/ron-howard",
"http://thecolbertreport.cc.com/videos/6fx090/credit-check",
"http://thecolbertreport.cc.com/videos/lzvish/sign-off---unicorn-dealership"
],
"guest": "Ron Howard"
},
{
"date": "2009-05-13",
"videos": [
"http://thecolbertreport.cc.com/videos/yvcq61/intro---05-13-09",
"http://thecolbertreport.cc.com/videos/g3716f/robert-gibbs-hates-ringing-cell-phones",
"http://thecolbertreport.cc.com/videos/hp9jyy/colbert-platinum----1-000-dishes",
"http://thecolbertreport.cc.com/videos/eon7i2/michael-pollan",
"http://thecolbertreport.cc.com/videos/0it13s/stephen-colbert-is-awesome",
"http://thecolbertreport.cc.com/videos/5715dt/our-plan-in-havana",
"http://thecolbertreport.cc.com/videos/g7s21x/you-are-a-dummy"
],
"guest": "Michael Pollan"
},
{
"date": "2009-05-14",
"videos": [
"http://thecolbertreport.cc.com/videos/ph1m2t/intro---05-14-09",
"http://thecolbertreport.cc.com/videos/priitm/caveman-porn-stash",
"http://thecolbertreport.cc.com/videos/phfour/donorschoose-org-donations",
"http://thecolbertreport.cc.com/videos/m82ydm/yusuf",
"http://thecolbertreport.cc.com/videos/vyychn/stephen-s-coke-party-protest"
],
"guest": "Yusuf"
},
{
"date": "2009-05-18",
"videos": [
"http://thecolbertreport.cc.com/videos/hopfi8/intro---05-18-09",
"http://thecolbertreport.cc.com/videos/gc17yz/welcome-to-the-real-world--obama",
"http://thecolbertreport.cc.com/videos/oh4xki/threatdown---charity--casual-jesus---robot-teachers",
"http://thecolbertreport.cc.com/videos/phv8h6/meghan-mccain",
"http://thecolbertreport.cc.com/videos/h4dfgj/sign-off---internal-clock"
],
"guest": "Meghan McCain"
},
{
"date": "2009-05-19",
"videos": [
"http://thecolbertreport.cc.com/videos/k69zx1/intro---05-19-09",
"http://thecolbertreport.cc.com/videos/um8x6x/rumsfeld-s-cover-letter-bible-quotes",
"http://thecolbertreport.cc.com/videos/9w54d6/difference-makers---stephen-keith",
"http://thecolbertreport.cc.com/videos/tn9xuo/walter-kirn",
"http://thecolbertreport.cc.com/videos/l2dw5z/stephen-s-show",
"http://thecolbertreport.cc.com/videos/y5v5ns/the-word---tough-cell"
],
"guest": "Walter Kirn"
},
{
"date": "2009-05-20",
"videos": [
"http://thecolbertreport.cc.com/videos/zq89uw/intro---05-20-09",
"http://thecolbertreport.cc.com/videos/b9eth2/extra--extra--bleed-all-about-it-",
"http://thecolbertreport.cc.com/videos/e5f1sd/donorschoose-org-classroom-projects",
"http://thecolbertreport.cc.com/videos/u2rpts/seth-shostak",
"http://thecolbertreport.cc.com/videos/m63aac/goodnight",
"http://thecolbertreport.cc.com/videos/i401ml/the-word---i-know-you-are-but-what-am-i-"
],
"guest": "Seth Shostak"
},
{
"date": "2009-05-21",
"videos": [
"http://thecolbertreport.cc.com/videos/sll291/intro---05-21-09",
"http://thecolbertreport.cc.com/videos/hck7te/47-million-year-old-fossil",
"http://thecolbertreport.cc.com/videos/4kzrbn/formidable-opponent---pragmatism-or-idealism",
"http://thecolbertreport.cc.com/videos/ait1y2/green-day",
"http://thecolbertreport.cc.com/videos/iuaf6k/she-said--cia-said---bob-graham"
],
"guest": "Green Day"
},
{
"date": "2009-06-01",
"videos": [
"http://thecolbertreport.cc.com/videos/kbuqbk/intro---06-01-09",
"http://thecolbertreport.cc.com/videos/ckumab/guns-in-national-parks",
"http://thecolbertreport.cc.com/videos/ezeifx/sonia-sotomayor-s-nomination---jeffrey-toobin",
"http://thecolbertreport.cc.com/videos/2p70rc/where-and-when-is-stephen-going-to-the-persian-gulf----united-arab-emirates",
"http://thecolbertreport.cc.com/videos/4suoo4/byron-dorgan"
],
"guest": "Jeffrey Toobin, Sen. Byron Dorgan"
},
{
"date": "2009-06-02",
"videos": [
"http://thecolbertreport.cc.com/videos/poyt56/intro---06-02-09",
"http://thecolbertreport.cc.com/videos/xahwo7/saudi-arabia-press-restrictions",
"http://thecolbertreport.cc.com/videos/m4ur7f/jim-moran-vs--viagra",
"http://thecolbertreport.cc.com/videos/bpwglm/katty-kay",
"http://thecolbertreport.cc.com/videos/860dm5/best-audience-of-the-night",
"http://thecolbertreport.cc.com/videos/ch9xnn/supreme-court-press",
"http://thecolbertreport.cc.com/videos/t28i3d/dance-for-stephen"
],
"guest": "Katty Kay"
},
{
"date": "2009-06-03",
"videos": [
"http://thecolbertreport.cc.com/videos/lte593/intro---06-03-09",
"http://thecolbertreport.cc.com/videos/1azzsn/we-have-a-death-star-",
"http://thecolbertreport.cc.com/videos/in49m6/tip-wag---4th-of-july--craig-t--nelson---gm",
"http://thecolbertreport.cc.com/videos/ughago/eric-schlosser",
"http://thecolbertreport.cc.com/videos/fw7nrm/sign-off----the-hollow-men-",
"http://thecolbertreport.cc.com/videos/rfeepg/cheating-death---cheerios--soda-paralysis---oprah-s-crazy-talk"
],
"guest": "Eric Schlosser"
},
{
"date": "2009-06-04",
"videos": [
"http://thecolbertreport.cc.com/videos/rpkl6b/intro---06-04-09",
"http://thecolbertreport.cc.com/videos/oqx005/wikipedia-bans-scientologists",
"http://thecolbertreport.cc.com/videos/anuhnx/craziest-f--king-thing-i-ve-ever-heard---external-lungs",
"http://thecolbertreport.cc.com/videos/obi6e0/dag-soderberg",
"http://thecolbertreport.cc.com/videos/u226dl/the-word---i-do--you-don-t"
],
"guest": "Dag Soderberg, David Byrne"
},
{
"date": "2009-06-08",
"videos": [
"http://thecolbertreport.cc.com/videos/gbu94e/operation-iraqi-stephen---mysterious-trip",
"http://thecolbertreport.cc.com/videos/wy7a2l/operation-iraqi-stephen---john-mccain",
"http://thecolbertreport.cc.com/videos/n4g2vg/stephen-strong---army-of-me---basic-training-pt--1",
"http://thecolbertreport.cc.com/videos/c4z5y3/obama-orders-stephen-s-haircut---ray-odierno",
"http://thecolbertreport.cc.com/videos/m6uaot/sign-off---new-haircut"
],
"guest": "Stephen broadcasts from Iraq, Gen. Ray Odierno"
},
{
"date": "2009-06-09",
"videos": [
"http://thecolbertreport.cc.com/videos/xuowp6/operation-iraqi-stephen---s-h-",
"http://thecolbertreport.cc.com/videos/nlvzz2/operation-iraqi-stephen---bill-clinton---amp-energy",
"http://thecolbertreport.cc.com/videos/8querl/formidable-opponent---don-t-ask--don-t-tell",
"http://thecolbertreport.cc.com/videos/xjmvnq/tareq-salha---robin-balcom",
"http://thecolbertreport.cc.com/videos/bdo17v/sign-off---hi--stephen-s-mom",
"http://thecolbertreport.cc.com/videos/clgan9/the-word---why-are-you-here-"
],
"guest": "Stephen broadcasts from Iraq (1)"
},
{
"date": "2009-06-10",
"videos": [
"http://thecolbertreport.cc.com/videos/3avxyi/operation-iraqi-stephen---stephen-s-spider-hole",
"http://thecolbertreport.cc.com/videos/cyrxgp/admiral-crunch",
"http://thecolbertreport.cc.com/videos/xfobul/lt--gen--charles-h--jacoby-jr-",
"http://thecolbertreport.cc.com/videos/jk0yi6/sign-off---head-rub",
"http://thecolbertreport.cc.com/videos/nlng6v/operation-iraqi-stephen---tom-hanks-care-package",
"http://thecolbertreport.cc.com/videos/xbtx2g/stephen-strong---army-of-me---basic-training-pt--2"
],
"guest": "Stephen broadcasts from Iraq (2)"
},
{
"date": "2009-06-11",
"videos": [
"http://thecolbertreport.cc.com/videos/x1yyko/stephen-gets-his-hair-cut",
"http://thecolbertreport.cc.com/videos/ithwrz/operation-iraqi-stephen---golf-club---george-w--bush-s-greeting",
"http://thecolbertreport.cc.com/videos/9p7eto/operation-iraqi-stephen---fallback-position---air-force-thunderbirds",
"http://thecolbertreport.cc.com/videos/hqcfyh/operation-iraqi-stephen---frank-a--grippe",
"http://thecolbertreport.cc.com/videos/aa7w7z/operation-iraqi-stephen---sign-off---honey--i-m-coming-home",
"http://thecolbertreport.cc.com/videos/74tfzb/better-know-a-cradle-of-civilization---barham-saleh"
],
"guest": "Stephen broadcasts from Iraq (3)"
},
{
"date": "2009-06-15",
"videos": [
"http://thecolbertreport.cc.com/videos/7zoy4v/intro---06-15-09",
"http://thecolbertreport.cc.com/videos/ycfoc7/warm-memories-of-iraq",
"http://thecolbertreport.cc.com/videos/cgcvlh/car-shout---gm---chrysler",
"http://thecolbertreport.cc.com/videos/px4jql/austan-goolsbee",
"http://thecolbertreport.cc.com/videos/22hank/sign-off---driving-for-the-last-10-minutes"
],
"guest": "Austan Goolsbee"
},
{
"date": "2009-06-16",
"videos": [
"http://thecolbertreport.cc.com/videos/6kwzzi/intro---06-16-09",
"http://thecolbertreport.cc.com/videos/e51xox/croatia-s-biggest-jeans-world-record",
"http://thecolbertreport.cc.com/videos/86p43v/teh-runoff---karim-sadjadpour",
"http://thecolbertreport.cc.com/videos/guirtz/balls-for-kidz---carnivals-encore",
"http://thecolbertreport.cc.com/videos/8g3agb/jim-rogers",
"http://thecolbertreport.cc.com/videos/1bur1p/stephen-s-sound-advice---how-to-be-a-totalitarian-nutjob"
],
"guest": "Karim Sadjadpour, Jim Rogers"
},
{
"date": "2009-06-17",
"videos": [
"http://thecolbertreport.cc.com/videos/vz7xis/intro---06-17-09",
"http://thecolbertreport.cc.com/videos/y8n8bj/stephen-s-positive-obama-coverage",
"http://thecolbertreport.cc.com/videos/v8qfms/the-word---bohemian-grove",
"http://thecolbertreport.cc.com/videos/fgc5qj/alpha-dog-of-the-week---silvio-berlusconi",
"http://thecolbertreport.cc.com/videos/6wqhd0/joshua-micah-marshall",
"http://thecolbertreport.cc.com/videos/1jvq35/teh-runoff",
"http://thecolbertreport.cc.com/videos/31otgs/goodnight"
],
"guest": "Joshua Micah Marshall"
},
{
"date": "2009-06-18",
"videos": [
"http://thecolbertreport.cc.com/videos/ewcaj5/intro---06-18-09",
"http://thecolbertreport.cc.com/videos/0qwej8/murder-in-the-white-house---jeff-goldblum",
"http://thecolbertreport.cc.com/videos/nmpsnk/bears---balls---tobacco--project-natal---graveyard-bids",
"http://thecolbertreport.cc.com/videos/e8rev9/paul-muldoon",
"http://thecolbertreport.cc.com/videos/dvld1q/sign-off---law---order-preview",
"http://thecolbertreport.cc.com/videos/e8h8e5/murder-in-the-white-house---fly-widow-interview",
"http://thecolbertreport.cc.com/videos/e72lp2/sign-off---aloha--idaho"
],
"guest": "Paul Muldoon"
},
{
"date": "2009-06-22",
"videos": [
"http://thecolbertreport.cc.com/videos/je4uya/intro---06-22-09",
"http://thecolbertreport.cc.com/videos/91fk6r/zicam-recall",
"http://thecolbertreport.cc.com/videos/h9527k/the-enemy-within---cane-fu",
"http://thecolbertreport.cc.com/videos/he9dc0/simon-schama",
"http://thecolbertreport.cc.com/videos/k4vrsb/sign-off---stephen-suffers--too"
],
"guest": "Simon Schama"
},
{
"date": "2009-06-23",
"videos": [
"http://thecolbertreport.cc.com/videos/wovkbp/barack-obama-s-response-to-iran",
"http://thecolbertreport.cc.com/videos/yaknra/america-s-health-plan-demic",
"http://thecolbertreport.cc.com/videos/xc1sqp/governor-alert---the-search-for-mark-sanford",
"http://thecolbertreport.cc.com/videos/fmv6yq/david-kilcullen",
"http://thecolbertreport.cc.com/videos/i99yp3/the-smell-of-freedom---jeff-goldblum"
],
"guest": "Howard Dean, David Kilcullen"
},
{
"date": "2009-06-24",
"videos": [
"http://thecolbertreport.cc.com/videos/rhiizu/intro---06-24-09",
"http://thecolbertreport.cc.com/videos/5xejpe/mark-sanford-does-something-interesting",
"http://thecolbertreport.cc.com/videos/neths8/matthew-crawford",
"http://thecolbertreport.cc.com/videos/i50dum/sign-off---random-gps-coordinate-lottery",
"http://thecolbertreport.cc.com/videos/jkobj5/america-s-health-plan-demic---howard-dean",
"http://thecolbertreport.cc.com/videos/411cqv/sign-off---goodnight"
],
"guest": "Matthew Crawford"
},
{
"date": "2009-06-25",
"videos": [
"http://thecolbertreport.cc.com/videos/j1tx3a/intro---06-25-09",
"http://thecolbertreport.cc.com/videos/g71yl5/gay-demon-on-the-loose",
"http://thecolbertreport.cc.com/videos/5gki1y/commonsense-health-care-reform-infomercial",
"http://thecolbertreport.cc.com/videos/ohjhjq/jim-fouratt",
"http://thecolbertreport.cc.com/videos/l3h2eg/sign-off---one-breath",
"http://thecolbertreport.cc.com/videos/nw0bxn/sport-report---soccer--tennis---brett-favre"
],
"guest": "Jim Fouratt"
},
{
"date": "2009-06-29",
"videos": [
"http://thecolbertreport.cc.com/videos/ehxpq9/jeff-goldblum-will-be-missed",
"http://thecolbertreport.cc.com/videos/di8fs8/michael-jackson-s-media-attention",
"http://thecolbertreport.cc.com/videos/8ouc6a/the-word---noncensus",
"http://thecolbertreport.cc.com/videos/4zr9io/neil-degrasse-tyson"
],
"guest": "Neil DeGrasse Tyson"
},
{
"date": "2009-06-30",
"videos": [
"http://thecolbertreport.cc.com/videos/klvpw6/intro---06-30-09",
"http://thecolbertreport.cc.com/videos/hy9hl7/al-franken-finally-declared-senator",
"http://thecolbertreport.cc.com/videos/hzd5cg/4th-of-july-under-attack",
"http://thecolbertreport.cc.com/videos/jzev8y/is-it-time-to-care-about-soccer-",
"http://thecolbertreport.cc.com/videos/knfvfz/is-it-time-to-care-about-soccer----alexi-lalas",
"http://thecolbertreport.cc.com/videos/8x5ezx/kevin-mattson",
"http://thecolbertreport.cc.com/videos/ehxpq9/jeff-goldblum-will-be-missed"
],
"guest": "Alexi Lalas, Kevin Mattson"
},
{
"date": "2009-07-01",
"videos": [
"http://thecolbertreport.cc.com/videos/umpd2x/intro---07-01-09",
"http://thecolbertreport.cc.com/videos/opbzv4/the-second-coming-of-ronald-reagan",
"http://thecolbertreport.cc.com/videos/6wo5t4/the-clinton-curse",
"http://thecolbertreport.cc.com/videos/heqh3g/judge--jury---executioner---firefighters--gold-waste---strip-search",
"http://thecolbertreport.cc.com/videos/r9zau8/nicholas-kristof",
"http://thecolbertreport.cc.com/videos/sldptb/sign-off---farewell--david-souter"
],
"guest": "Nicholas Kristof"
},
{
"date": "2009-07-02",
"videos": [
"http://thecolbertreport.cc.com/videos/f4016f/intro---07-02-09",
"http://thecolbertreport.cc.com/videos/mc9la4/cnn-finds-bubbles-the-chimp",
"http://thecolbertreport.cc.com/videos/n31uuy/re-report---lost-treasures-of-babylon",
"http://thecolbertreport.cc.com/videos/v5trw8/ed-viesturs",
"http://thecolbertreport.cc.com/videos/zc3q4z/sign-off---see-you-at-the-bar",
"http://thecolbertreport.cc.com/videos/sedae1/tip-wag---cynthia-davis---fox-news",
"http://thecolbertreport.cc.com/videos/wyj1b1/sign-off---get-your-illegal-fireworks"
],
"guest": "Ed Viesturs"
},
{
"date": "2009-07-13",
"videos": [
"http://thecolbertreport.cc.com/videos/4zm73s/intro---07-13-09",
"http://thecolbertreport.cc.com/videos/m8x1rr/va-backlog---paul-rieckhoff",
"http://thecolbertreport.cc.com/videos/qvijip/paul-krugman",
"http://thecolbertreport.cc.com/videos/2wjc98/goodnight"
],
"guest": "Paul Rieckhoff, Paul Krugman"
},
{
"date": "2009-07-14",
"videos": [
"http://thecolbertreport.cc.com/videos/w7y41r/intro---07-14-09",
"http://thecolbertreport.cc.com/videos/17wwbv/raise-high-the-rage-beams",
"http://thecolbertreport.cc.com/videos/o7y2te/leymah-gbowee",
"http://thecolbertreport.cc.com/videos/9nhp7n/sign-off---the-pitcher-in-the-oat",
"http://thecolbertreport.cc.com/videos/55a0ws/remembering-remembering-michael-jackson",
"http://thecolbertreport.cc.com/videos/bfjyjy/stephen-s-sound-advice---how-to-bork-a-nominee"
],
"guest": "Leymah Gbowee"
},
{
"date": "2009-07-15",
"videos": [
"http://thecolbertreport.cc.com/videos/38zw9a/intro---07-15-09",
"http://thecolbertreport.cc.com/videos/7avxb3/stephen-wants-to-be-the-worst-person-in-the-world",
"http://thecolbertreport.cc.com/videos/yhsbjx/difference-makers---doug-jackson",
"http://thecolbertreport.cc.com/videos/jkayfy/douglas-rushkoff",
"http://thecolbertreport.cc.com/videos/1ikoxj/sign-off---no-man-is-a-failure",
"http://thecolbertreport.cc.com/videos/9vyt62/senator-wences-questions-sonia-sotomayor",
"http://thecolbertreport.cc.com/videos/jb4xw4/the-word---guns--credit--and-corn"
],
"guest": "Douglas Rushkoff"
},
{
"date": "2009-07-16",
"videos": [
"http://thecolbertreport.cc.com/videos/n291gl/intro---07-16-09",
"http://thecolbertreport.cc.com/videos/7pmbq4/the-memy-awards",
"http://thecolbertreport.cc.com/videos/3ahlmo/cheating-death---diabetes-dogs--chocolate-milk---swearing-in-pain",
"http://thecolbertreport.cc.com/videos/7hp904/edmund-andrews",
"http://thecolbertreport.cc.com/videos/1wc2dn/sign-off---stephen-wins",
"http://thecolbertreport.cc.com/videos/cqz0pq/tip-wag---assassination-squads--biblical-history---gay-penguins"
],
"guest": "Edmund Andrews"
},
{
"date": "2009-07-20",
"videos": [
"http://thecolbertreport.cc.com/videos/z5a6bx/walter-cronkite-remembered",
"http://thecolbertreport.cc.com/videos/0a6zq6/reverse-racism",
"http://thecolbertreport.cc.com/videos/wqv2b7/sport-report---jessica-simpson--olympic-brothel---bud-light",
"http://thecolbertreport.cc.com/videos/bowvin/bob-park",
"http://thecolbertreport.cc.com/videos/x2ppm1/sign-off---goodnight"
],
"guest": "Geoffrey Canada, Bob Park"
},
{
"date": "2009-07-21",
"videos": [
"http://thecolbertreport.cc.com/videos/78h601/intro---07-21-09",
"http://thecolbertreport.cc.com/videos/1egi6s/40th-anniversary-of-the-moon-landing",
"http://thecolbertreport.cc.com/videos/puckfx/better-know-a-lobby---acorn",
"http://thecolbertreport.cc.com/videos/gwtxoo/aaron-carroll",
"http://thecolbertreport.cc.com/videos/o84f1o/sign-off---stephen-s-chip",
"http://thecolbertreport.cc.com/videos/hmh0yy/reverse-racism---geoffrey-canada"
],
"guest": "Dr. Aaron Carroll"
},
{
"date": "2009-07-22",
"videos": [
"http://thecolbertreport.cc.com/videos/j9y28p/intro---07-22-09",
"http://thecolbertreport.cc.com/videos/43yfk6/the-longest-solar-eclipse-of-the-century",
"http://thecolbertreport.cc.com/videos/8st941/sniper-trifle---matthew-waxman",
"http://thecolbertreport.cc.com/videos/gda2z2/pope-wrist-watch",
"http://thecolbertreport.cc.com/videos/hlljrv/chris-anderson",
"http://thecolbertreport.cc.com/videos/tzs7et/the-word---a-perfect-world"
],
"guest": "Matthew Waxman, Chris Anderson"
},
{
"date": "2009-07-23",
"videos": [
"http://thecolbertreport.cc.com/videos/abmeny/health-care-reform-is-the-matrix",
"http://thecolbertreport.cc.com/videos/al2ar6/health-care-hell-scare---die-agnosis--mur-dr",
"http://thecolbertreport.cc.com/videos/lb7ei8/sign-off---tivo",
"http://thecolbertreport.cc.com/videos/l3lw8t/sniper-trifle",
"http://thecolbertreport.cc.com/videos/1y6s8z/sign-off---goodnight"
],
"guest": "Zev Chafets"
},
{
"date": "2009-07-27",
"videos": [
"http://thecolbertreport.cc.com/videos/g64g5i/intro---07-27-09",
"http://thecolbertreport.cc.com/videos/bx3wyo/sarah-palin-will-be-missed",
"http://thecolbertreport.cc.com/videos/5mjokj/nailed--em---library-crime",
"http://thecolbertreport.cc.com/videos/c4hocz/movits-"
],
"guest": "Movits"
},
{
"date": "2009-07-28",
"videos": [
"http://thecolbertreport.cc.com/videos/nwsa83/president-obama-s-teachable-moment",
"http://thecolbertreport.cc.com/videos/574gc1/womb-raiders---the-fight-for-the-truth-behind-obama-s-birth",
"http://thecolbertreport.cc.com/videos/wg36jw/arianna-huffington",
"http://thecolbertreport.cc.com/videos/aayh4c/sign-off---devil-s-tricks",
"http://thecolbertreport.cc.com/videos/g64g5i/intro---07-27-09"
],
"guest": "Arianna Huffington"
},
{
"date": "2009-07-29",
"videos": [
"http://thecolbertreport.cc.com/videos/n0hvmj/intro---07-29-09",
"http://thecolbertreport.cc.com/videos/em0er2/frank-the-roommate",
"http://thecolbertreport.cc.com/videos/hw67wd/sport-report---tour-de-france---robotic-baseball",
"http://thecolbertreport.cc.com/videos/2dvjk4/kevin-baker",
"http://thecolbertreport.cc.com/videos/h00qyf/sign-off---watch-without-blinking",
"http://thecolbertreport.cc.com/videos/zafhtu/womb-raiders---orly-taitz"
],
"guest": "Kevin Baker"
},
{
"date": "2009-07-30",
"videos": [
"http://thecolbertreport.cc.com/videos/jdw6pa/intro---07-30-09",
"http://thecolbertreport.cc.com/videos/uq6k19/white-house-beer-summit",
"http://thecolbertreport.cc.com/videos/fmie7p/tip-wag---man-words---movits-",
"http://thecolbertreport.cc.com/videos/g75n20/kathryn-bigelow",
"http://thecolbertreport.cc.com/videos/2mqpw1/sign-off---taco-bell-spokesdog",
"http://thecolbertreport.cc.com/videos/10c870/the-word---he-who-smelt-it--dealt-it"
],
"guest": "Kathryn Bigelow"
},
{
"date": "2009-08-03",
"videos": [
"http://thecolbertreport.cc.com/videos/6tkw9s/intro---08-03-09",
"http://thecolbertreport.cc.com/videos/g2s68c/dominic-philip-s-book-habit",
"http://thecolbertreport.cc.com/videos/kc14p7/nailed--em---war-on-birth-control",
"http://thecolbertreport.cc.com/videos/yre45i/tony-zinni",
"http://thecolbertreport.cc.com/videos/vv0gs6/sign-off---goodnight"
],
"guest": "Gen. Tony Zinni"
},
{
"date": "2009-08-04",
"videos": [
"http://thecolbertreport.cc.com/videos/2qha08/merry-barackmas",
"http://thecolbertreport.cc.com/videos/wyon84/the-word---hippie-replacement",
"http://thecolbertreport.cc.com/videos/m1d4yt/kurt-andersen",
"http://thecolbertreport.cc.com/videos/e8glog/sign-off---love-makes-the-world-go-round",
"http://thecolbertreport.cc.com/videos/lqp674/bears---balls---how-to-pay-for-health-care"
],
"guest": "Kurt Andersen"
},
{
"date": "2009-08-05",
"videos": [
"http://thecolbertreport.cc.com/videos/dozbxd/bill-clinton-s-personal-appearance",
"http://thecolbertreport.cc.com/videos/pedumk/2010-midterms---joe-sestak",
"http://thecolbertreport.cc.com/videos/8s2cpt/kris-kobach",
"http://thecolbertreport.cc.com/videos/5f7tro/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/7wxgsg/colbert-bump-cocktail---david-wondrich"
],
"guest": "Kris Kobach"
},
{
"date": "2009-08-06",
"videos": [
"http://thecolbertreport.cc.com/videos/vesroc/intro---08-06-09",
"http://thecolbertreport.cc.com/videos/7qrkub/back-to-school-with-jeremih",
"http://thecolbertreport.cc.com/videos/04qijm/movies-that-are-destroying-america---summer",
"http://thecolbertreport.cc.com/videos/zar0yt/meryl-streep",
"http://thecolbertreport.cc.com/videos/diktol/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/updeyd/human-week"
],
"guest": "Meryl Streep"
},
{
"date": "2009-08-10",
"videos": [
"http://thecolbertreport.cc.com/videos/gaywhl/intro---08-10-09",
"http://thecolbertreport.cc.com/videos/0aiuqk/death-panels",
"http://thecolbertreport.cc.com/videos/1d8uxl/better-know-a-district---maine-s-1st---chellie-pingree",
"http://thecolbertreport.cc.com/videos/klodac/barbara-boxer",
"http://thecolbertreport.cc.com/videos/9r0u01/sign-off---encore"
],
"guest": "Sen. Barbara Boxer"
},
{
"date": "2009-08-11",
"videos": [
"http://thecolbertreport.cc.com/videos/1qhrzu/intro---08-11-09",
"http://thecolbertreport.cc.com/videos/tq0ixs/stephen-s-driving-tips-via-twitter-service",
"http://thecolbertreport.cc.com/videos/kc7xgf/alpha-dog-of-the-week---betty-lichtenstein",
"http://thecolbertreport.cc.com/videos/0ivmu5/jonathan-cohn",
"http://thecolbertreport.cc.com/videos/9pu9xl/sign-off---prevent-forest-fires",
"http://thecolbertreport.cc.com/videos/dra60l/cold-war-update---cuba---topless-putin"
],
"guest": "Jonathan Cohn"
},
{
"date": "2009-08-12",
"videos": [
"http://thecolbertreport.cc.com/videos/9g2evg/intro---08-12-09",
"http://thecolbertreport.cc.com/videos/cypmfk/americans-sacrifice-their-ipods",
"http://thecolbertreport.cc.com/videos/5esjcx/formidable-opponent---health-care---burger-king",
"http://thecolbertreport.cc.com/videos/53n2qf/mark-johnson",
"http://thecolbertreport.cc.com/videos/j153gh/yes-we-afghan---james-carville"
],
"guest": "Mark Johnson"
},
{
"date": "2009-08-13",
"videos": [
"http://thecolbertreport.cc.com/videos/3rk7mk/intro---08-13-09",
"http://thecolbertreport.cc.com/videos/d9wypw/sheila-jackson-lee-takes-a-phone-call",
"http://thecolbertreport.cc.com/videos/1fblyv/cheating-death---blue-m-ms--vitamin-d---hormones",
"http://thecolbertreport.cc.com/videos/pfw8xc/mark-devlin",
"http://thecolbertreport.cc.com/videos/xagarl/sign-off---stephen-s-online-information",
"http://thecolbertreport.cc.com/videos/8bsp4q/who-s-not-honoring-me-now----obama--nra---teen-choice-awards"
],
"guest": "Mark Devlin"
},
{
"date": "2009-08-17",
"videos": [
"http://thecolbertreport.cc.com/videos/eu8yuk/intro---08-17-09",
"http://thecolbertreport.cc.com/videos/54nh4d/obama-publishes-health-care-op-ed",
"http://thecolbertreport.cc.com/videos/xe1vuk/even-better-er-know-a-district---colorado-s-2nd---jared-polis",
"http://thecolbertreport.cc.com/videos/p4m942/bill-mckibben",
"http://thecolbertreport.cc.com/videos/rasuqa/sign-off---goodnight"
],
"guest": "Bill McKibben"
},
{
"date": "2009-08-18",
"videos": [
"http://thecolbertreport.cc.com/videos/wagj66/intro---08-18-09",
"http://thecolbertreport.cc.com/videos/wu0pjh/hamid-karzai-endorsement",
"http://thecolbertreport.cc.com/videos/z3d9c9/tip-wag---german-campaign--russian-dogs---flying-rabbis",
"http://thecolbertreport.cc.com/videos/xjhfzn/robert-wright",
"http://thecolbertreport.cc.com/videos/nw5bk3/sign-off--shofar",
"http://thecolbertreport.cc.com/videos/79rlpw/the-word---must-be-tv"
],
"guest": "Robert Wright"
},
{
"date": "2009-08-19",
"videos": [
"http://thecolbertreport.cc.com/videos/eu5hos/barney-frank-refuses-to-talk-to-a-dining-room-table",
"http://thecolbertreport.cc.com/videos/f6lol5/sugar-shortage---marion-nestle",
"http://thecolbertreport.cc.com/videos/ckefur/ang-lee",
"http://thecolbertreport.cc.com/videos/qwyqmu/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/jrwpha/the-word---arch-enemies"
],
"guest": "Ang Lee"
},
{
"date": "2009-08-20",
"videos": [
"http://thecolbertreport.cc.com/videos/om1fcy/intro---08-20-09",
"http://thecolbertreport.cc.com/videos/bgxuqk/france-bans-elephants",
"http://thecolbertreport.cc.com/videos/ho2y6d/stephen-s-sound-advice---how-to-make-babies",
"http://thecolbertreport.cc.com/videos/3muzmh/chris-matthews",
"http://thecolbertreport.cc.com/videos/gv0u6s/sign-off---vacation-begins",
"http://thecolbertreport.cc.com/videos/k1zrq2/colbert-platinum---urbane-nomads--gigayacht---michael-jackson-diamond"
],
"guest": "Chris Matthews"
},
{
"date": "2009-09-14",
"videos": [
"http://thecolbertreport.cc.com/videos/dq2vzv/intro---09-14-09",
"http://thecolbertreport.cc.com/videos/npiiku/conservatives-are-back",
"http://thecolbertreport.cc.com/videos/ehltxr/kanye-west-interrupts-taylor-swift-at-the-vmas",
"http://thecolbertreport.cc.com/videos/ljbubg/cory-booker",
"http://thecolbertreport.cc.com/videos/4kq9de/sign-off---goodnight"
],
"guest": "Cory Booker"
},
{
"date": "2009-09-15",
"videos": [
"http://thecolbertreport.cc.com/videos/drgqxg/world-record-for-mexican-insults",
"http://thecolbertreport.cc.com/videos/c9v1s6/the-word---let-freedom-ka-ching",
"http://thecolbertreport.cc.com/videos/qm9oq3/christiane-amanpour",
"http://thecolbertreport.cc.com/videos/tcjp92/stephen-loses-world-record-to-lou-dobbs",
"http://thecolbertreport.cc.com/videos/hen1ip/better-know-a-lobby---health-care-for-america-now"
],
"guest": "Christiane Amanpour"
},
{
"date": "2009-09-16",
"videos": [
"http://thecolbertreport.cc.com/videos/ch7xyz/intro---09-16-09",
"http://thecolbertreport.cc.com/videos/dp3jiw/body-worlds-plans-cadaver-sex-exhibit",
"http://thecolbertreport.cc.com/videos/p1ugzo/figgy-moonpowder",
"http://thecolbertreport.cc.com/videos/1642tt/wayne-coyne",
"http://thecolbertreport.cc.com/videos/pafbhp/citizens-united-v--federal-election-commission---jeffrey-toobin"
],
"guest": "The Flaming Lips"
},
{
"date": "2009-09-17",
"videos": [
"http://thecolbertreport.cc.com/videos/oclyoo/goat-lab",
"http://thecolbertreport.cc.com/videos/5psdx6/goat-lab---jon-ronson",
"http://thecolbertreport.cc.com/videos/3zmd8j/frank-bruni",
"http://thecolbertreport.cc.com/videos/xl4dp2/i-s-on-edjukashun---muslim-textbooks---tony-danza"
],
"guest": "Frank Bruni"
},
{
"date": "2009-09-22",
"videos": [
"http://thecolbertreport.cc.com/videos/fscepw/intro---09-22-09",
"http://thecolbertreport.cc.com/videos/brwe58/atone-phone---emmy-awards",
"http://thecolbertreport.cc.com/videos/h3pbsv/atone-phone---jon-stewart-calls-to-apologize",
"http://thecolbertreport.cc.com/videos/oqiy0y/shai-agassi",
"http://thecolbertreport.cc.com/videos/zxvw0a/sign-off---shofar-goodnight"
],
"guest": "Shai Agassi"
},
{
"date": "2009-09-23",
"videos": [
"http://thecolbertreport.cc.com/videos/epco4o/lunatic-dictator-accommodations",
"http://thecolbertreport.cc.com/videos/xtts8p/capitalism-s-enemy---michael-moore",
"http://thecolbertreport.cc.com/videos/hwx2pv/aj-jacobs",
"http://thecolbertreport.cc.com/videos/8ch7no/sign-off---thank-you-for-joining-us",
"http://thecolbertreport.cc.com/videos/npdo9z/tip-wag---guns-on-amtrak--fake-lesbians---battleship-audition"
],
"guest": "Michael Moore, A.J. Jacobs"
},
{
"date": "2009-09-24",
"videos": [
"http://thecolbertreport.cc.com/videos/92d7p3/intro---09-24-09",
"http://thecolbertreport.cc.com/videos/srdbkv/atone-phone---larry-king-calls",
"http://thecolbertreport.cc.com/videos/f4xrhk/easter-under-attack---peeps-display",
"http://thecolbertreport.cc.com/videos/xqer72/ken-burns",
"http://thecolbertreport.cc.com/videos/cqqzqe/sign-off---automated-desk",
"http://thecolbertreport.cc.com/videos/rh4p4f/tom-delay-dances-with-the-stars"
],
"guest": "Ken Burns"
},
{
"date": "2009-09-28",
"videos": [
"http://thecolbertreport.cc.com/videos/ph4cw3/atone-phone---last-day-of-apologies",
"http://thecolbertreport.cc.com/videos/89wc6t/do--dump-or-marry",
"http://thecolbertreport.cc.com/videos/r9at2m/sheryl-wudunn",
"http://thecolbertreport.cc.com/videos/wsefin/sign-off---goodnight--conan"
],
"guest": "Sheryl WuDunn"
},
{
"date": "2009-09-29",
"videos": [
"http://thecolbertreport.cc.com/videos/8qd7gf/intro---09-29-09",
"http://thecolbertreport.cc.com/videos/4bcajc/spider-pope",
"http://thecolbertreport.cc.com/videos/22jcm5/cheating-death---snus---placebo-effect",
"http://thecolbertreport.cc.com/videos/03ei16/matt-latimer",
"http://thecolbertreport.cc.com/videos/7bmnxg/sign-off---richard-dawkins-will-be-here-tomorrow",
"http://thecolbertreport.cc.com/videos/ph4cw3/atone-phone---last-day-of-apologies"
],
"guest": "Matt Latimer"
},
{
"date": "2009-09-30",
"videos": [
"http://thecolbertreport.cc.com/videos/6bhu7e/intro---09-30-09",
"http://thecolbertreport.cc.com/videos/rrbojv/send-your-medical-bills-to-max-baucus",
"http://thecolbertreport.cc.com/videos/m2yjay/a-pace-odyssey",
"http://thecolbertreport.cc.com/videos/jhrv69/richard-dawkins",
"http://thecolbertreport.cc.com/videos/t5u4g8/sign-off---goodnight--grammy",
"http://thecolbertreport.cc.com/videos/kf4xf5/the-word---out-of-the-closet"
],
"guest": "Richard Dawkins"
},
{
"date": "2009-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/wlav1v/najibullah-zazi-threatens-beauty-supplies",
"http://thecolbertreport.cc.com/videos/6dv0jz/2016-olympics-in-chicago---george-wendt",
"http://thecolbertreport.cc.com/videos/zxuz0a/francis-collins",
"http://thecolbertreport.cc.com/videos/q9o9qv/sign-off---new-slang",
"http://thecolbertreport.cc.com/videos/91s6ka/threatdown---environmentalists--kang-lee---mountain-pine-beetles"
],
"guest": "George Wendt, Dr. Francis Collins"
},
{
"date": "2009-10-05",
"videos": [
"http://thecolbertreport.cc.com/videos/733czp/intro---10-05-09",
"http://thecolbertreport.cc.com/videos/7yi77e/americans-for-prosperity-cheer-chicago-s-failure",
"http://thecolbertreport.cc.com/videos/k8e7bl/eating-the-distance---the-brad-sciullo-story-pt--2",
"http://thecolbertreport.cc.com/videos/wfl2if/arne-duncan",
"http://thecolbertreport.cc.com/videos/d1uxmt/sign-off---goodnight"
],
"guest": "Arne Duncan"
},
{
"date": "2009-10-06",
"videos": [
"http://thecolbertreport.cc.com/videos/lomf6q/new-swine-flu-vaccine-drops",
"http://thecolbertreport.cc.com/videos/7060r2/the-road-ahead-in-afghanistan---lara-logan",
"http://thecolbertreport.cc.com/videos/yz886x/john-darnielle",
"http://thecolbertreport.cc.com/videos/58l1kv/the-word---learning-is-fundamental"
],
"guest": "Lara Logan, the Mountain Goats"
},
{
"date": "2009-10-07",
"videos": [
"http://thecolbertreport.cc.com/videos/kt8d60/intro---10-07-09",
"http://thecolbertreport.cc.com/videos/p6tyac/human-sacrifice-channel",
"http://thecolbertreport.cc.com/videos/i1e7h0/craziest-f--king-thing-i-ve-ever-heard---eye-tooth",
"http://thecolbertreport.cc.com/videos/59gyno/alison-gopnik",
"http://thecolbertreport.cc.com/videos/9ergzb/sign-off---jasper-t--jowls",
"http://thecolbertreport.cc.com/videos/qm22ls/formula-401--a-star-is-born"
],
"guest": "Alison Gopnik"
},
{
"date": "2009-10-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ac6rq4/intro---10-08-09",
"http://thecolbertreport.cc.com/videos/u1v1j7/kevin-the-iranian-intern",
"http://thecolbertreport.cc.com/videos/jigfye/sport-report---rush-limbaugh---ted-williams--frozen-head",
"http://thecolbertreport.cc.com/videos/ih4ouf/colin-beavan",
"http://thecolbertreport.cc.com/videos/7t5ve1/sign-off---buddy-system",
"http://thecolbertreport.cc.com/videos/81wvda/tip-wag---conservapedia--louvre---honda-unicycle"
],
"guest": "Colin Beavan"
},
{
"date": "2009-10-12",
"videos": [
"http://thecolbertreport.cc.com/videos/6s4gb6/intro---10-12-09",
"http://thecolbertreport.cc.com/videos/xiuiwd/happy-columbus-day",
"http://thecolbertreport.cc.com/videos/vnmcv0/fallback-position---james-blake",
"http://thecolbertreport.cc.com/videos/2ko3eq/sanjay-gupta",
"http://thecolbertreport.cc.com/videos/izp5gd/sign-off---thanks-to-the-guests"
],
"guest": "Shashi Tharoor, Dr. Sanjay Gupta"
},
{
"date": "2009-10-13",
"videos": [
"http://thecolbertreport.cc.com/videos/g87deh/intro---10-13-09",
"http://thecolbertreport.cc.com/videos/4cco61/jermaine-maine-tweets-miley-cyrus-facts",
"http://thecolbertreport.cc.com/videos/7jpek6/the-born-supremacy---david-javerbaum",
"http://thecolbertreport.cc.com/videos/s52xb5/sylvia-earle",
"http://thecolbertreport.cc.com/videos/obxlza/sign-off---gmail",
"http://thecolbertreport.cc.com/videos/l4n6tb/war-of-peace---shashi-tharoor"
],
"guest": "David Javerbaum, Sylvia Earle"
},
{
"date": "2009-10-14",
"videos": [
"http://thecolbertreport.cc.com/videos/g6skj6/pat-roberts-warns-against-health-care-box-canyon",
"http://thecolbertreport.cc.com/videos/3copn0/the-obesity-epidemic---amy-farrell",
"http://thecolbertreport.cc.com/videos/ljym9p/the-rza",
"http://thecolbertreport.cc.com/videos/wijvgm/sign-off---should-have-put-a-ring-on-it",
"http://thecolbertreport.cc.com/videos/m5y3ox/the-word---symbol-minded"
],
"guest": "Amy Farrell, The RZA"
},
{
"date": "2009-10-15",
"videos": [
"http://thecolbertreport.cc.com/videos/0bzt4y/intro---10-15-09",
"http://thecolbertreport.cc.com/videos/0a133r/the-money-shot",
"http://thecolbertreport.cc.com/videos/8xmsj4/the-mayo-lution-will-not-be-televised",
"http://thecolbertreport.cc.com/videos/7s45sd/jerry-mitchell",
"http://thecolbertreport.cc.com/videos/sgqznj/sign-off---stephen-unveils-a-new-portrait",
"http://thecolbertreport.cc.com/videos/ubn9ao/yahweh-or-no-way---legislation-prayers---fake-shroud-of-turin"
],
"guest": "Jerry Mitchell"
},
{
"date": "2009-10-26",
"videos": [
"http://thecolbertreport.cc.com/videos/4srpg9/george-will-s-long-tie",
"http://thecolbertreport.cc.com/videos/gy6tin/the-word---don-t-ask-don-t-tell",
"http://thecolbertreport.cc.com/videos/xhz2mw/cornel-west",
"http://thecolbertreport.cc.com/videos/2onypd/sign-off---don-t-move"
],
"guest": "Cornel West"
},
{
"date": "2009-10-27",
"videos": [
"http://thecolbertreport.cc.com/videos/l98jof/intro---10-27-09",
"http://thecolbertreport.cc.com/videos/3f3ssx/george-w--bush-s-motivational-speech",
"http://thecolbertreport.cc.com/videos/wtcyjy/colbert-platinum---harvard-billionaires---red-diamond-suv",
"http://thecolbertreport.cc.com/videos/8c9hx0/gail-collins",
"http://thecolbertreport.cc.com/videos/plvf84/sign-off---goodnight-",
"http://thecolbertreport.cc.com/videos/liq1p2/job-recommendation-from-stephen-colbert",
"http://thecolbertreport.cc.com/videos/dtlk2w/stephen-s-sound-advice---how-to-get-a-job"
],
"guest": "Randall Balmer, Gail Collins"
},
{
"date": "2009-10-28",
"videos": [
"http://thecolbertreport.cc.com/videos/zspzvk/intro---10-28-09",
"http://thecolbertreport.cc.com/videos/qvcosm/joe-lieberman-is-a-true-independent",
"http://thecolbertreport.cc.com/videos/1r96o8/big-bang-theory",
"http://thecolbertreport.cc.com/videos/3r9su2/brian-cox",
"http://thecolbertreport.cc.com/videos/bzrvnc/sign-off---future-stephen",
"http://thecolbertreport.cc.com/videos/1va17m/holy-water-under-the-bridge---randall-balmer"
],
"guest": "Brian Cox"
},
{
"date": "2009-10-29",
"videos": [
"http://thecolbertreport.cc.com/videos/bbj9sz/intro---10-29-09",
"http://thecolbertreport.cc.com/videos/yl6xd1/usa-today-slams-dirigibles",
"http://thecolbertreport.cc.com/videos/al6ssq/threatdown---halloween-edition",
"http://thecolbertreport.cc.com/videos/ku01px/bill-simmons",
"http://thecolbertreport.cc.com/videos/xalyef/sign-off---thanks-to-bill-simmons---rosanne-cash",
"http://thecolbertreport.cc.com/videos/w56skk/the-word---you-genics"
],
"guest": "Rosanne Cash, Bill Simmons"
},
{
"date": "2009-11-02",
"videos": [
"http://thecolbertreport.cc.com/videos/vfdy5q/intro---11-02-09",
"http://thecolbertreport.cc.com/videos/uke17x/used-karzai",
"http://thecolbertreport.cc.com/videos/uxgb9s/alpha-dog-of-the-week---arnold-schwarzenegger",
"http://thecolbertreport.cc.com/videos/t62cji/nicholas-thompson",
"http://thecolbertreport.cc.com/videos/7g9pgn/sign-off---donate-to-the-u-s--speedskating-team"
],
"guest": "Nicholas Thompson"
},
{
"date": "2009-11-03",
"videos": [
"http://thecolbertreport.cc.com/videos/hlio3b/intro---11-03-09",
"http://thecolbertreport.cc.com/videos/zbi6j6/canadian-hackers-sabotage-colbert-nation",
"http://thecolbertreport.cc.com/videos/olb2ep/nailed--em---mormon-church-trespassing",
"http://thecolbertreport.cc.com/videos/qdk21v/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/sqdke8/sign-off---they-call-me-mister-fry",
"http://thecolbertreport.cc.com/videos/b7il1x/sport-report---nyc-marathon---olympic-speedskating"
],
"guest": "Andrew Sullivan"
},
{
"date": "2009-11-04",
"videos": [
"http://thecolbertreport.cc.com/videos/wm06ja/intro---11-04-09",
"http://thecolbertreport.cc.com/videos/hzm3ur/-09-off-year-semi-presidential-electferendum",
"http://thecolbertreport.cc.com/videos/src597/formidable-opponent---global-warming-with-al-gore",
"http://thecolbertreport.cc.com/videos/lkkq9m/harold-evans",
"http://thecolbertreport.cc.com/videos/64ucdo/sign-off---poison-gas",
"http://thecolbertreport.cc.com/videos/ol1mvi/the-word---the-green-mile"
],
"guest": "Harold Evans"
},
{
"date": "2009-11-05",
"videos": [
"http://thecolbertreport.cc.com/videos/ymrkt5/intro---11-05-09",
"http://thecolbertreport.cc.com/videos/i7dq6q/guy-fawkers",
"http://thecolbertreport.cc.com/videos/6vac7m/cheating-death---swine-flu-scam-detector---vaxaconda",
"http://thecolbertreport.cc.com/videos/cj1lqu/william-bratton",
"http://thecolbertreport.cc.com/videos/6e51a0/sign-off---donate-to-u-s--speedskating",
"http://thecolbertreport.cc.com/videos/hnu3dh/tip-wag---rush-limbaugh---us-weekly"
],
"guest": "Joey Cheek, Chief William Bratton"
},
{
"date": "2009-11-09",
"videos": [
"http://thecolbertreport.cc.com/videos/p4del4/intro---11-09-09",
"http://thecolbertreport.cc.com/videos/zhrahz/trouble--coverage",
"http://thecolbertreport.cc.com/videos/uaeaom/u-s--speedskating-team-takes-gold",
"http://thecolbertreport.cc.com/videos/62flai/thomas-campbell",
"http://thecolbertreport.cc.com/videos/5hgk8f/sign-off---goodnight"
],
"guest": "Thomas Campbell"
},
{
"date": "2009-11-10",
"videos": [
"http://thecolbertreport.cc.com/videos/nwm4io/intro---11-10-09",
"http://thecolbertreport.cc.com/videos/bpec5m/barney-frank-is-not-a-great-outdoorsman",
"http://thecolbertreport.cc.com/videos/476wty/maria-shriver",
"http://thecolbertreport.cc.com/videos/rl73xb/sign-off---you-can-t-take-it-with-you",
"http://thecolbertreport.cc.com/videos/ocuoqq/exclusive---better-know-a-district---delaware-s-at-large---mike-castle",
"http://thecolbertreport.cc.com/videos/i4pgl0/better-know-a-district---delaware-s-at-large---mike-castle"
],
"guest": "Maria Shriver"
},
{
"date": "2009-11-11",
"videos": [
"http://thecolbertreport.cc.com/videos/8m4icj/intro---11-11-09",
"http://thecolbertreport.cc.com/videos/d3hhgz/goldman-sachs-does-god-s-work",
"http://thecolbertreport.cc.com/videos/1al5v4/tip-wag---san-francisco-chronicle---george-clinton",
"http://thecolbertreport.cc.com/videos/p4wqld/christopher-caldwell",
"http://thecolbertreport.cc.com/videos/xp7fig/sign-off---stephen-s-fight-with-christopher-caldwell",
"http://thecolbertreport.cc.com/videos/2vmljd/iraniversary---karim-sadjadpour"
],
"guest": "Christopher Caldwell"
},
{
"date": "2009-11-12",
"videos": [
"http://thecolbertreport.cc.com/videos/lbfhkm/intro---11-12-09",
"http://thecolbertreport.cc.com/videos/cnw6wz/miracle-whip-buys-ad-space",
"http://thecolbertreport.cc.com/videos/ips2v8/the-word---the-money-shot",
"http://thecolbertreport.cc.com/videos/2k90o4/sport-report---cricket-scandal---letter-writing-campaign",
"http://thecolbertreport.cc.com/videos/1yilwm/woody-harrelson",
"http://thecolbertreport.cc.com/videos/l85kiv/grover-the-hill"
],
"guest": "Woody Harrelson"
},
{
"date": "2009-11-16",
"videos": [
"http://thecolbertreport.cc.com/videos/t5pqdy/intro---11-16-09",
"http://thecolbertreport.cc.com/videos/8ggl86/obama-bows-to-japanese-emperor",
"http://thecolbertreport.cc.com/videos/xgze85/alpha-dog-of-the-week---joe-perry",
"http://thecolbertreport.cc.com/videos/6einjp/paul-goldberger",
"http://thecolbertreport.cc.com/videos/i42i9t/sign-off---good-morning--burma"
],
"guest": "Paul Goldberger"
},
{
"date": "2009-11-17",
"videos": [
"http://thecolbertreport.cc.com/videos/im99fb/intro---11-17-09",
"http://thecolbertreport.cc.com/videos/z1cr8v/kid-gloves---marc-kielburger",
"http://thecolbertreport.cc.com/videos/ij8d04/malcolm-gladwell",
"http://thecolbertreport.cc.com/videos/w71om6/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/mwjf6e/the-word---skeletons-in-the-closet"
],
"guest": "Malcolm Gladwell"
},
{
"date": "2009-11-18",
"videos": [
"http://thecolbertreport.cc.com/videos/24jack/intro---11-18-09",
"http://thecolbertreport.cc.com/videos/odu5xx/eggo-waffles-shortage-alert",
"http://thecolbertreport.cc.com/videos/cuhtda/threatdown---quetzalcoatl--santa-claus---canadian-groin-kickers",
"http://thecolbertreport.cc.com/videos/ah5dzo/norah-jones",
"http://thecolbertreport.cc.com/videos/1vm4fs/exclusive---better-know-a-district---california-s-12th---jackie-speier-pt--1",
"http://thecolbertreport.cc.com/videos/udd9qu/exclusive---better-know-a-district---california-s-12th---jackie-speier-pt--2",
"http://thecolbertreport.cc.com/videos/p8c7xo/better-know-a-district---california-s-12th---jackie-speier"
],
"guest": "Norah Jones"
},
{
"date": "2009-11-19",
"videos": [
"http://thecolbertreport.cc.com/videos/6iz54h/stephen-shakes-his-moneymaker",
"http://thecolbertreport.cc.com/videos/4tmz49/celebrating-the-ak-47---john-pike",
"http://thecolbertreport.cc.com/videos/zy3jiq/sign-off---thanks--elvis-costello",
"http://thecolbertreport.cc.com/videos/tf53hs/the-word---grand-old-pity-party"
],
"guest": "John Pike, Elvis Costello"
},
{
"date": "2009-11-30",
"videos": [
"http://thecolbertreport.cc.com/videos/x90ton/intro---11-30-09",
"http://thecolbertreport.cc.com/videos/qljewq/amateur-hour-at-the-white-house",
"http://thecolbertreport.cc.com/videos/ahhfo9/better-know-a-lobby---ploughshares-fund",
"http://thecolbertreport.cc.com/videos/ec0x55/cevin-soling",
"http://thecolbertreport.cc.com/videos/53k9co/sign-off---goodnight"
],
"guest": "Dan Esty, Cevin Soling"
},
{
"date": "2009-12-01",
"videos": [
"http://thecolbertreport.cc.com/videos/jvjn7h/intro---12-01-09",
"http://thecolbertreport.cc.com/videos/fj2x2m/u-s--army-chain-of-command",
"http://thecolbertreport.cc.com/videos/zwjey6/gold--frankincense-and-mars---guy-consolmagno",
"http://thecolbertreport.cc.com/videos/s6mur0/sherman-alexie",
"http://thecolbertreport.cc.com/videos/km8wtf/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/bohr52/something-is-melting-in-denmark---dan-esty"
],
"guest": "Guy Consolmagno, Sherman Alexie"
},
{
"date": "2009-12-02",
"videos": [
"http://thecolbertreport.cc.com/videos/lstmf1/intro---12-02-09",
"http://thecolbertreport.cc.com/videos/yvq647/deployment-figures",
"http://thecolbertreport.cc.com/videos/et6ksb/craig-watkins",
"http://thecolbertreport.cc.com/videos/cyylc0/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/ndi826/better-know-a-made-up-district---connecticut-s-42nd"
],
"guest": "Craig Watkins"
},
{
"date": "2009-12-03",
"videos": [
"http://thecolbertreport.cc.com/videos/qrqaja/formidable-opponent---gary-the-tennis-coach",
"http://thecolbertreport.cc.com/videos/q8vv0p/intro---12-03-09",
"http://thecolbertreport.cc.com/videos/knxrx6/tiger-s-tale",
"http://thecolbertreport.cc.com/videos/hw80nv/skate-expectations---skeleton-team-tryouts---zach-lund",
"http://thecolbertreport.cc.com/videos/heye88/janet-napolitano",
"http://thecolbertreport.cc.com/videos/dy9y1l/sign-off---welcome-sean-julien",
"http://thecolbertreport.cc.com/videos/qx8k9b/cheating-death---r-j--reynolds--genzyme---bionic-bottom"
],
"guest": "Sec. Janet Napolitano"
},
{
"date": "2009-12-07",
"videos": [
"http://thecolbertreport.cc.com/videos/opl0gz/intro---12-07-09",
"http://thecolbertreport.cc.com/videos/l9wksx/who-s-attacking-me-now----g--edward-deseve",
"http://thecolbertreport.cc.com/videos/t0b3f4/craziest-f--king-thing-i-ve-ever-heard---tongue-eating-parasite",
"http://thecolbertreport.cc.com/videos/pgp8y2/bill-t--jones"
],
"guest": "Bill T. Jones, a performance by the cast of \"Fela\""
},
{
"date": "2009-12-08",
"videos": [
"http://thecolbertreport.cc.com/videos/7a6f7k/intro---12-08-09",
"http://thecolbertreport.cc.com/videos/0y3uce/how-far-good-parents-will-go",
"http://thecolbertreport.cc.com/videos/gcu1ou/fed-s-dead---bernie-sanders",
"http://thecolbertreport.cc.com/videos/9o2lyz/andy-schlafly",
"http://thecolbertreport.cc.com/videos/2v1vhb/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/w4zn3p/tip-wag---jonas-brothers--fox-news---japanese-burger-king"
],
"guest": "Sen. Bernie Sanders, Andy Schlafly"
},
{
"date": "2009-12-09",
"videos": [
"http://thecolbertreport.cc.com/videos/fdjwxb/intro---12-09-09",
"http://thecolbertreport.cc.com/videos/ckek7p/monkey-threatdown---holes---banana-too-high",
"http://thecolbertreport.cc.com/videos/h3kb0s/the-blitzkrieg-on-grinchitude---hallmark---krampus",
"http://thecolbertreport.cc.com/videos/is6uvv/matt-taibbi",
"http://thecolbertreport.cc.com/videos/mlp3y1/sign-off---goodnight-with-krampus",
"http://thecolbertreport.cc.com/videos/2l8p98/fed-s-dead"
],
"guest": "Matt Taibbi"
},
{
"date": "2009-12-10",
"videos": [
"http://thecolbertreport.cc.com/videos/03g0d5/obama-s-nobel-prize-speech---afghandyland",
"http://thecolbertreport.cc.com/videos/zivscx/skate-expectations---bobsled-team-tryouts",
"http://thecolbertreport.cc.com/videos/hjnxot/lara-logan",
"http://thecolbertreport.cc.com/videos/y74r8f/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/2jc7dn/the-word---grand-old-purity"
],
"guest": "Lara Logan"
},
{
"date": "2009-12-14",
"videos": [
"http://thecolbertreport.cc.com/videos/efg3d5/intro---12-14-09",
"http://thecolbertreport.cc.com/videos/9wxgc9/president-obama---the-colbert-interview",
"http://thecolbertreport.cc.com/videos/t1tsns/stephen-challenges-shani-davis---katherine-reutter",
"http://thecolbertreport.cc.com/videos/vt4qtf/snoop-dogg"
],
"guest": "Katherine Reutter, Snoop Dogg"
},
{
"date": "2009-12-15",
"videos": [
"http://thecolbertreport.cc.com/videos/x6ydfv/intro---12-15-09",
"http://thecolbertreport.cc.com/videos/3plx6x/for-he-s-a-jowly-good-fellow",
"http://thecolbertreport.cc.com/videos/10vyk2/the-blitzkrieg-on-grinchitude---treesus---christ-mas-tree",
"http://thecolbertreport.cc.com/videos/i16cci/alicia-keys",
"http://thecolbertreport.cc.com/videos/qn15hk/stephen-challenges-shani-davis",
"http://thecolbertreport.cc.com/videos/u5g55p/exclusive---extended-interview-with-barack-obama"
],
"guest": "Alicia Keys"
},
{
"date": "2009-12-16",
"videos": [
"http://thecolbertreport.cc.com/videos/ozgmuy/accenture-drops-tiger-woods",
"http://thecolbertreport.cc.com/videos/4jdam2/the-word---spyvate-sector",
"http://thecolbertreport.cc.com/videos/bjlb37/tom-brokaw",
"http://thecolbertreport.cc.com/videos/q9eqq1/sign-off---goodbye--2009",
"http://thecolbertreport.cc.com/videos/ufq6qh/prescott-financial---gold--women---sheep"
],
"guest": "Tom Brokaw"
}
],
"2010": [
{
"date": "2010-01-04",
"videos": [
"http://thecolbertreport.cc.com/videos/a6c63f/intro---goodbye--old-set",
"http://thecolbertreport.cc.com/videos/qr3067/high-definition-upgrade",
"http://thecolbertreport.cc.com/videos/ca8z2z/genitalia-bomb-threat",
"http://thecolbertreport.cc.com/videos/hospuh/skate-expectations---curling-team-tryouts",
"http://thecolbertreport.cc.com/videos/bqki32/skate-expectations---curling-team-tryouts---colbert-vs--shuster",
"http://thecolbertreport.cc.com/videos/ytow3n/sign-off---thanks-for-the-new-set"
],
"guest": "Erick Erickson"
},
{
"date": "2010-01-05",
"videos": [
"http://thecolbertreport.cc.com/videos/l0fai0/intro---01-05-10",
"http://thecolbertreport.cc.com/videos/qomtkk/high-definition-advertising",
"http://thecolbertreport.cc.com/videos/ywy8j4/night-of-terror---the-crapification-of-the-american-pant-scape",
"http://thecolbertreport.cc.com/videos/s2n141/the-word---ideal-or-no-deal",
"http://thecolbertreport.cc.com/videos/t3fpvm/better-know-an-enemy---yemen",
"http://thecolbertreport.cc.com/videos/r8x6ag/riley-crane",
"http://thecolbertreport.cc.com/videos/doe1xo/sign-off---stephen-draws-woodstock"
],
"guest": "Riley Crane"
},
{
"date": "2010-01-06",
"videos": [
"http://thecolbertreport.cc.com/videos/rewr4u/intro---01-06-10",
"http://thecolbertreport.cc.com/videos/u584e6/a-message-to-standard-definition-cable-providers",
"http://thecolbertreport.cc.com/videos/g2gimh/drag-me-to-health---ezra-klein---linda-douglass",
"http://thecolbertreport.cc.com/videos/h3mxst/alpha-dog-of-the-week---domino-s-pizza",
"http://thecolbertreport.cc.com/videos/4cd9bx/charles-moore",
"http://thecolbertreport.cc.com/videos/elm4s5/sign-off---not-stephen-s-show"
],
"guest": "Capt. Charles Moore"
},
{
"date": "2010-01-07",
"videos": [
"http://thecolbertreport.cc.com/videos/uo3v4r/intro---01-07-10",
"http://thecolbertreport.cc.com/videos/f2zb2u/failure-to-connect-the-dots",
"http://thecolbertreport.cc.com/videos/z3kdhi/fatal-subtraction---barry-scheck",
"http://thecolbertreport.cc.com/videos/wi0ong/tip-wag---burj-dubai--avatar---transgender-appointees",
"http://thecolbertreport.cc.com/videos/c3suh9/james-fowler",
"http://thecolbertreport.cc.com/videos/tso1cs/sign-off---goodnight"
],
"guest": "Barry Scheck, James Fowler"
},
{
"date": "2010-01-11",
"videos": [
"http://thecolbertreport.cc.com/videos/xptxw6/harry-reid-s-racial-praise",
"http://thecolbertreport.cc.com/videos/3s1wqs/move-your-money---eugene-jarecki",
"http://thecolbertreport.cc.com/videos/y47i8f/colbert-platinum---estate-tax---skull-ballot-box",
"http://thecolbertreport.cc.com/videos/4q61kj/morgan-freeman",
"http://thecolbertreport.cc.com/videos/8e60wq/sign-off---stephen-will-be-right-back"
],
"guest": "Eugene Jarecki, Morgan Freeman"
},
{
"date": "2010-01-12",
"videos": [
"http://thecolbertreport.cc.com/videos/qjn9bh/intro---01-12-10",
"http://thecolbertreport.cc.com/videos/7qig8p/roxxxy-the-sex-robot",
"http://thecolbertreport.cc.com/videos/8ln9tv/cheating-death---alzheimer-s--jet-lag---female-libido",
"http://thecolbertreport.cc.com/videos/7jfkm7/raj-patel"
],
"guest": "Raj Patel"
},
{
"date": "2010-01-13",
"videos": [
"http://thecolbertreport.cc.com/videos/w3lt72/intro---01-13-10",
"http://thecolbertreport.cc.com/videos/34mknq/game-change-gossip",
"http://thecolbertreport.cc.com/videos/kwpeqs/sport-report---gilbert-arenas---mark-mcgwire",
"http://thecolbertreport.cc.com/videos/t39jgx/movies-that-are-destroying-america---avatar-edition",
"http://thecolbertreport.cc.com/videos/1xyrig/john-heilemann",
"http://thecolbertreport.cc.com/videos/erf677/sign-off---mark-mcgwire-action-figure"
],
"guest": "John Heilemann"
},
{
"date": "2010-01-14",
"videos": [
"http://thecolbertreport.cc.com/videos/t151qr/intro---01-14-10",
"http://thecolbertreport.cc.com/videos/dbcboq/watercressgate",
"http://thecolbertreport.cc.com/videos/et1vio/the-word---honor-bound",
"http://thecolbertreport.cc.com/videos/7owg19/haiti-disaster-relief-donations---kathleen-sebelius",
"http://thecolbertreport.cc.com/videos/gqd029/kathleen-sebelius",
"http://thecolbertreport.cc.com/videos/afqd2o/sign-off---text-for-haiti-disaster-relief"
],
"guest": "Kathleen Sebelius"
},
{
"date": "2010-01-18",
"videos": [
"http://thecolbertreport.cc.com/videos/i2h2wa/intro---01-18-10",
"http://thecolbertreport.cc.com/videos/uqolbx/massachusetts-special-election",
"http://thecolbertreport.cc.com/videos/6s93dq/coal-comfort---margaret-palmer",
"http://thecolbertreport.cc.com/videos/2kgg0x/own-a-piece-of-histor-me---original-interview-table",
"http://thecolbertreport.cc.com/videos/r6fzoi/emily-pilloton",
"http://thecolbertreport.cc.com/videos/47fs6h/sign-off---home-barbershop-quartet-game"
],
"guest": "Dr. Margaret Palmer, Emily Pilloton"
},
{
"date": "2010-01-19",
"videos": [
"http://thecolbertreport.cc.com/videos/w2qqgl/intro---01-19-10",
"http://thecolbertreport.cc.com/videos/9t5rlw/onward-christian-soldiers",
"http://thecolbertreport.cc.com/videos/eseeb0/skate-expectations---speedskating-team-training",
"http://thecolbertreport.cc.com/videos/nw0obk/skate-expectations---speedskating-team-training---tucker-fredricks",
"http://thecolbertreport.cc.com/videos/wljw31/stephen-bosworth",
"http://thecolbertreport.cc.com/videos/5zz1m5/sign-off---teleprompter-in-italics"
],
"guest": "Amb. Stephen Bosworth"
},
{
"date": "2010-01-20",
"videos": [
"http://thecolbertreport.cc.com/videos/oarl2s/intro---01-20-10",
"http://thecolbertreport.cc.com/videos/9fshqm/boston-dream-guy",
"http://thecolbertreport.cc.com/videos/h7cxuq/skate-expectations---speedskating-race",
"http://thecolbertreport.cc.com/videos/r0fs08/skate-expectations---speedskating-team-training---colbert-vs--davis",
"http://thecolbertreport.cc.com/videos/9qoq3s/dick-ebersol",
"http://thecolbertreport.cc.com/videos/ekjbd1/sign-off---original-interview-table-auction"
],
"guest": "Dick Ebersol"
},
{
"date": "2010-01-21",
"videos": [
"http://thecolbertreport.cc.com/videos/dhnvbi/intro---01-21-10",
"http://thecolbertreport.cc.com/videos/a891l1/own-a-piece-of-histor-me---legendary-interview-table",
"http://thecolbertreport.cc.com/videos/3t1wu4/taliban-public-relations",
"http://thecolbertreport.cc.com/videos/61faxb/the-word---two-faced",
"http://thecolbertreport.cc.com/videos/fqdy69/threatdown---airport-security-edition",
"http://thecolbertreport.cc.com/videos/nchr4z/john-farmer",
"http://thecolbertreport.cc.com/videos/ngpu7c/sign-off---raise-money-for-haiti-relief"
],
"guest": "John Farmer"
},
{
"date": "2010-01-25",
"videos": [
"http://thecolbertreport.cc.com/videos/ucog8c/intro---01-25-10",
"http://thecolbertreport.cc.com/videos/2i26ye/obama-gets-called-for-jury-duty",
"http://thecolbertreport.cc.com/videos/iyaiyz/the-word---manifest-density",
"http://thecolbertreport.cc.com/videos/fgn6yx/alpha-dog-of-the-week---harold-ford-jr-",
"http://thecolbertreport.cc.com/videos/y99wku/kati-marton",
"http://thecolbertreport.cc.com/videos/6u56ui/sign-off---50th-anniversary-of-bubble-wrap"
],
"guest": "Kati Marton"
},
{
"date": "2010-01-26",
"videos": [
"http://thecolbertreport.cc.com/videos/8ukd1u/andre-bauer-is-not-against-animals",
"http://thecolbertreport.cc.com/videos/1qu3mj/democrats-must-fight-back---paul-begala",
"http://thecolbertreport.cc.com/videos/4cv6sy/tip-wag---creigh-deeds---scarebear-trail-companion",
"http://thecolbertreport.cc.com/videos/t59ksv/mika-brzezinski",
"http://thecolbertreport.cc.com/videos/oz7mss/own-a-piece-of-histor-me---original-c-shaped-anchor-desk"
],
"guest": "Paul Begala, Mika Brzezinski"
},
{
"date": "2010-01-27",
"videos": [
"http://thecolbertreport.cc.com/videos/5wqyfx/intro---01-27-10",
"http://thecolbertreport.cc.com/videos/69904a/hamid-karzai-s-fashionable-hat",
"http://thecolbertreport.cc.com/videos/99bavp/the-word---prece-don-t",
"http://thecolbertreport.cc.com/videos/9hb7jh/fox-news-puts-james-o-keefe-into-context",
"http://thecolbertreport.cc.com/videos/suw63r/arthur-benjamin",
"http://thecolbertreport.cc.com/videos/iljqkj/sign-off---give-stephen-an-ipad"
],
"guest": "Arthur Benjamin"
},
{
"date": "2010-01-28",
"videos": [
"http://thecolbertreport.cc.com/videos/pg6y12/stephen-s-state-of-the-union-speech",
"http://thecolbertreport.cc.com/videos/lnaqfo/david-gergen",
"http://thecolbertreport.cc.com/videos/jsxv0a/sport-report---all-white-basketball---jana-rawlinson",
"http://thecolbertreport.cc.com/videos/xebsoq/sign-off---bid-on-stephen-s-c-shaped-desk"
],
"guest": "David Gergen"
},
{
"date": "2010-02-01",
"videos": [
"http://thecolbertreport.cc.com/videos/pg94s5/the-word---siren-song",
"http://thecolbertreport.cc.com/videos/2n1vl2/sport-report---nicole-detling-miller---jessica-smith",
"http://thecolbertreport.cc.com/videos/k0hjb1/harold-ford-jr-",
"http://thecolbertreport.cc.com/videos/biwfer/sign-off---u-s-a-"
],
"guest": "Nicole Detling Miller, Jessica Smith, Harold Ford Jr."
},
{
"date": "2010-02-02",
"videos": [
"http://thecolbertreport.cc.com/videos/u6k7x8/intro---02-02-10",
"http://thecolbertreport.cc.com/videos/idx9j1/the-word---cognoscor-ergo-sum",
"http://thecolbertreport.cc.com/videos/2ffk5q/bananafish-tale---henry-allen",
"http://thecolbertreport.cc.com/videos/0xtws0/eliot-spitzer",
"http://thecolbertreport.cc.com/videos/wfnsyt/sign-off---kentucky-fried-regret"
],
"guest": "Eliot Spitzer"
},
{
"date": "2010-02-03",
"videos": [
"http://thecolbertreport.cc.com/videos/pmvmz3/intro---02-03-10",
"http://thecolbertreport.cc.com/videos/4nj8ql/be-almost-all-that-you-can-be",
"http://thecolbertreport.cc.com/videos/5iocp5/job-man-caravan",
"http://thecolbertreport.cc.com/videos/sysu7h/job-man-caravan---peter-cove",
"http://thecolbertreport.cc.com/videos/t6rlnb/john-durant",
"http://thecolbertreport.cc.com/videos/s0494z/sign-off---office-pool"
],
"guest": "Peter Cove, John Durant"
},
{
"date": "2010-02-04",
"videos": [
"http://thecolbertreport.cc.com/videos/zn4dgm/intro---02-04-10",
"http://thecolbertreport.cc.com/videos/qkvdcs/hermaphrodites-can-t-be-gay",
"http://thecolbertreport.cc.com/videos/qqtebr/tip-wag---waterboarding---canada-s-history",
"http://thecolbertreport.cc.com/videos/6a6j6j/formidable-opponent---khalid-sheikh-mohammed-s-trial",
"http://thecolbertreport.cc.com/videos/sm98y8/henry-louis-gates--jr-",
"http://thecolbertreport.cc.com/videos/bsgq92/own-a-piece-of-histor-me---fireplace-portrait"
],
"guest": "Henry Louis Gates"
},
{
"date": "2010-02-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ek3awf/exclusive---skate-expectations---bobsled-team-tryouts-pt--1",
"http://thecolbertreport.cc.com/videos/52kgrq/office-super-bowl-ad-pool",
"http://thecolbertreport.cc.com/videos/2idiz7/the-word---faux--n--tell",
"http://thecolbertreport.cc.com/videos/mtoffp/sarah-palin-uses-a-hand-o-prompter",
"http://thecolbertreport.cc.com/videos/xdafq2/jonathan-safran-foer",
"http://thecolbertreport.cc.com/videos/r5okcx/sign-off---goodnight"
],
"guest": "Jonathan Safran Foer"
},
{
"date": "2010-02-09",
"videos": [
"http://thecolbertreport.cc.com/videos/msydxm/exclusive---skate-expectations---bobsled-team-tryouts-pt--2",
"http://thecolbertreport.cc.com/videos/s5t5z4/celebrate-black-history-month-with-heineken",
"http://thecolbertreport.cc.com/videos/nwoc1b/corporate-free-speech---chris-dodd",
"http://thecolbertreport.cc.com/videos/884juj/alpha-dog-of-the-week---markus-bestin",
"http://thecolbertreport.cc.com/videos/uao9dj/george-stephanopoulos",
"http://thecolbertreport.cc.com/videos/zcybb6/sign-off---it-s-lonely-at-the-top"
],
"guest": "George Stephanopoulos"
},
{
"date": "2010-02-10",
"videos": [
"http://thecolbertreport.cc.com/videos/ka4dxt/exclusive---skate-expectations---bobsled-team-tryouts-pt--3",
"http://thecolbertreport.cc.com/videos/l0cv8x/intro---02-10-10",
"http://thecolbertreport.cc.com/videos/br6hwk/we-re-off-to-see-the-blizzard",
"http://thecolbertreport.cc.com/videos/cu5mso/better-know-a-district---illinois--5th",
"http://thecolbertreport.cc.com/videos/3752v8/better-know-a-district---illinois--5th---mike-quigley",
"http://thecolbertreport.cc.com/videos/34z9mm/claire-danes",
"http://thecolbertreport.cc.com/videos/f2whru/sign-off---goodnight"
],
"guest": "Claire Danes"
},
{
"date": "2010-02-11",
"videos": [
"http://thecolbertreport.cc.com/videos/eyfb9f/exclusive---skate-expectations---curling-team-tryouts-pt--1",
"http://thecolbertreport.cc.com/videos/65cpdn/iran-begins-enriching-uranian",
"http://thecolbertreport.cc.com/videos/n5w4fs/the-word---political-suicide",
"http://thecolbertreport.cc.com/videos/li6roe/sport-report---global-snow-drive---al-michaels",
"http://thecolbertreport.cc.com/videos/s9qfmt/david-ross",
"http://thecolbertreport.cc.com/videos/qbth0f/sign-off---see-you-in-vancouver"
],
"guest": "Al Michaels, David Ross"
},
{
"date": "2010-02-22",
"videos": [
"http://thecolbertreport.cc.com/videos/jvyagn/exclusive---skate-expectations---speedskating-team-training-pt--1",
"http://thecolbertreport.cc.com/videos/rbcb67/intro---02-22-10",
"http://thecolbertreport.cc.com/videos/racwcb/vancouverage-2010---ed-colbert",
"http://thecolbertreport.cc.com/videos/tzovg4/better-know-a-riding---vancouver-s-south",
"http://thecolbertreport.cc.com/videos/5l4d9t/better-know-a-riding---vancouver-s-south---ujjal-dosanjh",
"http://thecolbertreport.cc.com/videos/gg3l88/shaun-white",
"http://thecolbertreport.cc.com/videos/iohppn/sign-off---you-are-not-americans"
],
"guest": "Shaun White"
},
{
"date": "2010-02-23",
"videos": [
"http://thecolbertreport.cc.com/videos/iar6l3/exclusive---skate-expectations---speedskating-team-training-pt--2",
"http://thecolbertreport.cc.com/videos/us6yyq/america-s-olympic-wins---lindsey-vonn",
"http://thecolbertreport.cc.com/videos/1ftd3s/olympic-international-houses",
"http://thecolbertreport.cc.com/videos/yd5amw/bob-costas",
"http://thecolbertreport.cc.com/videos/4vx1ll/sign-off---bob-costas-rides-the-moose"
],
"guest": "Lindsey Vonn, Bob Costas"
},
{
"date": "2010-02-24",
"videos": [
"http://thecolbertreport.cc.com/videos/j11loy/exclusive---better-know-a-riding---vancouver-s-south---ujjal-dosanjh-pt--1",
"http://thecolbertreport.cc.com/videos/eom1sq/exclusive---better-know-a-riding---vancouver-s-south---ujjal-dosanjh-pt--2",
"http://thecolbertreport.cc.com/videos/8olwnj/exclusive---better-know-a-riding---vancouver-s-south---ujjal-dosanjh-pt--3",
"http://thecolbertreport.cc.com/videos/l0ax8q/exclusive---skate-expectations---speedskating-team-training-pt--3",
"http://thecolbertreport.cc.com/videos/php8ta/cold-war-update---olympic-edition",
"http://thecolbertreport.cc.com/videos/mrk7jd/freud-rage---the-iceman-counseleth",
"http://thecolbertreport.cc.com/videos/7u3h32/ryan-st--onge---jeret-peterson",
"http://thecolbertreport.cc.com/videos/ampazf/sign-off---as-they-say-in-canada"
],
"guest": "Scott Hamilton, Jeret Peterson, Ryan St. Onge"
},
{
"date": "2010-02-25",
"videos": [
"http://thecolbertreport.cc.com/videos/i93x4n/exclusive---skate-expectations---speedskating-team-training-pt--4",
"http://thecolbertreport.cc.com/videos/e7hgxz/intro---02-25-10",
"http://thecolbertreport.cc.com/videos/jy3odd/stephen-distracts-bob-costas",
"http://thecolbertreport.cc.com/videos/zoz0j2/freud-rage---the-iceman-counseleth---shani-davis",
"http://thecolbertreport.cc.com/videos/iactcg/off-notice---canadian-iceholes",
"http://thecolbertreport.cc.com/videos/j2htnd/seth-wescott",
"http://thecolbertreport.cc.com/videos/2pub5y/sign-off---thank-you--everyone"
],
"guest": "Shani Davis, Seth Wescott"
},
{
"date": "2010-03-01",
"videos": [
"http://thecolbertreport.cc.com/videos/r61kzy/intro---stephen-wins-the-olympics",
"http://thecolbertreport.cc.com/videos/z9bfu8/president-obama-mentions-stephen",
"http://thecolbertreport.cc.com/videos/4nmlgo/health-care-marriage-counseling",
"http://thecolbertreport.cc.com/videos/6qwf52/olympics-wrap-up---michael-buble",
"http://thecolbertreport.cc.com/videos/ncbadn/don-cheadle",
"http://thecolbertreport.cc.com/videos/zbx22j/sign-off---goodnight"
],
"guest": "Don Cheadle"
},
{
"date": "2010-03-02",
"videos": [
"http://thecolbertreport.cc.com/videos/mevtpj/intro---03-02-10",
"http://thecolbertreport.cc.com/videos/wa48j7/president-obama-s-first-physical",
"http://thecolbertreport.cc.com/videos/u1ymnx/the-word---kid-owe",
"http://thecolbertreport.cc.com/videos/odsatp/colbert-platinum---necker-nymph---lexus-lfa",
"http://thecolbertreport.cc.com/videos/cc44qu/david-brooks",
"http://thecolbertreport.cc.com/videos/ci6g0d/sign-off---goose-that-lays-the-golden-egg"
],
"guest": "David Brooks"
},
{
"date": "2010-03-03",
"videos": [
"http://thecolbertreport.cc.com/videos/srp7ci/jim-bunning-ends-filibuster",
"http://thecolbertreport.cc.com/videos/37u7lc/greece-s-economic-downfall---scheherazade-rehman",
"http://thecolbertreport.cc.com/videos/elhxu1/tip-wag---american-academy-of-pediatrics---starbucks",
"http://thecolbertreport.cc.com/videos/m631tw/garry-wills",
"http://thecolbertreport.cc.com/videos/d3nhmb/sign-off---goodnight"
],
"guest": "Scheherazade Rehman, Garry Wills"
},
{
"date": "2010-03-04",
"videos": [
"http://thecolbertreport.cc.com/videos/lfv3jf/health-care-magic",
"http://thecolbertreport.cc.com/videos/cgobmb/iraqracy",
"http://thecolbertreport.cc.com/videos/qdumax/tip-wag---james-o-keefe---sean-hannity",
"http://thecolbertreport.cc.com/videos/vy9si5/barry-schwartz",
"http://thecolbertreport.cc.com/videos/r3uuup/sign-off---see-you-later--alligator"
],
"guest": "Barry Schwartz"
},
{
"date": "2010-03-08",
"videos": [
"http://thecolbertreport.cc.com/videos/1919hp/exclusive---olympic-international-houses-pt--2",
"http://thecolbertreport.cc.com/videos/zqfavl/action-center---health-care-bill---ezra-klein",
"http://thecolbertreport.cc.com/videos/1nrjt6/tom-hanks-pt--1",
"http://thecolbertreport.cc.com/videos/49pae4/tom-hanks-pt--2",
"http://thecolbertreport.cc.com/videos/60qghm/sign-off---one-thought",
"http://thecolbertreport.cc.com/videos/xdowah/exclusive---olympic-international-houses-pt--1"
],
"guest": "Tom Hanks"
},
{
"date": "2010-03-09",
"videos": [
"http://thecolbertreport.cc.com/videos/6zrwd6/consumer-alert---pringles",
"http://thecolbertreport.cc.com/videos/rokdab/the-word---define---conquer",
"http://thecolbertreport.cc.com/videos/b670fj/tip-wag---joe-lieberman--the-pope---sharks",
"http://thecolbertreport.cc.com/videos/evq830/annie-leonard",
"http://thecolbertreport.cc.com/videos/887xl8/sign-off---goodnight"
],
"guest": "Annie Leonard"
},
{
"date": "2010-03-10",
"videos": [
"http://thecolbertreport.cc.com/videos/rj79bv/intro---03-10-10",
"http://thecolbertreport.cc.com/videos/ij37tl/non-sexual-groping",
"http://thecolbertreport.cc.com/videos/94dkr8/health-care-vote-information-nerve-center---charlie-cook",
"http://thecolbertreport.cc.com/videos/9m4kr7/survival-seed-bank",
"http://thecolbertreport.cc.com/videos/ski7ov/sean-carroll",
"http://thecolbertreport.cc.com/videos/4k81na/sign-off---the-colbert-repoll"
],
"guest": "Sean Carroll"
},
{
"date": "2010-03-11",
"videos": [
"http://thecolbertreport.cc.com/videos/nce2ba/karl-rove-s-new-book",
"http://thecolbertreport.cc.com/videos/8tmwv8/the-colbert-repoll---scott-rasmussen",
"http://thecolbertreport.cc.com/videos/8r95fc/monkey-on-the-lam---florida",
"http://thecolbertreport.cc.com/videos/c8f0b1/david-aaronovitch",
"http://thecolbertreport.cc.com/videos/96nihd/sign-off---thanks--karl-rove"
],
"guest": "David Aaronovitch"
},
{
"date": "2010-03-15",
"videos": [
"http://thecolbertreport.cc.com/videos/mz0yt2/intro---03-15-10",
"http://thecolbertreport.cc.com/videos/hut7vd/daylight-savings-time",
"http://thecolbertreport.cc.com/videos/cfbe28/the-word---afghanistan",
"http://thecolbertreport.cc.com/videos/402t35/i-can-t-believe-it-s-not-buddha---raj-patel",
"http://thecolbertreport.cc.com/videos/rf3mus/robert-baer",
"http://thecolbertreport.cc.com/videos/mdf427/sign-off---goodnight-with-balloon"
],
"guest": "Robert Baer"
},
{
"date": "2010-03-16",
"videos": [
"http://thecolbertreport.cc.com/videos/fmjopd/intro---03-16-10",
"http://thecolbertreport.cc.com/videos/jz5m0e/barack-joe-bama",
"http://thecolbertreport.cc.com/videos/wuyjzf/i-s-on-edjukashun---texas-school-board",
"http://thecolbertreport.cc.com/videos/wl96gx/thought-for-food---donna-simpson--le-whif---cat-litter",
"http://thecolbertreport.cc.com/videos/4h8104/rebecca-skloot",
"http://thecolbertreport.cc.com/videos/r6jed2/sign-off---remember-to-wear-green"
],
"guest": "Rebecca Skloot"
},
{
"date": "2010-03-17",
"videos": [
"http://thecolbertreport.cc.com/videos/86ybsq/ireland-s-shamrock-shortage",
"http://thecolbertreport.cc.com/videos/wpflq2/sport-report---vasectomies--chess-boxing---golf",
"http://thecolbertreport.cc.com/videos/m84hav/united-states-census-2010",
"http://thecolbertreport.cc.com/videos/wqbtkw/nell-irvin-painter",
"http://thecolbertreport.cc.com/videos/vvqhqa/sign-off---goodnight"
],
"guest": "Nell Irvin Painter"
},
{
"date": "2010-03-18",
"videos": [
"http://thecolbertreport.cc.com/videos/9cthmz/middle-eastern-dogs",
"http://thecolbertreport.cc.com/videos/oymi80/glenn-beck-attacks-social-justice---james-martin",
"http://thecolbertreport.cc.com/videos/70uuap/cheating-death---clenched-fingers---pill-reminder",
"http://thecolbertreport.cc.com/videos/42czdy/mary-matalin",
"http://thecolbertreport.cc.com/videos/xqfew6/sign-off---goodnight"
],
"guest": "Mary Matalin"
},
{
"date": "2010-03-29",
"videos": [
"http://thecolbertreport.cc.com/videos/uolmzb/passover-dinner-with-elijah",
"http://thecolbertreport.cc.com/videos/ua8bnx/geriatric-breeding-program",
"http://thecolbertreport.cc.com/videos/ixrazk/the-word---napoleon-blown-apart",
"http://thecolbertreport.cc.com/videos/m8ik8j/passover-commercialism",
"http://thecolbertreport.cc.com/videos/yksbdg/claire-mccaskill",
"http://thecolbertreport.cc.com/videos/s0mkwg/sign-off---friedrich-schiller"
],
"guest": "Sen. Claire McCaskill"
},
{
"date": "2010-03-30",
"videos": [
"http://thecolbertreport.cc.com/videos/13gooh/intro---03-30-10",
"http://thecolbertreport.cc.com/videos/fbk80n/ricky-martin-is-gay",
"http://thecolbertreport.cc.com/videos/fvq7gv/the-word---forgive-and-forget",
"http://thecolbertreport.cc.com/videos/dx0lyr/thought-for-food---corn-diapers--fatty-foods---jamie-oliver",
"http://thecolbertreport.cc.com/videos/51a308/simon-johnson",
"http://thecolbertreport.cc.com/videos/c9ef0m/sign-off---pringles---whipped-cream"
],
"guest": "Simon Johnson"
},
{
"date": "2010-03-31",
"videos": [
"http://thecolbertreport.cc.com/videos/xyd8rc/intro---03-31-10",
"http://thecolbertreport.cc.com/videos/phkk0m/who-s-not-honoring-me-now----peabody-awards",
"http://thecolbertreport.cc.com/videos/mnvsrm/tip-wag---hutaree-militia---abc",
"http://thecolbertreport.cc.com/videos/p9l3um/easter-under-attack---peeps-display-update",
"http://thecolbertreport.cc.com/videos/wj35p0/craig-mullaney",
"http://thecolbertreport.cc.com/videos/bnjl9e/sign-off---finger-pointing-award"
],
"guest": "Craig Mullaney"
},
{
"date": "2010-04-01",
"videos": [
"http://thecolbertreport.cc.com/videos/cej48a/intro---04-01-10",
"http://thecolbertreport.cc.com/videos/iymjih/stephen-gets-a-free-ipad",
"http://thecolbertreport.cc.com/videos/2nbqob/elephant-graveyard---david-frum",
"http://thecolbertreport.cc.com/videos/d9x5mh/jell-o-tampering",
"http://thecolbertreport.cc.com/videos/3z9wwh/judith-shulevitz",
"http://thecolbertreport.cc.com/videos/vjehbr/sign-off---goodnight-with-an-ipad"
],
"guest": "David Frum, Judith Shulevitz"
},
{
"date": "2010-04-05",
"videos": [
"http://thecolbertreport.cc.com/videos/5ehjj8/intro---04-05-10",
"http://thecolbertreport.cc.com/videos/9ef1ri/stephen-converts-to-3d",
"http://thecolbertreport.cc.com/videos/xo27p1/the-word---bait-and-snitch",
"http://thecolbertreport.cc.com/videos/rp7kua/threatdown---fox--the-obamas---time-traveling-brandy-thieves",
"http://thecolbertreport.cc.com/videos/672vju/dean-kamen",
"http://thecolbertreport.cc.com/videos/zv5abl/sign-off---goodnight-in-3d"
],
"guest": "Dean Kamen"
},
{
"date": "2010-04-06",
"videos": [
"http://thecolbertreport.cc.com/videos/l4nkoq/science-catfight---joe-bastardi-vs--brenda-ekwurzel",
"http://thecolbertreport.cc.com/videos/506dri/scrabble-allows-proper-names",
"http://thecolbertreport.cc.com/videos/hovkbz/al-sharpton",
"http://thecolbertreport.cc.com/videos/z3ifg9/sign-off---goodnight"
],
"guest": "Joe Bastardi, Brenda Ekwurzel, Rev. Al Sharpton"
},
{
"date": "2010-04-07",
"videos": [
"http://thecolbertreport.cc.com/videos/b1trvk/tiki-barber-cheats-on-his-wife",
"http://thecolbertreport.cc.com/videos/ov8dk6/tip-wag---hello-kitty-wine---pig-s-blood-filters",
"http://thecolbertreport.cc.com/videos/ds7vyt/nailed--em---fentimans-victorian-lemonade",
"http://thecolbertreport.cc.com/videos/23bsc5/david-simon",
"http://thecolbertreport.cc.com/videos/c3sk5b/sign-off---hello-kitty-wine---cigarettes"
],
"guest": "David Simon"
},
{
"date": "2010-04-08",
"videos": [
"http://thecolbertreport.cc.com/videos/x3hnt4/intro---04-08-10",
"http://thecolbertreport.cc.com/videos/p89oku/tiger-s-nike-commercial",
"http://thecolbertreport.cc.com/videos/06i9x0/the-word---affirmative-inaction",
"http://thecolbertreport.cc.com/videos/as4xr9/the-final-final-frontier",
"http://thecolbertreport.cc.com/videos/kkc8ee/neil-degrasse-tyson",
"http://thecolbertreport.cc.com/videos/54hsqy/sign-off---no-man-is-a-failure"
],
"guest": "Neil DeGrasse Tyson"
},
{
"date": "2010-04-12",
"videos": [
"http://thecolbertreport.cc.com/videos/5mdm7i/exclusive---julian-assange-extended-interview",
"http://thecolbertreport.cc.com/videos/vxvlp9/unpaid-internship-crackdown",
"http://thecolbertreport.cc.com/videos/ag970g/justice-stevens-replacement---jeffrey-toobin",
"http://thecolbertreport.cc.com/videos/3a0o7p/wikileaks-military-video",
"http://thecolbertreport.cc.com/videos/q1yz2t/julian-assange",
"http://thecolbertreport.cc.com/videos/abcefn/sign-off---goodnight"
],
"guest": "Jeffrey Toobin, Julian Assange"
},
{
"date": "2010-04-13",
"videos": [
"http://thecolbertreport.cc.com/videos/z1lfjo/dow-hits-11-000",
"http://thecolbertreport.cc.com/videos/fzwwcp/the-word---the-lost-cause",
"http://thecolbertreport.cc.com/videos/l0qwni/thought-for-food---mentally-ill-advertisers---german-cupcakes",
"http://thecolbertreport.cc.com/videos/aab36z/jon-mooallem",
"http://thecolbertreport.cc.com/videos/qrdpob/sign-off---cupcake-chicken-sandwich"
],
"guest": "Jon Mooallem"
},
{
"date": "2010-04-14",
"videos": [
"http://thecolbertreport.cc.com/videos/i50gi7/president-obama-bows-again",
"http://thecolbertreport.cc.com/videos/xhpjb5/sunday-morning-fact-checking---jake-tapper---bill-adair",
"http://thecolbertreport.cc.com/videos/f941v8/ryanair-charges-for-toilets",
"http://thecolbertreport.cc.com/videos/ohefue/david-shields",
"http://thecolbertreport.cc.com/videos/igm53s/sign-off---china-s-central-finance-ministry"
],
"guest": "David Shields"
},
{
"date": "2010-04-15",
"videos": [
"http://thecolbertreport.cc.com/videos/eskkbc/intro---04-15-10",
"http://thecolbertreport.cc.com/videos/1fannu/stephen-saves-the-space-program",
"http://thecolbertreport.cc.com/videos/1ymc3v/tip-wag---forbes---hipsters",
"http://thecolbertreport.cc.com/videos/5gztgb/formula-01-liquid-genetic-material",
"http://thecolbertreport.cc.com/videos/q2q4mc/aimee-mullins",
"http://thecolbertreport.cc.com/videos/t03669/sign-off---tax-deadline"
],
"guest": "Aimee Mullins"
},
{
"date": "2010-04-19",
"videos": [
"http://thecolbertreport.cc.com/videos/o36u2p/marilyn-monroe-s-x-rays",
"http://thecolbertreport.cc.com/videos/55ox6j/goldman-sachs--fraud-case---andrew-ross-sorkin",
"http://thecolbertreport.cc.com/videos/cyx4fw/volcano-eyjafjallajokull",
"http://thecolbertreport.cc.com/videos/ca04kl/george-will",
"http://thecolbertreport.cc.com/videos/8di6ao/sign-off---too-big-to-fail"
],
"guest": "Andrew Ross Sorkin, George Will"
},
{
"date": "2010-04-20",
"videos": [
"http://thecolbertreport.cc.com/videos/5kfqlg/intro---04-20-10",
"http://thecolbertreport.cc.com/videos/q0xdhc/robotic-voice-simulator---foreign-accent-syndrome",
"http://thecolbertreport.cc.com/videos/f5imzl/p-k--winsome---tea-party-consulting",
"http://thecolbertreport.cc.com/videos/2o8c1s/stephen-refuses-to-celebrate-4-20",
"http://thecolbertreport.cc.com/videos/n3iff5/jeffrey-katzenberg",
"http://thecolbertreport.cc.com/videos/kuy0dk/sign-off---as-they-say-in-japan"
],
"guest": "Jeffrey Katzenberg"
},
{
"date": "2010-04-21",
"videos": [
"http://thecolbertreport.cc.com/videos/6z2omj/the-new--100-bill",
"http://thecolbertreport.cc.com/videos/2nsr1s/the-word---no-problemo",
"http://thecolbertreport.cc.com/videos/mqfg58/nailed--em---drive-through-rapping",
"http://thecolbertreport.cc.com/videos/0teg38/craig-robinson",
"http://thecolbertreport.cc.com/videos/2tayao/sign-off---donate-to-john-legend-s-charity"
],
"guest": "Craig Robinson"
},
{
"date": "2010-04-22",
"videos": [
"http://thecolbertreport.cc.com/videos/62j0m5/newspapers-celebrate-earth-day",
"http://thecolbertreport.cc.com/videos/tqucn8/the-word---straight-to-video",
"http://thecolbertreport.cc.com/videos/g660yb/bonus-word---defamation-of-independents",
"http://thecolbertreport.cc.com/videos/0le7r3/gorillaz",
"http://thecolbertreport.cc.com/videos/s79r6n/sign-off---this-is-a-fun-job"
],
"guest": "Gorillaz"
},
{
"date": "2010-04-26",
"videos": [
"http://thecolbertreport.cc.com/videos/i6lszt/intro---04-26-10",
"http://thecolbertreport.cc.com/videos/exfe65/boobquake-day-causes-earthquake",
"http://thecolbertreport.cc.com/videos/ddudkb/the-word---docu-drama",
"http://thecolbertreport.cc.com/videos/4qgs1h/indecision-2010---midterm-elections---sue-lowden",
"http://thecolbertreport.cc.com/videos/j7hi89/sharon-jones"
],
"guest": "Sharon Jones and the Dap-Kings"
},
{
"date": "2010-04-27",
"videos": [
"http://thecolbertreport.cc.com/videos/5m4fi7/intro---04-27-10",
"http://thecolbertreport.cc.com/videos/7b23mk/the-real-lloyd-blankfein",
"http://thecolbertreport.cc.com/videos/ais5bh/stephen-hawking-is-such-an-a-hole---encountering-aliens",
"http://thecolbertreport.cc.com/videos/rjye16/conn-iggulden",
"http://thecolbertreport.cc.com/videos/68bzkf/sign-off---six-flags-discount-tickets"
],
"guest": "Conn Iggulden"
},
{
"date": "2010-04-28",
"videos": [
"http://thecolbertreport.cc.com/videos/g493lv/intro---04-28-10",
"http://thecolbertreport.cc.com/videos/uzkxfc/gulf-of-mexico-oil-spill",
"http://thecolbertreport.cc.com/videos/tzdwrb/cheating-death---tobacco-mints--breast-milk---hallucinogens",
"http://thecolbertreport.cc.com/videos/ke79c8/difference-makers---robert-ekas",
"http://thecolbertreport.cc.com/videos/pj9ppq/gregg-easterbrook",
"http://thecolbertreport.cc.com/videos/1tu0hz/sign-off---chief-wandering-meadow-s-headdress"
],
"guest": "Gregg Easterbrook"
},
{
"date": "2010-04-29",
"videos": [
"http://thecolbertreport.cc.com/videos/qu7aln/intro---rube-goldberg-machine",
"http://thecolbertreport.cc.com/videos/dima6g/wind-farm---oil-spill",
"http://thecolbertreport.cc.com/videos/u1djps/california-s-proposition-14---abel-maldonado",
"http://thecolbertreport.cc.com/videos/yqd68y/tip-wag---scientists---kfc",
"http://thecolbertreport.cc.com/videos/byd88g/ok-go"
],
"guest": "Abel Maldonado, OK Go"
},
{
"date": "2010-05-03",
"videos": [
"http://thecolbertreport.cc.com/videos/caaib9/times-square-terrorism",
"http://thecolbertreport.cc.com/videos/i2zwg4/fda-salt-regulation---lori-roman---michael-jacobson",
"http://thecolbertreport.cc.com/videos/bfve2i/bp-s-undersea-dome",
"http://thecolbertreport.cc.com/videos/6yc052/elizabeth-warren",
"http://thecolbertreport.cc.com/videos/jj9r4k/sign-off---lady-liberty-souvenirs"
],
"guest": "Elizabeth Warren"
},
{
"date": "2010-05-04",
"videos": [
"http://thecolbertreport.cc.com/videos/dula0l/intro---05-04-10",
"http://thecolbertreport.cc.com/videos/zfi7tc/boom--doesn-t-go-the-dynamite",
"http://thecolbertreport.cc.com/videos/dvwpph/the-word---flight-risk",
"http://thecolbertreport.cc.com/videos/xyjhb7/stephen-hawking-is-such-an-a-hole---time-travel",
"http://thecolbertreport.cc.com/videos/j2pf36/mark-moffett",
"http://thecolbertreport.cc.com/videos/d97fmn/sign-off---michael-j--fox-gets-locked-in"
],
"guest": "Michael J. Fox, Mark W. Moffett"
},
{
"date": "2010-05-05",
"videos": [
"http://thecolbertreport.cc.com/videos/nlh1ly/intro---05-05-10",
"http://thecolbertreport.cc.com/videos/2nfnz7/nashville-flood-wakeboarder",
"http://thecolbertreport.cc.com/videos/bw8v97/the-enemy-within---backyard-clothesline",
"http://thecolbertreport.cc.com/videos/2p2tqn/alpha-dog-of-the-week---george-rekers",
"http://thecolbertreport.cc.com/videos/pnjs6i/dave-isay",
"http://thecolbertreport.cc.com/videos/xufsxi/sign-off---dancing-with-julian"
],
"guest": "David Isay"
},
{
"date": "2010-05-06",
"videos": [
"http://thecolbertreport.cc.com/videos/pvx1hb/white-people-prayer-gap",
"http://thecolbertreport.cc.com/videos/97ikxz/british-election-couverage---andrew-sullivan",
"http://thecolbertreport.cc.com/videos/8a0q0r/movies-that-are-destroying-america---2010-summer-movie-edition",
"http://thecolbertreport.cc.com/videos/xo7hie/stewart-brand",
"http://thecolbertreport.cc.com/videos/0txjlv/sign-off---the-usa-today"
],
"guest": "Stewart Brand"
},
{
"date": "2010-05-10",
"videos": [
"http://thecolbertreport.cc.com/videos/8bpcly/intro---05-10-10",
"http://thecolbertreport.cc.com/videos/0m67h9/house-returns-the-favor",
"http://thecolbertreport.cc.com/videos/pxkemd/greece-wither-soon---scheherazade-rehman",
"http://thecolbertreport.cc.com/videos/oejc0z/oil-containment-solution-randomizer",
"http://thecolbertreport.cc.com/videos/6ikft9/gary-johnson",
"http://thecolbertreport.cc.com/videos/xeq5yb/sign-off---goodnight"
],
"guest": "Gov. Gary Johnson"
},
{
"date": "2010-05-11",
"videos": [
"http://thecolbertreport.cc.com/videos/n8gkaf/intro---05-11-10",
"http://thecolbertreport.cc.com/videos/pcdm2a/consumer-alert---best-friends-charm-bracelets",
"http://thecolbertreport.cc.com/videos/1227nt/kagan-worship---dahlia-lithwick",
"http://thecolbertreport.cc.com/videos/rp68kf/australian-sperm-shortage",
"http://thecolbertreport.cc.com/videos/d04me7/hampton-sides",
"http://thecolbertreport.cc.com/videos/qv4b2o/sign-off---wriststrong-arm"
],
"guest": "Hampton Sides"
},
{
"date": "2010-05-12",
"videos": [
"http://thecolbertreport.cc.com/videos/nyl5ye/intro---05-12-10",
"http://thecolbertreport.cc.com/videos/rxu3ed/controlled-burn-of-a-natural-gas",
"http://thecolbertreport.cc.com/videos/zf5e7d/threatdown---military-food-police--jazz-robots---pretty-girls",
"http://thecolbertreport.cc.com/videos/0mg8t8/stephen-s-sound-advice---how-to-ace-the-sats",
"http://thecolbertreport.cc.com/videos/jynvz7/deepak-chopra",
"http://thecolbertreport.cc.com/videos/0mpxm3/sign-off---fire-extinguisher-shooting"
],
"guest": "Deepak Chopra"
},
{
"date": "2010-05-13",
"videos": [
"http://thecolbertreport.cc.com/videos/uic1xz/intro---05-13-10",
"http://thecolbertreport.cc.com/videos/mp7sng/confirming-elena",
"http://thecolbertreport.cc.com/videos/o1qad4/the-hold-steady",
"http://thecolbertreport.cc.com/videos/ugcamu/sign-off---time-traveling-brandy-thief"
],
"guest": "The Hold Steady"
},
{
"date": "2010-06-01",
"videos": [
"http://thecolbertreport.cc.com/videos/1heoo5/intro---6-1-10",
"http://thecolbertreport.cc.com/videos/395e6g/vodka-eyeballing",
"http://thecolbertreport.cc.com/videos/6f9c47/up-brit-creek",
"http://thecolbertreport.cc.com/videos/p943d0/failure-to-launch---atlantis-crew",
"http://thecolbertreport.cc.com/videos/ngl48j/ayaan-hirsi-ali",
"http://thecolbertreport.cc.com/videos/jygylj/sign-off---water-eyeballing"
],
"guest": "Ayaan Hirsi Ali"
},
{
"date": "2010-06-02",
"videos": [
"http://thecolbertreport.cc.com/videos/6707v3/intro---6-2-10",
"http://thecolbertreport.cc.com/videos/gqwbeo/japan-s-special-election---kazuo-myazaki",
"http://thecolbertreport.cc.com/videos/qrxaw1/tip-wag---foxconn--charles-taylor---naomi-campbell",
"http://thecolbertreport.cc.com/videos/4dk71f/craziest-f--ing-thing-i-ve-ever-heard---gored-bullfighter",
"http://thecolbertreport.cc.com/videos/dvcqzb/lisa-miller",
"http://thecolbertreport.cc.com/videos/a4ztpz/sign-off---parting-gifts-for-kazuo-myazaki"
],
"guest": "Lisa Miller"
},
{
"date": "2010-06-03",
"videos": [
"http://thecolbertreport.cc.com/videos/d81bvl/intro---6-3-10",
"http://thecolbertreport.cc.com/videos/iy7vo7/crude---unusual",
"http://thecolbertreport.cc.com/videos/44gj25/who-s-watching-the-watchdog----liam-mccormack",
"http://thecolbertreport.cc.com/videos/p34tly/who-s-riding-my-coattails-now----ipad-suit-pocket",
"http://thecolbertreport.cc.com/videos/fo5d9i/vampire-weekend"
],
"guest": "Vampire Weekend"
},
{
"date": "2010-06-07",
"videos": [
"http://thecolbertreport.cc.com/videos/r4arov/intro---6-7-10",
"http://thecolbertreport.cc.com/videos/y0xgng/charity-begins-at-11-30",
"http://thecolbertreport.cc.com/videos/lc7nxu/oil-s-well-that-never-ends",
"http://thecolbertreport.cc.com/videos/c2l6b4/oil-spill-rage---james-carville",
"http://thecolbertreport.cc.com/videos/30w6f5/jonathan-alter",
"http://thecolbertreport.cc.com/videos/ow5rnp/sign-off---gulf-of-america-fund"
],
"guest": "James Carville, Jonathan Alter"
},
{
"date": "2010-06-08",
"videos": [
"http://thecolbertreport.cc.com/videos/uj5obr/obama-s-whoomp--there-it-is-controversy",
"http://thecolbertreport.cc.com/videos/yj9oop/the-word---p-r--mageddon",
"http://thecolbertreport.cc.com/videos/n3e887/mark-frauenfelder",
"http://thecolbertreport.cc.com/videos/r1zjxy/sign-off---the-most-useless-machine"
],
"guest": "Mark Frauenfelder"
},
{
"date": "2010-06-09",
"videos": [
"http://thecolbertreport.cc.com/videos/ou7te0/helen-thomas-s-reputation",
"http://thecolbertreport.cc.com/videos/0eesk5/formidable-opponent---michael-oren",
"http://thecolbertreport.cc.com/videos/41cjs4/shout-out---7th-eaccs",
"http://thecolbertreport.cc.com/videos/12z179/sam-nunn",
"http://thecolbertreport.cc.com/videos/hv8uj4/sign-off---50-hamburgers"
],
"guest": "Amb. Michael Oren, Sen. Sam Nunn"
},
{
"date": "2010-06-10",
"videos": [
"http://thecolbertreport.cc.com/videos/6iz8ha/bp-stock-sinks",
"http://thecolbertreport.cc.com/videos/e46kh9/sport-report---soccer-debate---marc-fisher---mark-starr",
"http://thecolbertreport.cc.com/videos/9rht3y/simulated-mars-mission",
"http://thecolbertreport.cc.com/videos/19ikyl/alan-bean",
"http://thecolbertreport.cc.com/videos/gewg17/sign-off---chocolate-syrup"
],
"guest": "Alan Bean"
},
{
"date": "2010-06-14",
"videos": [
"http://thecolbertreport.cc.com/videos/7xsbh3/intro---6-14-10",
"http://thecolbertreport.cc.com/videos/vlk9h9/america-s-strained-relationship-with-england",
"http://thecolbertreport.cc.com/videos/xhnftx/smokin--pole---the-quest-for-arctic-riches--canada---china",
"http://thecolbertreport.cc.com/videos/b6bfik/who-s-not-honoring-me-now----tonys---mtv-movie-awards",
"http://thecolbertreport.cc.com/videos/bd9ero/stephen-prothero",
"http://thecolbertreport.cc.com/videos/t2lbqh/sign-off---the-new-oxford-american-dictionary"
],
"guest": "Stephen Prothero"
},
{
"date": "2010-06-15",
"videos": [
"http://thecolbertreport.cc.com/videos/ue0g9m/intro---6-15-10",
"http://thecolbertreport.cc.com/videos/w6pwpk/testoster-ruin---hanna-rosin",
"http://thecolbertreport.cc.com/videos/o42e2u/tip-wag---marshall-islands---disney-world-fate",
"http://thecolbertreport.cc.com/videos/zkoqn2/carl-safina",
"http://thecolbertreport.cc.com/videos/vr28jt/sign-off---hot-boxers"
],
"guest": "Dr. Carl Safina"
},
{
"date": "2010-06-16",
"videos": [
"http://thecolbertreport.cc.com/videos/vtw6mw/intro---6-16-10",
"http://thecolbertreport.cc.com/videos/atwjd4/obama-s-bp-oil-spill-speech",
"http://thecolbertreport.cc.com/videos/fq1qpx/the-word----tay-the-cour-e",
"http://thecolbertreport.cc.com/videos/0occfp/brevity-is-the-soul-of-twit",
"http://thecolbertreport.cc.com/videos/ak28k2/devo"
],
"guest": "Devo"
},
{
"date": "2010-06-17",
"videos": [
"http://thecolbertreport.cc.com/videos/zp0vlt/exclusive---who-s-watching-the-watchdog-pt--1",
"http://thecolbertreport.cc.com/videos/mgk9uw/exclusive---who-s-watching-the-watchdog-pt--2",
"http://thecolbertreport.cc.com/videos/lmlfss/obama-s-simplified-bp-oil-spill-speech",
"http://thecolbertreport.cc.com/videos/r0x7kl/south-carolina-s-4th-district-primary---bob-inglis",
"http://thecolbertreport.cc.com/videos/pw3z5k/colbert-platinum---summer-travel-edition",
"http://thecolbertreport.cc.com/videos/psfs9q/david-mamet",
"http://thecolbertreport.cc.com/videos/t0bf7h/sign-off---retweet-for-the-gulf-of-america-fund"
],
"guest": "David Mamet"
},
{
"date": "2010-06-21",
"videos": [
"http://thecolbertreport.cc.com/videos/3xh3zp/us-ties-with-slovenia",
"http://thecolbertreport.cc.com/videos/tsbncg/fallback-position---astronaut-pt--1",
"http://thecolbertreport.cc.com/videos/lw3o9e/joe-barton-s-misconstrued-misconstruction",
"http://thecolbertreport.cc.com/videos/6rxgjl/wes-moore",
"http://thecolbertreport.cc.com/videos/xr56ob/sign-off---spare-cursed-monkey-s-paw"
],
"guest": "Wes Moore"
},
{
"date": "2010-06-22",
"videos": [
"http://thecolbertreport.cc.com/videos/f7v2qo/who-s-riding-my-coattails-now----ipad-suit-pocket",
"http://thecolbertreport.cc.com/videos/mt3j86/stanley-mcchrystal-talks-to-rolling-stone",
"http://thecolbertreport.cc.com/videos/dry79y/fallback-position---astronaut-pt--2",
"http://thecolbertreport.cc.com/videos/eyzb5g/usa-board-of-ophthalmological-freedom",
"http://thecolbertreport.cc.com/videos/ej23e4/gloria-steinem",
"http://thecolbertreport.cc.com/videos/jewfph/sign-off---goodnight"
],
"guest": "Gloria Steinem"
},
{
"date": "2010-06-23",
"videos": [
"http://thecolbertreport.cc.com/videos/h4yffi/intro---6-23-10",
"http://thecolbertreport.cc.com/videos/wcoc11/us-defeats-algeria",
"http://thecolbertreport.cc.com/videos/licobk/yahweh-or-no-way---the-blues-brothers---glenn-beck",
"http://thecolbertreport.cc.com/videos/3dk57p/prophet-glenn-beck---father-guido-sarducci",
"http://thecolbertreport.cc.com/videos/quds8l/tim-westergren",
"http://thecolbertreport.cc.com/videos/p3f9t8/sign-off---tomorrow-s-fallback-position"
],
"guest": "Tim Westergren"
},
{
"date": "2010-06-24",
"videos": [
"http://thecolbertreport.cc.com/videos/k3vali/intro---6-24-10",
"http://thecolbertreport.cc.com/videos/i8ohf4/put-the-cursed-monkey-paw-down",
"http://thecolbertreport.cc.com/videos/5m2oyq/the-word---weapon-of-mass-construction",
"http://thecolbertreport.cc.com/videos/6ppo8y/fallback-position---astronaut-pt--3",
"http://thecolbertreport.cc.com/videos/3td47y/michael-specter",
"http://thecolbertreport.cc.com/videos/86kjse/sign-off---general-s-cap"
],
"guest": "Michael Specter"
},
{
"date": "2010-06-28",
"videos": [
"http://thecolbertreport.cc.com/videos/cchudg/robert-c--byrd-dies-at-92",
"http://thecolbertreport.cc.com/videos/t7kbm8/rolling-stone-article-on-mcchrystal---michael-hastings",
"http://thecolbertreport.cc.com/videos/nxs1np/doomsday-bunkers",
"http://thecolbertreport.cc.com/videos/kpz62f/john-waters",
"http://thecolbertreport.cc.com/videos/q1un38/sign-off---goodnight"
],
"guest": "Michael Hastings, John Waters"
},
{
"date": "2010-06-29",
"videos": [
"http://thecolbertreport.cc.com/videos/8w7w4q/intro---6-29-10",
"http://thecolbertreport.cc.com/videos/5i29xg/supreme-court-justice-sweetness",
"http://thecolbertreport.cc.com/videos/gxmj8l/basketcase---stephie-s-knicks-hoop-de-doo-pt--1",
"http://thecolbertreport.cc.com/videos/cxtlq7/lube-job",
"http://thecolbertreport.cc.com/videos/t7eba8/julian-castro",
"http://thecolbertreport.cc.com/videos/6s4ag9/sign-off---sweetness"
],
"guest": "Mayor Julian Castro"
},
{
"date": "2010-06-30",
"videos": [
"http://thecolbertreport.cc.com/videos/4nay3b/mysteries-of-the-ancient-unknown---king-tut-s-penis-pt--1",
"http://thecolbertreport.cc.com/videos/200t0y/cold-war-update---north-korea---russian-spies",
"http://thecolbertreport.cc.com/videos/85xlkw/nicholas-carr",
"http://thecolbertreport.cc.com/videos/zz75v5/sign-off---goodnight"
],
"guest": "Nicholas Carr"
},
{
"date": "2010-07-01",
"videos": [
"http://thecolbertreport.cc.com/videos/qkh2oy/intro---7-1-10",
"http://thecolbertreport.cc.com/videos/p1rz8m/al-qaeda-starts-inspire-magazine",
"http://thecolbertreport.cc.com/videos/ytd0xh/threatdown---dawn--actual-food---texas-gop",
"http://thecolbertreport.cc.com/videos/zgf08n/tangelo-american-john-boehner",
"http://thecolbertreport.cc.com/videos/7p27ga/manny-howard",
"http://thecolbertreport.cc.com/videos/lruog2/sign-off---obsessive-compulsive-disorder"
],
"guest": "Manny Howard"
},
{
"date": "2010-07-05",
"videos": [
"http://thecolbertreport.cc.com/videos/88l8y3/stephen-is-sick",
"http://thecolbertreport.cc.com/videos/yw04k6/electronic-frontier-foundation---cindy-cohn",
"http://thecolbertreport.cc.com/videos/2vgxvc/unemployment-benefits---paul-krugman",
"http://thecolbertreport.cc.com/videos/tod2oy/michio-kaku",
"http://thecolbertreport.cc.com/videos/59nr33/sign-off---the-hot-zone"
],
"guest": "Paul Krugman, Dr. Michio Kaku"
},
{
"date": "2010-07-06",
"videos": [
"http://thecolbertreport.cc.com/videos/jogb92/intro---7-6-10",
"http://thecolbertreport.cc.com/videos/vh6d9y/latest-soap-opera-news",
"http://thecolbertreport.cc.com/videos/v4t63q/the-word---the-white-stuff",
"http://thecolbertreport.cc.com/videos/52xc1z/i-s-on-edjukashun---loyola--texas-textbooks---wal-mart",
"http://thecolbertreport.cc.com/videos/44dhom/garret-keizer",
"http://thecolbertreport.cc.com/videos/p9lstk/sign-off---goodnight"
],
"guest": "Garret Keizer"
},
{
"date": "2010-07-07",
"videos": [
"http://thecolbertreport.cc.com/videos/yx0x8s/the-carell-corral",
"http://thecolbertreport.cc.com/videos/u8pmv7/the-economist-photoshops-obama-s-picture",
"http://thecolbertreport.cc.com/videos/2vaaww/thought-for-food---kentucky-tuna---grilled-cheese-burger-melt",
"http://thecolbertreport.cc.com/videos/7ctnwz/formula-401--beauty-from-my-beast",
"http://thecolbertreport.cc.com/videos/s7mibo/steve-carell",
"http://thecolbertreport.cc.com/videos/ytvd7r/sign-off---2010-sexy-spermatozoa-calendar"
],
"guest": "Steve Carell"
},
{
"date": "2010-07-08",
"videos": [
"http://thecolbertreport.cc.com/videos/381yrb/intro---7-8-10",
"http://thecolbertreport.cc.com/videos/x5lln0/modest-con-2010",
"http://thecolbertreport.cc.com/videos/zjdl0i/automatics-for-the-people---ilya-shapiro---jackie-hilly",
"http://thecolbertreport.cc.com/videos/eieifn/emergency-thought-for-food---candwich-setback",
"http://thecolbertreport.cc.com/videos/nlmfgk/arturo-rodriguez",
"http://thecolbertreport.cc.com/videos/oc0gsm/sign-off---go-get-a-tan"
],
"guest": "Arturo Rodriguez"
},
{
"date": "2010-07-26",
"videos": [
"http://thecolbertreport.cc.com/videos/xsaeav/intro---7-26-10",
"http://thecolbertreport.cc.com/videos/snrn4u/stephen-s-eco-vacation",
"http://thecolbertreport.cc.com/videos/qqashr/racial-pro-firing",
"http://thecolbertreport.cc.com/videos/1axxh8/nailed--em---polka-piracy",
"http://thecolbertreport.cc.com/videos/u5kfga/hephzibah-anderson",
"http://thecolbertreport.cc.com/videos/rcl3ml/sign-off---bud-light-lime"
],
"guest": "Hephzibah Anderson"
},
{
"date": "2010-07-27",
"videos": [
"http://thecolbertreport.cc.com/videos/aiaw4g/intro---7-27-10",
"http://thecolbertreport.cc.com/videos/56iw57/bp-s-live-hayward-cam",
"http://thecolbertreport.cc.com/videos/m571z2/that-s-the-way-i-leak-it---tom-blanton",
"http://thecolbertreport.cc.com/videos/431v9v/tip-wag---baby-gap--dick-cheney---plants",
"http://thecolbertreport.cc.com/videos/2afxlp/kevin-kline",
"http://thecolbertreport.cc.com/videos/y6qd20/sign-off---goodnight"
],
"guest": "Thomas S. Blanton, Kevin Kline"
},
{
"date": "2010-07-28",
"videos": [
"http://thecolbertreport.cc.com/videos/it4pai/obama-blows-off-the-boy-scouts",
"http://thecolbertreport.cc.com/videos/ce9wme/the-word---ownership-society",
"http://thecolbertreport.cc.com/videos/k9y4mw/republican-gubernatorial-primary-battle-watch--010---tennessee",
"http://thecolbertreport.cc.com/videos/hjiro1/elon-musk",
"http://thecolbertreport.cc.com/videos/fl5n9q/sign-off---bit-of-advice"
],
"guest": "Elon Musk"
},
{
"date": "2010-07-29",
"videos": [
"http://thecolbertreport.cc.com/videos/cjuayn/intro---7-29-10",
"http://thecolbertreport.cc.com/videos/dzk032/the-oil-is-missing",
"http://thecolbertreport.cc.com/videos/i9hga3/thought-for-food---cereal--foot-long-cheeseburger---ecobot-iii",
"http://thecolbertreport.cc.com/videos/jt67k1/apology-box",
"http://thecolbertreport.cc.com/videos/sdjfj9/andy-cohen",
"http://thecolbertreport.cc.com/videos/6hqby7/sign-off---cocktails"
],
"guest": "Andy Cohen"
},
{
"date": "2010-08-02",
"videos": [
"http://thecolbertreport.cc.com/videos/07zpy3/intro---8-2-10",
"http://thecolbertreport.cc.com/videos/o9k8cr/stephen-might-be-gay",
"http://thecolbertreport.cc.com/videos/wx3505/sport-report---london-olympics---illegal-bullfighting",
"http://thecolbertreport.cc.com/videos/3dwyx0/alpha-dog-of-the-week---david-h--brooks",
"http://thecolbertreport.cc.com/videos/ln5q1u/jimmy-cliff"
],
"guest": "Jimmy Cliff"
},
{
"date": "2010-08-03",
"videos": [
"http://thecolbertreport.cc.com/videos/s8t2k9/brett-favre-retires-again",
"http://thecolbertreport.cc.com/videos/noj1lw/consumer-protection-agency---barney-frank",
"http://thecolbertreport.cc.com/videos/jrpte4/republican-gubernatorial-primary-battle-watch--010---basil-marceaux-com",
"http://thecolbertreport.cc.com/videos/a5r0r5/laura-ingraham",
"http://thecolbertreport.cc.com/videos/9838f3/sign-off---credit-card-agreement"
],
"guest": "Laura Ingraham"
},
{
"date": "2010-08-04",
"videos": [
"http://thecolbertreport.cc.com/videos/eirad0/basil-marceaux-com---obama-s-birthday",
"http://thecolbertreport.cc.com/videos/4mbc26/p-k--winsome---black-viewer-ratings",
"http://thecolbertreport.cc.com/videos/vhx4eu/threat-standdown---monkey-terrorism",
"http://thecolbertreport.cc.com/videos/t5nlmh/michael-posner",
"http://thecolbertreport.cc.com/videos/gc9gia/sign-off---nielsen-mandela"
],
"guest": "Michael Posner"
},
{
"date": "2010-08-05",
"videos": [
"http://thecolbertreport.cc.com/videos/tsl05q/intro---8-5-10",
"http://thecolbertreport.cc.com/videos/1qu0ts/how-to-ruin-same-sex-marriages",
"http://thecolbertreport.cc.com/videos/gw1rft/pope-s-baseball-cap---catholictv",
"http://thecolbertreport.cc.com/videos/bdzvwl/savion-glover",
"http://thecolbertreport.cc.com/videos/our78a/sign-off---tap-dancing"
],
"guest": "Savion Glover"
},
{
"date": "2010-08-10",
"videos": [
"http://thecolbertreport.cc.com/videos/cfbxpk/intro---8-10-10",
"http://thecolbertreport.cc.com/videos/40r2zf/honoring-martin-luther-king",
"http://thecolbertreport.cc.com/videos/jbgt2s/citizenship-down---akhil-amar",
"http://thecolbertreport.cc.com/videos/v2az23/alpha-dog-of-the-week---steven-slater",
"http://thecolbertreport.cc.com/videos/uhmewn/dylan-ratigan",
"http://thecolbertreport.cc.com/videos/p3wgd1/sign-off---goodnight"
],
"guest": "Dylan Ratigan"
},
{
"date": "2010-08-11",
"videos": [
"http://thecolbertreport.cc.com/videos/jwpn0p/moral-compass-5000-action-center",
"http://thecolbertreport.cc.com/videos/tpcehb/david-finkel",
"http://thecolbertreport.cc.com/videos/j0nge7/sign-off---goodnight"
],
"guest": "David Finkel"
},
{
"date": "2010-08-12",
"videos": [
"http://thecolbertreport.cc.com/videos/ibivj9/intro---8-12-10",
"http://thecolbertreport.cc.com/videos/t6cmn9/happy-ramadan",
"http://thecolbertreport.cc.com/videos/tavgu2/the-word---weapon-of-mass-construction",
"http://thecolbertreport.cc.com/videos/obv2rl/senior-moment",
"http://thecolbertreport.cc.com/videos/lx17lm/chuck-close",
"http://thecolbertreport.cc.com/videos/h6dwnn/sign-off---chuck-close-books"
],
"guest": "Chuck Close"
},
{
"date": "2010-08-16",
"videos": [
"http://thecolbertreport.cc.com/videos/q61axv/growing-intelligence-community---richard-clarke",
"http://thecolbertreport.cc.com/videos/yh08ag/invasion-of-the-country-snatchers",
"http://thecolbertreport.cc.com/videos/gr3fyt/john-fetterman",
"http://thecolbertreport.cc.com/videos/6ksdhb/sign-off---starbucks-latte"
],
"guest": "Richard Clarke, John Fetterman"
},
{
"date": "2010-08-17",
"videos": [
"http://thecolbertreport.cc.com/videos/dlrtyi/intro---8-17-10",
"http://thecolbertreport.cc.com/videos/c3sn86/newsweek-ranks-the-world-s-best-countries",
"http://thecolbertreport.cc.com/videos/2hdefm/better-know-a-lobby---american-meat-institute",
"http://thecolbertreport.cc.com/videos/tno3pg/fox-news-and-republican-party-make-it-official",
"http://thecolbertreport.cc.com/videos/2kzgs4/barry-levine",
"http://thecolbertreport.cc.com/videos/xsqp9j/sign-off---newsweek"
],
"guest": "Barry Levine"
},
{
"date": "2010-08-18",
"videos": [
"http://thecolbertreport.cc.com/videos/vby4js/intro---8-18-10",
"http://thecolbertreport.cc.com/videos/50c2du/brett-favre-returns-to-football",
"http://thecolbertreport.cc.com/videos/08wn77/the-word---borderline-personality",
"http://thecolbertreport.cc.com/videos/l06vi1/don-t-shoot-the-schlessinger",
"http://thecolbertreport.cc.com/videos/389e2m/thomas-french",
"http://thecolbertreport.cc.com/videos/b2scuj/sign-off---sharpened-broom-handle"
],
"guest": "Thomas French"
},
{
"date": "2010-08-19",
"videos": [
"http://thecolbertreport.cc.com/videos/x0zwn9/intro---8-19-10",
"http://thecolbertreport.cc.com/videos/m4f5im/the-word---what-if-you-threw-a-peace-and-nobody-came-",
"http://thecolbertreport.cc.com/videos/2rjk08/all-s-well-that-ends-oil-well---michael-blum",
"http://thecolbertreport.cc.com/videos/c2uztk/jon-krakauer",
"http://thecolbertreport.cc.com/videos/g9w04r/sign-off---goodnight"
],
"guest": "Jon Krakauer"
},
{
"date": "2010-08-23",
"videos": [
"http://thecolbertreport.cc.com/videos/zn0m8s/stephen-wins-an-emmy",
"http://thecolbertreport.cc.com/videos/xa3l6x/the-word---losing-his-religion",
"http://thecolbertreport.cc.com/videos/8vazj8/aqua-threatdown---oyster-sluts--japanese-hackers---israeli-regulators",
"http://thecolbertreport.cc.com/videos/jjg6uf/leslie-kean",
"http://thecolbertreport.cc.com/videos/gbrydj/sign-off---balloon"
],
"guest": "Leslie Kean"
},
{
"date": "2010-08-24",
"videos": [
"http://thecolbertreport.cc.com/videos/8v2r6r/intro---8-24-10",
"http://thecolbertreport.cc.com/videos/ay7pky/terror-bunker-5200",
"http://thecolbertreport.cc.com/videos/rxmuip/the-word---control-self-delete",
"http://thecolbertreport.cc.com/videos/7azwuj/mahmoody-blues",
"http://thecolbertreport.cc.com/videos/vly30s/jeffrey-goldberg",
"http://thecolbertreport.cc.com/videos/p0468k/sign-off---sanitized-goodnight"
],
"guest": "Jeffrey Goldberg"
},
{
"date": "2010-08-25",
"videos": [
"http://thecolbertreport.cc.com/videos/ckwof5/john-mccain-s-victorious-defeat",
"http://thecolbertreport.cc.com/videos/bn16zn/stephen-colbert-university---andrew-hacker",
"http://thecolbertreport.cc.com/videos/nmp9j3/mysteries-of-the-ancient-unknown---king-tut-s-penis-pt--2",
"http://thecolbertreport.cc.com/videos/boejnl/heidi-cullen",
"http://thecolbertreport.cc.com/videos/8mv6il/sign-off---calculator"
],
"guest": "Andrew Hacker, Heidi Cullen"
},
{
"date": "2010-08-26",
"videos": [
"http://thecolbertreport.cc.com/videos/8g8jfw/intro---8-26-10",
"http://thecolbertreport.cc.com/videos/cg8fb2/fox-news-job-opening",
"http://thecolbertreport.cc.com/videos/3k8c17/glenn-livid",
"http://thecolbertreport.cc.com/videos/ozbh2e/you-mosque-be-kidding",
"http://thecolbertreport.cc.com/videos/idhto6/richard-engel",
"http://thecolbertreport.cc.com/videos/054o86/sign-off---speaking-fee"
],
"guest": "Richard Engel"
},
{
"date": "2010-09-07",
"videos": [
"http://thecolbertreport.cc.com/videos/99y0f6/intro---9-7-10",
"http://thecolbertreport.cc.com/videos/xvxdbg/geese-witherspoon",
"http://thecolbertreport.cc.com/videos/os39h8/better-know-a-district---delaware-s-at-large---mike-castle-update",
"http://thecolbertreport.cc.com/videos/ylp5nt/anthony-romero",
"http://thecolbertreport.cc.com/videos/olfody/sign-off---welcome-home-show"
],
"guest": "Anthony Romero"
},
{
"date": "2010-09-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ynyu8x/intro---9-8-10",
"http://thecolbertreport.cc.com/videos/kmgrcb/been-there--won-that---joe-biden---yogi-berra",
"http://thecolbertreport.cc.com/videos/l21o2y/been-there--won-that---ray-odierno",
"http://thecolbertreport.cc.com/videos/dp7uzb/joe-biden",
"http://thecolbertreport.cc.com/videos/r1r2jw/sign-off---thanks-to-the-returning-troops"
],
"guest": "Vice President Joe Biden, Gen. Raymond Odierno"
},
{
"date": "2010-09-09",
"videos": [
"http://thecolbertreport.cc.com/videos/txd70l/been-there--won-that---jim-webb",
"http://thecolbertreport.cc.com/videos/tvmzxz/been-there--won-that---david-petraeus",
"http://thecolbertreport.cc.com/videos/9543jt/brent-cummings---josh-bleill"
],
"guest": "Sen. Jim Webb, Lt. Col. Brent Cummings, John Legend"
},
{
"date": "2010-09-13",
"videos": [
"http://thecolbertreport.cc.com/videos/4q0lgz/intro---9-13-10",
"http://thecolbertreport.cc.com/videos/1x4nj0/microwave-programming",
"http://thecolbertreport.cc.com/videos/wzt5ev/bears---balls---american-apparel---chocolatey",
"http://thecolbertreport.cc.com/videos/nwwxfb/stop-sending-live-animals",
"http://thecolbertreport.cc.com/videos/hr5uxa/lisa-birnbach",
"http://thecolbertreport.cc.com/videos/w7kfgs/sign-off---goodnight"
],
"guest": "Lisa Birnbach"
},
{
"date": "2010-09-14",
"videos": [
"http://thecolbertreport.cc.com/videos/zipkzm/intro---9-14-10",
"http://thecolbertreport.cc.com/videos/pet2x5/peta-criticizes-joe-biden",
"http://thecolbertreport.cc.com/videos/7cbxuw/the-word---mutually-assured-coercion",
"http://thecolbertreport.cc.com/videos/oh49ge/luther-campbell-opposes-ground-zero-mosque",
"http://thecolbertreport.cc.com/videos/yevohc/sean-wilentz",
"http://thecolbertreport.cc.com/videos/fugenz/sign-off---goodnight"
],
"guest": "Sean Wilentz"
},
{
"date": "2010-09-15",
"videos": [
"http://thecolbertreport.cc.com/videos/0hpaxs/intro---9-15-10",
"http://thecolbertreport.cc.com/videos/f8g0cq/libertea",
"http://thecolbertreport.cc.com/videos/7v15m5/atone-phone---joan-rivers-calls",
"http://thecolbertreport.cc.com/videos/n9nk9d/saul-griffith",
"http://thecolbertreport.cc.com/videos/mjozqh/sign-off---world-changing-announcement"
],
"guest": "Saul Griffith"
},
{
"date": "2010-09-16",
"videos": [
"http://thecolbertreport.cc.com/videos/uj8r4c/march-to-keep-fear-alive-announcement",
"http://thecolbertreport.cc.com/videos/5klha6/threatdown---bedbugs---environmentalists---jerome-goddard",
"http://thecolbertreport.cc.com/videos/pck634/lawrence-o-donnell",
"http://thecolbertreport.cc.com/videos/h5yz8n/sign-off---march-to-keep-fear-alive"
],
"guest": "Lawrence O'Donnell"
},
{
"date": "2010-09-20",
"videos": [
"http://thecolbertreport.cc.com/videos/cahpkw/intro---9-20-10",
"http://thecolbertreport.cc.com/videos/1fmwjo/christine-o-donnell-witch-test",
"http://thecolbertreport.cc.com/videos/diatjd/tip-wag---chilean-miners--portland-press-herald---isa-blyth",
"http://thecolbertreport.cc.com/videos/a4y4ey/march-to-keep-fear-alive-media-coverage",
"http://thecolbertreport.cc.com/videos/b65ofd/pavement"
],
"guest": "Pavement"
},
{
"date": "2010-09-21",
"videos": [
"http://thecolbertreport.cc.com/videos/yi7cbo/intro---9-21-10",
"http://thecolbertreport.cc.com/videos/t99up5/in-poor-taste---mark-shriver",
"http://thecolbertreport.cc.com/videos/2vrsvg/colbertslist",
"http://thecolbertreport.cc.com/videos/tnb3an/eric-schmidt",
"http://thecolbertreport.cc.com/videos/kecowj/sign-off---sign-up-for-the-march-to-keep-fear-alive"
],
"guest": "Eric Schmidt"
},
{
"date": "2010-09-22",
"videos": [
"http://thecolbertreport.cc.com/videos/q8xj8c/intro---9-22-10",
"http://thecolbertreport.cc.com/videos/gcap67/the-christine-o-donnell-clip-predictor-3000",
"http://thecolbertreport.cc.com/videos/xq0472/the-word---the-more-you-no",
"http://thecolbertreport.cc.com/videos/xr7q4y/fallback-position---migrant-worker-pt--1",
"http://thecolbertreport.cc.com/videos/kgnwdf/guillermo-del-toro",
"http://thecolbertreport.cc.com/videos/lnpblj/sign-off---stephen-won-t-forgive-you"
],
"guest": "Guillermo Del Toro"
},
{
"date": "2010-09-23",
"videos": [
"http://thecolbertreport.cc.com/videos/e9ulyf/intro---9-23-10",
"http://thecolbertreport.cc.com/videos/puxqvp/fallback-position---migrant-worker-pt--2",
"http://thecolbertreport.cc.com/videos/imp10g/sanchez-bump",
"http://thecolbertreport.cc.com/videos/937jzh/oscar-goodman",
"http://thecolbertreport.cc.com/videos/hitep1/sign-off---american-history-lesson"
],
"guest": "Oscar Goodman"
},
{
"date": "2010-09-27",
"videos": [
"http://thecolbertreport.cc.com/videos/esvw5v/intro---9-27-10",
"http://thecolbertreport.cc.com/videos/aychpz/corn-packer-apology",
"http://thecolbertreport.cc.com/videos/nc19il/the-delawert-report",
"http://thecolbertreport.cc.com/videos/pcae92/the-word---army-of-mum",
"http://thecolbertreport.cc.com/videos/kby55r/yahweh-or-no-way---ihop---antonio-federici-ad",
"http://thecolbertreport.cc.com/videos/y2afey/ken-burns",
"http://thecolbertreport.cc.com/videos/g2pys1/sign-off---goodnight"
],
"guest": "Ken Burns"
},
{
"date": "2010-09-28",
"videos": [
"http://thecolbertreport.cc.com/videos/s437p7/intro---9-28-10",
"http://thecolbertreport.cc.com/videos/gspyir/left-behind---paul-begala",
"http://thecolbertreport.cc.com/videos/57ib6e/terror-a-new-one",
"http://thecolbertreport.cc.com/videos/ut4vp1/ross-douthat",
"http://thecolbertreport.cc.com/videos/0pm7c2/sign-off---democratic-grave"
],
"guest": "Paul Begala, Ross Douthat"
},
{
"date": "2010-09-29",
"videos": [
"http://thecolbertreport.cc.com/videos/umvy3w/march-to-keep-fear-alive-insanity-bus",
"http://thecolbertreport.cc.com/videos/kup6co/the-word---original-spin",
"http://thecolbertreport.cc.com/videos/z1c69t/threatdown---record-breaking-gays--koalas---purell",
"http://thecolbertreport.cc.com/videos/q56zhc/steven-rattner",
"http://thecolbertreport.cc.com/videos/kn5pkq/sign-off---sign-up-for-the-march-to-keep-fear-alive"
],
"guest": "Steve Rattner"
},
{
"date": "2010-09-30",
"videos": [
"http://thecolbertreport.cc.com/videos/umgd4n/intro---9-30-10",
"http://thecolbertreport.cc.com/videos/xic7q8/president-obama-endorses-the-rally-to-restore-sanity",
"http://thecolbertreport.cc.com/videos/xd5pkh/droid-rage",
"http://thecolbertreport.cc.com/videos/w8i263/stat-of-the-union",
"http://thecolbertreport.cc.com/videos/h7gmgz/aaron-sorkin",
"http://thecolbertreport.cc.com/videos/7zrc6h/sign-off---march-to-keep-fear-alive-costumes"
],
"guest": "Aaron Sorkin"
},
{
"date": "2010-10-04",
"videos": [
"http://thecolbertreport.cc.com/videos/vwiap8/intro---10-4-10",
"http://thecolbertreport.cc.com/videos/h7fctl/we-world-war-won-it",
"http://thecolbertreport.cc.com/videos/k8t4ao/the-word---it-s-a-small-minded-world",
"http://thecolbertreport.cc.com/videos/nbdcz5/tip-wag---tea-party-coloring-book---calm-legislation",
"http://thecolbertreport.cc.com/videos/pl2b2g/eugene-robinson",
"http://thecolbertreport.cc.com/videos/3w0ogs/sign-off---matching-donor"
],
"guest": "Eugene Robinson"
},
{
"date": "2010-10-05",
"videos": [
"http://thecolbertreport.cc.com/videos/72j4yn/intro---10-5-10",
"http://thecolbertreport.cc.com/videos/9xty22/american-sexual-habits",
"http://thecolbertreport.cc.com/videos/0xyglo/gang-busters---john-burnett",
"http://thecolbertreport.cc.com/videos/e4gleb/langur-monkey-security",
"http://thecolbertreport.cc.com/videos/98qo87/leon-botstein",
"http://thecolbertreport.cc.com/videos/gi2fk6/sign-off---goodnight"
],
"guest": "Leon Botstein"
},
{
"date": "2010-10-06",
"videos": [
"http://thecolbertreport.cc.com/videos/pg4r1d/intro---10-6-10",
"http://thecolbertreport.cc.com/videos/gu3bg9/tiny-triumphs---environmentalist-ear-pollution",
"http://thecolbertreport.cc.com/videos/rex0nc/rawesome-foods-raid",
"http://thecolbertreport.cc.com/videos/6krvaq/mavis-staples---jeff-tweedy",
"http://thecolbertreport.cc.com/videos/01gaiu/sign-off---you-are-not-alone"
],
"guest": "Mavis Staples & Jeff Tweedy"
},
{
"date": "2010-10-07",
"videos": [
"http://thecolbertreport.cc.com/videos/sy1j26/indecision-2010---revenge-of-the-fallen---fearstock-com",
"http://thecolbertreport.cc.com/videos/5qjigz/proposition-19---joseph-califano---gary-johnson",
"http://thecolbertreport.cc.com/videos/rzuziw/donorschoose-org-fear-drawings",
"http://thecolbertreport.cc.com/videos/077dy4/davis-guggenheim",
"http://thecolbertreport.cc.com/videos/th4oe4/sign-off---don-t-go-to-donorschoose-com"
],
"guest": "Davis Guggenheim"
},
{
"date": "2010-10-11",
"videos": [
"http://thecolbertreport.cc.com/videos/mnxgqn/intro---10-11-10",
"http://thecolbertreport.cc.com/videos/2buyr8/rich-iott-wears-a-nazi-uniform",
"http://thecolbertreport.cc.com/videos/f1n1ah/threatdown---muslim-edition",
"http://thecolbertreport.cc.com/videos/6x3w7h/formula-4-your-eyes-only",
"http://thecolbertreport.cc.com/videos/l23gil/robert-reich",
"http://thecolbertreport.cc.com/videos/6314hj/sign-off---stephen-needs-a-place-to-hold-his-march"
],
"guest": "Robert Reich"
},
{
"date": "2010-10-12",
"videos": [
"http://thecolbertreport.cc.com/videos/ksbkyk/intro---10-12-10",
"http://thecolbertreport.cc.com/videos/que3dz/101-year-old-woman-becomes-a-u-s--citizen",
"http://thecolbertreport.cc.com/videos/xpawsw/tip-wag---peabody-public-schools--andy-rooney---ground-zero-mosque-design",
"http://thecolbertreport.cc.com/videos/o656bc/merch-to-keep-fear-alive",
"http://thecolbertreport.cc.com/videos/bncunr/brendan-steinhauser",
"http://thecolbertreport.cc.com/videos/4i1iy2/sign-off---apple-filled-with-razor-blades"
],
"guest": "Brendan Steinhauser"
},
{
"date": "2010-10-13",
"videos": [
"http://thecolbertreport.cc.com/videos/nkf1gw/intro---10-13-10",
"http://thecolbertreport.cc.com/videos/40azz5/america-helps-rescue-chilean-miners",
"http://thecolbertreport.cc.com/videos/fg5dcw/sport-report---steroids--commonwealth-games---brett-favre-s-sexting",
"http://thecolbertreport.cc.com/videos/nq3g54/tax-shelter-skelter",
"http://thecolbertreport.cc.com/videos/ip94pd/austan-goolsbee",
"http://thecolbertreport.cc.com/videos/7n0fzv/sign-off---tic-tac-toe-with-austan-goolsbee"
],
"guest": "Austan Goolsbee"
},
{
"date": "2010-10-14",
"videos": [
"http://thecolbertreport.cc.com/videos/ke3ug4/transitive-property-of-christine-o-donnell",
"http://thecolbertreport.cc.com/videos/jvi6id/people-who-are-destroying-america---landscaping-goats",
"http://thecolbertreport.cc.com/videos/8kgt7i/rally-to-restore-sanity-and-or-fear-chinatown-bus-tickets",
"http://thecolbertreport.cc.com/videos/wc2nwv/bill-bryson",
"http://thecolbertreport.cc.com/videos/ns0u0b/sign-off---oprah-is-wonderful"
],
"guest": "Bill Bryson"
},
{
"date": "2010-10-25",
"videos": [
"http://thecolbertreport.cc.com/videos/ou6z90/indecision-2010---revenge-of-the-fallen---sean-bielat---ken-buck",
"http://thecolbertreport.cc.com/videos/t96zw6/the-word---midterm-erection",
"http://thecolbertreport.cc.com/videos/r3cpem/who-s-honoring-me-now----colbert-nation-five-years-of-excellence-award",
"http://thecolbertreport.cc.com/videos/tx8w6w/nicholas-negroponte",
"http://thecolbertreport.cc.com/videos/hjbcjo/sign-off---fifth-anniversary-portrait"
],
"guest": "Nicholas Negroponte"
},
{
"date": "2010-10-26",
"videos": [
"http://thecolbertreport.cc.com/videos/vtn4dg/intro---10-26-10",
"http://thecolbertreport.cc.com/videos/upm6ow/stephen-appears-in-the-new-york-times-crossword-puzzle",
"http://thecolbertreport.cc.com/videos/rh943m/the-word---invisible-inc-",
"http://thecolbertreport.cc.com/videos/57deny/food-insurance-insurance",
"http://thecolbertreport.cc.com/videos/9dol4n/garry-wills",
"http://thecolbertreport.cc.com/videos/ifnetg/sign-off---stream-elvis-costello-s-national-ransom"
],
"guest": "Gary Wills"
},
{
"date": "2010-10-27",
"videos": [
"http://thecolbertreport.cc.com/videos/qjfe6u/exclusive---have-you-seen-the-ghost-of-jon-",
"http://thecolbertreport.cc.com/videos/iyha0d/intro---10-27-10",
"http://thecolbertreport.cc.com/videos/a393lf/rand-paul-supporter-stomps-on-liberal-activist-s-head",
"http://thecolbertreport.cc.com/videos/ah47vl/indecision-2010---revenge-of-the-fallen---tom-perriello",
"http://thecolbertreport.cc.com/videos/k3z37d/snooki-halloween-costume---spooky-rally-song",
"http://thecolbertreport.cc.com/videos/tmruw9/apolo-ohno",
"http://thecolbertreport.cc.com/videos/g0i5r2/sign-off---2010-election-map-from-denny-s"
],
"guest": "Rep. Tom Perriello, Apolo Anton Ohno"
},
{
"date": "2010-10-28",
"videos": [
"http://thecolbertreport.cc.com/videos/ea746g/the-mcrib-is-back",
"http://thecolbertreport.cc.com/videos/y2nj3n/fear-for-all-pt--1",
"http://thecolbertreport.cc.com/videos/ttx9jf/fear-for-all-pt--2",
"http://thecolbertreport.cc.com/videos/el1mv0/maira-kalman",
"http://thecolbertreport.cc.com/videos/p6c0ah/sign-off---see-you-at-the-rally"
],
"guest": "Maira Kalman"
},
{
"date": "2010-11-01",
"videos": [
"http://thecolbertreport.cc.com/videos/4or1uk/intro---11-1-10",
"http://thecolbertreport.cc.com/videos/pjth2k/a-fond-look-back-at-the-rally",
"http://thecolbertreport.cc.com/videos/6y87u2/midterm-senate-races---nevada--alaska---delaware",
"http://thecolbertreport.cc.com/videos/ghbjcp/hispanic-and-gay-voters-should-stay-at-home",
"http://thecolbertreport.cc.com/videos/r4udbe/jonathan-alter",
"http://thecolbertreport.cc.com/videos/h06l8n/sign-off---don-t-forget-to-vote"
],
"guest": "Jonathan Alter"
},
{
"date": "2010-11-02",
"videos": [
"http://thecolbertreport.cc.com/videos/q6wjad/indecision-2010---intro---11-2-10",
"http://thecolbertreport.cc.com/videos/5y5ul8/indecision-2010---gop-takes-house",
"http://thecolbertreport.cc.com/videos/yubkdk/indecision-2010---david-frum",
"http://thecolbertreport.cc.com/videos/ii11zs/indecision-2010---katrina-vanden-heuvel",
"http://thecolbertreport.cc.com/videos/fpxe9g/indecision-2010---sign-off---election-to-end-all-elections"
],
"guest": "Katrina vanden Heuvel, David Frum"
},
{
"date": "2010-11-03",
"videos": [
"http://thecolbertreport.cc.com/videos/npkdbl/intro---11-3-10",
"http://thecolbertreport.cc.com/videos/dnol9b/we-hardly-better-knew-ye",
"http://thecolbertreport.cc.com/videos/tsa7r8/stephen-colbert-gives-you-props",
"http://thecolbertreport.cc.com/videos/g1n60y/doris-kearns-goodwin",
"http://thecolbertreport.cc.com/videos/0ciqy7/sign-off---smiley-face-balloon"
],
"guest": "Doris Kearns Goodwin"
},
{
"date": "2010-11-04",
"videos": [
"http://thecolbertreport.cc.com/videos/ze4pgk/intro---11-4-10",
"http://thecolbertreport.cc.com/videos/jssup2/spider-man-is-alaska-s-write-in-candidate",
"http://thecolbertreport.cc.com/videos/59l5bf/tip-wag---tsa--bert---dogs",
"http://thecolbertreport.cc.com/videos/px319n/elvis-costello"
],
"guest": "Elvis Costello"
},
{
"date": "2010-11-08",
"videos": [
"http://thecolbertreport.cc.com/videos/bf24qu/one-hour-in-the-future",
"http://thecolbertreport.cc.com/videos/odml1w/the-word---nothingness",
"http://thecolbertreport.cc.com/videos/450kbl/president-obama-s-expensive-trip-to-india",
"http://thecolbertreport.cc.com/videos/itfuo6/reza-aslan",
"http://thecolbertreport.cc.com/videos/flh0gj/sign-off---battleship"
],
"guest": "Reza Aslan"
},
{
"date": "2010-11-09",
"videos": [
"http://thecolbertreport.cc.com/videos/ndicnt/decision-points",
"http://thecolbertreport.cc.com/videos/t6dluv/house-oversight-committee-hearings---abbe-lowell",
"http://thecolbertreport.cc.com/videos/2tsnui/craziest-f--king-thing-i-ve-ever-heard---crab-vending-machines",
"http://thecolbertreport.cc.com/videos/thu56b/cee-lo-green"
],
"guest": "Cee-Lo Green"
},
{
"date": "2010-11-10",
"videos": [
"http://thecolbertreport.cc.com/videos/r8nn6k/michelle-obama-s-embarrassing-handshake",
"http://thecolbertreport.cc.com/videos/h0bv7g/america-s-job-loss---beri-fox",
"http://thecolbertreport.cc.com/videos/qra7vl/statue-of-jesus",
"http://thecolbertreport.cc.com/videos/0cxark/martha-stewart",
"http://thecolbertreport.cc.com/videos/gd9t0s/sign-off---saltine-hors-d-oeuvres"
],
"guest": "Martha Stewart"
},
{
"date": "2010-11-11",
"videos": [
"http://thecolbertreport.cc.com/videos/vavqn0/colbert-platinum---kanye-west---million-dollar-advent-calendar-segment",
"http://thecolbertreport.cc.com/videos/6py8bn/intro---11-11-10",
"http://thecolbertreport.cc.com/videos/6obewf/stephen-absorbs-gene-shalit-s-opinions",
"http://thecolbertreport.cc.com/videos/pigos8/colbert-platinum---kanye-west---million-dollar-advent-calendar",
"http://thecolbertreport.cc.com/videos/8zchd5/stephen-trademarks-dated-catchphrases",
"http://thecolbertreport.cc.com/videos/opi39p/quincy-jones",
"http://thecolbertreport.cc.com/videos/dlv5sb/sign-off---if-it-walks-like-a-duck"
],
"guest": "Quincy Jones"
},
{
"date": "2010-11-15",
"videos": [
"http://thecolbertreport.cc.com/videos/zwpnzb/finding-mr--goodwrench",
"http://thecolbertreport.cc.com/videos/dzeed3/tsa-full-body-scanners---jeffrey-goldberg",
"http://thecolbertreport.cc.com/videos/yi115x/garfield-and-president-obama-s-veterans-day-controversies",
"http://thecolbertreport.cc.com/videos/zgerlg/david-stern",
"http://thecolbertreport.cc.com/videos/f5nt0v/sign-off---garfield-loves-veterans"
],
"guest": "David Stern"
},
{
"date": "2010-11-16",
"videos": [
"http://thecolbertreport.cc.com/videos/a6jx8i/intro---11-16-10",
"http://thecolbertreport.cc.com/videos/r1nlt4/prince-william-proposes-to-kate-middleton",
"http://thecolbertreport.cc.com/videos/6x0tmp/thought-for-food---c-zurrrre--medal-of-hunger-winner---cheesercize",
"http://thecolbertreport.cc.com/videos/5n8eoi/stephen-colbert-s-report",
"http://thecolbertreport.cc.com/videos/brwtip/john-legend"
],
"guest": "John Legend"
},
{
"date": "2010-11-17",
"videos": [
"http://thecolbertreport.cc.com/videos/13lnab/intro---11-17-10",
"http://thecolbertreport.cc.com/videos/bzhpi2/charlie-rangel--you-got-mailed",
"http://thecolbertreport.cc.com/videos/izlih7/old-people-in-space",
"http://thecolbertreport.cc.com/videos/rhup4k/chair-apparent",
"http://thecolbertreport.cc.com/videos/x10udl/ian-frazier",
"http://thecolbertreport.cc.com/videos/iu8jdu/synchronize-watches-to-colbert-time"
],
"guest": "Ian Frazier"
},
{
"date": "2010-11-18",
"videos": [
"http://thecolbertreport.cc.com/videos/rip59b/stephen-pardons-joseph-gobbles",
"http://thecolbertreport.cc.com/videos/6dqu0c/tip-wag---pope-benedict-xvi--trick-play---joseph-gobbles",
"http://thecolbertreport.cc.com/videos/fbks4j/joseph-gobbles-shoots-jay-the-intern",
"http://thecolbertreport.cc.com/videos/9ldbp0/salvatore-giunta",
"http://thecolbertreport.cc.com/videos/92wwov/sign-off---happy-thanksgiving"
],
"guest": "Staff Sgt. Salvatore Giunta"
},
{
"date": "2010-11-29",
"videos": [
"http://thecolbertreport.cc.com/videos/fyh8jk/intro---11-29-10",
"http://thecolbertreport.cc.com/videos/5liwl3/black-friday-interpretation",
"http://thecolbertreport.cc.com/videos/qhebrf/better-business-hero",
"http://thecolbertreport.cc.com/videos/1fhpey/dan-savage",
"http://thecolbertreport.cc.com/videos/nilxac/sign-off---goodnight"
],
"guest": "Dan Savage"
},
{
"date": "2010-11-30",
"videos": [
"http://thecolbertreport.cc.com/videos/0th7i0/god-drops-steve-johnson-s-football-pass",
"http://thecolbertreport.cc.com/videos/rd3bzl/wikileaks-document-dump---james-rubin",
"http://thecolbertreport.cc.com/videos/t2kayc/soap-opera-product-placement",
"http://thecolbertreport.cc.com/videos/5qjkay/tom-vilsack",
"http://thecolbertreport.cc.com/videos/ovt98b/sign-off---chex-mix-product-placement"
],
"guest": "Tom Vilsack"
},
{
"date": "2010-12-01",
"videos": [
"http://thecolbertreport.cc.com/videos/373wri/return-of-the-estate-tax",
"http://thecolbertreport.cc.com/videos/hml13u/lame-duck-congress---jake-tapper",
"http://thecolbertreport.cc.com/videos/df8z4y/cheating-death---calming-meat-goggles---the-ithrone",
"http://thecolbertreport.cc.com/videos/hbifbv/michelle-rhee",
"http://thecolbertreport.cc.com/videos/5oq9dq/sign-off---up-on-the-lingo"
],
"guest": "Michelle Rhee"
},
{
"date": "2010-12-02",
"videos": [
"http://thecolbertreport.cc.com/videos/d067b7/intro---12-2-10",
"http://thecolbertreport.cc.com/videos/y4fa8v/john-thune-looks-presidential",
"http://thecolbertreport.cc.com/videos/vaqkqk/the-word---the-great-white-wail",
"http://thecolbertreport.cc.com/videos/efh5u1/the-blitzkrieg-on-grinchitude---atheist-billboard---capitol-christmas-tree",
"http://thecolbertreport.cc.com/videos/trmu6j/david-stockman",
"http://thecolbertreport.cc.com/videos/v9n94y/sign-off---chinese-finger-trap"
],
"guest": "David Stockman"
},
{
"date": "2010-12-06",
"videos": [
"http://thecolbertreport.cc.com/videos/exzvsm/cosmo-is-available-in-mongolia",
"http://thecolbertreport.cc.com/videos/bwubcy/the-word---unrequited-gov",
"http://thecolbertreport.cc.com/videos/eoidl7/mysteries-of-the-ancient-unknown---the-pursuit-of-the-pharaoh-s-phallus-pt--1",
"http://thecolbertreport.cc.com/videos/wdodc8/garry-trudeau",
"http://thecolbertreport.cc.com/videos/gktluk/sign-off---goodnight"
],
"guest": "Garry Trudeau"
},
{
"date": "2010-12-07",
"videos": [
"http://thecolbertreport.cc.com/videos/ishllr/extension-of-the-bush-tax-cuts",
"http://thecolbertreport.cc.com/videos/n0u86v/mysteries-of-the-ancient-unknown---the-pursuit-of-the-pharaoh-s-phallus-pt--2",
"http://thecolbertreport.cc.com/videos/ya6qw9/poll-to-repeal-don-t-ask--don-t-tell",
"http://thecolbertreport.cc.com/videos/gf8r28/david-eisenhower---julie-nixon-eisenhower",
"http://thecolbertreport.cc.com/videos/99syt9/sign-off---goodnight"
],
"guest": "Julie Nixon Eisenhower & David Eisenhower"
},
{
"date": "2010-12-08",
"videos": [
"http://thecolbertreport.cc.com/videos/f6likw/exclusive---steve-martin-extended-segment",
"http://thecolbertreport.cc.com/videos/kml8x8/tip-wag---art-edition---brent-glass",
"http://thecolbertreport.cc.com/videos/2akwcg/steve-martin-pt--1",
"http://thecolbertreport.cc.com/videos/yqcbtk/steve-martin-pt--2",
"http://thecolbertreport.cc.com/videos/ct0ud7/sign-off---steve-martin-mask"
],
"guest": "Steve Martin"
},
{
"date": "2010-12-09",
"videos": [
"http://thecolbertreport.cc.com/videos/znivka/israel-shark-conspiracy",
"http://thecolbertreport.cc.com/videos/fi19uy/international-manhunt-for-julian-assange---daniel-ellsberg",
"http://thecolbertreport.cc.com/videos/fk2pnu/art-stephen-up-challenge---william-wegman",
"http://thecolbertreport.cc.com/videos/1akto9/julie-taymor",
"http://thecolbertreport.cc.com/videos/hcd55s/sign-off---christmas-party"
],
"guest": "Julie Taymor"
},
{
"date": "2010-12-13",
"videos": [
"http://thecolbertreport.cc.com/videos/f2kl6o/intro---12-13-10",
"http://thecolbertreport.cc.com/videos/eolk50/found-goldman-sachs-mastercard",
"http://thecolbertreport.cc.com/videos/c1yv8b/the-word---swift-payment",
"http://thecolbertreport.cc.com/videos/btsd4o/blitzkrieg-on-grinchitude---gretchen-carlson---christian-nation-christ-mas-tree",
"http://thecolbertreport.cc.com/videos/rufuhr/patti-smith",
"http://thecolbertreport.cc.com/videos/t0590z/sign-off---remembering-richard-holbrooke"
],
"guest": "Patti Smith"
},
{
"date": "2010-12-14",
"videos": [
"http://thecolbertreport.cc.com/videos/ycermm/goldman-sachs-lawyers-want-buckley-t--ratchford-s-card-back",
"http://thecolbertreport.cc.com/videos/rsdutw/prop-8-challenge---david-boies",
"http://thecolbertreport.cc.com/videos/4tx5ks/stephen-wins-twitter---biz-stone",
"http://thecolbertreport.cc.com/videos/ouqrnm/stephen-sondheim",
"http://thecolbertreport.cc.com/videos/ajg2h0/sign-off---closing-credits"
],
"guest": "David Boies, Stephen Sondheim"
},
{
"date": "2010-12-15",
"videos": [
"http://thecolbertreport.cc.com/videos/9gi4ae/intro---12-15-10",
"http://thecolbertreport.cc.com/videos/67nfxh/scanner-defying-pancakes",
"http://thecolbertreport.cc.com/videos/fv3gl9/world-war-3-0---omar-wasow",
"http://thecolbertreport.cc.com/videos/rr8wvk/tiny-triumphs---lethal-drug-shortage",
"http://thecolbertreport.cc.com/videos/e05lny/laird-hamilton",
"http://thecolbertreport.cc.com/videos/nv267b/sign-off---winter-fashion-tip"
],
"guest": "Omar Wasow, Laird Hamilton"
},
{
"date": "2010-12-16",
"videos": [
"http://thecolbertreport.cc.com/videos/cb861t/christmas-holy-week",
"http://thecolbertreport.cc.com/videos/m38gcf/jesus-is-a-liberal-democrat",
"http://thecolbertreport.cc.com/videos/tvxon5/amy-sedaris",
"http://thecolbertreport.cc.com/videos/zejxdk/paul-simon"
],
"guest": "Amy Sedaris, Paul Simon"
}
],
"2011": [
{
"date": "2011-01-03",
"videos": [
"http://thecolbertreport.cc.com/videos/a5rzlq/intro---1-3-11",
"http://thecolbertreport.cc.com/videos/pgayak/snowpocalypse-2010",
"http://thecolbertreport.cc.com/videos/7b084t/tip-wag---susan-g--komen-foundation---spider-man-musical",
"http://thecolbertreport.cc.com/videos/44ybv8/the-enemy-within---caboodle-ranch",
"http://thecolbertreport.cc.com/videos/vopb2f/ed-rendell",
"http://thecolbertreport.cc.com/videos/bvg4tu/sign-off---home-improvement-tip"
],
"guest": "Sen. Bernie Sanders"
},
{
"date": "2011-01-04",
"videos": [
"http://thecolbertreport.cc.com/videos/40y983/intro---1-4-11",
"http://thecolbertreport.cc.com/videos/tq4xo3/native-american-overlords",
"http://thecolbertreport.cc.com/videos/kafccc/gold-faithful",
"http://thecolbertreport.cc.com/videos/0ds0c9/gold-faithful---ron-paul---david-leonhardt",
"http://thecolbertreport.cc.com/videos/leatvt/geoffrey-canada",
"http://thecolbertreport.cc.com/videos/h983ts/sign-off---12-dutchmen-answer"
],
"guest": "John Heilemann"
},
{
"date": "2011-01-05",
"videos": [
"http://thecolbertreport.cc.com/videos/upvgg0/intro---1-5-11",
"http://thecolbertreport.cc.com/videos/ttqn4k/huckleberry-finn-censorship",
"http://thecolbertreport.cc.com/videos/4c01zx/what-s-a-reince-priebus-",
"http://thecolbertreport.cc.com/videos/d2586v/yellowline-international--inc-",
"http://thecolbertreport.cc.com/videos/1yfs5a/atul-gawande",
"http://thecolbertreport.cc.com/videos/ta25ww/sign-off---dark-side-of-the-moon"
],
"guest": "Steve Case"
},
{
"date": "2011-01-06",
"videos": [
"http://thecolbertreport.cc.com/videos/gfffz6/shout-out-to-arby-s",
"http://thecolbertreport.cc.com/videos/g7dtso/john-boehner-s-large-gavel",
"http://thecolbertreport.cc.com/videos/t27er5/cheating-death---placebo-effect--immortality---wild-lynx",
"http://thecolbertreport.cc.com/videos/n6wqjn/bill-o-reilly-proves-god-s-existence---neil-degrasse-tyson",
"http://thecolbertreport.cc.com/videos/i48v1q/ronald-depinho",
"http://thecolbertreport.cc.com/videos/x8bqqt/sign-off---boris-the-lynx"
],
"guest": "Dr. Ronald DePinho"
},
{
"date": "2011-01-10",
"videos": [
"http://thecolbertreport.cc.com/videos/qi5a0o/intro---1-10-11",
"http://thecolbertreport.cc.com/videos/xl3r2n/pundits-lay-blame-for-senseless-arizona-attack",
"http://thecolbertreport.cc.com/videos/6s01yh/bull-sessions",
"http://thecolbertreport.cc.com/videos/cng4n9/difference-makers---galactic-edition-pt--1",
"http://thecolbertreport.cc.com/videos/oelxfx/difference-makers---galactic-edition-pt--2",
"http://thecolbertreport.cc.com/videos/gk32r8/fen-montaigne",
"http://thecolbertreport.cc.com/videos/oslcyl/sign-off---goodnight"
],
"guest": "Fen Montaigne"
},
{
"date": "2011-01-11",
"videos": [
"http://thecolbertreport.cc.com/videos/97pzie/intro---1-11-11",
"http://thecolbertreport.cc.com/videos/q63emf/snowstorm-preparation",
"http://thecolbertreport.cc.com/videos/rbg8gh/metunes---grammy-vote---dan-auerbach--patrick-carney---ezra-koenig",
"http://thecolbertreport.cc.com/videos/oqami3/lithuania-perfume",
"http://thecolbertreport.cc.com/videos/mqh8rb/chris-hughes",
"http://thecolbertreport.cc.com/videos/8re8oa/sign-off---pringles"
],
"guest": "Chris Hughes"
},
{
"date": "2011-01-12",
"videos": [
"http://thecolbertreport.cc.com/videos/1aza8n/50-cent-makes-money-on-twitter",
"http://thecolbertreport.cc.com/videos/b4mxvn/the-word---life--liberty-and-the-pursuit-of-angriness",
"http://thecolbertreport.cc.com/videos/56kjjw/bernard-henri-levy-pt--1",
"http://thecolbertreport.cc.com/videos/cmxyxs/bernard-henri-levy-pt--2",
"http://thecolbertreport.cc.com/videos/splrfl/sign-off---goodnight"
],
"guest": "Bernard-Henri Levy"
},
{
"date": "2011-01-13",
"videos": [
"http://thecolbertreport.cc.com/videos/h5qwzv/hitler-s-inspiring-tucson-memorial-speech",
"http://thecolbertreport.cc.com/videos/nhx7bu/thought-for-food---fruit-pouch--doritos-ad---super-big-gulp",
"http://thecolbertreport.cc.com/videos/wdqdqn/israeli-vulture-spy",
"http://thecolbertreport.cc.com/videos/xczq8w/kevin-spacey",
"http://thecolbertreport.cc.com/videos/iyyhr8/sign-off---new-york-post"
],
"guest": "Kevin Spacey"
},
{
"date": "2011-01-17",
"videos": [
"http://thecolbertreport.cc.com/videos/iuhos5/intro---1-17-11",
"http://thecolbertreport.cc.com/videos/ztaz7m/martin-luther-king-jr--day-sales",
"http://thecolbertreport.cc.com/videos/9ycstf/the-word---run-for-your-life",
"http://thecolbertreport.cc.com/videos/ib4cpu/art-stephen-up-challenge---wade-hampton",
"http://thecolbertreport.cc.com/videos/kd5rmr/sherry-turkle",
"http://thecolbertreport.cc.com/videos/tj76rr/sign-off---new-york-post"
],
"guest": "Sherry Turkle"
},
{
"date": "2011-01-18",
"videos": [
"http://thecolbertreport.cc.com/videos/fi5nk7/intro---1-18-11",
"http://thecolbertreport.cc.com/videos/y6lk8z/mika-brzezinski-experiences-palin-fatigue",
"http://thecolbertreport.cc.com/videos/1zj4bl/the-word---disintegration",
"http://thecolbertreport.cc.com/videos/l4vdiw/coma-cozy",
"http://thecolbertreport.cc.com/videos/zeukt7/cornel-west",
"http://thecolbertreport.cc.com/videos/njlf77/sign-off---coma-cozy"
],
"guest": "Cornel West"
},
{
"date": "2011-01-19",
"videos": [
"http://thecolbertreport.cc.com/videos/4e1xmn/intro---1-19-11",
"http://thecolbertreport.cc.com/videos/0s8rfq/black-tie-dinner-for-hu-jintao",
"http://thecolbertreport.cc.com/videos/nujiex/tip-wag---four-loko---horoscopes",
"http://thecolbertreport.cc.com/videos/vb8d7c/shout-out---preston-pysh",
"http://thecolbertreport.cc.com/videos/czmy3b/ron-reagan",
"http://thecolbertreport.cc.com/videos/0ycmn7/sign-off---i-eat-america--and-so-can-you---recall"
],
"guest": "Ron Reagan Jr."
},
{
"date": "2011-01-20",
"videos": [
"http://thecolbertreport.cc.com/videos/091ydv/rush-limbaugh-speaks-chinese",
"http://thecolbertreport.cc.com/videos/bq6mnl/state-budget-shortfalls---christine-todd-whitman",
"http://thecolbertreport.cc.com/videos/c8u4qm/50th-anniversary-of-jfk-s-inaugural-address",
"http://thecolbertreport.cc.com/videos/6pfgfg/chris-matthews",
"http://thecolbertreport.cc.com/videos/jjup5d/sign-off---donald-pellview"
],
"guest": "Chris Matthews"
},
{
"date": "2011-01-24",
"videos": [
"http://thecolbertreport.cc.com/videos/z2h5xs/intro---1-24-11",
"http://thecolbertreport.cc.com/videos/ry0uh0/stephen-rejects-keith-olbermann-s-power",
"http://thecolbertreport.cc.com/videos/e7bfej/the-word---coverage-of-denial",
"http://thecolbertreport.cc.com/videos/mjnoqk/art-stephen-up-challenge---banksy",
"http://thecolbertreport.cc.com/videos/rsyf0v/charlie-rose",
"http://thecolbertreport.cc.com/videos/v0sh08/sign-off---keith-olbermug"
],
"guest": "Charlie Rose"
},
{
"date": "2011-01-25",
"videos": [
"http://thecolbertreport.cc.com/videos/1mhey7/intro---1-25-11",
"http://thecolbertreport.cc.com/videos/d21szi/the--battle-hymn-of-the-tiger-mother--controversy",
"http://thecolbertreport.cc.com/videos/5198pt/threatdown---radical-muslim-snacks--flying-robot-drones---coked-up-vacuums",
"http://thecolbertreport.cc.com/videos/ooebba/nazi-ometer",
"http://thecolbertreport.cc.com/videos/2lr90o/amy-chua",
"http://thecolbertreport.cc.com/videos/71c1bx/sign-off---stephen-welcomes-cody-price"
],
"guest": "Amy Chua"
},
{
"date": "2011-01-26",
"videos": [
"http://thecolbertreport.cc.com/videos/99necf/anonymous-insider-author-speculation",
"http://thecolbertreport.cc.com/videos/d2sy94/obama-s-state-of-the-union-address---michael-waldman",
"http://thecolbertreport.cc.com/videos/za0351/mr--smith-goes-to-the-state-legislature--then-later-possibly-washington---curtis-oda",
"http://thecolbertreport.cc.com/videos/wja66h/christine-yvette-lewis",
"http://thecolbertreport.cc.com/videos/7znx6n/sign-off---man-handler---fork-phone"
],
"guest": "Michael Waldman, Christine Yvette Lewis"
},
{
"date": "2011-01-27",
"videos": [
"http://thecolbertreport.cc.com/videos/fllqqg/intro---1-27-11",
"http://thecolbertreport.cc.com/videos/959fok/candyquake",
"http://thecolbertreport.cc.com/videos/bhf8jv/time-traveling-porn---daryl-bem",
"http://thecolbertreport.cc.com/videos/uffqf8/gordita-supreme-court",
"http://thecolbertreport.cc.com/videos/zgxlja/brian-greene",
"http://thecolbertreport.cc.com/videos/nkbrns/sign-off---goodnight"
],
"guest": "Dr. Daryl Bem, Brian Greene"
},
{
"date": "2011-01-31",
"videos": [
"http://thecolbertreport.cc.com/videos/2wwddt/intro---1-31-11",
"http://thecolbertreport.cc.com/videos/uv1y3k/mubarak--mu-problems",
"http://thecolbertreport.cc.com/videos/w70tw3/mubarak--mu-problems---samer-shehata",
"http://thecolbertreport.cc.com/videos/35ink0/paul-offit",
"http://thecolbertreport.cc.com/videos/ccilnn/sign-off---kim-jong-bear"
],
"guest": "Samer Shehata, Dr. Paul Offit"
},
{
"date": "2011-02-01",
"videos": [
"http://thecolbertreport.cc.com/videos/wk9d57/hosni-mubarak-will-not-run-again",
"http://thecolbertreport.cc.com/videos/ie8q6j/thought-for-food---nestle-corporation",
"http://thecolbertreport.cc.com/videos/2ucxw7/thought-for-food---wyngz---wal-mart",
"http://thecolbertreport.cc.com/videos/odeko3/wal-mart-collaborates-with-obama-administration---leslie-dach",
"http://thecolbertreport.cc.com/videos/4shxg7/michael-lewis",
"http://thecolbertreport.cc.com/videos/s7oggh/sign-off---digiorno-pizza---boneless-wyngz"
],
"guest": "Leslie Dach, Michael Lewis"
},
{
"date": "2011-02-02",
"videos": [
"http://thecolbertreport.cc.com/videos/zdhdko/intro---2-2-11",
"http://thecolbertreport.cc.com/videos/ct2jwf/bing-gets-served",
"http://thecolbertreport.cc.com/videos/a4bw27/cairo-turns-into-the-jersey-shore",
"http://thecolbertreport.cc.com/videos/q27618/crisis-in-egypt",
"http://thecolbertreport.cc.com/videos/yjimo0/tip-wag---british-superman---big-flats-beer",
"http://thecolbertreport.cc.com/videos/dme3nu/sean-dorrance-kelly",
"http://thecolbertreport.cc.com/videos/n2upjg/sign-off---christiane-aman-purr---big-flats-beer"
],
"guest": "Sean Kelly"
},
{
"date": "2011-02-03",
"videos": [
"http://thecolbertreport.cc.com/videos/nn8o94/intro---2-3-11",
"http://thecolbertreport.cc.com/videos/lo20rh/crisis-in-egypt---anderson-cooper---bill-o-reilly",
"http://thecolbertreport.cc.com/videos/vuogyk/sport-report---super-bowl-edition",
"http://thecolbertreport.cc.com/videos/91t3tp/affirmative-reaction",
"http://thecolbertreport.cc.com/videos/i5rwqs/jane-mcgonigal",
"http://thecolbertreport.cc.com/videos/hffd6m/sign-off---newest-member-of-the-colbert-nation"
],
"guest": "Jane McGonigal"
},
{
"date": "2011-02-14",
"videos": [
"http://thecolbertreport.cc.com/videos/kruhy0/intro---2-14-11",
"http://thecolbertreport.cc.com/videos/4drnjr/mysteries-of-the-ancient-unknown---egyptian-coincidence",
"http://thecolbertreport.cc.com/videos/gv0hvh/the-enemy-within---toddler-edition",
"http://thecolbertreport.cc.com/videos/qtecuk/james-murphy-of-lcd-soundsystem",
"http://thecolbertreport.cc.com/videos/4qawhf/sign-off---scoops-of-americone-dream"
],
"guest": "LCD Soundsystem"
},
{
"date": "2011-02-15",
"videos": [
"http://thecolbertreport.cc.com/videos/ynf8rd/intro---2-15-11",
"http://thecolbertreport.cc.com/videos/sjuyr9/italian-bunga-bunga-parties---egyptian-democracy",
"http://thecolbertreport.cc.com/videos/ara6q6/egyptian-democracy---christiane-amanpour",
"http://thecolbertreport.cc.com/videos/n9a7wj/mr--smith-goes-to-the-state-legislature--then-later-possibly-washington---ron-gould",
"http://thecolbertreport.cc.com/videos/uobmig/david-albright",
"http://thecolbertreport.cc.com/videos/95itm9/sign-off---christiane-aman-purr-s-safari-suit"
],
"guest": "Christiane Amanpour, David Albright"
},
{
"date": "2011-02-16",
"videos": [
"http://thecolbertreport.cc.com/videos/bbqm6g/intro---2-16-11",
"http://thecolbertreport.cc.com/videos/bojft9/republican-voters-doubt-obama-s-american-citizenship",
"http://thecolbertreport.cc.com/videos/uk8a3q/tip-wag---colbuffington-re-post--repo-games---whale-fail",
"http://thecolbertreport.cc.com/videos/8r9j45/murdoch-he-wrote",
"http://thecolbertreport.cc.com/videos/re8ih2/eric-foner",
"http://thecolbertreport.cc.com/videos/i84xxd/sign-off---general-butterbean"
],
"guest": "Eric Foner"
},
{
"date": "2011-02-17",
"videos": [
"http://thecolbertreport.cc.com/videos/62enfw/the-huffington-post-posts-about-the-colbuffington-re-post",
"http://thecolbertreport.cc.com/videos/yjsn8n/clarence-thomas-s-financial-disclosure-controversy",
"http://thecolbertreport.cc.com/videos/tvwda6/project-magazine-cover-boy",
"http://thecolbertreport.cc.com/videos/sjlg3t/jeffrey-leonard",
"http://thecolbertreport.cc.com/videos/m0qkxm/sign-off---project-magazine-cover"
],
"guest": "Jeffrey Leonard"
},
{
"date": "2011-02-21",
"videos": [
"http://thecolbertreport.cc.com/videos/86hqgf/turmoil-in-the-middle-east---turmoil-in-the-middle-west",
"http://thecolbertreport.cc.com/videos/lp0v0e/cheating-death---ablibalify---bing-bongavax",
"http://thecolbertreport.cc.com/videos/fwkicl/rick-santorum-internet-search",
"http://thecolbertreport.cc.com/videos/8du0y6/eugene-jarecki",
"http://thecolbertreport.cc.com/videos/58iq33/sign-off---goodnight"
],
"guest": "Eugene Jarecki"
},
{
"date": "2011-02-22",
"videos": [
"http://thecolbertreport.cc.com/videos/bqnw4a/intro---2-22-11",
"http://thecolbertreport.cc.com/videos/bm2a1j/a-less-perfect-union",
"http://thecolbertreport.cc.com/videos/usnwve/a-less-perfect-union---randi-weingarten",
"http://thecolbertreport.cc.com/videos/f6avpd/wisco-inferno---jon-erpenbach",
"http://thecolbertreport.cc.com/videos/p92sec/bing-west",
"http://thecolbertreport.cc.com/videos/2kp9tj/sign-off---democrat-call"
],
"guest": "Randi Weingarten, Bing West"
},
{
"date": "2011-02-23",
"videos": [
"http://thecolbertreport.cc.com/videos/pd1kio/intro---2-23-11",
"http://thecolbertreport.cc.com/videos/883h13/usa-today-infographic-sells-out",
"http://thecolbertreport.cc.com/videos/fn2n7y/bust-in-show",
"http://thecolbertreport.cc.com/videos/tnaq8e/nailed--em---mark-burdett",
"http://thecolbertreport.cc.com/videos/iap6wk/stephanie-coontz",
"http://thecolbertreport.cc.com/videos/uyxtz0/sign-off---rebroadcasts"
],
"guest": "Stephanie Coontz"
},
{
"date": "2011-02-24",
"videos": [
"http://thecolbertreport.cc.com/videos/7a9kp1/era-of-american-dental-exceptionalism-is-over",
"http://thecolbertreport.cc.com/videos/xjtazd/corporate-hacker-tries-to-take-down-wikileaks",
"http://thecolbertreport.cc.com/videos/8jruu4/corporate-hacker-tries-to-take-down-wikileaks---glenn-greenwald",
"http://thecolbertreport.cc.com/videos/tyiacl/republicans-flirt-with-presidential-candidacy",
"http://thecolbertreport.cc.com/videos/hxtqey/mike-huckabee",
"http://thecolbertreport.cc.com/videos/6ahql2/sign-off---elephant-beat"
],
"guest": "Glenn Greenwald, Mike Huckabee"
},
{
"date": "2011-02-28",
"videos": [
"http://thecolbertreport.cc.com/videos/8jxxuv/intro---2-28-11",
"http://thecolbertreport.cc.com/videos/8fpe6c/anonymous-hacks-the-colbert-report",
"http://thecolbertreport.cc.com/videos/ohhby5/tip-wag---joe-reed---levi-s-ex-girlfriend-jeans",
"http://thecolbertreport.cc.com/videos/lrah7j/art-stephen-up-challenge---phillips-de-pury-auction",
"http://thecolbertreport.cc.com/videos/4oq5za/michael-scheuer",
"http://thecolbertreport.cc.com/videos/qg45nm/sign-off---tomorrow-s-goodnight-preview"
],
"guest": "Michael Scheuer"
},
{
"date": "2011-03-01",
"videos": [
"http://thecolbertreport.cc.com/videos/dbc523/intro---3-1-11",
"http://thecolbertreport.cc.com/videos/hl74h7/muammar-al-gaddafi-competes-with-charlie-sheen",
"http://thecolbertreport.cc.com/videos/ce6ez1/the-word---new-country-for-old-men",
"http://thecolbertreport.cc.com/videos/6zdcls/senior-moment---geriatric-porn",
"http://thecolbertreport.cc.com/videos/zxzpiz/evan-osnos",
"http://thecolbertreport.cc.com/videos/b6gm2j/sign-off---welcome-zachary-paul-dahm"
],
"guest": "Evan Osnos"
},
{
"date": "2011-03-02",
"videos": [
"http://thecolbertreport.cc.com/videos/44fqvj/intro---3-2-11",
"http://thecolbertreport.cc.com/videos/jh2tli/wisconsin-prank-call-bill",
"http://thecolbertreport.cc.com/videos/i9x3xr/the-word---economic-boom",
"http://thecolbertreport.cc.com/videos/uz0ktw/eulogy-spot",
"http://thecolbertreport.cc.com/videos/7lrvtf/harry-connick-jr-",
"http://thecolbertreport.cc.com/videos/ninj2e/sign-off---demise-of-the-white-pages"
],
"guest": "Harry Connick Jr."
},
{
"date": "2011-03-03",
"videos": [
"http://thecolbertreport.cc.com/videos/nb3zpi/fox-news-suspends-contributors",
"http://thecolbertreport.cc.com/videos/7vwzpc/ice-cream-fight-with-jimmy-fallon",
"http://thecolbertreport.cc.com/videos/4oi0dh/ice-cream-hallucination-with-jimmy-fallon",
"http://thecolbertreport.cc.com/videos/zxu7kb/mark-moffett",
"http://thecolbertreport.cc.com/videos/2x8ter/sign-off---late-night-snack"
],
"guest": "Mark W. Moffett"
},
{
"date": "2011-03-07",
"videos": [
"http://thecolbertreport.cc.com/videos/432mwn/intro---3-7-11",
"http://thecolbertreport.cc.com/videos/dmu7rh/stephen-wants-an-ipad-2",
"http://thecolbertreport.cc.com/videos/zql2lp/on-notice---mike-huckabee",
"http://thecolbertreport.cc.com/videos/mrhaui/america-s-next-gop-model",
"http://thecolbertreport.cc.com/videos/ux0w7b/joshua-foer",
"http://thecolbertreport.cc.com/videos/un3kdu/art-stephen-up-challenge---bid-on-stephen-s-portrait"
],
"guest": "Joshua Foer"
},
{
"date": "2011-03-08",
"videos": [
"http://thecolbertreport.cc.com/videos/2s9pic/happy-mardi-gras---international-women-s-day",
"http://thecolbertreport.cc.com/videos/29cv4a/light-bulb-ban",
"http://thecolbertreport.cc.com/videos/yuo5to/light-bulb-ban---dale-bryk",
"http://thecolbertreport.cc.com/videos/2nv2ie/charlie-sheen---fake-rahm-emanuel-on-twitter",
"http://thecolbertreport.cc.com/videos/dqh7vp/dan-sinker",
"http://thecolbertreport.cc.com/videos/wjd0wx/sign-off---welcome-zoe-simone-sanchez"
],
"guest": "Dan Sinker"
},
{
"date": "2011-03-09",
"videos": [
"http://thecolbertreport.cc.com/videos/oivxm4/intro---3-9-11",
"http://thecolbertreport.cc.com/videos/durtx6/stephen-gives-up-catholicism-for-lent",
"http://thecolbertreport.cc.com/videos/c3zm6w/bench-press",
"http://thecolbertreport.cc.com/videos/qi1r7y/bench-press---anthony-weiner",
"http://thecolbertreport.cc.com/videos/mbmsxi/david-brooks",
"http://thecolbertreport.cc.com/videos/bh348l/sign-off---jewish-stephen"
],
"guest": "David Brooks"
},
{
"date": "2011-03-10",
"videos": [
"http://thecolbertreport.cc.com/videos/au4itm/intro---3-10-11",
"http://thecolbertreport.cc.com/videos/w8nzdj/newt-gingrich-wants-to-screw-america",
"http://thecolbertreport.cc.com/videos/hagj8b/colbert-pac-ad",
"http://thecolbertreport.cc.com/videos/k698u1/peter-king-understands-violent-radicalism",
"http://thecolbertreport.cc.com/videos/84jg83/reza-aslan",
"http://thecolbertreport.cc.com/videos/x9iaae/sign-off---enjoy-the-moment"
],
"guest": "Reza Aslan"
},
{
"date": "2011-03-21",
"videos": [
"http://thecolbertreport.cc.com/videos/tkzzdn/intro---3-21-11",
"http://thecolbertreport.cc.com/videos/btot11/crisis-in-the-middle-everywhere---japan---libya",
"http://thecolbertreport.cc.com/videos/kvj8rv/raging-art-on---art-1",
"http://thecolbertreport.cc.com/videos/9m4lpg/sign-off---dueling-banjos"
],
"guest": "Steve Martin and the Steep Canyon Rangers"
},
{
"date": "2011-03-22",
"videos": [
"http://thecolbertreport.cc.com/videos/67fxmc/intro---3-22-11",
"http://thecolbertreport.cc.com/videos/4k1vs5/californians-respond-to-japanese-disaster",
"http://thecolbertreport.cc.com/videos/tadiop/raging-art-on---art-2",
"http://thecolbertreport.cc.com/videos/7fv2d8/crisis-in-the-middle-everywhere---cnn-and-fox-news-fight-in-libya",
"http://thecolbertreport.cc.com/videos/iky4d9/ayman-mohyeldin",
"http://thecolbertreport.cc.com/videos/f8fwxt/sign-off---goodnight"
],
"guest": "Ayman Mohyeldin"
},
{
"date": "2011-03-23",
"videos": [
"http://thecolbertreport.cc.com/videos/m2qxvd/top-news-stories-all-at-once",
"http://thecolbertreport.cc.com/videos/3rhe0w/raging-art-on---art-3",
"http://thecolbertreport.cc.com/videos/3ccbj2/the-word---over-reactor",
"http://thecolbertreport.cc.com/videos/wd1pjd/nathan-myhrvold",
"http://thecolbertreport.cc.com/videos/l5f2yi/sign-off---pistachio-ice-cream"
],
"guest": "Nathan Myhrvold"
},
{
"date": "2011-03-24",
"videos": [
"http://thecolbertreport.cc.com/videos/awwa6r/intro---3-24-11",
"http://thecolbertreport.cc.com/videos/o0idw2/bears---balls---misery-edition",
"http://thecolbertreport.cc.com/videos/pst3ox/eat--pray-to-eat---laurie-garrett",
"http://thecolbertreport.cc.com/videos/strtop/channeled-rage",
"http://thecolbertreport.cc.com/videos/rfce7l/jody-williams",
"http://thecolbertreport.cc.com/videos/3z7nhm/sign-off---john-oliver-s-new-york-stand-up-show"
],
"guest": "Jody Williams"
},
{
"date": "2011-03-28",
"videos": [
"http://thecolbertreport.cc.com/videos/2u3wdk/intro---3-28-11",
"http://thecolbertreport.cc.com/videos/vou6it/shout-out-to-cece-lederer",
"http://thecolbertreport.cc.com/videos/xeu06g/chaos-in-chaonada",
"http://thecolbertreport.cc.com/videos/s3xgtv/tip-wag---cigarette-tax--abortion-waiting-period---bargain-travelers",
"http://thecolbertreport.cc.com/videos/c06ht5/maine-squeeze",
"http://thecolbertreport.cc.com/videos/2p412b/michael-moore",
"http://thecolbertreport.cc.com/videos/lplrhl/sign-off---movits--streams--out-of-my-head-"
],
"guest": "Michael Moore"
},
{
"date": "2011-03-29",
"videos": [
"http://thecolbertreport.cc.com/videos/xysvku/intro---3-29-11",
"http://thecolbertreport.cc.com/videos/wtajtw/turd-sandwich-in-libya",
"http://thecolbertreport.cc.com/videos/fkwv1e/yahweh-or-no-way---christianity-is-fattening",
"http://thecolbertreport.cc.com/videos/oa9b4m/stephen-s-next-religion---stephen-prothero",
"http://thecolbertreport.cc.com/videos/730dpm/jimmy-fallon-promises-a-performance-by-stephen",
"http://thecolbertreport.cc.com/videos/7m3guo/anthony-fauci",
"http://thecolbertreport.cc.com/videos/ms1yr8/sign-off---do-not-help-jimmy-fallon"
],
"guest": "Dr. Anthony Fauci"
},
{
"date": "2011-03-30",
"videos": [
"http://thecolbertreport.cc.com/videos/6nwkpk/exclusive---reporter-gets-nailed-by-san-francisco-cop",
"http://thecolbertreport.cc.com/videos/xysvku/intro---3-29-11",
"http://thecolbertreport.cc.com/videos/wtajtw/turd-sandwich-in-libya",
"http://thecolbertreport.cc.com/videos/fkwv1e/yahweh-or-no-way---christianity-is-fattening",
"http://thecolbertreport.cc.com/videos/oa9b4m/stephen-s-next-religion---stephen-prothero",
"http://thecolbertreport.cc.com/videos/730dpm/jimmy-fallon-promises-a-performance-by-stephen",
"http://thecolbertreport.cc.com/videos/7m3guo/anthony-fauci",
"http://thecolbertreport.cc.com/videos/ms1yr8/sign-off---do-not-help-jimmy-fallon"
],
"guest": "Tim Shriver"
},
{
"date": "2011-03-30",
"videos": [
"http://thecolbertreport.cc.com/videos/zxtidm/james-o-keefe-asks-for-donations",
"http://thecolbertreport.cc.com/videos/8stgre/colbert-pac",
"http://thecolbertreport.cc.com/videos/dtl1ew/colbert-pac---trevor-potter",
"http://thecolbertreport.cc.com/videos/i3lpcq/stephen-practices-rebecca-black-s--friday-",
"http://thecolbertreport.cc.com/videos/wug1p5/tim-shriver",
"http://thecolbertreport.cc.com/videos/dwx5m0/sign-off---goodnight"
],
"guest": "Tim Shriver"
},
{
"date": "2011-03-31",
"videos": [
"http://thecolbertreport.cc.com/videos/a6ko78/intro---3-31-11",
"http://thecolbertreport.cc.com/videos/oth30j/congressional-budget-menorah",
"http://thecolbertreport.cc.com/videos/j56fvd/madison-as-hell",
"http://thecolbertreport.cc.com/videos/o6su04/piers-gibbon",
"http://thecolbertreport.cc.com/videos/gq7wfn/sign-off---congressional-budget-menorah-fire"
],
"guest": "Piers Gibbon"
},
{
"date": "2011-04-04",
"videos": [
"http://thecolbertreport.cc.com/videos/nknyci/government-shutdown-menorah",
"http://thecolbertreport.cc.com/videos/8fsxhp/stephen-shows-off-the-ipad-2",
"http://thecolbertreport.cc.com/videos/953smc/the-word---that-new-smell-smell",
"http://thecolbertreport.cc.com/videos/zr09m5/the-glennpocalypse",
"http://thecolbertreport.cc.com/videos/j7j5ds/andrew-chaikin",
"http://thecolbertreport.cc.com/videos/9h7n61/sign-off---inescapables"
],
"guest": "Andrew Chaikin"
},
{
"date": "2011-04-05",
"videos": [
"http://thecolbertreport.cc.com/videos/x139me/tim-pawlenty-appeals-to-youth-vote",
"http://thecolbertreport.cc.com/videos/dq1pyh/renaissance-nemesis---frank-jameso",
"http://thecolbertreport.cc.com/videos/zw8gjf/james-franco-pt--1",
"http://thecolbertreport.cc.com/videos/91jml7/james-franco-pt--2",
"http://thecolbertreport.cc.com/videos/upimil/sign-off---frank-jameso"
],
"guest": "James Franco"
},
{
"date": "2011-04-06",
"videos": [
"http://thecolbertreport.cc.com/videos/1fi1u8/wisconsin-supreme-court-race",
"http://thecolbertreport.cc.com/videos/vu85n8/my-fair-colbert---hugo-vickers-pt--1",
"http://thecolbertreport.cc.com/videos/53yz6p/wd-40-1",
"http://thecolbertreport.cc.com/videos/q5s3lh/sir-david-tang",
"http://thecolbertreport.cc.com/videos/oqhpiw/sign-off---wd-40-1-cleaner"
],
"guest": "Sir David Tang"
},
{
"date": "2011-04-07",
"videos": [
"http://thecolbertreport.cc.com/videos/x9mvny/exclusive---my-fair-colbert---charming-prince-philip",
"http://thecolbertreport.cc.com/videos/ruv6gp/exclusive---my-fair-colbert---ghost-of-an-irishman",
"http://thecolbertreport.cc.com/videos/k0xu9f/intro---4-7-11",
"http://thecolbertreport.cc.com/videos/a3oo5c/the-koran-s-best-day-ever",
"http://thecolbertreport.cc.com/videos/uepxed/my-fair-colbert---hugo-vickers-pt--2",
"http://thecolbertreport.cc.com/videos/4zz0jd/my-fair-colbert---hugo-vickers-pt--3",
"http://thecolbertreport.cc.com/videos/hv2afg/jeff-greenfield",
"http://thecolbertreport.cc.com/videos/b9aslx/sign-off---goodnight"
],
"guest": "Jeff Greenfield"
},
{
"date": "2011-04-11",
"videos": [
"http://thecolbertreport.cc.com/videos/5p5wwd/countdown-to-government-shutdown",
"http://thecolbertreport.cc.com/videos/wueypc/pap-smears-at-walgreens",
"http://thecolbertreport.cc.com/videos/5o6455/thought-for-food---chocolate-air--denny-s---bacon-cologne",
"http://thecolbertreport.cc.com/videos/5ej465/jamie-hyneman---adam-savage",
"http://thecolbertreport.cc.com/videos/sse1uc/sign-off---champagne-flute-of-lead-paint"
],
"guest": "Jamie Hyneman & Adam Savage"
},
{
"date": "2011-04-12",
"videos": [
"http://thecolbertreport.cc.com/videos/hvb9sp/intro---4-12-11",
"http://thecolbertreport.cc.com/videos/ez4az7/jon-kyl-tweets-not-intended-to-be-factual-statements",
"http://thecolbertreport.cc.com/videos/xcin15/mitt-happens",
"http://thecolbertreport.cc.com/videos/l039ce/mitt-happens---rick-brookhiser",
"http://thecolbertreport.cc.com/videos/pqpkrr/threat-level--rainbow",
"http://thecolbertreport.cc.com/videos/2gpjkk/ray-kurzweil",
"http://thecolbertreport.cc.com/videos/ry2cgl/sign-off---goodnight"
],
"guest": "Ray Kurzweil"
},
{
"date": "2011-04-13",
"videos": [
"http://thecolbertreport.cc.com/videos/tjsqfs/tim-pawlenty-declares-candidacy-before-he-s-ready",
"http://thecolbertreport.cc.com/videos/ha4gop/the-word---buy-and-cellulite",
"http://thecolbertreport.cc.com/videos/jc9fbz/the-enemy-within---unicyclists",
"http://thecolbertreport.cc.com/videos/nm38xu/morgan-spurlock",
"http://thecolbertreport.cc.com/videos/l1ikyh/sign-off---doritos-suit"
],
"guest": "Morgan Spurlock"
},
{
"date": "2011-04-14",
"videos": [
"http://thecolbertreport.cc.com/videos/fziyvf/obama-needs-charts-and-graphs",
"http://thecolbertreport.cc.com/videos/pfzzi1/viacom-ruins-stephen-s-pac-dream",
"http://thecolbertreport.cc.com/videos/yzb7q2/colbert-super-pac---trevor-potter",
"http://thecolbertreport.cc.com/videos/k099cq/easter-under-attack---egg-edition",
"http://thecolbertreport.cc.com/videos/iybrlk/caroline-kennedy",
"http://thecolbertreport.cc.com/videos/rjwyn0/sign-off---ipad"
],
"guest": "Caroline Kennedy"
},
{
"date": "2011-04-25",
"videos": [
"http://thecolbertreport.cc.com/videos/00rg0h/catholic-bender",
"http://thecolbertreport.cc.com/videos/tml3zz/obama-s-tax-return---road-to-the-trump-house",
"http://thecolbertreport.cc.com/videos/e943tp/cheating-death---vaxa-international--lap-band-surgery---restless-leg-syndrome",
"http://thecolbertreport.cc.com/videos/nxhrou/ron-paul",
"http://thecolbertreport.cc.com/videos/8813vl/sign-off---vacsa-not-masturbating"
],
"guest": "Rep. Ron Paul"
},
{
"date": "2011-04-26",
"videos": [
"http://thecolbertreport.cc.com/videos/hl20qf/intro---4-26-11",
"http://thecolbertreport.cc.com/videos/zv4zje/mitt-romney-s--peacetime--gaffe",
"http://thecolbertreport.cc.com/videos/rmltni/charles-manson-believes-in-global-warming",
"http://thecolbertreport.cc.com/videos/i3gdyb/a-c--grayling",
"http://thecolbertreport.cc.com/videos/qxdqyc/sign-off---taser"
],
"guest": "A.C. Grayling"
},
{
"date": "2011-04-27",
"videos": [
"http://thecolbertreport.cc.com/videos/d9mieg/intro---4-27-11",
"http://thecolbertreport.cc.com/videos/cnt2qq/america-needs-to-see-obama-s-report-cards",
"http://thecolbertreport.cc.com/videos/vog079/tip-wag---faa--casio-watches---postal-service",
"http://thecolbertreport.cc.com/videos/qu6i2l/anderson-cooper-goes-on-the-absurd-u-chart",
"http://thecolbertreport.cc.com/videos/okt7ac/ice-t",
"http://thecolbertreport.cc.com/videos/bi5bau/sign-off---goodnight-in-spanish"
],
"guest": "Ice-T"
},
{
"date": "2011-04-28",
"videos": [
"http://thecolbertreport.cc.com/videos/xcnvxf/intro---4-28-11",
"http://thecolbertreport.cc.com/videos/6ei496/stephen-waits-for-his-royal-wedding-invitation-in-london",
"http://thecolbertreport.cc.com/videos/8ureil/progressives-united---russ-feingold",
"http://thecolbertreport.cc.com/videos/dfmioz/homeland-security-eliminates-color-coded-terror-alert-system",
"http://thecolbertreport.cc.com/videos/r7zj9a/wade-graham",
"http://thecolbertreport.cc.com/videos/tsom8o/sign-off---off-to-the-royal-wedding"
],
"guest": "Wade Graham"
},
{
"date": "2011-05-02",
"videos": [
"http://thecolbertreport.cc.com/videos/792my5/intro---5-2-11",
"http://thecolbertreport.cc.com/videos/6kw3l1/long-awaited--we-got-bin-laden--party",
"http://thecolbertreport.cc.com/videos/501cxj/carefree-pre-9-11-world",
"http://thecolbertreport.cc.com/videos/w147rj/relations-with-pakistan---richard-haass",
"http://thecolbertreport.cc.com/videos/x03tm5/francis-fukuyama",
"http://thecolbertreport.cc.com/videos/s3o1z2/sign-off---obama-s-timer-runs-out"
],
"guest": "Francis Fukuyama"
},
{
"date": "2011-05-03",
"videos": [
"http://thecolbertreport.cc.com/videos/v58m27/intro---5-3-11",
"http://thecolbertreport.cc.com/videos/h9f07a/osama-bin-laden-is-still-dead",
"http://thecolbertreport.cc.com/videos/5n9zp7/obama-takes-credit-for-bin-laden-s-assassination",
"http://thecolbertreport.cc.com/videos/h1wdo9/journalistic-grintegrity",
"http://thecolbertreport.cc.com/videos/u2r1n6/rex-ryan",
"http://thecolbertreport.cc.com/videos/ukrfvl/sign-off---special-kiss"
],
"guest": "Rex Ryan"
},
{
"date": "2011-05-04",
"videos": [
"http://thecolbertreport.cc.com/videos/edkk4q/intro---5-4-11",
"http://thecolbertreport.cc.com/videos/ndiuxr/terrorists--they-re-just-like-us-",
"http://thecolbertreport.cc.com/videos/kbkvj6/stephen-searches-for-shared-bathroom-key",
"http://thecolbertreport.cc.com/videos/kt1w5q/movies-that-are-destroying-america---saving-america-edition",
"http://thecolbertreport.cc.com/videos/50b5cb/amy-farrell",
"http://thecolbertreport.cc.com/videos/jcmie8/sign-off---goodnight"
],
"guest": "Amy Farrell"
},
{
"date": "2011-05-05",
"videos": [
"http://thecolbertreport.cc.com/videos/lbrn85/stephen-confesses-to-a-distracted-media",
"http://thecolbertreport.cc.com/videos/avpz0y/threatdown---superman--madden-nfl-12----glee-",
"http://thecolbertreport.cc.com/videos/g2bhyr/inaugural-republican-presidential-debate---donald-trump-s-wisdom",
"http://thecolbertreport.cc.com/videos/4neb1g/bill-james",
"http://thecolbertreport.cc.com/videos/k2or8w/sign-off---dennis-kucinich-heat-vision"
],
"guest": "Bill James"
},
{
"date": "2011-05-09",
"videos": [
"http://thecolbertreport.cc.com/videos/dkbe7y/intro---5-9-11",
"http://thecolbertreport.cc.com/videos/6rdbxz/hasidic-newspaper-removes-hillary-clinton",
"http://thecolbertreport.cc.com/videos/mqyr6k/herman-cain-wins-the-first-republican-presidential-debate",
"http://thecolbertreport.cc.com/videos/38grqn/the-word---autocratic-for-the-people",
"http://thecolbertreport.cc.com/videos/d8bi6b/lupe-fiasco",
"http://thecolbertreport.cc.com/videos/vonv0r/sign-off---lupe-fiasco-s--lasers-"
],
"guest": "Lupe Fiasco"
},
{
"date": "2011-05-10",
"videos": [
"http://thecolbertreport.cc.com/videos/r02fac/newt-gingrich---donald-trump-announce-future-announcements",
"http://thecolbertreport.cc.com/videos/w3lgcs/yahweh-or-no-way---thor---apocalypse-billboard",
"http://thecolbertreport.cc.com/videos/zu0ju2/difference-makers---donald-trump",
"http://thecolbertreport.cc.com/videos/i4gyok/geoffrey-rush",
"http://thecolbertreport.cc.com/videos/wmfolw/sign-off---a-rare-correction"
],
"guest": "Geoffrey Rush"
},
{
"date": "2011-05-11",
"videos": [
"http://thecolbertreport.cc.com/videos/g0js2x/intro---5-11-11",
"http://thecolbertreport.cc.com/videos/txo75b/herman-cain-claims-the-colbert-bump",
"http://thecolbertreport.cc.com/videos/1ssaiz/corp-constituency",
"http://thecolbertreport.cc.com/videos/nfv0i1/corp-constituency---trevor-potter",
"http://thecolbertreport.cc.com/videos/rqvi06/award-to-the-wise",
"http://thecolbertreport.cc.com/videos/sjt27k/eric-greitens",
"http://thecolbertreport.cc.com/videos/q3siyv/sign-off---press-hat"
],
"guest": "Eric Greitens"
},
{
"date": "2011-05-12",
"videos": [
"http://thecolbertreport.cc.com/videos/mp7mrs/intro---5-12-11",
"http://thecolbertreport.cc.com/videos/zz94qv/obama-s-latino-panderfest",
"http://thecolbertreport.cc.com/videos/vkp4tr/terror--a-new-one",
"http://thecolbertreport.cc.com/videos/9o0mt6/terror--a-new-one---lawrence-wright",
"http://thecolbertreport.cc.com/videos/dqvz13/if-at-first-you-don-t-secede",
"http://thecolbertreport.cc.com/videos/yx5grt/john-bradshaw",
"http://thecolbertreport.cc.com/videos/sw8fy6/sign-off---stephen-s-super-pac-needs-support"
],
"guest": "John Bradshaw"
},
{
"date": "2011-05-16",
"videos": [
"http://thecolbertreport.cc.com/videos/9xaxr4/mike-huckabee---donald-trump-drop-out",
"http://thecolbertreport.cc.com/videos/duon08/fig-newton-gingrich-2012",
"http://thecolbertreport.cc.com/videos/epwg6t/stephen-files-super-pac-request",
"http://thecolbertreport.cc.com/videos/g3ep11/alison-klayman",
"http://thecolbertreport.cc.com/videos/4r7evh/sign-off---goodnight"
],
"guest": "Alison Klayman"
},
{
"date": "2011-05-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ip5tv7/intro---5-17-11",
"http://thecolbertreport.cc.com/videos/1ugsri/world-s-oldest-panda-dies",
"http://thecolbertreport.cc.com/videos/l4p5dq/the-word---enhanced-rejustification",
"http://thecolbertreport.cc.com/videos/pg06l0/arnold-schwarzenegger-s-sex-scandal",
"http://thecolbertreport.cc.com/videos/58filp/amy-kremer",
"http://thecolbertreport.cc.com/videos/no1rv9/sign-off---goodnight"
],
"guest": "Amy Kremer"
},
{
"date": "2011-05-18",
"videos": [
"http://thecolbertreport.cc.com/videos/faf2no/exclusive---austan-goolsbee-extended-interview-pt--1",
"http://thecolbertreport.cc.com/videos/6pf58s/exclusive---austan-goolsbee-extended-interview-pt--2",
"http://thecolbertreport.cc.com/videos/bdi4g4/exclusive---austan-goolsbee-extended-interview-pt--3",
"http://thecolbertreport.cc.com/videos/6khcvr/intro---5-18-11",
"http://thecolbertreport.cc.com/videos/55ye8a/osama-bin-laden-s-replacement",
"http://thecolbertreport.cc.com/videos/tohq6g/tip-wag---ohio-legislature---facebook",
"http://thecolbertreport.cc.com/videos/2cxcrh/breaking-newt",
"http://thecolbertreport.cc.com/videos/vvu071/austan-goolsbee",
"http://thecolbertreport.cc.com/videos/sklv51/sign-off---long-austan-goolsbee-interview"
],
"guest": "Austan Goolsbee"
},
{
"date": "2011-05-19",
"videos": [
"http://thecolbertreport.cc.com/videos/7qmvog/john-lithgow-performs-gingrich-press-release",
"http://thecolbertreport.cc.com/videos/pb82sf/better-know-a-district---illinois--18th---aaron-schock-update",
"http://thecolbertreport.cc.com/videos/3gd1zf/clergy-matic-ecclesi-action-center-3-16",
"http://thecolbertreport.cc.com/videos/5ec3r8/kareem-abdul-jabbar",
"http://thecolbertreport.cc.com/videos/p12tcc/sign-off---history-of-life-on-earth"
],
"guest": "Kareem Abdul-Jabbar"
},
{
"date": "2011-05-31",
"videos": [
"http://thecolbertreport.cc.com/videos/gn9ut5/intro---5-31-11",
"http://thecolbertreport.cc.com/videos/xxn340/charleston-to-bermuda-yacht-race",
"http://thecolbertreport.cc.com/videos/fgthom/sarah-palin-s-bus-tour",
"http://thecolbertreport.cc.com/videos/bmwaxh/fec-questions---trevor-potter",
"http://thecolbertreport.cc.com/videos/7bl2ga/invisible-judgment",
"http://thecolbertreport.cc.com/videos/ox3on4/james-stewart",
"http://thecolbertreport.cc.com/videos/vn091b/sign-off---goodnight"
],
"guest": "James B. Stewart"
},
{
"date": "2011-06-01",
"videos": [
"http://thecolbertreport.cc.com/videos/nos79v/intro---6-1-11",
"http://thecolbertreport.cc.com/videos/mqb30h/sarah-palin-visits-the-times-square-applebee-s",
"http://thecolbertreport.cc.com/videos/ul70kx/meat-tweet",
"http://thecolbertreport.cc.com/videos/jph6sv/harmful-cell-phones",
"http://thecolbertreport.cc.com/videos/beqc1p/who-s-riding-my-coattails-now----jimmy-fallon",
"http://thecolbertreport.cc.com/videos/5a4ke7/robert-f--kennedy-jr-",
"http://thecolbertreport.cc.com/videos/3enqpr/sign-off---iphone"
],
"guest": "Robert Kennedy Jr."
},
{
"date": "2011-06-02",
"videos": [
"http://thecolbertreport.cc.com/videos/7o4l3r/intro---6-2-11",
"http://thecolbertreport.cc.com/videos/rqi6dy/dancing-on-the-ceiling",
"http://thecolbertreport.cc.com/videos/1db84y/anthony-weiner-addresses-twitter-scandal",
"http://thecolbertreport.cc.com/videos/qhexu1/tip-wag---osama-bin-laden---hugh-hefner",
"http://thecolbertreport.cc.com/videos/8t7m7k/salman-khan",
"http://thecolbertreport.cc.com/videos/rqa2ar/sign-off---goodnight"
],
"guest": "Salman Khan"
},
{
"date": "2011-06-06",
"videos": [
"http://thecolbertreport.cc.com/videos/bwqzbu/anthony-weiner-s-emergency-press-conference",
"http://thecolbertreport.cc.com/videos/uvi91o/paul-revere-s-famous-ride",
"http://thecolbertreport.cc.com/videos/x424g2/stephen-s-twitter-scandal",
"http://thecolbertreport.cc.com/videos/qyadrw/obama-administration-replaces-food-pyramid",
"http://thecolbertreport.cc.com/videos/fdolcv/werner-herzog",
"http://thecolbertreport.cc.com/videos/ed6qec/stephen-s-midnight-ride"
],
"guest": "Werner Herzog"
},
{
"date": "2011-06-07",
"videos": [
"http://thecolbertreport.cc.com/videos/suzxde/scott-pelley-s-first-cbs-broadcast",
"http://thecolbertreport.cc.com/videos/1w9fvc/the-word---hear-no-evil",
"http://thecolbertreport.cc.com/videos/fvvawg/sugar-ray-leonard",
"http://thecolbertreport.cc.com/videos/b4ot0e/apologies-to-shimshamistan"
],
"guest": "Sugar Ray Leonard"
},
{
"date": "2011-06-08",
"videos": [
"http://thecolbertreport.cc.com/videos/fq1085/herman-cain-wants-small-bills",
"http://thecolbertreport.cc.com/videos/bmggoz/better-know-a-district---california-s-10th---john-garamendi",
"http://thecolbertreport.cc.com/videos/ycdgvg/weiner-captures-manscaping-vote",
"http://thecolbertreport.cc.com/videos/yvz8wj/bre-pettis",
"http://thecolbertreport.cc.com/videos/ao2r17/sign-off---makerbot-head"
],
"guest": "Bre Pettis"
},
{
"date": "2011-06-09",
"videos": [
"http://thecolbertreport.cc.com/videos/tz9edm/shaquille-o-neal-retires",
"http://thecolbertreport.cc.com/videos/umrvml/mitt-romney-leads-in-fox-news-poll",
"http://thecolbertreport.cc.com/videos/qgxogp/the-word---the-business-end",
"http://thecolbertreport.cc.com/videos/oneftb/andrew-breitbart-reveals-weiner-photo",
"http://thecolbertreport.cc.com/videos/5f3kap/tom-ridge",
"http://thecolbertreport.cc.com/videos/vvj5q2/sign-off---goodnight"
],
"guest": "Tom Ridge"
},
{
"date": "2011-06-13",
"videos": [
"http://thecolbertreport.cc.com/videos/0zzkov/anthony-weiner-gym-photos",
"http://thecolbertreport.cc.com/videos/vgcql3/sport-report---miami-heat--fifa---freestyle-canoe-dancing",
"http://thecolbertreport.cc.com/videos/vyyl7z/henry-kissinger-pt--1",
"http://thecolbertreport.cc.com/videos/2j87li/henry-kissinger-pt--2",
"http://thecolbertreport.cc.com/videos/w5b5l1/sign-off---goodnight"
],
"guest": "Henry Kissinger"
},
{
"date": "2011-06-14",
"videos": [
"http://thecolbertreport.cc.com/videos/lokk6e/intro---6-14-11",
"http://thecolbertreport.cc.com/videos/egh1n7/elephants-in-the-room",
"http://thecolbertreport.cc.com/videos/ykt712/close-sesame",
"http://thecolbertreport.cc.com/videos/s6kp16/janny-scott",
"http://thecolbertreport.cc.com/videos/j0gylk/sign-off---marshmallows"
],
"guest": "Janny Scott"
},
{
"date": "2011-06-15",
"videos": [
"http://thecolbertreport.cc.com/videos/d8iaxd/intro---6-15-11",
"http://thecolbertreport.cc.com/videos/zj00ia/iran-bans-necklaces-and-shorts",
"http://thecolbertreport.cc.com/videos/xbt4w9/kindergarten-gop",
"http://thecolbertreport.cc.com/videos/ynp682/the-word---shock-the-vote",
"http://thecolbertreport.cc.com/videos/46tlsv/senior-moment---pot-smoking-seniors",
"http://thecolbertreport.cc.com/videos/5h6ee5/keith-olbermann",
"http://thecolbertreport.cc.com/videos/5rh3rg/sign-off---stephen-wears-shorts"
],
"guest": "Keith Olbermann"
},
{
"date": "2011-06-20",
"videos": [
"http://thecolbertreport.cc.com/videos/2374v3/intro---6-20-11",
"http://thecolbertreport.cc.com/videos/q7b70y/stephest-colbchella--011---rock-you-like-a-thirst-icane",
"http://thecolbertreport.cc.com/videos/y7lr8u/threatdown---moo-shu-man-milk--centenarians---robo-slackers",
"http://thecolbertreport.cc.com/videos/gds7n9/justin-vernon",
"http://thecolbertreport.cc.com/videos/su735n/sign-off---bon-iver-bonus-song"
],
"guest": "Bon Iver"
},
{
"date": "2011-06-21",
"videos": [
"http://thecolbertreport.cc.com/videos/3o3le7/generic-republican-presidential-nominee",
"http://thecolbertreport.cc.com/videos/ct0au7/stephest-colbchella--011---stephen-revives-his-music-career",
"http://thecolbertreport.cc.com/videos/v43nph/2011--a-rock-odyssey-featuring-jack-white-pt--1",
"http://thecolbertreport.cc.com/videos/7e8ifi/florence-welch",
"http://thecolbertreport.cc.com/videos/ei7r0b/sign-off---talib-kweli-tomorrow"
],
"guest": "Florence and the Machine"
},
{
"date": "2011-06-22",
"videos": [
"http://thecolbertreport.cc.com/videos/f5h9ob/george-w--bush-helps-break-a-world-record",
"http://thecolbertreport.cc.com/videos/ozlnky/2011--a-rock-odyssey-featuring-jack-white-pt--2",
"http://thecolbertreport.cc.com/videos/u3bmmq/the-word---the-defining-moment",
"http://thecolbertreport.cc.com/videos/c7shlp/talib-kweli"
],
"guest": "Talib Kweli"
},
{
"date": "2011-06-23",
"videos": [
"http://thecolbertreport.cc.com/videos/ihqt34/exclusive---2011--a-rock-odyssey-featuring-jack-white---catholic-throwdown",
"http://thecolbertreport.cc.com/videos/zbc2ok/stephest-colbchella--011---stephen-announces-his-hit-song",
"http://thecolbertreport.cc.com/videos/1if3ir/nation-building-in-america",
"http://thecolbertreport.cc.com/videos/4evhq9/2011--a-rock-odyssey-featuring-jack-white-pt--3",
"http://thecolbertreport.cc.com/videos/39or3g/jack-white"
],
"guest": "The Black Belles"
},
{
"date": "2011-06-27",
"videos": [
"http://thecolbertreport.cc.com/videos/8tiso3/intro---6-27-11",
"http://thecolbertreport.cc.com/videos/zz1v27/tip-wag---scented-razors---rick-scott-s-approval-rating",
"http://thecolbertreport.cc.com/videos/7e3kfb/stephen---jonathan-alter-at-gaillard-auditorium",
"http://thecolbertreport.cc.com/videos/npgonl/good-point-other-point---ted-nugent-vs--millennials",
"http://thecolbertreport.cc.com/videos/89vjk7/grover-norquist",
"http://thecolbertreport.cc.com/videos/fe2wnr/sign-off---scented-box-cutter"
],
"guest": "Grover Norquist"
},
{
"date": "2011-06-28",
"videos": [
"http://thecolbertreport.cc.com/videos/gs5b2y/intro---6-28-11",
"http://thecolbertreport.cc.com/videos/im5by3/michele-bachmann-compares-herself-to-john-wayne",
"http://thecolbertreport.cc.com/videos/b2dez1/the-word---too-big-to-nail",
"http://thecolbertreport.cc.com/videos/eztgrx/advertising-to-monkeys",
"http://thecolbertreport.cc.com/videos/jfztdi/alexandra-pelosi",
"http://thecolbertreport.cc.com/videos/1it2j9/sign-off---teleprompter-eulogy"
],
"guest": "Alexandra Pelosi"
},
{
"date": "2011-06-29",
"videos": [
"http://thecolbertreport.cc.com/videos/e7dlbc/intro---6-29-11",
"http://thecolbertreport.cc.com/videos/s3xttd/4th-of-july-under-attack---fireworks-cancelled",
"http://thecolbertreport.cc.com/videos/7gul1z/colbert-super-pac---irresponsible-advertising",
"http://thecolbertreport.cc.com/videos/kco7lo/colbert-super-pac---trevor-potter-preps-stephen-for-his-fec-hearing",
"http://thecolbertreport.cc.com/videos/o7wrgl/hometown-hero-town---lexington--ky",
"http://thecolbertreport.cc.com/videos/zc23xv/gary-sinise",
"http://thecolbertreport.cc.com/videos/80a7v2/sign-off---see-you-at-the-fec"
],
"guest": "Gary Sinise"
},
{
"date": "2011-06-30",
"videos": [
"http://thecolbertreport.cc.com/videos/3yk8uf/intro---6-30-11",
"http://thecolbertreport.cc.com/videos/gffis7/colbert-super-pac---i-can-haz-super-pac-",
"http://thecolbertreport.cc.com/videos/uf525x/colbert-super-pac---stephen-addresses-colbert-super-nation",
"http://thecolbertreport.cc.com/videos/owodco/formidable-opponent---pakistan",
"http://thecolbertreport.cc.com/videos/807lhi/timothy-garton-ash",
"http://thecolbertreport.cc.com/videos/b2dqnd/sign-off---super-pac-donations"
],
"guest": "Timothy Garton Ash"
},
{
"date": "2011-07-11",
"videos": [
"http://thecolbertreport.cc.com/videos/t8xnmj/intro---7-11-11",
"http://thecolbertreport.cc.com/videos/sgqex9/colbert-super-pac---pushing-the-limits",
"http://thecolbertreport.cc.com/videos/m3svek/anti-frack-attacks",
"http://thecolbertreport.cc.com/videos/2h3oe2/tip-wag---conservative-john-lennon---unfunny-germany",
"http://thecolbertreport.cc.com/videos/z2r2b0/michael-shermer",
"http://thecolbertreport.cc.com/videos/g47pr3/sign-off---super-pac-fundraising-goal"
],
"guest": "Michael Shermer"
},
{
"date": "2011-07-12",
"videos": [
"http://thecolbertreport.cc.com/videos/20gpt7/herman-cain-train",
"http://thecolbertreport.cc.com/videos/7aive1/the-family-leader-s-controversial-pledge",
"http://thecolbertreport.cc.com/videos/7sobpk/heterosexual-accountability-buddy",
"http://thecolbertreport.cc.com/videos/vw4tol/dan-savage",
"http://thecolbertreport.cc.com/videos/nkuukl/sign-off---fixing-the-boiler"
],
"guest": "Dan Savage"
},
{
"date": "2011-07-13",
"videos": [
"http://thecolbertreport.cc.com/videos/smsyco/intro---7-13-11",
"http://thecolbertreport.cc.com/videos/70lgql/flagworth-2012",
"http://thecolbertreport.cc.com/videos/7gb5kn/republicans-choose-none-of-the-above",
"http://thecolbertreport.cc.com/videos/palj9t/obama-calls-the-republican-bluff",
"http://thecolbertreport.cc.com/videos/5ulzg5/david-mccullough",
"http://thecolbertreport.cc.com/videos/7xngpa/sign-off---pen-toss"
],
"guest": "David McCullough"
},
{
"date": "2011-07-14",
"videos": [
"http://thecolbertreport.cc.com/videos/h2i0g7/intro---7-14-11",
"http://thecolbertreport.cc.com/videos/8oisqi/carmageddon",
"http://thecolbertreport.cc.com/videos/uqj8qb/may-the-best-stephen-colbert-win",
"http://thecolbertreport.cc.com/videos/a29405/murdoch-s-media-empire-might-go-down-the-toilet",
"http://thecolbertreport.cc.com/videos/1o1flh/improvised-expressive-devices",
"http://thecolbertreport.cc.com/videos/82ovjs/jose-antonio-vargas",
"http://thecolbertreport.cc.com/videos/9nwz4n/sign-off---goodnight"
],
"guest": "Jose Antonio Vargas"
},
{
"date": "2011-07-18",
"videos": [
"http://thecolbertreport.cc.com/videos/ureory/intro---7-18-11",
"http://thecolbertreport.cc.com/videos/ybue54/epic-blockbuster",
"http://thecolbertreport.cc.com/videos/7t9e81/colbert-super-pac---cash-crawl",
"http://thecolbertreport.cc.com/videos/73lwqj/colbert-super-pac---campaign-finance",
"http://thecolbertreport.cc.com/videos/9q309t/blood-in-the-water---rupert-murdoch-s-news-of-the-world-scandal",
"http://thecolbertreport.cc.com/videos/36812w/john-prendergast",
"http://thecolbertreport.cc.com/videos/d8rt51/sign-off---prerecorded-episodes"
],
"guest": "John Prendergast"
},
{
"date": "2011-07-19",
"videos": [
"http://thecolbertreport.cc.com/videos/bcunwj/newt-s-white-whale",
"http://thecolbertreport.cc.com/videos/nhl043/god-calls-rick-perry",
"http://thecolbertreport.cc.com/videos/6cdpui/debt-ceiling-deadline-conspiracy",
"http://thecolbertreport.cc.com/videos/maophz/david-carr",
"http://thecolbertreport.cc.com/videos/50pek1/sign-off---goodnight"
],
"guest": "David Carr"
},
{
"date": "2011-07-20",
"videos": [
"http://thecolbertreport.cc.com/videos/pmh9y8/humanized-by-pie",
"http://thecolbertreport.cc.com/videos/ozixqy/voter-id-laws",
"http://thecolbertreport.cc.com/videos/2i29ww/congressional-partisan-rancor",
"http://thecolbertreport.cc.com/videos/2p2ijk/michael-sandel",
"http://thecolbertreport.cc.com/videos/tia7kd/sign-off---reading"
],
"guest": "Michael Sandel"
},
{
"date": "2011-07-21",
"videos": [
"http://thecolbertreport.cc.com/videos/egjics/intro---7-21-11",
"http://thecolbertreport.cc.com/videos/l3rcr1/death-of-america-s-space-program",
"http://thecolbertreport.cc.com/videos/vntv81/i-s-on-edjukashun---gay-history---disney-english",
"http://thecolbertreport.cc.com/videos/6yym31/nbc--no-butt-coverage",
"http://thecolbertreport.cc.com/videos/9catel/david-eagleman",
"http://thecolbertreport.cc.com/videos/nn8qoh/sign-off---space-robot"
],
"guest": "David Eagleman"
},
{
"date": "2011-07-25",
"videos": [
"http://thecolbertreport.cc.com/videos/l0wxhe/y2-gay",
"http://thecolbertreport.cc.com/videos/fbd6kf/norwegian-muslish-gunman-s-islam-esque-atrocity",
"http://thecolbertreport.cc.com/videos/wznkdz/vaginal-puppeteering-vs--d--k-scrub",
"http://thecolbertreport.cc.com/videos/z4gfkc/brian-cox",
"http://thecolbertreport.cc.com/videos/9q5n38/sign-off---the-thinker"
],
"guest": "Brian Cox"
},
{
"date": "2011-07-26",
"videos": [
"http://thecolbertreport.cc.com/videos/bzl0xh/intro---7-26-11",
"http://thecolbertreport.cc.com/videos/umjv5s/herman-cain-cancels-on-stephen",
"http://thecolbertreport.cc.com/videos/zq2rpw/-poor--in-america",
"http://thecolbertreport.cc.com/videos/j2gcnk/-poor--in-america---peter-edelman",
"http://thecolbertreport.cc.com/videos/a4awyb/america-s-bucket-list",
"http://thecolbertreport.cc.com/videos/azl59v/brooke-gladstone",
"http://thecolbertreport.cc.com/videos/ly4qfz/sign-off---america-s-bucket-list"
],
"guest": "Brooke Gladstone"
},
{
"date": "2011-07-27",
"videos": [
"http://thecolbertreport.cc.com/videos/zq1omv/nissan-s--leaf-wave--deadline",
"http://thecolbertreport.cc.com/videos/x50fvb/difference-makers---patrick-rodgers",
"http://thecolbertreport.cc.com/videos/3o44r7/helium-runs-out",
"http://thecolbertreport.cc.com/videos/omkngv/missy-cummings",
"http://thecolbertreport.cc.com/videos/y4zc9o/sign-off---surveillance-drone-crash"
],
"guest": "Mary \"Missy\" Cummings"
},
{
"date": "2011-07-28",
"videos": [
"http://thecolbertreport.cc.com/videos/8c1oeo/the-republican-ring-of-power",
"http://thecolbertreport.cc.com/videos/yzmsiz/colbert-super-pac---for-the-children",
"http://thecolbertreport.cc.com/videos/e4r2vc/colbert-super-pac---matthew-dowd---ham-rove",
"http://thecolbertreport.cc.com/videos/z6f8m4/buddy-roemer-pt--1",
"http://thecolbertreport.cc.com/videos/n4ldiq/buddy-roemer-pt--2",
"http://thecolbertreport.cc.com/videos/tzpdu5/sign-off---cone-of-silence"
],
"guest": "Buddy Roemer"
},
{
"date": "2011-08-01",
"videos": [
"http://thecolbertreport.cc.com/videos/aqw9op/intro---8-1-11",
"http://thecolbertreport.cc.com/videos/lrz1ud/-three-billy-goats-gruff--budget-negotiations",
"http://thecolbertreport.cc.com/videos/mgkqu6/the-word---with-great-power-comes-no-responsibility",
"http://thecolbertreport.cc.com/videos/6v3oa3/from-ashes-to-bullets",
"http://thecolbertreport.cc.com/videos/mqbxt0/tony-hsieh",
"http://thecolbertreport.cc.com/videos/sqd53z/sign-off---sneakers"
],
"guest": "Tony Hsieh"
},
{
"date": "2011-08-02",
"videos": [
"http://thecolbertreport.cc.com/videos/xaqx6o/intro---8-2-11",
"http://thecolbertreport.cc.com/videos/j862uf/newt-gingrich-s-twitter-scandal",
"http://thecolbertreport.cc.com/videos/pzfcj1/america-s-credit-grating",
"http://thecolbertreport.cc.com/videos/y1xqdj/america-s-credit-grating---david-leonhardt",
"http://thecolbertreport.cc.com/videos/gg2p1r/baby-teeth-economy",
"http://thecolbertreport.cc.com/videos/id20x6/al-hunt",
"http://thecolbertreport.cc.com/videos/h26uru/sign-off---goodnight"
],
"guest": "Al Hunt"
},
{
"date": "2011-08-03",
"videos": [
"http://thecolbertreport.cc.com/videos/br7gdf/intro---8-3-11",
"http://thecolbertreport.cc.com/videos/3i1326/multiracial-spider-man",
"http://thecolbertreport.cc.com/videos/f3w320/threatdown---fake-states--sharia-weather---monopoly",
"http://thecolbertreport.cc.com/videos/cvc16w/women-s-health-nazi-plan",
"http://thecolbertreport.cc.com/videos/6x0m3y/robert-wittman",
"http://thecolbertreport.cc.com/videos/utsxoh/sign-off---official-flag-updater"
],
"guest": "Robert Wittman"
},
{
"date": "2011-08-04",
"videos": [
"http://thecolbertreport.cc.com/videos/t3bxny/intro---8-4-11",
"http://thecolbertreport.cc.com/videos/8tx5s2/barack-obama-s-50th-birthday",
"http://thecolbertreport.cc.com/videos/7ahjkr/colbert-super-pac---the-heroes-respond",
"http://thecolbertreport.cc.com/videos/ma6ejy/wisconsin-s-recall-election---americans-for-prosperity-s-absentee-ballot-typos",
"http://thecolbertreport.cc.com/videos/8q9pe2/sport-report---baseball-s-lowest-records---mlb-s-twitter-feed",
"http://thecolbertreport.cc.com/videos/d8704f/anthony-bourdain",
"http://thecolbertreport.cc.com/videos/afj5qe/sign-off---goodnight"
],
"guest": "Anthony Bourdain"
},
{
"date": "2011-08-08",
"videos": [
"http://thecolbertreport.cc.com/videos/smerqo/america-s-credit-downgrade",
"http://thecolbertreport.cc.com/videos/y7x3es/colbert-super-pac---rick-perry-for-president",
"http://thecolbertreport.cc.com/videos/lu1v74/doomsday-bargain-bunkers",
"http://thecolbertreport.cc.com/videos/wkairk/nassir-ghaemi",
"http://thecolbertreport.cc.com/videos/4zkkn5/sign-off---stephen-sniffs-a-marker"
],
"guest": "Nassir Ghaemi"
},
{
"date": "2011-08-09",
"videos": [
"http://thecolbertreport.cc.com/videos/tufpnm/intro---8-9-11",
"http://thecolbertreport.cc.com/videos/pxptx8/heatsteria",
"http://thecolbertreport.cc.com/videos/rtqznl/the-word---head-in-the-cloud",
"http://thecolbertreport.cc.com/videos/gj6vb5/ric-ocasek"
],
"guest": "The Cars"
},
{
"date": "2011-08-10",
"videos": [
"http://thecolbertreport.cc.com/videos/mjvryb/intro---8-10-11",
"http://thecolbertreport.cc.com/videos/1jlwac/hooker-drawer-market",
"http://thecolbertreport.cc.com/videos/cw4el2/yahweh-or-no-way---mormons---god-s-poll-numbers",
"http://thecolbertreport.cc.com/videos/uulxb3/god-s-job-performance---jim-martin",
"http://thecolbertreport.cc.com/videos/15zleh/colbert-super-pac---campaign-donation-addiction",
"http://thecolbertreport.cc.com/videos/zxka8u/elliot-ackerman",
"http://thecolbertreport.cc.com/videos/mvgmwy/sign-off---e-mailing-colbert-nation"
],
"guest": "Elliott Ackerman"
},
{
"date": "2011-08-11",
"videos": [
"http://thecolbertreport.cc.com/videos/pi19ix/super-pac-ad---behind-the-green-corn",
"http://thecolbertreport.cc.com/videos/x1aodj/super-pac-ad---episode-iv--a-new-hope",
"http://thecolbertreport.cc.com/videos/etbj36/romney-2012----corporations-are-people-",
"http://thecolbertreport.cc.com/videos/90ptp7/colbert-super-pac---rick-parry-with-an--a--for-america",
"http://thecolbertreport.cc.com/videos/swbu9s/colbert-super-pac---confused-by-rick-parry-with-an--a--for-america",
"http://thecolbertreport.cc.com/videos/yu257u/gloria-steinem",
"http://thecolbertreport.cc.com/videos/7x3ryp/sign-off---stephen-s-emmy-award"
],
"guest": "Gloria Steinem"
},
{
"date": "2011-08-15",
"videos": [
"http://thecolbertreport.cc.com/videos/40fotx/exclusive---susan-rice-extended-interview-pt--1",
"http://thecolbertreport.cc.com/videos/vvlrva/exclusive---susan-rice-extended-interview-pt--2",
"http://thecolbertreport.cc.com/videos/lqjncy/susan-rice-extended-interview-pt--3",
"http://thecolbertreport.cc.com/videos/0yyo1z/colbert-super-pac---stephen-apologizes-to-woi-in-des-moines",
"http://thecolbertreport.cc.com/videos/dzchwi/colbert-super-pac---iowa-straw-poll-results",
"http://thecolbertreport.cc.com/videos/dkh4ps/susan-rice-pt--1",
"http://thecolbertreport.cc.com/videos/nla0b4/susan-rice-pt--2",
"http://thecolbertreport.cc.com/videos/1rtsq5/sign-off---full-susan-rice-interview-online"
],
"guest": "Amb. Susan Rice"
},
{
"date": "2011-08-16",
"videos": [
"http://thecolbertreport.cc.com/videos/i0nwuy/exclusive---space-shuttle-atlantis-crew---extended-interview-pt--1",
"http://thecolbertreport.cc.com/videos/8gjrx4/exclusive---space-shuttle-atlantis-crew---extended-interview-pt--2",
"http://thecolbertreport.cc.com/videos/rmrfc3/the-etymology-of--obamacare-",
"http://thecolbertreport.cc.com/videos/cjfda6/colbert-super-pac---persuadulux-6000",
"http://thecolbertreport.cc.com/videos/m00z1i/colbert-super-pac---frank-luntz-commits-to-the-pac",
"http://thecolbertreport.cc.com/videos/a8v2gy/nasa-s-greatest-moments-montage",
"http://thecolbertreport.cc.com/videos/nnfhdg/chris-ferguson--doug-hurley--rex-walheim---sandy-magnus",
"http://thecolbertreport.cc.com/videos/h83o7v/sign-off---stephen-s-launch-pad-nut"
],
"guest": "STS-135 astronauts"
},
{
"date": "2011-08-17",
"videos": [
"http://thecolbertreport.cc.com/videos/brmz0s/exclusive---jeff-bridges-for-summer-s-eve",
"http://thecolbertreport.cc.com/videos/1cvtnm/intro---8-17-11",
"http://thecolbertreport.cc.com/videos/yk47i3/colbert-super-pac---rick-perry-s-treasurer",
"http://thecolbertreport.cc.com/videos/uiim37/tip-wag---evangelical-scientists---rick-santorum",
"http://thecolbertreport.cc.com/videos/4km5oi/jeff-bridges",
"http://thecolbertreport.cc.com/videos/1bb0sg/sign-off---jeff-bridges--album-cover"
],
"guest": "Jeff Bridges"
},
{
"date": "2011-08-18",
"videos": [
"http://thecolbertreport.cc.com/videos/237rh7/intro---8-18-11",
"http://thecolbertreport.cc.com/videos/oqd808/russia-s-james-bonds-vs--america-s-barack-obama",
"http://thecolbertreport.cc.com/videos/j31bbb/colbert-super-pac---parry-with-an-a-gate----day-6---we-may-have-did-it-",
"http://thecolbertreport.cc.com/videos/94c0x7/colbert-super-pac---parry-with-an-a-gate----day-6---woi-in-des-moines-reports",
"http://thecolbertreport.cc.com/videos/ger41z/anderson-cooper-s-kryptonite",
"http://thecolbertreport.cc.com/videos/1yhudu/kevin-mitnick",
"http://thecolbertreport.cc.com/videos/5r0lwc/sign-off---woi-in-des-moines"
],
"guest": "Kevin Mitnick"
},
{
"date": "2011-09-06",
"videos": [
"http://thecolbertreport.cc.com/videos/s3kv9p/michele-bachmann-s-natural-disaster-metaphor",
"http://thecolbertreport.cc.com/videos/fk34r7/the-word---happy-endings",
"http://thecolbertreport.cc.com/videos/ovw3t4/cheating-death---placebocisers---vaxamalgam",
"http://thecolbertreport.cc.com/videos/1cua0e/tim-pawlenty",
"http://thecolbertreport.cc.com/videos/d2roue/sign-off---placebocisers"
],
"guest": "Gov. Tim Pawlenty"
},
{
"date": "2011-09-07",
"videos": [
"http://thecolbertreport.cc.com/videos/1iqy2m/intro---9-7-11",
"http://thecolbertreport.cc.com/videos/nw0vtw/this-weak-in-national-secowardty",
"http://thecolbertreport.cc.com/videos/dhg1or/martin-luther-king-jr--memorial-paraphrase",
"http://thecolbertreport.cc.com/videos/796niz/parry-with-an-a-gate----day-26---update",
"http://thecolbertreport.cc.com/videos/h8ndj7/robin-wright",
"http://thecolbertreport.cc.com/videos/we0bnb/sign-off---stephen-uses-his-ipad"
],
"guest": "Robin B. Wright"
},
{
"date": "2011-09-08",
"videos": [
"http://thecolbertreport.cc.com/videos/6ut02o/republican-presidential-debate-media-coverage",
"http://thecolbertreport.cc.com/videos/0yghln/rick-perry-presents",
"http://thecolbertreport.cc.com/videos/pf00vn/barack-obama-s-jobs-speech",
"http://thecolbertreport.cc.com/videos/5x0a3c/tom-brokaw",
"http://thecolbertreport.cc.com/videos/lwsx3m/sign-off---old-milwaukee-beer"
],
"guest": "Tom Brokaw"
},
{
"date": "2011-09-12",
"videos": [
"http://thecolbertreport.cc.com/videos/3ooncl/tea-party-face-off-preview",
"http://thecolbertreport.cc.com/videos/4ig8mh/stephen-reports-on-an-old-fashioned-hero",
"http://thecolbertreport.cc.com/videos/eicjwv/shopping-griefportunities",
"http://thecolbertreport.cc.com/videos/sxy47f/diane-sawyer",
"http://thecolbertreport.cc.com/videos/g2jfq9/sign-off---stephen-s-mug"
],
"guest": "Diane Sawyer"
},
{
"date": "2011-09-13",
"videos": [
"http://thecolbertreport.cc.com/videos/bgo24q/intro---9-13-11",
"http://thecolbertreport.cc.com/videos/6jpgl3/cnn-tea-party-republican-debate",
"http://thecolbertreport.cc.com/videos/swyrcg/barack-obama-s-american-jobs-act",
"http://thecolbertreport.cc.com/videos/q1hw3n/barack-obama-s-american-jobs-act---paul-krugman",
"http://thecolbertreport.cc.com/videos/t7gpb8/ron-paul-2012",
"http://thecolbertreport.cc.com/videos/2cr39e/al-gore",
"http://thecolbertreport.cc.com/videos/e1gewo/sign-off----stephen-colbert-"
],
"guest": "Al Gore"
},
{
"date": "2011-09-14",
"videos": [
"http://thecolbertreport.cc.com/videos/thyhg7/jobs-bill-clipgate",
"http://thecolbertreport.cc.com/videos/gvt0ij/return-to-sender",
"http://thecolbertreport.cc.com/videos/3h08e2/return-to-sender---phil-rubio",
"http://thecolbertreport.cc.com/videos/gz48mn/rick-perry-s-hpv-vaccine-mandate",
"http://thecolbertreport.cc.com/videos/dx27ks/michael-moore",
"http://thecolbertreport.cc.com/videos/3rxw2x/sign-off---goodnight"
],
"guest": "Michael Moore"
},
{
"date": "2011-09-15",
"videos": [
"http://thecolbertreport.cc.com/videos/jgxmci/intro---9-15-11",
"http://thecolbertreport.cc.com/videos/rte3k7/take-a-billion--leave-a-billion",
"http://thecolbertreport.cc.com/videos/15vhbi/the-other-american-jobs-act",
"http://thecolbertreport.cc.com/videos/rje3k2/jimmy-fallon---stephen-reminisce",
"http://thecolbertreport.cc.com/videos/h90n13/fema-s-waffle-house-index",
"http://thecolbertreport.cc.com/videos/b406bd/david-copperfield",
"http://thecolbertreport.cc.com/videos/7m5lpn/sign-off---stephen-s-magic-trick"
],
"guest": "David Copperfield"
},
{
"date": "2011-09-20",
"videos": [
"http://thecolbertreport.cc.com/videos/tpoc1g/the-63rd-emmy-awards",
"http://thecolbertreport.cc.com/videos/whouap/barack-obama-unveils-the--buffett-rule-",
"http://thecolbertreport.cc.com/videos/pyq49u/the-word---death-and-taxes",
"http://thecolbertreport.cc.com/videos/3q875w/the-gayest-penetration",
"http://thecolbertreport.cc.com/videos/xnvm51/jeffrey-kluger",
"http://thecolbertreport.cc.com/videos/t0vjb4/sign-off---colbert-nation-s-newest-members"
],
"guest": "Jeffrey Kluger"
},
{
"date": "2011-09-21",
"videos": [
"http://thecolbertreport.cc.com/videos/hc8ova/intro---9-21-11",
"http://thecolbertreport.cc.com/videos/negwpt/coming-soon---hour-long-radiohead-special",
"http://thecolbertreport.cc.com/videos/kyxdz3/european-union-collapse---war-fueled-recovery",
"http://thecolbertreport.cc.com/videos/t51ow7/european-union-collapse---war-fueled-recovery---chrystia-freeland",
"http://thecolbertreport.cc.com/videos/wvyk91/wall-street-under-siege",
"http://thecolbertreport.cc.com/videos/z0celp/daniel-yergin",
"http://thecolbertreport.cc.com/videos/y9o1cm/sign-off---cigar"
],
"guest": "Daniel Yergin"
},
{
"date": "2011-09-22",
"videos": [
"http://thecolbertreport.cc.com/videos/9dc7h4/defunct-satellite-hurtles-toward-earth",
"http://thecolbertreport.cc.com/videos/szcqls/tip-wag---marine-corps---department-of-homeland-security",
"http://thecolbertreport.cc.com/videos/6uyhy5/obama-s-u-n--gaffes---rick-perry-s-support-for-israel",
"http://thecolbertreport.cc.com/videos/ncny69/jeremy-ben-ami",
"http://thecolbertreport.cc.com/videos/akoxfi/sign-off---the-beloved-dog-lives-on"
],
"guest": "Jeremy Ben-Ami"
},
{
"date": "2011-09-26",
"videos": [
"http://thecolbertreport.cc.com/videos/1w32i4/intro---9-26-11",
"http://thecolbertreport.cc.com/videos/p9c0ds/dr-pepper-presents-stephen-colbert-s-rocktember-with-radiohead",
"http://thecolbertreport.cc.com/videos/u4qbft/the-word---i-think--therefore-i-brand",
"http://thecolbertreport.cc.com/videos/grlcgn/radiohead",
"http://thecolbertreport.cc.com/videos/xqeu3w/ignoring-global-warming",
"http://thecolbertreport.cc.com/videos/wwvu7o/ignoring-global-warming---thom-yorke---ed-o-brien"
],
"guest": "Radiohead"
},
{
"date": "2011-09-27",
"videos": [
"http://thecolbertreport.cc.com/videos/9qb4vy/stephen---melinda-gates-foundation---donorschoose-org",
"http://thecolbertreport.cc.com/videos/tsm4sg/rick-perry-s-debate-gaffe---arizona-s-primary-date",
"http://thecolbertreport.cc.com/videos/5mvmay/sport-report---nascar-s-green-initiatives---nfl-pat-downs",
"http://thecolbertreport.cc.com/videos/ptxagr/melinda-gates",
"http://thecolbertreport.cc.com/videos/zlthc8/sign-off---beer-from-the-beerkenstocks"
],
"guest": "Melinda Gates"
},
{
"date": "2011-09-28",
"videos": [
"http://thecolbertreport.cc.com/videos/3qibl4/intro---9-28-11",
"http://thecolbertreport.cc.com/videos/udzuyb/george-clooney-s-villa-parties",
"http://thecolbertreport.cc.com/videos/tbuq71/the-word---labor-chains",
"http://thecolbertreport.cc.com/videos/3qmkez/atone-phone---john-lithgow-calls",
"http://thecolbertreport.cc.com/videos/ndmtp9/ken-burns",
"http://thecolbertreport.cc.com/videos/osmia6/sign-off---reading---shofar-playing"
],
"guest": "Ken Burns"
},
{
"date": "2011-09-29",
"videos": [
"http://thecolbertreport.cc.com/videos/0agwtq/mark-cuban-dances",
"http://thecolbertreport.cc.com/videos/ivvzeu/colbert-super-pac---ham-rove-s-secrets",
"http://thecolbertreport.cc.com/videos/3yzu4u/colbert-super-pac---trevor-potter---stephen-s-shell-corporation",
"http://thecolbertreport.cc.com/videos/ujyuht/colbert-super-pac-shh----the-donating-game",
"http://thecolbertreport.cc.com/videos/qiwg3k/mark-cuban",
"http://thecolbertreport.cc.com/videos/8ekdsc/sign-off---last-heroe--crawl"
],
"guest": "Mark Cuban"
},
{
"date": "2011-10-03",
"videos": [
"http://thecolbertreport.cc.com/videos/fehwjq/rick-perry-s-questionably-named-hunting-camp",
"http://thecolbertreport.cc.com/videos/m272fc/supreme-courting-season",
"http://thecolbertreport.cc.com/videos/v2njjc/supreme-courting-season---jeffrey-toobin",
"http://thecolbertreport.cc.com/videos/25ffk2/threatdown---bears-in-rehab--bear-terminators---sanctimonious-enviro-bears",
"http://thecolbertreport.cc.com/videos/wmazj5/jerome-groopman",
"http://thecolbertreport.cc.com/videos/kp6658/sign-off---stephen-s-water-bottle"
],
"guest": "Jerome Groopman"
},
{
"date": "2011-10-04",
"videos": [
"http://thecolbertreport.cc.com/videos/wy82eg/intro---10-4-11",
"http://thecolbertreport.cc.com/videos/3wq74s/chris-christie-2012",
"http://thecolbertreport.cc.com/videos/3dpzet/chris-christie-2012---rick-davis",
"http://thecolbertreport.cc.com/videos/cwuy2m/bocephus-s-eternal-question",
"http://thecolbertreport.cc.com/videos/xhc68w/john-lithgow",
"http://thecolbertreport.cc.com/videos/n16lxn/sign-off---formula-401-rumors"
],
"guest": "John Lithgow"
},
{
"date": "2011-10-05",
"videos": [
"http://thecolbertreport.cc.com/videos/0vn7mh/intro---10-5-11",
"http://thecolbertreport.cc.com/videos/xnxfq5/herman-cain-2012",
"http://thecolbertreport.cc.com/videos/dbbjic/herman-cain-2012---gay-choice",
"http://thecolbertreport.cc.com/videos/6kkk93/tip-wag---mexico-city-marriage-licenses---modern-warfare-3-s-xp-promotion",
"http://thecolbertreport.cc.com/videos/ifegp7/talib-kweli---yasiin-bey--a-k-a--mos-def-",
"http://thecolbertreport.cc.com/videos/7edjef/sign-off---iphone-goodnight"
],
"guest": "Mos Def & Talib Kweli"
},
{
"date": "2011-10-06",
"videos": [
"http://thecolbertreport.cc.com/videos/0qyxlz/colbert-super-pac-ad---foul-balls",
"http://thecolbertreport.cc.com/videos/fri8e1/intro---10-6-11",
"http://thecolbertreport.cc.com/videos/z103m6/sarah-palin-s-sad-news",
"http://thecolbertreport.cc.com/videos/yarfv2/colbert-super-pac-shh----apology-to-ham-rove",
"http://thecolbertreport.cc.com/videos/fottda/tribute-to-steve-jobs",
"http://thecolbertreport.cc.com/videos/98xl59/jason-amerine",
"http://thecolbertreport.cc.com/videos/oy1k9u/sign-off---goodnight"
],
"guest": "Jason Amerine"
},
{
"date": "2011-10-17",
"videos": [
"http://thecolbertreport.cc.com/videos/nng5h7/exclusive---harry-belafonte-extended-interview",
"http://thecolbertreport.cc.com/videos/gj3y6l/occupy-wall-street-spreads",
"http://thecolbertreport.cc.com/videos/z27tp0/the-word---look-out-for-the-little-guy",
"http://thecolbertreport.cc.com/videos/6vl2zq/sport-report---nba-lockout---colbert-super-pac-ad",
"http://thecolbertreport.cc.com/videos/01fxlb/harry-belafonte",
"http://thecolbertreport.cc.com/videos/s0qu24/sign-off---goodnight"
],
"guest": "Harry Belafonte"
},
{
"date": "2011-10-18",
"videos": [
"http://thecolbertreport.cc.com/videos/h40j2n/talking-iphone-4s",
"http://thecolbertreport.cc.com/videos/ta7e7u/herman-cain-s-electrified-fence",
"http://thecolbertreport.cc.com/videos/cbwqbb/thought-for-food---school-potato-guidelines---fast-food-stamps",
"http://thecolbertreport.cc.com/videos/3h8h2l/steven-pinker",
"http://thecolbertreport.cc.com/videos/9c1bsf/sign-off---sixth-anniversary-portrait"
],
"guest": "Steven Pinker"
},
{
"date": "2011-10-19",
"videos": [
"http://thecolbertreport.cc.com/videos/iirczx/intro---10-19-11",
"http://thecolbertreport.cc.com/videos/gghhza/herman-cain-canes-the-unemployed",
"http://thecolbertreport.cc.com/videos/ubi151/job-killing-epa",
"http://thecolbertreport.cc.com/videos/zi48pt/job-killing-epa---carol-browner",
"http://thecolbertreport.cc.com/videos/f49qpp/rush-limbaugh-s-l-r-a--research",
"http://thecolbertreport.cc.com/videos/fztuzs/ali-soufan",
"http://thecolbertreport.cc.com/videos/kodm5a/sign-off---laptop-music"
],
"guest": "Ali Soufan"
},
{
"date": "2011-10-20",
"videos": [
"http://thecolbertreport.cc.com/videos/n73wq4/intro---10-20-11",
"http://thecolbertreport.cc.com/videos/5p2a33/goodbye--muammar-al-gaddafi",
"http://thecolbertreport.cc.com/videos/5xgc3k/tip-wag---tea-party-nation-pledge---spirit-airlines--ad-revenue",
"http://thecolbertreport.cc.com/videos/ql433h/bill-o-reilly-s--pinheads---patriots-",
"http://thecolbertreport.cc.com/videos/qw2pao/chris-martin"
],
"guest": "Coldplay"
},
{
"date": "2011-10-24",
"videos": [
"http://thecolbertreport.cc.com/videos/x027jm/exclusive---colbert-super-pac---frank-luntz---stephen-knows-his-classic-rock",
"http://thecolbertreport.cc.com/videos/f8t1zf/america-s-top-mormons---jon-huntsman",
"http://thecolbertreport.cc.com/videos/45wqla/colbert-super-pac----corporations-are-people-",
"http://thecolbertreport.cc.com/videos/6s8sdq/colbert-super-pac----corporations-are-people----frank-luntz",
"http://thecolbertreport.cc.com/videos/5jjhhv/colbert-super-pac----corporations-are-people----frank-luntz-s-focus-group",
"http://thecolbertreport.cc.com/videos/541ucf/jon-huntsman",
"http://thecolbertreport.cc.com/videos/53t2yg/sign-off---goodnight"
],
"guest": "Jon Huntsman"
},
{
"date": "2011-10-25",
"videos": [
"http://thecolbertreport.cc.com/videos/s25oo4/intro---10-25-11",
"http://thecolbertreport.cc.com/videos/darfes/steve-jobs--biography",
"http://thecolbertreport.cc.com/videos/3uz7qn/herman-cain-s-campaign-ad",
"http://thecolbertreport.cc.com/videos/n2dzu0/flogging-the-americone-dream",
"http://thecolbertreport.cc.com/videos/wsqtx0/susan-saladoff",
"http://thecolbertreport.cc.com/videos/89ebii/sign-off---enjoying-americone-dream"
],
"guest": "Susan Saladoff"
},
{
"date": "2011-10-26",
"videos": [
"http://thecolbertreport.cc.com/videos/lj5z4k/colbert-super-pac-ad---ball-gag",
"http://thecolbertreport.cc.com/videos/xlwljf/exclusive---hey--remember-this--alabama-",
"http://thecolbertreport.cc.com/videos/fa0w0c/intro---10-26-11",
"http://thecolbertreport.cc.com/videos/zwe40u/whales-aren-t-people",
"http://thecolbertreport.cc.com/videos/7rtf6k/alabama-s-migrant-workers",
"http://thecolbertreport.cc.com/videos/dcq3ky/war-on-halloween---costume-swapping---jesus-ween",
"http://thecolbertreport.cc.com/videos/sqeewv/taylor-branch",
"http://thecolbertreport.cc.com/videos/6twlww/sign-off---don-t-buy-these-books"
],
"guest": "Taylor Branch"
},
{
"date": "2011-10-27",
"videos": [
"http://thecolbertreport.cc.com/videos/hfaq0j/intro---10-27-11",
"http://thecolbertreport.cc.com/videos/gmesd4/shockupy-wall-street-fad",
"http://thecolbertreport.cc.com/videos/xhn542/sport-report---nfl-fines---colbert-super-pac-s-second-nba-lockout-ad",
"http://thecolbertreport.cc.com/videos/s2ax4o/toby-keith"
],
"guest": "Toby Keith"
},
{
"date": "2011-10-31",
"videos": [
"http://thecolbertreport.cc.com/videos/l7lj84/sexy-costume-discrimination",
"http://thecolbertreport.cc.com/videos/0svkvx/colbert-super-pac---occupy-wall-street-co-optportunity",
"http://thecolbertreport.cc.com/videos/d4hmi3/colbert-super-pac---stephen-colbert-occupies-occupy-wall-street-pt--1",
"http://thecolbertreport.cc.com/videos/4tqlz9/tip-wag---gun-freedom---healthcare-bartering",
"http://thecolbertreport.cc.com/videos/n0jrmj/neil-macgregor",
"http://thecolbertreport.cc.com/videos/tyvfoe/sign-off---goodnight"
],
"guest": "Neil MacGregor"
},
{
"date": "2011-11-01",
"videos": [
"http://thecolbertreport.cc.com/videos/9346zn/intro---11-1-11",
"http://thecolbertreport.cc.com/videos/ysh9bq/herman-cain-under-attack",
"http://thecolbertreport.cc.com/videos/hqjgoz/colbert-super-pac---stephen-colbert-occupies-occupy-wall-street-pt--2",
"http://thecolbertreport.cc.com/videos/yo2avl/yo-yo-ma--stuart-duncan--edgar-meyer---chris-thile",
"http://thecolbertreport.cc.com/videos/pez22q/sign-off---goodnight"
],
"guest": "Yo-Yo Ma"
},
{
"date": "2011-11-02",
"videos": [
"http://thecolbertreport.cc.com/videos/394xx1/intro---11-2-11",
"http://thecolbertreport.cc.com/videos/n3ifbc/herman-cain-s-international-affairs",
"http://thecolbertreport.cc.com/videos/icx1x6/the-word---bite-the-hand-that-feeds-you",
"http://thecolbertreport.cc.com/videos/6dlo6v/muffingate",
"http://thecolbertreport.cc.com/videos/6jv4ha/michael-pollan",
"http://thecolbertreport.cc.com/videos/c8yk04/sign-off---white-castle---beer"
],
"guest": "Michael Pollan"
},
{
"date": "2011-11-03",
"videos": [
"http://thecolbertreport.cc.com/videos/db8sp6/intro---11-3-11",
"http://thecolbertreport.cc.com/videos/tvwydl/ghost-sex",
"http://thecolbertreport.cc.com/videos/gxg7x0/european-investment-prospectus",
"http://thecolbertreport.cc.com/videos/2nhcbh/colbert-super-pac---herman-cain-s-fundraising---rush-limbaugh-s-stereotypes",
"http://thecolbertreport.cc.com/videos/rwwdgv/nathan-wolfe",
"http://thecolbertreport.cc.com/videos/g7b66l/sign-off---purell"
],
"guest": "Nathan Wolfe"
},
{
"date": "2011-11-07",
"videos": [
"http://thecolbertreport.cc.com/videos/px6doe/colbert-super-pac---issue-ads",
"http://thecolbertreport.cc.com/videos/otywae/colbert-super-pac---issue-ads---trevor-potter",
"http://thecolbertreport.cc.com/videos/6nuhjw/blood-in-the-water---larry-taylor-s-anti-semitic-slur",
"http://thecolbertreport.cc.com/videos/xisem8/niall-ferguson",
"http://thecolbertreport.cc.com/videos/e9gc1y/sign-off---goodnight"
],
"guest": "Niall Ferguson"
},
{
"date": "2011-11-08",
"videos": [
"http://thecolbertreport.cc.com/videos/m4n0nh/herman-cain-won-t-be-stopped",
"http://thecolbertreport.cc.com/videos/yk540u/colbert-platinum---wealth-under-siege",
"http://thecolbertreport.cc.com/videos/3krrxg/the-blitzkrieg-on-grinchitude---fired-santa-claus---colbert-super-pac-christmas",
"http://thecolbertreport.cc.com/videos/s4sqap/seth-meyers",
"http://thecolbertreport.cc.com/videos/fz9les/sign-off---custom-escape-yacht"
],
"guest": "Seth Meyers"
},
{
"date": "2011-11-09",
"videos": [
"http://thecolbertreport.cc.com/videos/qc00ca/intro---11-9-11",
"http://thecolbertreport.cc.com/videos/gs7ppt/herman-cain-s-democrat-conspiracy",
"http://thecolbertreport.cc.com/videos/e94bhi/the-word---bully-pulpit",
"http://thecolbertreport.cc.com/videos/v1f4n3/americone-dream-of-the-future",
"http://thecolbertreport.cc.com/videos/3k5pcf/james-martin",
"http://thecolbertreport.cc.com/videos/9mrd4k/sign-off---feeding-jimmy-fallon-s-portrait"
],
"guest": "Father Jim Martin"
},
{
"date": "2011-11-10",
"videos": [
"http://thecolbertreport.cc.com/videos/qfc9xd/shock---aussie",
"http://thecolbertreport.cc.com/videos/pg0q9t/rick-perry-s-sorry--oops",
"http://thecolbertreport.cc.com/videos/g1tcu5/occupy-u-c--berkeley",
"http://thecolbertreport.cc.com/videos/4vt0hx/brian-eno"
],
"guest": "Brian Eno"
},
{
"date": "2011-11-14",
"videos": [
"http://thecolbertreport.cc.com/videos/ufww4s/intro---11-14-11",
"http://thecolbertreport.cc.com/videos/3zodum/cbs-snubs-michele-bachmann",
"http://thecolbertreport.cc.com/videos/5vb30b/keystone-xl-oil-pipeline---bill-mckibben",
"http://thecolbertreport.cc.com/videos/hu2y6t/vodka-tampons",
"http://thecolbertreport.cc.com/videos/uoo5c0/thomas-thwaites",
"http://thecolbertreport.cc.com/videos/9x16t1/sign-off---leaf-blower"
],
"guest": "Thomas Thwaites"
},
{
"date": "2011-11-15",
"videos": [
"http://thecolbertreport.cc.com/videos/c73ioe/occupy-wall-street-decamped",
"http://thecolbertreport.cc.com/videos/qzjgvi/difference-makers---jimmy-justice",
"http://thecolbertreport.cc.com/videos/ufsd5o/bears---balls---celebrity-relics---gooooooold-",
"http://thecolbertreport.cc.com/videos/f1tu06/elijah-wood",
"http://thecolbertreport.cc.com/videos/0vuu1j/sign-off---one-ring"
],
"guest": "Elijah Wood"
},
{
"date": "2011-11-16",
"videos": [
"http://thecolbertreport.cc.com/videos/znljdd/intro---11-16-11",
"http://thecolbertreport.cc.com/videos/ukaw6z/newt-gingrich-s-greek-cruise",
"http://thecolbertreport.cc.com/videos/6dwdiy/tip-wag---pin-ups-for-ron-paul--movie-torture-tactics---offensive-merchandise",
"http://thecolbertreport.cc.com/videos/z9qeks/elderly-occupier-pepper-sprayed",
"http://thecolbertreport.cc.com/videos/94gywl/chris-matthews",
"http://thecolbertreport.cc.com/videos/aekw8v/colbert-report-bedtime-stories---dragon---wizard"
],
"guest": "Chris Matthews"
},
{
"date": "2011-11-17",
"videos": [
"http://thecolbertreport.cc.com/videos/hnwps8/intro---11-17-11",
"http://thecolbertreport.cc.com/videos/41apq9/people-magazine-s-sexiest-man-alive-2011",
"http://thecolbertreport.cc.com/videos/wdsxo5/the-word---the-1-",
"http://thecolbertreport.cc.com/videos/h76098/thought-for-food---pushy-pops",
"http://thecolbertreport.cc.com/videos/y88hzi/susan-orlean",
"http://thecolbertreport.cc.com/videos/8d1q2a/sign-off---shout-out-to-the-black-belles"
],
"guest": "Susan Orlean"
},
{
"date": "2011-11-28",
"videos": [
"http://thecolbertreport.cc.com/videos/no4xhk/intro---11-28-11",
"http://thecolbertreport.cc.com/videos/58ikdq/violent-black-friday",
"http://thecolbertreport.cc.com/videos/h84vbf/tip-wag---barack-obama-s-omission--mitt-romney-s-ad---lululemon-s-tagline",
"http://thecolbertreport.cc.com/videos/qggo98/stephen-colbert-s-mereporters",
"http://thecolbertreport.cc.com/videos/ut1g77/siddhartha-mukherjee",
"http://thecolbertreport.cc.com/videos/np8x21/sign-off---macbook"
],
"guest": "Siddhartha Mukherjee"
},
{
"date": "2011-11-29",
"videos": [
"http://thecolbertreport.cc.com/videos/92ekqe/intro---11-29-11",
"http://thecolbertreport.cc.com/videos/fafzt9/he-said--she-said--she-said--she-said--she-said--she-was-paid-not-to-say",
"http://thecolbertreport.cc.com/videos/r8p3nn/yahweh-or-no-way---altered-catholic-mass--papal-seat-belt---offensive-vodka-ad",
"http://thecolbertreport.cc.com/videos/4dohxr/tinariwen-with-kyp-malone---tunde-adebimpe",
"http://thecolbertreport.cc.com/videos/9nbfru/sign-off---tinariwen--album"
],
"guest": "Tinariwen"
},
{
"date": "2011-11-30",
"videos": [
"http://thecolbertreport.cc.com/videos/fc3loc/newt-gingrich-denies-lobbying",
"http://thecolbertreport.cc.com/videos/akure9/barney-frank-s-retirement",
"http://thecolbertreport.cc.com/videos/d0x6zg/better-know-a-district---massachusetts--4th---barney-frank-update",
"http://thecolbertreport.cc.com/videos/j1oeb0/conservative-siri",
"http://thecolbertreport.cc.com/videos/okgz78/stephen-sondheim",
"http://thecolbertreport.cc.com/videos/ga76kd/sign-off---goodnight"
],
"guest": "Stephen Sondheim"
},
{
"date": "2011-12-01",
"videos": [
"http://thecolbertreport.cc.com/videos/eclhxy/in-herman-cain-s-defense",
"http://thecolbertreport.cc.com/videos/70sj7m/stop-online-piracy-act",
"http://thecolbertreport.cc.com/videos/nmrgz9/stop-online-piracy-act---danny-goldberg---jonathan-zittrain",
"http://thecolbertreport.cc.com/videos/pzi69s/mitt-romney-gets-testy",
"http://thecolbertreport.cc.com/videos/pmypbg/richard-branson",
"http://thecolbertreport.cc.com/videos/rhwqc7/sign-off---fire-extinguishing-powder"
],
"guest": "Richard Branson"
},
{
"date": "2011-12-05",
"videos": [
"http://thecolbertreport.cc.com/videos/yy5x27/2011-kennedy-center-honors",
"http://thecolbertreport.cc.com/videos/xn3r3g/mysteries-of-the-ancient-unknown---2012-end-of-times",
"http://thecolbertreport.cc.com/videos/f2zdhx/herman-cain-drops-out",
"http://thecolbertreport.cc.com/videos/dt8216/jimmie-johnson",
"http://thecolbertreport.cc.com/videos/0ewfq6/sign-off---slow-motion-race-replay"
],
"guest": "Jimmie Johnson"
},
{
"date": "2011-12-06",
"videos": [
"http://thecolbertreport.cc.com/videos/1o3huj/american-drone-in-iran",
"http://thecolbertreport.cc.com/videos/fcu2h2/donald-s-trumptacular---stephen-s-south-carolina-serious--classy-republican-debate",
"http://thecolbertreport.cc.com/videos/dphj6u/the-black-keys",
"http://thecolbertreport.cc.com/videos/4t05a5/sign-off---glenn-eichler-s-graphic-novel"
],
"guest": "The Black Keys"
},
{
"date": "2011-12-07",
"videos": [
"http://thecolbertreport.cc.com/videos/5kfnqe/stephen-colbert-s-south-carolina-serious--classy-republican-debate---save-the-date",
"http://thecolbertreport.cc.com/videos/h7qfup/colbert-super-pac---stephen-s-south-carolina-referendum",
"http://thecolbertreport.cc.com/videos/6dds1t/colbert-super-pac---stephen-s-south-carolina-referendum---dick-harpootlian",
"http://thecolbertreport.cc.com/videos/c66w64/jon-huntsman-sr--s-ad-buy",
"http://thecolbertreport.cc.com/videos/pueyvf/david-hallberg"
],
"guest": "David Hallberg"
},
{
"date": "2011-12-08",
"videos": [
"http://thecolbertreport.cc.com/videos/08g4y6/intro---12-8-11",
"http://thecolbertreport.cc.com/videos/sd4lua/michigan-s-snow-cone-machines",
"http://thecolbertreport.cc.com/videos/lbdchz/cheating-death---chicken-pox-lollipops---fecal-transplants",
"http://thecolbertreport.cc.com/videos/3d10i3/rick-perry-s-pro-christmas-ad",
"http://thecolbertreport.cc.com/videos/ovws10/jack-abramoff",
"http://thecolbertreport.cc.com/videos/gt2hau/sign-off---goodnight"
],
"guest": "Jack Abramoff"
},
{
"date": "2011-12-12",
"videos": [
"http://thecolbertreport.cc.com/videos/iu3gnx/intro---12-12-11",
"http://thecolbertreport.cc.com/videos/52a05g/christmas-cram",
"http://thecolbertreport.cc.com/videos/zuufyt/tip-wag---liberal-dictionary---newt-gingrich-alert",
"http://thecolbertreport.cc.com/videos/qv9fb0/norway-s-butter-shortage",
"http://thecolbertreport.cc.com/videos/kx2u80/samuel-l--jackson",
"http://thecolbertreport.cc.com/videos/v6sdfa/sign-off---merry-christmas"
],
"guest": "Samuel L. Jackson"
},
{
"date": "2011-12-13",
"videos": [
"http://thecolbertreport.cc.com/videos/rwb03h/intro---12-13-11",
"http://thecolbertreport.cc.com/videos/7zgxss/trump-s-cancellation---stephen-s-south-carolina-serious--classy-re-announcement",
"http://thecolbertreport.cc.com/videos/frhjj0/the-word---let-them-buy-cake",
"http://thecolbertreport.cc.com/videos/flxy99/anderson-cooper-s-phallus-party-accusation",
"http://thecolbertreport.cc.com/videos/sn7cpj/mark-whitaker",
"http://thecolbertreport.cc.com/videos/eswjdg/sign-off---goodnight"
],
"guest": "Mark Whitaker"
},
{
"date": "2011-12-14",
"videos": [
"http://thecolbertreport.cc.com/videos/18wgz1/stephen-colbert-s-south-carolina-serious--classy-debate---nat-geo-wild-s-response",
"http://thecolbertreport.cc.com/videos/khf3hx/christine-o-donnell-s-endorsement",
"http://thecolbertreport.cc.com/videos/vg9vdy/stephen-colbert-s-big-gay-roundup---military-bestiality---homosexual-penguins",
"http://thecolbertreport.cc.com/videos/qvom30/tv-hat",
"http://thecolbertreport.cc.com/videos/lqslc3/ray-odierno"
],
"guest": "Gen. Raymond Odierno"
},
{
"date": "2011-12-15",
"videos": [
"http://thecolbertreport.cc.com/videos/8900sr/stephen-colbert-s-south-carolina-serious--classy-republican-debate---network-battle",
"http://thecolbertreport.cc.com/videos/dwccb9/the-blitzkrieg-on-grinchitude---department-store-cutbacks---gun-filled-christmas",
"http://thecolbertreport.cc.com/videos/9ugow2/fox-news--mitt-romney-photo-flub",
"http://thecolbertreport.cc.com/videos/iqj0p8/daniel-craig",
"http://thecolbertreport.cc.com/videos/tri39n/2011-goodbye"
],
"guest": "Daniel Craig"
}
],
"2012": [
{
"date": "2012-01-03",
"videos": [
"http://thecolbertreport.cc.com/videos/9u9qx6/iowa-caucus-2012",
"http://thecolbertreport.cc.com/videos/yx6r23/iowa-caucus---caucus-goer-s-choice",
"http://thecolbertreport.cc.com/videos/5mqn59/iowa-caucus---megyn-shelly-s-prediction",
"http://thecolbertreport.cc.com/videos/qx2w8n/kim-jong-il---in-memoriam",
"http://thecolbertreport.cc.com/videos/ioguwl/bernie-sanders",
"http://thecolbertreport.cc.com/videos/4ob0g2/sign-off---megyn-shelly"
],
"guest": "Sen. Bernie Sanders"
},
{
"date": "2012-01-04",
"videos": [
"http://thecolbertreport.cc.com/videos/s8am6m/iowa-caucus---mitt-romney-s-victory-speech---rick-santorum-s-coup",
"http://thecolbertreport.cc.com/videos/m762nz/iowa-caucus---not-mitt-romney-s-super-pac",
"http://thecolbertreport.cc.com/videos/x195wh/iowa-caucus---cable-news-coverage",
"http://thecolbertreport.cc.com/videos/61k2nf/iowa-caucus---woi-in-des-moines-reports",
"http://thecolbertreport.cc.com/videos/1ja4vs/john-heilemann",
"http://thecolbertreport.cc.com/videos/xyq4st/sign-off---erin-burnett-pong"
],
"guest": "John Heilemann"
},
{
"date": "2012-01-05",
"videos": [
"http://thecolbertreport.cc.com/videos/8t37qs/intro---1-5-12",
"http://thecolbertreport.cc.com/videos/js72my/fun-rick-santorum",
"http://thecolbertreport.cc.com/videos/5xw4yi/the-word---catch-2012",
"http://thecolbertreport.cc.com/videos/sjbolu/god-s-message-to-pat-robertson",
"http://thecolbertreport.cc.com/videos/lgtesz/steve-case",
"http://thecolbertreport.cc.com/videos/o6dbzj/sign-off---mayan-headwear---sacrificial-chicken"
],
"guest": "Steve Case"
},
{
"date": "2012-01-09",
"videos": [
"http://thecolbertreport.cc.com/videos/y3wl1i/intro---1-9-12",
"http://thecolbertreport.cc.com/videos/3m6txc/new-hampshire-gop-debates",
"http://thecolbertreport.cc.com/videos/l08ywe/new-hampshire-gop-debates---moderate-extremes",
"http://thecolbertreport.cc.com/videos/75c0w9/rick-santorum-on-gay-parents---bla-people",
"http://thecolbertreport.cc.com/videos/e3zsob/melissa-harris-perry",
"http://thecolbertreport.cc.com/videos/j2sskk/sign-off---jack-daniels"
],
"guest": "Neil Shubin"
},
{
"date": "2012-01-10",
"videos": [
"http://thecolbertreport.cc.com/videos/9llvcg/new-hampshire-primary---mitt-romney-s-gaffe",
"http://thecolbertreport.cc.com/videos/m98f4t/tip-wag---irresponsible-dead-people---insensitive-papa-john-s",
"http://thecolbertreport.cc.com/videos/wwvi39/malice-in-blunderland",
"http://thecolbertreport.cc.com/videos/fqk2fh/bill-moyers",
"http://thecolbertreport.cc.com/videos/wdmkv8/sign-off---turntable"
],
"guest": "Ben Gibbard"
},
{
"date": "2012-01-11",
"videos": [
"http://thecolbertreport.cc.com/videos/bxzp6z/intro---1-11-12",
"http://thecolbertreport.cc.com/videos/f8j0ng/commitment-to-mitt-romney",
"http://thecolbertreport.cc.com/videos/7t7ct3/south-carolina-s-fresh-face",
"http://thecolbertreport.cc.com/videos/73ux63/stephen-colbert-s-end-of-the-world-of-the-week---phobos-grunt",
"http://thecolbertreport.cc.com/videos/wx04iy/george-stephanopoulos",
"http://thecolbertreport.cc.com/videos/vjhrm3/sign-off---decision-of-a-lifetime"
],
"guest": "George Stephanopoulos"
},
{
"date": "2012-01-12",
"videos": [
"http://thecolbertreport.cc.com/videos/hrwtsb/colbert-super-pac---coordination-problem",
"http://thecolbertreport.cc.com/videos/av6bvx/colbert-super-pac---coordination-resolution-with-jon-stewart",
"http://thecolbertreport.cc.com/videos/5otlsk/mike-d-s-hip-hop-semantics",
"http://thecolbertreport.cc.com/videos/ui35sv/mike-allen",
"http://thecolbertreport.cc.com/videos/mnp9up/sign-off---ipad-ebook"
],
"guest": "Mike Allen"
},
{
"date": "2012-01-16",
"videos": [
"http://thecolbertreport.cc.com/videos/dyktip/colbert-super-pac-ad---not-abel",
"http://thecolbertreport.cc.com/videos/lec1ln/intro---1-16-12",
"http://thecolbertreport.cc.com/videos/ke9tkw/jon-huntsman-out--rick-santorum-in",
"http://thecolbertreport.cc.com/videos/buf78z/colbert-super-pac---mitt-romney-attack-ad",
"http://thecolbertreport.cc.com/videos/uh4wcy/the-word---raise-cain",
"http://thecolbertreport.cc.com/videos/cgtb89/scott-douglas",
"http://thecolbertreport.cc.com/videos/td091t/sign-off----this-is-herman-cain--"
],
"guest": "Rev. Scott Douglas"
},
{
"date": "2012-01-17",
"videos": [
"http://thecolbertreport.cc.com/videos/knvkbe/colbert-super-pac-ad---double-negative",
"http://thecolbertreport.cc.com/videos/fe4nep/intro---1-17-12",
"http://thecolbertreport.cc.com/videos/ufvy9m/colbert-super-pac---gop-attack-ads---herman-cain-ad",
"http://thecolbertreport.cc.com/videos/qil57h/yahweh-or-no-way---online-christian-dating---seven-days-of-sex",
"http://thecolbertreport.cc.com/videos/0alvjc/jennifer-granholm",
"http://thecolbertreport.cc.com/videos/mbnjnn/sign-off---vote-for-herman-cain"
],
"guest": "Jennifer Granholm"
},
{
"date": "2012-01-18",
"videos": [
"http://thecolbertreport.cc.com/videos/bpbhtr/colbert-super-pac-ad---modern-stage-combat",
"http://thecolbertreport.cc.com/videos/2f7upq/intro---1-18-12",
"http://thecolbertreport.cc.com/videos/q6xocp/newt-gingrich-s-performance---mitt-romney-s-tax-returns",
"http://thecolbertreport.cc.com/videos/fx3xum/stephen-s-approval-rating",
"http://thecolbertreport.cc.com/videos/zvmmfs/colbert-super-pac---civility-ad---stephen-s-south-carolina-rally",
"http://thecolbertreport.cc.com/videos/orzoc4/sopa---pipa",
"http://thecolbertreport.cc.com/videos/i8qam3/david-frum",
"http://thecolbertreport.cc.com/videos/3mfkme/sign-off---south-carolina-rally-with-herman-cain"
],
"guest": "David Frum"
},
{
"date": "2012-01-19",
"videos": [
"http://thecolbertreport.cc.com/videos/pebyno/troubled-gop-waters---stephen-under-attack",
"http://thecolbertreport.cc.com/videos/7qvxgu/colbert-super-pac---john-paul-stevens",
"http://thecolbertreport.cc.com/videos/k3pbui/carrie-rebora-barratt",
"http://thecolbertreport.cc.com/videos/nno4x3/sign-off---flight-to-charleston--sc"
],
"guest": "Carrie Rebora Barratt"
},
{
"date": "2012-01-23",
"videos": [
"http://thecolbertreport.cc.com/videos/kachyg/intro---1-23-12",
"http://thecolbertreport.cc.com/videos/iql42n/newt-gingrich-s-south-carolina-kill",
"http://thecolbertreport.cc.com/videos/50z46i/herman-cain-s-bittersweet-south-carolina-victory",
"http://thecolbertreport.cc.com/videos/e3y9nd/rock-me-like-a-herman-cain-south-cain-olina-primary-rally---cain-elot-revisited",
"http://thecolbertreport.cc.com/videos/vim94y/bruce-bueno-de-mesquita",
"http://thecolbertreport.cc.com/videos/gu52h0/sign-off---sniffing-a-marker"
],
"guest": "Bruce Bueno De Mesquita"
},
{
"date": "2012-01-24",
"videos": [
"http://thecolbertreport.cc.com/videos/n2rnnr/exclusive---rock-me-like-a-herman-cain-south-cain-olina-primary-rally-pt--1",
"http://thecolbertreport.cc.com/videos/jc76hc/exclusive---rock-me-like-a-herman-cain-south-cain-olina-primary-rally-pt--2",
"http://thecolbertreport.cc.com/videos/jog4lt/intro---1-24-12",
"http://thecolbertreport.cc.com/videos/q3ro37/colbert-super-pac---hostage-crisis---day-2",
"http://thecolbertreport.cc.com/videos/zop8mz/18th-gop-debate",
"http://thecolbertreport.cc.com/videos/gzi3ec/grim-colberty-tales-with-maurice-sendak-pt--1",
"http://thecolbertreport.cc.com/videos/kg7hw1/rick-santorum-s-senior-pandering",
"http://thecolbertreport.cc.com/videos/381zai/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/14903e/sign-off---reading--bumble-ardy-"
],
"guest": "Andrew Sullivan"
},
{
"date": "2012-01-25",
"videos": [
"http://thecolbertreport.cc.com/videos/9f0foj/2012-state-of-the-union-address---gop-rebuttals",
"http://thecolbertreport.cc.com/videos/2uwi0i/grim-colberty-tales-with-maurice-sendak-pt--2",
"http://thecolbertreport.cc.com/videos/3un4zv/un-american-news---china-edition",
"http://thecolbertreport.cc.com/videos/kwuhk6/terry-gross",
"http://thecolbertreport.cc.com/videos/r2j6o1/sign-off---colonel-tuxedo-s-cat-food"
],
"guest": "Terry Gross"
},
{
"date": "2012-01-26",
"videos": [
"http://thecolbertreport.cc.com/videos/05qh1w/colbert-super-pac---hostage-crisis---day-4",
"http://thecolbertreport.cc.com/videos/5gcr8j/mitt-romney---newt-gingrich-in-florida",
"http://thecolbertreport.cc.com/videos/pudtpb/sean-hannity-s--the-great-american-panel-",
"http://thecolbertreport.cc.com/videos/y191mp/the-great-available-panel",
"http://thecolbertreport.cc.com/videos/sg6jkh/drew-barrymore",
"http://thecolbertreport.cc.com/videos/kk56ka/sign-off---football-throwing"
],
"guest": "Drew Barrymore"
},
{
"date": "2012-01-30",
"videos": [
"http://thecolbertreport.cc.com/videos/rcm539/colbert-super-pac---the-great-chase",
"http://thecolbertreport.cc.com/videos/1ws9v2/colbert-super-pac---return-of-the-pac",
"http://thecolbertreport.cc.com/videos/n3pkmh/threatdown---barack-obama--fundamentalist-flippers---coked-up-diplomats",
"http://thecolbertreport.cc.com/videos/tlfrhi/gop---the-hispanic-vote",
"http://thecolbertreport.cc.com/videos/amck6x/laurence-tribe",
"http://thecolbertreport.cc.com/videos/v9f5m2/sign-off---shouting-goodnight"
],
"guest": "Laurence H. Tribe"
},
{
"date": "2012-01-31",
"videos": [
"http://thecolbertreport.cc.com/videos/62pas5/intro---1-31-12",
"http://thecolbertreport.cc.com/videos/f44hch/newt-gingrich-s-supporters",
"http://thecolbertreport.cc.com/videos/udnnzi/the-word---american-history-x-d",
"http://thecolbertreport.cc.com/videos/qs311n/bjork",
"http://thecolbertreport.cc.com/videos/u7u9lh/sign-off----biophilia-"
],
"guest": "Bjork"
},
{
"date": "2012-02-01",
"videos": [
"http://thecolbertreport.cc.com/videos/yk5cpe/intro---2-1-12",
"http://thecolbertreport.cc.com/videos/o3p6c2/black-history-celebration-moment",
"http://thecolbertreport.cc.com/videos/3nohh2/mitt-romney-s-florida-victory",
"http://thecolbertreport.cc.com/videos/uswa0x/colbert-super-pac---americone-dream-super-pack",
"http://thecolbertreport.cc.com/videos/kqctrf/ameena-matthews",
"http://thecolbertreport.cc.com/videos/5m98im/sign-off---americone-dream-super-pack"
],
"guest": "Ameena Matthews"
},
{
"date": "2012-02-02",
"videos": [
"http://thecolbertreport.cc.com/videos/4dia59/intro---2-2-12",
"http://thecolbertreport.cc.com/videos/uu5zmj/the-meaning-of-groundhog-day",
"http://thecolbertreport.cc.com/videos/bwbr2v/america-s-biggest-super-pac-donors",
"http://thecolbertreport.cc.com/videos/lh3kq3/colbert-super-pac---thank-you",
"http://thecolbertreport.cc.com/videos/04ottd/survivor-sues-newt-gingrich---dave-bickler",
"http://thecolbertreport.cc.com/videos/a7r0zs/christiane-amanpour",
"http://thecolbertreport.cc.com/videos/uzu0lz/sign-off---goodnight"
],
"guest": "Christiane Amanpour"
},
{
"date": "2012-02-13",
"videos": [
"http://thecolbertreport.cc.com/videos/hhq4en/intro---2-13-12",
"http://thecolbertreport.cc.com/videos/2kynbu/linsanity-",
"http://thecolbertreport.cc.com/videos/hgxqxc/people-who-are-destroying-america---sawstop",
"http://thecolbertreport.cc.com/videos/ju995r/stephen-colbert-s-free-americone-dream-day",
"http://thecolbertreport.cc.com/videos/eks7za/bill-mckibben",
"http://thecolbertreport.cc.com/videos/k6qadu/sign-off---colbert-nation-newborn"
],
"guest": "Bill McKibben"
},
{
"date": "2012-02-14",
"videos": [
"http://thecolbertreport.cc.com/videos/u5h2yo/intro---2-14-12",
"http://thecolbertreport.cc.com/videos/3rk6lv/westminster-kennel-club-dog-show-2012",
"http://thecolbertreport.cc.com/videos/jx9ojl/contraception-crusade",
"http://thecolbertreport.cc.com/videos/lyzukj/tip-wag---gay-building-marriage---transportation-safety-board-cell-phone-ban",
"http://thecolbertreport.cc.com/videos/ej01p5/william-broad",
"http://thecolbertreport.cc.com/videos/mhuyjx/sign-off---stephen-s-friend-lou-dog"
],
"guest": "William Broad"
},
{
"date": "2012-02-20",
"videos": [
"http://thecolbertreport.cc.com/videos/f1ta15/intro---2-20-12",
"http://thecolbertreport.cc.com/videos/7ghzcu/mitt-romney---donald-trump-in-michigan",
"http://thecolbertreport.cc.com/videos/lydem1/rick-santorum-s-energy-war-alarm",
"http://thecolbertreport.cc.com/videos/tqad40/ann-patchett",
"http://thecolbertreport.cc.com/videos/qgsly5/sign-off---caught-looking"
],
"guest": "Ann Patchett"
},
{
"date": "2012-02-21",
"videos": [
"http://thecolbertreport.cc.com/videos/vdtnp9/intro---2-21-12",
"http://thecolbertreport.cc.com/videos/dgnc7d/douchebag-showdown",
"http://thecolbertreport.cc.com/videos/mnahgd/colbert-super-pac---nancy-pelosi-s-ad---barack-obama-s-super-pac",
"http://thecolbertreport.cc.com/videos/s0vtdx/robert-kagan",
"http://thecolbertreport.cc.com/videos/x36uyb/sign-off---dark-lord-of-the-sith"
],
"guest": "Robert Kagan"
},
{
"date": "2012-02-22",
"videos": [
"http://thecolbertreport.cc.com/videos/n05gam/intro---2-22-12",
"http://thecolbertreport.cc.com/videos/krghr1/stephen-s-lenten-sacrifice",
"http://thecolbertreport.cc.com/videos/dv9iqc/the-word---surrender-to-a-buyer-power",
"http://thecolbertreport.cc.com/videos/w2qw1t/better-know-a-district---california-s-8th",
"http://thecolbertreport.cc.com/videos/d6raxz/nancy-pelosi",
"http://thecolbertreport.cc.com/videos/9mdx7s/sign-off---conquistador-sacrifice"
],
"guest": "Rep. Nancy Pelosi"
},
{
"date": "2012-02-23",
"videos": [
"http://thecolbertreport.cc.com/videos/g3b2me/arizona-gop-debate",
"http://thecolbertreport.cc.com/videos/6wnf2j/posthumous-mormon-baptism",
"http://thecolbertreport.cc.com/videos/zzgfft/wheat-thins-sponsortunity",
"http://thecolbertreport.cc.com/videos/jshg47/placido-domingo"
],
"guest": "Placido Domingo"
},
{
"date": "2012-02-27",
"videos": [
"http://thecolbertreport.cc.com/videos/6llqzw/mitt-romney-s---rick-santorum-s-michigan-campaigns",
"http://thecolbertreport.cc.com/videos/45yrtw/peggielene-bartels",
"http://thecolbertreport.cc.com/videos/xr2dmf/sign-off---goodnight"
],
"guest": "Peggielene Bartels"
},
{
"date": "2012-02-28",
"videos": [
"http://thecolbertreport.cc.com/videos/l484x8/intro---2-28-12",
"http://thecolbertreport.cc.com/videos/b44eo3/the-colbert-report-s-1000th-show",
"http://thecolbertreport.cc.com/videos/hsyhov/rising-oil-prices---john-kilduff",
"http://thecolbertreport.cc.com/videos/gqa08a/mr--smith-goes-to-the-state-legislature--then-later-possibly-washington---bob-morris---kyle-jones",
"http://thecolbertreport.cc.com/videos/0xatad/ross-eisenbrey",
"http://thecolbertreport.cc.com/videos/8ebxgr/stephen-s-1000th-ticket"
],
"guest": "Ross Eisenbrey"
},
{
"date": "2012-02-29",
"videos": [
"http://thecolbertreport.cc.com/videos/ueosv6/intro---2-29-12",
"http://thecolbertreport.cc.com/videos/y0ejfo/countdown-to-loving-mitt",
"http://thecolbertreport.cc.com/videos/3dllp7/the-word---change-we-can-believe-in",
"http://thecolbertreport.cc.com/videos/3adb3i/tip-wag---kansas--male-birth-control-pill---new-york-s-babyccino",
"http://thecolbertreport.cc.com/videos/puth71/william-shatner",
"http://thecolbertreport.cc.com/videos/dhcxcx/sign-off---goodnight"
],
"guest": "William Shatner"
},
{
"date": "2012-03-01",
"videos": [
"http://thecolbertreport.cc.com/videos/ueosv6/intro---2-29-12",
"http://thecolbertreport.cc.com/videos/y0ejfo/countdown-to-loving-mitt",
"http://thecolbertreport.cc.com/videos/3dllp7/the-word---change-we-can-believe-in",
"http://thecolbertreport.cc.com/videos/3adb3i/tip-wag---kansas--male-birth-control-pill---new-york-s-babyccino",
"http://thecolbertreport.cc.com/videos/puth71/william-shatner",
"http://thecolbertreport.cc.com/videos/dhcxcx/sign-off---goodnight"
],
"guest": "Claire Danes"
},
{
"date": "2012-03-01",
"videos": [
"http://thecolbertreport.cc.com/videos/eolisf/countdown-to-loving-mitt---jeb-bush",
"http://thecolbertreport.cc.com/videos/bf1ekb/people-who-are-destroying-america---teachers",
"http://thecolbertreport.cc.com/videos/ncu1ti/mysteries-of-the-ancient-unknown---yo-mama-jokes",
"http://thecolbertreport.cc.com/videos/tw0ear/claire-danes",
"http://thecolbertreport.cc.com/videos/4gz8ak/sign-off---jeb-bush-s-portrait"
],
"guest": "Claire Danes"
},
{
"date": "2012-03-05",
"videos": [
"http://thecolbertreport.cc.com/videos/xceapv/countdown-to-loving-mitt---super-tuesday",
"http://thecolbertreport.cc.com/videos/29dn96/rush-limbaugh-apologizes-to-sandra-fluke",
"http://thecolbertreport.cc.com/videos/pww7ru/sport-report---pete-weber--danica-patrick---the-new-orleans-saints",
"http://thecolbertreport.cc.com/videos/nwk5lf/audra-mcdonald"
],
"guest": "Audra McDonald"
},
{
"date": "2012-03-06",
"videos": [
"http://thecolbertreport.cc.com/videos/4yvx5w/super-tuesday-party--putin-s-win---india-s-state-assembly",
"http://thecolbertreport.cc.com/videos/nzr8wl/the-word---due-or-die",
"http://thecolbertreport.cc.com/videos/rxyz0z/thought-for-food---responsible-snacking---second-breakfast",
"http://thecolbertreport.cc.com/videos/h24vfx/jonathan-safran-foer",
"http://thecolbertreport.cc.com/videos/em4ksp/sign-off---good-catch"
],
"guest": "Jonathan Safran Foer"
},
{
"date": "2012-03-07",
"videos": [
"http://thecolbertreport.cc.com/videos/i93vkc/intro---3-7-12",
"http://thecolbertreport.cc.com/videos/3df60s/higgs-boson-humor",
"http://thecolbertreport.cc.com/videos/y5rjly/countdown-to-loving-mitt---super-tuesday-results",
"http://thecolbertreport.cc.com/videos/7v4ikl/cyber-republican-convention",
"http://thecolbertreport.cc.com/videos/ciyqhs/iranian-irony-threat",
"http://thecolbertreport.cc.com/videos/060vqq/willem-dafoe",
"http://thecolbertreport.cc.com/videos/c0qp1t/sign-off---goodnight"
],
"guest": "Willem Dafoe"
},
{
"date": "2012-03-08",
"videos": [
"http://thecolbertreport.cc.com/videos/3nl0qx/eric-bolling-s-secret-gas-prices-plan",
"http://thecolbertreport.cc.com/videos/fig5ri/herman-cain-s-avant-garde-pac-ad"
],
"guest": "Don Fleming, Elvis Costello, Emmylou Harris"
},
{
"date": "2012-03-12",
"videos": [
"http://thecolbertreport.cc.com/videos/c4fdt8/daylight-savings-socialism",
"http://thecolbertreport.cc.com/videos/2v3qmo/republicans--southern-strategy",
"http://thecolbertreport.cc.com/videos/lo9wk9/republicans--southern-strategy---dave--mudcat--saunders",
"http://thecolbertreport.cc.com/videos/16w3vh/cheating-death---bacon-cure-for-nosebleeds---sound-wave-sterility",
"http://thecolbertreport.cc.com/videos/nmtsxp/katherine-boo",
"http://thecolbertreport.cc.com/videos/owkzk2/sign-off---goodnight-with-a-smile"
],
"guest": "Katherine Boo"
},
{
"date": "2012-03-13",
"videos": [
"http://thecolbertreport.cc.com/videos/bz7jdm/who-s-not-honoring-me-now----seattle-s-pop-conference",
"http://thecolbertreport.cc.com/videos/qn0q26/threatdown---stoned-pat-robertson--muslim-american-reality-tv---pampered-bears",
"http://thecolbertreport.cc.com/videos/h98570/republican-southern-primary---simplified-speeches",
"http://thecolbertreport.cc.com/videos/msz5qh/andrew-bird"
],
"guest": "Andrew Bird"
},
{
"date": "2012-03-14",
"videos": [
"http://thecolbertreport.cc.com/videos/m77cwc/greg-smith-s-goldman-sachs-op-ed",
"http://thecolbertreport.cc.com/videos/rwxeui/republican-southern-primary---rick-santorum-against-teleprompters",
"http://thecolbertreport.cc.com/videos/yeczkv/republican-southern-primary---kermit-the-frog",
"http://thecolbertreport.cc.com/videos/7n8gsd/monkey-on-the-lam---alabama",
"http://thecolbertreport.cc.com/videos/zkum1o/mark-mckinnon",
"http://thecolbertreport.cc.com/videos/d8t6uu/sign-off---goodnight"
],
"guest": "Mark McKinnon"
},
{
"date": "2012-03-15",
"videos": [
"http://thecolbertreport.cc.com/videos/eq8308/airport-security-for-senior-citizens",
"http://thecolbertreport.cc.com/videos/zjy3q9/rush-limbaugh-loses-more-sponsors",
"http://thecolbertreport.cc.com/videos/krx9gw/rick-santorum-visits-puerto-rico-and-speaks-from-his-heart",
"http://thecolbertreport.cc.com/videos/vh5p5b/ireland-s-imported-sperm---ethnically-accurate-headgear",
"http://thecolbertreport.cc.com/videos/8o29gb/dexter-filkins",
"http://thecolbertreport.cc.com/videos/e66q9g/sign-off---goodnight"
],
"guest": "Dexter Filkins"
},
{
"date": "2012-03-26",
"videos": [
"http://thecolbertreport.cc.com/videos/no5p1a/exclusive---david-page-extended-interview",
"http://thecolbertreport.cc.com/videos/a8lnqt/intro---3-26-12",
"http://thecolbertreport.cc.com/videos/3ejcul/stephen-s-spring-break",
"http://thecolbertreport.cc.com/videos/008ndt/the-word---dressed-to-kill",
"http://thecolbertreport.cc.com/videos/7faawr/mitt-romney-etch-a-sketch-comparison",
"http://thecolbertreport.cc.com/videos/rc1xqe/david-page",
"http://thecolbertreport.cc.com/videos/20xgt7/sign-off---goodnight"
],
"guest": "Dr. David Page"
},
{
"date": "2012-03-27",
"videos": [
"http://thecolbertreport.cc.com/videos/rk3w4e/intro---3-27-12",
"http://thecolbertreport.cc.com/videos/cua8o6/barack-obama-gun-control-conspiracy",
"http://thecolbertreport.cc.com/videos/ykhpki/tip-wag---anti-prejudice-drug---dick-cheney-s-heart",
"http://thecolbertreport.cc.com/videos/53yh09/thought-for-food---tacocopter",
"http://thecolbertreport.cc.com/videos/ghn5jt/charles-murray",
"http://thecolbertreport.cc.com/videos/y9plha/sign-off---goodnight"
],
"guest": "Charles Murray"
},
{
"date": "2012-03-28",
"videos": [
"http://thecolbertreport.cc.com/videos/lg7nrp/the-supreme-court-weighs-in-on-obamacare",
"http://thecolbertreport.cc.com/videos/svf90k/the-supreme-court-weighs-in-on-obamacare---emily-bazelon",
"http://thecolbertreport.cc.com/videos/tnvz1z/the-conservative-teen",
"http://thecolbertreport.cc.com/videos/bmkpwj/mark-ruffalo",
"http://thecolbertreport.cc.com/videos/jjebsm/sign-off---goodnight-snack"
],
"guest": "Mark Ruffalo"
},
{
"date": "2012-03-29",
"videos": [
"http://thecolbertreport.cc.com/videos/7erwuh/stephen-offers-colbert-super-pac-super-fun-pack",
"http://thecolbertreport.cc.com/videos/9bgxui/intro---3-29-12",
"http://thecolbertreport.cc.com/videos/nuvo4m/the-mega-millions-lottery",
"http://thecolbertreport.cc.com/videos/7qagdx/colbert-super-pac---texan-supporters---super-fun-pack",
"http://thecolbertreport.cc.com/videos/2m6prp/mitt-romney-tells-a-funny-story",
"http://thecolbertreport.cc.com/videos/7dpy0t/peter-beinart",
"http://thecolbertreport.cc.com/videos/r5oifs/sign-off---colbert-super-pac-super-fun-pack"
],
"guest": "Peter Beinart"
},
{
"date": "2012-04-02",
"videos": [
"http://thecolbertreport.cc.com/videos/8f8tya/intro---4-2-12",
"http://thecolbertreport.cc.com/videos/1nq1ce/colbert-super-pac---super-fun-pack-treasure-hunt",
"http://thecolbertreport.cc.com/videos/1bsxs9/the-beefstate-governors",
"http://thecolbertreport.cc.com/videos/fmif88/yahweh-or-no-way---christian-card-counters--pope-benedict-on-marxism---pope-cologne",
"http://thecolbertreport.cc.com/videos/5yl006/gary-johnson",
"http://thecolbertreport.cc.com/videos/77h3h1/sign-off---goodnight"
],
"guest": "Gov. Gary Johnson"
},
{
"date": "2012-04-03",
"videos": [
"http://thecolbertreport.cc.com/videos/33j3ar/lftb-colbology",
"http://thecolbertreport.cc.com/videos/z52jo4/colbert-super-pac---super-fun-pack-not-legal-advice---certificate-of-presidenthood",
"http://thecolbertreport.cc.com/videos/v3p6ss/colbert-super-pac-shh----501c4-disclosure",
"http://thecolbertreport.cc.com/videos/ag45p1/colbert-super-pac-shh----501c4-disclosure---trevor-potter",
"http://thecolbertreport.cc.com/videos/y4berw/rick-santorum-speaks-from-his-heart---california-colleges",
"http://thecolbertreport.cc.com/videos/1b9vpb/nikki-haley",
"http://thecolbertreport.cc.com/videos/asl5su/sign-off---helmeted-ham-rove"
],
"guest": "Gov. Nikki Haley"
},
{
"date": "2012-04-04",
"videos": [
"http://thecolbertreport.cc.com/videos/2ihe55/intro---4-4-12",
"http://thecolbertreport.cc.com/videos/6y1ct4/peabody-award-for-colbert-super-pac",
"http://thecolbertreport.cc.com/videos/4io3p9/settling-for-mitt-romney",
"http://thecolbertreport.cc.com/videos/x8e4ps/colbert-super-pac---republicans---the-latino-vote",
"http://thecolbertreport.cc.com/videos/6ml3sk/wilford-brimley-calls---quaker-oats-makeover",
"http://thecolbertreport.cc.com/videos/plj4a3/robert-ballard",
"http://thecolbertreport.cc.com/videos/qyyf0b/sign-off---second-peabody-award"
],
"guest": "Robert D. Ballard"
},
{
"date": "2012-04-05",
"videos": [
"http://thecolbertreport.cc.com/videos/om9vmg/bad-news-about-good-unemployment-news",
"http://thecolbertreport.cc.com/videos/lnmh56/colbert-s-very-wanted---manatee-mailbox",
"http://thecolbertreport.cc.com/videos/0u9fik/dirt-bike-badass-in-the-lincoln-tunnel",
"http://thecolbertreport.cc.com/videos/ji5xxu/anne-rice",
"http://thecolbertreport.cc.com/videos/si0xcn/sign-off---lincoln-tunnel"
],
"guest": "Anne Rice"
},
{
"date": "2012-04-09",
"videos": [
"http://thecolbertreport.cc.com/videos/8ziziz/easter-under-attack---bunny-vs--bilby",
"http://thecolbertreport.cc.com/videos/oyaen8/searching-for-mr--right---mitt-romney---iowa-s-steve-king",
"http://thecolbertreport.cc.com/videos/csp74m/stephen-colbert-s-shame-spiral---senior-citizen-gymnasts",
"http://thecolbertreport.cc.com/videos/kruk2j/bob-lutz",
"http://thecolbertreport.cc.com/videos/9wc34u/sign-off---remembering-mike-wallace"
],
"guest": "Bob Lutz"
},
{
"date": "2012-04-10",
"videos": [
"http://thecolbertreport.cc.com/videos/2n6qw1/intro---4-10-12",
"http://thecolbertreport.cc.com/videos/82ub2z/rick-santorum-leaves-presidential-race",
"http://thecolbertreport.cc.com/videos/qu7492/i-got-the-tweets-like-grassley",
"http://thecolbertreport.cc.com/videos/3la5nh/tip-wag---coal-industry-crackdown---box-spring-bunker",
"http://thecolbertreport.cc.com/videos/mfxyfn/stephen-colbert-s-lady-heroes---glen-grothman",
"http://thecolbertreport.cc.com/videos/o4ah40/richard-hersh",
"http://thecolbertreport.cc.com/videos/es5mrc/sign-off---goodnight"
],
"guest": "Richard Hersh"
},
{
"date": "2012-04-11",
"videos": [
"http://thecolbertreport.cc.com/videos/3ygjj0/amped-up-for-michelle-obama",
"http://thecolbertreport.cc.com/videos/bc3gqm/the-word---whuh-how-",
"http://thecolbertreport.cc.com/videos/ingur1/employing-a-veteran---sergeant-bryan-escobedo",
"http://thecolbertreport.cc.com/videos/f8r4k5/michelle-obama-pt--1",
"http://thecolbertreport.cc.com/videos/v3wlgc/michelle-obama-pt--2",
"http://thecolbertreport.cc.com/videos/u0cci1/sign-off---goodnight"
],
"guest": "Michelle Obama"
},
{
"date": "2012-04-12",
"videos": [
"http://thecolbertreport.cc.com/videos/pzrkzg/intro---4-12-12",
"http://thecolbertreport.cc.com/videos/m5gmsh/the-other-war-on-women",
"http://thecolbertreport.cc.com/videos/v73czf/stephen-colbert-s-end-of-the-world-of-the-week---survivalist-singles---tsunami-food",
"http://thecolbertreport.cc.com/videos/s55d89/cold-war-update---alleged-congressional-communists",
"http://thecolbertreport.cc.com/videos/x9epzo/james-cameron",
"http://thecolbertreport.cc.com/videos/avonwu/sign-off---goodnight"
],
"guest": "James Cameron"
},
{
"date": "2012-04-16",
"videos": [
"http://thecolbertreport.cc.com/videos/z2fjas/a-beautiful-war-for-women-segment",
"http://thecolbertreport.cc.com/videos/2ixpov/secret-service-sex-scandal",
"http://thecolbertreport.cc.com/videos/ilt6wv/a-beautiful-war-for-women",
"http://thecolbertreport.cc.com/videos/44j8wl/newt-gingrich---gun-rights",
"http://thecolbertreport.cc.com/videos/ru5vnr/bonnie-raitt"
],
"guest": "Bonnie Raitt"
},
{
"date": "2012-04-17",
"videos": [
"http://thecolbertreport.cc.com/videos/wpng4g/intro---4-17-12",
"http://thecolbertreport.cc.com/videos/gxlf9b/mitt-romney-s-dinner-table-pranks",
"http://thecolbertreport.cc.com/videos/sfsf06/thought-for-food---bug-food-coloring--hot-dog-stuffed-crust---drugged-poultry",
"http://thecolbertreport.cc.com/videos/vklngm/gsa-spending-scandal",
"http://thecolbertreport.cc.com/videos/6fhp9q/jonah-lehrer",
"http://thecolbertreport.cc.com/videos/culsks/sign-off---goodnight"
],
"guest": "Jonah Lehrer"
},
{
"date": "2012-04-18",
"videos": [
"http://thecolbertreport.cc.com/videos/q3i7x8/intro---4-18-12",
"http://thecolbertreport.cc.com/videos/ddq41n/searching-for-mr--right---mitt-romney---ohio-s-rob-portman",
"http://thecolbertreport.cc.com/videos/er0kn7/the-word---gateway-hug",
"http://thecolbertreport.cc.com/videos/vw1qdm/stephen-colbert-s-end-of-the-world-of-the-week---doomsday-preppers",
"http://thecolbertreport.cc.com/videos/xzzk73/arianna-huffington",
"http://thecolbertreport.cc.com/videos/tttdob/sign-off---goodnight-kiss"
],
"guest": "Arianna Huffington"
},
{
"date": "2012-04-19",
"videos": [
"http://thecolbertreport.cc.com/videos/hrfl05/intro---4-19-12",
"http://thecolbertreport.cc.com/videos/a9n2pr/stephen-s-4-20-message",
"http://thecolbertreport.cc.com/videos/zdgaqc/alpha-dog-of-the-week---cory-booker",
"http://thecolbertreport.cc.com/videos/nb2ksl/the-enemy-within---bologna-border-bust",
"http://thecolbertreport.cc.com/videos/uio9bo/time-s-2012-top-100-most-influential",
"http://thecolbertreport.cc.com/videos/h2p67e/tavis-smiley---cornel-west",
"http://thecolbertreport.cc.com/videos/g291q8/sign-off---time-s-top-100"
],
"guest": "Tavis Smiley & Cornel West"
},
{
"date": "2012-04-23",
"videos": [
"http://thecolbertreport.cc.com/videos/4wypj5/intro---4-23-12",
"http://thecolbertreport.cc.com/videos/m8blpo/steve-doocy-s-silver-spoon-subtext-reporting",
"http://thecolbertreport.cc.com/videos/2gwl1y/tip-wag--pheromone-parties---arizona-s--pre-life--laws",
"http://thecolbertreport.cc.com/videos/v2y3wl/mitt-romney-s-picnic-gaffe",
"http://thecolbertreport.cc.com/videos/14wyxm/don-mcleroy",
"http://thecolbertreport.cc.com/videos/l9d2q6/sign-off---goodnight"
],
"guest": "Don McLeroy"
},
{
"date": "2012-04-24",
"videos": [
"http://thecolbertreport.cc.com/videos/ly3so2/super-tuesday-ii--election-boogaloo---death-match-in-hellaware",
"http://thecolbertreport.cc.com/videos/xmivrq/-i-am-a-pole--and-so-can-you---",
"http://thecolbertreport.cc.com/videos/i4eh7r/canada-s-currency-coup",
"http://thecolbertreport.cc.com/videos/ycnifi/magnus-carlsen",
"http://thecolbertreport.cc.com/videos/cfkek7/sign-off---ipad"
],
"guest": "Magnus Carlsen"
},
{
"date": "2012-04-25",
"videos": [
"http://thecolbertreport.cc.com/videos/et0kro/intro---4-25-12",
"http://thecolbertreport.cc.com/videos/or4jr5/nasa-retires-discovery---drops-spacebook",
"http://thecolbertreport.cc.com/videos/6xkuod/the-word---united-we-can-t-stand-them",
"http://thecolbertreport.cc.com/videos/gi36k3/cheating-death---crash-diet-feeding-tubes---scrotum-gel-injections",
"http://thecolbertreport.cc.com/videos/88pieq/michael-sandel",
"http://thecolbertreport.cc.com/videos/wduflz/sign-off---goodnight"
],
"guest": "Michael Sandel"
},
{
"date": "2012-04-26",
"videos": [
"http://thecolbertreport.cc.com/videos/xrzvpm/intro---4-26-12",
"http://thecolbertreport.cc.com/videos/9rs6oa/barack-obama-s-slow-jam-backlash",
"http://thecolbertreport.cc.com/videos/2w9amu/colbert-super-pac---super-fun-pack-1st-treasure-hunt-clue",
"http://thecolbertreport.cc.com/videos/1ytfce/jack-white",
"http://thecolbertreport.cc.com/videos/kymj2z/sign-off---montclair-film-festival"
],
"guest": "Jack White"
},
{
"date": "2012-04-30",
"videos": [
"http://thecolbertreport.cc.com/videos/l8r5un/intro---4-30-12",
"http://thecolbertreport.cc.com/videos/u2x3gk/delicate-advice-for-chen-guangcheng",
"http://thecolbertreport.cc.com/videos/g6gv3q/the-word---don-t-ask--don-t-show---tell",
"http://thecolbertreport.cc.com/videos/z2rpip/concealing-weapons-in-style",
"http://thecolbertreport.cc.com/videos/csg3jo/diane-keaton",
"http://thecolbertreport.cc.com/videos/tly3vi/sign-off---stephen-s-fashionable-firearm"
],
"guest": "Diane Keaton"
},
{
"date": "2012-05-01",
"videos": [
"http://thecolbertreport.cc.com/videos/8gt820/intro---5-1-12",
"http://thecolbertreport.cc.com/videos/pktymf/barack-obama---the-anniversary-of-bin-laden-s-assassination",
"http://thecolbertreport.cc.com/videos/0zj7f4/paul-ryan-s-christian-budget-cuts",
"http://thecolbertreport.cc.com/videos/7af7jl/paul-ryan-s-christian-budget-cuts---thomas-reese",
"http://thecolbertreport.cc.com/videos/cpb2np/carne-ross",
"http://thecolbertreport.cc.com/videos/a9ioqx/sign-off---goodnight"
],
"guest": "Carne Ross"
},
{
"date": "2012-05-02",
"videos": [
"http://thecolbertreport.cc.com/videos/jciyto/intro---5-2-12",
"http://thecolbertreport.cc.com/videos/n232ru/richard-branson-shaped-ice-cubes",
"http://thecolbertreport.cc.com/videos/goj2h9/the-word---debt-panels",
"http://thecolbertreport.cc.com/videos/sv3iag/kermit-the-frog-s-german-tv-offense---hans-beinholtz",
"http://thecolbertreport.cc.com/videos/luw0ia/jonathan-haidt",
"http://thecolbertreport.cc.com/videos/k7vmo6/sign-off---stephen-colbert-s-6000k-norway-norwalkathon"
],
"guest": "Jonathan Haidt"
},
{
"date": "2012-05-03",
"videos": [
"http://thecolbertreport.cc.com/videos/msaxn6/newt-gingrich---mitt-romney-alliance-analogies",
"http://thecolbertreport.cc.com/videos/eki0dc/colbert-super-pac---in-search-of-mr--larose",
"http://thecolbertreport.cc.com/videos/2v2ixr/who-s-honoring-me-now----national-space-society---buzz-aldrin",
"http://thecolbertreport.cc.com/videos/z3ac6o/lena-dunham",
"http://thecolbertreport.cc.com/videos/1iw8uv/sign-off---2012-space-pioneer-award-for-mass-media"
],
"guest": "Lena Dunham"
},
{
"date": "2012-05-07",
"videos": [
"http://thecolbertreport.cc.com/videos/1jhhu2/uncensored---maurice-sendak-tribute----i-am-a-pole--and-so-can-you----release",
"http://thecolbertreport.cc.com/videos/feswk7/intro---5-7-12",
"http://thecolbertreport.cc.com/videos/d6nh6o/hand-disinfectant-drunk-teens",
"http://thecolbertreport.cc.com/videos/d69ur0/joe-biden-s-same-sex-marriage-gaffe",
"http://thecolbertreport.cc.com/videos/fplvtb/-pussy-hound--with-eric-mccormack",
"http://thecolbertreport.cc.com/videos/jrnml0/threatdown---newscasting-bears",
"http://thecolbertreport.cc.com/videos/u65qci/andy-cohen",
"http://thecolbertreport.cc.com/videos/xh5269/sign-off---sound-effects-box"
],
"guest": "Andy Cohen"
},
{
"date": "2012-05-08",
"videos": [
"http://thecolbertreport.cc.com/videos/p05t1b/colbert-super-pac-shh----corporate-campaign-players---super-secret--spooky-pacs-",
"http://thecolbertreport.cc.com/videos/b2tfg8/anonymous-attack-ads---claire-mccaskill",
"http://thecolbertreport.cc.com/videos/ad10bn/michelle-alexander",
"http://thecolbertreport.cc.com/videos/dsprai/sign-off----i-am-a-pole--and-so-can-you---"
],
"guest": "Michelle Alexander"
},
{
"date": "2012-05-09",
"videos": [
"http://thecolbertreport.cc.com/videos/v1k3ci/mexico-s-debate-playmate",
"http://thecolbertreport.cc.com/videos/b6tiga/barack-obama-vs--north-carolina-on-gay-marriage",
"http://thecolbertreport.cc.com/videos/t3omhb/jon-mcnaughton-s--nation-under-socialism--artwork",
"http://thecolbertreport.cc.com/videos/o2c49w/anna-wintour",
"http://thecolbertreport.cc.com/videos/bogip6/sign-off----i-am-a-pole--and-so-can-you----audiobook"
],
"guest": "Anna Wintour"
},
{
"date": "2012-05-10",
"videos": [
"http://thecolbertreport.cc.com/videos/6cwgo2/intro---5-10-12",
"http://thecolbertreport.cc.com/videos/7lnqh4/mother-s-day-shout-out",
"http://thecolbertreport.cc.com/videos/n27g4x/barack-obama-s-gay-blasphemy",
"http://thecolbertreport.cc.com/videos/b9m4e5/threatdown---interdimensional-black-people--gay-strokes---manipulative-sicko-monkeys",
"http://thecolbertreport.cc.com/videos/ytlc6i/wisconsin-s-fake-democrats",
"http://thecolbertreport.cc.com/videos/v6gyoh/francis-collins",
"http://thecolbertreport.cc.com/videos/vbl44w/sign-off---two-weeks-off---dry-roasted-peanuts"
],
"guest": "Dr. Francis Collins"
},
{
"date": "2012-05-29",
"videos": [
"http://thecolbertreport.cc.com/videos/hx8ph7/intro---5-29-12",
"http://thecolbertreport.cc.com/videos/cpgg7x/who-s-honoring-me-now----peabody-awards---maxim-s-hot-100",
"http://thecolbertreport.cc.com/videos/oo0mhd/donald-trump-s-creative-truth---mitt-romney-s-poll-numbers",
"http://thecolbertreport.cc.com/videos/cw4fxf/un-american-news---egypt-s-presidential-elections",
"http://thecolbertreport.cc.com/videos/32y78g/charlize-theron",
"http://thecolbertreport.cc.com/videos/gr0i67/sign-off---goodnight"
],
"guest": "Charlize Theron"
},
{
"date": "2012-05-30",
"videos": [
"http://thecolbertreport.cc.com/videos/u7h1f8/intro---5-30-12",
"http://thecolbertreport.cc.com/videos/kydmtj/mexico-s-drug---potato-chip-wars",
"http://thecolbertreport.cc.com/videos/s73hgy/robert-mugabe-s-u-n--tourism-tribute",
"http://thecolbertreport.cc.com/videos/dfm2k1/alan-alda",
"http://thecolbertreport.cc.com/videos/b6lw83/sign-off---stephen-s-matchbox"
],
"guest": "Alan Alda"
},
{
"date": "2012-05-31",
"videos": [
"http://thecolbertreport.cc.com/videos/y3bfh6/buy-best-selling--i-am-a-pole--and-so-can-you---",
"http://thecolbertreport.cc.com/videos/sib2qy/barack-obama-s-righteous-drone-strikes",
"http://thecolbertreport.cc.com/videos/s3t2y6/the-word---two-birds-with-one-drone",
"http://thecolbertreport.cc.com/videos/pufh72/michael-bloomberg-s-super-sized-soda-scheme",
"http://thecolbertreport.cc.com/videos/pz3adl/jack-hitt",
"http://thecolbertreport.cc.com/videos/e9e1b2/sign-off---welcome-baby-gwinn-"
],
"guest": "Jack Hitt"
},
{
"date": "2012-06-04",
"videos": [
"http://thecolbertreport.cc.com/videos/nhsal8/juvenile-speeches-from-congress---president-sparkle-talk",
"http://thecolbertreport.cc.com/videos/w6itwj/the-word---sink-or-swim",
"http://thecolbertreport.cc.com/videos/r7x6me/better-know-a-district---represent-o-map-6000---georgia-s-5th",
"http://thecolbertreport.cc.com/videos/cx6fmy/john-lewis",
"http://thecolbertreport.cc.com/videos/5u46bt/sign-off---goodnight"
],
"guest": "Rep. John Lewis"
},
{
"date": "2012-06-05",
"videos": [
"http://thecolbertreport.cc.com/videos/lg5ugg/intro---6-5-12",
"http://thecolbertreport.cc.com/videos/xt64qc/cdc-zombie-apocalypse-statement",
"http://thecolbertreport.cc.com/videos/w4utag/tip-wag---japanese-diet-goggles--u-s--sperm-exports---taxidermied-toys",
"http://thecolbertreport.cc.com/videos/kkce78/self-marriage-problems",
"http://thecolbertreport.cc.com/videos/90ifev/jill-biden",
"http://thecolbertreport.cc.com/videos/hhgz9k/sign-off---goodnight"
],
"guest": "Jill Biden"
},
{
"date": "2012-06-06",
"videos": [
"http://thecolbertreport.cc.com/videos/ta5d10/transit-of-venus---mars-reality-show-pitch",
"http://thecolbertreport.cc.com/videos/y1zpiy/wisconsin-s-recall-results",
"http://thecolbertreport.cc.com/videos/0vve8r/difference-makers---larry-johnson",
"http://thecolbertreport.cc.com/videos/pqv8yf/neil-patrick-harris",
"http://thecolbertreport.cc.com/videos/1n5kn0/sign-off---ray-bradbury-tribute"
],
"guest": "Neil Patrick Harris"
},
{
"date": "2012-06-07",
"videos": [
"http://thecolbertreport.cc.com/videos/2l9h7f/intro---6-7-12",
"http://thecolbertreport.cc.com/videos/n107py/corruption-on-pakistan-s--sesame-street-",
"http://thecolbertreport.cc.com/videos/5zzgas/the-new-york-times--hit-job-on-mitt-romney",
"http://thecolbertreport.cc.com/videos/mlqu18/a-teacup-pig---partisan-politics",
"http://thecolbertreport.cc.com/videos/gfpnqx/regina-spektor",
"http://thecolbertreport.cc.com/videos/8x9qre/colbert-super-pac---super-fun-pack-treasure-hunt-clue"
],
"guest": "Regina Spektor"
},
{
"date": "2012-06-11",
"videos": [
"http://thecolbertreport.cc.com/videos/8zxgdh/neil-degrasse-tyson-on--prometheus--gaffe",
"http://thecolbertreport.cc.com/videos/4dkvt6/radical-feminist-nuns",
"http://thecolbertreport.cc.com/videos/u1f5qa/radical-feminist-nuns---simone-campbell",
"http://thecolbertreport.cc.com/videos/beuiqq/-banana-bunker--tutorial",
"http://thecolbertreport.cc.com/videos/0lbz7s/martin-sheen",
"http://thecolbertreport.cc.com/videos/h1jqol/sign-off---wooden-ruler"
],
"guest": "Martin Sheen"
},
{
"date": "2012-06-12",
"videos": [
"http://thecolbertreport.cc.com/videos/syl8av/intro---6-12-12",
"http://thecolbertreport.cc.com/videos/4p817x/mitt-romney-s-blue-collar-equestrian-pastime",
"http://thecolbertreport.cc.com/videos/nu56lh/barack-obama-s-anti-terror-leaks",
"http://thecolbertreport.cc.com/videos/dfjz7v/barack-obama-s-jobs-gaffe---mitt-romney-s-courageous-comeback",
"http://thecolbertreport.cc.com/videos/e4m68b/operation-artificial-swedener",
"http://thecolbertreport.cc.com/videos/eici19/will-allen",
"http://thecolbertreport.cc.com/videos/uaovz2/sign-off---stephen-s-equestrian-display"
],
"guest": "Will Allen"
},
{
"date": "2012-06-13",
"videos": [
"http://thecolbertreport.cc.com/videos/f93cwg/high-wire-walk-over-niagara-falls",
"http://thecolbertreport.cc.com/videos/e61ypw/the-word---free-lunch",
"http://thecolbertreport.cc.com/videos/clm6h7/the-enemy-within---apes-armed-with-ipads",
"http://thecolbertreport.cc.com/videos/0nbwzv/gregg-allman",
"http://thecolbertreport.cc.com/videos/0bcb4l/sign-off---goodnight"
],
"guest": "Gregg Allman"
},
{
"date": "2012-06-14",
"videos": [
"http://thecolbertreport.cc.com/videos/wdhef3/marijuana-legalization-as-election-hot-button-issue",
"http://thecolbertreport.cc.com/videos/zy2va1/super-pac-super-cash---24-hour-political-ad-channels",
"http://thecolbertreport.cc.com/videos/a5uuwa/cheating-death---penis-curvature-cures---single-women-sleep-aids",
"http://thecolbertreport.cc.com/videos/jylspq/steve-coll",
"http://thecolbertreport.cc.com/videos/nw9c2r/sign-off---bon-voyage--peter-gwinn"
],
"guest": "Steve Coll"
},
{
"date": "2012-06-18",
"videos": [
"http://thecolbertreport.cc.com/videos/34ngb2/intro---6-18-12",
"http://thecolbertreport.cc.com/videos/c3nu3d/barack-obama-s-immigration-policy-change",
"http://thecolbertreport.cc.com/videos/z9bjae/press-interruption-at-barack-obama-s-immigration-address",
"http://thecolbertreport.cc.com/videos/f3coxy/operation-artificial-swedener---sweden-s-response",
"http://thecolbertreport.cc.com/videos/x4uwku/paul-krugman",
"http://thecolbertreport.cc.com/videos/fdw0ht/sign-off---goodnight"
],
"guest": "Paul Krugman"
},
{
"date": "2012-06-19",
"videos": [
"http://thecolbertreport.cc.com/videos/0r91gj/john-kerry-as-mitt-romney-in-debate-prep",
"http://thecolbertreport.cc.com/videos/zxypkl/mitt-romney-s-champion-horse---dressage-tribute",
"http://thecolbertreport.cc.com/videos/ugscr4/unscooped-dog-poop-crimes",
"http://thecolbertreport.cc.com/videos/xdevam/olivia-wilde",
"http://thecolbertreport.cc.com/videos/kada0a/sign-off---stephen-s-dressage-dance"
],
"guest": "Olivia Wilde"
},
{
"date": "2012-06-20",
"videos": [
"http://thecolbertreport.cc.com/videos/6q5qvo/intro---6-20-12",
"http://thecolbertreport.cc.com/videos/w6vibi/asian-immigration-threat",
"http://thecolbertreport.cc.com/videos/95tn0n/unraveling-the-operation-fast---furious-scandal",
"http://thecolbertreport.cc.com/videos/b65og2/joe-the-plumber-s-controversial-gun-control-ad",
"http://thecolbertreport.cc.com/videos/4h0l60/thought-for-food---doritos-tacos---flavorlopes",
"http://thecolbertreport.cc.com/videos/lwb6am/daniel-klaidman",
"http://thecolbertreport.cc.com/videos/31ptzz/sign-off---goodnight"
],
"guest": "Daniel Klaidman"
},
{
"date": "2012-06-21",
"videos": [
"http://thecolbertreport.cc.com/videos/7r29kf/egypt-s-presidential-election---hosni-mubarak-s-health",
"http://thecolbertreport.cc.com/videos/zdprqc/threatdown---sicko-penguins--stoner-babies---terrorist-furniture",
"http://thecolbertreport.cc.com/videos/5yjil8/operation-artificial-swedener---c-mon-sweden--take-a-chance-on-stephen",
"http://thecolbertreport.cc.com/videos/e6ik9l/lawrence-krauss",
"http://thecolbertreport.cc.com/videos/e8ivor/sign-off----a-universe-from-nothing-"
],
"guest": "Lawrence Krauss"
},
{
"date": "2012-06-25",
"videos": [
"http://thecolbertreport.cc.com/videos/ylc1ta/intro---6-25-12",
"http://thecolbertreport.cc.com/videos/cbsvdk/colbert-news-alert---obamacare-supreme-court-ruling",
"http://thecolbertreport.cc.com/videos/wn3vzl/colbert-news-alert---obamacare-supreme-court-ruling---richard-mourdock-s-responses",
"http://thecolbertreport.cc.com/videos/1nhpf3/the-word---silver-maligning",
"http://thecolbertreport.cc.com/videos/0u5f3i/i-s-on-edjukashun---study-drugs",
"http://thecolbertreport.cc.com/videos/2q2di6/frank-deford",
"http://thecolbertreport.cc.com/videos/wri423/sign-off---five-finger-fillet"
],
"guest": "Frank Deford"
},
{
"date": "2012-06-26",
"videos": [
"http://thecolbertreport.cc.com/videos/ifbnsf/intro---6-26-12",
"http://thecolbertreport.cc.com/videos/8wlx7c/supreme-court-ruling-on-arizona-immigration-policy",
"http://thecolbertreport.cc.com/videos/06bwvh/tip-wag---pixar-s-gay-agenda--america-s-obesity---adidas-shackle-sneakers",
"http://thecolbertreport.cc.com/videos/ohfzqq/dish-network-s-autohop-service",
"http://thecolbertreport.cc.com/videos/r8iy26/richard-ford",
"http://thecolbertreport.cc.com/videos/ybvbi1/sign-off---goodnight"
],
"guest": "Richard Ford"
},
{
"date": "2012-06-27",
"videos": [
"http://thecolbertreport.cc.com/videos/g8onr9/colbert-super-pac-treasure-hunt-solution",
"http://thecolbertreport.cc.com/videos/gl54n8/mitt-romney-s-victory-retreat---democrats--convention-deficit",
"http://thecolbertreport.cc.com/videos/t2x64z/national-geographic-poll-on-alien-invasion-management",
"http://thecolbertreport.cc.com/videos/td6pu4/blood-in-the-water---mike-turzai-s-voter-id-remarks",
"http://thecolbertreport.cc.com/videos/5em8r3/rainbow-stuffed-gay-pride-oreo",
"http://thecolbertreport.cc.com/videos/aj465n/melinda-gates",
"http://thecolbertreport.cc.com/videos/bxvxkj/sign-off---oreo-cookie-plate"
],
"guest": "Melinda Gates"
},
{
"date": "2012-06-28",
"videos": [
"http://thecolbertreport.cc.com/videos/coii6k/cable-news-gaffe-on-obamacare-supreme-court-ruling",
"http://thecolbertreport.cc.com/videos/p7wwtp/john-roberts--obamacare-swing-vote",
"http://thecolbertreport.cc.com/videos/n5b9bc/obamacare---the-broccoli-argument",
"http://thecolbertreport.cc.com/videos/xqmuun/obamacare---the-broccoli-argument---emily-bazelon",
"http://thecolbertreport.cc.com/videos/843q05/aaron-sorkin",
"http://thecolbertreport.cc.com/videos/hdpyh9/colbert-super-pac---super-fun-pack-treasure-finder"
],
"guest": "Aaron Sorkin"
},
{
"date": "2012-07-16",
"videos": [
"http://thecolbertreport.cc.com/videos/rkamql/intro---7-16-12",
"http://thecolbertreport.cc.com/videos/nw0ci8/tomkat-s-divorce---anderson-cooper-s-sexual-orientation",
"http://thecolbertreport.cc.com/videos/xmrkal/mitt-romney-s-retroactive-retirement-from-bain-capital",
"http://thecolbertreport.cc.com/videos/hs3epw/thought-for-food---caffeine-edition---funeral-home-starbucks---car-coffee-makers",
"http://thecolbertreport.cc.com/videos/gxb8p4/anne-marie-slaughter",
"http://thecolbertreport.cc.com/videos/nj5kky/sign-off---smiles-or-whatever"
],
"guest": "Anne-Marie Slaughter"
},
{
"date": "2012-07-17",
"videos": [
"http://thecolbertreport.cc.com/videos/5r1yvx/nevada-s--none-of-the-above--is-fearsome-foe-for-gop",
"http://thecolbertreport.cc.com/videos/577ry9/the-word---on-the-straight---narrow-minded",
"http://thecolbertreport.cc.com/videos/xrrg9u/who-s-honoring-me-now----philadelphia-s-rosenbach-museum-and-library",
"http://thecolbertreport.cc.com/videos/8qe1km/nas"
],
"guest": "Nas"
},
{
"date": "2012-07-18",
"videos": [
"http://thecolbertreport.cc.com/videos/xiottz/intro---7-18-12",
"http://thecolbertreport.cc.com/videos/jhpgom/-struggling--waiters---waitresses-at-mitt-romney-s-fundraiser",
"http://thecolbertreport.cc.com/videos/40x15i/tip-wag---christian-tablet-computer---rock-paper-scissors-robot",
"http://thecolbertreport.cc.com/videos/5qgquz/stephen-colbert-s-metunes---def-leppard-s--forgeries--of-old-hits",
"http://thecolbertreport.cc.com/videos/67w2nh/annise-parker",
"http://thecolbertreport.cc.com/videos/2wz88p/sign-off---goodnight"
],
"guest": "Mayor Annise D. Parker"
},
{
"date": "2012-07-19",
"videos": [
"http://thecolbertreport.cc.com/videos/h8wtk8/fred-willard-arrested-for-lewd-conduct",
"http://thecolbertreport.cc.com/videos/64cfhk/libor-interest-rate-scandal",
"http://thecolbertreport.cc.com/videos/7dpxne/libor-interest-rate-scandal---dave-leonhardt",
"http://thecolbertreport.cc.com/videos/uknspr/canada-s-economic-growth-despite-melting-currency",
"http://thecolbertreport.cc.com/videos/xfd2bp/lisa-jackson",
"http://thecolbertreport.cc.com/videos/iw4bs9/sign-off---goodnight"
],
"guest": "Lisa Jackson"
},
{
"date": "2012-07-23",
"videos": [
"http://thecolbertreport.cc.com/videos/imdi3o/intro---7-23-12",
"http://thecolbertreport.cc.com/videos/0xmom4/interview-no-show--mike-tyson",
"http://thecolbertreport.cc.com/videos/v7f1z0/shepard-smith-s-personal-reporting-style",
"http://thecolbertreport.cc.com/videos/p2oill/partisan-speculation-over-colorado-shooter",
"http://thecolbertreport.cc.com/videos/3cxwny/vikram-gandhi",
"http://thecolbertreport.cc.com/videos/rwkf73/sign-off---goodnight"
],
"guest": "Vikram Gandhi"
},
{
"date": "2012-07-24",
"videos": [
"http://thecolbertreport.cc.com/videos/knsr5h/intro---7-24-12",
"http://thecolbertreport.cc.com/videos/h74nmb/hamster-study-links-late-night-tv-with-depression",
"http://thecolbertreport.cc.com/videos/zxif76/u-s--agriculture---drought-disaster",
"http://thecolbertreport.cc.com/videos/x2crx4/u-s--agriculture---drought-disaster---bruce-babcock",
"http://thecolbertreport.cc.com/videos/bov9or/james-fallows",
"http://thecolbertreport.cc.com/videos/lpy9h0/sign-off---goodnight"
],
"guest": "James Fallows"
},
{
"date": "2012-07-25",
"videos": [
"http://thecolbertreport.cc.com/videos/0mcg76/mitt-romney-s-anglo-saxon-connection",
"http://thecolbertreport.cc.com/videos/w5w9pn/mitt-romney-vs--barack-obama-on-small-business-owners",
"http://thecolbertreport.cc.com/videos/x14yw9/the-word---1-man-show",
"http://thecolbertreport.cc.com/videos/f7r40e/bibles-swapped-for--fifty-shades-of-grey-",
"http://thecolbertreport.cc.com/videos/4414pc/dan-gross",
"http://thecolbertreport.cc.com/videos/e1brl1/sign-off---goodnight"
],
"guest": "Dan Gross"
},
{
"date": "2012-07-26",
"videos": [
"http://thecolbertreport.cc.com/videos/vqlxb2/intro---7-26-12",
"http://thecolbertreport.cc.com/videos/4fk2ow/sport-report---stephen-colbefrajilympic-expealacoverage-",
"http://thecolbertreport.cc.com/videos/kycpil/mitt-romney-s-london-olympics-blunder",
"http://thecolbertreport.cc.com/videos/lra5ae/chick-fil-a-s-anti-gay-marriage-announcement",
"http://thecolbertreport.cc.com/videos/4nngh8/peter-westmacott",
"http://thecolbertreport.cc.com/videos/ccwpvt/sign-off---colbert-nation-twins"
],
"guest": "Amb. Peter Westmacott"
},
{
"date": "2012-07-30",
"videos": [
"http://thecolbertreport.cc.com/videos/70ka18/mitt-romney-s-disinterest-in-dressage",
"http://thecolbertreport.cc.com/videos/lav3uh/stephen-s-dressage-training-pt--1",
"http://thecolbertreport.cc.com/videos/zdpacy/tony-robbins--signature-firewalk",
"http://thecolbertreport.cc.com/videos/554xm8/joan-rivers",
"http://thecolbertreport.cc.com/videos/d69lls/sign-off----i-hate-everyone----starting-with-me-"
],
"guest": "Joan Rivers"
},
{
"date": "2012-07-31",
"videos": [
"http://thecolbertreport.cc.com/videos/d1pkf4/intro---7-31-12",
"http://thecolbertreport.cc.com/videos/sbevip/rick-gorka-s-press-outburst-in-poland",
"http://thecolbertreport.cc.com/videos/8qmv9k/rafalca-s-impact-on-mitt-romney-s-vp-pick",
"http://thecolbertreport.cc.com/videos/f5vsty/stephen-s-dressage-training-pt--2",
"http://thecolbertreport.cc.com/videos/lfsrga/stephest-colbchella--012---rocktaugustfest",
"http://thecolbertreport.cc.com/videos/p9ejfs/jeff-koons",
"http://thecolbertreport.cc.com/videos/e0ikf9/sign-off---goodnight"
],
"guest": "Jeff Koons"
},
{
"date": "2012-08-01",
"videos": [
"http://thecolbertreport.cc.com/videos/fjidln/obama-administration-s-birth-control-mandate",
"http://thecolbertreport.cc.com/videos/llkyw5/the--fiscal-cliff--conundrum---grover-norquist-s-tax-pledge",
"http://thecolbertreport.cc.com/videos/u1lf6f/sport-report---stephen-colbefrajilympic-expealacoverage----gymnastics---swimming",
"http://thecolbertreport.cc.com/videos/gayfdj/john-grunsfeld",
"http://thecolbertreport.cc.com/videos/gwa2y4/sign-off---totem"
],
"guest": "John Grunsfeld"
},
{
"date": "2012-08-02",
"videos": [
"http://thecolbertreport.cc.com/videos/x1we2u/exclusive---better-know-a-district---missouri-s-3rd-or-1st---russ-carnahan",
"http://thecolbertreport.cc.com/videos/3wx6bt/rafalca-s-first-day-of-dressage",
"http://thecolbertreport.cc.com/videos/ql0bqa/nancy-pelosi-s-bkad-pact---the-disclose-act-filibuster",
"http://thecolbertreport.cc.com/videos/tdj576/better-know-a-district---missouri-s-3rd-or-1st---russ-carnahan",
"http://thecolbertreport.cc.com/videos/t85slm/thought-for-food---usda-meatless-mondays---plant-communication-research",
"http://thecolbertreport.cc.com/videos/fyzakp/chris-hayes",
"http://thecolbertreport.cc.com/videos/m1idm3/sign-off---carrot-nibble"
],
"guest": "Chris Hayes"
},
{
"date": "2012-08-06",
"videos": [
"http://thecolbertreport.cc.com/videos/kz6vda/intro---8-6-12",
"http://thecolbertreport.cc.com/videos/h9qt0r/mars-rover-landing",
"http://thecolbertreport.cc.com/videos/w2s6c0/chick-fil-a-appreciation-day",
"http://thecolbertreport.cc.com/videos/x7yc4w/pete-seeger",
"http://thecolbertreport.cc.com/videos/aj407y/sign-off----pete-seeger--in-his-own-words-"
],
"guest": "Pete Seeger"
},
{
"date": "2012-08-07",
"videos": [
"http://thecolbertreport.cc.com/videos/1vt8t5/sport-report---stephen-colbefrajilympic-expealacoverage----soft-anti-americanism",
"http://thecolbertreport.cc.com/videos/k4260i/mitt-romney-s-protective-press-pool---running-mate-clues",
"http://thecolbertreport.cc.com/videos/q82dz5/steve-king-s-dogfighting-defense",
"http://thecolbertreport.cc.com/videos/nlroaz/mark-shriver",
"http://thecolbertreport.cc.com/videos/jx7y7x/sign-off---goodnight"
],
"guest": "Mark Shriver"
},
{
"date": "2012-08-08",
"videos": [
"http://thecolbertreport.cc.com/videos/23mkh8/intro---8-8-12",
"http://thecolbertreport.cc.com/videos/4fqxvr/obamacare---pizza-costs",
"http://thecolbertreport.cc.com/videos/h3tu8s/cheating-death---sensor-enabled-pills---facelift-bungee-cords",
"http://thecolbertreport.cc.com/videos/zgmish/liza-mundy",
"http://thecolbertreport.cc.com/videos/d5p8ok/sign-off---vacsa-strap"
],
"guest": "Liza Mundy"
},
{
"date": "2012-08-09",
"videos": [
"http://thecolbertreport.cc.com/videos/8gpwtc/anti-muslim-attack-on-hillary-clinton-aide",
"http://thecolbertreport.cc.com/videos/sr618c/better-know-a-district---minnesota-s-5th---keith-ellison",
"http://thecolbertreport.cc.com/videos/zzeqj6/who-s-honoring-me-now----psychonomic-bulletin---review",
"http://thecolbertreport.cc.com/videos/i891sf/woody-harrelson",
"http://thecolbertreport.cc.com/videos/nynu71/sign-off---goodnight"
],
"guest": "Woody Harrelson"
},
{
"date": "2012-08-13",
"videos": [
"http://thecolbertreport.cc.com/videos/d4650t/stephest-colbchella--012---welcome-to-rocktaugustfest",
"http://thecolbertreport.cc.com/videos/6jv3cb/mitt-romney-s-bold-running-mate-pick",
"http://thecolbertreport.cc.com/videos/wk9zh3/stephest-colbchella--012---fun-",
"http://thecolbertreport.cc.com/videos/r9jxwl/sign-off---stephest-colbchella--012---t-mobile-goodnight"
],
"guest": "Fun."
},
{
"date": "2012-08-14",
"videos": [
"http://thecolbertreport.cc.com/videos/9sxdgp/stephest-colbchella--012---rocktaugustfest-night-two",
"http://thecolbertreport.cc.com/videos/ovgwtm/mitt-romney-s---paul-ryan-s-foreign-policy-credentials",
"http://thecolbertreport.cc.com/videos/ajslu2/-stars-earn-stripes--reality-series",
"http://thecolbertreport.cc.com/videos/4uk1xx/stephest-colbchella--012---grizzly-bear",
"http://thecolbertreport.cc.com/videos/1eoihc/sign-off---stephest-colbchella--012---t-mobile-goodnight-auditions"
],
"guest": "Grizzly Bear"
},
{
"date": "2012-08-15",
"videos": [
"http://thecolbertreport.cc.com/videos/jus7dh/exclusive---stephest-colbchella--012---concert-setup-timelapse",
"http://thecolbertreport.cc.com/videos/lkqb8i/stephest-colbchella--012---rocktaugustfest-night-three",
"http://thecolbertreport.cc.com/videos/iwgkv9/fierce-five-interns",
"http://thecolbertreport.cc.com/videos/tzk5xz/stephest-colbchella--012---intrepid-sea--air---space-museum",
"http://thecolbertreport.cc.com/videos/buxzdm/stephest-colbchella--012---santigold",
"http://thecolbertreport.cc.com/videos/891lvk/sign-off---stephest-colbchella--012---t-mobile-goodnight-with-grandmaster-flash"
],
"guest": "The U.S. Women's Olympic Gymnastics team, Santigold"
},
{
"date": "2012-08-16",
"videos": [
"http://thecolbertreport.cc.com/videos/bx6qnh/stephest-colbchella--012---rocktaugustfest-night-four",
"http://thecolbertreport.cc.com/videos/tgqk3o/mitt-romney---paul-ryan---the-dynam-ish-duo",
"http://thecolbertreport.cc.com/videos/ymbqe6/17th-amendment-under-attack",
"http://thecolbertreport.cc.com/videos/x5cie8/stephest-colbchella--012---wayne-coyne",
"http://thecolbertreport.cc.com/videos/ez1hov/sign-off---stephest-colbchella--012---t-mobile-goodnight-in-a-bubble"
],
"guest": "The Flaming Lips"
},
{
"date": "2012-08-28",
"videos": [
"http://thecolbertreport.cc.com/videos/z0q2d6/hurricane-isaac-at-gop-convention",
"http://thecolbertreport.cc.com/videos/2a1lg4/colbert-super-pac---hurricane-isaac---stephen-s-money-convention",
"http://thecolbertreport.cc.com/videos/kcyg86/todd-akin-s-abortion-gaffe",
"http://thecolbertreport.cc.com/videos/2f1kwv/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/qomrph/sign-off---goodnight"
],
"guest": "Andrew Sullivan"
},
{
"date": "2012-08-29",
"videos": [
"http://thecolbertreport.cc.com/videos/ane28t/america-strikes-back---episode-ii---return-of-the-america-strikes-back--again",
"http://thecolbertreport.cc.com/videos/std0vn/the-mitt-romney-story",
"http://thecolbertreport.cc.com/videos/3teieb/the-mitt-romney-story---ann-romney-s-gop-convention-speech",
"http://thecolbertreport.cc.com/videos/w1ej3a/mitt-romney-s-role-model",
"http://thecolbertreport.cc.com/videos/n7yuw7/ayn-rand---paul-ryan",
"http://thecolbertreport.cc.com/videos/v0fegj/jennifer-burns",
"http://thecolbertreport.cc.com/videos/gxzmx3/sign-off---goodnight"
],
"guest": "Jennifer Burns"
},
{
"date": "2012-08-30",
"videos": [
"http://thecolbertreport.cc.com/videos/0pjdyn/america-strikes-back---episode-iii---the-phantom-money",
"http://thecolbertreport.cc.com/videos/7543m5/the-gop-convention---mitt-romney-s-minority-appeal",
"http://thecolbertreport.cc.com/videos/vo7txi/paul-ryan-s-misleading-gop-convention-speech",
"http://thecolbertreport.cc.com/videos/ghjrfh/jon-huntsman-pt--1",
"http://thecolbertreport.cc.com/videos/93jjo7/jon-huntsman-pt--2",
"http://thecolbertreport.cc.com/videos/vi4rti/sign-off---goodnight"
],
"guest": "Jon Huntsman"
},
{
"date": "2012-08-31",
"videos": [
"http://thecolbertreport.cc.com/videos/x9yoif/america-strikes-back---episode-iv---a-new-ish-hope",
"http://thecolbertreport.cc.com/videos/9czru3/mitt-romney-s--solid--gop-convention-speech",
"http://thecolbertreport.cc.com/videos/spqhue/the-gop-convention-s-mystery-speaker",
"http://thecolbertreport.cc.com/videos/qrijg7/the-gop-convention-s-mystery-speaker---clint-eastwood-s-chair",
"http://thecolbertreport.cc.com/videos/cx5s7v/neil-armstrong-tribute",
"http://thecolbertreport.cc.com/videos/n0qmbf/james-carville",
"http://thecolbertreport.cc.com/videos/2cv31s/sign-off---goodnight"
],
"guest": "James Carville"
},
{
"date": "2012-09-04",
"videos": [
"http://thecolbertreport.cc.com/videos/r83jxh/exclusive---better-know-a-district---new-york-s-9th---yvette-clarke",
"http://thecolbertreport.cc.com/videos/mxucyy/the-2012-people-s-party-congress-of-charlotte",
"http://thecolbertreport.cc.com/videos/bg56qn/better-know-a-district---new-york-s-9th---yvette-clarke",
"http://thecolbertreport.cc.com/videos/cy97ce/paul-ryan-s-marathon-time-gaffe",
"http://thecolbertreport.cc.com/videos/stj7xj/reihan-salam",
"http://thecolbertreport.cc.com/videos/awwi1z/sign-off---goodnight"
],
"guest": "Reihan Salam"
},
{
"date": "2012-09-05",
"videos": [
"http://thecolbertreport.cc.com/videos/4axjsp/the-2012-people-s-party-congress-of-charlotte---sound-system",
"http://thecolbertreport.cc.com/videos/lnxbm7/the-2012-people-s-party-congress-of-charlotte---michelle-obama---tammy-duckworth",
"http://thecolbertreport.cc.com/videos/zp0jy0/the-2012-people-s-party-congress-of-charlotte---michelle-obama-s-speech-tweets",
"http://thecolbertreport.cc.com/videos/75ubcv/sport-report---nfl-referee-lockout",
"http://thecolbertreport.cc.com/videos/fjhhan/michael-grunwald",
"http://thecolbertreport.cc.com/videos/05j0ux/sign-off---goodnight"
],
"guest": "Michael Grunwald"
},
{
"date": "2012-09-06",
"videos": [
"http://thecolbertreport.cc.com/videos/vf84g8/the-2012-people-s-party-congress-of-charlotte---avoiding-water-gate--day-1",
"http://thecolbertreport.cc.com/videos/qfodha/the-2012-people-s-party-congress-of-charlotte---bill-clinton---hill-poll",
"http://thecolbertreport.cc.com/videos/p7kw6y/the-2012-people-s-party-congress-of-charlotte---god---jerusalem",
"http://thecolbertreport.cc.com/videos/epwrup/bill-richardson",
"http://thecolbertreport.cc.com/videos/8ivg8l/sign-off---taco-plate"
],
"guest": "Bill Richardson"
},
{
"date": "2012-09-07",
"videos": [
"http://thecolbertreport.cc.com/videos/9wdqkq/the-2012-people-s-party-congress-of-charlotte---youth-vote",
"http://thecolbertreport.cc.com/videos/cr72mv/the-2012-people-s-party-congress-of-charlotte---tom-brokaw---barack-obama",
"http://thecolbertreport.cc.com/videos/l9ys9b/rnc-convention-vs--dnc-convention",
"http://thecolbertreport.cc.com/videos/6oqr0u/the-2012-people-s-party-congress-of-charlotte---colbert-bump",
"http://thecolbertreport.cc.com/videos/oq50sl/ed-rendell",
"http://thecolbertreport.cc.com/videos/fbd0do/sign-off---goodnight"
],
"guest": "Ed Rendell"
},
{
"date": "2012-09-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ohliey/intro---9-17-12",
"http://thecolbertreport.cc.com/videos/q2ib3a/values-voter-summit-gaffe",
"http://thecolbertreport.cc.com/videos/kelspo/mitt-romney-s-libya-comments",
"http://thecolbertreport.cc.com/videos/liknzb/atone-phone---ira-glass-calls",
"http://thecolbertreport.cc.com/videos/454q6n/drew-faust",
"http://thecolbertreport.cc.com/videos/lh4d2v/sign-off---shofar"
],
"guest": "Drew Faust"
},
{
"date": "2012-09-18",
"videos": [
"http://thecolbertreport.cc.com/videos/v7w7w3/intro---9-18-12",
"http://thecolbertreport.cc.com/videos/53lqfp/logo-makeover-for-usa-today",
"http://thecolbertreport.cc.com/videos/dsvsbf/mitt-romney-s-secret-video",
"http://thecolbertreport.cc.com/videos/m021ol/tip-wag---apple-samsung-lawsuit---tabloid-clash",
"http://thecolbertreport.cc.com/videos/ni1t1w/jeffrey-toobin",
"http://thecolbertreport.cc.com/videos/qteu69/sign-off---shrimp-toss"
],
"guest": "Jeffrey Toobin"
},
{
"date": "2012-09-19",
"videos": [
"http://thecolbertreport.cc.com/videos/8pu5um/intro---9-19-12",
"http://thecolbertreport.cc.com/videos/yf80jg/mitt-romney-s---barack-obama-s-secret-videos",
"http://thecolbertreport.cc.com/videos/rdsd7t/the-word---ask-not",
"http://thecolbertreport.cc.com/videos/4yfsux/wife-of-jesus",
"http://thecolbertreport.cc.com/videos/3vyhzj/itzhak-perlman"
],
"guest": "Itzhak Perlman"
},
{
"date": "2012-09-20",
"videos": [
"http://thecolbertreport.cc.com/videos/8f3t3h/vladimir-putin-s-crane-flight",
"http://thecolbertreport.cc.com/videos/asy3gz/mitt-romney-s-hispanic-outreach",
"http://thecolbertreport.cc.com/videos/3f13ot/mitt-romney-s-hispanic-outreach---esteban-colberto",
"http://thecolbertreport.cc.com/videos/2ufg9n/alpha-dog-of-the-week---cecilia-gimenez",
"http://thecolbertreport.cc.com/videos/nxad9d/errol-morris",
"http://thecolbertreport.cc.com/videos/sbgok9/sign-off---ask-o-matic"
],
"guest": "Errol Morris"
},
{
"date": "2012-09-25",
"videos": [
"http://thecolbertreport.cc.com/videos/kke43t/intro---9-25-12",
"http://thecolbertreport.cc.com/videos/ahsdxc/mitt-romney-s-airplane-window-gaffe",
"http://thecolbertreport.cc.com/videos/495xja/national-journal-poll",
"http://thecolbertreport.cc.com/videos/9vebvz/-rolling-calamity--campaign----america-again--preview",
"http://thecolbertreport.cc.com/videos/vk8jsq/sport-report---nfl-referee-lockout---replacement-refs---ratings",
"http://thecolbertreport.cc.com/videos/1my2a8/claressa-shields",
"http://thecolbertreport.cc.com/videos/n6n3t7/sign-off----america-again-"
],
"guest": "Claressa Shields"
},
{
"date": "2012-09-26",
"videos": [
"http://thecolbertreport.cc.com/videos/dfrukr/intro---9-26-12",
"http://thecolbertreport.cc.com/videos/diooyo/yom-kippur---aporkalypse",
"http://thecolbertreport.cc.com/videos/pnhcq0/obama-s-ottoman-empire",
"http://thecolbertreport.cc.com/videos/kzi40s/40-days-to-save-america",
"http://thecolbertreport.cc.com/videos/lsl385/jim-holt",
"http://thecolbertreport.cc.com/videos/jwctvx/sign-off---turkish-delight"
],
"guest": "Jim Holt"
},
{
"date": "2012-09-27",
"videos": [
"http://thecolbertreport.cc.com/videos/373l0t/-america-again--re-becoming-the-greatness-we-never-weren-t-",
"http://thecolbertreport.cc.com/videos/s9359o/mitt-romney-s-sliding-poll-numbers",
"http://thecolbertreport.cc.com/videos/zpnkfm/-skewed--presidential-polls",
"http://thecolbertreport.cc.com/videos/7tmsil/vince-gilligan-pt--1",
"http://thecolbertreport.cc.com/videos/e6j3e4/vince-gilligan-pt--2",
"http://thecolbertreport.cc.com/videos/xrnkns/sign-off----america-again-"
],
"guest": "Vince Gilligan"
},
{
"date": "2012-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/21ytsa/mitt-romney-s-tax-plan-math",
"http://thecolbertreport.cc.com/videos/v5694x/the-word---supply-chained",
"http://thecolbertreport.cc.com/videos/h64sbo/mahmoud-ahmadinejad-s-un-entourage",
"http://thecolbertreport.cc.com/videos/k9q5kh/ben-folds-five"
],
"guest": "Ben Folds Five"
},
{
"date": "2012-10-02",
"videos": [
"http://thecolbertreport.cc.com/videos/5ujlwr/intro---10-2-12",
"http://thecolbertreport.cc.com/videos/yeek7a/-america-again--release",
"http://thecolbertreport.cc.com/videos/cy7c9f/pulpit-freedom-sunday",
"http://thecolbertreport.cc.com/videos/x5r0se/pulpit-freedom-sunday---jim-garlow",
"http://thecolbertreport.cc.com/videos/oe7wh2/debate-hype---mitt-s-strategy",
"http://thecolbertreport.cc.com/videos/78yg26/jorge-ramos",
"http://thecolbertreport.cc.com/videos/dictxb/sign-off----america-again--release"
],
"guest": "Jorge Ramos"
},
{
"date": "2012-10-03",
"videos": [
"http://thecolbertreport.cc.com/videos/ef28hc/intro---10-3-12",
"http://thecolbertreport.cc.com/videos/05md2w/presidential-debates---mitt-romney-s-re-introduction",
"http://thecolbertreport.cc.com/videos/2cmp66/george-will-s-political-post-racial-journalism",
"http://thecolbertreport.cc.com/videos/idoutl/cheating-death---low-t",
"http://thecolbertreport.cc.com/videos/nw3yhm/kenny-rogers",
"http://thecolbertreport.cc.com/videos/rt3hz7/sign-off---banana-phone"
],
"guest": "Kenny Rogers"
},
{
"date": "2012-10-04",
"videos": [
"http://thecolbertreport.cc.com/videos/5uncqq/obama-s-debate-apathy---pbs",
"http://thecolbertreport.cc.com/videos/cl08kb/chris-matthews-s-impotent-rage",
"http://thecolbertreport.cc.com/videos/inrj8y/mitt-s-socialist-rhetoric---body-language",
"http://thecolbertreport.cc.com/videos/mw7xqx/mitt-s--etch-a-sketch--behavior",
"http://thecolbertreport.cc.com/videos/nvjrik/voter-fraud-alert---halloween---pennsylvania",
"http://thecolbertreport.cc.com/videos/fkt99i/george-church",
"http://thecolbertreport.cc.com/videos/8vqy9e/sign-off---rabbit-food"
],
"guest": "Dr. George Church"
},
{
"date": "2012-10-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ohtrd9/intro---10-8-12",
"http://thecolbertreport.cc.com/videos/53brnc/unemployment-below-eight-percent",
"http://thecolbertreport.cc.com/videos/uey9b0/the-word---it-s-not-easy-having-green",
"http://thecolbertreport.cc.com/videos/s8mn29/koch-brothers---orc-senate-candidate",
"http://thecolbertreport.cc.com/videos/43khod/mark-kelly",
"http://thecolbertreport.cc.com/videos/sq2eio/sign-off---welcome-baby-brumm-"
],
"guest": "Mark Kelly"
},
{
"date": "2012-10-09",
"videos": [
"http://thecolbertreport.cc.com/videos/htdpl2/intro---10-9-12",
"http://thecolbertreport.cc.com/videos/69kfag/president-obama-s-obsessiveness-plea",
"http://thecolbertreport.cc.com/videos/0g0ihq/smokin--pole---the-quest-for-arctic-riches---china---russia",
"http://thecolbertreport.cc.com/videos/fu9mpp/mitt-romney-s-vague--long-winded-foreign-threats",
"http://thecolbertreport.cc.com/videos/fgftvy/morrissey"
],
"guest": "Morrissey"
},
{
"date": "2012-10-10",
"videos": [
"http://thecolbertreport.cc.com/videos/4jb3d3/intro---10-10-12",
"http://thecolbertreport.cc.com/videos/ejqp1v/beverage-based-polling---pizza-toppings-town-hall",
"http://thecolbertreport.cc.com/videos/jur0u9/the-word---meducation",
"http://thecolbertreport.cc.com/videos/t1y0rc/threatdown---apple-fan-bears--drunk-cars---bears",
"http://thecolbertreport.cc.com/videos/plccwf/naomi-wolf",
"http://thecolbertreport.cc.com/videos/od1her/sign-off----vagina--a-new-biography-"
],
"guest": "Naomi Wolf"
},
{
"date": "2012-10-11",
"videos": [
"http://thecolbertreport.cc.com/videos/6smkkc/intro---10-11-12",
"http://thecolbertreport.cc.com/videos/kiyawb/the-vice-presidential-debate",
"http://thecolbertreport.cc.com/videos/s190yi/this-changes-everything---obama-s-martian-gayness",
"http://thecolbertreport.cc.com/videos/2ksunf/formidable-opponent---mitt-romney",
"http://thecolbertreport.cc.com/videos/xhdwfk/chrystia-freeland",
"http://thecolbertreport.cc.com/videos/zr1go5/sign-off---goodnight"
],
"guest": "Chrystia Freeland"
},
{
"date": "2012-10-15",
"videos": [
"http://thecolbertreport.cc.com/videos/fuzsdf/intro---10-15-12",
"http://thecolbertreport.cc.com/videos/0bmyur/supersonic-space-jump",
"http://thecolbertreport.cc.com/videos/iudpa7/tip-wag---norway---american-family-association",
"http://thecolbertreport.cc.com/videos/0q2emr/monkey-on-the-lam---florida---monkey-on-the-gram",
"http://thecolbertreport.cc.com/videos/zj6xib/evan-thomas",
"http://thecolbertreport.cc.com/videos/n0kt18/sign-off---goodnight"
],
"guest": "Evan Thomas"
},
{
"date": "2012-10-16",
"videos": [
"http://thecolbertreport.cc.com/videos/keo9r0/the-wealth-edge----cool--debate-technology",
"http://thecolbertreport.cc.com/videos/4aqbh6/affirmative-action-supreme-court-case",
"http://thecolbertreport.cc.com/videos/y46z6y/affirmative-action-supreme-court-case---emily-bazelon",
"http://thecolbertreport.cc.com/videos/4uld4g/paul-ryan-s-phony-campaign-photo",
"http://thecolbertreport.cc.com/videos/4c7frp/cory-booker",
"http://thecolbertreport.cc.com/videos/juen77/sign-off---iphone"
],
"guest": "Cory Booker"
},
{
"date": "2012-10-17",
"videos": [
"http://thecolbertreport.cc.com/videos/wd584x/second-presidential-debate-showdown",
"http://thecolbertreport.cc.com/videos/rjvmac/libya-gate-scandal",
"http://thecolbertreport.cc.com/videos/j531em/stupid-town-hall-topics",
"http://thecolbertreport.cc.com/videos/jr7tf6/mitt-s-greatest-debate-triumph",
"http://thecolbertreport.cc.com/videos/hhxtxg/alpha-dog-of-the-week---scott-desjarlais",
"http://thecolbertreport.cc.com/videos/f4jil4/tyler-perry",
"http://thecolbertreport.cc.com/videos/namywp/sign-off---loose-teeth"
],
"guest": "Tyler Perry"
},
{
"date": "2012-10-18",
"videos": [
"http://thecolbertreport.cc.com/videos/1dfeya/celebrity-campaign-endorsements",
"http://thecolbertreport.cc.com/videos/rgzljg/mitt-s-first-day",
"http://thecolbertreport.cc.com/videos/2q39xi/junk-food-feed",
"http://thecolbertreport.cc.com/videos/xttei6/special-report---a-shucking-disaster---nightmare-at-the-mitchell-corn-palace",
"http://thecolbertreport.cc.com/videos/t8vgd4/the-killers",
"http://thecolbertreport.cc.com/videos/ieuitc/sign-off----battle-born-"
],
"guest": "The Killers"
},
{
"date": "2012-10-22",
"videos": [
"http://thecolbertreport.cc.com/videos/0t7wmw/virginia-s-voter-fraud-fighter",
"http://thecolbertreport.cc.com/videos/jhyr4v/ceo-blackmail---fec-consent",
"http://thecolbertreport.cc.com/videos/t1yx0h/governor-magorium-s-ganja-emporium",
"http://thecolbertreport.cc.com/videos/8uddyg/donald-sadoway",
"http://thecolbertreport.cc.com/videos/czceut/sign-off---goodnight"
],
"guest": "Donald Sadoway"
},
{
"date": "2012-10-23",
"videos": [
"http://thecolbertreport.cc.com/videos/nept6x/stephen-colbert-s-debate-2012-coverage",
"http://thecolbertreport.cc.com/videos/wowfoq/elusive--mysterious--undecided-voters",
"http://thecolbertreport.cc.com/videos/twexhe/lance-armstrong-s-doping-scandal",
"http://thecolbertreport.cc.com/videos/hrawp4/john-grisham",
"http://thecolbertreport.cc.com/videos/rxk7z1/sign-off---manischewitz"
],
"guest": "John Grisham"
},
{
"date": "2012-10-24",
"videos": [
"http://thecolbertreport.cc.com/videos/3gbfdl/intro---10-24-12",
"http://thecolbertreport.cc.com/videos/ifrr4g/donald-trump-s-october-surprise",
"http://thecolbertreport.cc.com/videos/n9028e/nonstop-libya-gate-questions",
"http://thecolbertreport.cc.com/videos/gzidte/richard-mourdock-s-rape-comment",
"http://thecolbertreport.cc.com/videos/swkt4w/anthony-everitt",
"http://thecolbertreport.cc.com/videos/ug2zqb/sign-off---gop-rape-mention-tally"
],
"guest": "Anthony Everitt"
},
{
"date": "2012-10-25",
"videos": [
"http://thecolbertreport.cc.com/videos/7k4pkh/intro---10-25-12",
"http://thecolbertreport.cc.com/videos/a0h9on/voting---hormones",
"http://thecolbertreport.cc.com/videos/zu00re/stephen-ghoulbert-s-spooky-time-halloween-fun-guide---tom-hanks",
"http://thecolbertreport.cc.com/videos/pb058e/mitch-daniels-pt--1",
"http://thecolbertreport.cc.com/videos/9tzl4i/mitch-daniels-pt--2",
"http://thecolbertreport.cc.com/videos/pstvp6/sign-off---murderer-skull-model"
],
"guest": "Gov. Mitch Daniels"
},
{
"date": "2012-10-31",
"videos": [
"http://thecolbertreport.cc.com/videos/rky5ab/hurricane-sandy-s-aftermath",
"http://thecolbertreport.cc.com/videos/ey2jqz/hurricane-sandy---election-day",
"http://thecolbertreport.cc.com/videos/lk60fg/flamboyant-sandy---federal-relief-debate",
"http://thecolbertreport.cc.com/videos/5vx4ad/donald-trump-s-october-surprise-extension",
"http://thecolbertreport.cc.com/videos/x89ju7/lilly-ledbetter",
"http://thecolbertreport.cc.com/videos/jqfgo3/sign-off---american-red-cross---hurricane-sandy"
],
"guest": "Lilly Ledbetter"
},
{
"date": "2012-11-01",
"videos": [
"http://thecolbertreport.cc.com/videos/hk2ox4/intro---11-1-12",
"http://thecolbertreport.cc.com/videos/mtuxrh/hurricane-sandy-traffic-ordeal",
"http://thecolbertreport.cc.com/videos/pdmw4z/tip-wag---constant-documentation---billy-graham",
"http://thecolbertreport.cc.com/videos/rmzkbz/david-byrne---st--vincent",
"http://thecolbertreport.cc.com/videos/w4v4gd/sign-off---american-red-cross---hurricane-sandy"
],
"guest": "David Byrne & St. Vincent"
},
{
"date": "2012-11-05",
"videos": [
"http://thecolbertreport.cc.com/videos/mm7c7b/colbert-super-pac---severe-candidate-warning",
"http://thecolbertreport.cc.com/videos/h3qcht/shame-based-campaigning",
"http://thecolbertreport.cc.com/videos/ga4hky/shame-based-campaigning---sasha-issenberg",
"http://thecolbertreport.cc.com/videos/ef460s/-razor-tight--presidential-election",
"http://thecolbertreport.cc.com/videos/tl7vb4/nate-silver",
"http://thecolbertreport.cc.com/videos/i1cdch/sign-off---go-vote-"
],
"guest": "Nate Silver"
},
{
"date": "2012-11-06",
"videos": [
"http://thecolbertreport.cc.com/videos/2wfr8k/the-colbert-report-election-2012---who-will-replace-obama---012",
"http://thecolbertreport.cc.com/videos/ydqq2x/the-colbert-report-election-2012---too-close-to-call",
"http://thecolbertreport.cc.com/videos/b9hvj6/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/vghwne/senate-races---state-referenda",
"http://thecolbertreport.cc.com/videos/cao81i/sign-off---election-reflections"
],
"guest": "Andrew Sullivan"
},
{
"date": "2012-11-07",
"videos": [
"http://thecolbertreport.cc.com/videos/d96ihg/intro---11-7-12",
"http://thecolbertreport.cc.com/videos/zviz5s/four-more-years-of-hopey-change",
"http://thecolbertreport.cc.com/videos/hbkurh/nontraditional-non-white-america",
"http://thecolbertreport.cc.com/videos/btqtta/polling-irregularities---vote-by-phone-scam",
"http://thecolbertreport.cc.com/videos/wjevw3/wind-power-s-health-hazards",
"http://thecolbertreport.cc.com/videos/xs8d72/doris-kearns-goodwin",
"http://thecolbertreport.cc.com/videos/6iwo2a/sign-off---solace-in-a-bottle"
],
"guest": "Doris Kearns Goodwin"
},
{
"date": "2012-11-08",
"videos": [
"http://thecolbertreport.cc.com/videos/lttdhm/intro---11-8-12",
"http://thecolbertreport.cc.com/videos/op51y2/nor-easter---mitt-romney",
"http://thecolbertreport.cc.com/videos/ryj0jw/difference-makers---stephen-dick-jr-",
"http://thecolbertreport.cc.com/videos/25lwb9/the-plight-of-platonic-relationships",
"http://thecolbertreport.cc.com/videos/doygtf/rachel-maddow",
"http://thecolbertreport.cc.com/videos/jzxfgf/sign-off---goodnight"
],
"guest": "Rachel Maddow"
},
{
"date": "2012-11-12",
"videos": [
"http://thecolbertreport.cc.com/videos/3szdub/david-petraeus-s--all-in--affair",
"http://thecolbertreport.cc.com/videos/kj1cs9/colbert-super-pac-shh----karl-rove---jon-stewart",
"http://thecolbertreport.cc.com/videos/66y7dx/colbert-super-pac-shh----secret-second-501c4---trevor-potter",
"http://thecolbertreport.cc.com/videos/tl4uce/blitzkrieg-on-grinchitude---santa-s-pipe",
"http://thecolbertreport.cc.com/videos/6vpcf3/ken-burns",
"http://thecolbertreport.cc.com/videos/3w1i4s/sign-off---goodbye-colbert-super-pac"
],
"guest": "Ken Burns"
},
{
"date": "2012-11-13",
"videos": [
"http://thecolbertreport.cc.com/videos/i9yvhl/intro---11-13-12",
"http://thecolbertreport.cc.com/videos/uml8yd/2072--race-to-the-white-orb",
"http://thecolbertreport.cc.com/videos/s5vmrx/tip-wag---pranab-mukherjee--brazilian-scientists--sonia-sotomayor",
"http://thecolbertreport.cc.com/videos/icmpvx/newt-gingrich-pt--1",
"http://thecolbertreport.cc.com/videos/61deqz/newt-gingrich-pt--2",
"http://thecolbertreport.cc.com/videos/ujlf67/sign-off---goodnight"
],
"guest": "Newt Gingrich"
},
{
"date": "2012-11-14",
"videos": [
"http://thecolbertreport.cc.com/videos/e0pxrk/intro---11-14-12",
"http://thecolbertreport.cc.com/videos/3zu15f/who-s-attacking-me-now----canadian-broadcasting-corporation",
"http://thecolbertreport.cc.com/videos/kvs6wn/high-frequency-trading",
"http://thecolbertreport.cc.com/videos/ba8i6j/high-frequency-trading---christopher-steiner",
"http://thecolbertreport.cc.com/videos/wvf1nd/tony-kushner-pt--1",
"http://thecolbertreport.cc.com/videos/ezygjv/tony-kushner-pt--2",
"http://thecolbertreport.cc.com/videos/cz0sty/sign-off---goodnight"
],
"guest": "Tony Kushner"
},
{
"date": "2012-11-15",
"videos": [
"http://thecolbertreport.cc.com/videos/cazbp6/intro---11-15-12",
"http://thecolbertreport.cc.com/videos/regxdh/millennial-generation-soup-campaign",
"http://thecolbertreport.cc.com/videos/jy83mg/general-s-hospital",
"http://thecolbertreport.cc.com/videos/xve006/cheating-death---flu-fighting-meth",
"http://thecolbertreport.cc.com/videos/we1zlp/chris-stringer",
"http://thecolbertreport.cc.com/videos/f23a7f/sign-off---the-colbert-report-s-seventh-anniversary"
],
"guest": "Chris Stringer"
},
{
"date": "2012-11-26",
"videos": [
"http://thecolbertreport.cc.com/videos/9ex0kp/intro---11-26-12",
"http://thecolbertreport.cc.com/videos/i4lmrj/stephen-s-thanksgiving---holy-black-friday",
"http://thecolbertreport.cc.com/videos/242ato/judge--jury---executioner---copyright-law",
"http://thecolbertreport.cc.com/videos/ob3lcn/blitzkrieg-on-grinchitude---pope-benedict-xvi",
"http://thecolbertreport.cc.com/videos/std5aq/jake-tapper",
"http://thecolbertreport.cc.com/videos/o2lec3/sign-off---goodnight"
],
"guest": "Jake Tapper"
},
{
"date": "2012-11-27",
"videos": [
"http://thecolbertreport.cc.com/videos/oh9w4r/canada-s-grinch",
"http://thecolbertreport.cc.com/videos/7imsna/the-fiscal-cliff-compromise",
"http://thecolbertreport.cc.com/videos/72sdt0/the-fiscal-cliff-compromise---reihan-salam",
"http://thecolbertreport.cc.com/videos/1fuekz/dolly-parton",
"http://thecolbertreport.cc.com/videos/nqrlrq/sign-off---country-chords"
],
"guest": "Dolly Parton"
},
{
"date": "2012-11-28",
"videos": [
"http://thecolbertreport.cc.com/videos/ui3lan/intro---11-28-12",
"http://thecolbertreport.cc.com/videos/omvkv3/record-powerball-jackpot",
"http://thecolbertreport.cc.com/videos/tnr1l8/the-word---sisters-are-doing-it-to-themselves",
"http://thecolbertreport.cc.com/videos/xpxkwl/filibuster-reform",
"http://thecolbertreport.cc.com/videos/qc393o/frank-oz",
"http://thecolbertreport.cc.com/videos/b9jkcc/sign-off---stephen-s-muppet"
],
"guest": "Frank Oz"
},
{
"date": "2012-11-29",
"videos": [
"http://thecolbertreport.cc.com/videos/gnb0gv/intro---11-29-12",
"http://thecolbertreport.cc.com/videos/cehmsr/moon-shattering-news",
"http://thecolbertreport.cc.com/videos/9o0ttj/tip-wag---gay-rights-pioneers---gun-dorms",
"http://thecolbertreport.cc.com/videos/dgy710/top-10-of-2012---operation-killing--killing-kennedy-",
"http://thecolbertreport.cc.com/videos/qyxymb/sean-carroll",
"http://thecolbertreport.cc.com/videos/z8pd91/sign-off---acceptance-speech"
],
"guest": "Sean Carroll"
},
{
"date": "2012-12-03",
"videos": [
"http://thecolbertreport.cc.com/videos/c2msxt/the-pundit--or-colbert-and-back-again",
"http://thecolbertreport.cc.com/videos/i94qww/the-pundit--or-colbert-and-back-again---hobbit-week-lineup",
"http://thecolbertreport.cc.com/videos/zkpe65/the-word---base-instincts",
"http://thecolbertreport.cc.com/videos/47ssk7/senior-moment---granny-pods",
"http://thecolbertreport.cc.com/videos/zm84yu/ian-mckellen",
"http://thecolbertreport.cc.com/videos/u8z3mx/sign-off---the-pundit--or-colbert-and-back-again---sting"
],
"guest": "Ian McKellen"
},
{
"date": "2012-12-04",
"videos": [
"http://thecolbertreport.cc.com/videos/ri5csw/the-pundit--or-colbert-and-back-again---hobbit-week-night-two",
"http://thecolbertreport.cc.com/videos/q3aiti/low-t---low-o",
"http://thecolbertreport.cc.com/videos/n7lg1x/kate-the-great-s-morning-sickness",
"http://thecolbertreport.cc.com/videos/v8syf8/martin-freeman",
"http://thecolbertreport.cc.com/videos/rmahy7/sign-off---the-pundit--or-colbert-and-back-again---rivendell"
],
"guest": "Martin Freeman"
},
{
"date": "2012-12-05",
"videos": [
"http://thecolbertreport.cc.com/videos/qtkdcn/the-pundit--or-colbert-and-back-again---hobbit-week-night-three",
"http://thecolbertreport.cc.com/videos/6x66a7/the-word---hire-learning",
"http://thecolbertreport.cc.com/videos/9j5qtc/politicos---paranoid-fantasies",
"http://thecolbertreport.cc.com/videos/m8dp2f/andy-serkis",
"http://thecolbertreport.cc.com/videos/msip4s/sign-off---the-pundit--or-colbert-and-back-again---one-ring"
],
"guest": "Peter Jackson"
},
{
"date": "2012-12-06",
"videos": [
"http://thecolbertreport.cc.com/videos/teluzg/the-pundit--or-colbert-and-back-again---hobbit-week-night-four",
"http://thecolbertreport.cc.com/videos/hhe4hg/jim-demint-s-resignation",
"http://thecolbertreport.cc.com/videos/d0n0vz/stephen-colbert--wax-on---wax-off-at-madame-tussauds-pt--1",
"http://thecolbertreport.cc.com/videos/1voj50/stephen-colbert--wax-on---wax-off-at-madame-tussauds-pt--2",
"http://thecolbertreport.cc.com/videos/0tvck8/peter-jackson",
"http://thecolbertreport.cc.com/videos/fbqohj/sign-off---the-pundit--or-colbert-and-back-again---hobbit-week-concludes"
],
"guest": "Andy Serkis"
},
{
"date": "2012-12-10",
"videos": [
"http://thecolbertreport.cc.com/videos/0cfmll/stephen-for-u-s--senate",
"http://thecolbertreport.cc.com/videos/8skoq2/fox-news-s-secret-presidential-recruit",
"http://thecolbertreport.cc.com/videos/gdygvq/diana-krall"
],
"guest": "Diana Krall, Elvis Costello"
},
{
"date": "2012-12-11",
"videos": [
"http://thecolbertreport.cc.com/videos/t45azb/intro---12-11-12",
"http://thecolbertreport.cc.com/videos/69xjmc/fiscal-cliff-negotiations",
"http://thecolbertreport.cc.com/videos/iwvp9d/threatdown---commie-unicorns---foreman-barbie",
"http://thecolbertreport.cc.com/videos/8is78z/ex-gay-therapy-debate",
"http://thecolbertreport.cc.com/videos/m3omdi/malcolm-gladwell"
],
"guest": "Malcolm Gladwell, Audra McDonald"
},
{
"date": "2012-12-12",
"videos": [
"http://thecolbertreport.cc.com/videos/hoair6/success-for-operation-killing--killing-kennedy-",
"http://thecolbertreport.cc.com/videos/8aazot/stephen-s-appointment-with-destiny---jeff-bingaman",
"http://thecolbertreport.cc.com/videos/yr83zl/ground-zero-mosque-erade",
"http://thecolbertreport.cc.com/videos/38iv8s/mandy-patinkin"
],
"guest": "Mandy Patinkin, Michael Stipe"
},
{
"date": "2012-12-13",
"videos": [
"http://thecolbertreport.cc.com/videos/ao4d2q/hurricane-sandy-mega-concert",
"http://thecolbertreport.cc.com/videos/dseos2/uncensored----breaking-abbey-",
"http://thecolbertreport.cc.com/videos/clpvpj/colbert-super-pac---the-ham-rove-memorial-fund",
"http://thecolbertreport.cc.com/videos/wozbhp/simone-campbell"
],
"guest": "Sister Simone Campbell, Jeff Tweedy, Mavis Staples, Sean Lennon"
}
],
"2013": [
{
"date": "2013-01-07",
"videos": [
"http://thecolbertreport.cc.com/videos/bgkrwx/intro---1-7-13",
"http://thecolbertreport.cc.com/videos/83h5da/stephen-s-holiday-break",
"http://thecolbertreport.cc.com/videos/9nmhtf/fiscal-cliff-deal---disincentives",
"http://thecolbertreport.cc.com/videos/wq7dip/the-platinum-debt-ceiling-solution",
"http://thecolbertreport.cc.com/videos/b1uvtc/blood-in-the-water---bill-o-reilly-s-racial-insensitivity",
"http://thecolbertreport.cc.com/videos/ayoamg/jimmy-wales",
"http://thecolbertreport.cc.com/videos/a1dzb3/sign-off---goodnight"
],
"guest": "Jimmy Wales"
},
{
"date": "2013-01-08",
"videos": [
"http://thecolbertreport.cc.com/videos/fuxwr9/intro---1-8-13",
"http://thecolbertreport.cc.com/videos/gdcdgs/postage-price-hike",
"http://thecolbertreport.cc.com/videos/vcqeg7/cheating-death---rage---blood-transfusions",
"http://thecolbertreport.cc.com/videos/ps8djx/bin-laden-film-controversy",
"http://thecolbertreport.cc.com/videos/kq9pp2/chris-kluwe",
"http://thecolbertreport.cc.com/videos/gcv2eh/sign-off---vacsa-tern"
],
"guest": "Chris Kluwe"
},
{
"date": "2013-01-09",
"videos": [
"http://thecolbertreport.cc.com/videos/kg1znk/intro---1-9-13",
"http://thecolbertreport.cc.com/videos/ip7ql9/idaho-s-walled---armed-community",
"http://thecolbertreport.cc.com/videos/tzcfhr/gun-control-backlash",
"http://thecolbertreport.cc.com/videos/52uula/thought-for-food---wheat-addictions",
"http://thecolbertreport.cc.com/videos/ysa6lr/neil-shubin",
"http://thecolbertreport.cc.com/videos/5majke/sign-off---mcgnaw-the-gluten-free-beaver"
],
"guest": "Neil Shubin"
},
{
"date": "2013-01-10",
"videos": [
"http://thecolbertreport.cc.com/videos/uej3ac/roadside-sofa-boning",
"http://thecolbertreport.cc.com/videos/5n5w35/obama-s-failed-second-term",
"http://thecolbertreport.cc.com/videos/35sqrd/tip-wag---hapifork---kevin-garnett",
"http://thecolbertreport.cc.com/videos/ro7hjf/benjamin-gibbard"
],
"guest": "Ben Gibbard"
},
{
"date": "2013-01-14",
"videos": [
"http://thecolbertreport.cc.com/videos/y2ynrh/stephen-colbert-s-double-barrel-blam-o-rama---silver-bullets---video-games",
"http://thecolbertreport.cc.com/videos/8zsm19/stephen-colbert-s-double-barrel-blam-o-rama---piers-morgan---james-yeager",
"http://thecolbertreport.cc.com/videos/zftq7q/stephen-colbert-s-double-barrel-blam-o-rama---guns-as-civil-rights-victims",
"http://thecolbertreport.cc.com/videos/4lcqtx/vitaminwater-advertising-lawsuit",
"http://thecolbertreport.cc.com/videos/bainem/piers-morgan",
"http://thecolbertreport.cc.com/videos/hoc2kn/sign-off---pocketbook-constitution"
],
"guest": "Piers Morgan"
},
{
"date": "2013-01-15",
"videos": [
"http://thecolbertreport.cc.com/videos/t6cye7/intro---1-15-13",
"http://thecolbertreport.cc.com/videos/p5ll7c/lance-armstrong-s-interview-with-oprah",
"http://thecolbertreport.cc.com/videos/uuduw3/monkey-on-the-lam---macaque-attack---1-381-days-of-simian-terror-in-tampa",
"http://thecolbertreport.cc.com/videos/r78s3t/catacoffin-catacombo-sound-system",
"http://thecolbertreport.cc.com/videos/an9lge/jared-diamond",
"http://thecolbertreport.cc.com/videos/usj2pz/sign-off---goodnight"
],
"guest": "Jared Diamond"
},
{
"date": "2013-01-16",
"videos": [
"http://thecolbertreport.cc.com/videos/j56lbb/intro---1-16-13",
"http://thecolbertreport.cc.com/videos/s9aj13/healthy-fake-smiles",
"http://thecolbertreport.cc.com/videos/uhkynp/hsbc-laundering-charges",
"http://thecolbertreport.cc.com/videos/hbxrk6/hsbc-laundering-charges---matt-taibbi",
"http://thecolbertreport.cc.com/videos/62nu7n/pat-robertson-s-romance-advice",
"http://thecolbertreport.cc.com/videos/m7jh2f/tom-brokaw",
"http://thecolbertreport.cc.com/videos/ib0ftp/sign-off---goodnight"
],
"guest": "Tom Brokaw"
},
{
"date": "2013-01-17",
"videos": [
"http://thecolbertreport.cc.com/videos/r3kb1q/exclusive---colbert-wax-on---wax-off-at-madame-tussauds--outtakes",
"http://thecolbertreport.cc.com/videos/qqx0s8/corporate-scamwich",
"http://thecolbertreport.cc.com/videos/df7rup/obama-s-gun-grab",
"http://thecolbertreport.cc.com/videos/w73nzv/the-word---united-we-standoff",
"http://thecolbertreport.cc.com/videos/g1jrq5/porn-names---porn-lawsuits",
"http://thecolbertreport.cc.com/videos/vem33s/akhil-reed-amar",
"http://thecolbertreport.cc.com/videos/jawwj8/sign-off---goodnight"
],
"guest": "Akhil Reed Amar"
},
{
"date": "2013-01-21",
"videos": [
"http://thecolbertreport.cc.com/videos/zzot6e/intro---1-21-13",
"http://thecolbertreport.cc.com/videos/xjexam/obama-s-second-inauguration",
"http://thecolbertreport.cc.com/videos/li25sm/stephen-s-re-inauguration",
"http://thecolbertreport.cc.com/videos/djvjxw/threatdown---flu--kate-middleton--vomiting-robots--superintelligent-gonorrhea--bears",
"http://thecolbertreport.cc.com/videos/o7bw1e/ta-nehisi-coates",
"http://thecolbertreport.cc.com/videos/9hwods/sign-off---hotel-bibles"
],
"guest": "Ta-Nehisi Coates"
},
{
"date": "2013-01-22",
"videos": [
"http://thecolbertreport.cc.com/videos/u2sxvp/exclusive---kathryn-bigelow-extended-interview",
"http://thecolbertreport.cc.com/videos/4h7ltu/obama-s-inauguration---class-warfare",
"http://thecolbertreport.cc.com/videos/0f673t/the-word---win--lose--or-redraw",
"http://thecolbertreport.cc.com/videos/tccphp/dustin-hoffman-s-bad-news",
"http://thecolbertreport.cc.com/videos/rn0fho/kathryn-bigelow",
"http://thecolbertreport.cc.com/videos/msaso2/sign-off----zero-dark-thirty-----quartet-"
],
"guest": "Kathryn Bigelow"
},
{
"date": "2013-01-23",
"videos": [
"http://thecolbertreport.cc.com/videos/3reklz/beyonce-s-lip-gate",
"http://thecolbertreport.cc.com/videos/vw3zie/tip-wag---montpelier-school-district--theatlasphere-com---florida-officials",
"http://thecolbertreport.cc.com/videos/f3o0qj/alpha-dog-of-the-week---virginia-state-senate-republicans",
"http://thecolbertreport.cc.com/videos/202a1c/sally-field",
"http://thecolbertreport.cc.com/videos/hd80sm/sign-off---goodnight"
],
"guest": "Sally Field"
},
{
"date": "2013-01-24",
"videos": [
"http://thecolbertreport.cc.com/videos/xaaxud/france---the-mali-conflict",
"http://thecolbertreport.cc.com/videos/i1sdq5/france---the-mali-conflict---edward-berenson",
"http://thecolbertreport.cc.com/videos/vgqq4z/benghazi-attack-hearing",
"http://thecolbertreport.cc.com/videos/ktiaje/tavi-gevinson",
"http://thecolbertreport.cc.com/videos/scixor/sign-off---stephen-s-makeover"
],
"guest": "Tavi Gevinson"
},
{
"date": "2013-01-28",
"videos": [
"http://thecolbertreport.cc.com/videos/q1iuxz/intro---1-28-13",
"http://thecolbertreport.cc.com/videos/27at9z/rapiscan-scanners",
"http://thecolbertreport.cc.com/videos/mm5bdz/the-word---the-new-abnormal",
"http://thecolbertreport.cc.com/videos/0q31iw/the-axis-of-evil-of-the-week---north-korea",
"http://thecolbertreport.cc.com/videos/qdf7ec/michael-shellenberger",
"http://thecolbertreport.cc.com/videos/tquuvs/sign-off---goodnight"
],
"guest": "Michael Shellenberger"
},
{
"date": "2013-01-29",
"videos": [
"http://thecolbertreport.cc.com/videos/4ax2hi/intro---1-29-13",
"http://thecolbertreport.cc.com/videos/81oaln/iran-s-space-monkey---america-s-ape-moratorium",
"http://thecolbertreport.cc.com/videos/k95k9v/gun-control---state-sovereignty",
"http://thecolbertreport.cc.com/videos/7c8y4f/gun-control---state-sovereignty---cliff-sloan",
"http://thecolbertreport.cc.com/videos/gfoq4g/guantanamo-bay-office-closure",
"http://thecolbertreport.cc.com/videos/jtkgrc/george-saunders",
"http://thecolbertreport.cc.com/videos/jzuerq/sign-off----tenth-of-december-"
],
"guest": "George Saunders"
},
{
"date": "2013-01-30",
"videos": [
"http://thecolbertreport.cc.com/videos/omljip/intro---1-30-13",
"http://thecolbertreport.cc.com/videos/drdd3e/coming-out-benefits---gay-rights",
"http://thecolbertreport.cc.com/videos/qnfsur/the-word---it-gets-worse",
"http://thecolbertreport.cc.com/videos/i6hr57/non-racist-kkk",
"http://thecolbertreport.cc.com/videos/kiwt0s/bill-gates",
"http://thecolbertreport.cc.com/videos/4wroqd/sign-off---goodnight"
],
"guest": "Bill Gates"
},
{
"date": "2013-01-31",
"videos": [
"http://thecolbertreport.cc.com/videos/101faw/sport-report---ads-for-ads---deer-antler-spray",
"http://thecolbertreport.cc.com/videos/odn1pg/sport-report---gatorade-chemicals---chicken-wing-shortage",
"http://thecolbertreport.cc.com/videos/7wymxs/craziest-f--king-thing-i-ve-ever-heard---crows-using-tools",
"http://thecolbertreport.cc.com/videos/v42kz3/matthew-guerrieri",
"http://thecolbertreport.cc.com/videos/o489no/sign-off---welcome-baby-sanchez-"
],
"guest": "Matthew Guerrieri"
},
{
"date": "2013-02-04",
"videos": [
"http://thecolbertreport.cc.com/videos/iyrevo/intro---2-4-13",
"http://thecolbertreport.cc.com/videos/kb76z3/super-bowl-xlvii",
"http://thecolbertreport.cc.com/videos/vow0uy/bipartisan-immigration-reform",
"http://thecolbertreport.cc.com/videos/ur7z4s/skeet-shooting-skeptics",
"http://thecolbertreport.cc.com/videos/qxsatq/sonia-sotomayor",
"http://thecolbertreport.cc.com/videos/cmttl3/sign-off---second-amendment"
],
"guest": "Justice Sonia Sotomayor"
},
{
"date": "2013-02-05",
"videos": [
"http://thecolbertreport.cc.com/videos/2316uc/intro---2-5-13",
"http://thecolbertreport.cc.com/videos/e96s3c/royal-remains",
"http://thecolbertreport.cc.com/videos/t6wn9f/tip-wag---drunk-donating----the-job--reality-show",
"http://thecolbertreport.cc.com/videos/a1z0cu/california-s-heroic-hitchhiker",
"http://thecolbertreport.cc.com/videos/dyxduh/julie-andrews",
"http://thecolbertreport.cc.com/videos/y7gdjs/sign-off---final-rose"
],
"guest": "Julie Andrews"
},
{
"date": "2013-02-06",
"videos": [
"http://thecolbertreport.cc.com/videos/ae7fmq/intro---2-6-13",
"http://thecolbertreport.cc.com/videos/33sahu/the-penny-pinch",
"http://thecolbertreport.cc.com/videos/r6xbr9/stephen-s-sister-for-congress",
"http://thecolbertreport.cc.com/videos/07240r/scientology-church-violence",
"http://thecolbertreport.cc.com/videos/acokbc/lawrence-wright",
"http://thecolbertreport.cc.com/videos/kt2abh/sign-off---watermelon-warning"
],
"guest": "Lawrence Wright"
},
{
"date": "2013-02-07",
"videos": [
"http://thecolbertreport.cc.com/videos/14j8d1/intro---2-7-13",
"http://thecolbertreport.cc.com/videos/k4xzoo/winter-storm-nemo",
"http://thecolbertreport.cc.com/videos/xknwhm/mr--smith-goes-to-the-state-legislature---stacey-campfield",
"http://thecolbertreport.cc.com/videos/044mxj/-bang-with-friends--app",
"http://thecolbertreport.cc.com/videos/eqsq39/benh-zeitlin",
"http://thecolbertreport.cc.com/videos/xarh0o/sign-off---goodnight"
],
"guest": "Behn Zeitlin"
},
{
"date": "2013-02-11",
"videos": [
"http://thecolbertreport.cc.com/videos/xstxbo/bush-family-email-hack",
"http://thecolbertreport.cc.com/videos/s7p70k/pope-s-resignation---papal-speculatron-7500",
"http://thecolbertreport.cc.com/videos/v1p2wr/pope-s-resignation---papal-speculatron-7500---james-martin",
"http://thecolbertreport.cc.com/videos/he6l0j/garry-wills",
"http://thecolbertreport.cc.com/videos/38op41/sign-off----why-priests--"
],
"guest": "Garry Wills"
},
{
"date": "2013-02-12",
"videos": [
"http://thecolbertreport.cc.com/videos/hbhjqi/intro---2-12-13",
"http://thecolbertreport.cc.com/videos/hwigu9/rnc-autopsy",
"http://thecolbertreport.cc.com/videos/6t4bfw/conservative-victory-project",
"http://thecolbertreport.cc.com/videos/b91wqa/arizona-s-gun-posse",
"http://thecolbertreport.cc.com/videos/87jshg/roger-hodge",
"http://thecolbertreport.cc.com/videos/4j42vn/sign-off---goodnight"
],
"guest": "Roger Hodge"
},
{
"date": "2013-02-13",
"videos": [
"http://thecolbertreport.cc.com/videos/r8y2v4/obama-s-state-of-the-union",
"http://thecolbertreport.cc.com/videos/7g4eal/state-of-the-rubio",
"http://thecolbertreport.cc.com/videos/89tt3v/spanish-state-of-the-rubio",
"http://thecolbertreport.cc.com/videos/wrywsk/dave-grohl",
"http://thecolbertreport.cc.com/videos/rsui4q/sign-off---dry-mouth"
],
"guest": "Dave Grohl"
},
{
"date": "2013-02-14",
"videos": [
"http://thecolbertreport.cc.com/videos/8k6qf1/st--valentine-s-day",
"http://thecolbertreport.cc.com/videos/bg5se9/standard---poor-s-ratings-lawsuit",
"http://thecolbertreport.cc.com/videos/a7o9iy/standard---poor-s-ratings-lawsuit---david-leonhardt",
"http://thecolbertreport.cc.com/videos/gha2xx/nailed--em---richard-eggers",
"http://thecolbertreport.cc.com/videos/jipac1/gavin-newsom",
"http://thecolbertreport.cc.com/videos/tl6blx/sign-off----here-s-the-deal-"
],
"guest": "Gavin Newsom"
},
{
"date": "2013-02-19",
"videos": [
"http://thecolbertreport.cc.com/videos/mk66vx/russian-meteor-strike",
"http://thecolbertreport.cc.com/videos/18bt84/colbert-platinum---huayra-sports-car--phil-mickelson---belle-isle",
"http://thecolbertreport.cc.com/videos/nzi8fo/obama-s-secretive-golf-outing",
"http://thecolbertreport.cc.com/videos/qsppoj/emily-bazelon",
"http://thecolbertreport.cc.com/videos/rivg1z/sign-off---goodnight"
],
"guest": "Emily Bazelon"
},
{
"date": "2013-02-20",
"videos": [
"http://thecolbertreport.cc.com/videos/tq706t/u-k--horse-meat-scandal",
"http://thecolbertreport.cc.com/videos/76hws3/sport-report---international-soccer-corruption",
"http://thecolbertreport.cc.com/videos/t95tyj/sport-report---international-soccer-corruption---alexi-lalas",
"http://thecolbertreport.cc.com/videos/oy70q1/norway-s--national-firewood-night-",
"http://thecolbertreport.cc.com/videos/d68kfy/david-goldhill",
"http://thecolbertreport.cc.com/videos/4869v6/sign-off---goodnight"
],
"guest": "David Goldhill"
},
{
"date": "2013-02-21",
"videos": [
"http://thecolbertreport.cc.com/videos/5dzdoq/-friends-of-hamas--rumor",
"http://thecolbertreport.cc.com/videos/0x6brn/geo-group-stadium",
"http://thecolbertreport.cc.com/videos/yhhjej/corporate-twitter-hacks",
"http://thecolbertreport.cc.com/videos/ef8eii/lil-buck"
],
"guest": "Lil Buck"
},
{
"date": "2013-02-25",
"videos": [
"http://thecolbertreport.cc.com/videos/dysmy8/intro---2-25-13",
"http://thecolbertreport.cc.com/videos/n5lz93/the-word---silent-but-deadly",
"http://thecolbertreport.cc.com/videos/ub1skg/popewatch-2013---vatican-sex-parties",
"http://thecolbertreport.cc.com/videos/ovpx97/simon-garfield",
"http://thecolbertreport.cc.com/videos/7ucjsc/sign-off---goodnight"
],
"guest": "Simon Garfield"
},
{
"date": "2013-02-26",
"videos": [
"http://thecolbertreport.cc.com/videos/8vjzyf/intro---2-26-13",
"http://thecolbertreport.cc.com/videos/gy9em4/popewatch-indeschism-2013---one-pope-over-the-line",
"http://thecolbertreport.cc.com/videos/f5k4cb/battleground-texas---jeremy-bird",
"http://thecolbertreport.cc.com/videos/xdriyp/drone-ducking-tips",
"http://thecolbertreport.cc.com/videos/wr3lk3/michio-kaku",
"http://thecolbertreport.cc.com/videos/i7sahj/sign-off---goodnight"
],
"guest": "Dr. Michio Kaku"
},
{
"date": "2013-02-27",
"videos": [
"http://thecolbertreport.cc.com/videos/6637zm/intro---2-27-13",
"http://thecolbertreport.cc.com/videos/8okga0/halls-mentho-lyptus-cough-drops",
"http://thecolbertreport.cc.com/videos/9mtjmn/khalid-sheikh-mohammed-s-trial-at-gitmo",
"http://thecolbertreport.cc.com/videos/9mvj8u/khalid-sheikh-mohammed-s-trial-at-gitmo---neal-katyal",
"http://thecolbertreport.cc.com/videos/r7gapm/john-kerry-s-dumb-talk",
"http://thecolbertreport.cc.com/videos/cxjhmj/paola-antonelli",
"http://thecolbertreport.cc.com/videos/7trotu/sign-off---halls-mentho-lyptus"
],
"guest": "Paola Antonelli"
},
{
"date": "2013-02-28",
"videos": [
"http://thecolbertreport.cc.com/videos/hmyuom/intro---2-28-13",
"http://thecolbertreport.cc.com/videos/1epo24/colbert-report-consumer-alert---demonic-goodwill-items",
"http://thecolbertreport.cc.com/videos/d7le3o/pope-tbd---souvenir-sales",
"http://thecolbertreport.cc.com/videos/tnbuj0/budget-sequestration",
"http://thecolbertreport.cc.com/videos/66dbox/jon-favreau",
"http://thecolbertreport.cc.com/videos/o5hoan/sign-off---goodnight"
],
"guest": "Obama speechwriter Jon Favreau"
},
{
"date": "2013-03-04",
"videos": [
"http://thecolbertreport.cc.com/videos/ouzof3/sequestration---obama-s-sci-fi-flub",
"http://thecolbertreport.cc.com/videos/xlk2nw/the-enemy-within---dr--skylar-bayer",
"http://thecolbertreport.cc.com/videos/4v9opj/texas-gun-training-bill---free-shotgun-experiment",
"http://thecolbertreport.cc.com/videos/ala255/kirk-bloodsworth",
"http://thecolbertreport.cc.com/videos/7xfdsz/sign-off---goodnight"
],
"guest": "Kirk Bloodsworth"
},
{
"date": "2013-03-05",
"videos": [
"http://thecolbertreport.cc.com/videos/johtnl/intro---3-5-13",
"http://thecolbertreport.cc.com/videos/d8ua02/hugo-chavez---jon-stewart-announcements",
"http://thecolbertreport.cc.com/videos/yesa8j/obama-s-israel-trip",
"http://thecolbertreport.cc.com/videos/xeotb9/obama-s-israel-trip---michael-oren",
"http://thecolbertreport.cc.com/videos/r5gahs/dennis-tito-s-mars-flyby-mission",
"http://thecolbertreport.cc.com/videos/23396i/james-franco",
"http://thecolbertreport.cc.com/videos/ki0n4m/sign-off---goodnight"
],
"guest": "James Franco"
},
{
"date": "2013-03-06",
"videos": [
"http://thecolbertreport.cc.com/videos/5pvbru/-snowquester-",
"http://thecolbertreport.cc.com/videos/2ox5xp/voting-rights-act",
"http://thecolbertreport.cc.com/videos/5yipjs/voting-rights-act---julian-bond",
"http://thecolbertreport.cc.com/videos/3ddous/thought-for-food---bloomberg---the-nacho-bliss-point",
"http://thecolbertreport.cc.com/videos/25fidf/brendan-o-connell",
"http://thecolbertreport.cc.com/videos/76de2t/sign-off---tostitos-scoops"
],
"guest": "Brendan O'Connell"
},
{
"date": "2013-03-07",
"videos": [
"http://thecolbertreport.cc.com/videos/7nblia/rand-paul-s-filibuster",
"http://thecolbertreport.cc.com/videos/aq09bw/north-korea-s-armistice-breach----we-are-the-world--propaganda-video",
"http://thecolbertreport.cc.com/videos/rz6ppl/the-bachelor",
"http://thecolbertreport.cc.com/videos/uldxcb/john-sexton",
"http://thecolbertreport.cc.com/videos/mhruf7/sign-off---land-of-romance"
],
"guest": "John Sexton"
},
{
"date": "2013-03-25",
"videos": [
"http://thecolbertreport.cc.com/videos/6zcxhr/election-of-pope-francis",
"http://thecolbertreport.cc.com/videos/t23n7e/history-channel-s--the-bible-",
"http://thecolbertreport.cc.com/videos/7cya4y/colbert-super-pac---ham-rove-memorial-conference-room",
"http://thecolbertreport.cc.com/videos/bwz16t/junot-diaz",
"http://thecolbertreport.cc.com/videos/vwhyh8/sign-off----the-bible-"
],
"guest": "Junot Diaz"
},
{
"date": "2013-03-26",
"videos": [
"http://thecolbertreport.cc.com/videos/ftxoqq/gop-growth---opportunity-project",
"http://thecolbertreport.cc.com/videos/k5798h/the-word---narcicitizenship",
"http://thecolbertreport.cc.com/videos/rj8f1x/stephen-colbert-is-watching-your-kids---whale-bone-porn",
"http://thecolbertreport.cc.com/videos/udr4lu/eric-topol",
"http://thecolbertreport.cc.com/videos/755nas/sign-off---medical-smartphone"
],
"guest": "Dr. Eric Topol"
},
{
"date": "2013-03-27",
"videos": [
"http://thecolbertreport.cc.com/videos/lapsll/intro---3-27-13",
"http://thecolbertreport.cc.com/videos/8f2crl/bill-o-reilly-on-gay-marriage",
"http://thecolbertreport.cc.com/videos/jk0icd/facebook--like--button-science",
"http://thecolbertreport.cc.com/videos/gd7ki7/sharia-mops",
"http://thecolbertreport.cc.com/videos/0i05bg/carl-edgar-blake-ii",
"http://thecolbertreport.cc.com/videos/8g5b2m/sign-off---hamlet"
],
"guest": "Carl Edgar Blake II"
},
{
"date": "2013-03-28",
"videos": [
"http://thecolbertreport.cc.com/videos/mmwqg6/supreme-court-hearings-on-gay-marriage",
"http://thecolbertreport.cc.com/videos/o26xyc/supreme-court-hearings-on-gay-marriage---emily-bazelon-pt--1",
"http://thecolbertreport.cc.com/videos/qbupod/supreme-court-hearings-on-gay-marriage---emily-bazelon-pt--2",
"http://thecolbertreport.cc.com/videos/sliefv/robert-lustig",
"http://thecolbertreport.cc.com/videos/qlgxw8/sign-off---goodnight"
],
"guest": "Dr. Robert Lustig"
},
{
"date": "2013-04-01",
"videos": [
"http://thecolbertreport.cc.com/videos/j7yyx1/intro---4-1-13",
"http://thecolbertreport.cc.com/videos/mbhysf/easter-under-attack---pope-edition",
"http://thecolbertreport.cc.com/videos/egcbz2/health-care-lottery",
"http://thecolbertreport.cc.com/videos/g3wft7/utah-s-earth-day-celebration",
"http://thecolbertreport.cc.com/videos/rmu5w0/sigourney-weaver",
"http://thecolbertreport.cc.com/videos/lt4lab/sign-off---welcome-baby-nurick-"
],
"guest": "Sigourney Weaver"
},
{
"date": "2013-04-02",
"videos": [
"http://thecolbertreport.cc.com/videos/dgrhqs/gay-marriage-fraud",
"http://thecolbertreport.cc.com/videos/sq7yjh/we-are-at-war---north-korea",
"http://thecolbertreport.cc.com/videos/0pozxj/we-are-at-war---north-korea---victor-cha",
"http://thecolbertreport.cc.com/videos/w7owfy/florida-s-bong-bill",
"http://thecolbertreport.cc.com/videos/7qy183/jim-mcgreevey",
"http://thecolbertreport.cc.com/videos/1qietk/sign-off---goodnight"
],
"guest": "Jim McGreevey"
},
{
"date": "2013-04-03",
"videos": [
"http://thecolbertreport.cc.com/videos/3ci6sy/-morning-joe--vs--the-colbert-report",
"http://thecolbertreport.cc.com/videos/54w6pz/gun-control---barn-orgies",
"http://thecolbertreport.cc.com/videos/heku72/rnc-young-voters-survey",
"http://thecolbertreport.cc.com/videos/tnl1m7/a-c--grayling",
"http://thecolbertreport.cc.com/videos/kfs88u/sign-off---campaign-poster"
],
"guest": "A.C. Grayling"
},
{
"date": "2013-04-04",
"videos": [
"http://thecolbertreport.cc.com/videos/6sjovw/intro---4-4-13",
"http://thecolbertreport.cc.com/videos/2h8ym1/pegasus-pipeline-spill",
"http://thecolbertreport.cc.com/videos/0tmqs0/koko---jeremy-irons-on-gay-marriage",
"http://thecolbertreport.cc.com/videos/97bihb/obama-s-brain-initiative",
"http://thecolbertreport.cc.com/videos/wb31l0/francis-collins",
"http://thecolbertreport.cc.com/videos/jpb3iv/sign-off---eeg-cap"
],
"guest": "Dr. Francis Collins"
},
{
"date": "2013-04-08",
"videos": [
"http://thecolbertreport.cc.com/videos/2htlq3/colbert-galactic-initiative",
"http://thecolbertreport.cc.com/videos/z4m9xu/colbert-galactic-initiative---bill-clinton-pt--1",
"http://thecolbertreport.cc.com/videos/y3hr34/colbert-galactic-initiative---bill-clinton-pt--2",
"http://thecolbertreport.cc.com/videos/hmills/colbert-galactic-initiative---bill-clinton-pt--3",
"http://thecolbertreport.cc.com/videos/jmsckt/sign-off---colbert-galactic-initiative"
],
"guest": "Bill Clinton"
},
{
"date": "2013-04-09",
"videos": [
"http://thecolbertreport.cc.com/videos/dzx936/intro---4-9-13",
"http://thecolbertreport.cc.com/videos/9a1zbe/prez-billy-jeff-clinton",
"http://thecolbertreport.cc.com/videos/k04x7j/clinton-global-initiative-university-exchange-fair",
"http://thecolbertreport.cc.com/videos/yq6m6x/exxon-s-disaster-relief",
"http://thecolbertreport.cc.com/videos/qa420d/charlie-leduff",
"http://thecolbertreport.cc.com/videos/jti3ea/sign-off---potato-clock"
],
"guest": "Charlie LeDuff"
},
{
"date": "2013-04-10",
"videos": [
"http://thecolbertreport.cc.com/videos/r4g4o0/navy-laser-technology",
"http://thecolbertreport.cc.com/videos/b0yf3a/tip-wag---gun-edition---united-nations--senate-republicans---video-games",
"http://thecolbertreport.cc.com/videos/xr32ry/anthony-weiner-s-comeback",
"http://thecolbertreport.cc.com/videos/mvszff/shane-smith",
"http://thecolbertreport.cc.com/videos/fhj67z/sign-off---laser-tag"
],
"guest": "Shane Smith"
},
{
"date": "2013-04-11",
"videos": [
"http://thecolbertreport.cc.com/videos/ycrshs/nasa-lasso",
"http://thecolbertreport.cc.com/videos/2ixasd/america-s-pot-astrophe",
"http://thecolbertreport.cc.com/videos/t10bgi/america-s-pot-astrophe---nick-gillespie",
"http://thecolbertreport.cc.com/videos/82a7wi/times-square-mascots-ban",
"http://thecolbertreport.cc.com/videos/oiajpp/cass-sunstein",
"http://thecolbertreport.cc.com/videos/5r04eq/sign-off---goodnight"
],
"guest": "Cass Sunstein"
},
{
"date": "2013-04-16",
"videos": [
"http://thecolbertreport.cc.com/videos/ifpmy1/intro---4-16-13",
"http://thecolbertreport.cc.com/videos/s94ied/tip-wag---brood-ii-cicadas--sexcereal---gop-internet-memes",
"http://thecolbertreport.cc.com/videos/h77c6i/rollie-eggmaster",
"http://thecolbertreport.cc.com/videos/c5i1jr/caroline-kennedy",
"http://thecolbertreport.cc.com/videos/yygt35/sign-off---goodnight"
],
"guest": "Caroline Kennedy"
},
{
"date": "2013-04-17",
"videos": [
"http://thecolbertreport.cc.com/videos/yfwqpo/ricin-letters---boston-bombing-suspects",
"http://thecolbertreport.cc.com/videos/b1ekda/bitcoin-plunge",
"http://thecolbertreport.cc.com/videos/rxy9ze/bitcoin-plunge---adam-davidson",
"http://thecolbertreport.cc.com/videos/2sml1x/-accidental-racist--song",
"http://thecolbertreport.cc.com/videos/n7jblw/alan-cumming",
"http://thecolbertreport.cc.com/videos/4y7jmv/sign-off---goodnight"
],
"guest": "Alan Cumming"
},
{
"date": "2013-04-18",
"videos": [
"http://thecolbertreport.cc.com/videos/jr70gq/boston-marathon--bag-men-",
"http://thecolbertreport.cc.com/videos/de4kxw/the-bucket-maiden-voyage",
"http://thecolbertreport.cc.com/videos/x7fhfp/gun-control-block",
"http://thecolbertreport.cc.com/videos/tvksjy/richard-engel",
"http://thecolbertreport.cc.com/videos/17gkl6/sign-off---the-bucket"
],
"guest": "Richard Engel"
},
{
"date": "2013-04-22",
"videos": [
"http://thecolbertreport.cc.com/videos/nc9lav/intro---4-22-13",
"http://thecolbertreport.cc.com/videos/vlo1dt/boston-bombers",
"http://thecolbertreport.cc.com/videos/pd1fay/toronto-terror-plot",
"http://thecolbertreport.cc.com/videos/06tavh/tiny-triumphs---infrastructure---river-pollution",
"http://thecolbertreport.cc.com/videos/hkxcsa/george-w--bush-presidential-library",
"http://thecolbertreport.cc.com/videos/d8p3y1/michael-pollan",
"http://thecolbertreport.cc.com/videos/34u7cu/sign-off---goodnight"
],
"guest": "Michael Pollan"
},
{
"date": "2013-04-23",
"videos": [
"http://thecolbertreport.cc.com/videos/12jjaw/scoobygate",
"http://thecolbertreport.cc.com/videos/dcyvro/austerity-s-spreadsheet-error",
"http://thecolbertreport.cc.com/videos/kbgnf0/austerity-s-spreadsheet-error---thomas-herndon",
"http://thecolbertreport.cc.com/videos/54pqtc/eric-schmidt",
"http://thecolbertreport.cc.com/videos/uwzpai/sign-off---goodnight"
],
"guest": "Eric Schmidt"
},
{
"date": "2013-04-24",
"videos": [
"http://thecolbertreport.cc.com/videos/kwa0vp/ap-twitter-hack",
"http://thecolbertreport.cc.com/videos/tk4his/bill-clinton-s-twitter-lessons",
"http://thecolbertreport.cc.com/videos/r1hl69/tiny-triumphs---nasa-s-giant-penis-doodle",
"http://thecolbertreport.cc.com/videos/zi0nnq/danica-patrick",
"http://thecolbertreport.cc.com/videos/zwp3mi/sign-off---goodnight"
],
"guest": "Danica Patrick"
},
{
"date": "2013-04-25",
"videos": [
"http://thecolbertreport.cc.com/videos/md1l1j/exclusive---better-know-a-district---pennsylvania-s-17th---matt-cartwright",
"http://thecolbertreport.cc.com/videos/1waayt/colbert-s-book-club",
"http://thecolbertreport.cc.com/videos/zfq57f/better-know-a-district---pennsylvania-s-17th---matt-cartwright",
"http://thecolbertreport.cc.com/videos/ypl8dh/miranda-rights-for-boston-bomber",
"http://thecolbertreport.cc.com/videos/9j0img/gene-robinson",
"http://thecolbertreport.cc.com/videos/vqrjkz/sign-off---welcome-baby-matheson-"
],
"guest": "Bishop Gene Robinson"
},
{
"date": "2013-04-29",
"videos": [
"http://thecolbertreport.cc.com/videos/lceacn/intro---4-29-13",
"http://thecolbertreport.cc.com/videos/s55dpi/stephen-s-worst-sports-nightmare",
"http://thecolbertreport.cc.com/videos/q8gaki/the-final-days-of-straight-america",
"http://thecolbertreport.cc.com/videos/su6rj1/the-word---we-shall-undermine",
"http://thecolbertreport.cc.com/videos/u2ew19/yelp-prison-reviews",
"http://thecolbertreport.cc.com/videos/8ewxg4/iggy-pop"
],
"guest": "Iggy & the Stooges"
},
{
"date": "2013-04-30",
"videos": [
"http://thecolbertreport.cc.com/videos/9ab72e/intro---4-30-13",
"http://thecolbertreport.cc.com/videos/6brvhc/forced-tank-spending",
"http://thecolbertreport.cc.com/videos/yxooec/the-word---medical-leave",
"http://thecolbertreport.cc.com/videos/4iphqy/thought-for-food---spreadable-sharia---buddy-cup",
"http://thecolbertreport.cc.com/videos/z5q514/evan-spiegel---bobby-murphy",
"http://thecolbertreport.cc.com/videos/i4mbhv/sign-off---snapchat"
],
"guest": "Evan Spiegel & Bobby Murphy"
},
{
"date": "2013-05-01",
"videos": [
"http://thecolbertreport.cc.com/videos/82vhzw/over-the-counter-plan-b",
"http://thecolbertreport.cc.com/videos/7a77hc/background-check-backlash",
"http://thecolbertreport.cc.com/videos/rf6pzs/the-word---n-r-a--vana",
"http://thecolbertreport.cc.com/videos/cm8gvz/macklemore---ryan-lewis",
"http://thecolbertreport.cc.com/videos/sq79ll/sign-off----the-heist-"
],
"guest": "Macklemore & Ryan Lewis"
},
{
"date": "2013-05-02",
"videos": [
"http://thecolbertreport.cc.com/videos/tqo262/intro---5-2-13",
"http://thecolbertreport.cc.com/videos/7emy7s/boston-bomber-accomplices",
"http://thecolbertreport.cc.com/videos/2k1660/gitmo-hunger-strike",
"http://thecolbertreport.cc.com/videos/is0h3a/gitmo-hunger-strike---charles-swift",
"http://thecolbertreport.cc.com/videos/nhiiwp/movies-that-are-destroying-america---summer-movie-edition----man-of-steel-----iron-man-3-",
"http://thecolbertreport.cc.com/videos/mqwnf6/ben-kingsley",
"http://thecolbertreport.cc.com/videos/t46my4/sign-off---montclair-film-festival"
],
"guest": "Ben Kingsley"
},
{
"date": "2013-05-06",
"videos": [
"http://thecolbertreport.cc.com/videos/1mqcyb/intro---5-6-13",
"http://thecolbertreport.cc.com/videos/tnugl6/colbert-s-book-club----the-great-gatsby-",
"http://thecolbertreport.cc.com/videos/rxk0vp/stephen-colbert-s-bats--t-serious---bullet-conspiracy-theory",
"http://thecolbertreport.cc.com/videos/ltsnqq/tip-wag---catholic-diocese-of-brooklyn---stoner-dogs",
"http://thecolbertreport.cc.com/videos/wm2xsq/robert-caro",
"http://thecolbertreport.cc.com/videos/479h8q/sign-off---south-carolina-special-election"
],
"guest": "Robert Caro"
},
{
"date": "2013-05-07",
"videos": [
"http://thecolbertreport.cc.com/videos/bpnvtc/breaking-news---benghazi-whistleblowers",
"http://thecolbertreport.cc.com/videos/wwbl80/better-know-a-district---maryland-s-4th---donna-edwards",
"http://thecolbertreport.cc.com/videos/p3cofn/promposals",
"http://thecolbertreport.cc.com/videos/eyzxx1/douglas-rushkoff",
"http://thecolbertreport.cc.com/videos/ampziq/sign-off---goodnight"
],
"guest": "Douglas Rushkoff"
},
{
"date": "2013-05-08",
"videos": [
"http://thecolbertreport.cc.com/videos/mpvlti/intro---5-8-13",
"http://thecolbertreport.cc.com/videos/fyx23e/south-carolina-election-results",
"http://thecolbertreport.cc.com/videos/m0huaq/spiteful-partisanship",
"http://thecolbertreport.cc.com/videos/gbxmpo/going-diaperless",
"http://thecolbertreport.cc.com/videos/xg0uqu/richard-besser",
"http://thecolbertreport.cc.com/videos/in85s8/sign-off---helium-voice"
],
"guest": "Dr. Richard Besser"
},
{
"date": "2013-05-09",
"videos": [
"http://thecolbertreport.cc.com/videos/t96yfm/colbert-s-book-club----the-great-gatsby-",
"http://thecolbertreport.cc.com/videos/1i7t2j/colbert-s-book-club---learning--the-great-gatsby-",
"http://thecolbertreport.cc.com/videos/4apw9e/colbert-s-book-club---jennifer-egan----the-great-gatsby-",
"http://thecolbertreport.cc.com/videos/tetoi9/baz-luhrmann",
"http://thecolbertreport.cc.com/videos/uuyuly/sign-off----the-great-gatsby-"
],
"guest": "Jennifer Egan, Baz Luhrmann"
},
{
"date": "2013-05-13",
"videos": [
"http://thecolbertreport.cc.com/videos/hdvhlq/benghazi-attacks-talking-points",
"http://thecolbertreport.cc.com/videos/gxwgja/colbert-super-pac-shh----irs-special-scrutiny",
"http://thecolbertreport.cc.com/videos/jgqf2m/threatdown---planet-gay--world-wide-wood---junkie-bears",
"http://thecolbertreport.cc.com/videos/l06a4l/jessica-buchanan---erik-landemalm",
"http://thecolbertreport.cc.com/videos/ny9pcg/sign-off---goodnight"
],
"guest": "Jessica Buchanan & Erik Landemalm"
},
{
"date": "2013-05-14",
"videos": [
"http://thecolbertreport.cc.com/videos/g6ij84/intro---5-14-13",
"http://thecolbertreport.cc.com/videos/1nghxb/obamacare-repeal-vote",
"http://thecolbertreport.cc.com/videos/0jjvya/heritage-foundation-s-immigration-study",
"http://thecolbertreport.cc.com/videos/h5zenk/who-s-not-honoring-me-now----maxim",
"http://thecolbertreport.cc.com/videos/tq7jny/dan-brown",
"http://thecolbertreport.cc.com/videos/ftry54/sign-off---maxim-s-hot-100"
],
"guest": "Dan Brown"
},
{
"date": "2013-05-15",
"videos": [
"http://thecolbertreport.cc.com/videos/c91oeg/bug-protein",
"http://thecolbertreport.cc.com/videos/qxjgw6/better-know-a-district---wisconsin-s-4th---gwen-moore-pt--1",
"http://thecolbertreport.cc.com/videos/ft1gyx/better-know-a-district---wisconsin-s-4th---gwen-moore-pt--2",
"http://thecolbertreport.cc.com/videos/xjltw5/cyndi-lauper",
"http://thecolbertreport.cc.com/videos/f06og4/sign-off---kinky-boots"
],
"guest": "Cyndi Lauper"
},
{
"date": "2013-05-16",
"videos": [
"http://thecolbertreport.cc.com/videos/ru2qad/intro---5-16-13",
"http://thecolbertreport.cc.com/videos/vshddv/asparagusgate",
"http://thecolbertreport.cc.com/videos/x9725b/tip-wag---wind-turbines---china",
"http://thecolbertreport.cc.com/videos/6685w4/3d-printed-guns",
"http://thecolbertreport.cc.com/videos/7xqphc/daniel-lieberman",
"http://thecolbertreport.cc.com/videos/yktive/sign-off---barefoot-shoes"
],
"guest": "Dr. Daniel Lieberman"
},
{
"date": "2013-05-20",
"videos": [
"http://thecolbertreport.cc.com/videos/iqqmsb/mazda-scandal-booth---benghazi",
"http://thecolbertreport.cc.com/videos/xwopvb/mazda-scandal-booth---the-irs",
"http://thecolbertreport.cc.com/videos/5qyy0w/mazda-scandal-booth---the-irs---trevor-potter",
"http://thecolbertreport.cc.com/videos/irj43w/david-sassoon",
"http://thecolbertreport.cc.com/videos/m9mkd8/sign-off---mazda-scandal-booth"
],
"guest": "David Sassoon"
},
{
"date": "2013-05-21",
"videos": [
"http://thecolbertreport.cc.com/videos/wp98kg/intro---5-21-13",
"http://thecolbertreport.cc.com/videos/7fm2v2/irish-potato-famine-pathogen",
"http://thecolbertreport.cc.com/videos/pbfcaq/cheating-death---sun-exposure---marijuana",
"http://thecolbertreport.cc.com/videos/3jp6f3/census-bureau-harassment",
"http://thecolbertreport.cc.com/videos/cqajs7/noah-feldman",
"http://thecolbertreport.cc.com/videos/2jhy5w/sign-off---goodnight"
],
"guest": "Noah Feldman"
},
{
"date": "2013-05-22",
"videos": [
"http://thecolbertreport.cc.com/videos/c02847/intro---5-22-13",
"http://thecolbertreport.cc.com/videos/24adff/irs-tea-party-scandal",
"http://thecolbertreport.cc.com/videos/icnp2y/tip-wag---senators-mitch-and-chong---resourceful-rich-folk",
"http://thecolbertreport.cc.com/videos/60entl/-citizen-koch-",
"http://thecolbertreport.cc.com/videos/15h43y/matt-berninger"
],
"guest": "The National"
},
{
"date": "2013-05-23",
"videos": [
"http://thecolbertreport.cc.com/videos/2j741e/aumf-repeal",
"http://thecolbertreport.cc.com/videos/khhujw/aumf-repeal---andrew-bacevich",
"http://thecolbertreport.cc.com/videos/0bv6m0/redemption-for-all",
"http://thecolbertreport.cc.com/videos/ur1l6x/c-j--chivers",
"http://thecolbertreport.cc.com/videos/ahpe36/sign-off---goodnight"
],
"guest": "C.J. Chivers"
},
{
"date": "2013-06-03",
"videos": [
"http://thecolbertreport.cc.com/videos/ex0o10/stephen-s-week-off",
"http://thecolbertreport.cc.com/videos/ervy41/better-know-a-district---wisconsin-s-2nd---mark-pocan",
"http://thecolbertreport.cc.com/videos/s86l5y/trackingpoint-rifle",
"http://thecolbertreport.cc.com/videos/4fwbkt/john-dingell",
"http://thecolbertreport.cc.com/videos/yrhc20/sign-off---goodnight"
],
"guest": "Rep. John Dingell"
},
{
"date": "2013-06-04",
"videos": [
"http://thecolbertreport.cc.com/videos/fivedj/michele-bachmann-s-last-term",
"http://thecolbertreport.cc.com/videos/x7wc5a/tip-wag---google-glass---the-lone-ranger----3d-printed-food",
"http://thecolbertreport.cc.com/videos/u1fvmr/irs-political-targeting---line-dancing-scandals",
"http://thecolbertreport.cc.com/videos/tz8gve/alex-gibney",
"http://thecolbertreport.cc.com/videos/fbuavt/sign-off---goodnight"
],
"guest": "Alex Gibney"
},
{
"date": "2013-06-05",
"videos": [
"http://thecolbertreport.cc.com/videos/2ntvt9/intro---6-5-13",
"http://thecolbertreport.cc.com/videos/eogja8/commando-of-steel",
"http://thecolbertreport.cc.com/videos/fva65v/monsanto-s-modified-wheat",
"http://thecolbertreport.cc.com/videos/ibdfsk/monsanto-s-modified-wheat---laurie-garrett",
"http://thecolbertreport.cc.com/videos/bqahez/photojournalists-vs--iphones",
"http://thecolbertreport.cc.com/videos/wqd06c/jonathan-alter",
"http://thecolbertreport.cc.com/videos/el0t4o/sign-off---amber-waves-of-frankengrain"
],
"guest": "Jonathan Alter"
},
{
"date": "2013-06-06",
"videos": [
"http://thecolbertreport.cc.com/videos/onw7lq/nsa-phone-surveillance",
"http://thecolbertreport.cc.com/videos/hbmw2f/colbert-classic---spy-training-with-peter-earnest",
"http://thecolbertreport.cc.com/videos/zhz7uc/john-mellencamp--stephen-king---t-bone-burnett---pt--1",
"http://thecolbertreport.cc.com/videos/lcf7d3/john-mellencamp--stephen-king---t-bone-burnett---pt--2",
"http://thecolbertreport.cc.com/videos/46x6yt/sign-off---nose-tap"
],
"guest": "Stephen King, John Mellencamp, T Bone Burnett"
},
{
"date": "2013-06-10",
"videos": [
"http://thecolbertreport.cc.com/videos/oc2w3x/edward-snowden-s-nsa-leaks",
"http://thecolbertreport.cc.com/videos/bkbpaj/the-imploding-muslim-country-of-the-week---turkey",
"http://thecolbertreport.cc.com/videos/rnftw3/the-imploding-muslim-country-of-the-week---turkey---omer-taspinar",
"http://thecolbertreport.cc.com/videos/147u1d/cold-war-update---nuclear-launch-careers",
"http://thecolbertreport.cc.com/videos/vii2l9/dan-savage",
"http://thecolbertreport.cc.com/videos/kmqz9h/sign-off---the-imploding-muslim-country-of-the-week-booth"
],
"guest": "Dan Savage"
},
{
"date": "2013-06-11",
"videos": [
"http://thecolbertreport.cc.com/videos/ctjh9s/intro---6-11-13",
"http://thecolbertreport.cc.com/videos/1mm086/prism-surveillance-program",
"http://thecolbertreport.cc.com/videos/jejy0d/prism-surveillance-program---jeffrey-rosen",
"http://thecolbertreport.cc.com/videos/sa86i9/chewbacca-s-tsa-encounter",
"http://thecolbertreport.cc.com/videos/s2d0lp/daniel-bergner",
"http://thecolbertreport.cc.com/videos/x7nfzj/sign-off---goodnight"
],
"guest": "Daniel Bergner"
},
{
"date": "2013-06-12",
"videos": [
"http://thecolbertreport.cc.com/videos/jdqve3/stephen-colbert-s-tribute-to-having-paul-mccartney-on-his-show",
"http://thecolbertreport.cc.com/videos/eweibb/nsa-scandal-developments",
"http://thecolbertreport.cc.com/videos/9i45f0/paul-mccartney",
"http://thecolbertreport.cc.com/videos/2ildb8/nyc-bike-share"
],
"guest": "Paul McCartney"
},
{
"date": "2013-06-19",
"videos": [
"http://thecolbertreport.cc.com/videos/yxgnju/remembering-lorna-colbert",
"http://thecolbertreport.cc.com/videos/jm7bya/cap-n-crunch-scandal",
"http://thecolbertreport.cc.com/videos/rtfkei/tip-wag---wall-street---north-carolina",
"http://thecolbertreport.cc.com/videos/vztqfg/the-postal-service",
"http://thecolbertreport.cc.com/videos/7vr4pz/sign-off---stage-fall"
],
"guest": "The Postal Service"
},
{
"date": "2013-06-20",
"videos": [
"http://thecolbertreport.cc.com/videos/616g0e/intro---6-20-13",
"http://thecolbertreport.cc.com/videos/v8ee5f/iran-s-presidential-election",
"http://thecolbertreport.cc.com/videos/k3dodo/steve-king-on-chicken-cages",
"http://thecolbertreport.cc.com/videos/7udg5z/nestle-s-natural-resource",
"http://thecolbertreport.cc.com/videos/0mw5zk/joss-whedon",
"http://thecolbertreport.cc.com/videos/ooshhr/sign-off---paper-towel-tube-cage"
],
"guest": "Joss Whedon"
},
{
"date": "2013-06-24",
"videos": [
"http://thecolbertreport.cc.com/videos/6gyv8z/the-irs---darrell-issa-s-gut",
"http://thecolbertreport.cc.com/videos/oztyjs/the-word---truthinews",
"http://thecolbertreport.cc.com/videos/93t9s1/tiny-triumphs---laser-klan",
"http://thecolbertreport.cc.com/videos/dzzcx7/andrew-solomon",
"http://thecolbertreport.cc.com/videos/h7v6sr/sign-off---goodnight"
],
"guest": "Andrew Solomon"
},
{
"date": "2013-06-25",
"videos": [
"http://thecolbertreport.cc.com/videos/g5p8y4/intro---6-25-13",
"http://thecolbertreport.cc.com/videos/348hon/scotus-on-the-voting-rights-act",
"http://thecolbertreport.cc.com/videos/ysuxww/brazil-s-political-protests",
"http://thecolbertreport.cc.com/videos/3gv8et/brazil-s-political-protests---larry-rohter",
"http://thecolbertreport.cc.com/videos/mnxaxk/george-zimmerman-s-murder-trial",
"http://thecolbertreport.cc.com/videos/ip1pn0/peniel-joseph",
"http://thecolbertreport.cc.com/videos/b4zgvh/sign-off---goodnight"
],
"guest": "Peniel Joseph"
},
{
"date": "2013-06-26",
"videos": [
"http://thecolbertreport.cc.com/videos/m2xuu4/intro---6-26-13",
"http://thecolbertreport.cc.com/videos/nzd784/the-supreme-court-rules-on-doma",
"http://thecolbertreport.cc.com/videos/um981i/the-end-of-the-voting-rights-act",
"http://thecolbertreport.cc.com/videos/btpztg/the-voting-rights-act---gay-marriage---emily-bazelon",
"http://thecolbertreport.cc.com/videos/3ca2a0/bill-moyers",
"http://thecolbertreport.cc.com/videos/09w1k9/sign-off---goodnight"
],
"guest": "Bill Moyers"
},
{
"date": "2013-06-27",
"videos": [
"http://thecolbertreport.cc.com/videos/9lyyd3/4th-of-july-under-attack",
"http://thecolbertreport.cc.com/videos/3wbx1d/stephen-colbert-s-big-gay-roundup",
"http://thecolbertreport.cc.com/videos/ncxmfs/-gang-of-eight--immigration-reform-bill",
"http://thecolbertreport.cc.com/videos/0gj3ie/chuck-schumer",
"http://thecolbertreport.cc.com/videos/6kec7y/sign-off---goodnight"
],
"guest": "Sen. Chuck Schumer"
},
{
"date": "2013-07-15",
"videos": [
"http://thecolbertreport.cc.com/videos/6jl3zv/stephen-s-vacation",
"http://thecolbertreport.cc.com/videos/0gzuno/george-zimmerman-verdict",
"http://thecolbertreport.cc.com/videos/9nhthn/people-who-are-destroying-america---lynn-harrell",
"http://thecolbertreport.cc.com/videos/6dlnrd/ktvu-tv-on-asiana-airlines-crash",
"http://thecolbertreport.cc.com/videos/vwtsg0/jeremy-scahill",
"http://thecolbertreport.cc.com/videos/88fai0/sign-off---goodnight"
],
"guest": "Jeremy Scahill"
},
{
"date": "2013-07-16",
"videos": [
"http://thecolbertreport.cc.com/videos/2ymeh3/intro---7-16-13",
"http://thecolbertreport.cc.com/videos/rr5gb5/royal-baby-bump",
"http://thecolbertreport.cc.com/videos/dd82ys/tip-wag---non-rioting-black-people---fox-news",
"http://thecolbertreport.cc.com/videos/e8110o/npr-on-multitasking",
"http://thecolbertreport.cc.com/videos/e5obyh/david-karp",
"http://thecolbertreport.cc.com/videos/0mvlz8/sign-off---macbox"
],
"guest": "David Karp"
},
{
"date": "2013-07-17",
"videos": [
"http://thecolbertreport.cc.com/videos/84x6wp/rolling-stone-s-boston-bomber-cover",
"http://thecolbertreport.cc.com/videos/eiwwmp/dysfunctional-house-republicans---immigration-reform",
"http://thecolbertreport.cc.com/videos/dii80x/food-stamp-funding",
"http://thecolbertreport.cc.com/videos/279goq/jerry-seinfeld-pt--1",
"http://thecolbertreport.cc.com/videos/pw17w7/jerry-seinfeld-pt--2",
"http://thecolbertreport.cc.com/videos/qfpfy4/sign-off---paper-fan"
],
"guest": "Jerry Seinfeld"
},
{
"date": "2013-07-18",
"videos": [
"http://thecolbertreport.cc.com/videos/r4piw8/edward-snowden-s-asylum-option",
"http://thecolbertreport.cc.com/videos/2m27vd/political-sex-scandals---new-york-city-elections",
"http://thecolbertreport.cc.com/videos/dpebt7/political-sex-scandals---new-york-city-elections---eliot-spitzer",
"http://thecolbertreport.cc.com/videos/m8rn8j/breaking-news-on-college-sex",
"http://thecolbertreport.cc.com/videos/y56hes/jeff-bridges",
"http://thecolbertreport.cc.com/videos/fiop8t/sign-off----operation-javelin-"
],
"guest": "Jeff Bridges"
},
{
"date": "2013-07-22",
"videos": [
"http://thecolbertreport.cc.com/videos/20zlbx/britain-s-royal-baby",
"http://thecolbertreport.cc.com/videos/d0bn33/geraldo-rivera-s-tribute-to-helen-thomas",
"http://thecolbertreport.cc.com/videos/8fg72p/minimum-wage---mcdonald-s-spending-journal",
"http://thecolbertreport.cc.com/videos/0p9n45/neil-degrasse-tyson-s-alien-theory",
"http://thecolbertreport.cc.com/videos/3azmuc/kjerstin-gruys",
"http://thecolbertreport.cc.com/videos/mritg0/sign-off---linguini-worm"
],
"guest": "Kjerstin Gruys"
},
{
"date": "2013-07-23",
"videos": [
"http://thecolbertreport.cc.com/videos/y6fmk6/royal-afterbirth--013-",
"http://thecolbertreport.cc.com/videos/adczam/george-zimmerman---racial-tensions",
"http://thecolbertreport.cc.com/videos/3vijkd/the-word---color-bind",
"http://thecolbertreport.cc.com/videos/vbghld/domino-s-pizza-drone",
"http://thecolbertreport.cc.com/videos/5tqazj/kenneth-goldsmith",
"http://thecolbertreport.cc.com/videos/fvgc0u/sign-off---goodnight"
],
"guest": "Kenneth Goldsmith"
},
{
"date": "2013-07-24",
"videos": [
"http://thecolbertreport.cc.com/videos/508jwm/royal-baby-fever",
"http://thecolbertreport.cc.com/videos/eodctw/anthony-weiner-s-penis",
"http://thecolbertreport.cc.com/videos/4sgopv/carlos-danger--secret-mayor",
"http://thecolbertreport.cc.com/videos/bf89i9/kanye-west-s-clothing-line",
"http://thecolbertreport.cc.com/videos/zwqhae/anant-agarwal",
"http://thecolbertreport.cc.com/videos/gbago4/sign-off---goodnight"
],
"guest": "Anant Agarwal"
},
{
"date": "2013-07-25",
"videos": [
"http://thecolbertreport.cc.com/videos/l1dtzt/london-s-fake-town-crier",
"http://thecolbertreport.cc.com/videos/lyjdmu/detroit-s-bankruptcy",
"http://thecolbertreport.cc.com/videos/h9c7gh/detroit-s-bankruptcy---stephen-henderson",
"http://thecolbertreport.cc.com/videos/8chokd/steve-king-s-immigrant-analogy",
"http://thecolbertreport.cc.com/videos/263vwc/olympia-snowe",
"http://thecolbertreport.cc.com/videos/kx84kd/sign-off---hand-bell"
],
"guest": "Olympia Snowe"
},
{
"date": "2013-07-29",
"videos": [
"http://thecolbertreport.cc.com/videos/uw17hh/intro---7-29-13",
"http://thecolbertreport.cc.com/videos/n0w3zw/obamacare-cards",
"http://thecolbertreport.cc.com/videos/pna3x8/tip-wag---steve-stockman--david-cameron---north-carolina-legislature",
"http://thecolbertreport.cc.com/videos/2i98l3/the-lumineers",
"http://thecolbertreport.cc.com/videos/1i7dzf/sign-off---tambourine"
],
"guest": "The Lumineers"
},
{
"date": "2013-07-30",
"videos": [
"http://thecolbertreport.cc.com/videos/trrcbd/intro---7-30-13",
"http://thecolbertreport.cc.com/videos/mulhwo/smokin--pole---the-quest-for-arctic-riches--north-pole-lake",
"http://thecolbertreport.cc.com/videos/gr77sg/senator-gridlock",
"http://thecolbertreport.cc.com/videos/hrha3p/the-word---secrets---laws",
"http://thecolbertreport.cc.com/videos/jah6al/ted-cruz-s-humble-portrait",
"http://thecolbertreport.cc.com/videos/bhod50/atul-gawande",
"http://thecolbertreport.cc.com/videos/c1f9z7/sign-off---sleigh-bells"
],
"guest": "Atul Gawande"
},
{
"date": "2013-07-31",
"videos": [
"http://thecolbertreport.cc.com/videos/4dtx20/intro---7-31-13",
"http://thecolbertreport.cc.com/videos/6p4joy/bradley-manning-verdict",
"http://thecolbertreport.cc.com/videos/hcbpix/lunch-or-campaign-2016-",
"http://thecolbertreport.cc.com/videos/21zxm1/chris-christie-vs--rand-paul",
"http://thecolbertreport.cc.com/videos/zyu4c8/stephen-colbert-s-super-coin-toss",
"http://thecolbertreport.cc.com/videos/ngxjwr/emily-matchar",
"http://thecolbertreport.cc.com/videos/f1q01l/sign-off---game-over"
],
"guest": "Emily Matchar"
},
{
"date": "2013-08-01",
"videos": [
"http://thecolbertreport.cc.com/videos/s9hzk7/intro---8-1-13",
"http://thecolbertreport.cc.com/videos/09hbf0/edward-snowden-s-asylum",
"http://thecolbertreport.cc.com/videos/o0rsdt/oppressed-white-male-alert---bob-filner",
"http://thecolbertreport.cc.com/videos/y8ilbl/grab-ask-5800",
"http://thecolbertreport.cc.com/videos/opj4x1/threatdown---global-erotic-extremism--mini-muslims---stripper-bears",
"http://thecolbertreport.cc.com/videos/gyog46/bryan-cranston",
"http://thecolbertreport.cc.com/videos/qv7up3/sign-off---goodnight"
],
"guest": "Bryan Cranston"
},
{
"date": "2013-08-05",
"videos": [
"http://thecolbertreport.cc.com/videos/n525ux/global-terror-warning",
"http://thecolbertreport.cc.com/videos/1y9s5s/sport-report---a-rod-s-drug-scandal---combat-juggling",
"http://thecolbertreport.cc.com/videos/91y2gj/hugh-laurie",
"http://thecolbertreport.cc.com/videos/g0yu17/broadcast-networks-want-more-indecency",
"http://thecolbertreport.cc.com/videos/n9o8qy/sign-off---glossary-of-terms"
],
"guest": "Hugh Laurie"
},
{
"date": "2013-08-06",
"videos": [
"http://thecolbertreport.cc.com/videos/4ybtps/stephest-colbchella--013---the-song-of-the-summer-of-the-century",
"http://thecolbertreport.cc.com/videos/s9j4ux/stephest-colbchella--013---special-guest-stephen-colbert-"
],
"guest": "Robin Thicke"
},
{
"date": "2013-08-07",
"videos": [
"http://thecolbertreport.cc.com/videos/0t0r8t/stephest-colbchella--013---disco-decepticons",
"http://thecolbertreport.cc.com/videos/je51p5/rich-white-guys-agreeing-with-each-other-alert---neil-cavuto",
"http://thecolbertreport.cc.com/videos/m9o287/fast-food-workers-strike---mary-kay-henry",
"http://thecolbertreport.cc.com/videos/b0jyca/sec-vs--fabulous-fab",
"http://thecolbertreport.cc.com/videos/rrfnhj/ashton-kutcher",
"http://thecolbertreport.cc.com/videos/iqw6df/sign-off---goodnight"
],
"guest": "Ashton Kutcher"
},
{
"date": "2013-08-08",
"videos": [
"http://thecolbertreport.cc.com/videos/ehgkke/ganjay-supta",
"http://thecolbertreport.cc.com/videos/x55kjy/hollywood-heroes",
"http://thecolbertreport.cc.com/videos/lual8r/hollywood-heroes---matt-damon",
"http://thecolbertreport.cc.com/videos/qqmmcz/the-ronald-wilson-reagan-economic-breathing-zone",
"http://thecolbertreport.cc.com/videos/6duz1s/colum-mccann",
"http://thecolbertreport.cc.com/videos/fama3f/sign-off----fifty-shades-of-grey-"
],
"guest": "Colum McCann"
},
{
"date": "2013-08-12",
"videos": [
"http://thecolbertreport.cc.com/videos/m7rv7i/badonkadonk-journalism",
"http://thecolbertreport.cc.com/videos/qokabz/better-know-a-district---new-jersey-s-12th",
"http://thecolbertreport.cc.com/videos/vni3w0/better-know-a-district---new-jersey-s-12th---rush-holt",
"http://thecolbertreport.cc.com/videos/swss3n/innocent-tourist-mistake",
"http://thecolbertreport.cc.com/videos/lixrq0/sheldon-whitehouse",
"http://thecolbertreport.cc.com/videos/ck9vu0/sign-off---goodnight"
],
"guest": "Sen. Sheldon Whitehouse"
},
{
"date": "2013-08-13",
"videos": [
"http://thecolbertreport.cc.com/videos/jtshn3/stop-and-frisk---mandatory-minimums",
"http://thecolbertreport.cc.com/videos/o5aiwi/tsa-expansion-program",
"http://thecolbertreport.cc.com/videos/miwb3z/tsa-expansion-program---steven-pinker",
"http://thecolbertreport.cc.com/videos/pd148a/john-lewis-pt--1",
"http://thecolbertreport.cc.com/videos/ocqoae/john-lewis-pt--2",
"http://thecolbertreport.cc.com/videos/z6ytj0/sign-off----the-better-angels-of-our-nature-"
],
"guest": "Rep. John Lewis"
},
{
"date": "2013-08-14",
"videos": [
"http://thecolbertreport.cc.com/videos/als8jg/intro---8-14-13",
"http://thecolbertreport.cc.com/videos/wjgfbx/sochi-2014-winter-olympics",
"http://thecolbertreport.cc.com/videos/y58ew9/people-who-are-destroying-america---johnny-cummings",
"http://thecolbertreport.cc.com/videos/oafmw7/big-mother-government",
"http://thecolbertreport.cc.com/videos/wc12me/kevin-spacey",
"http://thecolbertreport.cc.com/videos/o1qztj/sign-off---goodnight"
],
"guest": "Kevin Spacey"
},
{
"date": "2013-08-15",
"videos": [
"http://thecolbertreport.cc.com/videos/fwx35y/obama-rodeo-clown",
"http://thecolbertreport.cc.com/videos/0bdl0z/golden-age-of-flammability",
"http://thecolbertreport.cc.com/videos/r9ju4t/the-word---gag-gift",
"http://thecolbertreport.cc.com/videos/jngkv0/nsa-press-conference-on-domestic-spying",
"http://thecolbertreport.cc.com/videos/8ax5jq/richard-brodhead",
"http://thecolbertreport.cc.com/videos/42qo92/sign-off---second-installment-of-colbert-s-book-club"
],
"guest": "Richard Brodhead"
},
{
"date": "2013-09-03",
"videos": [
"http://thecolbertreport.cc.com/videos/pkboc3/exclusive---better-know-a-district---michigan-s-5th---dan-kildee",
"http://thecolbertreport.cc.com/videos/pnf1sx/intro---9-3-13",
"http://thecolbertreport.cc.com/videos/tx5zzr/stephen-s-science-project---chemical-weapons-in-syria",
"http://thecolbertreport.cc.com/videos/dhyi3l/better-know-a-district---michigan-s-5th---dan-kildee",
"http://thecolbertreport.cc.com/videos/pwzlgj/timothy-dolan-pt--1",
"http://thecolbertreport.cc.com/videos/m4p07o/timothy-dolan-pt--2",
"http://thecolbertreport.cc.com/videos/xws5t1/sign-off---welcome-baby-rosta-"
],
"guest": "Timothy Cardinal Dolan"
},
{
"date": "2013-09-04",
"videos": [
"http://thecolbertreport.cc.com/videos/4obytf/intro---9-4-13",
"http://thecolbertreport.cc.com/videos/020ri3/cris-ish-in-syri-eh",
"http://thecolbertreport.cc.com/videos/jtjmpo/cris-ish-in-syri-eh---steve-coll",
"http://thecolbertreport.cc.com/videos/hrfvxe/perfect-polly",
"http://thecolbertreport.cc.com/videos/q9zsg7/gary-england",
"http://thecolbertreport.cc.com/videos/jnebqk/sign-off---goodnight"
],
"guest": "Gary England"
},
{
"date": "2013-09-05",
"videos": [
"http://thecolbertreport.cc.com/videos/fzzhny/intro---9-5-13",
"http://thecolbertreport.cc.com/videos/cgxdol/smile-file---ariel-castro---the-eric-bolling-sunshine-express",
"http://thecolbertreport.cc.com/videos/cn86ce/kitten-subway-crisis---the-new-york-city-mayoral-race",
"http://thecolbertreport.cc.com/videos/l0disu/colbert-s-book-club---the-couch-bunker",
"http://thecolbertreport.cc.com/videos/ub6jy0/john-prine"
],
"guest": "John Prine"
},
{
"date": "2013-09-09",
"videos": [
"http://thecolbertreport.cc.com/videos/m0qnfl/egypt-s-stork-bust",
"http://thecolbertreport.cc.com/videos/4zp755/syrian-conflict-action-plan",
"http://thecolbertreport.cc.com/videos/jvhzt0/ronald-reagan-on-the-syrian-conflict",
"http://thecolbertreport.cc.com/videos/a4utu0/tip-wag---iowa--bigger-pants---recent-articles",
"http://thecolbertreport.cc.com/videos/f9cuxl/billie-jean-king",
"http://thecolbertreport.cc.com/videos/2dw2cm/sign-off---spider-reagan"
],
"guest": "Billie Jean King"
},
{
"date": "2013-09-10",
"videos": [
"http://thecolbertreport.cc.com/videos/o8sjcq/colbert-s-book-club---j-d--salinger",
"http://thecolbertreport.cc.com/videos/49qji6/colbert-s-book-club---better-know-a-salinger",
"http://thecolbertreport.cc.com/videos/ueo7a2/colbert-s-book-club---tobias-wolff----the-catcher-in-the-rye-",
"http://thecolbertreport.cc.com/videos/f2a6ao/colbert-s-book-club---shane-salerno-on-j-d--salinger",
"http://thecolbertreport.cc.com/videos/2p7nwl/sign-off---colbert-s-book-club---j-d--salinger-s-glass-family"
],
"guest": "Shane Salerno"
},
{
"date": "2013-09-11",
"videos": [
"http://thecolbertreport.cc.com/videos/lop9g2/new-york-city-mayoral-primary",
"http://thecolbertreport.cc.com/videos/pymjnx/america-s-got-serious-reservations-about-this---syria",
"http://thecolbertreport.cc.com/videos/cta0kn/america-s-got-serious-reservations-about-this---syria---rand-paul",
"http://thecolbertreport.cc.com/videos/w9ejb1/barack-obama-s-footgate---secret-muslim-code",
"http://thecolbertreport.cc.com/videos/p83qs9/sheryl-crow"
],
"guest": "Sheryl Crow"
},
{
"date": "2013-09-12",
"videos": [
"http://thecolbertreport.cc.com/videos/r3zogj/vladimir-putin-s-op-ed-photos",
"http://thecolbertreport.cc.com/videos/bujbay/better-know-a-district---washington-s-7th---jim-mcdermott",
"http://thecolbertreport.cc.com/videos/7z7vfu/vladimir-putin-s-op-ed-on-u-s--intervention-in-syria",
"http://thecolbertreport.cc.com/videos/cm16zd/philip-mudd",
"http://thecolbertreport.cc.com/videos/4lw1cp/sign-off---goodnight"
],
"guest": "Philip Mudd"
},
{
"date": "2013-09-16",
"videos": [
"http://thecolbertreport.cc.com/videos/weeyn5/intro---9-16-13",
"http://thecolbertreport.cc.com/videos/2lxvvp/lehman-brothers-anniversary---economic-recovery",
"http://thecolbertreport.cc.com/videos/ggices/the-word---the-guilted-age",
"http://thecolbertreport.cc.com/videos/vui8um/miss-america-2013",
"http://thecolbertreport.cc.com/videos/v77k60/andrew-bacevich",
"http://thecolbertreport.cc.com/videos/c31p0i/sign-off---financial-crisis-anniversary-cake"
],
"guest": "Andrew Bacevich"
},
{
"date": "2013-09-17",
"videos": [
"http://thecolbertreport.cc.com/videos/qkhrkt/intro---9-17-13",
"http://thecolbertreport.cc.com/videos/hwlkz5/the-people-s-republic-of-obamastan---forbes-400-losers",
"http://thecolbertreport.cc.com/videos/cgb0cw/colbert-platinum---luxury-ice---hot-dic-tip",
"http://thecolbertreport.cc.com/videos/rkpujl/soul-rending-cheerios-ad",
"http://thecolbertreport.cc.com/videos/2dwhox/arne-duncan",
"http://thecolbertreport.cc.com/videos/ukxkfk/sign-off---goodnight"
],
"guest": "Arne Duncan"
},
{
"date": "2013-09-18",
"videos": [
"http://thecolbertreport.cc.com/videos/g7l8kk/syria-conflict---end-times-prophecy",
"http://thecolbertreport.cc.com/videos/8pp3si/united-nations-on-syria-conflict---andrew-sullivan",
"http://thecolbertreport.cc.com/videos/v0wk5h/navy-yard-shooting---gun-violence-causes",
"http://thecolbertreport.cc.com/videos/ft7l84/nicholson-baker",
"http://thecolbertreport.cc.com/videos/lpg81o/sign-off----damascus-countdown-"
],
"guest": "Nicholson Baker"
},
{
"date": "2013-09-19",
"videos": [
"http://thecolbertreport.cc.com/videos/1j1cxh/michelle-obama-s-h2o-campaign",
"http://thecolbertreport.cc.com/videos/4iux0d/obamacare-government-shutdown",
"http://thecolbertreport.cc.com/videos/6nrq55/obamacare-navigators",
"http://thecolbertreport.cc.com/videos/7qwiwv/tip-wag---hammunition---george-clooney",
"http://thecolbertreport.cc.com/videos/x5xw6g/jack-johnson"
],
"guest": "Jack Johnson"
},
{
"date": "2013-09-24",
"videos": [
"http://thecolbertreport.cc.com/videos/ecu59e/stephen-s-emmy-awards",
"http://thecolbertreport.cc.com/videos/nsfkr7/on-notice---pope-francis",
"http://thecolbertreport.cc.com/videos/vb7ms1/on-notice---pope-francis---jim-martin",
"http://thecolbertreport.cc.com/videos/7xtam8/metallica",
"http://thecolbertreport.cc.com/videos/g9dzis/sign-off---emmy-exhibition"
],
"guest": "Metallica"
},
{
"date": "2013-09-25",
"videos": [
"http://thecolbertreport.cc.com/videos/8fmvel/censorship-for-youtube-comments",
"http://thecolbertreport.cc.com/videos/lsiidb/sport-report---cranium-coddlers---san-francisco-street-chess---floyd-mayweather",
"http://thecolbertreport.cc.com/videos/ks6rd5/ted-cruz-s-obamacare--filibuster-",
"http://thecolbertreport.cc.com/videos/urqr8j/joseph-gordon-levitt",
"http://thecolbertreport.cc.com/videos/93nnw6/sign-off---ring-announcer"
],
"guest": "Joseph Gordon-Levitt"
},
{
"date": "2013-09-26",
"videos": [
"http://thecolbertreport.cc.com/videos/itk7kp/americone-dream-product-placement",
"http://thecolbertreport.cc.com/videos/u1mo7v/chris-fischer",
"http://thecolbertreport.cc.com/videos/lo2m3c/intro---9-26-13",
"http://thecolbertreport.cc.com/videos/153u0a/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/87ddew/time-travel-adventures-with-conservatives"
],
"guest": "Chris Fischer"
},
{
"date": "2013-09-30",
"videos": [
"http://thecolbertreport.cc.com/videos/mp715j/rockin--government-shutdown-eve",
"http://thecolbertreport.cc.com/videos/pbvraa/tip-wag---butterball--ashley-merryman---science",
"http://thecolbertreport.cc.com/videos/wzj7bh/vince-gilligan-pt--1",
"http://thecolbertreport.cc.com/videos/xid9jc/vince-gilligan-pt--2"
],
"guest": "Vince Gilligan"
},
{
"date": "2013-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/99odk6/federal-government-shutdown",
"http://thecolbertreport.cc.com/videos/cn352h/affordable-care-act---obama-s-computerized-america",
"http://thecolbertreport.cc.com/videos/1ntmd2/adorable-care-act---generation-opportunity",
"http://thecolbertreport.cc.com/videos/gfz4h7/national-hispanic-heritage-month",
"http://thecolbertreport.cc.com/videos/obk0r1/daniel-radcliffe",
"http://thecolbertreport.cc.com/videos/7ni2qs/sign-off---goodnight"
],
"guest": "Daniel Radcliffe"
},
{
"date": "2013-10-02",
"videos": [
"http://thecolbertreport.cc.com/videos/aykl9k/intro---10-2-13",
"http://thecolbertreport.cc.com/videos/qx1ar9/1995-shutdown-survival-bunker",
"http://thecolbertreport.cc.com/videos/qz6a9i/government--slimdown----potus-meeting",
"http://thecolbertreport.cc.com/videos/xjdheq/blood-in-the-water---bill-o-reilly-s--killing-jesus-",
"http://thecolbertreport.cc.com/videos/5ynb8q/chris-matthews",
"http://thecolbertreport.cc.com/videos/mvs3wz/sign-off---shutdown-survival-bunker"
],
"guest": "Chris Matthews"
},
{
"date": "2013-10-03",
"videos": [
"http://thecolbertreport.cc.com/videos/7l0bys/government-shutdown-day-three",
"http://thecolbertreport.cc.com/videos/amjasd/the-2013-government-shutdown-wedding-of-the-century-pt--1",
"http://thecolbertreport.cc.com/videos/qt2vrd/david-finkel",
"http://thecolbertreport.cc.com/videos/6as11u/sign-off---audra-mcdonald-s-availability"
],
"guest": "David Finkel"
},
{
"date": "2013-10-07",
"videos": [
"http://thecolbertreport.cc.com/videos/iyj9i2/government-shutdown-s-one-week-anniversary",
"http://thecolbertreport.cc.com/videos/f9ohl9/bond-v--united-states",
"http://thecolbertreport.cc.com/videos/rodf66/mccutcheon-v--fec---emily-bazelon",
"http://thecolbertreport.cc.com/videos/d10tae/banksy-s-new-york-reign-of-terror",
"http://thecolbertreport.cc.com/videos/feyjl3/james-spithill",
"http://thecolbertreport.cc.com/videos/m7oe3o/sign-off----not-a-game--game"
],
"guest": "James Spithill"
},
{
"date": "2013-10-08",
"videos": [
"http://thecolbertreport.cc.com/videos/phldtj/intro---10-8-13",
"http://thecolbertreport.cc.com/videos/u5kkik/debt-ceiling-deadline",
"http://thecolbertreport.cc.com/videos/2b5rst/pro-pot-laws---pointers",
"http://thecolbertreport.cc.com/videos/049124/thanksgiving-under-attack---hanukkah",
"http://thecolbertreport.cc.com/videos/llhqmr/paul-giamatti",
"http://thecolbertreport.cc.com/videos/tuzaza/sign-off----tj---dave-"
],
"guest": "Paul Giamatti"
},
{
"date": "2013-10-09",
"videos": [
"http://thecolbertreport.cc.com/videos/pjgp86/intro---10-9-13",
"http://thecolbertreport.cc.com/videos/ssksja/ride-for-the-constitution",
"http://thecolbertreport.cc.com/videos/h502rh/twitter-s-ipo",
"http://thecolbertreport.cc.com/videos/k9g3h2/tom-emmer-s-controversial-ad",
"http://thecolbertreport.cc.com/videos/ldxsu2/tom-hanks",
"http://thecolbertreport.cc.com/videos/uevql0/sign-off---goodnight"
],
"guest": "Tom Hanks"
},
{
"date": "2013-10-10",
"videos": [
"http://thecolbertreport.cc.com/videos/xqbppa/government-shutdown-day-10---shep-smith-s-input",
"http://thecolbertreport.cc.com/videos/bzo5fv/because-shep---fox-news-deck",
"http://thecolbertreport.cc.com/videos/rt3php/because-shep---fox-news-deck---colbert-info-news-veranda",
"http://thecolbertreport.cc.com/videos/r2mded/hanksy-s-grizzly-art",
"http://thecolbertreport.cc.com/videos/twnvtr/reed-albergotti---vanessa-o-connell",
"http://thecolbertreport.cc.com/videos/gn1hnb/sign-off---goodnight"
],
"guest": "Reed Albergotti & Vanessa O'Connell"
},
{
"date": "2013-10-21",
"videos": [
"http://thecolbertreport.cc.com/videos/zabrcj/end-of-the-government-shutdown",
"http://thecolbertreport.cc.com/videos/fs5lvs/tip-wag---new-jersey--robo-teachers---amazon-erotica",
"http://thecolbertreport.cc.com/videos/xmc07q/the-reflektors",
"http://thecolbertreport.cc.com/videos/z30io4/sign-off----midnight"
],
"guest": "The Reflektors"
},
{
"date": "2013-10-22",
"videos": [
"http://thecolbertreport.cc.com/videos/0nhfjd/intro---10-22-13",
"http://thecolbertreport.cc.com/videos/tpp3c7/the-in-box---lions-vs--tigers",
"http://thecolbertreport.cc.com/videos/w4k85n/thought-for-food---kfc-s-go-cup---powerful-yogurt",
"http://thecolbertreport.cc.com/videos/wv85sy/the-neiman-marcus-christmas-book",
"http://thecolbertreport.cc.com/videos/413dai/a--scott-berg",
"http://thecolbertreport.cc.com/videos/j9enbw/sign-off----the-heart-of-giving-"
],
"guest": "A. Scott Berg"
},
{
"date": "2013-10-23",
"videos": [
"http://thecolbertreport.cc.com/videos/pfan07/obamacare-website-gate",
"http://thecolbertreport.cc.com/videos/51c17c/i-tried-to-sign-up-for-obamacare---health-care-house-of-horrors",
"http://thecolbertreport.cc.com/videos/w07qf1/i-tried-to-sign-up-for-obamacare---health-care-navigators",
"http://thecolbertreport.cc.com/videos/j95qfd/judy-woodruff---gwen-ifill",
"http://thecolbertreport.cc.com/videos/rtpako/sign-off---goodnight"
],
"guest": "Gwen Ifill, Judy Woodruff"
},
{
"date": "2013-10-24",
"videos": [
"http://thecolbertreport.cc.com/videos/3cv3ae/intro---10-24-13",
"http://thecolbertreport.cc.com/videos/8rabqj/girly-hats-for-the-marines",
"http://thecolbertreport.cc.com/videos/6zcsyl/the-word---philantrophy",
"http://thecolbertreport.cc.com/videos/60wsnw/craziest-f--king-thing-i-ve-ever-heard---tomtatoes",
"http://thecolbertreport.cc.com/videos/9ak9w5/stephen-fry",
"http://thecolbertreport.cc.com/videos/9py49q/sign-off---goodnight"
],
"guest": "Stephen Fry"
},
{
"date": "2013-10-28",
"videos": [
"http://thecolbertreport.cc.com/videos/xfzjxy/healthcare-gov-s-missing-woman",
"http://thecolbertreport.cc.com/videos/0m56pa/germany-s-nsa-outrage",
"http://thecolbertreport.cc.com/videos/7egvpg/germany-s-nsa-outrage---mark-mazzetti",
"http://thecolbertreport.cc.com/videos/boarwv/lifetime-of-furfillment",
"http://thecolbertreport.cc.com/videos/kz8x10/orlando-bloom",
"http://thecolbertreport.cc.com/videos/fl658q/sign-off---goodnight"
],
"guest": "Orlando Bloom"
},
{
"date": "2013-10-29",
"videos": [
"http://thecolbertreport.cc.com/videos/dhae0b/intro---10-29-13",
"http://thecolbertreport.cc.com/videos/qingaf/the-word---on-your-feet",
"http://thecolbertreport.cc.com/videos/yxqllm/rand-paul-s-plagiarism-problem",
"http://thecolbertreport.cc.com/videos/j9efvm/billy-collins",
"http://thecolbertreport.cc.com/videos/fnaadw/sign-off----aimless-love-"
],
"guest": "Billy Collins"
},
{
"date": "2013-10-30",
"videos": [
"http://thecolbertreport.cc.com/videos/wibml9/intro---10-30-13",
"http://thecolbertreport.cc.com/videos/me8aye/the-gop-s-self-disapproval",
"http://thecolbertreport.cc.com/videos/jns4fj/threatdown---divorce--undocumented-network-jumpers---global-warming",
"http://thecolbertreport.cc.com/videos/ammjdj/shepard-smith-s-digital-dependency",
"http://thecolbertreport.cc.com/videos/7frodo/jack-andraka",
"http://thecolbertreport.cc.com/videos/s14fzp/sign-off---goodnight"
],
"guest": "Jack Andraka"
},
{
"date": "2013-10-31",
"videos": [
"http://thecolbertreport.cc.com/videos/vr2jg3/intro---10-31-13",
"http://thecolbertreport.cc.com/videos/8q3ppm/war-on-halloween---matt-lauer-s-costume",
"http://thecolbertreport.cc.com/videos/2krnuz/blood-in-the-water---jim-wheeler-s-hypothetical-slavery-vote",
"http://thecolbertreport.cc.com/videos/mzqttu/the-word---see-no-evil",
"http://thecolbertreport.cc.com/videos/owduja/zach-sims",
"http://thecolbertreport.cc.com/videos/53uet6/sign-off---the-glenlivet"
],
"guest": "Zach Sims"
},
{
"date": "2013-11-04",
"videos": [
"http://thecolbertreport.cc.com/videos/hfr88n/intro---11-4-13",
"http://thecolbertreport.cc.com/videos/v68n7l/obamacare-s-gender-blind-premiums",
"http://thecolbertreport.cc.com/videos/oi11jp/the-word---inc--god-we-trust",
"http://thecolbertreport.cc.com/videos/29w6fx/-realhumanpraise-for-fox-news",
"http://thecolbertreport.cc.com/videos/z1sht0/david-folkenflik",
"http://thecolbertreport.cc.com/videos/vl9eiz/sign-off---goodnight"
],
"guest": "David Folkenflik"
},
{
"date": "2013-11-05",
"videos": [
"http://thecolbertreport.cc.com/videos/owoy1b/exclusive---julius-erving-extended-interview",
"http://thecolbertreport.cc.com/videos/7bd2cq/rob-ford-s-crack-scandal",
"http://thecolbertreport.cc.com/videos/s5iv9f/difference-makers---tim-morrison-and-meagan-brame",
"http://thecolbertreport.cc.com/videos/6abc8c/gay-sex-in-the-insect-world",
"http://thecolbertreport.cc.com/videos/9v56tr/julius-erving",
"http://thecolbertreport.cc.com/videos/du2t8n/sign-off---crack-pipe"
],
"guest": "Julius Erving"
},
{
"date": "2013-11-06",
"videos": [
"http://thecolbertreport.cc.com/videos/rpo0ya/ms--marvel-s-reboot",
"http://thecolbertreport.cc.com/videos/el55uc/tip-wag---toys--r--us--shroom-tombs---john-pike",
"http://thecolbertreport.cc.com/videos/hdhamk/washington-state-s-gmo-labeling-initiative",
"http://thecolbertreport.cc.com/videos/7nyym9/brian-lehrer",
"http://thecolbertreport.cc.com/videos/snu1i2/sign-off---welcome-baby-fischel-"
],
"guest": "Brian Lehrer"
},
{
"date": "2013-11-07",
"videos": [
"http://thecolbertreport.cc.com/videos/d61yyh/employment-non-discrimination-act",
"http://thecolbertreport.cc.com/videos/4cx9x8/sport-report---washington-redskins-name-controversy---miami-dolphins-bullying-allegations",
"http://thecolbertreport.cc.com/videos/7cyanz/who-might-be-honoring-me-next----people-s-choice-awards",
"http://thecolbertreport.cc.com/videos/80epmw/daniel-lieberman",
"http://thecolbertreport.cc.com/videos/tx4mq5/sign-off---people-s-choice-awards"
],
"guest": "Daniel Lieberman"
},
{
"date": "2013-11-11",
"videos": [
"http://thecolbertreport.cc.com/videos/84rhzu/-60-minutes--benghazi-controversy",
"http://thecolbertreport.cc.com/videos/uwudem/-60-minutes--benghazi-controversy---poncho-denews--bogus-bombshell",
"http://thecolbertreport.cc.com/videos/bd4gnc/chris-christie-s-sunday-media-blitz",
"http://thecolbertreport.cc.com/videos/2lqizl/peter-baker",
"http://thecolbertreport.cc.com/videos/kglpif/sign-off---goodnight"
],
"guest": "Peter Baker"
},
{
"date": "2013-11-12",
"videos": [
"http://thecolbertreport.cc.com/videos/iitiue/intro---11-12-13",
"http://thecolbertreport.cc.com/videos/pqrcpb/obamacare-enrollment-troubles",
"http://thecolbertreport.cc.com/videos/s7e3qv/iran-nuke-negotiations---french-resistance",
"http://thecolbertreport.cc.com/videos/0qvety/iran-nuke-negotiations---trita-parsi",
"http://thecolbertreport.cc.com/videos/9s2qhn/shantytown-glamour-camping",
"http://thecolbertreport.cc.com/videos/91wur1/david-christian",
"http://thecolbertreport.cc.com/videos/61ms6y/sign-off----a-single-roll-of-the-dice-"
],
"guest": "David Christian"
},
{
"date": "2013-11-13",
"videos": [
"http://thecolbertreport.cc.com/videos/1p3who/u-s--drone-controversy",
"http://thecolbertreport.cc.com/videos/h4v9zq/difference-makers---philip-steel",
"http://thecolbertreport.cc.com/videos/w8qzgv/blood-in-the-water---richard-cohen-s-conventional-wisdom",
"http://thecolbertreport.cc.com/videos/sn95d6/blind-boys-of-alabama---jimmy-carter"
],
"guest": "Blind Boys of Alabama"
},
{
"date": "2013-11-14",
"videos": [
"http://thecolbertreport.cc.com/videos/2o6sb0/philippines-typhoon-relief",
"http://thecolbertreport.cc.com/videos/8olyhc/rob-ford-s-defiance",
"http://thecolbertreport.cc.com/videos/wrbvsm/alexis-ohanian",
"http://thecolbertreport.cc.com/videos/nmbdiq/sign-off---kitten-cuddle"
],
"guest": "Alexis Ohanian"
},
{
"date": "2013-11-18",
"videos": [
"http://thecolbertreport.cc.com/videos/yv49an/intro---11-18-13",
"http://thecolbertreport.cc.com/videos/m7v6ee/philippines-relief-from-the-colbert-nation",
"http://thecolbertreport.cc.com/videos/suwtn9/obamacare-backlash---pundit-hyperbole",
"http://thecolbertreport.cc.com/videos/gnc6o8/obamacare-backlash---conservative-victory-lap",
"http://thecolbertreport.cc.com/videos/12pe6a/alpha-dog-of-the-week---chip-wilson",
"http://thecolbertreport.cc.com/videos/cdeggb/steve-mcqueen",
"http://thecolbertreport.cc.com/videos/5ow82m/sign-off---goodnight"
],
"guest": "Steve McQueen"
},
{
"date": "2013-11-19",
"videos": [
"http://thecolbertreport.cc.com/videos/kzu5qm/walmart-s-employee-food-drive",
"http://thecolbertreport.cc.com/videos/fkmwr4/america-s-wealth-divide",
"http://thecolbertreport.cc.com/videos/nj0wp7/america-s-wealth-divide---robert-reich",
"http://thecolbertreport.cc.com/videos/ppx1hm/slate-s--minutes-to-read--feature",
"http://thecolbertreport.cc.com/videos/g1usdl/rick-santorum",
"http://thecolbertreport.cc.com/videos/jnk6o6/sign-off---sweater-vest"
],
"guest": "Rick Santorum"
},
{
"date": "2013-11-20",
"videos": [
"http://thecolbertreport.cc.com/videos/kv4dxf/intro---11-20-13",
"http://thecolbertreport.cc.com/videos/xxqfor/trey-radel-s-cocaine-arrest",
"http://thecolbertreport.cc.com/videos/s2213y/tip-wag---hopped-up-pops--starbucks---american-consumers",
"http://thecolbertreport.cc.com/videos/aiu6v1/sport-report---russia-s-anti-gay-winter-games",
"http://thecolbertreport.cc.com/videos/bjap7z/m-i-a-"
],
"guest": "M.I.A."
},
{
"date": "2013-11-21",
"videos": [
"http://thecolbertreport.cc.com/videos/bz75lg/intro---11-21-13",
"http://thecolbertreport.cc.com/videos/16t3na/nuclear-option-in-the-senate",
"http://thecolbertreport.cc.com/videos/ynxkze/mary-fallin-and-same-sex-benefits",
"http://thecolbertreport.cc.com/videos/pqqitw/guess-who-s-coming-to-thanksgiving-dinner-",
"http://thecolbertreport.cc.com/videos/5idfv3/j-j--abrams",
"http://thecolbertreport.cc.com/videos/1xi9cj/sign-off----s-"
],
"guest": "J.J. Abrams"
},
{
"date": "2013-12-02",
"videos": [
"http://thecolbertreport.cc.com/videos/a8rc4x/intro---12-2-13",
"http://thecolbertreport.cc.com/videos/eax2go/healthcare-gov-revamp---presidential-turkey-pardon",
"http://thecolbertreport.cc.com/videos/32fik6/amazon-s-delivery-drones",
"http://thecolbertreport.cc.com/videos/kzzho9/blitzkrieg-on-grinchitude---bullet-catching-christmas-tree",
"http://thecolbertreport.cc.com/videos/tllp9w/daniel-goleman",
"http://thecolbertreport.cc.com/videos/4pjxs1/sign-off---eighth-anniversary-portrait"
],
"guest": "Daniel Goleman"
},
{
"date": "2013-12-03",
"videos": [
"http://thecolbertreport.cc.com/videos/810uks/intro---12-3-13",
"http://thecolbertreport.cc.com/videos/6yqi5n/the-pope-s-secret-life",
"http://thecolbertreport.cc.com/videos/ojh0t8/thought-for-food---ban-on-trans-fats---mcdonald-s-mcrib-mystery",
"http://thecolbertreport.cc.com/videos/fepuu2/the-double-robotics-office-robot",
"http://thecolbertreport.cc.com/videos/g14s8s/ed-stone",
"http://thecolbertreport.cc.com/videos/jkirej/sign-off---honoring-ed-stone"
],
"guest": "Ed Stone"
},
{
"date": "2013-12-04",
"videos": [
"http://thecolbertreport.cc.com/videos/xzvt8w/do-nothing-congress",
"http://thecolbertreport.cc.com/videos/vjdf7c/tip-wag---campaign-for-cursive---the-rnc",
"http://thecolbertreport.cc.com/videos/y2lfd6/colbert-platinum---freedom-ship",
"http://thecolbertreport.cc.com/videos/hzc351/bryan-stevenson",
"http://thecolbertreport.cc.com/videos/eanv4b/sign-off"
],
"guest": "Bryan Stevenson"
},
{
"date": "2013-12-05",
"videos": [
"http://thecolbertreport.cc.com/videos/evhpy0/intro---12-5-13",
"http://thecolbertreport.cc.com/videos/r2orue/the-in-box---flight-vs--invisibility",
"http://thecolbertreport.cc.com/videos/t96lm4/legal-weed-in-colorado",
"http://thecolbertreport.cc.com/videos/q1iez3/legal-weed-in-colorado---ricardo-baca",
"http://thecolbertreport.cc.com/videos/zy6hlf/the-gop-s-lady-troubles",
"http://thecolbertreport.cc.com/videos/blunby/alan-mulally",
"http://thecolbertreport.cc.com/videos/xyy6ql/sign-off"
],
"guest": "Allan Mulally"
},
{
"date": "2013-12-09",
"videos": [
"http://thecolbertreport.cc.com/videos/8h6usc/remembering-nelson-mandela",
"http://thecolbertreport.cc.com/videos/w58dfp/the-case-against-charity---bill-o-reilly---john-stossel",
"http://thecolbertreport.cc.com/videos/5y4hrs/the-case-against-charity---homeless-for-the-holidays",
"http://thecolbertreport.cc.com/videos/76e84o/stephen-s-grammy-nomination",
"http://thecolbertreport.cc.com/videos/lv0hd2/david-keith",
"http://thecolbertreport.cc.com/videos/6p2s11/sign-off"
],
"guest": "David Keith"
},
{
"date": "2013-12-10",
"videos": [
"http://thecolbertreport.cc.com/videos/my8zmp/intro---12-10-13",
"http://thecolbertreport.cc.com/videos/7yd7o2/walmart-s-job-acceptance-rate",
"http://thecolbertreport.cc.com/videos/z9zxq1/the-word---channel-serfing",
"http://thecolbertreport.cc.com/videos/kaj6y2/blitzkrieg-on-grinchitude---early-christmas-in-venezuela",
"http://thecolbertreport.cc.com/videos/pt29fq/alex-blumberg",
"http://thecolbertreport.cc.com/videos/99z3wt/sign-off---farewell-to-frank-lesser"
],
"guest": "Alex Blumberg"
},
{
"date": "2013-12-11",
"videos": [
"http://thecolbertreport.cc.com/videos/zye2nw/blitzkrieg-on-grinchitude---festivus-pole-in-the-florida-capitol",
"http://thecolbertreport.cc.com/videos/2vwk2a/obama-s-handshake-controversy",
"http://thecolbertreport.cc.com/videos/ayrep6/sign-language-scandal-at-mandela-s-memorial",
"http://thecolbertreport.cc.com/videos/jna07l/mike-huckabee-s--12-days-of-obamacare-",
"http://thecolbertreport.cc.com/videos/ld1i97/elizabeth-gilbert",
"http://thecolbertreport.cc.com/videos/nxssxf/sign-off---goodnight"
],
"guest": "Elizabeth Gilbert"
},
{
"date": "2013-12-12",
"videos": [
"http://thecolbertreport.cc.com/videos/juqc9w/bipartisan-budget-agreement",
"http://thecolbertreport.cc.com/videos/ygi28a/cheating-death---sleep-health---cosmetic-surgery",
"http://thecolbertreport.cc.com/videos/btidng/megyn-kelly-on-santa-s-skin-color",
"http://thecolbertreport.cc.com/videos/gv6c5c/george-packer",
"http://thecolbertreport.cc.com/videos/o3drqn/sign-off---goodnight"
],
"guest": "George Packer"
},
{
"date": "2013-12-16",
"videos": [
"http://thecolbertreport.cc.com/videos/tch93k/intro---12-16-13",
"http://thecolbertreport.cc.com/videos/t0srep/google-s-robot-acquisition",
"http://thecolbertreport.cc.com/videos/4q1rc7/nsa-video-game-surveillance",
"http://thecolbertreport.cc.com/videos/qepegb/stephen-s-grammy-nomination---billy-crystal",
"http://thecolbertreport.cc.com/videos/1wx2c5/jonah-peretti"
],
"guest": "Jonah Peretti, Gregg Allman, the National"
},
{
"date": "2013-12-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ufkb4r/intro---12-17-13",
"http://thecolbertreport.cc.com/videos/hdex9j/anti-nsa-ruling---edward-snowden-s-asylum-bid",
"http://thecolbertreport.cc.com/videos/v7f6xw/tip-wag---all-china-edition",
"http://thecolbertreport.cc.com/videos/18yj36/-ted-cruz-to-the-future-",
"http://thecolbertreport.cc.com/videos/0hlwua/garry-trudeau"
],
"guest": "Garry Trudeau, Cyndi Lauper, Alan Cumming"
},
{
"date": "2013-12-18",
"videos": [
"http://thecolbertreport.cc.com/videos/uqgbw6/intro---12-18-13",
"http://thecolbertreport.cc.com/videos/w20rkq/rethinking-customer-satisfaction",
"http://thecolbertreport.cc.com/videos/hqucv3/santa-claus-ethnicity-debate",
"http://thecolbertreport.cc.com/videos/7ick9v/santa-claus-ethnicity-debate---hans-beinholtz",
"http://thecolbertreport.cc.com/videos/vv4aaz/keanu-reeves",
"http://thecolbertreport.cc.com/videos/52csyt/sign-off---goodnight"
],
"guest": "Keanu Reeves, Aaron Neville"
},
{
"date": "2013-12-19",
"videos": [
"http://thecolbertreport.cc.com/videos/rdc6qs/jamie-dimon-s-christmas-card",
"http://thecolbertreport.cc.com/videos/p9rfx1/fox-news-s--12-scams-of-christmas-",
"http://thecolbertreport.cc.com/videos/na7pll/phil-robertson-s--duck-dynasty--suspension",
"http://thecolbertreport.cc.com/videos/3q7h60/ben-stiller"
],
"guest": "Ben Stiller, the Blind Boys of Alabama"
}
],
"2014": [
{
"date": "2014-01-06",
"videos": [
"http://thecolbertreport.cc.com/videos/qaqhv8/intro---1-6-14",
"http://thecolbertreport.cc.com/videos/vobbe1/polar-vortex",
"http://thecolbertreport.cc.com/videos/3goywo/tip-wag---fda--toy-manufacturers---logo-party",
"http://thecolbertreport.cc.com/videos/hyg1jb/recreational-pot-sales-in-colorado",
"http://thecolbertreport.cc.com/videos/5qceid/ken-roth",
"http://thecolbertreport.cc.com/videos/f9w0xq/sign-off---polar-vortex"
],
"guest": "Kenneth Roth"
},
{
"date": "2014-01-07",
"videos": [
"http://thecolbertreport.cc.com/videos/4uqurx/donald-trump-and-fox---friends-vs--global-warming",
"http://thecolbertreport.cc.com/videos/s9iccj/income-inequality-debate",
"http://thecolbertreport.cc.com/videos/v3sijl/income-inequality-debate---jim-martin",
"http://thecolbertreport.cc.com/videos/b9gbou/time-travel-research-in-cyberspace",
"http://thecolbertreport.cc.com/videos/bz0qvj/john-seigenthaler",
"http://thecolbertreport.cc.com/videos/a4c8i8/sign-off----a-big-heart-open-to-god-"
],
"guest": "John Seigenthaler"
},
{
"date": "2014-01-08",
"videos": [
"http://thecolbertreport.cc.com/videos/1vojc6/intro---1-8-14",
"http://thecolbertreport.cc.com/videos/2zkpvh/chris-christie---the-george-washington-bridge-scandal",
"http://thecolbertreport.cc.com/videos/bkjqeq/cheating-death---robo-sperm---health-roulette",
"http://thecolbertreport.cc.com/videos/ct0fks/the-polar-vortex---fruit-tools",
"http://thecolbertreport.cc.com/videos/i292oo/ishmael-beah",
"http://thecolbertreport.cc.com/videos/srasr6/sign-off---cold-weather-fruit-hammer"
],
"guest": "Ishmael Beah"
},
{
"date": "2014-01-09",
"videos": [
"http://thecolbertreport.cc.com/videos/3nlrc7/new-jersey-bridge-scandal---damning-emails",
"http://thecolbertreport.cc.com/videos/ez26gi/new-jersey-bridge-scandal---chris-christie-s-someone-else-a-culpa",
"http://thecolbertreport.cc.com/videos/gvlcow/robert-gates-s--duty-",
"http://thecolbertreport.cc.com/videos/cjww9c/jeff-skoll",
"http://thecolbertreport.cc.com/videos/zmnwvz/sign-off---people-s-choice-award"
],
"guest": "Jeff Skoll"
},
{
"date": "2014-01-13",
"videos": [
"http://thecolbertreport.cc.com/videos/qh2gll/intro---1-13-14",
"http://thecolbertreport.cc.com/videos/nmeif6/water-crisis-in-west-virginia",
"http://thecolbertreport.cc.com/videos/l6fcm2/the-word---never-ender-s-game",
"http://thecolbertreport.cc.com/videos/ekq6m6/mirriad---retroactive-product-placement",
"http://thecolbertreport.cc.com/videos/zf2igg/sign-off---back-scratch"
],
"guest": "David Fanning"
},
{
"date": "2014-01-14",
"videos": [
"http://thecolbertreport.cc.com/videos/e0ksix/sport-report---baseball",
"http://thecolbertreport.cc.com/videos/8aoa48/sport-report---winter-sports",
"http://thecolbertreport.cc.com/videos/4lplhb/sport-report---billie-jean-king",
"http://thecolbertreport.cc.com/videos/1urzjl/deborah-solomon",
"http://thecolbertreport.cc.com/videos/b5df4x/sign-off---goodnight"
],
"guest": "Deborah Solomon"
},
{
"date": "2014-01-15",
"videos": [
"http://thecolbertreport.cc.com/videos/daejaf/ad-for-america",
"http://thecolbertreport.cc.com/videos/bxdt1w/sport-report---uneducated-college-athletes---peyton-manning-s-sponsor-shout-out",
"http://thecolbertreport.cc.com/videos/rbh95h/alpha-dog-of-the-week---francois-hollande",
"http://thecolbertreport.cc.com/videos/tkqmyv/gabriel-sherman",
"http://thecolbertreport.cc.com/videos/efgh7j/sign-off---goodnight"
],
"guest": "Gabriel Sherman"
},
{
"date": "2014-01-16",
"videos": [
"http://thecolbertreport.cc.com/videos/pqopug/nsa-software-implants",
"http://thecolbertreport.cc.com/videos/6omuyc/colbert-platinum---diamond-pacifiers---financial-domination",
"http://thecolbertreport.cc.com/videos/d589xx/stephen-s-grammy-nomination---carol-burnett",
"http://thecolbertreport.cc.com/videos/4g3c4f/naquasia-legrand",
"http://thecolbertreport.cc.com/videos/h6vhef/sign-off---colbert-s-book-club"
],
"guest": "Naquasia LeGrand"
},
{
"date": "2014-01-20",
"videos": [
"http://thecolbertreport.cc.com/videos/2jaqbf/intro---1-20-13",
"http://thecolbertreport.cc.com/videos/6qy0qw/peyton-manning-s--omaha--chant---marijuana-s-effects-on-football",
"http://thecolbertreport.cc.com/videos/bg48ms/the-word---thrift-justice",
"http://thecolbertreport.cc.com/videos/1ah0qw/pope-francis-s-breastfeeding-support---affordable-sainthood",
"http://thecolbertreport.cc.com/videos/szyyzo/scott-stossel",
"http://thecolbertreport.cc.com/videos/3kds6e/sign-off---colbert-s-book-club-reminder"
],
"guest": "Scott Stossel"
},
{
"date": "2014-01-21",
"videos": [
"http://thecolbertreport.cc.com/videos/6g3tkl/sign-off---colbert-s-book-club---ernest-hemingway-s--a-farewell-to-arms-",
"http://thecolbertreport.cc.com/videos/27el91/colbert-s-book-club---mariel-hemingway-on-ernest-hemingway",
"http://thecolbertreport.cc.com/videos/c8gx08/colbert-s-book-club---michael-chabon----a-farewell-to-arms-",
"http://thecolbertreport.cc.com/videos/2tt8np/colbert-s-book-club---better-know-a-hemingway",
"http://thecolbertreport.cc.com/videos/8vzg0l/colbert-s-book-club---ernest-hemingway"
],
"guest": "Michael Chabon, Mariel Hemingway"
},
{
"date": "2014-01-22",
"videos": [
"http://thecolbertreport.cc.com/videos/o2dl8a/intro---1-22-14",
"http://thecolbertreport.cc.com/videos/id8eug/mystery-doughnut-on-mars",
"http://thecolbertreport.cc.com/videos/db8f37/tip-wag---air-force--dr--keith-ablow---westminster-dog-show",
"http://thecolbertreport.cc.com/videos/wjov9z/tikker-death-watch",
"http://thecolbertreport.cc.com/videos/y85ykp/charles-duhigg",
"http://thecolbertreport.cc.com/videos/ihby00/sign-off---mutt"
],
"guest": "Charles Duhigg"
},
{
"date": "2014-01-23",
"videos": [
"http://thecolbertreport.cc.com/videos/ay6diu/riots-in-the-ukraine",
"http://thecolbertreport.cc.com/videos/nnj3ic/end-of-net-neutrality",
"http://thecolbertreport.cc.com/videos/qatuhg/end-of-net-neutrality---tim-wu",
"http://thecolbertreport.cc.com/videos/0i8pwp/china-s-colbert-report-rip-off",
"http://thecolbertreport.cc.com/videos/fykny6/patricia-churchland",
"http://thecolbertreport.cc.com/videos/5axbrg/sign-off---goodnight"
],
"guest": "Patricia Churchland"
},
{
"date": "2014-01-27",
"videos": [
"http://thecolbertreport.cc.com/videos/qs3r6w/logo-restrictions-for-the-super-bowl",
"http://thecolbertreport.cc.com/videos/51gnff/richard-sherman-s-rant-fallout",
"http://thecolbertreport.cc.com/videos/mk6zsq/nate-silver",
"http://thecolbertreport.cc.com/videos/c58bm1/sign-off---grammy-award"
],
"guest": "Nate Silver"
},
{
"date": "2014-01-28",
"videos": [
"http://thecolbertreport.cc.com/videos/gzw6pe/superb-owl-xlviii---nfl-extra-point-debate",
"http://thecolbertreport.cc.com/videos/g3ng7g/fallback-position---championship-nfl-quarterback",
"http://thecolbertreport.cc.com/videos/y1y1q6/spotted-owls-vs--barred-owls---david-yarnold",
"http://thecolbertreport.cc.com/videos/wx55bg/justin-tuck",
"http://thecolbertreport.cc.com/videos/q6n89x/sign-off---tootsie-pop"
],
"guest": "Justin Tuck"
},
{
"date": "2014-01-29",
"videos": [
"http://thecolbertreport.cc.com/videos/79qyj3/superb-owl-xlviii---football-christmas",
"http://thecolbertreport.cc.com/videos/pzw1hz/fallback-position---championship-nfl-quarterback-pt--2",
"http://thecolbertreport.cc.com/videos/0czypw/distractions---reactions-at-the-state-of-the-union",
"http://thecolbertreport.cc.com/videos/6h1tef/cris-carter"
],
"guest": "Cris Carter"
},
{
"date": "2014-01-30",
"videos": [
"http://thecolbertreport.cc.com/videos/vp5oqx/superb-owl-xlviii---football-health-concerns",
"http://thecolbertreport.cc.com/videos/8z0t1l/superb-owl-xlviii---football-health-concerns---steve-fainaru---mark-fainaru-wada",
"http://thecolbertreport.cc.com/videos/b88aif/big-game-debate-with-ed-murray-and-michael-hancock",
"http://thecolbertreport.cc.com/videos/7aqq1s/drew-brees",
"http://thecolbertreport.cc.com/videos/yucj0t/sign-off---football-toss"
],
"guest": "Drew Brees"
},
{
"date": "2014-02-03",
"videos": [
"http://thecolbertreport.cc.com/videos/kmzt7v/coca-cola-s-diverse--america-the-beautiful--ad",
"http://thecolbertreport.cc.com/videos/65qhlv/tip-wag---litigious-cheerleaders--pope-francis---china",
"http://thecolbertreport.cc.com/videos/nezg8b/j-k--rowling-s-ron-and-hermione-bombshell",
"http://thecolbertreport.cc.com/videos/nocpjv/jennifer-senior",
"http://thecolbertreport.cc.com/videos/msb2vl/sign-off---goodnight"
],
"guest": "Jennifer Senior"
},
{
"date": "2014-02-04",
"videos": [
"http://thecolbertreport.cc.com/videos/m0k7nu/black-history-of-children-s-dental-health-month---chris-christie-s-bridge-scandal-connection",
"http://thecolbertreport.cc.com/videos/81q2jm/chris-christie-vs--david-wildstein-on-the-new-jersey-bridge-scandal",
"http://thecolbertreport.cc.com/videos/49r39y/pussy-riot-pt--1",
"http://thecolbertreport.cc.com/videos/08f0xw/pussy-riot-pt--2",
"http://thecolbertreport.cc.com/videos/ubzb8b/sign-off---pussy-riot----bringing-human-rights-back-home-"
],
"guest": "Pussy Riot"
},
{
"date": "2014-02-05",
"videos": [
"http://thecolbertreport.cc.com/videos/nn8d7g/intro---2-5-14",
"http://thecolbertreport.cc.com/videos/w3uorg/obamacare-jobs-debate",
"http://thecolbertreport.cc.com/videos/djw49l/america-s-wealthy-under-siege---mort-zuckerman",
"http://thecolbertreport.cc.com/videos/cjdkxj/lake-street-dive",
"http://thecolbertreport.cc.com/videos/6itibl/sign-off---goodnight"
],
"guest": "Lake Street Dive"
},
{
"date": "2014-02-06",
"videos": [
"http://thecolbertreport.cc.com/videos/tzqa3o/obama---the-keystone-xl-pipeline",
"http://thecolbertreport.cc.com/videos/e3q55j/sochi-olympics-cry-athlon",
"http://thecolbertreport.cc.com/videos/yzcp46/tip-wag---tsa-peeping-toms--domino-s-pizza-artists---federal-judges",
"http://thecolbertreport.cc.com/videos/ze9n7p/paul-krugman",
"http://thecolbertreport.cc.com/videos/1ur5x9/sign-off---welcome-baby-eli-"
],
"guest": "Paul Krugman"
},
{
"date": "2014-02-10",
"videos": [
"http://thecolbertreport.cc.com/videos/alv9kr/rocky-start-at-the-sochi-olympics",
"http://thecolbertreport.cc.com/videos/155uge/sport-report---from-russia-with-love--but-no-gay-stuff-",
"http://thecolbertreport.cc.com/videos/s385jl/taliban-dognappers",
"http://thecolbertreport.cc.com/videos/hmu6hf/patrick-kennedy",
"http://thecolbertreport.cc.com/videos/bl6jzi/sign-off---buddy-cole"
],
"guest": "Patrick Kennedy"
},
{
"date": "2014-02-11",
"videos": [
"http://thecolbertreport.cc.com/videos/zddxmq/intro---2-11-14",
"http://thecolbertreport.cc.com/videos/yesavg/blade-in-the-usa",
"http://thecolbertreport.cc.com/videos/ow2caa/sport-report---from-russia-with-love--but-no-gay-stuff----u-s--speedskating-team",
"http://thecolbertreport.cc.com/videos/cxui4b/sport-report---michael-sam-s-coming-out",
"http://thecolbertreport.cc.com/videos/8yt2ar/charlie-crist",
"http://thecolbertreport.cc.com/videos/v6h2iw/sign-off---goodnight"
],
"guest": "Charlie Crist"
},
{
"date": "2014-02-12",
"videos": [
"http://thecolbertreport.cc.com/videos/mke8f4/white-house-state-dinner",
"http://thecolbertreport.cc.com/videos/ngjlqq/bill-o-reilly-s-interview-of-the-decade",
"http://thecolbertreport.cc.com/videos/f7yt2f/because-shep---white-house-menu-report",
"http://thecolbertreport.cc.com/videos/zqevr4/godfrey-reggio",
"http://thecolbertreport.cc.com/videos/wd8rlk/sign-off---au-revoir"
],
"guest": "Godfrey Reggio"
},
{
"date": "2014-02-18",
"videos": [
"http://thecolbertreport.cc.com/videos/cb08sc/intro---2-18-14",
"http://thecolbertreport.cc.com/videos/esabem/jimmy-fallon-s--tonight-show--debut",
"http://thecolbertreport.cc.com/videos/icw75d/transgender-awareness",
"http://thecolbertreport.cc.com/videos/px4k4w/transgender-awareness---janet-mock",
"http://thecolbertreport.cc.com/videos/fpn2d7/brian-greene",
"http://thecolbertreport.cc.com/videos/7cxypm/sign-off---goodnight"
],
"guest": "Brian Greene"
},
{
"date": "2014-02-19",
"videos": [
"http://thecolbertreport.cc.com/videos/8ht320/intro---2-19-14",
"http://thecolbertreport.cc.com/videos/z8viri/sport-report---from-russia-with-love--but-no-gay-stuff----buddy-cole-in-sochi",
"http://thecolbertreport.cc.com/videos/k0fmq0/victory-and-vigilance-at-the-sochi-games",
"http://thecolbertreport.cc.com/videos/pdgpm2/smile-file---al-qaeda-bomb-blunder",
"http://thecolbertreport.cc.com/videos/80x11s/alexander-payne",
"http://thecolbertreport.cc.com/videos/r3yso9/sign-off---goodnight"
],
"guest": "Alexander Payne"
},
{
"date": "2014-02-20",
"videos": [
"http://thecolbertreport.cc.com/videos/gtx5i8/auction-for-bill-o-reilly-s-stolen-microwave",
"http://thecolbertreport.cc.com/videos/7alqr9/sochi-olympics-2014---bode-miller",
"http://thecolbertreport.cc.com/videos/i1pl20/stanley-mcchrystal",
"http://thecolbertreport.cc.com/videos/3j3ziw/sign-off---microwave-auction---stanley-mcchrystal"
],
"guest": "Gen. Stanley McChrystal"
},
{
"date": "2014-02-24",
"videos": [
"http://thecolbertreport.cc.com/videos/1x3cmv/intro---2-24-14",
"http://thecolbertreport.cc.com/videos/dxcy1y/blade-in-the-usa---dutch-coach-s-anti-america-rant",
"http://thecolbertreport.cc.com/videos/y1wxc3/crisis-in-ukraine",
"http://thecolbertreport.cc.com/videos/8067fc/crisis-in-ukraine---gideon-rose",
"http://thecolbertreport.cc.com/videos/2y58gs/darlene-love",
"http://thecolbertreport.cc.com/videos/illjzj/sign-off---remembering-harold-ramis"
],
"guest": "Darlene Love"
},
{
"date": "2014-02-25",
"videos": [
"http://thecolbertreport.cc.com/videos/blcgek/the-huffington-post-on-the-past-lives-of-children",
"http://thecolbertreport.cc.com/videos/uov6m4/outrage-over-military-budget-cuts",
"http://thecolbertreport.cc.com/videos/y2j7vo/the-word---jobsolete",
"http://thecolbertreport.cc.com/videos/yw875l/consumers-for-paper-options",
"http://thecolbertreport.cc.com/videos/w2zhlc/st--vincent"
],
"guest": "St. Vincent"
},
{
"date": "2014-02-26",
"videos": [
"http://thecolbertreport.cc.com/videos/7vvoyf/michelle-obama-vs--child-obesity",
"http://thecolbertreport.cc.com/videos/gs9vcz/colbert-s-very-wanted---who-took-gumby-",
"http://thecolbertreport.cc.com/videos/y307f3/fox-news-on-hillary-clinton-s-age",
"http://thecolbertreport.cc.com/videos/tb28zm/meryl-davis---charlie-white",
"http://thecolbertreport.cc.com/videos/3w27qv/sign-off---chair-twirl"
],
"guest": "Meryl Davis & Charlie White"
},
{
"date": "2014-02-27",
"videos": [
"http://thecolbertreport.cc.com/videos/11tivg/intro---2-27-14",
"http://thecolbertreport.cc.com/videos/28qta1/defeat-for-arizona-s-anti-gay-legislation",
"http://thecolbertreport.cc.com/videos/p8fj8f/black-history-month---stereotypes---racial-identity",
"http://thecolbertreport.cc.com/videos/300ry4/black-history-month---laser-klan",
"http://thecolbertreport.cc.com/videos/8ijgcp/jeff-goldblum",
"http://thecolbertreport.cc.com/videos/axkpkj/sign-off---wedding-cake"
],
"guest": "Jeff Goldblum"
},
{
"date": "2014-03-03",
"videos": [
"http://thecolbertreport.cc.com/videos/hbrhpe/magical-evening-at-the-2014-academy-awards",
"http://thecolbertreport.cc.com/videos/q8u939/phony-obamacare-horror-stories",
"http://thecolbertreport.cc.com/videos/8jpus1/phony-obamacare-horror-stories---patrick-stewart",
"http://thecolbertreport.cc.com/videos/ysbw7d/sports-illustrated-barbie",
"http://thecolbertreport.cc.com/videos/wwqhgn/caitlin-flanagan",
"http://thecolbertreport.cc.com/videos/z2x5tb/sign-off----waiting-for-godot-"
],
"guest": "Caitlin Flanagan"
},
{
"date": "2014-03-04",
"videos": [
"http://thecolbertreport.cc.com/videos/y4s2js/intro---3-4-14",
"http://thecolbertreport.cc.com/videos/avavv1/better-know-a-geopolitical-flashpoint---crimean-peninsula",
"http://thecolbertreport.cc.com/videos/r79jgq/cold-war-update---obama-s-ukraine-response",
"http://thecolbertreport.cc.com/videos/dpc49v/arizona-s-religious-freedom-bill---self-professed-gays",
"http://thecolbertreport.cc.com/videos/bjwnn1/jaron-lanier",
"http://thecolbertreport.cc.com/videos/38n33x/sign-off---shoe-answering-machine"
],
"guest": "Jaron Lanier"
},
{
"date": "2014-03-05",
"videos": [
"http://thecolbertreport.cc.com/videos/a2cnjz/intro---3-5-14",
"http://thecolbertreport.cc.com/videos/chbquj/bill-o-reilly-on-the-downside-of-a-woman-president",
"http://thecolbertreport.cc.com/videos/ak3veo/tip-wag---chevron---fda",
"http://thecolbertreport.cc.com/videos/ppqf1u/headline-news-rebrand",
"http://thecolbertreport.cc.com/videos/0exuju/beau-willimon",
"http://thecolbertreport.cc.com/videos/gexopu/sign-off---goodnight"
],
"guest": "Beau Willimon"
},
{
"date": "2014-03-06",
"videos": [
"http://thecolbertreport.cc.com/videos/mmf7np/intro---3-6-14",
"http://thecolbertreport.cc.com/videos/te4fyy/legal-upskirting-in-massachusetts",
"http://thecolbertreport.cc.com/videos/awc6am/women-s-history-month---impossible-body-standards---appetizing-beauty-products",
"http://thecolbertreport.cc.com/videos/3si7rs/warner-music-s--happy-birthday--copyright",
"http://thecolbertreport.cc.com/videos/f3jjle/theaster-gates",
"http://thecolbertreport.cc.com/videos/g6qd4x/sign-off---liberty-bell"
],
"guest": "Theaster Gates"
},
{
"date": "2014-03-10",
"videos": [
"http://thecolbertreport.cc.com/videos/ag9578/intro---3-10-14",
"http://thecolbertreport.cc.com/videos/a6f94j/cross-controversy-at-9-11-museum",
"http://thecolbertreport.cc.com/videos/bn0fy6/the-word---pew--pew--pew-",
"http://thecolbertreport.cc.com/videos/gh6urb/neil-degrasse-tyson-pt--1",
"http://thecolbertreport.cc.com/videos/42g6iq/neil-degrasse-tyson-pt--2",
"http://thecolbertreport.cc.com/videos/1bou2c/sign-off---goodnight"
],
"guest": "Neil DeGrasse Tyson"
},
{
"date": "2014-03-11",
"videos": [
"http://thecolbertreport.cc.com/videos/g08oh5/intro---3-11-14",
"http://thecolbertreport.cc.com/videos/usi00y/fan-magazine-for-pope-francis",
"http://thecolbertreport.cc.com/videos/pis5qm/the-huffington-post-s-anal-sex-bombshell",
"http://thecolbertreport.cc.com/videos/pvjhwj/the-huffington-post-s-anal-sex-bombshell---randy-ferrar",
"http://thecolbertreport.cc.com/videos/qacc88/tip-wag---u-s--department-of-justice---wall-street",
"http://thecolbertreport.cc.com/videos/nba46a/ronan-farrow",
"http://thecolbertreport.cc.com/videos/hncfzx/sign-off---pope-centerfold"
],
"guest": "Ronan Farrow"
},
{
"date": "2014-03-12",
"videos": [
"http://thecolbertreport.cc.com/videos/ut2zdq/president-obama-on--between-two-ferns-",
"http://thecolbertreport.cc.com/videos/h6q3h4/vladimir-putin-s-propaganda-machine---russia-today",
"http://thecolbertreport.cc.com/videos/i7q6ld/vladimir-putin-s-propaganda-machine---russia-today---liz-wahl",
"http://thecolbertreport.cc.com/videos/wp6hv1/nsa-s--ask-zelda--advice-column",
"http://thecolbertreport.cc.com/videos/2qsrw5/maria-shriver",
"http://thecolbertreport.cc.com/videos/i6cs26/sign-off---goodnight"
],
"guest": "Maria Shriver"
},
{
"date": "2014-03-13",
"videos": [
"http://thecolbertreport.cc.com/videos/5js43m/colorado-s-booming-marijuana-industry",
"http://thecolbertreport.cc.com/videos/a1ejoq/bears---balls---ganjapreneurs",
"http://thecolbertreport.cc.com/videos/xkuwmd/obama-s-overtime-pay-expansion",
"http://thecolbertreport.cc.com/videos/k9goh1/simon-schama",
"http://thecolbertreport.cc.com/videos/tl1mce/sign-off---goodnight"
],
"guest": "Simon Schama"
},
{
"date": "2014-03-24",
"videos": [
"http://thecolbertreport.cc.com/videos/hjb6kt/back-from-spring-break",
"http://thecolbertreport.cc.com/videos/imczen/better-know-a-district---north-carolina-s-1st---g-k--butterfield",
"http://thecolbertreport.cc.com/videos/8cy48v/malaysia-airlines--missing-plane",
"http://thecolbertreport.cc.com/videos/g4poyv/bryan-cranston",
"http://thecolbertreport.cc.com/videos/a2iw3f/sign-off---goodnight"
],
"guest": "Bryan Cranston"
},
{
"date": "2014-03-25",
"videos": [
"http://thecolbertreport.cc.com/videos/9n1euv/hugely-historic-night-with-jimmy-carter",
"http://thecolbertreport.cc.com/videos/0k0w7y/president-jimmy-carter---the-colbert-interviews",
"http://thecolbertreport.cc.com/videos/xepzs5/jimmy-carter-pt--1",
"http://thecolbertreport.cc.com/videos/t3jp2g/jimmy-carter-pt--2",
"http://thecolbertreport.cc.com/videos/uyisf5/sign-off---goodnight--carter-library"
],
"guest": "Jimmy Carter"
},
{
"date": "2014-03-26",
"videos": [
"http://thecolbertreport.cc.com/videos/1zhwtt/drunk-secret-service-agents-in-amsterdam",
"http://thecolbertreport.cc.com/videos/b6cwb3/sport-report---professional-soccer-toddler--golf-innovations---washington-redskins-charm-offensive",
"http://thecolbertreport.cc.com/videos/q8pyub/bright-prospects-for-the-gop-in-2016",
"http://thecolbertreport.cc.com/videos/mcpvbd/errol-morris",
"http://thecolbertreport.cc.com/videos/ycwnol/sign-off---goodnight"
],
"guest": "Errol Morris"
},
{
"date": "2014-03-27",
"videos": [
"http://thecolbertreport.cc.com/videos/qforig/intro---3-27-14",
"http://thecolbertreport.cc.com/videos/uqmqua/ukraine-s-dolphin-army",
"http://thecolbertreport.cc.com/videos/cabdj6/morning-news-for-millennials",
"http://thecolbertreport.cc.com/videos/srj2lz/hawaii-s-prostitution-exemption-for-cops",
"http://thecolbertreport.cc.com/videos/77oyfl/darren-aronofsky",
"http://thecolbertreport.cc.com/videos/tyuheg/sign-off---playdate-with-charlie-rose"
],
"guest": "Darren Aronofsky"
},
{
"date": "2014-03-31",
"videos": [
"http://thecolbertreport.cc.com/videos/lumbga/intro---3-31-14",
"http://thecolbertreport.cc.com/videos/3yhe9h/emoji-ethnicity",
"http://thecolbertreport.cc.com/videos/1zkr18/who-s-attacking-me-now-----cancelcolbert",
"http://thecolbertreport.cc.com/videos/35dcpo/stephen-s--cancelcolbert-mea-culpa",
"http://thecolbertreport.cc.com/videos/vj7n1j/biz-stone-pt--1",
"http://thecolbertreport.cc.com/videos/yc8huq/biz-stone-pt--2",
"http://thecolbertreport.cc.com/videos/adyesn/sign-off---bud-light-lime",
"http://thecolbertreport.cc.com/videos/p65waq/3-31-14-in--60-seconds"
],
"guest": "Biz Stone"
},
{
"date": "2014-04-01",
"videos": [
"http://thecolbertreport.cc.com/videos/3ljnpx/obamacare-victory-lap",
"http://thecolbertreport.cc.com/videos/cviqog/union-push-for-college-athletes",
"http://thecolbertreport.cc.com/videos/64v4nu/union-push-for-college-athletes---ramogi-huma",
"http://thecolbertreport.cc.com/videos/784uo8/john-malkovich",
"http://thecolbertreport.cc.com/videos/rc1p9n/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/c9xd2d/4-1-14-in--60-seconds"
],
"guest": "John Malkovich"
},
{
"date": "2014-04-02",
"videos": [
"http://thecolbertreport.cc.com/videos/zxr7i2/u-n--climate-change-report",
"http://thecolbertreport.cc.com/videos/o639ag/the-word---silent-but-deadly",
"http://thecolbertreport.cc.com/videos/1ypxfz/silicon-valley-s-cosmetic-surgery-boom",
"http://thecolbertreport.cc.com/videos/pnhs3f/dan-harris",
"http://thecolbertreport.cc.com/videos/wrxyua/sign-off---comedy-central-app"
],
"guest": "Dan Harris"
},
{
"date": "2014-04-03",
"videos": [
"http://thecolbertreport.cc.com/videos/kas793/holy-grail-discovery",
"http://thecolbertreport.cc.com/videos/n79fg2/supreme-court-ruling-on-aggregate-campaign-funding",
"http://thecolbertreport.cc.com/videos/n6lhb9/supreme-court-ruling-on-aggregate-campaign-funding---emily-bazelon",
"http://thecolbertreport.cc.com/videos/4vb00q/bill-o-reilly-s-defense-of-inequality",
"http://thecolbertreport.cc.com/videos/fgsnrb/mark-mazzetti",
"http://thecolbertreport.cc.com/videos/255jt7/sign-off---coffee-break"
],
"guest": "Mark Mazzetti"
},
{
"date": "2014-04-07",
"videos": [
"http://thecolbertreport.cc.com/videos/lz94c9/jeb-bush-on-illegal-immigrants",
"http://thecolbertreport.cc.com/videos/jjifoz/tip-wag---new-york-times--alaska-board-of-game---mazda",
"http://thecolbertreport.cc.com/videos/jvziju/matt-bevin-s-cockfighting-controversy",
"http://thecolbertreport.cc.com/videos/xj9d66/edward-frenkel",
"http://thecolbertreport.cc.com/videos/2dvxf1/sign-off---newspaper"
],
"guest": "Edward Frenkel"
},
{
"date": "2014-04-08",
"videos": [
"http://thecolbertreport.cc.com/videos/m6pj8n/intro---4-8-14",
"http://thecolbertreport.cc.com/videos/wpor0d/america-s-uninformed-opinion-on-ukraine",
"http://thecolbertreport.cc.com/videos/ncl2k5/cia-interrogation-report",
"http://thecolbertreport.cc.com/videos/nemi1a/common-core-confusion",
"http://thecolbertreport.cc.com/videos/uyjkgv/jane-goodall",
"http://thecolbertreport.cc.com/videos/2v7871/sign-off---cheers"
],
"guest": "Jane Goodall"
},
{
"date": "2014-04-09",
"videos": [
"http://thecolbertreport.cc.com/videos/53uymc/intro---4-9-14",
"http://thecolbertreport.cc.com/videos/o3rniz/heartbleed-internet-bug",
"http://thecolbertreport.cc.com/videos/8a5aao/brendan-eich-s-forced-resignation",
"http://thecolbertreport.cc.com/videos/3pg0sn/brendan-eich-s-forced-resignation---andrew-sullivan",
"http://thecolbertreport.cc.com/videos/l9zuu1/obama-s-equal-pay-orders",
"http://thecolbertreport.cc.com/videos/wr794b/sheryl-sandberg",
"http://thecolbertreport.cc.com/videos/mroadr/sign-off---goodnight"
],
"guest": "Sheryl Sandberg"
},
{
"date": "2014-04-10",
"videos": [
"http://thecolbertreport.cc.com/videos/k436zi/david-letterman-s-retirement",
"http://thecolbertreport.cc.com/videos/kv1taq/cheating-death---depression-edition",
"http://thecolbertreport.cc.com/videos/3a9611/bill-o-reilly-on-america-s--grievance-industry-",
"http://thecolbertreport.cc.com/videos/yi8cxa/sting"
],
"guest": "Sting"
},
{
"date": "2014-04-21",
"videos": [
"http://thecolbertreport.cc.com/videos/1tyawq/intro---4-21-14",
"http://thecolbertreport.cc.com/videos/0w61r2/al-qaeda-s-overly-public-pep-rally",
"http://thecolbertreport.cc.com/videos/055g6r/hillary-clinton-s-grandmother-status",
"http://thecolbertreport.cc.com/videos/7d5y74/stephen-colbert-s-bats--t-serious---hillary-clinton-shoe-spiracy-theory",
"http://thecolbertreport.cc.com/videos/hls49q/extreme-measures-for-boosting-church-attendance",
"http://thecolbertreport.cc.com/videos/p5o99a/ken-burns",
"http://thecolbertreport.cc.com/videos/v2nud8/sign-off---goodnight"
],
"guest": "Ken Burns"
},
{
"date": "2014-04-22",
"videos": [
"http://thecolbertreport.cc.com/videos/t2msi7/intro---4-22-14",
"http://thecolbertreport.cc.com/videos/1j1m90/postage-stamp-for-harvey-milk",
"http://thecolbertreport.cc.com/videos/0bsy88/better-know-a-district---california-s-29th",
"http://thecolbertreport.cc.com/videos/kg42wy/bad-news-for-ethanol-on-earth-day",
"http://thecolbertreport.cc.com/videos/yeczpa/george-will",
"http://thecolbertreport.cc.com/videos/0b7ymc/sign-off---goodnight"
],
"guest": "George Will"
},
{
"date": "2014-04-23",
"videos": [
"http://thecolbertreport.cc.com/videos/vnbuc3/intro---4-23-14",
"http://thecolbertreport.cc.com/videos/8l716g/canada-s-booming-middle-class",
"http://thecolbertreport.cc.com/videos/tn3469/sport-report---snacks-for-students---cockfighting",
"http://thecolbertreport.cc.com/videos/lz21l6/america-s-lime-crisis",
"http://thecolbertreport.cc.com/videos/g5cgj8/john-calipari",
"http://thecolbertreport.cc.com/videos/6glbo4/sign-off---goodnight"
],
"guest": "John Calipari"
},
{
"date": "2014-04-24",
"videos": [
"http://thecolbertreport.cc.com/videos/2c27q9/supreme-court-affirmative-action-ruling",
"http://thecolbertreport.cc.com/videos/ehanpl/the-ballad-of-cliven-bundy",
"http://thecolbertreport.cc.com/videos/5mf7zk/phyllis-schlafly-vs--equal-pay-for-women",
"http://thecolbertreport.cc.com/videos/ufdzm1/george-saunders",
"http://thecolbertreport.cc.com/videos/vtuwb7/sign-off---country-boy"
],
"guest": "George Saunders"
},
{
"date": "2014-04-28",
"videos": [
"http://thecolbertreport.cc.com/videos/6fq0xa/popechella",
"http://thecolbertreport.cc.com/videos/yhq2cw/preventable-diseases-on-the-rise",
"http://thecolbertreport.cc.com/videos/svsc0q/preventable-diseases-on-the-rise---paul-offit",
"http://thecolbertreport.cc.com/videos/5my1ja/outrage-over-obama-s-bowing",
"http://thecolbertreport.cc.com/videos/i1lidr/michael-mcfaul",
"http://thecolbertreport.cc.com/videos/gu3d7a/sign-off----deadly-choices-"
],
"guest": "Michael McFaul"
},
{
"date": "2014-04-29",
"videos": [
"http://thecolbertreport.cc.com/videos/cxn6h3/intro---4-29-14",
"http://thecolbertreport.cc.com/videos/jfz395/donald-sterling-s-racist-comments",
"http://thecolbertreport.cc.com/videos/td7npw/tip-wag---j-j--abrams---u-s--congress",
"http://thecolbertreport.cc.com/videos/8pyjlg/clemency-push-for-drug-convicts",
"http://thecolbertreport.cc.com/videos/eyae6k/robert-rodriguez",
"http://thecolbertreport.cc.com/videos/11mf9t/sign-off---goodnight"
],
"guest": "Robert Rodriguez"
},
{
"date": "2014-04-30",
"videos": [
"http://thecolbertreport.cc.com/videos/kdwdgq/intro---4-30-14",
"http://thecolbertreport.cc.com/videos/6lmqu6/president-assad-s-reelection-bid",
"http://thecolbertreport.cc.com/videos/so1kau/republican-advantage-in-the-2014-midterms",
"http://thecolbertreport.cc.com/videos/2nuw76/republican-advantage-in-the-2014-midterms---clay-aiken",
"http://thecolbertreport.cc.com/videos/tfpj0x/america-s-first-lesbian-throuple",
"http://thecolbertreport.cc.com/videos/fs6gac/audra-mcdonald"
],
"guest": "Audra McDonald"
},
{
"date": "2014-05-01",
"videos": [
"http://thecolbertreport.cc.com/videos/798k8c/-watters--world-",
"http://thecolbertreport.cc.com/videos/1e524e/-watters--world----tad-s-turf",
"http://thecolbertreport.cc.com/videos/zbjl95/cnn-s-endless-wait-for-flight-370-news",
"http://thecolbertreport.cc.com/videos/hji3d3/saul-williams",
"http://thecolbertreport.cc.com/videos/ie7s2m/saul-williams----amethyst-rocks-"
],
"guest": "Saul Williams"
},
{
"date": "2014-05-05",
"videos": [
"http://thecolbertreport.cc.com/videos/unhuhc/intro---5-5-14",
"http://thecolbertreport.cc.com/videos/oxvwlw/nancy-pelosi-s-cinco-de-mayo-celebration",
"http://thecolbertreport.cc.com/videos/0hu2aq/better-know-a-district---virginia-s-3rd",
"http://thecolbertreport.cc.com/videos/fo52kn/kareem-abdul-jabbar-on-racism-and-ghosts",
"http://thecolbertreport.cc.com/videos/c0s4ec/edward-o--wilson",
"http://thecolbertreport.cc.com/videos/4tegd5/sign-off---goodnight"
],
"guest": "Edward O. Wilson"
},
{
"date": "2014-05-06",
"videos": [
"http://thecolbertreport.cc.com/videos/pnqv06/intro---5-6-14",
"http://thecolbertreport.cc.com/videos/khlwzq/rand-paul-s-derby-date-with-rupert-murdoch",
"http://thecolbertreport.cc.com/videos/s4me1v/nra-annual-meeting---guns-everywhere-in-georgia",
"http://thecolbertreport.cc.com/videos/zekn1k/satanic-monument-for-the-oklahoma-state-house",
"http://thecolbertreport.cc.com/videos/iihdkg/bette-midler",
"http://thecolbertreport.cc.com/videos/n572qd/sign-off---nightcap"
],
"guest": "Bette Midler"
},
{
"date": "2014-05-07",
"videos": [
"http://thecolbertreport.cc.com/videos/1ztozi/intro---5-7-14",
"http://thecolbertreport.cc.com/videos/p4t1a2/vibrant-constipation-pill",
"http://thecolbertreport.cc.com/videos/ywt77c/tip-wag---herald-embroidery--bug-scientists---dana-perino",
"http://thecolbertreport.cc.com/videos/2u61x6/ukraine-in-the-membrane",
"http://thecolbertreport.cc.com/videos/uz2nio/david-remnick",
"http://thecolbertreport.cc.com/videos/q5zpsy/sign-off---goodnight"
],
"guest": "David Remnick"
},
{
"date": "2014-05-08",
"videos": [
"http://thecolbertreport.cc.com/videos/84cvwk/exclusive---better-know-a-challenger---florida-s-3rd---jake-rush",
"http://thecolbertreport.cc.com/videos/1u7a5d/vampire-for-congress-in-florida",
"http://thecolbertreport.cc.com/videos/vkcose/better-know-a-challenger---florida-s-3rd---jake-rush",
"http://thecolbertreport.cc.com/videos/8jno3s/stu-varney-among-the-common-people",
"http://thecolbertreport.cc.com/videos/m2n3c9/ellen-page",
"http://thecolbertreport.cc.com/videos/u05pdf/sign-off---spinning-top"
],
"guest": "Ellen Page"
},
{
"date": "2014-05-12",
"videos": [
"http://thecolbertreport.cc.com/videos/nnz78u/michael-sam-s-nfl-draft-kiss",
"http://thecolbertreport.cc.com/videos/g2hf60/stephen-colbert-s-bats--t-serious---monica-lewinsky-s-conveniently-timed-essay",
"http://thecolbertreport.cc.com/videos/2j80wh/glenn-greenwald-pt--1",
"http://thecolbertreport.cc.com/videos/31s76v/glenn-greenwald-pt--2",
"http://thecolbertreport.cc.com/videos/xovmc1/sign-off---penalty-whistle"
],
"guest": "Glenn Greenwald"
},
{
"date": "2014-05-13",
"videos": [
"http://thecolbertreport.cc.com/videos/wn13ym/pope-francis-s-crusade-against-capitalism",
"http://thecolbertreport.cc.com/videos/vmje6p/-bringbackourgirls",
"http://thecolbertreport.cc.com/videos/2rgt3x/-bringbackourgirls---rosemary-nyirumbe",
"http://thecolbertreport.cc.com/videos/jrmo9v/koch-brothers-vs--the-columbus-zoo",
"http://thecolbertreport.cc.com/videos/s46r2u/the-black-keys",
"http://thecolbertreport.cc.com/videos/7bxzr7/sign-off---sisters-united-bags"
],
"guest": "The Black Keys"
},
{
"date": "2014-05-14",
"videos": [
"http://thecolbertreport.cc.com/videos/mwq7dh/intro---5-14-14",
"http://thecolbertreport.cc.com/videos/5ob1j2/pope-francis-on-baptizing-martians",
"http://thecolbertreport.cc.com/videos/k6jlhl/the-word---f--k-it",
"http://thecolbertreport.cc.com/videos/4a4ahs/amazon-s-audacious-photography-patent",
"http://thecolbertreport.cc.com/videos/hffa7o/keri-russell",
"http://thecolbertreport.cc.com/videos/2b3fgm/sign-off---goodnight"
],
"guest": "Keri Russell"
},
{
"date": "2014-05-15",
"videos": [
"http://thecolbertreport.cc.com/videos/bvzi2n/vladimir-putin-s-space-station-ban",
"http://thecolbertreport.cc.com/videos/pb1byh/karl-rove-on-hillary-clinton-s-health",
"http://thecolbertreport.cc.com/videos/o2wt62/morality-lessons-for-robots",
"http://thecolbertreport.cc.com/videos/lmgmhg/thomas-friedman",
"http://thecolbertreport.cc.com/videos/z8ndeb/sign-off---mirror"
],
"guest": "Thomas Friedman"
},
{
"date": "2014-05-19",
"videos": [
"http://thecolbertreport.cc.com/videos/r5l7zc/intro---5-19-14",
"http://thecolbertreport.cc.com/videos/el90zp/co-ed-lab-rats",
"http://thecolbertreport.cc.com/videos/7oum5k/elizabeth-warren-vs--wall-street",
"http://thecolbertreport.cc.com/videos/7sujj3/colbert-report-consumer-alert---jerky-blaster",
"http://thecolbertreport.cc.com/videos/79q9bs/elizabeth-warren",
"http://thecolbertreport.cc.com/videos/igbz3e/sign-off---goodnight"
],
"guest": "Elizabeth Warren"
},
{
"date": "2014-05-20",
"videos": [
"http://thecolbertreport.cc.com/videos/oimxrw/china-s-cyber-spies",
"http://thecolbertreport.cc.com/videos/zfayee/the-gop-s-gloves-off-approach-to-hillary-clinton",
"http://thecolbertreport.cc.com/videos/dbim9j/google-and-the-right-to-be-forgotten",
"http://thecolbertreport.cc.com/videos/zopbx2/matthew-weiner",
"http://thecolbertreport.cc.com/videos/g4ax73/sign-off---goodbye-kiss"
],
"guest": "Matt Weiner"
},
{
"date": "2014-05-21",
"videos": [
"http://thecolbertreport.cc.com/videos/6uijkp/tea-party-defeat-in-the-gop-primaries",
"http://thecolbertreport.cc.com/videos/sk5fyk/idaho-s-bizarre-gubernatorial-debate",
"http://thecolbertreport.cc.com/videos/zn3est/mers-virus-in-america",
"http://thecolbertreport.cc.com/videos/xnk3xl/patrick-stewart",
"http://thecolbertreport.cc.com/videos/8pgnos/sign-off---goodnight"
],
"guest": "Patrick Stewart"
},
{
"date": "2014-05-22",
"videos": [
"http://thecolbertreport.cc.com/videos/7q56w3/intro---5-22-14",
"http://thecolbertreport.cc.com/videos/ouzxbu/va-hospital-outrage",
"http://thecolbertreport.cc.com/videos/s6rmi7/va-hospital-outrage---paul-rieckhoff",
"http://thecolbertreport.cc.com/videos/74fcac/marco-rubio-s-hazy-marijuana-history",
"http://thecolbertreport.cc.com/videos/b40eb0/ray-mabus",
"http://thecolbertreport.cc.com/videos/764wvl/sign-off---goodnight-and-good-week"
],
"guest": "Ray Mabus"
},
{
"date": "2014-06-02",
"videos": [
"http://thecolbertreport.cc.com/videos/xtbsgf/obama-s-prisoner-exchange-with-the-taliban",
"http://thecolbertreport.cc.com/videos/i8fthl/difference-makers---doug-varrieur",
"http://thecolbertreport.cc.com/videos/oq97o4/thomas-piketty-vs--billionaire-heroes",
"http://thecolbertreport.cc.com/videos/e301vf/thomas-piketty",
"http://thecolbertreport.cc.com/videos/lyrlrc/sign-off---goatee"
],
"guest": "Thomas Piketty"
},
{
"date": "2014-06-03",
"videos": [
"http://thecolbertreport.cc.com/videos/o4pou7/intro---6-3-14",
"http://thecolbertreport.cc.com/videos/u6nqsd/open-carry-backlash",
"http://thecolbertreport.cc.com/videos/57iigb/obama-s-global-warming-initiative",
"http://thecolbertreport.cc.com/videos/ifxi76/obama-s-global-warming-initiative---dan-esty",
"http://thecolbertreport.cc.com/videos/vf38fj/medicare-coverage-for-sex-change-surgery",
"http://thecolbertreport.cc.com/videos/ttwu42/morgan-freeman",
"http://thecolbertreport.cc.com/videos/qmezm2/sign-off---goodnight"
],
"guest": "Morgan Freeman"
},
{
"date": "2014-06-04",
"videos": [
"http://thecolbertreport.cc.com/videos/yuxdmx/the-perils-of-girly-hurricanes",
"http://thecolbertreport.cc.com/videos/ukf9gv/amazon-vs--hachette",
"http://thecolbertreport.cc.com/videos/t1nxwu/amazon-vs--hachette---sherman-alexie",
"http://thecolbertreport.cc.com/videos/w5wvxu/the-colbert-report-s-unintended-educational-value",
"http://thecolbertreport.cc.com/videos/olnbg3/jonah-hill",
"http://thecolbertreport.cc.com/videos/k89vi0/sign-off----california-"
],
"guest": "Jonah Hill"
},
{
"date": "2014-06-05",
"videos": [
"http://thecolbertreport.cc.com/videos/7fyrr9/intro---6-5-14",
"http://thecolbertreport.cc.com/videos/hfogr3/bergdghazi",
"http://thecolbertreport.cc.com/videos/2408x6/sport-report---mushroom-sports-drink--nfl-pill-pushers---rio-de-janeiro-s-olympic-problems",
"http://thecolbertreport.cc.com/videos/q8dzb2/the-drudge-report-on-hillary-clinton-s--walker-",
"http://thecolbertreport.cc.com/videos/muek3m/chrissie-hynde"
],
"guest": "Chrissie Hynde"
},
{
"date": "2014-06-09",
"videos": [
"http://thecolbertreport.cc.com/videos/tpxhoo/scott-fistler-s--cesar-chavez--strategy",
"http://thecolbertreport.cc.com/videos/7uozsl/fox-news-s-war-on-bowe-bergdahl",
"http://thecolbertreport.cc.com/videos/uyh5xo/craziest-f--king-thing-i-ve-ever-heard---vincent-van-gogh-s-reanimated-ear",
"http://thecolbertreport.cc.com/videos/allxmi/esther-perel",
"http://thecolbertreport.cc.com/videos/x78nyg/sign-off---goodnight"
],
"guest": "Esther Perel"
},
{
"date": "2014-06-10",
"videos": [
"http://thecolbertreport.cc.com/videos/gdbreq/turing-test-breakthrough",
"http://thecolbertreport.cc.com/videos/p8wqsa/the-enemy-within---bina-the-activist-android",
"http://thecolbertreport.cc.com/videos/n30nzb/sport-report---swimming-pools-for-football-fans---governors--hockey-wager",
"http://thecolbertreport.cc.com/videos/2lc1uv/john-waters",
"http://thecolbertreport.cc.com/videos/dxz774/sign-off---goodnight"
],
"guest": "John Waters"
},
{
"date": "2014-06-11",
"videos": [
"http://thecolbertreport.cc.com/videos/s8uwwo/intro---6-11-14",
"http://thecolbertreport.cc.com/videos/1d3kl4/eric-cantor-s-shocking-defeat",
"http://thecolbertreport.cc.com/videos/m87g43/the-word---debt-or-prison",
"http://thecolbertreport.cc.com/videos/2kgoki/rob-rhinehart",
"http://thecolbertreport.cc.com/videos/6v0f1z/sign-off---spiked-drink"
],
"guest": "Rob Rhinehart"
},
{
"date": "2014-06-12",
"videos": [
"http://thecolbertreport.cc.com/videos/iywdca/amazon-s-scorched-earth-tactics-and-edan-lepucki-s--california-",
"http://thecolbertreport.cc.com/videos/4n51kp/tip-wag---ted-cruz---led-zeppelin",
"http://thecolbertreport.cc.com/videos/0z44gm/sport-report---team-usa-vs--the-group-of-death---hans-beinholtz-on-the-world-cup",
"http://thecolbertreport.cc.com/videos/sqbqhw/james-webb",
"http://thecolbertreport.cc.com/videos/pjws58/sign-off---necktie"
],
"guest": "James Webb"
},
{
"date": "2014-06-16",
"videos": [
"http://thecolbertreport.cc.com/videos/6mpwy3/isis-militants-in-iraq",
"http://thecolbertreport.cc.com/videos/wlnavl/isis-militants-in-iraq---ben-van-heuvelen",
"http://thecolbertreport.cc.com/videos/eozrlj/racial-perceptions-and-economic-stress",
"http://thecolbertreport.cc.com/videos/n3etz1/ta-nehisi-coates",
"http://thecolbertreport.cc.com/videos/200z2y/sign-off---hand-mirror"
],
"guest": "Ta-Nehisi Coates"
},
{
"date": "2014-06-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ddo89r/world-cup-victory-for-team-usa",
"http://thecolbertreport.cc.com/videos/xoa360/the-word---a-darker-shade-of-pale",
"http://thecolbertreport.cc.com/videos/qpaogb/majority-support-for-same-sex-marriage",
"http://thecolbertreport.cc.com/videos/8buw4s/david-boies---theodore-b--olson",
"http://thecolbertreport.cc.com/videos/4gkwgg/sign-off---foam-finger"
],
"guest": "David Boies & Theodore B. Olson"
},
{
"date": "2014-06-18",
"videos": [
"http://thecolbertreport.cc.com/videos/exebzv/intro---6-18-14",
"http://thecolbertreport.cc.com/videos/hgs925/arrest-of-benghazi-terror-mastermind",
"http://thecolbertreport.cc.com/videos/a1yfmv/hillary-clinton-vs--the-rnc-squirrel",
"http://thecolbertreport.cc.com/videos/qj2x93/thad-cochran-on-doing-indecent-things-with-animals",
"http://thecolbertreport.cc.com/videos/3ul9zn/katty-kay---claire-shipman",
"http://thecolbertreport.cc.com/videos/och071/sign-off---goodnight"
],
"guest": "Katty Kay & Claire Shipman"
},
{
"date": "2014-06-19",
"videos": [
"http://thecolbertreport.cc.com/videos/gt99v3/the-iraq-pack",
"http://thecolbertreport.cc.com/videos/445utq/thought-for-food---domino-s-smart-slice---doritos-jacked",
"http://thecolbertreport.cc.com/videos/cbr3yz/-yo--smartphone-app",
"http://thecolbertreport.cc.com/videos/3abzv4/jay-carney",
"http://thecolbertreport.cc.com/videos/h0b8ou/sign-off---goodnight"
],
"guest": "Jay Carney"
},
{
"date": "2014-06-23",
"videos": [
"http://thecolbertreport.cc.com/videos/7bqhfd/team-usa-s-tragic-tie-with-portugal",
"http://thecolbertreport.cc.com/videos/k8orr2/obama-s-response-to-isis-in-iraq---mark-mazzetti",
"http://thecolbertreport.cc.com/videos/72elnv/jeremy-meeks-s-handsome-mug-shot",
"http://thecolbertreport.cc.com/videos/07oysy/john-green",
"http://thecolbertreport.cc.com/videos/mwnvtk/sign-off---goodnight"
],
"guest": "John Green"
},
{
"date": "2014-06-24",
"videos": [
"http://thecolbertreport.cc.com/videos/tmjbzp/intro---6-24-14",
"http://thecolbertreport.cc.com/videos/ee0zj7/isis-invades-hashtagistan",
"http://thecolbertreport.cc.com/videos/bveu0w/tip-wag---fda---ben---jerry-s",
"http://thecolbertreport.cc.com/videos/bu43e8/new-york-s-ban-on-tiger-selfies",
"http://thecolbertreport.cc.com/videos/bo739z/edie-falco",
"http://thecolbertreport.cc.com/videos/hgf6rh/sign-off---goodnight"
],
"guest": "Edie Falco"
},
{
"date": "2014-06-25",
"videos": [
"http://thecolbertreport.cc.com/videos/rpnj8s/obama-s-chipotle-blunder",
"http://thecolbertreport.cc.com/videos/glsyx9/stephen-colbert-s-bats--t-serious---child-immigrant-intrigue",
"http://thecolbertreport.cc.com/videos/nx3ix1/stephen-colbert-s-bats--t-serious---child-immigrant-intrigue---john-burnett",
"http://thecolbertreport.cc.com/videos/rki77c/primary-victory-for-thad-cochran",
"http://thecolbertreport.cc.com/videos/rn2gd8/eleanor-holmes-norton",
"http://thecolbertreport.cc.com/videos/q6den3/sign-off---goodnight"
],
"guest": "Rep. Eleanor Holmes Norton"
},
{
"date": "2014-06-26",
"videos": [
"http://thecolbertreport.cc.com/videos/suqg0f/stephen-colbert-s-bats--t-serious---the-vast-government-soccer-conspiracy",
"http://thecolbertreport.cc.com/videos/autzis/tip-wag---north-carolina-state-legislature---cereal-manufacturers",
"http://thecolbertreport.cc.com/videos/jrdas9/paul-rudd-pt--1",
"http://thecolbertreport.cc.com/videos/rb9bo7/paul-rudd-pt--2",
"http://thecolbertreport.cc.com/videos/8vp2bp/sign-off---so-long-for-two-weeks"
],
"guest": "Paul Rudd"
},
{
"date": "2014-07-14",
"videos": [
"http://thecolbertreport.cc.com/videos/fy2b19/intro---7-14-14",
"http://thecolbertreport.cc.com/videos/9cspva/world-cup-recap",
"http://thecolbertreport.cc.com/videos/mlyvqh/thank-you--racism---boehner-v--obama",
"http://thecolbertreport.cc.com/videos/xivy3m/hobby-lobby-case",
"http://thecolbertreport.cc.com/videos/9nzwjt/vessyl-digital-cup",
"http://thecolbertreport.cc.com/videos/6cvwe6/jad-abumrad---robert-krulwich",
"http://thecolbertreport.cc.com/videos/rpfaco/sign-off---goodnight"
],
"guest": "Jad Abumrad, Robert Krulwich"
},
{
"date": "2014-07-15",
"videos": [
"http://thecolbertreport.cc.com/videos/nnucn6/obama-s-senioritis",
"http://thecolbertreport.cc.com/videos/f0uh68/threatdown---all-bear-edition",
"http://thecolbertreport.cc.com/videos/08a2dg/vint-cerf-pt--1",
"http://thecolbertreport.cc.com/videos/x9hnxr/vint-cerf-pt--2",
"http://thecolbertreport.cc.com/videos/dixoxg/sign-off---goodnight"
],
"guest": "Vint Cerf"
},
{
"date": "2014-07-16",
"videos": [
"http://thecolbertreport.cc.com/videos/anklfa/intro---7-16-14",
"http://thecolbertreport.cc.com/videos/53n0nf/conservative-contempt-for-bill-de-blasio",
"http://thecolbertreport.cc.com/videos/cbs1n7/rick-perry-s-makeover---uncensored",
"http://thecolbertreport.cc.com/videos/1flr4c/filling-captain-america-s-shoes---joe-quesada",
"http://thecolbertreport.cc.com/videos/ypm476/bill-de-blasio",
"http://thecolbertreport.cc.com/videos/slmbh6/sign-off----captain-america-"
],
"guest": "Mayor Bill de Blasio"
},
{
"date": "2014-07-17",
"videos": [
"http://thecolbertreport.cc.com/videos/ket4ms/malaysia-airlines-crash---hamas-israel-violence",
"http://thecolbertreport.cc.com/videos/z3gi0q/questionable-compassion-for-child-immigrants",
"http://thecolbertreport.cc.com/videos/bfvmgh/coal-rolling",
"http://thecolbertreport.cc.com/videos/70ezhu/steven-m--wise",
"http://thecolbertreport.cc.com/videos/n00bpi/sign-off---soot-blast"
],
"guest": "Steven Wise"
},
{
"date": "2014-07-21",
"videos": [
"http://thecolbertreport.cc.com/videos/qimhj6/intro---7-21-14",
"http://thecolbertreport.cc.com/videos/n71mkf/world-news-wrap-up",
"http://thecolbertreport.cc.com/videos/8e5dyu/colbert-nation-vs--amazon---edan-lepucki",
"http://thecolbertreport.cc.com/videos/egw3ua/nancy-pelosi-pt--1",
"http://thecolbertreport.cc.com/videos/q8mj7b/nancy-pelosi-pt--2",
"http://thecolbertreport.cc.com/videos/98szje/sign-off----sweetness--9-"
],
"guest": "Rep. Nancy Pelosi"
},
{
"date": "2014-07-22",
"videos": [
"http://thecolbertreport.cc.com/videos/a6s2qu/rep--steve-pearce-s-fact-finding-mission-in-central-america",
"http://thecolbertreport.cc.com/videos/d24npe/rising-calls-for-obama-s-impeachment",
"http://thecolbertreport.cc.com/videos/stx9ln/rising-calls-for-obama-s-impeachment---p-k--winsome",
"http://thecolbertreport.cc.com/videos/qf023x/rory-mcilroy-and-caroline-wozniacki-s-post-breakup-triumph",
"http://thecolbertreport.cc.com/videos/1872w0/julia-ioffe",
"http://thecolbertreport.cc.com/videos/rxjlpc/sign-off---p-k--winsome"
],
"guest": "Julia Ioffe"
},
{
"date": "2014-07-23",
"videos": [
"http://thecolbertreport.cc.com/videos/74ly7x/housing-crisis-for-child-immigrants",
"http://thecolbertreport.cc.com/videos/w0dhco/six-californias",
"http://thecolbertreport.cc.com/videos/rmgh1u/six-californias---tim-draper",
"http://thecolbertreport.cc.com/videos/qb2d4f/lowe-s-vs--veterans-affairs",
"http://thecolbertreport.cc.com/videos/a368r9/mary-mazzio---oscar-vazquez",
"http://thecolbertreport.cc.com/videos/8nsg9g/sign-off---goodnight"
],
"guest": "Mary Mazzio, Oscar Vazquez"
},
{
"date": "2014-07-24",
"videos": [
"http://thecolbertreport.cc.com/videos/9bfzta/darth-vader-for-president",
"http://thecolbertreport.cc.com/videos/br4k5m/tip-wag----true-blood----washington--d-c---court-of-appeals",
"http://thecolbertreport.cc.com/videos/o26y1r/elon-musk-pt--1",
"http://thecolbertreport.cc.com/videos/s4aaoq/elon-musk-pt--2",
"http://thecolbertreport.cc.com/videos/baab8l/exclusive---elon-musk-discusses-mars",
"http://thecolbertreport.cc.com/videos/9pmgk5/sign-off---goodnight"
],
"guest": "Elon Musk"
},
{
"date": "2014-07-28",
"videos": [
"http://thecolbertreport.cc.com/videos/99fqm5/magical-afternoon-at-comic-con",
"http://thecolbertreport.cc.com/videos/yxerhp/the-word---see-no-equal",
"http://thecolbertreport.cc.com/videos/c8gyzb/-kim-kardashian--hollywood--game",
"http://thecolbertreport.cc.com/videos/me3jxh/beck"
],
"guest": "Beck"
},
{
"date": "2014-07-29",
"videos": [
"http://thecolbertreport.cc.com/videos/go3xsz/stephen-colbert-s-i-need-a-drink",
"http://thecolbertreport.cc.com/videos/zo7j8y/the-sarah-palin-channel",
"http://thecolbertreport.cc.com/videos/oeurov/jon-batiste-and-stay-human",
"http://thecolbertreport.cc.com/videos/84mh53/sign-off---jon-batiste-and-stay-human"
],
"guest": "Jon Batiste & Stay Human"
},
{
"date": "2014-07-30",
"videos": [
"http://thecolbertreport.cc.com/videos/vy7myr/orlando-bloom-s-altercation-with-justin-bieber",
"http://thecolbertreport.cc.com/videos/mfm78m/corporate-inversions",
"http://thecolbertreport.cc.com/videos/gv7xvj/corporate-inversions---allan-sloan",
"http://thecolbertreport.cc.com/videos/psbsuw/naked-tv",
"http://thecolbertreport.cc.com/videos/lb70bp/james-franco",
"http://thecolbertreport.cc.com/videos/n2673s/sign-off---goodnight"
],
"guest": "James Franco"
},
{
"date": "2014-07-31",
"videos": [
"http://thecolbertreport.cc.com/videos/dwf82q/women-on-american-currency",
"http://thecolbertreport.cc.com/videos/cruj3s/the-conflict-over-covering-the-conflict-in-gaza",
"http://thecolbertreport.cc.com/videos/m4juon/tip-wag---beelzebub---nasa",
"http://thecolbertreport.cc.com/videos/2mpwlv/campbell-brown",
"http://thecolbertreport.cc.com/videos/26ag1q/sign-off---monitoring-system"
],
"guest": "Campbell Brown"
},
{
"date": "2014-08-04",
"videos": [
"http://thecolbertreport.cc.com/videos/zcyj0l/40th-anniversary-of-nixon-s-resignation",
"http://thecolbertreport.cc.com/videos/9hxmyy/a-nation-betrayed---a-fond-look-back---74",
"http://thecolbertreport.cc.com/videos/c505xx/pat-buchanan",
"http://thecolbertreport.cc.com/videos/ecplh0/john-w--dean",
"http://thecolbertreport.cc.com/videos/jg7vda/sign-off---retrospectacular",
"http://thecolbertreport.cc.com/videos/2kctj0/exclusive---pat-buchanan"
],
"guest": "Pat Buchanan, John W. Dean"
},
{
"date": "2014-08-05",
"videos": [
"http://thecolbertreport.cc.com/videos/eu8j9u/open-carry-trailblazers",
"http://thecolbertreport.cc.com/videos/imtefo/-hard-choices----hillary-clinton",
"http://thecolbertreport.cc.com/videos/8tvtmw/language-lessons-from-america-s-senior-citizens",
"http://thecolbertreport.cc.com/videos/wb06vr/james-cameron",
"http://thecolbertreport.cc.com/videos/tovjr3/sign-off---goodnight"
],
"guest": "James Cameron"
},
{
"date": "2014-08-06",
"videos": [
"http://thecolbertreport.cc.com/videos/v652g6/smile-file---kim-jong-un-at-the-lube-factory",
"http://thecolbertreport.cc.com/videos/mrntln/rand-paul-s-hasty-exit",
"http://thecolbertreport.cc.com/videos/82nvgq/news-anchor-baby",
"http://thecolbertreport.cc.com/videos/gn8hz0/michael-fassbender"
],
"guest": "Michael Fassbender"
},
{
"date": "2014-08-07",
"videos": [
"http://thecolbertreport.cc.com/videos/2mrfmc/intro---8-7-14",
"http://thecolbertreport.cc.com/videos/bmd26v/vladimir-putin-s-food-sanctions",
"http://thecolbertreport.cc.com/videos/nm2atj/ebola-panic",
"http://thecolbertreport.cc.com/videos/7a9ir7/the-in-box---blt-vs--club",
"http://thecolbertreport.cc.com/videos/ddvyto/brian-chesky",
"http://thecolbertreport.cc.com/videos/dc3x0v/sign-off---bourbon-and-chicken"
],
"guest": "Brian Chesky"
},
{
"date": "2014-08-26",
"videos": [
"http://thecolbertreport.cc.com/videos/xfa2tc/intro---8-26-14",
"http://thecolbertreport.cc.com/videos/pupsy6/better-know-a-district---ohio-s-11th---marcia-fudge-pt--1",
"http://thecolbertreport.cc.com/videos/llmmz6/better-know-a-district---ohio-s-11th---marcia-fudge-pt--2",
"http://thecolbertreport.cc.com/videos/crpfrn/jeff-bridges---lois-lowry",
"http://thecolbertreport.cc.com/videos/30umwt/sign-off---goodnight"
],
"guest": "Jeff Bridges, Lois Lowry"
},
{
"date": "2014-08-27",
"videos": [
"http://thecolbertreport.cc.com/videos/12kfzg/intro---8-27-14",
"http://thecolbertreport.cc.com/videos/4komvc/outrage-in-ferguson",
"http://thecolbertreport.cc.com/videos/h1itnw/outrage-in-ferguson---a-national-conversation-on-race",
"http://thecolbertreport.cc.com/videos/8ye61k/scrabble-s-updated-dictionary",
"http://thecolbertreport.cc.com/videos/v6x4qn/michael-sheen",
"http://thecolbertreport.cc.com/videos/4g1qgo/sign-off---welcome-baby-eva-"
],
"guest": "Michael Sheen"
},
{
"date": "2014-08-28",
"videos": [
"http://thecolbertreport.cc.com/videos/2x4lop/isis-panic",
"http://thecolbertreport.cc.com/videos/yr7egy/isis-panic---announcing-reagan-s-return",
"http://thecolbertreport.cc.com/videos/bac98y/vapshot-alcohol-vaporizer",
"http://thecolbertreport.cc.com/videos/vmcz6o/jr",
"http://thecolbertreport.cc.com/videos/q6o47f/sign-off---goodnight"
],
"guest": "JR"
},
{
"date": "2014-09-02",
"videos": [
"http://thecolbertreport.cc.com/videos/7ohwx8/celebrity-nude-photo-scandal",
"http://thecolbertreport.cc.com/videos/kc4ojp/police-militarization-in-america",
"http://thecolbertreport.cc.com/videos/ukyqb3/police-militarization-in-america---norm-stamper",
"http://thecolbertreport.cc.com/videos/xuzel5/good-news-for-sleep-deprived-teens",
"http://thecolbertreport.cc.com/videos/sximkb/mandy-patinkin",
"http://thecolbertreport.cc.com/videos/hpkdp0/sign-off---goodnight"
],
"guest": "Mandy Patinkin"
},
{
"date": "2014-09-03",
"videos": [
"http://thecolbertreport.cc.com/videos/mrdb7o/intro---9-3-14",
"http://thecolbertreport.cc.com/videos/v7c4zm/obama-s-isis-strategy",
"http://thecolbertreport.cc.com/videos/2ccwew/obama-s-isis-strategy---frank-underwood",
"http://thecolbertreport.cc.com/videos/r6svso/coach-class-conflicts",
"http://thecolbertreport.cc.com/videos/ewijdy/randall-munroe",
"http://thecolbertreport.cc.com/videos/cs2fnl/sign-off---goodnight"
],
"guest": "Randall Munroe"
},
{
"date": "2014-09-04",
"videos": [
"http://thecolbertreport.cc.com/videos/30z1ut/intro---9-4-14",
"http://thecolbertreport.cc.com/videos/lo5wee/gays-in-the-st--patrick-s-day-parade",
"http://thecolbertreport.cc.com/videos/zq72u5/the-midterm-round-up",
"http://thecolbertreport.cc.com/videos/g7yyhh/al-qaeda-s-indian-franchise",
"http://thecolbertreport.cc.com/videos/s4ds82/doris-kearns-goodwin",
"http://thecolbertreport.cc.com/videos/fj6l1s/sign-off---ship-christening"
],
"guest": "Doris Kearns Goodwin"
},
{
"date": "2014-09-08",
"videos": [
"http://thecolbertreport.cc.com/videos/g9wav3/intro---9-8-14",
"http://thecolbertreport.cc.com/videos/dzxra6/william-and-kate-s-royal-pregnancy",
"http://thecolbertreport.cc.com/videos/3160bg/waiting-forever-for-immigration-reform",
"http://thecolbertreport.cc.com/videos/jz3rdd/pavlok-fitness-band",
"http://thecolbertreport.cc.com/videos/23mu4v/john-lithgow",
"http://thecolbertreport.cc.com/videos/a0x0bs/sign-off---goodnight"
],
"guest": "John Lithgow"
},
{
"date": "2014-09-09",
"videos": [
"http://thecolbertreport.cc.com/videos/j5s4z1/apple-unveils-its-smartwatch",
"http://thecolbertreport.cc.com/videos/s6gte9/the-midterm-round-up---the-gop-s-lady-problems",
"http://thecolbertreport.cc.com/videos/hkfm7z/hometown-hero-town---detroit",
"http://thecolbertreport.cc.com/videos/e4y7wx/jason-segel",
"http://thecolbertreport.cc.com/videos/93zpki/sign-off---jason-segel-s-latest-award"
],
"guest": "Jason Segel"
},
{
"date": "2014-09-10",
"videos": [
"http://thecolbertreport.cc.com/videos/u5vu07/intro---9-10-14",
"http://thecolbertreport.cc.com/videos/p2b64y/obama-s-isis-speech",
"http://thecolbertreport.cc.com/videos/lqm25y/dalai-lama-drama",
"http://thecolbertreport.cc.com/videos/4pdz7v/tip-wag---nasa---trump-entertainment-resorts",
"http://thecolbertreport.cc.com/videos/wn86jw/the-buypartisan-app",
"http://thecolbertreport.cc.com/videos/hyx04c/henry-kissinger",
"http://thecolbertreport.cc.com/videos/bipiaj/sign-off---goodnight"
],
"guest": "Henry Kissinger"
},
{
"date": "2014-09-11",
"videos": [
"http://thecolbertreport.cc.com/videos/oeusg2/this-country-is-at-war-",
"http://thecolbertreport.cc.com/videos/li99ni/republicans--predictions-of-the-iraq-crisis",
"http://thecolbertreport.cc.com/videos/wna0mw/global-warming-threatens-bird-species",
"http://thecolbertreport.cc.com/videos/ndpng7/lonn-taylor",
"http://thecolbertreport.cc.com/videos/cl9arb/sign-off---jim-cornelison-sings-the-national-anthem"
],
"guest": "Lonn Taylor"
},
{
"date": "2014-09-15",
"videos": [
"http://thecolbertreport.cc.com/videos/848h60/the-next-miss-america",
"http://thecolbertreport.cc.com/videos/lmtq66/the-vote-for-scottish-independence",
"http://thecolbertreport.cc.com/videos/exs7p5/the-vote-for-scottish-independence---matt-wells",
"http://thecolbertreport.cc.com/videos/0txz3z/think-tank-corruption",
"http://thecolbertreport.cc.com/videos/m1a8gr/mindy-kaling",
"http://thecolbertreport.cc.com/videos/0j1qdb/sign-off"
],
"guest": "Mindy Kaling"
},
{
"date": "2014-09-16",
"videos": [
"http://thecolbertreport.cc.com/videos/60e467/intro---9-16-14",
"http://thecolbertreport.cc.com/videos/0agoip/the-kinda-sorta-war-and-the-u-s--s-mysterious-allies",
"http://thecolbertreport.cc.com/videos/mzktzw/wall-street-meddles-with-restaurant-chain",
"http://thecolbertreport.cc.com/videos/oyl7ka/unlocking-the-truth"
],
"guest": "Unlocking the Truth"
},
{
"date": "2014-09-17",
"videos": [
"http://thecolbertreport.cc.com/videos/6d36zv/caped-cash-cows",
"http://thecolbertreport.cc.com/videos/zryrry/undercover-at-comic-con---prince-hawkcat",
"http://thecolbertreport.cc.com/videos/d791f1/undercover-at-comic-con---stephen-s-movie-pitches",
"http://thecolbertreport.cc.com/videos/xq6f9b/military-vehicles-for-public-schools",
"http://thecolbertreport.cc.com/videos/arckqm/viggo-mortensen",
"http://thecolbertreport.cc.com/videos/bfflr6/sign-off---aragorn"
],
"guest": "Viggo Mortensen"
},
{
"date": "2014-09-18",
"videos": [
"http://thecolbertreport.cc.com/videos/hn1ueg/checky",
"http://thecolbertreport.cc.com/videos/yupbhd/no-boots-on-the-ground-in-iraq",
"http://thecolbertreport.cc.com/videos/wjga35/sean-hannity-s-defense-of-adrian-peterson",
"http://thecolbertreport.cc.com/videos/rd6gao/terry-gilliam",
"http://thecolbertreport.cc.com/videos/148dzu/sign-off---stuffed-elephant"
],
"guest": "Terry Gilliam"
},
{
"date": "2014-09-22",
"videos": [
"http://thecolbertreport.cc.com/videos/uc4f7i/awol-afghan-soldiers",
"http://thecolbertreport.cc.com/videos/01cyc2/tip-wag---climate-change-marchers---senators-on-reality-tv",
"http://thecolbertreport.cc.com/videos/x58aop/charles-krauthammer-on-obama-s-mental-state",
"http://thecolbertreport.cc.com/videos/jq352p/tweedy"
],
"guest": "Tweedy"
},
{
"date": "2014-09-23",
"videos": [
"http://thecolbertreport.cc.com/videos/j6xqew/u-s--airstrikes-in-syria",
"http://thecolbertreport.cc.com/videos/ybvlae/better-know-a-district---california-s-2nd---jared-huffman",
"http://thecolbertreport.cc.com/videos/b5ni29/the-russians-buy-pbr",
"http://thecolbertreport.cc.com/videos/k5a58t/naomi-klein",
"http://thecolbertreport.cc.com/videos/ksh5pr/sign-off---pbr"
],
"guest": "Naomi Klein"
},
{
"date": "2014-09-24",
"videos": [
"http://thecolbertreport.cc.com/videos/5mneco/atone-phone---jeff-tweedy-calls",
"http://thecolbertreport.cc.com/videos/tw7sr5/obama-s-coffee-cup-salute"
],
"guest": "Bill Cosby"
},
{
"date": "2014-09-25",
"videos": [
"http://thecolbertreport.cc.com/videos/p49ls4/the-suspicious-death-of-staten-island-chuck",
"http://thecolbertreport.cc.com/videos/0hjuki/intro---9-25-14",
"http://thecolbertreport.cc.com/videos/tjmnw0/eric-holder-s-resignation",
"http://thecolbertreport.cc.com/videos/7dpl33/bill-o-reilly-s-elite-strike-force",
"http://thecolbertreport.cc.com/videos/0w775u/smile-file---the-u-a-e--s-first-female-fighter-pilot-vs---the-five----uncensored",
"http://thecolbertreport.cc.com/videos/g36k7p/walter-mischel",
"http://thecolbertreport.cc.com/videos/fhpqlq/sign-off---marshmallows"
],
"guest": "Walter Mischel"
},
{
"date": "2014-09-29",
"videos": [
"http://thecolbertreport.cc.com/videos/6ythcp/obama-s-rip-off-of-bush",
"http://thecolbertreport.cc.com/videos/eecxwy/hillary-clinton-and-the-grandmother-of-all-scandals",
"http://thecolbertreport.cc.com/videos/6w3vad/kim-jong-un-s-massive-cheese-consumption",
"http://thecolbertreport.cc.com/videos/ojmtk8/jamie-oliver",
"http://thecolbertreport.cc.com/videos/z231mw/sign-off---cake-and-cheese"
],
"guest": "Jamie Oliver"
},
{
"date": "2014-09-30",
"videos": [
"http://thecolbertreport.cc.com/videos/6k6hq3/muslims-in-the-end-zone",
"http://thecolbertreport.cc.com/videos/h1yge9/highlights-of-the-values-voter-summit",
"http://thecolbertreport.cc.com/videos/8x6lww/the-benefits-of-pessimism---hans-beinholtz",
"http://thecolbertreport.cc.com/videos/qofokt/jeffrey-tambor",
"http://thecolbertreport.cc.com/videos/pnsz05/sign-off---goodnight"
],
"guest": "Jeffrey Tambor"
},
{
"date": "2014-10-01",
"videos": [
"http://thecolbertreport.cc.com/videos/v6tds1/protests-in-hong-kong",
"http://thecolbertreport.cc.com/videos/v51zzo/protests-in-hong-kong---louisa-lim",
"http://thecolbertreport.cc.com/videos/zzbhqi/bill-o-reilly-takes-offense",
"http://thecolbertreport.cc.com/videos/oviilh/mike-mullen",
"http://thecolbertreport.cc.com/videos/5tiz1y/sign-off---goodnight",
"http://thecolbertreport.cc.com/videos/8f6kuv/exclusive---mike-mullen-extended-interview"
],
"guest": "Adm. Mike Mullen"
},
{
"date": "2014-10-02",
"videos": [
"http://thecolbertreport.cc.com/videos/jyghug/intro---10-2-14",
"http://thecolbertreport.cc.com/videos/x6d5sz/deathpocalypse-now---ebola-in-america---50-states-of-grave",
"http://thecolbertreport.cc.com/videos/hhhqqd/deathpocalypse-now---ebola-in-america---kent-sepkowitz",
"http://thecolbertreport.cc.com/videos/e72awe/solitocity",
"http://thecolbertreport.cc.com/videos/ye2fnr/lynn-sherr",
"http://thecolbertreport.cc.com/videos/7nl6i5/sign-off---hand-sanitizer"
],
"guest": "Lynn Sherr"
},
{
"date": "2014-10-06",
"videos": [
"http://thecolbertreport.cc.com/videos/g5stw6/intro---10-6-14",
"http://thecolbertreport.cc.com/videos/heaxbs/victory-for-gay-marriage---the-rise-of-amicus-briefs",
"http://thecolbertreport.cc.com/videos/ssmvma/victory-for-gay-marriage---the-rise-of-amicus-briefs---allison-orr-larsen",
"http://thecolbertreport.cc.com/videos/ayvbym/a-rare-correction---no-ebola-outbreak-in-the-u-s-",
"http://thecolbertreport.cc.com/videos/fcax26/james-m--mcpherson",
"http://thecolbertreport.cc.com/videos/bfwqfb/sign-off---goodnight"
],
"guest": "James McPherson"
},
{
"date": "2014-10-07",
"videos": [
"http://thecolbertreport.cc.com/videos/hhqgbw/ebolapalooza",
"http://thecolbertreport.cc.com/videos/nx3ewk/better-know-a-district---illinois-s-8th---tammy-duckworth",
"http://thecolbertreport.cc.com/videos/q2857u/cheating-death---pandemic-health",
"http://thecolbertreport.cc.com/videos/7swpxt/leon-wieseltier",
"http://thecolbertreport.cc.com/videos/rete59/sign-off---cigarette"
],
"guest": "Leon Wieseltier"
},
{
"date": "2014-10-08",
"videos": [
"http://thecolbertreport.cc.com/videos/e50viy/intro---10-8-14",
"http://thecolbertreport.cc.com/videos/khi8w0/john-boehner-vs--america-s-anti-gay-marriage-crusaders",
"http://thecolbertreport.cc.com/videos/m899eo/naming-the-war-against-isis",
"http://thecolbertreport.cc.com/videos/hzou6l/carol-burnett",
"http://thecolbertreport.cc.com/videos/hcc5br/sign-off---ear-tug"
],
"guest": "Carol Burnett"
},
{
"date": "2014-10-09",
"videos": [
"http://thecolbertreport.cc.com/videos/blfnlw/exclusive---robert-plant----little-maggie-",
"http://thecolbertreport.cc.com/videos/jdri4u/robert-plant----rainbow-",
"http://thecolbertreport.cc.com/videos/tyc0sx/intro---10-9-14",
"http://thecolbertreport.cc.com/videos/0gscic/columbus-day-under-attack",
"http://thecolbertreport.cc.com/videos/hpfwm4/raining-vs--sprinkling",
"http://thecolbertreport.cc.com/videos/xfjyum/republicans-are-people--too",
"http://thecolbertreport.cc.com/videos/jfanx7/robert-plant",
"http://thecolbertreport.cc.com/videos/o2y6sr/sign-off----lullaby-and----the-ceaseless-roar-"
],
"guest": "Robert Plant"
},
{
"date": "2014-10-13",
"videos": [
"http://thecolbertreport.cc.com/videos/fhnqjo/midterms--014---detour-to-gridlock---an-exciting-thing-that-i-am-totally-interested-in",
"http://thecolbertreport.cc.com/videos/8zip3j/intro---10-13-14",
"http://thecolbertreport.cc.com/videos/sx2hh2/32-episodes-left-for-the-report",
"http://thecolbertreport.cc.com/videos/fp4xfy/walter-isaacson",
"http://thecolbertreport.cc.com/videos/f4t3xr/sign-off---quality-time-with-americone-dream",
"http://thecolbertreport.cc.com/videos/bxbwj4/midterms--014---detour-to-gridlock---dennis-daugaard"
],
"guest": "Walter Isaacson"
},
{
"date": "2014-10-14",
"videos": [
"http://thecolbertreport.cc.com/videos/zg3zai/neil-young----who-s-gonna-stand-up---and-save-the-earth--",
"http://thecolbertreport.cc.com/videos/wcjcgn/a-week-of-victories-for-gay-rights",
"http://thecolbertreport.cc.com/videos/akzlpt/say-yes-to-rick-scott",
"http://thecolbertreport.cc.com/videos/namhpu/neil-young",
"http://thecolbertreport.cc.com/videos/veswmj/sign-off----special-deluxe-"
],
"guest": "Neil Young"
},
{
"date": "2014-10-15",
"videos": [
"http://thecolbertreport.cc.com/videos/qw8rwv/who-s-attacking-me-now----larry-page",
"http://thecolbertreport.cc.com/videos/q2u206/tip-wag---barack-obama---stan-lee",
"http://thecolbertreport.cc.com/videos/xv3cdl/sean-hannity-s-question-of-the-day",
"http://thecolbertreport.cc.com/videos/18x57e/justin-simien",
"http://thecolbertreport.cc.com/videos/4tsbtt/sign-off---goodnight"
],
"guest": "Justin Simien"
},
{
"date": "2014-10-16",
"videos": [
"http://thecolbertreport.cc.com/videos/uebndp/abandoned-wmds-in-iraq",
"http://thecolbertreport.cc.com/videos/aywapn/abandoned-wmds-in-iraq---c-j--chivers",
"http://thecolbertreport.cc.com/videos/3o1uzs/rick-scott-and-charlie-crist-s-bizarre-debate",
"http://thecolbertreport.cc.com/videos/z4umi5/william-deresiewicz",
"http://thecolbertreport.cc.com/videos/xrvm7x/stephen-s-old-ipod"
],
"guest": "Bill Deresiewicz"
},
{
"date": "2014-10-27",
"videos": [
"http://thecolbertreport.cc.com/videos/e27u8w/intro---10-27-14",
"http://thecolbertreport.cc.com/videos/8hjpi2/ebola-in-new-york",
"http://thecolbertreport.cc.com/videos/whfeyg/louie-gohmert-on-gays-in-the-military",
"http://thecolbertreport.cc.com/videos/jjpinj/meredith-vieira",
"http://thecolbertreport.cc.com/videos/a0zbrf/sign-off---sundae"
],
"guest": "Meredith Vieira"
},
{
"date": "2014-10-28",
"videos": [
"http://thecolbertreport.cc.com/videos/xxvx4u/war-on-halloween---flaming-bags-of-government",
"http://thecolbertreport.cc.com/videos/jxddq4/the-nra-vs--pennsylvania-s-pet-eating-ban",
"http://thecolbertreport.cc.com/videos/6cj1fk/tom-corbett-s-photoshopped-diversity",
"http://thecolbertreport.cc.com/videos/nzy3nz/sport-report---fall-experimental-football-league",
"http://thecolbertreport.cc.com/videos/c7wjzg/michael-lewis",
"http://thecolbertreport.cc.com/videos/64x2gg/sign-off---goodnight"
],
"guest": "Michael Lewis"
},
{
"date": "2014-10-29",
"videos": [
"http://thecolbertreport.cc.com/videos/ladjef/gamergate",
"http://thecolbertreport.cc.com/videos/wr7hqq/gamergate---anita-sarkeesian",
"http://thecolbertreport.cc.com/videos/ll1e16/heroism-in-canada",
"http://thecolbertreport.cc.com/videos/1h66nr/jill-lepore",
"http://thecolbertreport.cc.com/videos/1fc6m9/sign-off---microphone"
],
"guest": "Jill Lepore"
},
{
"date": "2014-10-30",
"videos": [
"http://thecolbertreport.cc.com/videos/qvw67z/intro---10-30-14",
"http://thecolbertreport.cc.com/videos/hxvn8w/-america-again--in-paperback",
"http://thecolbertreport.cc.com/videos/365nm9/america-s-midterm-indifference---george-takei",
"http://thecolbertreport.cc.com/videos/cykxut/the-perils-of-anchor-zygotes",
"http://thecolbertreport.cc.com/videos/tqbn3t/david-miliband",
"http://thecolbertreport.cc.com/videos/4rgfpm/sign-off---goodnight"
],
"guest": "David Miliband"
},
{
"date": "2014-11-03",
"videos": [
"http://thecolbertreport.cc.com/videos/cvjwus/intro---11-3-14",
"http://thecolbertreport.cc.com/videos/p6uab8/midterms--014---detour-to-gridlock---midterm-flyer-of-shame",
"http://thecolbertreport.cc.com/videos/qmg04s/tip-wag---nazi-dairy-products--tim-cook---prostate-health-researchers",
"http://thecolbertreport.cc.com/videos/rw2v1b/stephen-colbert-s-enchanted-princess-pixie-wedding-cake",
"http://thecolbertreport.cc.com/videos/lffyr9/chuck-todd",
"http://thecolbertreport.cc.com/videos/xrfsl8/sign-off---goodnight"
],
"guest": "Chuck Todd"
},
{
"date": "2014-11-04",
"videos": [
"http://thecolbertreport.cc.com/videos/1g0aji/midterms--014---detour-to-gridlock---live-coverage",
"http://thecolbertreport.cc.com/videos/cmr0z4/midterms--014---detour-to-gridlock---mountains-of-midterm-madness",
"http://thecolbertreport.cc.com/videos/w3muth/midterms--014---detour-to-gridlock---social-tracker-8700",
"http://thecolbertreport.cc.com/videos/ekj19q/andrew-sullivan",
"http://thecolbertreport.cc.com/videos/ckxbqk/sign-off---stephen-s-last-election-special"
],
"guest": "Andrew Sullivan"
},
{
"date": "2014-11-05",
"videos": [
"http://thecolbertreport.cc.com/videos/c5okdm/intro---11-5-14",
"http://thecolbertreport.cc.com/videos/ywqnjy/the-republicans-win-everything",
"http://thecolbertreport.cc.com/videos/wq84nn/better-know-a-district---california-s-13th---barbara-lee",
"http://thecolbertreport.cc.com/videos/7feu8t/legalized-marijuana-in-washington--d-c-",
"http://thecolbertreport.cc.com/videos/w2qs7x/kirsten-gillibrand",
"http://thecolbertreport.cc.com/videos/tno5bj/sign-off---goodnight"
],
"guest": "Sen. Kirsten Gillibrand"
},
{
"date": "2014-11-06",
"videos": [
"http://thecolbertreport.cc.com/videos/kk2x1a/intro---11-6-14",
"http://thecolbertreport.cc.com/videos/rtdlsr/busted-for-feeding-the-homeless",
"http://thecolbertreport.cc.com/videos/3rw0tz/cheating-death---aging---women-s-health",
"http://thecolbertreport.cc.com/videos/sc6mpp/the-republicans--inspiring-climate-change-message",
"http://thecolbertreport.cc.com/videos/v06v9z/steven-johnson",
"http://thecolbertreport.cc.com/videos/yzaj23/sign-off---goodnight"
],
"guest": "Steven Johnson"
},
{
"date": "2014-11-10",
"videos": [
"http://thecolbertreport.cc.com/videos/erbk9q/intro---11-10-14",
"http://thecolbertreport.cc.com/videos/xnwueh/big-news-from-the-hermit-kingdom",
"http://thecolbertreport.cc.com/videos/avadrz/the-word---it-s-a-trap-",
"http://thecolbertreport.cc.com/videos/87vgoo/adventures-in-snackology",
"http://thecolbertreport.cc.com/videos/sbmlul/andy-cohen",
"http://thecolbertreport.cc.com/videos/7uog9s/sign-off---goodnight"
],
"guest": "Andy Cohen"
},
{
"date": "2014-11-11",
"videos": [
"http://thecolbertreport.cc.com/videos/mnkz05/intro---11-11-14",
"http://thecolbertreport.cc.com/videos/wht7i8/uncertain-death-for-isis-s-leader",
"http://thecolbertreport.cc.com/videos/thgfth/blowback-from-obama-s-visit-to-china",
"http://thecolbertreport.cc.com/videos/uqricc/tip-wag---breitbart",
"http://thecolbertreport.cc.com/videos/41fe1h/diane-von-furstenberg",
"http://thecolbertreport.cc.com/videos/ncl44x/sign-off---cheerful-reflection"
],
"guest": "Diane Von Furstenberg"
},
{
"date": "2014-11-12",
"videos": [
"http://thecolbertreport.cc.com/videos/80wk4b/intro---11-12-14",
"http://thecolbertreport.cc.com/videos/a1b4ph/new-york-city-s-rat-deficiency",
"http://thecolbertreport.cc.com/videos/rn92gg/stephen-colbert-s-auto-robotic-fixation",
"http://thecolbertreport.cc.com/videos/hhmb28/mr--smith-goes-to-the-state-legislature--then-later-possibly-washington---gordon-klingenschmitt",
"http://thecolbertreport.cc.com/videos/6wtwlg/terence-tao",
"http://thecolbertreport.cc.com/videos/a1eex6/sign-off---red-wine"
],
"guest": "Terence Tao"
},
{
"date": "2014-11-13",
"videos": [
"http://thecolbertreport.cc.com/videos/jtbvle/reforming-health-care-reform",
"http://thecolbertreport.cc.com/videos/fe3wjm/reforming-health-care-reform---emily-bazelon",
"http://thecolbertreport.cc.com/videos/cvq86c/gay-marriage-victory-in-south-carolina",
"http://thecolbertreport.cc.com/videos/3pu1ey/jennifer-lawrence",
"http://thecolbertreport.cc.com/videos/9aqahd/sign-off---goodnight"
],
"guest": "Jennifer Lawrence"
},
{
"date": "2014-11-17",
"videos": [
"http://thecolbertreport.cc.com/videos/qed7bp/bono-s-missing-luggage",
"http://thecolbertreport.cc.com/videos/9dr12d/survival-tips-from--good-morning-america-",
"http://thecolbertreport.cc.com/videos/7vjzxb/bernie-sanders-pt--1",
"http://thecolbertreport.cc.com/videos/67tlr7/bernie-sanders-pt--2",
"http://thecolbertreport.cc.com/videos/uqho5w/sign-off---goodnight"
],
"guest": "Sen. Bernie Sanders"
},
{
"date": "2014-11-18",
"videos": [
"http://thecolbertreport.cc.com/videos/fys4c2/intro---11-18-14",
"http://thecolbertreport.cc.com/videos/ib2b3k/polar-plunge",
"http://thecolbertreport.cc.com/videos/iw2iwg/obama-s-immigration-plan---esteban-colberto",
"http://thecolbertreport.cc.com/videos/bbfckz/tip-wag---salvage-stores---maine",
"http://thecolbertreport.cc.com/videos/o8su6y/eva-longoria",
"http://thecolbertreport.cc.com/videos/vu8jpe/sign-off---goodnight"
],
"guest": "Eva Longoria"
},
{
"date": "2014-11-19",
"videos": [
"http://thecolbertreport.cc.com/videos/7mkltp/simulated-school-attack-in-florida",
"http://thecolbertreport.cc.com/videos/dvppp6/difference-makers---the-free-keene-squad",
"http://thecolbertreport.cc.com/videos/sdqbxm/black-friday-sale",
"http://thecolbertreport.cc.com/videos/9yc4ry/toni-morrison",
"http://thecolbertreport.cc.com/videos/y4ygag/sign-off---goodnight"
],
"guest": "Toni Morrison"
},
{
"date": "2014-11-20",
"videos": [
"http://thecolbertreport.cc.com/videos/01iemp/obama-s-executive-amnesty",
"http://thecolbertreport.cc.com/videos/fie7ef/threatdown---declining-standards-of-sexiness--people-who-eat-chocolate---invaders-of-the-new-world",
"http://thecolbertreport.cc.com/videos/e55wo4/jon-stewart-pt--1",
"http://thecolbertreport.cc.com/videos/vbi9v5/jon-stewart-pt--2",
"http://thecolbertreport.cc.com/videos/zwcggy/sign-off---goodnight"
],
"guest": "Jon Stewart"
},
{
"date": "2014-12-01",
"videos": [
"http://thecolbertreport.cc.com/videos/wmtufg/intro---12-1-14",
"http://thecolbertreport.cc.com/videos/umsrnb/lightsaber-controversy",
"http://thecolbertreport.cc.com/videos/wud7e1/ferguson-fallout-and-the-st--louis-rams",
"http://thecolbertreport.cc.com/videos/d6xq50/jihadis-of-the-high-seas",
"http://thecolbertreport.cc.com/videos/3h1qqa/john-mccain",
"http://thecolbertreport.cc.com/videos/dnrg1a/sign-off---goodnight"
],
"guest": "Sen. John McCain"
},
{
"date": "2014-12-02",
"videos": [
"http://thecolbertreport.cc.com/videos/v8mtsf/intro---12-2-14",
"http://thecolbertreport.cc.com/videos/hyqrm1/announcing-the-mr--colbert-goes-to-washington-special",
"http://thecolbertreport.cc.com/videos/ethq4d/the-word---crook-and-ladder",
"http://thecolbertreport.cc.com/videos/lje2l4/blitzkrieg-on-grinchitude---mistletoe-drones",
"http://thecolbertreport.cc.com/videos/z0hz76/tony-bennett-and-lady-gaga"
],
"guest": "Tony Bennett & Lady Gaga"
},
{
"date": "2014-12-03",
"videos": [
"http://thecolbertreport.cc.com/videos/c9s1cs/intro---12-3-14",
"http://thecolbertreport.cc.com/videos/nxwili/the-no-social-security-for-nazis-act",
"http://thecolbertreport.cc.com/videos/ziipwv/thought-for-food---fairlife-milk---pizza-hut-s-subconscious-menu",
"http://thecolbertreport.cc.com/videos/fpdlpw/surprise-visit-from-amy-sedaris",
"http://thecolbertreport.cc.com/videos/4r9o52/christopher-nolan",
"http://thecolbertreport.cc.com/videos/nwo3n2/sign-off---goodnight"
],
"guest": "Christopher Nolan"
},
{
"date": "2014-12-04",
"videos": [
"http://thecolbertreport.cc.com/videos/ik935r/president-barack-obama-to-appear-on-the-report",
"http://thecolbertreport.cc.com/videos/d5k5nz/outrage-over-eric-garner-decision",
"http://thecolbertreport.cc.com/videos/pxune6/obama-s-bold-and-beautiful-ambassador-pick",
"http://thecolbertreport.cc.com/videos/nucbbu/paul-farmer",
"http://thecolbertreport.cc.com/videos/82d47r/sign-off---grimmy"
],
"guest": "Dr. Paul Farmer"
},
{
"date": "2014-12-08",
"videos": [
"http://thecolbertreport.cc.com/videos/u8bqev/mr--colbert-goes-to-washington",
"http://thecolbertreport.cc.com/videos/cnlqbr/better-know-a-america---the-fightin--us",
"http://thecolbertreport.cc.com/videos/88p9oh/the-word---president-barack-obama---to-health-in-a-handbasket",
"http://thecolbertreport.cc.com/videos/i14vel/president-barack-obama-pt--1",
"http://thecolbertreport.cc.com/videos/mpmtan/president-barack-obama-pt--2",
"http://thecolbertreport.cc.com/videos/3mcn6y/sign-off---see-ya",
"http://thecolbertreport.cc.com/videos/4mkbqz/exclusive---president-barack-obama-extended-interview"
],
"guest": "President Barack Obama"
},
{
"date": "2014-12-09",
"videos": [
"http://thecolbertreport.cc.com/videos/tgnj0t/-eaten-alive--outrage",
"http://thecolbertreport.cc.com/videos/vd3icz/better-know-a-district---georgia-s-1st---reuniting-with-rep--jack-kingston",
"http://thecolbertreport.cc.com/videos/pz35hw/who-s-honoring-me-now----entertainment-weekly",
"http://thecolbertreport.cc.com/videos/2kz4pi/james-corden",
"http://thecolbertreport.cc.com/videos/0frj3t/sign-off---sting"
],
"guest": "James Corden"
},
{
"date": "2014-12-10",
"videos": [
"http://thecolbertreport.cc.com/videos/kquici/cia-torture-report",
"http://thecolbertreport.cc.com/videos/rlpjf5/cia-torture-report---pundits-defend-america",
"http://thecolbertreport.cc.com/videos/z4grj8/cia-torture-report---tom-blanton",
"http://thecolbertreport.cc.com/videos/8i6klx/sarah-koenig",
"http://thecolbertreport.cc.com/videos/im3k81/sign-off---headphones"
],
"guest": "Sarah Koenig"
},
{
"date": "2014-12-11",
"videos": [
"http://thecolbertreport.cc.com/videos/anckrc/scott-walker-s-hanukkah-gaffe",
"http://thecolbertreport.cc.com/videos/399enl/yahweh-or-no-way---epic-casting-controversy",
"http://thecolbertreport.cc.com/videos/p9nk9d/announcing-the-colbert-report-raffle",
"http://thecolbertreport.cc.com/videos/509747/smaug",
"http://thecolbertreport.cc.com/videos/mfxigz/sign-off---aftermath-of-smaug"
],
"guest": "\"The Hobbit: Battle of the Five Armies\" special"
},
{
"date": "2014-12-15",
"videos": [
"http://thecolbertreport.cc.com/videos/bt8vk8/intro---12-15-14",
"http://thecolbertreport.cc.com/videos/lwna3x/michele-bachmann-s-extreme-holiday-cheer",
"http://thecolbertreport.cc.com/videos/0frisd/formidable-opponent---torture-report",
"http://thecolbertreport.cc.com/videos/9xetgg/kim-jong-un-s-exclusive-name---sony-s-hack-attack",
"http://thecolbertreport.cc.com/videos/j9u5in/seth-rogen",
"http://thecolbertreport.cc.com/videos/bhrczk/sign-off---goodnight"
],
"guest": "Seth Rogen"
},
{
"date": "2014-12-16",
"videos": [
"http://thecolbertreport.cc.com/videos/arfo3o/jeb-bush-s-presidential-ambitions",
"http://thecolbertreport.cc.com/videos/tnwzte/oil-war---jason-bordoff",
"http://thecolbertreport.cc.com/videos/vd8ci4/colbert-platinum---holiday-gift-edition",
"http://thecolbertreport.cc.com/videos/w5h8eb/kendrick-lamar",
"http://thecolbertreport.cc.com/videos/pjrqsj/kendrick-lamar---debut-of-untitled-track"
],
"guest": "Kendrick Lamar"
}
]
}
working_folder = 'G:/Downloads'
for colbDate in testP['2014']:
if 1:
newfileResize = 'G:/downloads/The Colbert Report 2014/TheColbertReport '+colbDate['date']+'.mp4'
if not os.path.exists(newfileResize):
folderName = 'G:/downloads/The Colbert Report 2014/'+colbDate['date']
try:
os.mkdir(folderName)
except:
pass
pos = 0
for vid in colbDate['videos']:
pos+=1
done = False
while not done:
folderContents = os.listdir(folderName)
for folderContent in folderContents:
if folderContent.startswith(str(pos)+' ') and (not folderContent.endswith('.part')):
done = True
if not done:
cmd = os.path.join(working_folder,'youtube-dl.exe') + ' --no-continue -o "'+folderName+'/'+str(pos)+' %(title)s.%(ext)s" '+vid
subprocess.call(cmd,shell=True)
vids = []
for vid in os.listdir(folderName):
if vid.endswith('.mp4'):
vids.append(os.path.join(folderName,vid))
vids.sort()
newfile = 'G:/downloads/The Colbert Report 2014/TheColbertReport '+colbDate['date']+'temp.mp4'
if not os.path.exists(newfileResize):
cmd = r' -cat "' + r'" -cat "'.join(vids) + r'" -new "'+newfile+'"'
exc = "G:/Downloads/mp4box.exe -tmp G:/temp/ " + cmd
subprocess.call(exc,shell=True)
cmd = "G:/Downloads/ffmpeg/bin/ffmpeg.exe -i \"" + newfile + "\" -vf scale=1024:576 \""+newfileResize+"\""
subprocess.call(cmd,shell=True)
while os.path.exists(newfile):
try:
os.remove(newfile)
except:
pass
else:
print 'file found ' + newfile
| Java |
<?php
/**
* youtubegallery Joomla! 2.5 Native Component
* @version 3.5.3
* @author DesignCompass corp< <support@joomlaboat.com>
* @link http://www.joomlaboat.com
* @GNU General Public License
**/
defined('_JEXEC') or die('Restricted access');
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'render.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_youtubegallery'.DS.'includes'.DS.'misc.php');
$listid=(int)$params->get( 'listid' );
$themeid=(int)$params->get( 'themeid' );
$align='';
if($listid!=0 and $themeid!=0)
{
$misc=new YouTubeGalleryMisc;
if(!$misc->getVideoListTableRow($listid))
echo '<p>No video found</p>';
if(!$misc->getThemeTableRow($themeid))
echo '<p>No theme found</p>';
$firstvideo='';
$youtubegallerycode='';
$total_number_of_rows=0;
$misc->update_playlist();
//if($theme_row->openinnewwindow==4)
// $videoid=''; //Hot Video Switch
// else
$videoid=JRequest::getVar('videoid');
if($misc->theme_row->playvideo==1 and $videoid!='')
$misc->theme_row->autoplay=1;
$videoid_new=$videoid;
$videolist=$misc->getVideoList_FromCache_From_Table($videoid_new,$total_number_of_rows);
if($videoid=='')
{
if($misc->theme_row->playvideo==1 and $videoid_new!='')
$videoid=$videoid_new;
}
$renderer= new YouTubeGalleryRenderer;
$gallerymodule=$renderer->render(
$videolist,
$misc->videolist_row,
$misc->theme_row,
$total_number_of_rows,
$videoid
);
if($params->get( 'allowcontentplugins' ))
{
$o = new stdClass();
$o->text=$gallerymodule;
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content');
$r = $dispatcher->trigger('onContentPrepare', array ('com_content.article', &$o, &$params_, 0));
$gallerymodule=$o->text;
}
$align=$params->get( 'galleryalign' );
switch($align)
{
case 'left' :
$youtubegallerycode.= '<div style="float:left;position:relative;">'.$gallerymodule.'</div>';
break;
case 'center' :
$youtubegallerycode.= '<div style="width:'.$misc->theme_row->width.'px;margin-left:auto;margin-right:auto;position:relative;">'.$gallerymodule.'</div>';
break;
case 'right' :
$youtubegallerycode.= '<div style="float:right;position:relative;">'.$gallerymodule.'</div>';
break;
default :
$youtubegallerycode.= $gallerymodule;
break;
}//switch($align)
echo $youtubegallerycode;
}
else
echo '<p>Video list or Theme not selected</p>';
?>
| Java |
<?php
$absolute_path = __FILE__;
$path_to_file = explode( 'wp-content', $absolute_path );
$path_to_wp = $path_to_file[0];
require_once( $path_to_wp.'/wp-load.php' );
$to = isset($_POST['to'])?trim($_POST['to']):'';
$name = isset($_POST['name'])?trim($_POST['name']):'';
$email = isset($_POST['email'])?trim($_POST['email']):'';
$content = isset($_POST['content'])?trim($_POST['content']):'';
$error = true;
if($to == '' || $email == '' || $content == '' || $name == '') $error = false;
$sitename = get_bloginfo('name');
if($error){
$subject = 'A message from '.$name;
$headers = 'From: '.$email . "\r\n" . 'Reply-To: '.$email . "\r\n";
mail($to, $subject, $content, $headers);
} | Java |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.io.monitor;
import java.io.File;
import java.io.Serializable;
/**
* {@link FileEntry} represents the state of a file or directory, capturing
* the following {@link File} attributes at a point in time.
* <ul>
* <li>File Name (see {@link File#getName()})</li>
* <li>Exists - whether the file exists or not (see {@link File#exists()})</li>
* <li>Directory - whether the file is a directory or not (see {@link File#isDirectory()})</li>
* <li>Last Modified Date/Time (see {@link File#lastModified()})</li>
* <li>Length (see {@link File#length()}) - directories treated as zero</li>
* <li>Children - contents of a directory (see {@link File#listFiles(java.io.FileFilter)})</li>
* </ul>
* <p>
* <h3>Custom Implementations</h3>
* If the state of additional {@link File} attributes is required then create a custom
* {@link FileEntry} with properties for those attributes. Override the
* {@link #newChildInstance(File)} to return a new instance of the appropriate type.
* You may also want to override the {@link #refresh(File)} method.
* @see FileAlterationObserver
* @since 2.0
*/
public class FileEntry implements Serializable {
static final FileEntry[] EMPTY_ENTRIES = new FileEntry[0];
private final FileEntry parent;
private FileEntry[] children;
private final File file;
private String name;
private boolean exists;
private boolean directory;
private long lastModified;
private long length;
/**
* Construct a new monitor for a specified {@link File}.
*
* @param file The file being monitored
*/
public FileEntry(File file) {
this((FileEntry)null, file);
}
/**
* Construct a new monitor for a specified {@link File}.
*
* @param parent The parent
* @param file The file being monitored
*/
public FileEntry(FileEntry parent, File file) {
if (file == null) {
throw new IllegalArgumentException("File is missing");
}
this.file = file;
this.parent = parent;
this.name = file.getName();
}
/**
* Refresh the attributes from the {@link File}, indicating
* whether the file has changed.
* <p>
* This implementation refreshes the <code>name</code>, <code>exists</code>,
* <code>directory</code>, <code>lastModified</code> and <code>length</code>
* properties.
* <p>
* The <code>exists</code>, <code>directory</code>, <code>lastModified</code>
* and <code>length</code> properties are compared for changes
*
* @param file the file instance to compare to
* @return <code>true</code> if the file has changed, otherwise <code>false</code>
*/
public boolean refresh(File file) {
// cache original values
boolean origExists = exists;
long origLastModified = lastModified;
boolean origDirectory = directory;
long origLength = length;
// refresh the values
name = file.getName();
exists = file.exists();
directory = exists ? file.isDirectory() : false;
lastModified = exists ? file.lastModified() : 0;
length = exists && !directory ? file.length() : 0;
// Return if there are changes
return exists != origExists ||
lastModified != origLastModified ||
directory != origDirectory ||
length != origLength;
}
/**
* Create a new child instance.
* <p>
* Custom implementations should override this method to return
* a new instance of the appropriate type.
*
* @param file The child file
* @return a new child instance
*/
public FileEntry newChildInstance(File file) {
return new FileEntry(this, file);
}
/**
* Return the parent entry.
*
* @return the parent entry
*/
public FileEntry getParent() {
return parent;
}
/**
* Return the level
*
* @return the level
*/
public int getLevel() {
return parent == null ? 0 : parent.getLevel() + 1;
}
/**
* Return the directory's files.
*
* @return This directory's files or an empty
* array if the file is not a directory or the
* directory is empty
*/
public FileEntry[] getChildren() {
return children != null ? children : EMPTY_ENTRIES;
}
/**
* Set the directory's files.
*
* @param children This directory's files, may be null
*/
public void setChildren(FileEntry[] children) {
this.children = children;
}
/**
* Return the file being monitored.
*
* @return the file being monitored
*/
public File getFile() {
return file;
}
/**
* Return the file name.
*
* @return the file name
*/
public String getName() {
return name;
}
/**
* Set the file name.
*
* @param name the file name
*/
public void setName(String name) {
this.name = name;
}
/**
* Return the last modified time from the last time it
* was checked.
*
* @return the last modified time
*/
public long getLastModified() {
return lastModified;
}
/**
* Return the last modified time from the last time it
* was checked.
*
* @param lastModified The last modified time
*/
public void setLastModified(long lastModified) {
this.lastModified = lastModified;
}
/**
* Return the length.
*
* @return the length
*/
public long getLength() {
return length;
}
/**
* Set the length.
*
* @param length the length
*/
public void setLength(long length) {
this.length = length;
}
/**
* Indicate whether the file existed the last time it
* was checked.
*
* @return whether the file existed
*/
public boolean isExists() {
return exists;
}
/**
* Set whether the file existed the last time it
* was checked.
*
* @param exists whether the file exists or not
*/
public void setExists(boolean exists) {
this.exists = exists;
}
/**
* Indicate whether the file is a directory or not.
*
* @return whether the file is a directory or not
*/
public boolean isDirectory() {
return directory;
}
/**
* Set whether the file is a directory or not.
*
* @param directory whether the file is a directory or not
*/
public void setDirectory(boolean directory) {
this.directory = directory;
}
}
| Java |
<html lang="en">
<head>
<title>abbr - GNU Texinfo 4.8</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Texinfo 4.8">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Indicating.html#Indicating" title="Indicating">
<link rel="prev" href="cite.html#cite" title="cite">
<link rel="next" href="acronym.html#acronym" title="acronym">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This manual is for GNU Texinfo (version 4.8, 29 December 2004),
a documentation system that can produce both online information and a
printed manual from a single source.
Copyright (C) 1988, 1990, 1991, 1992, 1993, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.1 or any later version published by the Free Software
Foundation; with no Invariant Sections, with the Front-Cover texts
being ``A GNU Manual,'' and with the Back-Cover Texts as in (a)
below. A copy of the license is included in the section entitled
``GNU Free Documentation License.''
(a) The FSF's Back-Cover Text is: ``You have freedom to copy and
modify this GNU Manual, like GNU software. Copies published by
the Free Software Foundation raise funds for GNU development.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="abbr"></a>
Next: <a rel="next" accesskey="n" href="acronym.html#acronym">acronym</a>,
Previous: <a rel="previous" accesskey="p" href="cite.html#cite">cite</a>,
Up: <a rel="up" accesskey="u" href="Indicating.html#Indicating">Indicating</a>
<hr>
</div>
<h4 class="subsection">9.1.14 <code>@abbr</code>{<var>abbreviation</var>[, <var>meaning</var>]}</h4>
<p><a name="index-abbr-430"></a>
<a name="index-Abbreviations_002c-tagging-431"></a>You can use the <code>@abbr</code> command for general abbreviations. The
abbreviation is given as the single argument in braces, as in
`<samp><span class="samp">@abbr{Comput.}</span></samp>'. As a matter of style, or for particular
abbreviations, you may prefer to omit periods, as in
`<samp><span class="samp">@abbr{Mr} Stallman</span></samp>'.
<p><code>@abbr</code> accepts an optional second argument, intended to be used
for the meaning of the abbreviation.
<p>If the abbreviation ends with a lowercase letter and a period, and is
not at the end of a sentence, and has no second argument, remember to
use the <code>@.</code> command (see <a href="Not-Ending-a-Sentence.html#Not-Ending-a-Sentence">Not Ending a Sentence</a>) to get the correct spacing. However, you do not have to
use <code>@.</code> within the abbreviation itself; Texinfo automatically
assumes periods within the abbreivation do not end a sentence.
<p><a name="index-g_t_003cabbr_003e-tag-432"></a>In TeX and in the Info output, the first argument is printed as-is;
if the second argument is present, it is printed in parentheses after
the abbreviation. In HTML and XML, the <code><abbr></code> tag is
used; in Docbook, the <code><abbrev></code> tag is used. For instance:
<pre class="example"> @abbr{Comput. J., Computer Journal}
</pre>
<p class="noindent">produces:
<pre class="display"> <abbr title="Computer Journal">Comput. J.</abbr> (Computer Journal)
</pre>
<p>For abbreviations consisting of all capital letters, you may prefer to
use the <code>@acronym</code> command instead. See the next section for
more on the usage of these two commands.
</body></html>
| Java |
/* $Id: http_client.h 3227 2010-06-29 13:43:05Z ming $ */
/*
* Copyright (C) 2008-2010 Teluu Inc. (http://www.teluu.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJLIB_UTIL_HTTP_CLIENT_H__
#define __PJLIB_UTIL_HTTP_CLIENT_H__
/**
* @file http_client.h
* @brief Simple HTTP Client
*/
#include <pj/activesock.h>
#include <pjlib-util/types.h>
PJ_BEGIN_DECL
/**
* @defgroup PJ_HTTP_CLIENT Simple HTTP Client
* @ingroup PJ_PROTOCOLS
* @{
* This contains a simple HTTP client implementation.
* Some known limitations:
* - Does not support chunked Transfer-Encoding.
*/
/**
* This opaque structure describes the http request.
*/
typedef struct pj_http_req pj_http_req;
/**
* Defines the maximum number of elements in a pj_http_headers
* structure.
*/
#define PJ_HTTP_HEADER_SIZE 32
/**
* This structure describes http request/response headers.
* Application should call #pj_http_headers_add_elmt() to
* add a header field.
*/
typedef struct pj_http_headers
{
unsigned count; /**< Number of header fields */
struct pj_http_header_elmt
{
pj_str_t name;
pj_str_t value;
} header[PJ_HTTP_HEADER_SIZE]; /**< Header elements/fields */
} pj_http_headers;
/**
* Parameters that can be given during http request creation. Application
* must initialize this structure with #pj_http_req_param_default().
*/
typedef struct pj_http_req_param
{
/**
* The address family of the URL.
* Default is pj_AF_INET().
*/
int addr_family;
/**
* The HTTP request method.
* Default is GET.
*/
pj_str_t method;
/**
* The HTTP protocol version ("1.0" or "1.1").
* Default is "1.0".
*/
pj_str_t version;
/**
* HTTP request operation timeout.
* Default is PJ_HTTP_DEFAULT_TIMEOUT.
*/
pj_time_val timeout;
/**
* User-defined data.
* Default is NULL.
*/
void *user_data;
/**
* HTTP request headers.
* Default is empty.
*/
pj_http_headers headers;
/**
* This structure describes the http request body. If application
* specifies the data to send, the data must remain valid until
* the HTTP request is sent. Alternatively, application can choose
* to specify total_size as the total data size to send instead
* while leaving the data NULL (and its size 0). In this case,
* HTTP request will then call on_send_data() callback once it is
* ready to send the request body. This will be useful if
* application does not wish to load the data into the buffer at
* once.
*
* Default is empty.
*/
struct pj_http_reqdata
{
void *data; /**< Request body data */
pj_size_t size; /**< Request body size */
pj_size_t total_size; /**< If total_size > 0, data */
/**< will be provided later */
} reqdata;
} pj_http_req_param;
/**
* This structure describes HTTP response.
*/
typedef struct pj_http_resp
{
pj_str_t version; /**< HTTP version of the server */
pj_uint16_t status_code; /**< Status code of the request */
pj_str_t reason; /**< Reason phrase */
pj_http_headers headers; /**< Response headers */
/**
* The value of content-length header field. -1 if not
* specified.
*/
pj_int32_t content_length;
void *data; /**< Data received */
pj_size_t size; /**< Data size */
} pj_http_resp;
/**
* This structure describes HTTP URL.
*/
typedef struct pj_http_url
{
pj_str_t protocol; /**< Protocol used */
pj_str_t host; /**< Host name */
pj_uint16_t port; /**< Port number */
pj_str_t path; /**< Path */
} pj_http_url;
/**
* This structure describes the callbacks to be called by the HTTP request.
*/
typedef struct pj_http_req_callback
{
/**
* This callback is called when a complete HTTP response header
* is received.
*
* @param http_req The http request.
* @param resp The response of the request.
*/
void (*on_response)(pj_http_req *http_req, const pj_http_resp *resp);
/**
* This callback is called when the HTTP request is ready to send
* its request body. Application may wish to use this callback if
* it wishes to load the data at a later time or if it does not
* wish to load the whole data into memory. In order for this
* callback to be called, application MUST set http_req_param.total_size
* to a value greater than 0.
*
* @param http_req The http request.
* @param data Pointer to the data that will be sent. Application
* must set the pointer to the current data chunk/segment
* to be sent. Data must remain valid until the next
* on_send_data() callback or for the last segment,
* until it is sent.
* @param size Pointer to the data size that will be sent.
*/
void (*on_send_data)(pj_http_req *http_req,
void **data, pj_size_t *size);
/**
* This callback is called when a segment of response body data
* arrives. If this callback is specified (i.e. not NULL), the
* on_complete() callback will be called with zero-length data
* (within the response parameter), hence the application must
* store and manage its own data buffer, otherwise the
* on_complete() callback will be called with the response
* parameter containing the complete data.
*
* @param http_req The http request.
* @param data The buffer containing the data.
* @param size The length of data in the buffer.
*/
void (*on_data_read)(pj_http_req *http_req,
void *data, pj_size_t size);
/**
* This callback is called when the HTTP request is completed.
* If the callback on_data_read() is specified, the variable
* response->data will be set to NULL, otherwise it will
* contain the complete data. Response data is allocated from
* pj_http_req's internal memory pool so the data remain valid
* as long as pj_http_req is not destroyed and application does
* not start a new request.
*
* If no longer required, application may choose to destroy
* pj_http_req immediately by calling #pj_http_req_destroy() inside
* the callback.
*
* @param http_req The http request.
* @param status The status of the request operation. PJ_SUCCESS
* if the operation completed successfully
* (connection-wise). To check the server's
* status-code response to the HTTP request,
* application should check resp->status_code instead.
* @param resp The response of the corresponding request. If
* the status argument is non-PJ_SUCCESS, this
* argument will be set to NULL.
*/
void (*on_complete)(pj_http_req *http_req,
pj_status_t status,
const pj_http_resp *resp);
} pj_http_req_callback;
/**
* Initialize the http request parameters with the default values.
*
* @param param The parameter to be initialized.
*/
PJ_DECL(void) pj_http_req_param_default(pj_http_req_param *param);
/**
* Add a header element/field. Application MUST make sure that
* name and val pointer remains valid until the HTTP request is sent.
*
* @param headers The headers.
* @param name The header field name.
* @param value The header field value.
*
* @return PJ_SUCCESS if the operation has been successful,
* or the appropriate error code on failure.
*/
PJ_DECL(pj_status_t) pj_http_headers_add_elmt(pj_http_headers *headers,
pj_str_t *name,
pj_str_t *val);
/**
* The same as #pj_http_headers_add_elmt() with char * as
* its parameters. Application MUST make sure that name and val pointer
* remains valid until the HTTP request is sent.
*
* @param headers The headers.
* @param name The header field name.
* @param value The header field value.
*
* @return PJ_SUCCESS if the operation has been successful,
* or the appropriate error code on failure.
*/
PJ_DECL(pj_status_t) pj_http_headers_add_elmt2(pj_http_headers *headers,
char *name, char *val);
/**
* Parse a http URL into its components.
*
* @param url The URL to be parsed.
* @param hurl Pointer to receive the parsed result.
*
* @return PJ_SUCCESS if the operation has been successful,
* or the appropriate error code on failure.
*/
PJ_DECL(pj_status_t) pj_http_req_parse_url(const pj_str_t *url,
pj_http_url *hurl);
/**
* Create the HTTP request.
*
* @param pool Pool to use. HTTP request will use the pool's factory
* to allocate its own memory pool.
* @param url HTTP URL request.
* @param timer The timer to use.
* @param ioqueue The ioqueue to use.
* @param param Optional parameters. When this parameter is not
* specifed (NULL), the default values will be used.
* @param hcb Pointer to structure containing application
* callbacks.
* @param http_req Pointer to receive the http request instance.
*
* @return PJ_SUCCESS if the operation has been successful,
* or the appropriate error code on failure.
*/
PJ_DECL(pj_status_t) pj_http_req_create(pj_pool_t *pool,
const pj_str_t *url,
pj_timer_heap_t *timer,
pj_ioqueue_t *ioqueue,
const pj_http_req_param *param,
const pj_http_req_callback *hcb,
pj_http_req **http_req);
/**
* Set the timeout of the HTTP request operation. Note that if the
* HTTP request is currently running, the timeout will only affect
* subsequent request operations.
*
* @param http_req The http request.
* @param timeout Timeout value for HTTP request operation.
*/
PJ_DECL(void) pj_http_req_set_timeout(pj_http_req *http_req,
const pj_time_val* timeout);
/**
* Starts an asynchronous HTTP request to the URL specified.
*
* @param http_req The http request.
*
* @return
* - PJ_SUCCESS if success
* - non-zero which indicates the appropriate error code.
*/
PJ_DECL(pj_status_t) pj_http_req_start(pj_http_req *http_req);
/**
* Cancel the asynchronous HTTP request.
*
* @param http_req The http request.
* @param notify If non-zero, the on_complete() callback will be
* called with status PJ_ECANCELLED to notify that
* the query has been cancelled.
*
* @return
* - PJ_SUCCESS if success
* - non-zero which indicates the appropriate error code.
*/
PJ_DECL(pj_status_t) pj_http_req_cancel(pj_http_req *http_req,
pj_bool_t notify);
/**
* Destroy the http request.
*
* @param http_req The http request to be destroyed.
*
* @return PJ_SUCCESS if success.
*/
PJ_DECL(pj_status_t) pj_http_req_destroy(pj_http_req *http_req);
/**
* Find out whether the http request is running.
*
* @param http_req The http request.
*
* @return PJ_TRUE if a request is pending, or
* PJ_FALSE if idle
*/
PJ_DECL(pj_bool_t) pj_http_req_is_running(const pj_http_req *http_req);
/**
* Retrieve the user data previously associated with this http
* request.
*
* @param http_req The http request.
*
* @return The user data.
*/
PJ_DECL(void *) pj_http_req_get_user_data(pj_http_req *http_req);
/**
* @}
*/
PJ_END_DECL
#endif /* __PJLIB_UTIL_HTTP_CLIENT_H__ */
| Java |
using System;
namespace Server.Items
{
public class StatuetteDyeTub : DyeTub, Engines.VeteranRewards.IRewardItem
{
public override bool AllowDyables{ get{ return false; } }
public override bool AllowStatuettes{ get{ return true; } }
public override int TargetMessage{ get{ return 1049777; } } // Target the statuette to dye
public override int FailMessage{ get{ return 1049778; } } // You can only dye veteran reward statuettes with this tub.
public override int LabelNumber{ get{ return 1049741; } } // Reward Statuette Dye Tub
public override CustomHuePicker CustomHuePicker{ get{ return CustomHuePicker.LeatherDyeTub; } }
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get{ return m_IsRewardItem; }
set{ m_IsRewardItem = value; }
}
[Constructable]
public StatuetteDyeTub()
{
LootType = LootType.Blessed;
}
public override void OnDoubleClick( Mobile from )
{
if ( m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy( from, this, null ) )
return;
base.OnDoubleClick( from );
}
public StatuetteDyeTub( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 1 ); // version
writer.Write( (bool) m_IsRewardItem );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
break;
}
}
}
}
}
| Java |
/*
* ISDB subtitle decoding
* Copyright (c) 2013 0p1pp1
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <iconv.h>
#include <string.h>
#include "ass_mp.h"
#include "mp_global.h"
#include "mp_msg.h"
#include "libmpdemux/stheader.h"
#include "sub/isdbsubdec.h"
#include "libavutil/avstring.h"
#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#undef AV_NOPTS_VALUE
#define AV_NOPTS_VALUE ((signed)INT64_C(0x8000000000000000))
#define ISDBSUB_DATA_ID 0x80
#define ISDBSUB_DU_TYPE_TXT 0x20
#define ISDBSUB_UNIT_SEP 0x1F
#define ISDBSUB_MGMNT_TIMEOUT (180 * 1000)
#define ISDBSUB_NO_DGID -1
#define ISDBSUB_MAX_LANG 2 /* ARIB TR-B14/B15 */
#define IS_HORIZONTAL_LAYOUT(format) \
((format) == ISDBSUB_FMT_960H || (format) == ISDBSUB_FMT_720H)
#define LAYOUT_GET_WIDTH(format) \
(((format) == ISDBSUB_FMT_960H || (format) == ISDBSUB_FMT_960V) ? 960 : 720)
#define LAYOUT_GET_HEIGHT(format) \
(((format) == ISDBSUB_FMT_960H || (format) == ISDBSUB_FMT_960V) ? 540 : 480)
#define MPEGTS_MAX_PTS (((2LL<<33) + 45)/90)
#define RGBA(r,g,b,a) (((unsigned)(255 - (a)) << 24) | ((b) << 16) | ((g) << 8) | (r))
static const AVCRC *Crc_table;
typedef uint32_t rgba;
static rgba Default_clut[128] =
{
//0-7
RGBA(0,0,0,255), RGBA(255,0,0,255), RGBA(0,255,0,255), RGBA(255,255,0,255),
RGBA(0,0,255,255), RGBA(255,0,255,255), RGBA(0,255,255,255), RGBA(255,255,255,255),
//8-15
RGBA(0,0,0,0), RGBA(170,0,0,255), RGBA(0,170,0,255), RGBA(170,170,0,255),
RGBA(0,0,170,255), RGBA(170,0,170,255), RGBA(0,170,170,255), RGBA(170,170,170,255),
//16-23
RGBA(0,0,85,255), RGBA(0,85,0,255), RGBA(0,85,85,255), RGBA(0,85,170,255),
RGBA(0,85,255,255), RGBA(0,170,85,255), RGBA(0,170,255,255), RGBA(0,255,85,255),
//24-31
RGBA(0,255,170,255), RGBA(85,0,0,255), RGBA(85,0,85,255), RGBA(85,0,170,255),
RGBA(85,0,255,255), RGBA(85,85,0,255), RGBA(85,85,85,255), RGBA(85,85,170,255),
//32-39
RGBA(85,85,255,255), RGBA(85,170,0,255), RGBA(85,170,85,255), RGBA(85,170,170,255),
RGBA(85,170,255,255), RGBA(85,255,0,255), RGBA(85,255,85,255), RGBA(85,255,170,255),
//40-47
RGBA(85,255,255,255), RGBA(170,0,85,255), RGBA(170,0,255,255), RGBA(170,85,0,255),
RGBA(170,85,85,255), RGBA(170,85,170,255), RGBA(170,85,255,255), RGBA(170,170,85,255),
//48-55
RGBA(170,170,255,255), RGBA(170,255,0,255), RGBA(170,255,85,255), RGBA(170,255,170,255),
RGBA(170,255,255,255), RGBA(255,0,85,255), RGBA(255,0,170,255), RGBA(255,85,0,255),
//56-63
RGBA(255,85,85,255), RGBA(255,85,170,255), RGBA(255,85,255,255), RGBA(255,170,0,255),
RGBA(255,170,85,255), RGBA(255,170,170,255), RGBA(255,170,255,255), RGBA(255,255,85,255),
//64
RGBA(255,255,170,255),
// 65-127 are caliculated later.
};
static const uint8_t * const Default_macro[16] =
{
"\x1B\x24\x42\x1B\x29\x4A\x1B\x2A\x30\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x24\x42\x1B\x29\x31\x1B\x2A\x30\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x24\x42\x1B\x29\x20\x41\x1B\x2A\x30\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x32\x1B\x29\x34\x1B\x2A\x35\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x32\x1B\x29\x33\x1B\x2A\x35\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x32\x1B\x29\x20\x41\x1B\x2A\x35\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x20\x41\x1B\x29\x20\x42\x1B\x2A\x20\x43\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x20\x44\x1B\x29\x20\x45\x1B\x2A\x20\x46\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x20\x47\x1B\x29\x20\x48\x1B\x2A\x20\x49\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x20\x4A\x1B\x29\x20\x4B\x1B\x2A\x20\x4C\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x20\x4D\x1B\x29\x20\x4E\x1B\x2A\x20\x4F\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x24\x42\x1B\x29\x20\x42\x1B\x2A\x30\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x24\x42\x1B\x29\x20\x43\x1B\x2A\x30\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x24\x42\x1B\x29\x20\x44\x1B\x2A\x30\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x31\x1B\x29\x30\x1B\x2A\x4A\x1B\x2B\x20\x70\x0F\x1B\x7D",
"\x1B\x28\x4A\x1B\x29\x32\x1B\x2A\x20\x41\x1B\x2B\x20\x70\x0F\x1B\x7D"
};
struct b24str_state
{
int gl; /* index of the group invoked to GL */
int gr; /* index of the group invoked to GR */
int ss; /* flag if in SS2 or SS3. 2:SS2, 3:SS3 */
struct group
{
unsigned char mb; /* how many bytes one character consists of. */
// code for character sets
#define CODE_ASCII ('\x40')
#define CODE_ASCII2 ('\x4A')
#define CODE_JISX0208 ('\x42')
#define CODE_JISX0213_1 ('\x51')
#define CODE_JISX0213_2 ('\x50')
#define CODE_JISX0201_KATA ('\x49')
#define CODE_MOSAIC_C ('\x34')
#define CODE_MOSAIC_D ('\x35')
#define CODE_EXT ('\x3B')
#define CODE_X_HIRA ('\x30')
#define CODE_X_HIRA_P ('\x37')
#define CODE_X_KATA ('\x31')
#define CODE_X_KATA_P ('\x38')
#define CODE_X_DRCS_MB ('\x40')
#define CODE_X_DRCS_MIN ('\x41')
#define CODE_X_DRCS_MAX ('\x4F')
#define CODE_X_MACRO ('\x70')
unsigned char code; /* character set that this group designates */
} g[4];
};
struct isdbsub_layout
{
enum isdbsub_format {
ISDBSUB_FMT_960H = 0x08,
ISDBSUB_FMT_960V,
ISDBSUB_FMT_720H,
ISDBSUB_FMT_720V,
} format;
int is_profile_c; // profile C: "1seg". see ARIB TR-B14 3-4
// clipping area.
struct disp_area {
int x, y;
int w, h;
} display_area;
// for tracking pen position
int font_size; // valid values: {16, 20, 24, 30, 36} (TR-B14/B15)
struct fscale { // in [percent]
int fscx, fscy;
} font_scale; // 1/2x1/2, 1/2*1, 1*1, 1*2, 2*1, 2*2
struct spacing {
int col, row;
} cell_spacing;
// internal use for tracking pen position/line break.
// Although texts are laid out by libass,
// we need to track pen position by ourselves
// in order to calculate line breaking positions and charcter/line spacing.
int prev_char_sep;
int prev_line_desc;
int prev_line_bottom; // offset from display_area.y, not from top-margin.
int line_desc;
int linesep_upper;
int line_height;
int line_width; // pen position x
int prev_break_idx; // ctx->text.buf[prev_break_idx] holds the previous "\N"
int shift_baseline; // special case where baseline should be shifted down ?
int block_offset_h; // text[0].hspacing / 2
int block_offset_v; // line[0].lspacing_upper
int repeat_count; // -1: none, 0: until EOL, 1...i: repeat the next char i times
int in_combining; // bool
struct scroll_param {
enum {SCROLL_DIR_NONE, SCROLL_DIR_COLUMN, SCROLL_DIR_ROW} direction;
int rollout; // bool
int speed; // in pixel/sec
} scroll;
};
typedef struct isdbsub_state {
int auto_display; // bool. forced to be displayed w/o user interaction
int rollup_mode; // bool
uint8_t need_init; // bool
uint8_t clut_high_idx; // color = default_clut[high_idx << 8 | low_idx]
uint32_t fg_color;
uint32_t bg_color;
uint32_t mat_color;
struct isdbsub_layout layout_state;
struct b24str_state text_state;
} ISDBSubState;
typedef struct ISDBSubContext {
int last_mngmnt_id; // "data group id" of the last subtitle management data
int64_t last_mngmnt_pts; // time when the last mgmnt data was received
int64_t pts;
int64_t duration;
enum {
ISDBSUB_TMD_FREE,
ISDBSUB_TMD_REALTIME,
ISDBSUB_TMD_OFFSET
} timing_mode;
struct timecode {
int hour, min, sec, ms;
} offset, start; // currently unused.
ISDBSubState default_states[ISDBSUB_MAX_LANG];
int lang_tag; // language tag of the currently decoding subtitle text data
ISDBSubState current_state; //modified default_state[lang_tag]
iconv_t iconv;
struct my_str {
char *buf;
size_t len;
size_t used;
size_t txt_tail; // tail of the text, excluding trailing control sequences.
} text;
// for output
int is_style_inited;
char *script_info;
char *events;
} ISDBSubContext;
struct margins {
int l, r, v;
};
static void memdump(int level, const char *buf, int buf_size)
{
int i;
for (i=0; i < buf_size; i++) {
mp_msg(MSGT_DECSUB, level, "%02hhx ", buf[i]);
if (i % 16 == 15)
mp_msg(MSGT_DECSUB, level, "\n");
}
if (i % 16)
mp_msg(MSGT_DECSUB, level, "\n");
}
static char *my_astrconcat(char *a, char *b)
{
char *ret;
if (a == NULL)
return b ? strdup(b) : NULL;
if (b == NULL)
return a;
ret = av_asprintf("%s%s", a, b);
free(a);
return ret;
}
static char *pts_to_str(int64_t t, char *buf)
{
int ms10, sec, min, hour;
if (t == AV_NOPTS_VALUE)
return "NOPTS";
ms10 = (t % 1000) / 10;
t /= 1000;
sec = t % 60;
t /= 60;
min = t % 60;
t /= 60;
hour = t;
snprintf(buf, 13, "%02d:%02d:%02d.%02d", hour, min, sec, ms10);
return buf;
}
// NOTE: state->layout_state.format must be set before calling this func.
static void init_layout(struct isdbsub_layout *l)
{
l->font_size = 36;
l->display_area.x = 0;
l->display_area.y = 0;
switch (l->format) {
case ISDBSUB_FMT_960H:
l->display_area.w = 960;
l->display_area.h = 540;
l->cell_spacing.col = 4;
l->cell_spacing.row = 24;
break;
case ISDBSUB_FMT_960V:
l->display_area.w = 960;
l->display_area.h = 540;
l->cell_spacing.col = 12;
l->cell_spacing.row = 24;
break;
case ISDBSUB_FMT_720H:
l->display_area.w = 720;
l->display_area.h = 480;
l->cell_spacing.col = 4;
l->cell_spacing.row = 16;
break;
case ISDBSUB_FMT_720V:
l->display_area.w = 720;
l->display_area.h = 480;
l->cell_spacing.col = 8;
l->cell_spacing.row = 24;
break;
}
// profile C uses a fixed format,
// which does not define specific position or size and
// just requires to display texts in either 16x3 or 12x4 characters.
// we use ISDBSUB_FMT_960H for the base format.
if (l->is_profile_c) {
l->display_area.x = 160;
l->display_area.y = 360;
l->display_area.w = 640;
l->display_area.h = 180;
}
}
static void reset_state(ISDBSubState *state)
{
struct isdbsub_layout *l = &state->layout_state;
struct b24str_state *s = &state->text_state;
state->need_init = 1;
state->clut_high_idx = 0;
state->fg_color = Default_clut[7]; // white
state->bg_color = Default_clut[8]; // translucent
state->mat_color = Default_clut[8]; // FIXME: should be set in init_layout()?
l->block_offset_h = l->cell_spacing.col / 2;
l->block_offset_v = l->cell_spacing.row / 2;
l->font_scale.fscx = 100;
l->font_scale.fscy = 100;
l->prev_char_sep = 0;
l->prev_line_desc = 0;
l->prev_line_bottom = 0; // 0 means blcok_offset & pen_pos. are not defined yet.
l->line_height = 0;
l->line_width = 0;
l->line_desc = 0;
l->linesep_upper = 0;
l->prev_break_idx = 0;
l->shift_baseline = 0;
l->repeat_count = -1;
l->in_combining = 0;
l->scroll.direction = SCROLL_DIR_NONE;
s->gl = 0; // G0
s->gr = 2; // G2
s->ss = 0; // not in SS{2,3}
s->g[0].mb = 2;
s->g[0].code = CODE_JISX0208;
s->g[1].mb = 1;
s->g[1].code = CODE_ASCII;
s->g[2].mb = 1;
s->g[2].code = CODE_X_HIRA;
s->g[3].mb = 1;
s->g[3].code = CODE_X_MACRO;
// profile C uses different default.
if (l->is_profile_c) {
s->g[3].mb = 1;
s->g[3].code = CODE_X_DRCS_MIN;
s->gl = 3;
s->gr = 0;
}
}
static void get_margins(ISDBSubContext *ctx, struct margins *m)
{
struct isdbsub_layout *lstate = &ctx->current_state.layout_state;
if (IS_HORIZONTAL_LAYOUT(lstate->format)) {
m->l = lstate->display_area.x + lstate->block_offset_h;
m->r = LAYOUT_GET_WIDTH(lstate->format)
- (lstate->display_area.x + lstate->display_area.w);
m->v = lstate->display_area.y + lstate->block_offset_v;
if (lstate->is_profile_c)
m->v = 0;
} else {
m->l = lstate->display_area.y + lstate->block_offset_v;
m->r = LAYOUT_GET_HEIGHT(lstate->format)
- (lstate->display_area.y + lstate->display_area.h);
m->v = LAYOUT_GET_WIDTH(lstate->format)
- (lstate->display_area.x + lstate->display_area.w)
+ lstate->block_offset_h;
}
}
static void clear_text(ISDBSubContext *ctx)
{
ctx->text.used = 0;
ctx->text.txt_tail = 0;
}
static void fixup_linesep(ISDBSubContext *ctx);
static void append_event(ISDBSubContext *ctx)
{
ISDBSubState *state = &ctx->current_state;
struct isdbsub_layout *l = &state->layout_state;
char start[16], end[16];
struct margins m;
char effect[36], clipping[64];
char *dialog;
char c0 = 0;
if (ctx->pts == AV_NOPTS_VALUE || ctx->text.buf == NULL || !ctx->text.used)
return;
fixup_linesep(ctx);
mp_msg(MSGT_DECSUB, MSGL_DBG2, "append_event: %lu\n", ctx->text.used);
#if 0
if (state->rollup_mode)
ctx->duration = l->line_count * 5 * 1000; // FIXME
else if (l->scroll.direction != SCROLL_DIR_NONE && l->scroll.speed > 0)
ctx->duration = (display_area.w + (rollout ? text_box.w : 0)) * 1000 / scroll.speed
* (rollout ? 0 : 5000);
#endif
if (ctx->duration <= 0)
ctx->duration = 5000;
else if (ctx->duration < 100)
ctx->duration = 100;
pts_to_str(ctx->pts, start);
pts_to_str(ctx->pts + ctx->duration, end);
effect[0] = '\0';
get_margins(ctx, &m);
if (state->rollup_mode) {
if (IS_HORIZONTAL_LAYOUT(ctx->current_state.layout_state.format))
av_strlcatf(effect, sizeof(effect), "Scroll up;;;");
else
av_strlcatf(effect, sizeof(effect), "Banner;;;;"); // LtoR
} else if ((IS_HORIZONTAL_LAYOUT(l->format) &&
l->scroll.direction == SCROLL_DIR_COLUMN) ||
(!IS_HORIZONTAL_LAYOUT(l->format) &&
l->scroll.direction == SCROLL_DIR_ROW))
av_strlcatf(effect, sizeof(effect), "Banner;%d;%d;0;%d",
1000 / l->scroll.speed,
(l->scroll.direction == SCROLL_DIR_ROW),
!l->scroll.rollout);
else if (l->scroll.direction != SCROLL_DIR_NONE)
av_strlcatf(effect, sizeof(effect), "Scroll up;%d;%d;%d;%d",
IS_HORIZONTAL_LAYOUT(l->format) ? m.v : m.l,
l->display_area.y + l->display_area.h,
1000 / l->scroll.speed,
!l->scroll.rollout);
clipping[0] = '\0';
av_strlcatf(clipping, sizeof(clipping), "{\\clip(%d,%d,%d,%d)}",
l->display_area.x, l->display_area.y,
l->display_area.x + l->display_area.w,
l->display_area.y + l->display_area.h);
// control sequences for the next event may be appended.
if (ctx->text.txt_tail != ctx->text.used) {
c0 = ctx->text.buf[ctx->text.txt_tail];
ctx->text.buf[ctx->text.txt_tail] = '\0';
}
dialog = av_asprintf("Dialogue: %s,%s,%s,%d,%d,%d,%s,%s%s\n",
l->is_profile_c ? "prof_c" :
(IS_HORIZONTAL_LAYOUT(l->format) ? "hstyle" : "vstyle"),
pts_to_str(ctx->pts, start), pts_to_str(ctx->pts + ctx->duration, end),
m.l, m.r, m.v, effect, clipping, ctx->text.buf);
if (ctx->events) {
ctx->events = my_astrconcat(ctx->events, dialog);
free(dialog);
} else
ctx->events = dialog;
ctx->pts += ctx->duration;
ctx->duration = 0;
state->need_init = 1;
if (ctx->text.txt_tail != ctx->text.used) {
ctx->text.buf[ctx->text.txt_tail] = c0;
memmove(ctx->text.buf, ctx->text.buf + ctx->text.txt_tail,
ctx->text.used - ctx->text.txt_tail);
ctx->text.used -= ctx->text.txt_tail;
ctx->text.txt_tail = 0;
}
}
static void reserve_buf(ISDBSubContext *ctx, size_t len)
{
size_t blen;
if (ctx->text.len >= ctx->text.used + len)
return;
blen = ((ctx->text.used + len + 127) >> 7) << 7;
ctx->text.buf = av_realloc(ctx->text.buf, blen);
if (!ctx->text.buf) {
mp_msg(MSGT_DECSUB, MSGL_WARN, "out of memory for ctx->text.\n");
return;
}
ctx->text.len = blen;
mp_msg(MSGT_DECSUB, MSGL_V, "expanded ctx->text(%lu)\n", blen);
}
static int append_str(ISDBSubContext *ctx, const char *str)
{
size_t tlen = strlen(str);
reserve_buf(ctx, tlen + 1); // +1 for terminating '\0'
memcpy(ctx->text.buf + ctx->text.used, str, tlen);
ctx->text.used += tlen;
ctx->text.buf[ctx->text.used] = '\0';
return 0;
}
static int prepend_str(ISDBSubContext *ctx, const char *str)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
size_t tlen = strlen(str);
reserve_buf(ctx, tlen + 1); // +1 for terminating '\0'
memmove(ctx->text.buf + tlen, ctx->text.buf, ctx->text.used);
memcpy(ctx->text.buf, str, tlen);
if (ls->prev_break_idx)
ls->prev_break_idx += tlen;
ctx->text.used += tlen;
ctx->text.buf[ctx->text.used] = '\0';
return 0;
}
static void do_output(ISDBSubContext *ctx, uint8_t **outbufp, int *osize)
{
int header = 0;
if (!ctx->script_info && !ctx->events)
return;
mp_msg(MSGT_DECSUB, MSGL_DBG2, "making output.\n");
if (ctx->script_info) {
*outbufp = my_astrconcat(*outbufp, ctx->script_info);
free(ctx->script_info);
ctx->script_info = NULL;
header = 1;
}
if (!ctx->is_style_inited) { // once
#define STYLE_PARAMS_FONT \
":lang=ja:charset=3000:spacing=dual"
#define STYLE_PARAMS_COMMON \
"&H00FFFFFF, &HFF000000, &HFF000000, &HFF000000, 1, 0, 0, 1\n"
*outbufp = my_astrconcat(*outbufp, "[V4+ Styles]\n"
"Format: Name, Fontname, Fontsize, Alignment, "
"PrimaryColour, OutlineColour, BackColour, ClippingColour, "
"BorderStyle, Outline, Shadow, treat_fontname_as_pattern\n"
"Style: vstyle, @" STYLE_PARAMS_FONT ", 36, 9, " STYLE_PARAMS_COMMON
"Style: hstyle, " STYLE_PARAMS_FONT ", 36, 7, " STYLE_PARAMS_COMMON
"Style: prof_c, " STYLE_PARAMS_FONT ", 36, 2, " STYLE_PARAMS_COMMON);
#undef STYLE_PARAMS_FONT
#undef STYLE_PARAMS_COMMON
ctx->is_style_inited = 1;
header = 1;
}
if (ctx->events || header) {
if (header)
*outbufp = my_astrconcat(*outbufp, "\n[Events]\n"
"Format: Style, Start, End, MarginL, MarginR, MarginV, "
"Effect, Text\n");
*outbufp = my_astrconcat(*outbufp, ctx->events);
free(ctx->events);
ctx->events = NULL;
}
*osize = strlen(*outbufp);
mp_msg(MSGT_DECSUB, MSGL_V, "ass output:\n%s\n", *outbufp);
}
static void set_format(ISDBSubContext *ctx)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
clear_text(ctx);
reset_state(&ctx->current_state);
free(ctx->script_info);
ctx->script_info = av_asprintf("[Script Info]\nScript Type: v4.00+\n"
"PlayDepth: 24\nPlayResX: %d\nPlayResY: %d\nLanguage: ja\n"
"WrapStyle: 2\nStreamingMode: 1\n\n",
LAYOUT_GET_WIDTH(ls->format), LAYOUT_GET_HEIGHT(ls->format));
}
static void set_color(ISDBSubContext *ctx, int whatcolor, uint32_t color)
{
char fmt[32];
if (whatcolor < 1 || whatcolor > 5)
return;
fmt[0] = '\0';
av_strlcatf(fmt, sizeof(fmt), "{\\%dc&H%06X&\\%da&H%02X&}",
whatcolor, color & 0xffffff, whatcolor, color >> 24);
append_str(ctx, fmt);
mp_msg(MSGT_DECSUB, MSGL_DBG2, "(%d)-th color set to 0x%08X.\n",
whatcolor, color);
}
static void set_font_scale(ISDBSubContext *ctx)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
char fmt[24];
fmt[0] = '\0';
av_strlcatf(fmt, sizeof(fmt), "{\\fscx%d\\fscy%d}",
ls->font_scale.fscx, ls->font_scale.fscy);
append_str(ctx, fmt);
mp_msg(MSGT_DECSUB, MSGL_DBG2, "font scale: (%d, %d)\n",
ls->font_scale.fscx, ls->font_scale.fscy);
}
static const uint8_t *get_csi_params(const uint8_t *q,
unsigned int *p1, unsigned int *p2)
{
if (!p1)
return NULL;
*p1 = 0;
for (; *q >= 0x30 && *q <= 0x39; q++) {
*p1 *= 10;
*p1 += *q - 0x30;
}
if (!p2)
return q;
*p2 = 0;
if (*q != 0x20 && *q != 0x3B)
return NULL;
for (q++; *q >= 0x30 && *q <= 0x39; q++) {
*p2 *= 10;
*p2 += *q - 0x30;
}
return q;
}
// called at the start of sub-text or after each SWF/SDP/SDF occurrences.
// Define some style overrides at the start of Dialog line outputs,
// which are not defined in [style] nor ASS default.
// Note that SDP/SDF don't reset the other style parameters.
// Note2: multiple calls of this func safely overwrite the previous defs.
static void setup_line_head(ISDBSubContext *ctx)
{
ISDBSubState *state = &ctx->current_state;
struct isdbsub_layout *ls = &state->layout_state;
char item[256];
int cscale;
if (IS_HORIZONTAL_LAYOUT(ls->format))
cscale = ls->font_scale.fscx;
else
cscale = ls->font_scale.fscy;
item[0] = '\0';
// lsp will be corrected later.
// Note: ASS scales \fsp by font scale of the preceeding char.
av_strlcatf(item, sizeof(item), "{\\lsp0\\fsp%d}", ls->cell_spacing.col);
ls->prev_char_sep = ls->cell_spacing.col * cscale / 100;
av_strlcatf(item, sizeof(item), "{\\fs%d}", ls->font_size);
if (ls->font_scale.fscx != 100)
av_strlcatf(item, sizeof(item), "{\\fscx%d}", ls->font_scale.fscx);
if (ls->font_scale.fscy != 100)
av_strlcatf(item, sizeof(item), "{\\fscy%d}", ls->font_scale.fscy);
if (state->fg_color != 0x00FFFFFF) {
if ((state->fg_color & 0xFFFFFF) != 0xFFFFFF)
av_strlcatf(item, sizeof(item), "{\\1c&H%06X&}",
state->fg_color & 0xFFFFFF);
if ((state->fg_color >> 24) != 0x00)
av_strlcatf(item, sizeof(item), "{\\1a&H%02X&}",
state->fg_color >> 24);
}
if (state->bg_color != 0xFF000000) {
if ((state->bg_color & 0xFFFFFF) != 0)
av_strlcatf(item, sizeof(item), "{\\4c&H%06X&}",
state->bg_color & 0xFFFFFF);
if ((state->bg_color >> 24) != 0xFF)
av_strlcatf(item, sizeof(item), "{\\4a&H%02X&}",
state->bg_color >> 24);
}
if (state->mat_color != 0xFF000000) {
if ((state->mat_color & 0xFFFFFF) != 0)
av_strlcatf(item, sizeof(item), "{\\5c&H%06X&}",
state->mat_color & 0xFFFFFF);
if ((state->mat_color >> 24) != 0xFF)
av_strlcatf(item, sizeof(item), "{\\5a&H%02X&}",
state->mat_color >> 24);
}
prepend_str(ctx, item);
state->need_init = 0;
}
static void advance_by_pixels(ISDBSubContext *ctx, int csp)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
int cscale;
int csep_orig;
char tmp[32];
if (IS_HORIZONTAL_LAYOUT(ls->format))
cscale = ls->font_scale.fscx;
else
cscale = ls->font_scale.fscy;
csep_orig = ls->cell_spacing.col * cscale / 100;
tmp[0] = '\0';
av_strlcatf(tmp, sizeof(tmp), "{\\fsp%d}\xe2\x80\x8b{\\fsp%d}",
csp * 100 / cscale, ls->cell_spacing.col);
append_str(ctx, tmp);
ls->line_width += csp;
ls->prev_char_sep = csep_orig;
mp_msg(MSGT_DECSUB, MSGL_DBG2, "advanced %d pixel using fsp.\n", csp);
}
static void do_line_break(ISDBSubContext *ctx);
// move pen position to (col, row) relative to display area's top left.
// Note 1: In vertical layout, coordinates are rotated 90 deg.
// on the display area's top right.
// Note 2: the cell includes line/char spacings in both sides.
static void move_penpos(ISDBSubContext *ctx, int col, int row)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
int csp_l, col_ofs;
int cur_bottom;
int cell_height;
int cell_desc;
mp_msg(MSGT_DECSUB, MSGL_DBG2, "move pen pos. to (%d, %d).\n", col, row);
if (IS_HORIZONTAL_LAYOUT(ls->format)) {
// convert pen pos. to upper left of the cell.
cell_height = (ls->font_size + ls->cell_spacing.row)
* ls->font_scale.fscy / 100;
if (ls->font_scale.fscy == 200)
cell_desc = ls->cell_spacing.row / 2;
else
cell_desc = ls->cell_spacing.row * ls->font_scale.fscy / 200;
row -= cell_height;
csp_l = ls->cell_spacing.col * ls->font_scale.fscx / 200;
if (ls->line_width == 0 && ls->prev_line_bottom == 0)
ls->block_offset_h = csp_l;
col_ofs = ls->block_offset_h;
} else {
cell_height = (ls->font_size + ls->cell_spacing.row)
* ls->font_scale.fscx / 100;
cell_desc = cell_height / 2;
row -= cell_height - cell_desc;
csp_l = ls->cell_spacing.col * ls->font_scale.fscy / 200;
if (ls->line_width == 0 && ls->prev_line_bottom == 0)
ls->block_offset_v = csp_l;
col_ofs = ls->block_offset_v;
}
cur_bottom = ls->prev_line_bottom +
ls->linesep_upper + ls->line_height + ls->line_desc;
// allow adjusting +- cell_height/2 at maximum
// to align to the current line bottom.
if (row + cell_height / 2 > cur_bottom) {
// (col, row) is below the current line bottom
do_line_break(ctx); // ls->prev_line_bottom == cur_bottom
ls->linesep_upper = row + cell_height - cell_desc - ls->prev_line_bottom;
ls->line_height = 0;
advance_by_pixels(ctx, col + csp_l - col_ofs);
} else if (row + cell_height * 3 / 2 > cur_bottom &&
col + csp_l > col_ofs + ls->line_width) {
// append to the current line...
advance_by_pixels(ctx, col + csp_l - (col_ofs + ls->line_width));
} else {
mp_msg(MSGT_DECSUB, MSGL_INFO, "backward move not supported.\n");
return;
}
}
static void set_position(ISDBSubContext *ctx, unsigned int p1, unsigned int p2)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
int cw, ch;
int col, row;
if (IS_HORIZONTAL_LAYOUT(ls->format)) {
cw = (ls->font_size + ls->cell_spacing.col) * ls->font_scale.fscx / 100;
ch = (ls->font_size + ls->cell_spacing.row) * ls->font_scale.fscy / 100;
// pen position is at bottom left
col = p2 * cw;
row = p1 * ch + ch;
} else {
cw = (ls->font_size + ls->cell_spacing.col) * ls->font_scale.fscy / 100;
ch = (ls->font_size + ls->cell_spacing.row) * ls->font_scale.fscx / 100;
// pen position is at upper center,
// but in -90deg rotated coordinates, it is at middle left.
col = p2 * cw;
row = p1 * ch + ch / 2;
}
move_penpos(ctx, col, row);
}
static void forward_position(ISDBSubContext *ctx, int rows, int cols);
static const uint8_t *proc_ctl(ISDBSubContext *ctx,
const uint8_t *buf, int buf_size)
{
ISDBSubState *state = &ctx->current_state;
struct b24str_state *ts = &state->text_state;
struct isdbsub_layout *ls = &state->layout_state;
uint8_t code;
unsigned int p1, p2;
int i, mb;
const uint8_t *q;
while (buf_size > 0) {
code = buf[0];
if ((code & 0x60) != 0)
break;
buf++;
buf_size--;
p1 = p2 = 0;
switch (code) {
case 0x00: // NULL
break;
// cursor
case 0x09: // APF
// append a space
forward_position(ctx, 0, 1);
break;
case 0x16: // PAPF (0x40..0x7F)
if (buf_size < 1)
return NULL;
p1 = buf[0] & 0x3F;
buf++;
buf_size--;
forward_position(ctx, 0, p1);
break;
case 0x0D: // APR
forward_position(ctx, 1, 0);
mp_msg(MSGT_DECSUB, MSGL_DBG2, "explicit line break.\n");
break;
case 0x1C: // APS (0x40..0x7F, 0x40..0x7F)
if (buf_size < 2)
return NULL;
p1 = buf[0] & 0x3F;
p2 = buf[1] & 0x3F;
buf += 2;
buf_size -= 2;
mp_msg(MSGT_DECSUB, MSGL_DBG2, "aps: (%d, %d).\n", p1, p2);
set_position(ctx, p1, p2);
break;
case 0x0C: // CS
if (!state->rollup_mode) {
init_layout(ls);
reset_state(state);
clear_text(ctx);
mp_msg(MSGT_DECSUB, MSGL_DBG2, "screen cleared.\n");
}
break;
// iso2022 text state
case 0x0E: // LS1
ts->ss = 0;
ts->gl = 1;
break;
case 0x0F: // LS0
ts->ss = 0;
ts->gl = 0;
break;
case 0x19: // SS2
ts->ss = 2;
break;
case 0x1D: // SS3
ts->ss = 3;
break;
case 0x1B: // ESC(....)
if (buf_size < 1)
return NULL;
p1 = buf[0];
buf++;
buf_size--;
mb = 1;
switch (p1) {
case 0x6E: // LS2
case 0x6F: // LS3
ts->gl = 2 + (p1 & 0x01);
break;
case 0x7E: // LS1R
case 0x7D: // LS2R
case 0x7C: // LS3R
ts->gr = 0x7F - p1;
break;
// 0x28-0x2B (F) designate 1B set to G0-G3
// 0x24 [0x29-2B] (F) designate 2B set to G0-G3
// 0x28-0x2B 0x20 (F) designate 1B DRCS/MACRO to G0-G3
// 0x24 0x28-0x2B 0x20 (F) designate 2B DRCS to G0-G3
case 0x24:
if (buf_size < 1)
return NULL;
mb = 2;
p1 = buf[0];
if (p1 >= 0x28 && p1 <= 0x2B) {
buf++;
buf_size--;
} else
p1 = 0x28;
// fall through
case 0x28:
case 0x29:
case 0x2A:
case 0x2B:
if (buf_size < 1)
return NULL;
p2 = buf[0];
buf++;
buf_size--;
if (p2 == 0x20) {
if (buf_size < 1)
return NULL;
p2 = buf[0];
buf++;
buf_size--;
}
ts->g[p1 - 0x28].mb = mb;
ts->g[p1 - 0x28].code = p2;
break;
default:
mp_msg(MSGT_DECSUB, MSGL_V,
"unknown escape sequence: 0x%02hhx\n", p1);
}
break;
// color
case 0x80: // BKF
case 0x81: // RDF
case 0x82: // GRF
case 0x83: // YLF
case 0x84: // BLF
case 0x85: // MGF
case 0x86: // CNF
case 0x87: // WHF
p1 = (state->clut_high_idx << 4) | (code & 0x0F);
state->fg_color = Default_clut[p1];
set_color(ctx, 1, state->fg_color);
break;
case 0x90: // COL(0x48..0x7F) or (0x20, 0x40..0x4F)
if (buf_size < 1)
return NULL;
p1 = buf[0];
buf++;
buf_size--;
if (p1 == 0x20) {
if (buf_size < 1)
return NULL;
state->clut_high_idx = (buf[0] & 0x0F);
buf++;
buf_size--;
break;
}
p2 = (state->clut_high_idx << 4) | (p1 & 0x0F);
if ((p1 & 0xF0) == 0x40) {
state->fg_color = Default_clut[p2];
set_color(ctx, 1, state->fg_color);
}
break;
// character size
case 0x88: // SSZ
ls->font_scale.fscx = 50;
ls->font_scale.fscy = 50;
set_font_scale(ctx);
break;
case 0x89: // MSZ
ls->font_scale.fscx = 50;
ls->font_scale.fscy = 100;
set_font_scale(ctx);
break;
case 0x8A: // NSZ
ls->font_scale.fscx = 100;
ls->font_scale.fscy = 100;
set_font_scale(ctx);
break;
case 0x8B: // SZX ({0x41,0x44,0x45})
if (buf_size < 1)
return NULL;
p1 = buf[0];
buf++;
buf_size--;
ls->font_scale.fscx = 100;
ls->font_scale.fscy = 100;
if ((p1 & 0xFB) == 0x41)
ls->font_scale.fscy = 200;
if ((p1 & 0xFE) == 0x44)
ls->font_scale.fscx = 200;
set_font_scale(ctx);
break;
case 0x98: // RPC (0x40..0x7F)
if (buf_size < 1)
return NULL;
p1 = buf[0] & 0x3F;
buf++;
buf_size--;
ls->repeat_count = p1;
mp_msg(MSGT_DECSUB, MSGL_DBG2, "repeat char %d times.\n", p1);
break;
case 0x99: // SPL
append_str(ctx, "{\\u0}");
break;
case 0x9A: // STL
append_str(ctx, "{\\u1}");
break;
case 0x9B: // CSI
for (i = 0; i < buf_size; i++)
if (buf[i] >= 0x40 && buf[i] <= 0x6F)
break;
if (i == buf_size) {
buf += buf_size;
buf_size = 0;
break;
}
switch (buf[i]) {
// SWF1 (0x30..0x39, ...., 0x20, 0x53)
// -SWF2 ({0x38,0x3F?}, 0x3B, 0x30..0x32, 0x3B, 0x30..0x39, ...., [0x3B, 0x30..0x39,...,] 0x20, 0x53)
case 0x53:
q = get_csi_params(buf, &p1, NULL);
if (!q || *q != 0x20 || p1 < 7 || p1 > 10)
break;
ls->format = ISDBSUB_FMT_960H + (p1 - 7);
set_format(ctx); // calls reset_state, thus sate->need_init = 1
mp_msg(MSGT_DECSUB, MSGL_DBG2, "new format: %d\n", ls->format);
break;
// SDF (0x30..0x39,..., 0x3B, 0x30..0x39,..., 0x20, 0x56)
case 0x56:
q = get_csi_params(buf, &p1, &p2);
if (!q || *q != 0x20)
break;
ls->display_area.w = p1;
ls->display_area.h = p2;
state->need_init = 1;
mp_msg(MSGT_DECSUB, MSGL_DBG2,
"new disp. area size: (%u, %u)\n", p1, p2);
break;
// SDP (0x30..0x39,..., 0x3B, 0x30..0x39,..., 0x20, 0x5F)
case 0x5F:
q = get_csi_params(buf, &p1, &p2);
if (!q || *q != 0x20)
break;
ls->display_area.x = p1;
ls->display_area.y = p2;
state->need_init = 1;
mp_msg(MSGT_DECSUB, MSGL_DBG2,
"new disp. area pos: (%u, %u)\n", p1, p2);
break;
// RCS (0x30..0x39,...., 0x20, 0x6E)
case 0x6E:
q = get_csi_params(buf, &p1, NULL);
if (!q || *q != 0x20 || p1 > 15)
break;
state->mat_color = Default_clut[state->clut_high_idx << 4 | p1];
set_color(ctx, 5, state->mat_color);
break;
// SSM (0x30..0x39,..., 0x3B, 0x30..0x39,..., 0x20, 0x57)
case 0x57:
q = get_csi_params(buf, &p1, &p2);
if (!q || *q != 0x20 || p1 != p2)
break;
if (p1 == 16 || p1 == 20 || p1 == 24 || p1 == 30 || p1 == 36) {
char fs[8];
ls->font_size = p1;
fs[0] = '\0';
av_strlcatf(fs, sizeof(fs), "{\\fs%d}", p1);
append_str(ctx, fs);
if (ls->line_width != 0)
ls->shift_baseline = 0;
mp_msg(MSGT_DECSUB, MSGL_DBG2, "font size:%d\n", p1);
}
break;
// SHS (0x30..0x39,..., 0x20, 0x58)
// SVS (0x30..0x39,..., 0x20, 0x59)
case 0x58:
case 0x59:
q = get_csi_params(buf, &p1, NULL);
if (!q || *q != 0x20)
break;
if (code == 0x58)
ls->cell_spacing.col = p1;
else {
ls->cell_spacing.row = p1;
if (ls->line_width != 0)
ls->shift_baseline = 0;
}
mp_msg(MSGT_DECSUB, MSGL_DBG2, "%c-spacing:%u.\n",
(code == 0x58) ? 'h' : 'v', p1);
// no output here. automatically inserted later in proc_char().
break;
// ORN (0x30, 0x20, 0x63) or (0x31, 0x3B, 0x30..0x39 * 4, 0x20, 0x63)
case 0x63:
q = get_csi_params(buf, &p1, &p2);
if (!q)
break;
if (p1 == 0) // no ornaments
append_str(ctx, "{\\bord0\\3a&HFF&\\3c&H000000&}");
else if (p1 == 1 && *q == 0x20) { // outline
int idx = (p2 / 100) << 4 | (p2 % 100);
if (idx < 0 || idx > 127)
break;
append_str(ctx, "{\\bord1}");
set_color(ctx, 3, Default_clut[idx]);
}
break;
// SCR (0x30..0x34, 0x3B, 0x30..0x39..., 0x20, 0x67)
case 0x67:
q = get_csi_params(buf, &p1, &p2);
if (!q || *q != 0x20 || p1 > 4)
break;
if (p1 != 0)
clear_text(ctx);
ls->scroll.direction = (p1 + 1) / 2;
ls->scroll.rollout = (p1 == 2 || p1 == 4);
if (p2 == 0)
p2 = 1;
ls->scroll.speed = p2;
break;
// ACPS (0x30..0x39,...., 0x3B, 0x30..0x39,...., 0x20, 0x61)
case 0x61:
q = get_csi_params(buf, &p1, &p2);
if (!q || *q != 0x20)
break;
if ((signed) p1 < ls->display_area.x
|| (signed) p1 >= ls->display_area.x + ls->display_area.w
|| (signed) p2 < ls->display_area.y
|| (signed) p2 >= ls->display_area.y + ls->display_area.h) {
mp_msg(MSGT_DECSUB, MSGL_WARN,
"invalid parameters (%u, %u) in ACPS.\n", p1, p2);
break;
}
if (IS_HORIZONTAL_LAYOUT(ls->format))
move_penpos(ctx, p1 - ls->display_area.x,
p2 - ls->display_area.y);
else
move_penpos(ctx, ls->display_area.w - (p1 - ls->display_area.x),
p2 - ls->display_area.y);
break;
// -CCC ({0x30, 0x32..0x34}, 0x20, 0x54)
// -PLD (0x5B)
// -PLU (0x5C)
// -GSM (0x30..0x39,..., 0x3B, 0x30..0x39,..., 0x20, 0x42)
// -GAA ({0x30,0x31}, 0x20, 0x5D)
// -SRC (0x30..0x33, 0x3B, 0x30..0x39 * 4, 0x20, 0x5E)
// -TCC (0x30..0x3A, 0x3B, 0x30..0x33, 0x3B, 0x30..0x39,..., 0x20, 0x62)
// -CFS (0x30..0x39,..., 0x20, 0x65)
// -MDF (0x30..0x33, 0x20, 0x64)
// -XCS (0x30..0x31, 0x20, 0x66)
// PRA (0x30..0x39,..., 0x20, 0x68)
// -ACS (0x30, 0x20, 0x69)....(0x9B, 0x31,0x20,0x69) {(0x9B,{0x32,0x34},0x20,0x69)...(0x9B,{0x33,0x35},0x20, 0x69)}+
// -SCS (0x6F)(0x9B,...).....(0x9B,0x6F)
default:
mp_msg(MSGT_DECSUB, MSGL_V,
"invalid/un-supported CSI. terminating code:0x%02hhx len:%d\n", buf[i], i);
}
i++;
buf += i;
buf_size -= i;
break;
// non-supported control codes
case 0x9D: // -TIME (0x20, 0x40..0x7F) or (0x28, 0x40..0x43) or (0x29, ...., 0x40..0x43)
if (buf_size < 2)
return NULL;
if (buf[0] == 0x20 || buf[0] == 0x28) {
if (buf[0] == 0x20) {
// wait. copy & split out as another event
ctx->duration = (buf[1] - 0x40) * 100;
append_event(ctx);
}
buf += 2;
buf_size -= 2;
break;
}
if (buf[0] != 0x29)
return NULL;
while (buf_size > 0 && (buf[0] & 0xFC) != 0x40) {
buf++;
buf_size--;
}
if ((buf[0] & 0xFC) != 0x40)
return NULL;
// buf_size > 0
buf++;
buf_size--;
mp_msg(MSGT_DECSUB, MSGL_V,
"un-supported control code: 0x%02hhx\n", code);
break;
case 0x95: // -MACRO (0x4F) or (0x40..0x41, 0x21..0x7E, ...., 0x95, 0x4F)
if (buf_size < 1)
return NULL;
if (buf[0] == 0x40 || buf[0] == 0x41) {
while (buf_size > 1 && buf[0] != 0x95) {
buf++;
buf_size--;
}
if (buf[0] != 0x95)
return NULL;
// buf_size > 1
buf++;
buf_size--;
}
if (buf[0] != 0x4F)
return NULL;
buf++;
buf_size--;
mp_msg(MSGT_DECSUB, MSGL_V,
"un-supported control code: 0x%02hhx\n", code);
break;
case 0x92: // -CDC ({0x40,0x4F}) or (0x20, 0x40..0x4A)
if (buf_size >= 2 && buf[0] == 0x20) {
buf++;
buf_size--;
}
// fall through
case 0x91: // -FLC ({0x40,0x47,0x4F})
case 0x93: // -POL (0x40..0x42)
case 0x94: // -WHM ({0x40,0x44,0x45})
case 0x97: // -HLC (0x40..0x4F)
if (buf_size < 1)
return NULL;
buf++;
buf_size--;
// fall through
case 0x08: // APB
case 0x0A: // APD
case 0x0B: // -APU
default: // un-used/unknown control codes
mp_msg(MSGT_DECSUB, MSGL_V,
"unknown/ignored control code: 0x%02hhx\n", code);
break;
}
}
return buf;
}
static const uint8_t * const combining1[] = {
"\xcc\x81", // U+0301 combinng accute accent
"\xcc\x80", // U+0300 combining grave accent
"\xcc\x88", // U+0308 combining diaeresis
"\xcc\x82", // U+0302 combining circumflex accent
"\xcc\x84", // U+0304 combining macron
"\xcc\xb2", // U+0332 combining low line
};
static const uint8_t * const hira_symbols[9] = {
"\xe3\x82\x9d" /* U+309D */, "\xe3\x82\x9e" /* U+309E */,
"\xe3\x83\xbc" /* U+30FC */, "\xe3\x80\x82" /* U+3002 */,
"\xe3\x80\x8c" /* U+300C */, "\xe3\x80\x8d" /* U+300D */,
"\xe3\x80\x81" /* U+3001 */, "\xe3\x83\xbb" /* U+30FB */,
};
static const uint8_t * const kata_symbols[9] = {
"\xe3\x83\xbd" /* U+30FD */, "\xe3\x83\xbe" /* U+30FE */,
"\xe3\x83\xbc" /* U+30FC */, "\xe3\x80\x82" /* U+3002 */,
"\xe3\x80\x8c" /* U+300C */, "\xe3\x80\x8d" /* U+300D */,
"\xe3\x80\x81" /* U+3001 */, "\xe3\x83\xbb" /* U+30FB */,
};
/* ARIB STD B24 table.7-11 -> UTF-8 */
static const uint8_t * const trans_ext85[] = {
/* 1- 10 */
"\xe3\x90\x82", "\xf0\xa0\x85\x98", "\xe4\xbb\xbd", "\xe4\xbb\xbf", "\xe4\xbe\x9a",
"\xe4\xbf\x89", "\xe5\x82\x9c", "\xe5\x84\x9e", "\xe5\x86\xbc", "\xe3\x94\x9f",
/* 11- 20 */
"\xe5\x8c\x87", "\xe5\x8d\xa1", "\xe5\x8d\xac", "\xe5\xa9\xb9", "\xf0\xa0\xae\xb7",
"\xe5\x91\x8d", "\xe5\x92\x96", "\xe5\x92\x9c", "\xe5\x92\xa9", "\xe5\x94\x8e",
/* 21- 30 */
"\xe5\x95\x8a", "\xe5\x99\xb2", "\xe5\x9b\xa4", "\xe5\x9c\xb3", "\xe5\x9c\xb4",
"\xef\xa8\x90", "\xe5\xa2\x80", "\xe5\xa7\xa4", "\xe5\xa8\xa3", "\xe5\xa9\x95",
/* 31- 40 */
"\xe5\xaf\xac", "\xef\xa8\x91", "\xe3\x9f\xa2", "\xe5\xba\xac", "\xe5\xbc\xb4",
"\xe5\xbd\x85", "\xe5\xbe\xb7", "\xe6\x80\x97", "\xe6\x81\xb5", "\xe6\x84\xb0",
/* 41- 50 */
"\xe6\x98\xa4", "\xe6\x9b\x88", "\xe6\x9b\x99", "\xe6\x9b\xba", "\xe6\x9b\xbb",
"\xee\x82\x88", "\xe6\xa2\x81", "\xe6\xa4\x91", "\xe6\xa4\xbb", "\xe6\xa9\x85",
/* 51- 60 */
"\xe6\xaa\x91", "\xe6\xab\x9b", "\xf0\xa3\x8f\x8c", "\xf0\xa3\x8f\xbe", "\xf0\xa3\x97\x84",
"\xe6\xaf\xb1", "\xe6\xb3\xa0", "\xe6\xb4\xae", "\xef\xa9\x85", "\xe6\xb6\xbf",
/* 61- 70 */
"\xe6\xb7\x8a", "\xe6\xb7\xb8", "\xef\xa9\x86", "\xe6\xbd\x9e", "\xe6\xbf\xb9",
"\xe7\x81\xa4", "\xe7\x85\x95", "\xf0\xa4\x8b\xae", "\xe7\x85\x87", "\xe7\x87\x81",
/* 71- 80 */
"\xe7\x88\x80", "\xe7\x8e\x9f", "\xe7\x8e\xa8", "\xe7\x8f\x89", "\xe7\x8f\x96",
"\xe7\x90\x9b", "\xe7\x90\xa1", "\xef\xa9\x8a", "\xe7\x90\xa6", "\xe7\x90\xaa",
/* 81- 90 */
"\xe7\x90\xac", "\xe7\x90\xb9", "\xe7\x91\x8b", "\xe3\xbb\x9a", "\xe7\x95\xb5",
"\xe7\x96\x81", "\xe7\x9d\xb2", "\xe4\x82\x93", "\xe7\xa3\x88", "\xe7\xa3\xa0",
/* 91-100 */
"\xe7\xa5\x87", "\xe7\xa6\xae", "\xe7\xa5\x93", "\xe8\xa2\x82", "\xe8\xa5\xa6",
"\xe7\xa7\x9a", "\xe7\xa8\x9e", "\xe7\xad\xbf", "\xe7\xb0\xb1", "\xe4\x89\xa4",
/* 101-110 */
"\xe7\xb6\x8b", "\xe7\xbe\xa1", "\xe8\x84\x98", "\xe8\x84\xba", "\xe8\x88\x98",
"\xe8\x8a\xae", "\xe8\x91\x9b", "\xe8\x93\x9c", "\xe8\x93\xac", "\xe8\x95\x99",
/* 111-120 */
"\xe8\x97\x8e", "\xe8\x9d\x95", "\xe8\x9f\xac", "\xe8\xa0\x8b", "\xe8\xa3\xb5",
"\xe8\xa7\x92", "\xe8\xab\xb6", "\xe8\xb7\x8e", "\xe8\xbe\xbb", "\xe8\xbf\xb6",
/* 121-130 */
"\xe9\x83\x9d", "\xe9\x84\xa7", "\xe9\x84\xad", "\xe9\x86\xb2", "\xe9\x88\xb3",
"\xe9\x8a\x88", "\xe9\x8c\xa1", "\xe9\x8d\x88", "\xe9\x96\x92", "\xe9\x9b\x9e",
/* 131-137 */
"\xe9\xa4\x83", "\xe9\xa5\x80", "\xe9\xab\x99", "\xe9\xaf\x96", "\xe9\xb7\x97",
"\xe9\xba\xb4", "\xe9\xba\xb5",
};
static const uint8_t * const trans_ext90[][96] = {
{ /* row 90 */
/* 1- 10 */
"\xe2\x9b\x8c", "\xe2\x9b\x8d", "\xe2\x9d\x97", "\xe2\x9b\x8f", "\xe2\x9b\x90",
"\xe2\x9b\x91", "", "\xe2\x9b\x92", "\xe2\x9b\x95", "\xe2\x9b\x93",
/* 11- 20 */
"\xe2\x9b\x94", "", "", "", "", "",
"\xf0\x9f\x85\xbf", "\xf0\x9f\x86\x8a", "", "", "\xe2\x9b\x96",
/* 21- 30 */
"\xe2\x9b\x97", "\xe2\x9b\x98", "\xe2\x9b\x99", "\xe2\x9b\x9a", "\xe2\x9b\x9b",
"\xe2\x9b\x9c", "\xe2\x9b\x9d", "\xe2\x9b\x9e", "\xe2\x9b\x9f", "\xe2\x9b\xa0",
/* 31- 40 */
"\xe2\x9b\xa1", "\xe2\xad\x95", "\xe3\x89\x88", "\xe3\x89\x89", "\xe3\x89\x8a",
"\xe3\x89\x8b", "\xe3\x89\x8c", "\xe3\x89\x8d", "\xe3\x89\x8e", "\xe3\x89\x8f",
/* 41- 50 */
"", "", "", "", "\xe2\x92\x91",
"\xe2\x92\x92", "\xe2\x92\x93", "\xf0\x9f\x85\x8a", "\xf0\x9f\x85\x8c", "\xf0\x9f\x84\xbf",
/* 51- 60 */
"\xf0\x9f\x85\x86", "\xf0\x9f\x85\x8b", "\xf0\x9f\x88\x90", "\xf0\x9f\x88\x91", "\xf0\x9f\x88\x92",
"\xf0\x9f\x88\x93", "\xf0\x9f\x85\x82", "\xf0\x9f\x88\x94", "\xf0\x9f\x88\x95", "\xf0\x9f\x88\x96",
/* 61- 70 */
"\xf0\x9f\x85\x8d", "\xf0\x9f\x84\xb1", "\xf0\x9f\x84\xbd", "\xe2\xac\x9b", "\xe2\xac\xa4",
"\xf0\x9f\x88\x97", "\xf0\x9f\x88\x98", "\xf0\x9f\x88\x99", "\xf0\x9f\x88\x9a", "\xf0\x9f\x88\x9b",
/* 71- 80 */
"\xe2\x9a\xbf", "\xf0\x9f\x88\x9c", "\xf0\x9f\x88\x9d", "\xf0\x9f\x88\x9e", "\xf0\x9f\x88\x9f",
"\xf0\x9f\x88\xa0", "\xf0\x9f\x88\xa1", "\xf0\x9f\x88\xa2", "\xf0\x9f\x88\xa3", "\xf0\x9f\x88\xa4",
/* 81- 84 */
"\xf0\x9f\x88\xa5", "\xf0\x9f\x85\x8e", "\xe3\x8a\x99", "\xf0\x9f\x88\x80",
},
{ /* row 91 */
/* 1- 10 */
"\xe2\x9b\xa3", "\xe2\xad\x96", "\xe2\xad\x97", "\xe2\xad\x98", "\xe2\xad\x99",
"\xe2\x98\x93", "\xe3\x8a\x8b", "\xe3\x80\x92", "\xe2\x9b\xa8", "\xe3\x89\x86",
/* 11- 20 */
"\xe3\x89\x85", "\xe2\x9b\xa9", "\xe0\xbf\x96", "\xe2\x9b\xaa", "\xe2\x9b\xab",
"\xe2\x9b\xac", "\xe2\x99\xa8", "\xe2\x9b\xad", "\xe2\x9b\xae", "\xe2\x9b\xaf",
/* 21- 30 */
"\xe2\x9a\x93", "\xe2\x9c\x88", "\xe2\x9b\xb0", "\xe2\x9b\xb1", "\xe2\x9b\xb2",
"\xe2\x9b\xb3", "\xe2\x9b\xb4", "\xe2\x9b\xb5", "\xf0\x9f\x85\x97", "\xe2\x92\xb9",
/* 31- 40 */
"\xe2\x93\x88", "\xe2\x9b\xb6", "\xf0\x9f\x85\x9f", "\xf0\x9f\x86\x8b", "\xf0\x9f\x86\x8d",
"\xf0\x9f\x86\x8c", "\xf0\x9f\x85\xb9", "\xe2\x9b\xb7", "\xe2\x9b\xb8", "\xe2\x9b\xb9",
/* 41- 49 */
"\xe2\x9b\xba", "\xf0\x9f\x85\xbb", "\xe2\x98\x8e", "\xe2\x9b\xbb", "\xe2\x9b\xbc",
"\xe2\x9b\xbd", "\xe2\x9b\xbe", "\xf0\x9f\x85\xbc", "\xe2\x9b\xbf",
},
{ /* row 92 */
/* 1- 10 */
"\xe2\x9e\xa1", "\xe2\xac\x85", "\xe2\xac\x86", "\xe2\xac\x87", "\xe2\xac\xaf",
"\xe2\xac\xae", "\xe5\xb9\xb4", "\xe6\x9c\x88", "\xe6\x97\xa5", "\xe5\x86\x86",
/* 11- 20 */
"\xe3\x8e\xa1", "\xe3\x8e\xa5", "\xe3\x8e\x9d", "\xe3\x8e\xa0", "\xe3\x8e\xa4",
"\xf0\x9f\x84\x80", "\xe2\x92\x88", "\xe2\x92\x89", "\xe2\x92\x8a", "\xe2\x92\x8b",
/* 21- 30 */
"\xe2\x92\x8c", "\xe2\x92\x8d", "\xe2\x92\x8e", "\xe2\x92\x8f", "\xe2\x92\x90",
"\xe6\xb0\x8f", "\xe5\x89\xaf", "\xe5\x85\x83", "\xe6\x95\x85", "\xe5\x89\x8d",
/* 31- 40 */
"\xe6\x96\xb0", "\xf0\x9f\x84\x81", "\xf0\x9f\x84\x82", "\xf0\x9f\x84\x83", "\xf0\x9f\x84\x84",
"\xf0\x9f\x84\x85", "\xf0\x9f\x84\x86", "\xf0\x9f\x84\x87", "\xf0\x9f\x84\x88", "\xf0\x9f\x84\x89",
/* 41- 50 */
"\xf0\x9f\x84\x8a", "\xe3\x88\xb3", "\xe3\x88\xb6", "\xe3\x88\xb2", "\xe3\x88\xb1",
"\xe3\x88\xb9", "\xe3\x89\x84", "\xe2\x96\xb6", "\xe2\x97\x80", "\xe3\x80\x96",
/* 51- 60 */
"\xe3\x80\x97", "\xe2\x9f\x90", "\xc2\xb2", "\xc2\xb3", "\xf0\x9f\x84\xad",
/* no unicode chars for musical score symbols (56...85) */
"?", "?", "?", "?", "?",
/* 61- 70 */
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?",
/* 71- 80 */
"?", "?", "?", "?", "?", "?", "?", "?", "?", "?",
/* 81- 90 */
"?", "?", "?", "?", "?",
"\xf0\x9f\x84\xac", "\xf0\x9f\x84\xab", "\xe3\x89\x87", "\xf0\x9f\x86\x90", "\xf0\x9f\x88\xa6",
/* 91 */
"\xe2\x84\xbb",
},
{ /* row 93 */
/* 1- 10 */
"\xe3\x88\xaa", "\xe3\x88\xab", "\xe3\x88\xac", "\xe3\x88\xad", "\xe3\x88\xae",
"\xe3\x88\xaf", "\xe3\x88\xb0", "\xe3\x88\xb7", "\xe3\x8d\xbe", "\xe3\x8d\xbd",
/* 11- 20 */
"\xe3\x8d\xbc", "\xe3\x8d\xbb", "\xe2\x84\x96", "\xe2\x84\xa1", "\xe3\x80\xb6",
"\xe2\x9a\xbe", "\xf0\x9f\x89\x80", "\xf0\x9f\x89\x81", "\xf0\x9f\x89\x82", "\xf0\x9f\x89\x83",
/* 21- 30 */
"\xf0\x9f\x89\x84", "\xf0\x9f\x89\x85", "\xf0\x9f\x89\x86", "\xf0\x9f\x89\x87", "\xf0\x9f\x89\x88",
"\xf0\x9f\x84\xaa", "\xf0\x9f\x88\xa7", "\xf0\x9f\x88\xa8", "\xf0\x9f\x88\xa9", "\xf0\x9f\x88\x94",
/* 31- 40 */
"\xf0\x9f\x88\xaa", "\xf0\x9f\x88\xab", "\xf0\x9f\x88\xac", "\xf0\x9f\x88\xad", "\xf0\x9f\x88\xae",
"\xf0\x9f\x88\xaf", "\xf0\x9f\x88\xb0", "\xf0\x9f\x88\xb1", "\xe2\x84\x93", "\xe3\x8e\x8f",
/* 41- 50 */
"\xe3\x8e\x90", "\xe3\x8f\x8a", "\xe3\x8e\x9e", "\xe3\x8e\xa2", "\xe3\x8d\xb1",
"", "", "\xc2\xbd", "\xe2\x86\x89", "\xe2\x85\x93",
/* 51- 60 */
"\xe2\x85\x94", "\xc2\xbc", "\xc2\xbe", "\xe2\x85\x95", "\xe2\x85\x96",
"\xe2\x85\x97", "\xe2\x85\x98", "\xe2\x85\x99", "\xe2\x85\x9a", "\xe2\x85\x90",
/* 61- 70 */
"\xe2\x85\x9b", "\xe2\x85\x91", "\xe2\x85\x92", "\xe2\x98\x80", "\xe2\x98\x81",
"\xe2\x98\x82", "\xe2\x9b\x84", "\xe2\x98\x96", "\xe2\x98\x97", "\xe2\x9b\x89",
/* 71- 80 */
"\xe2\x9b\x8a", "\xe2\x99\xa6", "\xe2\x99\xa5", "\xe2\x99\xa3","\xe2\x99\xa0",
"\xe2\x9b\x8b", "\xe2\xa8\x80", "\xe2\x80\xbc", "\xe2\x81\x89", "\xe2\x9b\x85",
/* 81- 90 */
"\xe2\x98\x94", "\xe2\x9b\x86", "\xe2\x98\x83", "\xe2\x9b\x87", "\xe2\x9a\xa1",
"\xe2\x9b\x87", "", "\xe2\x9a\x9e", "\xe2\x9a\x9f", "\xe2\x99\xac",
/* 91 */
"\xe2\x98\x8e",
},
{ /* row 94 */
/* 1- 10 */
"\xe2\x85\xa0", "\xe2\x85\xa1", "\xe2\x85\xa2", "\xe2\x85\xa3", "\xe2\x85\xa4",
"\xe2\x85\xa5", "\xe2\x85\xa6", "\xe2\x85\xa7", "\xe2\x85\xa8", "\xe2\x85\xa9",
/* 11- 20 */
"\xe2\x85\xaa", "\xe2\x85\xab", "\xe2\x91\xb0", "\xe2\x91\xb1", "\xe2\x91\xb2",
"\xe2\x91\xb3", "\xe2\x91\xb4", "\xe2\x91\xb5", "\xe2\x91\xb6", "\xe2\x91\xb7",
/* 21- 30 */
"\xe2\x91\xb8", "\xe2\x91\xb9", "\xe2\x91\xba", "\xe2\x91\xbb", "\xe2\x91\xbc",
"\xe2\x91\xbd", "\xe2\x91\xbe", "\xe2\x91\xbf", "\xe3\x89\x91", "\xe3\x89\x92",
/* 31- 40 */
"\xe3\x89\x93", "\xe3\x89\x94", "\xf0\x9f\x84\x90", "\xf0\x9f\x84\x91", "\xf0\x9f\x84\x92",
"\xf0\x9f\x84\x93", "\xf0\x9f\x84\x94", "\xf0\x9f\x84\x95", "\xf0\x9f\x84\x96", "\xf0\x9f\x84\x97",
/* 41- 50 */
"\xf0\x9f\x84\x98", "\xf0\x9f\x84\x99", "\xf0\x9f\x84\x9a", "\xf0\x9f\x84\x9b", "\xf0\x9f\x84\x9c",
"\xf0\x9f\x84\x9d", "\xf0\x9f\x84\x9e", "\xf0\x9f\x84\x9f", "\xf0\x9f\x84\xa0", "\xf0\x9f\x84\xa1",
/* 51- 60 */
"\xf0\x9f\x84\xa2", "\xf0\x9f\x84\xa3", "\xf0\x9f\x84\xa4", "\xf0\x9f\x84\xa5", "\xf0\x9f\x84\xa6",
"\xf0\x9f\x84\xa7", "\xf0\x9f\x84\xa8", "\xf0\x9f\x84\xa9", "\xe3\x89\x95", "\xe3\x89\x96",
/* 61- 70 */
"\xe3\x89\x97", "\xe3\x89\x98", "\xe3\x89\x99", "\xe3\x89\x9a", "\xe2\x91\xa0",
"\xe2\x91\xa1", "\xe2\x91\xa2", "\xe2\x91\xa3", "\xe2\x91\xa4", "\xe2\x91\xa5",
/* 71- 80 */
"\xe2\x91\xa6", "\xe2\x91\xa7", "\xe2\x91\xa8", "\xe2\x91\xa9", "\xe2\x91\xaa",
"\xe2\x91\xab", "\xe2\x91\xac", "\xe2\x91\xad", "\xe2\x91\xae", "\xe2\x91\xaf",
/* 81- 90 */
"\xe2\x9d\xb6", "\xe2\x9d\xb7", "\xe2\x9d\xb8", "\xe2\x9d\xb9", "\xe2\x9d\xba",
"\xe2\x9d\xbb", "\xe2\x9d\xbc", "\xe2\x9d\xbd", "\xe2\x9d\xbe", "\xe2\x9d\xbf",
/* 91- 93 */
"\xe2\x93\xab", "\xe2\x93\xac", "\xe3\x89\x9b",
}
};
static unsigned char append_arib_char (ISDBSubContext *ctx, uint8_t c1, uint8_t c2)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
struct b24str_state *ts = &ctx->current_state.text_state;
int gidx;
uint8_t code;
size_t ilen, olen, ret;
char indata[3], *obuf, *ibuf;
const uint8_t *p;
uint8_t *q;
int len;
ibuf = indata;
// make room for a new char. (at least 6 + 1 bytes)
reserve_buf(ctx, 7);
obuf = ctx->text.buf + ctx->text.used;
olen = ctx->text.len - ctx->text.used;
if (ts->ss > 1)
gidx = ts->ss;
else if (c1 & 0x80)
gidx = ts->gr;
else
gidx = ts->gl;
code = ts->g[gidx].code;
// some hacks
if ((c1 & 0x7F) == 0x20 || (c1 & 0x7F) == 0x7F) // SP or DEL
code = CODE_ASCII;
if (code == CODE_JISX0208 && (c1 & 0x7F) >= 0x75)
code = CODE_EXT;
switch (code) {
case CODE_ASCII:
case CODE_ASCII2:
ls->in_combining = 0;
c1 &= 0x7F;
if (c1 != 0x7F)
ctx->text.buf[ctx->text.used++] = c1; // no conversion needed
else {
// replace DELL with black-square (U+25A0)
memcpy(ctx->text.buf + ctx->text.used, "\xe2\x96\xa0", 3);
ctx->text.used += 3;
}
break;
case CODE_JISX0208:
case CODE_JISX0213_1:
c1 |= 0x80;
c2 |= 0x80;
// non-spacing char?
if ((c1 == 0xA1 && c2 >= 0xAD && c2 <= 0xB2) ||
(c1 == 0xA2 && c2 == 0xFE)) {
ls->in_combining = 1;
// U+20DD (0xe2839d) combining enclosing circle
p = (c1 == 0xA1) ? combining1[c2 - 0xAD] :
(const uint8_t *) "\xe2\x83\x9d";
len = strlen(p);
memcpy(ctx->text.buf + ctx->text.used, p, len);
ctx->text.used += len;
break;
}
ls->in_combining = 0;
ibuf[0] = c1;
ibuf[1] = c2;// ibuf[]: EUC-JP2013 kanji
ilen = 2;
ret = iconv(ctx->iconv, &ibuf, &ilen, &obuf, &olen);
if (ret != (size_t) -1)
ctx->text.used += obuf - &ctx->text.buf[ctx->text.used];
else
mp_msg(MSGT_DECSUB, MSGL_INFO,
"bad data as EUC-JP(%d). sp:%lu 0x%02hhx 0x%02hhx\n",
errno, olen, c1, c2);
break;
case CODE_JISX0213_2:
ls->in_combining = 0;
c1 |= 0x80;
c2 |= 0x80;
ilen = 3;
ibuf[0] = '\x8f';
ibuf[0] = c1;
ibuf[1] = c2;
ret = iconv(ctx->iconv, &ibuf, &ilen, &obuf, &olen);
if (ret != (size_t) -1)
ctx->text.used += obuf - &ctx->text.buf[ctx->text.used];
else
mp_msg(MSGT_DECSUB, MSGL_INFO,
"bad data as EUC-JP. 0x8f 0x%02hhx 0x%02hhx\n", c1, c2);
break;
case CODE_JISX0201_KATA:
ls->in_combining = 0;
c1 &= 0x7F;
// map to U+FF60 + (c1 - 0x20) = U+FF00 + (c1 + 0x40)
c1 += 0x40;
q = ctx->text.buf + ctx->text.used;
q[0] = 0xef;
q[1] = 0xbc + (c1 >> 6);
q[2] = 0x80 + (c1 & 0x3F);
ctx->text.used += 3;
break;
case CODE_X_HIRA:
case CODE_X_HIRA_P:
case CODE_X_KATA:
case CODE_X_KATA_P:
ls->in_combining = 0;
c1 &= 0x7F;
if (c1 < 0x77) {
q = ctx->text.buf + ctx->text.used;
// hira: {U+3040+ (c1 - 0x20)} -> {U+3000 + (c1 + 0x20)}
// kata: {U+30A0 + (c1 - 0x20)} -> {U+3000 + (c1 + 0x80)}
c1 += (code == CODE_X_HIRA || code == CODE_X_HIRA_P) ? 0x20 : 0x80;
q[0] = 0xe3;
q[1] = 0x80 + (c1 >> 6);
q[2] = 0x80 + (c1 & 0x3F);
ctx->text.used += 3;
} else {
c1 -= 0x77;
p = (code == CODE_X_HIRA || code == CODE_X_HIRA_P) ?
hira_symbols[c1] : kata_symbols[c1];
len = strlen(p);
memcpy(ctx->text.buf + ctx->text.used, p, len);
ctx->text.used += len;
}
break;
case CODE_EXT: // symbols defined in row 85.86, 90..94
ls->in_combining = 0;
c1 &= 0x7F;
c2 &= 0x7F;
switch (c1) {
case 0x75: // row 85-86
case 0x76:
c2 -= 0x21;
if (c1 == 0x76)
c2 += 94;
if (c2 < 137) {
p = trans_ext85[c2];
len = strlen(p);
memcpy(ctx->text.buf + ctx->text.used, p, len);
ctx->text.used += len;
} else
mp_msg(MSGT_DECSUB, MSGL_INFO, "bad data as extra char.\n");
break;
case 0x7A: // row 90-94
case 0x7B:
case 0x7C:
case 0x7D:
case 0x7E:
c1 -= 0x7A;
c2 -= 0x21;
p = trans_ext90[c1][c2];
len = strlen(p);
if (len > 0) {
memcpy(ctx->text.buf + ctx->text.used, p, len);
ctx->text.used += len;
} else
mp_msg(MSGT_DECSUB, MSGL_INFO, "bad data as extra char.\n");
break;
default:
mp_msg(MSGT_DECSUB, MSGL_V,
"un-supported data 0x%02hhx 0x%02hhx.\n", c1, c2);
}
break;
// non-spacing mosaic chars... just skip.
// don't touch in_combining, as other non-spacing char's may follow/precede...
case CODE_MOSAIC_C:
case CODE_MOSAIC_D:
break;
case CODE_X_MACRO:
break; // processed later
default:
ls->in_combining = 0;
// replace this unknown char with U+FFFD
memcpy(ctx->text.buf + ctx->text.used, "\xef\xbf\xbd", 3);
ctx->text.used += 3;
mp_msg(MSGT_DECSUB, MSGL_V,
"unknown charset:0x%02hhx data 0x%02hhx 0x%02hhx.\n", code, c1, c2);
break;
}
ctx->text.buf[ctx->text.used] = '\0';
return code;
}
static void insert_str(ISDBSubContext *ctx, const char *txt, int begin)
{
int end = ctx->text.used;
size_t len = strlen(txt);
if (len == 0 || len > 128)
return;
reserve_buf(ctx, len + 1); // +1 for terminating '\0'
memmove(ctx->text.buf + begin + len, ctx->text.buf + begin, end - begin);
memcpy(ctx->text.buf + begin, txt, len);
ctx->text.txt_tail += len;
ctx->text.used += len;
ctx->text.buf[ctx->text.used] = '\0';
}
static void advance(ISDBSubContext *ctx);
static void fixup_linesep(ISDBSubContext *ctx)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
char tmp[16];
int lsp;
if (ls->prev_break_idx <= 0)
return;
// adjust baseline if all chars in the line are 50% tall of one font size.
if (ls->shift_baseline && IS_HORIZONTAL_LAYOUT(ls->format)) {
int delta = ls->cell_spacing.row / 4;
ls->linesep_upper += delta;
ls->line_desc -= delta;
mp_msg(MSGT_DECSUB, MSGL_V, "baseline shifted down %dpx.\n", delta);
}
// not the first line
tmp[0]='\0';
lsp = ls->prev_line_desc + ls->linesep_upper;
av_strlcatf(tmp, sizeof(tmp), "{\\lsp%d}", lsp);
insert_str(ctx, tmp, ls->prev_break_idx);
}
static void do_line_break(ISDBSubContext *ctx)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
int csp;
char tmp[32];
if (IS_HORIZONTAL_LAYOUT(ls->format))
csp = ls->cell_spacing.col * ls->font_scale.fscx / 100;
else
csp = ls->cell_spacing.col * ls->font_scale.fscy / 100;
if (ls->line_width == 0) {
if (ls->prev_line_bottom == 0) {
if (IS_HORIZONTAL_LAYOUT(ls->format))
ls->block_offset_h = csp / 2;
else
ls->block_offset_v = csp / 2;
}
// avoid empty lines by prepending a space,
// as ASS halves line-spacing of empty lines.
append_str(ctx, "\xe3\x80\x80");
advance(ctx);
}
fixup_linesep(ctx);
ls->prev_break_idx = ctx->text.used;
tmp[0] = '\0';
av_strlcatf(tmp, sizeof(tmp), "\\N{\\lsp0\\fsp%d}", ls->cell_spacing.col);
append_str(ctx, tmp);
ls->prev_line_desc = ls->line_desc;
ls->prev_line_bottom += ls->linesep_upper + ls->line_height + ls->line_desc;
ls->prev_char_sep = csp;
ls->line_height = 0;
ls->line_width = 0;
ls->line_desc = 0;
ls->linesep_upper = 0;
ls->shift_baseline = 0;
}
// a new char will be appended. check h-spacing and line-breaking.
static void pre_advance(ISDBSubContext *ctx)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
int csp, cscale;
int w;
int blocklen;
int delta;
if (IS_HORIZONTAL_LAYOUT(ls->format)) {
cscale = ls->font_scale.fscx;
w = ls->font_size * cscale / 100;
csp = ls->cell_spacing.col * cscale / 100;
if (ls->prev_line_bottom == 0 && ls->line_width == 0)
ls->block_offset_h = csp / 2;
blocklen = ls->display_area.w - ls->block_offset_h;
} else {
cscale = ls->font_scale.fscy;
w = ls->font_size * cscale / 100;
csp = ls->cell_spacing.col * cscale / 100;
if (ls->prev_line_bottom == 0 && ls->line_width == 0)
ls->block_offset_v = csp / 2;
blocklen = ls->display_area.h - ls->block_offset_v;
}
if (csp != ls->prev_char_sep)
delta = ((ls->prev_char_sep + 1) / 2 + csp / 2) - ls->prev_char_sep;
else
delta = 0;
// check line break;
// note: at the head of a line, line breaking is useless.
if (ls->line_width != 0 &&
ls->line_width + delta + w > blocklen) {
mp_msg(MSGT_DECSUB, MSGL_V, "auto line break at %lu.\n",
ctx->text.used);
do_line_break(ctx);
} else if (ls->line_width != 0 && delta != 0) {
char tmp[32];
// need to compensate the wrong charsep of the previously added char.
// hack: insert zero-width space with the compensating \fsp. (can be <0)
// note that \fsp is scaled by \fscx in ASS.
tmp[0] = '\0';
av_strlcatf(tmp, sizeof(tmp), "{\\fsp%d}\xe2\x80\x8b{\\fsp%d}",
delta * 100 / cscale, ls->cell_spacing.col);
append_str(ctx, tmp);
ls->line_width += delta;
}
}
static void advance(ISDBSubContext *ctx)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
int cscale;
int h;
int asc, desc;
int csp;
if (IS_HORIZONTAL_LAYOUT(ls->format)) {
cscale = ls->font_scale.fscx;
h = ls->font_size * ls->font_scale.fscy / 100;
if (ls->font_scale.fscy == 200) {
desc = ls->cell_spacing.row / 2;
asc = ls->cell_spacing.row * 2 - desc + h;
} else {
desc = ls->cell_spacing.row * ls->font_scale.fscy / 200;
asc = ls->cell_spacing.row * ls->font_scale.fscy / 100 - desc + h;
}
if (asc > ls->line_height + ls->linesep_upper) {
if (h > ls->line_height)
ls->line_height = h;
ls->linesep_upper = asc - ls->line_height;
} else if (h > ls->line_height) {
ls->linesep_upper = ls->line_height + ls->linesep_upper - h;
ls->line_height = h;
}
if (ls->prev_line_bottom == 0 && ls->linesep_upper > ls->block_offset_v)
ls->block_offset_v = ls->linesep_upper;
if (ls->font_scale.fscy != 50)
ls->shift_baseline = 0;
} else {
int lsp;
cscale = ls->font_scale.fscy;
h = ls->font_size * ls->font_scale.fscx / 100;
lsp = ls->cell_spacing.row * ls->font_scale.fscx / 100;
desc = h / 2 + lsp / 2;
asc = h - h / 2 + lsp - lsp / 2;
if (asc > ls->line_height + ls->linesep_upper) {
if (h - h / 2 > ls->line_height)
ls->line_height = h - h / 2;
ls->linesep_upper = asc - ls->line_height;
} else if (h - h / 2 > ls->line_height) {
ls->linesep_upper = ls->line_height + ls->linesep_upper - h + h / 2;
ls->line_height = h - h / 2;
}
if (ls->prev_line_bottom == 0 && ls->linesep_upper > ls->block_offset_h)
ls->block_offset_h = ls->linesep_upper;
ls->shift_baseline = 0;
}
if (desc > ls->line_desc)
ls->line_desc = desc;
csp = ls->cell_spacing.col * cscale / 100;
ls->line_width += ls->font_size * cscale / 100 + csp;
ls->prev_char_sep = csp;
}
static void forward_position(ISDBSubContext *ctx, int rows, int cols)
{
int i;
for (i = 0; i < rows; i++)
do_line_break(ctx);
for (i = 0; i < cols; i++) {
pre_advance(ctx);
append_str(ctx, "\xe3\x80\x80");
advance(ctx);
}
if (rows > 0 && cols > 0)
ctx->current_state.layout_state.shift_baseline = 1;
}
static const uint8_t *proc_char(ISDBSubContext *ctx,
const uint8_t *buf, int buf_size)
{
struct isdbsub_layout *ls = &ctx->current_state.layout_state;
struct b24str_state *ts = &ctx->current_state.text_state;
unsigned int begin, end;
char *ch = NULL;
begin = end = ctx->text.used;
while (buf_size > 0 && (buf[0] & 0x60) != 0) {
uint8_t c1, c2 = 0;
unsigned char ctype;
c1 = buf[0];
buf ++;
buf_size --;
if ((c1 & 0x7F) != 0x20 && (c1 & 0x7F) != 0x7F) { // not (SP or DEL)
// multi-byte?
if ((ts->ss > 0 && ts->g[ts->ss].mb > 1)
|| (!ts->ss && (c1 & 0x80) && ts->g[ts->gr].mb > 1)
|| (!ts->ss && !(c1 & 0x80) && ts->g[ts->gl].mb > 1)) {
if (buf_size < 1)
return NULL;
c2 = buf[0];
buf ++;
buf_size --;
}
}
if (!ls->in_combining) {
pre_advance(ctx);
begin = end = ctx->text.used;
}
ctype = append_arib_char(ctx, c1, c2);
ts->ss = 0;
if (ctype == 0)
continue;
if (ctype == CODE_X_MACRO) {
mp_msg(MSGT_DECSUB, MSGL_DBG2, "macro 0x%02hhx.\n", c1);
if ((c1 & 0x70) == 0x60) {
c1 &= 0x0F;
proc_ctl(ctx, Default_macro[c1], strlen(Default_macro[c1]));
}
continue;
}
// if non-spacing sequence has terminated,..
if (!ls->in_combining && end - begin > 0 && ctx->text.used > end) {
char tmp[8]; // UTF-8 char is 6bytes at maximum....
unsigned int len;
len = ctx->text.used - end;
if (len > sizeof(tmp)) // for safety.
len = sizeof(tmp);
memcpy(tmp, ctx->text.buf + end, len);
memmove(ctx->text.buf + begin + len, ctx->text.buf + begin, end - begin);
memcpy(ctx->text.buf + begin, tmp, len);
mp_msg(MSGT_DECSUB, MSGL_V,
"moved the terminating spacing char to the head(%d).\n", begin);
}
end = ctx->text.used;
if (ls->in_combining)
continue;
// ls->in_combining == 0
advance(ctx);
// repeat
if (ls->repeat_count >= 0) {
// save the repeating char first.
ch = calloc(1, end - begin + 1);
if (ch)
memcpy(ch, ctx->text.buf + begin, end - begin);
else {
mp_msg(MSGT_DECSUB, MSGL_WARN,
"out of memory for repeating char.\n");
ls->repeat_count = -1;
}
}
if (ls->repeat_count == 0) {
pre_advance(ctx);
while (ls->line_width != 0) {
append_str(ctx, ch);
advance(ctx);
// prepare for the next one.
pre_advance(ctx);
}
} else if (ls->repeat_count > 0) {
while (--ls->repeat_count > 0) {
pre_advance(ctx);
append_str(ctx, ch);
advance(ctx);
}
}
if (ls->repeat_count > -1)
free(ch);
ls->repeat_count = -1;
}
if (buf_size <= 0)
return NULL;
// buf_size > 0 => assert((buf[0] & 0x60) == 0);
return buf;
}
static void process_txt_du(ISDBSubContext *ctx, const uint8_t *buf,
int buf_size)
{
const char *p, *q;
ctx->current_state = ctx->default_states[ctx->lang_tag];
reset_state(&ctx->current_state);
iconv(ctx->iconv, NULL, NULL, NULL, NULL);
p = buf;
while (buf_size > 0) {
q = proc_ctl(ctx, p, buf_size); // update ctx->current_state
if (!q)
break;
buf_size -= q - p;
p = q;
q = proc_char(ctx, p, buf_size); // append to ctx->text
ctx->text.txt_tail = ctx->text.used;
if (!q)
break;
buf_size -= q - p;
p = q;
if (ctx->current_state.need_init)
setup_line_head(ctx);
}
}
static void process_mngmnt_dg(ISDBSubContext *ctx, const uint8_t *buf,
int buf_size)
{
const uint8_t *p = buf;
int lang_num;
int du_loop_len;
int i;
ctx->timing_mode = *(p++) >> 6;
if (ctx->timing_mode == ISDBSUB_TMD_OFFSET) {
ctx->offset.hour = (p[0] >> 4) * 10 + (p[0] & 0x0f);
ctx->offset.min = (p[1] >> 4) * 10 + (p[1] & 0x0f);
ctx->offset.sec = (p[2] >> 4) * 10 + (p[2] & 0x0f);
ctx->offset.ms = (p[3] >> 4) * 100 + (p[3] & 0x0f) * 10 + (p[4] >> 4);
p += 5;
}
lang_num = *(p++);
for (i = 0; i < lang_num; i++) {
int lang_tag = *p >> 5;
int disp_mode = *p & 0x0f;
p++;
if ((disp_mode & 0x0c) == 0x0c)
p++; // skip display condition
p += 3; // skip lang code
if (lang_tag < ISDBSUB_MAX_LANG) {
ISDBSubState *state = &ctx->default_states[lang_tag];
int format;
state->auto_display = disp_mode >> 3;
state->rollup_mode = (*p & 0x03);
format = *p >> 4;
state->layout_state.is_profile_c = (format == 0x0F);
if (state->layout_state.is_profile_c)
format = ISDBSUB_FMT_960H;
if (format < ISDBSUB_FMT_960H || format > ISDBSUB_FMT_720V) {
mp_msg(MSGT_DECSUB, MSGL_INFO,
"illegal format:0x%02x in sub. mngment data.\n", format);
format = ISDBSUB_FMT_960H; // fallback
}
state->layout_state.format = format;
if ((*p & 0x0c) != 0x00)
mp_msg(MSGT_DECSUB, MSGL_WARN,
"char encoding:%d not supported.\n", ((*p & 0x0c) >> 2));
init_layout(&state->layout_state);
reset_state(state);
clear_text(ctx);
}
p++;
}
ctx->current_state = ctx->default_states[ctx->lang_tag];
set_format(ctx);
du_loop_len = AV_RB24(p);
p += 3;
if (p + du_loop_len > buf + buf_size)
du_loop_len = buf + buf_size - p;
while (du_loop_len >= 5) {
int du_size = AV_RB24(p + 2);
if (p[0] != ISDBSUB_UNIT_SEP || du_loop_len < 5 + du_size)
break;
du_loop_len -= (5 + du_size);
// ignore DRCS. only txt data units.
if (p[1] == ISDBSUB_DU_TYPE_TXT) {
memdump(MSGL_DBG2, p + 5, du_size);
process_txt_du(ctx, p + 5, du_size); // control seq. only
// copy back SWF, SDP, SDF,...
ctx->default_states[ctx->lang_tag] = ctx->current_state;
}
p += 5 + du_size;
}
}
static void process_sub_dg(ISDBSubContext *ctx, const uint8_t *buf,
int buf_size)
{
const uint8_t *p = buf;
int du_loop_len;
if (ctx->pts == AV_NOPTS_VALUE) {
mp_msg(MSGT_DECSUB, MSGL_INFO, "no timestamp on subtitle text data.");
return;
}
clear_text(ctx);
setup_line_head(ctx);
ctx->timing_mode = *(p++) >> 6;
// subtitle data should be TMD_FREE (ARIB TR-B15).
if (ctx->timing_mode != ISDBSUB_TMD_FREE) {
ctx->start.hour = (p[0] >> 4) * 10 + (p[0] & 0x0f);
ctx->start.min = (p[1] >> 4) * 10 + (p[1] & 0x0f);
ctx->start.sec = (p[2] >> 4) * 10 + (p[2] & 0x0f);
ctx->start.ms = (p[3] >> 4) * 100 + (p[3] & 0x0f) * 10 + (p[4] >> 4);
if (ctx->timing_mode == ISDBSUB_TMD_OFFSET) {
ctx->start.ms += ctx->offset.ms;
if (ctx->start.ms >= 1000) {
ctx->start.ms -= 1000;
ctx->start.sec ++;
}
ctx->start.sec += ctx->offset.sec;
if (ctx->start.sec >= 60) {
ctx->start.sec -= 60;
ctx->start.min ++;
}
ctx->start.min += ctx->offset.min;
if (ctx->start.min >= 60) {
ctx->start.min -= 60;
ctx->start.hour ++;
}
ctx->start.hour += ctx->offset.hour;
}
p += 5;
}
du_loop_len = AV_RB24(p);
p += 3;
if (p + du_loop_len > buf + buf_size)
du_loop_len = buf + buf_size - p;
while (du_loop_len >= 5) {
int du_size = AV_RB24(p + 2);
if (p[0] != ISDBSUB_UNIT_SEP || du_loop_len < 5 + du_size)
break;
du_loop_len -= (5 + du_size);
// ignore DRCS. only txt data units.
if (p[1] == ISDBSUB_DU_TYPE_TXT) {
memdump(MSGL_DBG2, p + 5, du_size);
process_txt_du(ctx, p + 5, du_size);
}
p += 5 + du_size;
}
append_event(ctx);
}
static int do_init(ISDBSubContext *ctx)
{
int i;
for (i = 65; i < 73; i++)
Default_clut[i] = Default_clut[i - 65] & ~RGBA(0,0,0,128);
for (i = 73; i < 128; i++)
Default_clut[i] = Default_clut[i - 64] & ~RGBA(0,0,0,128);
Crc_table = av_crc_get_table(AV_CRC_16_CCITT);
ctx->last_mngmnt_id = ISDBSUB_NO_DGID;
ctx->last_mngmnt_pts = AV_NOPTS_VALUE;
ctx->iconv = iconv_open("UTF-8", "EUC-JISX0213");
if (ctx->iconv == (iconv_t) -1)
return -1;
return 0;
}
void isdbsub_reset(struct sh_sub *sh)
{
ISDBSubContext *ctx = sh->context;
if (!ctx)
return;
if (ctx->iconv != (iconv_t) -1)
iconv_close(ctx->iconv);
free(ctx->text.buf);
free(ctx->script_info);
free(ctx->events);
free(ctx);
sh->context = NULL;
}
/**
* Decode a ISDB subtitle packet.
* \return < 0 on error, 'a' if further processing is needed
*/
int isdbsub_decode(struct sh_sub *sh, uint8_t **data, int *size,
double *pts, double *endpts)
{
ISDBSubContext *ctx = sh->context;
const uint8_t *buf = *data;
int buf_size = *size;
int64_t orig_pts;
const uint8_t *p, *p_end;
mp_msg(MSGT_DECSUB, MSGL_V, "ISDB sub packet:\n");
memdump(MSGL_DBG2, buf, buf_size);
ass_font_scale = 1.;
if (!ctx) {
ctx = sh->context = calloc(1, sizeof(ISDBSubContext));
if (!sh->context || do_init(sh->context)) {
mp_msg(MSGT_DECSUB, MSGL_WARN,
"Could not initialize codec context.\n");
return -1;
}
}
if (buf_size <= 10 || buf[0] != ISDBSUB_DATA_ID || buf[1] != 0xff) {
mp_msg(MSGT_DECSUB, MSGL_INFO, "incomplete or broken packet\n");
return -1;
}
/* set default output */
*data = NULL;
*size = 0;
orig_pts = (*pts != MP_NOPTS_VALUE) ? *pts * 1000 : AV_NOPTS_VALUE;
ctx->pts = orig_pts;
ctx->duration = 5 * 1000; //temporary.
ctx->lang_tag = sh->cur_lang_tag;
if (orig_pts != AV_NOPTS_VALUE && ctx->last_mngmnt_pts != AV_NOPTS_VALUE) {
int64_t t = orig_pts;
char t1[16], t2[16];
// check pts timeout, but taking PTS wrap-around into account.
if (t < ctx->last_mngmnt_pts &&
(ctx->last_mngmnt_pts - t) > (MPEGTS_MAX_PTS >> 1)) {
mp_msg(MSGT_DECSUB, MSGL_INFO, "PTS wrap-around %s -> %s\n",
pts_to_str(ctx->last_mngmnt_pts, t1), pts_to_str(t, t2));
t += MPEGTS_MAX_PTS;
}
if (t < ctx->last_mngmnt_pts ||
t - ctx->last_mngmnt_pts > ISDBSUB_MGMNT_TIMEOUT) {
mp_msg(MSGT_DECSUB, MSGL_INFO,
"Subtitle Management DataGroup time-out. %s -> %s\n",
pts_to_str(ctx->last_mngmnt_pts, t1), pts_to_str(t, t2));
ctx->last_mngmnt_pts = AV_NOPTS_VALUE;
}
}
p = buf + 3 + (buf[2] & 0x0f);
p_end = buf + buf_size;
while (p_end - p >= 7) {
int dg_id = p[0] >> 2;
int dg_size = AV_RB16(p + 3);
uint32_t crc = 0;
if (p + 5 + dg_size + 2 > p_end ||
(crc = av_crc(Crc_table, 0, p, 5 + dg_size + 2)) != 0) {
mp_msg(MSGT_DECSUB, MSGL_INFO, "incomplete or broken packet. "
"ofs:%ld l:%d crc:0x%04hx\n", p - buf, 5 + dg_size + 2, crc);
return -1;
}
p += 5;
if ((dg_id & 0x0f) == 0) { // subtile management data group
char t1[16];
if (dg_id != ctx->last_mngmnt_id
|| ctx->last_mngmnt_pts == AV_NOPTS_VALUE)
process_mngmnt_dg(ctx, p, dg_size);
else
mp_msg(MSGT_DECSUB, MSGL_DBG2,
"Skip the same subtitle management data group.\n");
ctx->last_mngmnt_id = dg_id;
ctx->last_mngmnt_pts = orig_pts;
mp_msg(MSGT_DECSUB, MSGL_DBG2,
"last_mngmnt_pts set to %s\n", pts_to_str(orig_pts, t1));
} else if ((dg_id & 0x0f) == ctx->lang_tag + 1) { // subtile data group
if (ctx->last_mngmnt_id == ISDBSUB_NO_DGID)
mp_msg(MSGT_DECSUB, MSGL_V, "no management data group received yet.\n");
else if ((dg_id & 0xf0) == ctx->last_mngmnt_id)
process_sub_dg(ctx, p, dg_size);
} else
mp_msg(MSGT_DECSUB, MSGL_DBG2,
"Subtitle data group id 0x%02x, length %d\n", dg_id, dg_size);
p += dg_size + 2;
}
if (orig_pts != AV_NOPTS_VALUE && ctx->last_mngmnt_pts == AV_NOPTS_VALUE) {
ctx->last_mngmnt_pts = orig_pts;
mp_msg(MSGT_DECSUB, MSGL_V,
"replaced empty last_mngmnt_pts with the next received PTS.\n");
}
do_output(ctx, data, size);
if (endpts && orig_pts != AV_NOPTS_VALUE)
*endpts = (ctx->pts + ctx->duration) / 1000.0;
return *data ? 'a' : 0;
}
| Java |
/*
* BSD compression module
*
* Patched version for ISDN syncPPP written 1997/1998 by Michael Hipp
* The whole module is now SKB based.
*
*/
/*
* Update: The Berkeley copyright was changed, and the change
* is retroactive to all "true" BSD software (ie everything
* from UCB as opposed to other peoples code that just carried
* the same license). The new copyright doesn't clash with the
* GPL, so the module-only restriction has been removed..
*/
/*
* Original copyright notice:
*
* Copyright (c) 1985, 1986 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* James A. Woods, derived from original work by Spencer Thomas
* and Joseph Orost.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/interrupt.h>
#include <linux/ptrace.h>
#include <linux/ioport.h>
#include <linux/in.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/errno.h>
#include <linux/string.h> /* used in new tty drivers */
#include <linux/signal.h> /* used in new tty drivers */
#include <linux/bitops.h>
#include <asm/byteorder.h>
#include <asm/types.h>
#include <linux/if.h>
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/inet.h>
#include <linux/ioctl.h>
#include <linux/vmalloc.h>
#include <linux/ppp_defs.h>
#include <linux/isdn.h>
#include <linux/isdn_ppp.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/if_arp.h>
#include <linux/ppp-comp.h>
#include "isdn_ppp.h"
MODULE_DESCRIPTION("ISDN4Linux: BSD Compression for PPP over ISDN");
MODULE_LICENSE("Dual BSD/GPL");
#define BSD_VERSION(x) ((x) >> 5)
#define BSD_NBITS(x) ((x) & 0x1F)
#define BSD_CURRENT_VERSION 1
#define DEBUG 1
/*
* A dictionary for doing BSD compress.
*/
struct bsd_dict {
u32 fcode;
u16 codem1; /* output of hash table -1 */
u16 cptr; /* map code to hash table entry */
};
struct bsd_db {
int totlen; /* length of this structure */
unsigned int hsize; /* size of the hash table */
unsigned char hshift; /* used in hash function */
unsigned char n_bits; /* current bits/code */
unsigned char maxbits; /* maximum bits/code */
unsigned char debug; /* non-zero if debug desired */
unsigned char unit; /* ppp unit number */
u16 seqno; /* sequence # of next packet */
unsigned int mru; /* size of receive (decompress) bufr */
unsigned int maxmaxcode; /* largest valid code */
unsigned int max_ent; /* largest code in use */
unsigned int in_count; /* uncompressed bytes, aged */
unsigned int bytes_out; /* compressed bytes, aged */
unsigned int ratio; /* recent compression ratio */
unsigned int checkpoint; /* when to next check the ratio */
unsigned int clear_count; /* times dictionary cleared */
unsigned int incomp_count; /* incompressible packets */
unsigned int incomp_bytes; /* incompressible bytes */
unsigned int uncomp_count; /* uncompressed packets */
unsigned int uncomp_bytes; /* uncompressed bytes */
unsigned int comp_count; /* compressed packets */
unsigned int comp_bytes; /* compressed bytes */
unsigned short *lens; /* array of lengths of codes */
struct bsd_dict *dict; /* dictionary */
int xmit;
};
#define BSD_OVHD 2 /* BSD compress overhead/packet */
#define MIN_BSD_BITS 9
#define BSD_INIT_BITS MIN_BSD_BITS
#define MAX_BSD_BITS 15
/*
* the next two codes should not be changed lightly, as they must not
* lie within the contiguous general code space.
*/
#define CLEAR 256 /* table clear output code */
#define FIRST 257 /* first free entry */
#define LAST 255
#define MAXCODE(b) ((1 << (b)) - 1)
#define BADCODEM1 MAXCODE(MAX_BSD_BITS)
#define BSD_HASH(prefix, suffix, hshift) ((((unsigned long)(suffix)) << (hshift)) \
^ (unsigned long)(prefix))
#define BSD_KEY(prefix, suffix) ((((unsigned long)(suffix)) << 16) \
+ (unsigned long)(prefix))
#define CHECK_GAP 10000 /* Ratio check interval */
#define RATIO_SCALE_LOG 8
#define RATIO_SCALE (1 << RATIO_SCALE_LOG)
#define RATIO_MAX (0x7fffffff >> RATIO_SCALE_LOG)
/*
* clear the dictionary
*/
static void bsd_clear(struct bsd_db *db)
{
db->clear_count++;
db->max_ent = FIRST - 1;
db->n_bits = BSD_INIT_BITS;
db->bytes_out = 0;
db->in_count = 0;
db->incomp_count = 0;
db->ratio = 0;
db->checkpoint = CHECK_GAP;
}
/*
* If the dictionary is full, then see if it is time to reset it.
*
* Compute the compression ratio using fixed-point arithmetic
* with 8 fractional bits.
*
* Since we have an infinite stream instead of a single file,
* watch only the local compression ratio.
*
* Since both peers must reset the dictionary at the same time even in
* the absence of CLEAR codes (while packets are incompressible), they
* must compute the same ratio.
*/
static int bsd_check(struct bsd_db *db) /* 1=output CLEAR */
{
unsigned int new_ratio;
if (db->in_count >= db->checkpoint)
{
/* age the ratio by limiting the size of the counts */
if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX)
{
db->in_count -= (db->in_count >> 2);
db->bytes_out -= (db->bytes_out >> 2);
}
db->checkpoint = db->in_count + CHECK_GAP;
if (db->max_ent >= db->maxmaxcode)
{
/* Reset the dictionary only if the ratio is worse,
* or if it looks as if it has been poisoned
* by incompressible data.
*
* This does not overflow, because
* db->in_count <= RATIO_MAX.
*/
new_ratio = db->in_count << RATIO_SCALE_LOG;
if (db->bytes_out != 0)
{
new_ratio /= db->bytes_out;
}
if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE)
{
bsd_clear(db);
return 1;
}
db->ratio = new_ratio;
}
}
return 0;
}
/*
* Return statistics.
*/
static void bsd_stats(void *state, struct compstat *stats)
{
struct bsd_db *db = (struct bsd_db *) state;
stats->unc_bytes = db->uncomp_bytes;
stats->unc_packets = db->uncomp_count;
stats->comp_bytes = db->comp_bytes;
stats->comp_packets = db->comp_count;
stats->inc_bytes = db->incomp_bytes;
stats->inc_packets = db->incomp_count;
stats->in_count = db->in_count;
stats->bytes_out = db->bytes_out;
}
/*
* Reset state, as on a CCP ResetReq.
*/
static void bsd_reset(void *state, unsigned char code, unsigned char id,
unsigned char *data, unsigned len,
struct isdn_ppp_resetparams *rsparm)
{
struct bsd_db *db = (struct bsd_db *) state;
bsd_clear(db);
db->seqno = 0;
db->clear_count = 0;
}
/*
* Release the compression structure
*/
static void bsd_free(void *state)
{
struct bsd_db *db = (struct bsd_db *) state;
if (db) {
/*
* Release the dictionary
*/
vfree(db->dict);
db->dict = NULL;
/*
* Release the string buffer
*/
vfree(db->lens);
db->lens = NULL;
/*
* Finally release the structure itself.
*/
kfree(db);
}
}
/*
* Allocate space for a (de) compressor.
*/
static void *bsd_alloc(struct isdn_ppp_comp_data *data)
{
int bits;
unsigned int hsize, hshift, maxmaxcode;
struct bsd_db *db;
int decomp;
static unsigned int htab[][2] = {
{ 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } , { 5003 , 4 } ,
{ 9001 , 5 } , { 18013 , 6 } , { 35023 , 7 } , { 69001 , 8 }
};
if (data->optlen != 1 || data->num != CI_BSD_COMPRESS
|| BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
return NULL;
bits = BSD_NBITS(data->options[0]);
if (bits < 9 || bits > 15)
return NULL;
hsize = htab[bits - 9][0];
hshift = htab[bits - 9][1];
/*
* Allocate the main control structure for this instance.
*/
maxmaxcode = MAXCODE(bits);
db = kzalloc(sizeof(struct bsd_db), GFP_KERNEL);
if (!db)
return NULL;
db->xmit = data->flags & IPPP_COMP_FLAG_XMIT;
decomp = db->xmit ? 0 : 1;
/*
* Allocate space for the dictionary. This may be more than one page in
* length.
*/
db->dict = vmalloc(hsize * sizeof(struct bsd_dict));
if (!db->dict) {
bsd_free(db);
return NULL;
}
/*
* If this is the compression buffer then there is no length data.
* For decompression, the length information is needed as well.
*/
if (!decomp)
db->lens = NULL;
else {
db->lens = vmalloc((maxmaxcode + 1) * sizeof(db->lens[0]));
if (!db->lens) {
bsd_free(db);
return (NULL);
}
}
/*
* Initialize the data information for the compression code
*/
db->totlen = sizeof(struct bsd_db) + (sizeof(struct bsd_dict) * hsize);
db->hsize = hsize;
db->hshift = hshift;
db->maxmaxcode = maxmaxcode;
db->maxbits = bits;
return (void *)db;
}
/*
* Initialize the database.
*/
static int bsd_init(void *state, struct isdn_ppp_comp_data *data, int unit, int debug)
{
struct bsd_db *db = state;
int indx;
int decomp;
if (!state || !data) {
printk(KERN_ERR "isdn_bsd_init: [%d] ERR, state %lx data %lx\n", unit, (long)state, (long)data);
return 0;
}
decomp = db->xmit ? 0 : 1;
if (data->optlen != 1 || data->num != CI_BSD_COMPRESS
|| (BSD_VERSION(data->options[0]) != BSD_CURRENT_VERSION)
|| (BSD_NBITS(data->options[0]) != db->maxbits)
|| (decomp && db->lens == NULL)) {
printk(KERN_ERR "isdn_bsd: %d %d %d %d %lx\n", data->optlen, data->num, data->options[0], decomp, (unsigned long)db->lens);
return 0;
}
if (decomp)
for (indx = LAST; indx >= 0; indx--)
db->lens[indx] = 1;
indx = db->hsize;
while (indx-- != 0) {
db->dict[indx].codem1 = BADCODEM1;
db->dict[indx].cptr = 0;
}
db->unit = unit;
db->mru = 0;
db->debug = 1;
bsd_reset(db, 0, 0, NULL, 0, NULL);
return 1;
}
/*
* Obtain pointers to the various structures in the compression tables
*/
#define dict_ptrx(p, idx) &(p->dict[idx])
#define lens_ptrx(p, idx) &(p->lens[idx])
#ifdef DEBUG
static unsigned short *lens_ptr(struct bsd_db *db, int idx)
{
if ((unsigned int) idx > (unsigned int) db->maxmaxcode) {
printk(KERN_DEBUG "<9>ppp: lens_ptr(%d) > max\n", idx);
idx = 0;
}
return lens_ptrx(db, idx);
}
static struct bsd_dict *dict_ptr(struct bsd_db *db, int idx)
{
if ((unsigned int) idx >= (unsigned int) db->hsize) {
printk(KERN_DEBUG "<9>ppp: dict_ptr(%d) > max\n", idx);
idx = 0;
}
return dict_ptrx(db, idx);
}
#else
#define lens_ptr(db, idx) lens_ptrx(db, idx)
#define dict_ptr(db, idx) dict_ptrx(db, idx)
#endif
/*
* compress a packet
*/
static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out, int proto)
{
struct bsd_db *db;
int hshift;
unsigned int max_ent;
unsigned int n_bits;
unsigned int bitno;
unsigned long accm;
int ent;
unsigned long fcode;
struct bsd_dict *dictp;
unsigned char c;
int hval, disp, ilen, mxcode;
unsigned char *rptr = skb_in->data;
int isize = skb_in->len;
#define OUTPUT(ent) \
{ \
bitno -= n_bits; \
accm |= ((ent) << bitno); \
do { \
if (skb_out && skb_tailroom(skb_out) > 0) \
*(skb_put(skb_out, 1)) = (unsigned char)(accm >> 24); \
accm <<= 8; \
bitno += 8; \
} while (bitno <= 24); \
}
/*
* If the protocol is not in the range we're interested in,
* just return without compressing the packet. If it is,
* the protocol becomes the first byte to compress.
*/
printk(KERN_DEBUG "bsd_compress called with %x\n", proto);
ent = proto;
if (proto < 0x21 || proto > 0xf9 || !(proto & 0x1))
return 0;
db = (struct bsd_db *) state;
hshift = db->hshift;
max_ent = db->max_ent;
n_bits = db->n_bits;
bitno = 32;
accm = 0;
mxcode = MAXCODE(n_bits);
/* This is the PPP header information */
if (skb_out && skb_tailroom(skb_out) >= 2) {
char *v = skb_put(skb_out, 2);
/* we only push our own data on the header,
AC,PC and protos is pushed by caller */
v[0] = db->seqno >> 8;
v[1] = db->seqno;
}
ilen = ++isize; /* This is off by one, but that is what is in draft! */
while (--ilen > 0) {
c = *rptr++;
fcode = BSD_KEY(ent, c);
hval = BSD_HASH(ent, c, hshift);
dictp = dict_ptr(db, hval);
/* Validate and then check the entry. */
if (dictp->codem1 >= max_ent)
goto nomatch;
if (dictp->fcode == fcode) {
ent = dictp->codem1 + 1;
continue; /* found (prefix,suffix) */
}
/* continue probing until a match or invalid entry */
disp = (hval == 0) ? 1 : hval;
do {
hval += disp;
if (hval >= db->hsize)
hval -= db->hsize;
dictp = dict_ptr(db, hval);
if (dictp->codem1 >= max_ent)
goto nomatch;
} while (dictp->fcode != fcode);
ent = dictp->codem1 + 1; /* finally found (prefix,suffix) */
continue;
nomatch:
OUTPUT(ent); /* output the prefix */
/* code -> hashtable */
if (max_ent < db->maxmaxcode) {
struct bsd_dict *dictp2;
struct bsd_dict *dictp3;
int indx;
/* expand code size if needed */
if (max_ent >= mxcode) {
db->n_bits = ++n_bits;
mxcode = MAXCODE(n_bits);
}
/*
* Invalidate old hash table entry using
* this code, and then take it over.
*/
dictp2 = dict_ptr(db, max_ent + 1);
indx = dictp2->cptr;
dictp3 = dict_ptr(db, indx);
if (dictp3->codem1 == max_ent)
dictp3->codem1 = BADCODEM1;
dictp2->cptr = hval;
dictp->codem1 = max_ent;
dictp->fcode = fcode;
db->max_ent = ++max_ent;
if (db->lens) {
unsigned short *len1 = lens_ptr(db, max_ent);
unsigned short *len2 = lens_ptr(db, ent);
*len1 = *len2 + 1;
}
}
ent = c;
}
OUTPUT(ent); /* output the last code */
if (skb_out)
db->bytes_out += skb_out->len; /* Do not count bytes from here */
db->uncomp_bytes += isize;
db->in_count += isize;
++db->uncomp_count;
++db->seqno;
if (bitno < 32)
++db->bytes_out; /* must be set before calling bsd_check */
/*
* Generate the clear command if needed
*/
if (bsd_check(db))
OUTPUT(CLEAR);
/*
* Pad dribble bits of last code with ones.
* Do not emit a completely useless byte of ones.
*/
if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0)
*(skb_put(skb_out, 1)) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24);
/*
* Increase code size if we would have without the packet
* boundary because the decompressor will do so.
*/
if (max_ent >= mxcode && max_ent < db->maxmaxcode)
db->n_bits++;
/* If output length is too large then this is an incompressible frame. */
if (!skb_out || (skb_out && skb_out->len >= skb_in->len)) {
++db->incomp_count;
db->incomp_bytes += isize;
return 0;
}
/* Count the number of compressed frames */
++db->comp_count;
db->comp_bytes += skb_out->len;
return skb_out->len;
#undef OUTPUT
}
/*
* Update the "BSD Compress" dictionary on the receiver for
* incompressible data by pretending to compress the incoming data.
*/
static void bsd_incomp(void *state, struct sk_buff *skb_in, int proto)
{
bsd_compress(state, skb_in, NULL, proto);
}
/*
* Decompress "BSD Compress".
*/
static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *skb_out,
struct isdn_ppp_resetparams *rsparm)
{
struct bsd_db *db;
unsigned int max_ent;
unsigned long accm;
unsigned int bitno; /* 1st valid bit in accm */
unsigned int n_bits;
unsigned int tgtbitno; /* bitno when we have a code */
struct bsd_dict *dictp;
int seq;
unsigned int incode;
unsigned int oldcode;
unsigned int finchar;
unsigned char *p, *ibuf;
int ilen;
int codelen;
int extra;
db = (struct bsd_db *) state;
max_ent = db->max_ent;
accm = 0;
bitno = 32; /* 1st valid bit in accm */
n_bits = db->n_bits;
tgtbitno = 32 - n_bits; /* bitno when we have a code */
printk(KERN_DEBUG "bsd_decompress called\n");
if (!skb_in || !skb_out) {
printk(KERN_ERR "bsd_decompress called with NULL parameter\n");
return DECOMP_ERROR;
}
/*
* Get the sequence number.
*/
if ((p = skb_pull(skb_in, 2)) == NULL) {
return DECOMP_ERROR;
}
p -= 2;
seq = (p[0] << 8) + p[1];
ilen = skb_in->len;
ibuf = skb_in->data;
/*
* Check the sequence number and give up if it differs from
* the value we're expecting.
*/
if (seq != db->seqno) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: bad sequence # %d, expected %d\n",
db->unit, seq, db->seqno - 1);
}
return DECOMP_ERROR;
}
++db->seqno;
db->bytes_out += ilen;
if (skb_tailroom(skb_out) > 0)
*(skb_put(skb_out, 1)) = 0;
else
return DECOMP_ERR_NOMEM;
oldcode = CLEAR;
/*
* Keep the checkpoint correctly so that incompressible packets
* clear the dictionary at the proper times.
*/
for (;;) {
if (ilen-- <= 0) {
db->in_count += (skb_out->len - 1); /* don't count the header */
break;
}
/*
* Accumulate bytes until we have a complete code.
* Then get the next code, relying on the 32-bit,
* unsigned accm to mask the result.
*/
bitno -= 8;
accm |= *ibuf++ << bitno;
if (tgtbitno < bitno)
continue;
incode = accm >> tgtbitno;
accm <<= n_bits;
bitno += n_bits;
/*
* The dictionary must only be cleared at the end of a packet.
*/
if (incode == CLEAR) {
if (ilen > 0) {
if (db->debug)
printk(KERN_DEBUG "bsd_decomp%d: bad CLEAR\n", db->unit);
return DECOMP_FATALERROR; /* probably a bug */
}
bsd_clear(db);
break;
}
if ((incode > max_ent + 2) || (incode > db->maxmaxcode)
|| (incode > max_ent && oldcode == CLEAR)) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: bad code 0x%x oldcode=0x%x ",
db->unit, incode, oldcode);
printk(KERN_DEBUG "max_ent=0x%x skb->Len=%d seqno=%d\n",
max_ent, skb_out->len, db->seqno);
}
return DECOMP_FATALERROR; /* probably a bug */
}
/* Special case for KwKwK string. */
if (incode > max_ent) {
finchar = oldcode;
extra = 1;
} else {
finchar = incode;
extra = 0;
}
codelen = *(lens_ptr(db, finchar));
if (skb_tailroom(skb_out) < codelen + extra) {
if (db->debug) {
printk(KERN_DEBUG "bsd_decomp%d: ran out of mru\n", db->unit);
#ifdef DEBUG
printk(KERN_DEBUG " len=%d, finchar=0x%x, codelen=%d,skblen=%d\n",
ilen, finchar, codelen, skb_out->len);
#endif
}
return DECOMP_FATALERROR;
}
/*
* Decode this code and install it in the decompressed buffer.
*/
p = skb_put(skb_out, codelen);
p += codelen;
while (finchar > LAST) {
struct bsd_dict *dictp2 = dict_ptr(db, finchar);
dictp = dict_ptr(db, dictp2->cptr);
#ifdef DEBUG
if (--codelen <= 0 || dictp->codem1 != finchar - 1) {
if (codelen <= 0) {
printk(KERN_ERR "bsd_decomp%d: fell off end of chain ", db->unit);
printk(KERN_ERR "0x%x at 0x%x by 0x%x, max_ent=0x%x\n", incode, finchar, dictp2->cptr, max_ent);
} else {
if (dictp->codem1 != finchar - 1) {
printk(KERN_ERR "bsd_decomp%d: bad code chain 0x%x finchar=0x%x ", db->unit, incode, finchar);
printk(KERN_ERR "oldcode=0x%x cptr=0x%x codem1=0x%x\n", oldcode, dictp2->cptr, dictp->codem1);
}
}
return DECOMP_FATALERROR;
}
#endif
{
u32 fcode = dictp->fcode;
*--p = (fcode >> 16) & 0xff;
finchar = fcode & 0xffff;
}
}
*--p = finchar;
#ifdef DEBUG
if (--codelen != 0)
printk(KERN_ERR "bsd_decomp%d: short by %d after code 0x%x, max_ent=0x%x\n", db->unit, codelen, incode, max_ent);
#endif
if (extra) /* the KwKwK case again */
*(skb_put(skb_out, 1)) = finchar;
/*
* If not first code in a packet, and
* if not out of code space, then allocate a new code.
*
* Keep the hash table correct so it can be used
* with uncompressed packets.
*/
if (oldcode != CLEAR && max_ent < db->maxmaxcode) {
struct bsd_dict *dictp2, *dictp3;
u16 *lens1, *lens2;
unsigned long fcode;
int hval, disp, indx;
fcode = BSD_KEY(oldcode, finchar);
hval = BSD_HASH(oldcode, finchar, db->hshift);
dictp = dict_ptr(db, hval);
/* look for a free hash table entry */
if (dictp->codem1 < max_ent) {
disp = (hval == 0) ? 1 : hval;
do {
hval += disp;
if (hval >= db->hsize)
hval -= db->hsize;
dictp = dict_ptr(db, hval);
} while (dictp->codem1 < max_ent);
}
/*
* Invalidate previous hash table entry
* assigned this code, and then take it over
*/
dictp2 = dict_ptr(db, max_ent + 1);
indx = dictp2->cptr;
dictp3 = dict_ptr(db, indx);
if (dictp3->codem1 == max_ent)
dictp3->codem1 = BADCODEM1;
dictp2->cptr = hval;
dictp->codem1 = max_ent;
dictp->fcode = fcode;
db->max_ent = ++max_ent;
/* Update the length of this string. */
lens1 = lens_ptr(db, max_ent);
lens2 = lens_ptr(db, oldcode);
*lens1 = *lens2 + 1;
/* Expand code size if needed. */
if (max_ent >= MAXCODE(n_bits) && max_ent < db->maxmaxcode) {
db->n_bits = ++n_bits;
tgtbitno = 32-n_bits;
}
}
oldcode = incode;
}
++db->comp_count;
++db->uncomp_count;
db->comp_bytes += skb_in->len - BSD_OVHD;
db->uncomp_bytes += skb_out->len;
if (bsd_check(db)) {
if (db->debug)
printk(KERN_DEBUG "bsd_decomp%d: peer should have cleared dictionary on %d\n",
db->unit, db->seqno - 1);
}
return skb_out->len;
}
/*************************************************************
* Table of addresses for the BSD compression module
*************************************************************/
static struct isdn_ppp_compressor ippp_bsd_compress = {
.owner = THIS_MODULE,
.num = CI_BSD_COMPRESS,
.alloc = bsd_alloc,
.free = bsd_free,
.init = bsd_init,
.reset = bsd_reset,
.compress = bsd_compress,
.decompress = bsd_decompress,
.incomp = bsd_incomp,
.stat = bsd_stats,
};
/*************************************************************
* Module support routines
*************************************************************/
static int __init isdn_bsdcomp_init(void)
{
int answer = isdn_ppp_register_compressor(&ippp_bsd_compress);
if (answer == 0)
printk(KERN_INFO "PPP BSD Compression module registered\n");
return answer;
}
static void __exit isdn_bsdcomp_exit(void)
{
isdn_ppp_unregister_compressor(&ippp_bsd_compress);
}
module_init(isdn_bsdcomp_init);
module_exit(isdn_bsdcomp_exit);
| Java |
<?php # -*- coding: utf-8 -*-
namespace W2M\Test\Unit\Import\Iterator;
use
W2M\Import\Iterator,
W2M\Test\Helper,
SimpleXMLElement;
class TermIteratorTest extends Helper\MonkeyTestCase {
public function test_current() {
/**
* there are problems when mocking SimpleXMLELement
*
* @link https://github.com/sebastianbergmann/phpunit-mock-objects/issues/141
*/
$sxml = new SimpleXMLElement( '<root/>' );
$iterator_mock = $this->mock_builder->iterator_simple_xml_item_wrapper();
$parser_mock = $this->mock_builder->service_term_parser_interface();
$import_term_mock = $this->mock_builder->type_wp_import_term();
$iterator_mock->expects( $this->once() )
->method( 'current' )
->willReturn( $sxml );
$parser_mock->expects( $this->once() )
->method( 'parse_term' )
->with( $sxml )
->willReturn( $import_term_mock );
$testee = new Iterator\TermIterator(
$iterator_mock,
$parser_mock
);
$this->assertSame(
$import_term_mock,
$testee->current()
);
}
}
| Java |
// Copyright (c) 2016- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "base/basictypes.h"
#include "Common/Log.h"
#include "Common/Vulkan/VulkanContext.h"
#include "GPU/Vulkan/VulkanUtil.h"
Vulkan2D::Vulkan2D(VulkanContext *vulkan) : vulkan_(vulkan) {
InitDeviceObjects();
}
Vulkan2D::~Vulkan2D() {
DestroyDeviceObjects();
}
void Vulkan2D::Shutdown() {
DestroyDeviceObjects();
}
void Vulkan2D::DestroyDeviceObjects() {
for (int i = 0; i < vulkan_->GetInflightFrames(); i++) {
if (frameData_[i].descPool != VK_NULL_HANDLE) {
vulkan_->Delete().QueueDeleteDescriptorPool(frameData_[i].descPool);
frameData_[i].descPool = VK_NULL_HANDLE;
}
}
for (auto it : pipelines_) {
vulkan_->Delete().QueueDeletePipeline(it.second);
}
pipelines_.clear();
VkDevice device = vulkan_->GetDevice();
if (descriptorSetLayout_ != VK_NULL_HANDLE) {
vkDestroyDescriptorSetLayout(device, descriptorSetLayout_, nullptr);
descriptorSetLayout_ = VK_NULL_HANDLE;
}
if (pipelineLayout_ != VK_NULL_HANDLE) {
vkDestroyPipelineLayout(device, pipelineLayout_, nullptr);
pipelineLayout_ = VK_NULL_HANDLE;
}
// pipelineBasicTex_ and pipelineBasicTex_ come from vulkan2D_.
if (pipelineCache_ != VK_NULL_HANDLE) {
vulkan_->Delete().QueueDeletePipelineCache(pipelineCache_);
pipelineCache_ = VK_NULL_HANDLE;
}
}
void Vulkan2D::InitDeviceObjects() {
pipelineCache_ = vulkan_->CreatePipelineCache();
// All resources we need for PSP drawing. Usually only bindings 0 and 2-4 are populated.
VkDescriptorSetLayoutBinding bindings[2] = {};
bindings[0].descriptorCount = 1;
bindings[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
bindings[0].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
bindings[0].binding = 0;
bindings[1].descriptorCount = 1;
bindings[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
bindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
bindings[1].binding = 1;
VkDevice device = vulkan_->GetDevice();
VkDescriptorSetLayoutCreateInfo dsl = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO };
dsl.bindingCount = 2;
dsl.pBindings = bindings;
VkResult res = vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_);
assert(VK_SUCCESS == res);
VkDescriptorPoolSize dpTypes[1];
dpTypes[0].descriptorCount = 3000;
dpTypes[0].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
VkDescriptorPoolCreateInfo dp = { VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO };
dp.flags = 0; // Don't want to mess around with individually freeing these, let's go fixed each frame and zap the whole array. Might try the dynamic approach later.
dp.maxSets = 3000;
dp.pPoolSizes = dpTypes;
dp.poolSizeCount = ARRAY_SIZE(dpTypes);
for (int i = 0; i < ARRAY_SIZE(frameData_); i++) {
VkResult res = vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frameData_[i].descPool);
assert(VK_SUCCESS == res);
}
VkPushConstantRange push = {};
push.offset = 0;
push.size = 16;
push.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
VkPipelineLayoutCreateInfo pl = { VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO };
pl.pPushConstantRanges = &push;
pl.pushConstantRangeCount = 1;
pl.setLayoutCount = 1;
pl.pSetLayouts = &descriptorSetLayout_;
pl.flags = 0;
res = vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_);
assert(VK_SUCCESS == res);
}
void Vulkan2D::DeviceLost() {
DestroyDeviceObjects();
}
void Vulkan2D::DeviceRestore(VulkanContext *vulkan) {
vulkan_ = vulkan;
InitDeviceObjects();
}
void Vulkan2D::BeginFrame() {
int curFrame = vulkan_->GetCurFrame();
FrameData &frame = frameData_[curFrame];
frame.descSets.clear();
vkResetDescriptorPool(vulkan_->GetDevice(), frame.descPool, 0);
}
void Vulkan2D::EndFrame() {
}
VkDescriptorSet Vulkan2D::GetDescriptorSet(VkImageView tex1, VkSampler sampler1, VkImageView tex2, VkSampler sampler2) {
DescriptorSetKey key;
key.imageView[0] = tex1;
key.imageView[1] = tex2;
key.sampler[0] = sampler1;
key.sampler[1] = sampler2;
int curFrame = vulkan_->GetCurFrame();
FrameData *frame = &frameData_[curFrame];
auto iter = frame->descSets.find(key);
if (iter != frame->descSets.end()) {
return iter->second;
}
// Didn't find one in the frame descriptor set cache, let's make a new one.
// We wipe the cache on every frame.
VkDescriptorSet desc;
VkDescriptorSetAllocateInfo descAlloc = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO };
descAlloc.pSetLayouts = &descriptorSetLayout_;
descAlloc.descriptorPool = frame->descPool;
descAlloc.descriptorSetCount = 1;
VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc);
assert(result == VK_SUCCESS);
// We just don't write to the slots we don't care about.
VkWriteDescriptorSet writes[2];
memset(writes, 0, sizeof(writes));
// Main and sub textures
int n = 0;
VkDescriptorImageInfo image1 = {};
VkDescriptorImageInfo image2 = {};
if (tex1) {
// TODO: Also support LAYOUT_GENERAL to be able to texture from framebuffers without transitioning them?
image1.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
image1.imageView = tex1;
image1.sampler = sampler1;
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writes[n].dstBinding = 0;
writes[n].pImageInfo = &image1;
writes[n].descriptorCount = 1;
writes[n].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
writes[n].dstSet = desc;
n++;
}
if (tex2) {
// TODO: Also support LAYOUT_GENERAL to be able to texture from framebuffers without transitioning them?
image2.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
image2.imageView = tex2;
image2.sampler = sampler2;
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writes[n].dstBinding = 1;
writes[n].pImageInfo = &image2;
writes[n].descriptorCount = 1;
writes[n].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
writes[n].dstSet = desc;
n++;
}
vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr);
frame->descSets[key] = desc;
return desc;
}
VkPipeline Vulkan2D::GetPipeline(VkRenderPass rp, VkShaderModule vs, VkShaderModule fs, bool readVertices, VK2DDepthStencilMode depthStencilMode) {
PipelineKey key;
key.vs = vs;
key.fs = fs;
key.rp = rp;
key.depthStencilMode = depthStencilMode;
key.readVertices = readVertices;
auto iter = pipelines_.find(key);
if (iter != pipelines_.end()) {
return iter->second;
}
VkPipelineColorBlendAttachmentState blend0 = {};
blend0.blendEnable = false;
blend0.colorWriteMask = depthStencilMode == VK2DDepthStencilMode::STENCIL_REPLACE_ALWAYS ? VK_COLOR_COMPONENT_A_BIT : 0xF;
VkPipelineColorBlendStateCreateInfo cbs = { VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO };
cbs.pAttachments = &blend0;
cbs.attachmentCount = 1;
cbs.logicOpEnable = false;
VkPipelineDepthStencilStateCreateInfo dss = { VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO };
dss.depthBoundsTestEnable = false;
dss.depthTestEnable = false;
dss.stencilTestEnable = false;
switch (depthStencilMode) {
case VK2DDepthStencilMode::NONE:
break;
case VK2DDepthStencilMode::STENCIL_REPLACE_ALWAYS:
dss.stencilTestEnable = true;
dss.front.reference = 0xFF;
dss.front.compareMask = 0xFF;
dss.front.compareOp = VK_COMPARE_OP_ALWAYS;
dss.front.depthFailOp = VK_STENCIL_OP_REPLACE;
dss.front.failOp = VK_STENCIL_OP_REPLACE;
dss.front.passOp = VK_STENCIL_OP_REPLACE;
dss.back = dss.front;
break;
}
VkDynamicState dynamicStates[5];
int numDyn = 0;
dynamicStates[numDyn++] = VK_DYNAMIC_STATE_SCISSOR;
dynamicStates[numDyn++] = VK_DYNAMIC_STATE_VIEWPORT;
if (depthStencilMode == VK2DDepthStencilMode::STENCIL_REPLACE_ALWAYS) {
dynamicStates[numDyn++] = VK_DYNAMIC_STATE_STENCIL_WRITE_MASK;
dynamicStates[numDyn++] = VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK;
dynamicStates[numDyn++] = VK_DYNAMIC_STATE_STENCIL_REFERENCE;
}
VkPipelineDynamicStateCreateInfo ds = { VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO };
ds.pDynamicStates = dynamicStates;
ds.dynamicStateCount = numDyn;
VkPipelineRasterizationStateCreateInfo rs = { VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO };
rs.lineWidth = 1.0f;
VkPipelineMultisampleStateCreateInfo ms = { VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO };
ms.rasterizationSamples = VK_SAMPLE_COUNT_1_BIT;
VkPipelineShaderStageCreateInfo ss[2] = {};
ss[0].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
ss[0].stage = VK_SHADER_STAGE_VERTEX_BIT;
ss[0].module = vs;
ss[0].pName = "main";
ss[0].flags = 0;
ss[1].sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
ss[1].stage = VK_SHADER_STAGE_FRAGMENT_BIT;
ss[1].module = fs;
ss[1].pName = "main";
ss[1].flags = 0;
VkPipelineInputAssemblyStateCreateInfo inputAssembly = { VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO };
inputAssembly.flags = 0;
inputAssembly.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
inputAssembly.primitiveRestartEnable = true;
VkVertexInputAttributeDescription attrs[2];
int attributeCount = 2;
attrs[0].binding = 0;
attrs[0].format = VK_FORMAT_R32G32B32_SFLOAT;
attrs[0].location = 0;
attrs[0].offset = 0;
attrs[1].binding = 0;
attrs[1].format = VK_FORMAT_R32G32_SFLOAT;
attrs[1].location = 1;
attrs[1].offset = 12;
int vertexStride = 12 + 8;
VkVertexInputBindingDescription ibd = {};
ibd.binding = 0;
ibd.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
ibd.stride = vertexStride;
VkPipelineVertexInputStateCreateInfo vis = { VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO };
vis.vertexBindingDescriptionCount = readVertices ? 1 : 0;
vis.pVertexBindingDescriptions = readVertices ? &ibd : nullptr;
vis.vertexAttributeDescriptionCount = readVertices ? attributeCount : 0;
vis.pVertexAttributeDescriptions = readVertices ? attrs : nullptr;
VkPipelineViewportStateCreateInfo views = { VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO };
views.viewportCount = 1;
views.scissorCount = 1;
views.pViewports = nullptr; // dynamic
views.pScissors = nullptr; // dynamic
VkGraphicsPipelineCreateInfo pipe = { VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO };
pipe.flags = 0;
pipe.stageCount = 2;
pipe.pStages = ss;
pipe.basePipelineIndex = 0;
pipe.pColorBlendState = &cbs;
pipe.pDepthStencilState = &dss;
pipe.pRasterizationState = &rs;
pipe.pVertexInputState = &vis;
pipe.pViewportState = &views;
pipe.pTessellationState = nullptr;
pipe.pDynamicState = &ds;
pipe.pInputAssemblyState = &inputAssembly;
pipe.pMultisampleState = &ms;
pipe.layout = pipelineLayout_;
pipe.basePipelineHandle = VK_NULL_HANDLE;
pipe.basePipelineIndex = 0;
pipe.renderPass = rp;
pipe.subpass = 0;
VkPipeline pipeline;
VkResult result = vkCreateGraphicsPipelines(vulkan_->GetDevice(), pipelineCache_, 1, &pipe, nullptr, &pipeline);
if (result == VK_SUCCESS) {
pipelines_[key] = pipeline;
return pipeline;
} else {
return VK_NULL_HANDLE;
}
}
VkShaderModule CompileShaderModule(VulkanContext *vulkan, VkShaderStageFlagBits stage, const char *code, std::string *error) {
std::vector<uint32_t> spirv;
bool success = GLSLtoSPV(stage, code, spirv, error);
if (!error->empty()) {
if (success) {
ERROR_LOG(G3D, "Warnings in shader compilation!");
} else {
ERROR_LOG(G3D, "Error in shader compilation!");
}
ERROR_LOG(G3D, "Messages: %s", error->c_str());
ERROR_LOG(G3D, "Shader source:\n%s", code);
OutputDebugStringUTF8("Messages:\n");
OutputDebugStringUTF8(error->c_str());
return VK_NULL_HANDLE;
} else {
VkShaderModule module;
if (vulkan->CreateShaderModule(spirv, &module)) {
return module;
} else {
return VK_NULL_HANDLE;
}
}
}
| Java |
'use strict';
angular.module('sbAdminApp')
.controller('CustomerListCtrl', function ($scope, $http, $rootScope, $stateParams, $location) {
$scope.page = {itemsPerPage: 20};
$scope.iForm = {pageSize : $scope.page.itemsPerPage};
$scope.showLevel = true;
if ($stateParams.searchFounder == 1) {
$scope.searchFounder = true;
}
$scope.level = $stateParams.level;
if ($stateParams.page) {
$scope.iForm.page = parseInt($stateParams.page);
}
$http.get("/org/customer/level-enumeration")
.success(function (data) {
$scope.levels = data;
});
$http.get("/org/customer/status-enumeration")
.success(function (data) {
$scope.statuses = data;
});
$http({
url: "/org/team/all",
method: "GET"
})
.success(function (data) {
$scope.teams = data;
});
$http({
url: "/org/customer/list",
method: "GET",
params: $scope.iForm
})
.success(function (data) {
$scope.items = data.content;
$scope.page.totalItems = data.total;
$scope.page.currentPage = data.page + 1;
});
$scope.pageChanged = function() {
$scope.iForm.page = $scope.page.currentPage - 1;
$location.search($scope.iForm);
}
$scope.search = function () {
$scope.iForm.page = 0;
$location.search($scope.iForm);
}
}); | Java |
.itemmoex{
float: left;
padding: 10px;
}
.moexname {
float:left;
}
.moexvalue {
float: left;
font-size: 24px;
line-height: 30px;
margin-left: 10px;
}
.moexdif {
float: left;
clear: left;
margin-left: 40px;
}
.moexlegend {
clear: left;
font-size: 12px;
color:#999;
margin: 0 0 3px 46px;
}
| Java |
#!/bin/bash
for f in sml/*.sml; do { time ../bin/yasmin $f ; } 2>&1 | tee logs/$f.txt ; done
exit
| Java |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <time.h>
int main(void)
{
int handle;
char msg[] = "This is a test";
char ch[50];
int n;
/* create a file */
handle = open("hello.txt", O_CREAT | O_RDWR, 0777);
/* write some data to the file */
write(handle, msg, strlen(msg));
/* seek to the beginning of the file */
lseek(handle, 0L, SEEK_SET);
/* reads chars from the file until we hit EOF */
/* do
{
read(handle, &ch, 1);
printf("%c", ch);
}while(ch != EOF);*/
while((n= read(handle, ch, 50)) > 0)
{
ch[n]='\0';
printf("%s\n", ch);
sleep(1);
}
close(handle);
return 0;
}
| Java |
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
/**
* Add meta boxes to selected post types
*/
function bpg_add_meta_box() {
$post_types = bpg_allowed_post_types();
if ( ! $post_types )
return;
foreach ( $post_types as $post_type => $status ) {
add_meta_box( 'bpg', apply_filters( 'bpg_meta_box_title', __( 'Photo Gallery', 'better-photo-gallery' ) ), 'bpg_metabox', $post_type, apply_filters( 'bpg_meta_box_context', 'normal' ), apply_filters( 'bpg_meta_box_priority', 'low' ) );
}
}
add_action( 'add_meta_boxes', 'bpg_add_meta_box' );
/**
* Render gallery metabox
*/
function bpg_metabox() {
global $post;
?>
<div id="gallery_images_container">
<ul class="gallery_images">
<?php
$image_gallery = get_post_meta( $post->ID, '_bpg', true );
$attachments = array_filter( explode( ',', $image_gallery ) );
if ( $attachments )
foreach ( $attachments as $attachment_id ) {
echo '<li class="image attachment details" data-attachment_id="' . $attachment_id . '"><div class="attachment-preview"><div class="thumbnail">
' . wp_get_attachment_image( $attachment_id, 'thumbnail' ) . '</div>
<a href="#" class="delete check" title="' . __( 'Remove image', 'better-photo-gallery' ) . '"><div class="media-modal-icon"></div></a>
</div></li>';
} ?>
</ul>
<input type="hidden" id="image_gallery" name="image_gallery" value="<?php echo esc_attr( $image_gallery ); ?>" />
<?php wp_nonce_field( 'bpg', 'bpg' ); ?>
</div>
<p class="add_gallery_images hide-if-no-js">
<a href="#"><?php _e( 'Add images to the gallery', 'better-photo-gallery' ); ?></a>
</p>
<?php
// options don't exist yet, set to checked by default
if ( ! get_post_meta( get_the_ID(), '_bpg_link_images', true ) )
$checked = ' checked="checked"';
else
$checked = bpg_has_linked_images() ? checked( get_post_meta( get_the_ID(), '_bpg_link_images', true ), 'on', false ) : '';
?>
<p>
<label for="bpg_link_images">
<input type="checkbox" id="bpg_link_images" value="on" name="bpg_link_images"<?php echo $checked; ?> /> <?php _e( 'Link images to larger sizes', 'better-photo-gallery' )?>
</label>
</p>
<?php
/**
* JavaScript Gallery
*/
?>
<script type="text/javascript">
jQuery(document).ready(function($){
// Uploading files
var image_gallery_frame;
var $image_gallery_ids = $('#image_gallery');
var $gallery_images = $('#gallery_images_container ul.gallery_images');
jQuery('.add_gallery_images').on( 'click', 'a', function( event ) {
var $el = $(this);
var attachment_ids = $image_gallery_ids.val();
event.preventDefault();
// If the media frame already exists, reopen it.
if ( image_gallery_frame ) {
image_gallery_frame.open();
return;
}
// Create the media frame.
image_gallery_frame = wp.media.frames.downloadable_file = wp.media({
// Set the title of the modal.
title: '<?php _e( 'Add Images to Gallery', 'better-photo-gallery' ); ?>',
button: {
text: '<?php _e( 'Add to gallery', 'better-photo-gallery' ); ?>',
},
multiple: true
});
// When an image is selected, run a callback.
image_gallery_frame.on( 'select', function() {
var selection = image_gallery_frame.state().get('selection');
selection.map( function( attachment ) {
attachment = attachment.toJSON();
if ( attachment.id ) {
attachment_ids = attachment_ids ? attachment_ids + "," + attachment.id : attachment.id;
$gallery_images.append('\
<li class="image attachment details" data-attachment_id="' + attachment.id + '">\
<div class="attachment-preview">\
<div class="thumbnail">\
<img src="' + attachment.url + '" />\
</div>\
<a href="#" class="delete check" title="<?php _e( 'Remove image', 'better-photo-gallery' ); ?>"><div class="media-modal-icon"></div></a>\
</div>\
</li>');
}
} );
$image_gallery_ids.val( attachment_ids );
});
// Finally, open the modal.
image_gallery_frame.open();
});
// Image ordering
$gallery_images.sortable({
items: 'li.image',
cursor: 'move',
scrollSensitivity:40,
forcePlaceholderSize: true,
forceHelperSize: false,
helper: 'clone',
opacity: 0.65,
placeholder: 'eig-metabox-sortable-placeholder',
start:function(event,ui){
ui.item.css('background-color','#f6f6f6');
},
stop:function(event,ui){
ui.item.removeAttr('style');
},
update: function(event, ui) {
var attachment_ids = '';
$('#gallery_images_container ul li.image').css('cursor','default').each(function() {
var attachment_id = jQuery(this).attr( 'data-attachment_id' );
attachment_ids = attachment_ids + attachment_id + ',';
});
$image_gallery_ids.val( attachment_ids );
}
});
// Remove images
$('#gallery_images_container').on( 'click', 'a.delete', function() {
$(this).closest('li.image').remove();
var attachment_ids = '';
$('#gallery_images_container ul li.image').css('cursor','default').each(function() {
var attachment_id = jQuery(this).attr( 'data-attachment_id' );
attachment_ids = attachment_ids + attachment_id + ',';
});
$image_gallery_ids.val( attachment_ids );
return false;
} );
});
</script>
<?php
}
/**
* Save function
*/
function bpg_save_post( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
$post_types = bpg_allowed_post_types();
// check user permissions
if ( isset( $_POST[ 'post_type' ] ) && !array_key_exists( $_POST[ 'post_type' ], $post_types ) ) {
if ( !current_user_can( 'edit_page', $post_id ) )
return;
}
else {
if ( !current_user_can( 'edit_post', $post_id ) )
return;
}
if ( ! isset( $_POST[ 'bpg' ] ) || ! wp_verify_nonce( $_POST[ 'bpg' ], 'bpg' ) )
return;
if ( isset( $_POST[ 'image_gallery' ] ) && !empty( $_POST[ 'image_gallery' ] ) ) {
$attachment_ids = sanitize_text_field( $_POST['image_gallery'] );
// turn comma separated values into array
$attachment_ids = explode( ',', $attachment_ids );
// clean the array
$attachment_ids = array_filter( $attachment_ids );
// return back to comma separated list with no trailing comma. This is common when deleting the images
$attachment_ids = implode( ',', $attachment_ids );
update_post_meta( $post_id, '_bpg', $attachment_ids );
} else {
delete_post_meta( $post_id, '_bpg' );
}
// link to larger images
if ( isset( $_POST[ 'bpg_link_images' ] ) )
update_post_meta( $post_id, '_bpg_link_images', $_POST[ 'bpg_link_images' ] );
else
update_post_meta( $post_id, '_bpg_link_images', 'off' );
do_action( 'bpg_save_post', $post_id );
}
add_action( 'save_post', 'bpg_save_post' ); | Java |
# INSTALL PROCEDURE (for Debian linux)
for copy/paste on terminal use ctrl+shift+v (you must activate terminal shortcut keys)
# COMMANDS (when install is finished)
SSH CONNECT: ssh *user@serverip* -p *portnumber*
REMOTE CONNECT: mysql -h *serverip* -P *mariadbport* -u root -p
DUMP: mysqldump -h *serverip* -P *mariadbport* -u dump -p custompos > dump.sql
DUMP: ssh *user@serverip* -p *sshport* mysqldump -u root -p custompos > dump.sql
LOCAL RESTORE: mysql -u root -p custompos < dump.sql
REMOTE RESTORE:
- on client copy dump file to /home/*user*/dump.sql then:
- scp -p *sshport* dump.sql *user@serverip*:/home/*user*/dump.sql
- on server cd /home/*user*/ then:
- mysql -u root -p custompos < dump.sql
# SSH SETUP
apt-get install openssh-server (if not already done)
apt-get install sudo (root is often brutforced and should be accessible only localy)
adduser *user* (if needed)
usermod -aG sudo *user*
nano /etc/sudoers
```
root ALL=(ALL:ALL) ALL
user ALL=(ALL:ALL) ALL
```
### on client
ssh-keygen -t rsa (save securely your passphrase)
ssh-copy-id *user@serverip* (passphrase needed, if no key is found, reload key with: ssh-add ~/.ssh/id_rsa)
### on server
nano /etc/ssh/sshd_config
```
Port [sshport]
Protocol 2
PubkeyAuthentication yes
PermitRootLogin no (before activing this, verify if the user access works)
RSAAuthentication no
UsePAM no
KerberosAuthentication no
GSSAPIAuthentication no
PasswordAuthentication no
ChallengeResponseAuthentication no
MaxAuthTries 10
ClientAliveInterval 600
ClientAliveCountMax 0
```
### restart ssh server
/etc/init.d/ssh reload
# TIME SERVER (customPOS use client date, they must be up to date)
apt-get install ntp
nano /etc/ntp.conf (change for your country NTP pool)
systemctl enable ntp (for automatic NTP start on boot)
ntpq -p (to check if the server is synchronized)
sudo ntpdate serverip (to check if client can connect to the server)
# MARIADB
apt-get install mariadb-server (if needed)
remove every *.cnf file in /etc/mysql and subdirectories except: debian.cnf debian-start mariadb.cnf my.cnf
mysql_secure_installation
nano /etc/mysql/mariadb.cnf
```
[client-server]
port=mariadbport
[mysqld]
character_set_server=latin1
sql_mode=STRICT_ALL_TABLES
default-storage-engine=InnoDB
default_tmp_storage_engine=InnoDB
enforce_storage_engine=InnoDB
datadir=/var/lib/mysql/
temp-pool
loose-innodb_file_per_table
innodb_buffer_pool_instances=2
innodb_buffer_pool_size=4G
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
```
/etc/init.d/mysql reload
check if mariadb is listening on your chosen port: netstat -anp | grep *portnumber*
if not you may have duplicate config file
# CREATE DATABASE & TABLES & STORED PROCEDURES
ssh *user@serverip* -p *portnumber*
mysql -u root -p
copy/paste (ctrl+shift+v) the content of tables.sql directly on mysql session
copy/paste (ctrl+shift+v) the content of stored.procedure.sql directly on mysql session
# AUTOMATIC BACKUP (example for weekly backup everyday at 22h00, older files will be overwrited)
create and grant 'dump'@'localhost' :
```
CREATE USER 'dump'@'localhost' IDENTIFIED BY 'password';
GRANT LOCK TABLES,SELECT ON custompos.* TO 'dump'@'localhost';
```
crontab -e
```
0 22 * * 1 mysqldump -u dump -ppassword custompos > /home/user/dump1.sql
0 22 * * 2 mysqldump -u dump -ppassword custompos > /home/user/dump2.sql
0 22 * * 3 mysqldump -u dump -ppassword custompos > /home/user/dump3.sql
0 22 * * 4 mysqldump -u dump -ppassword custompos > /home/user/dump4.sql
0 22 * * 5 mysqldump -u dump -ppassword custompos > /home/user/dump5.sql
0 22 * * 6 mysqldump -u dump -ppassword custompos > /home/user/dump6.sql
0 22 * * 0 mysqldump -u dump -ppassword custompos > /home/user/dump0.sql
```
# USERS & PRIVILEGE
### CREATE AND GRANT ADMINISTRATOR (access via LibreOffice-Base, be carefull with these privileges: accidental mouse move will creat new inserts)
```
CREATE USER 'admin'@'x.x.x.%' IDENTIFIED BY 'password';
GRANT ALL ON custompos.customer TO 'admin'@'x.x.x.%';
GRANT SELECT,UPDATE,DELETE ON custompos.devis TO 'admin'@'x.x.x.%';
GRANT ALL ON custompos.devisdet TO 'admin'@'x.x.x.%';
GRANT SELECT,UPDATE,DELETE ON custompos.entree TO 'admin'@'x.x.x.%';
GRANT ALL ON custompos.entreedet TO 'admin'@'x.x.x.%';
GRANT SELECT,UPDATE,DELETE ON custompos.fact TO 'admin'@'x.x.x.%';
GRANT ALL ON custompos.factdet TO 'admin'@'x.x.x.%';
GRANT ALL ON custompos.fourn TO 'admin'@'x.x.x.%';
GRANT SELECT,UPDATE,DELETE ON custompos.regl TO 'admin'@'x.x.x.%';
GRANT ALL ON custompos.stk TO 'admin'@'x.x.x.%';
GRANT SELECT ON custompos.output TO 'admin'@'x.x.x.%';
GRANT ALL ON custompos.utilisateur TO 'admin'@'x.x.x.%';
```
### CREATE AND GRANT ASSISTANT (access via LibreOffice-Base, Example to adapt)
```
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'assistant'@'x.x.x.%';
GRANT SELECT,UPDATE (datefact,utilisateur,numclient,nom,lieu,transport,bc,pay1,pay2,pay3,pay4,mode1,mode2,mode3,mode4,rendu,typefact,echeance,lettre,contact,chq1,chq2,chq3,chq4,bl) ON `custompos`.`fact` TO 'assistant'@'x.x.x.%';
GRANT SELECT,UPDATE (design) ON `custompos`.`factdet` TO 'assistant'@'x.x.x.%';
GRANT SELECT,UPDATE ON `custompos`.`regl` TO 'assistant'@'x.x.x.%';
GRANT SELECT,UPDATE ON `custompos`.`stk` TO 'assistant'@'x.x.x.%';
GRANT SELECT,UPDATE ON `custompos`.`customer` TO 'assistant'@'x.x.x.%';
GRANT SELECT,UPDATE (nom,fact) ON `custompos`.`entree` TO 'assistant'@'x.x.x.%';
GRANT SELECT ON `custompos`.`entreedet` TO 'assistant'@'x.x.x.%';
GRANT SELECT ON custompos.output TO 'assistant'@'x.x.x.%';
```
### CREATE AND GRANT PRIVILEGED USERS (for customPOS access)
```
CREATE USER 'user'@'x.x.x.%' IDENTIFIED BY 'password';
GRANT SELECT,UPDATE ON custompos.customer TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.devis TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.devisdet TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.fact TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.factdet TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.regl TO 'user'@'x.x.x.%'
GRANT SELECT,UPDATE ON custompos.stk TO 'user'@'x.x.x.%'
GRANT SELECT ON custompos.utilisateur TO 'user'@'x.x.x.%'
GRANT UPDATE (freecell) ON custompos.utilisateur TO 'user'@'x.x.x.%'
GRANT EXECUTE ON PROCEDURE custompos.balances TO 'user'@'x.x.x.%'
GRANT EXECUTE ON PROCEDURE custompos.balance TO 'user'@'x.x.x.%'
GRANT EXECUTE ON PROCEDURE custompos.fdj2 TO 'user'@'x.x.x.%'
```
### CREATE AND GRANT RESTRICTED USERS (for customPOS access)
```
CREATE USER 'user'@'x.x.x.%' IDENTIFIED BY 'password'
GRANT SELECT,UPDATE ON custompos.customer TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.devis TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.devisdet TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.entree TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.entreedet TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.fact TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.factdet TO 'user'@'x.x.x.%'
GRANT SELECT ON custompos.fourn TO 'user'@'x.x.x.%'
GRANT SELECT,INSERT ON custompos.regl TO 'user'@'x.x.x.%'
GRANT SELECT,UPDATE ON custompos.stk TO 'user'@'x.x.x.%'
GRANT SELECT ON custompos.output TO 'user'@'x.x.x.%'
GRANT SELECT ON custompos.utilisateur TO 'user'@'x.x.x.%'
GRANT EXECUTE ON PROCEDURE custompos.balances TO 'user'@'x.x.x.%'
GRANT EXECUTE ON PROCEDURE custompos.balance TO 'user'@'x.x.x.%'
```
| Java |
#!/usr/bin/env lua
-- -*-lua-*-
--
-- $Id: pm_led.lua $
--
-- Author: Markus Stenberg <markus stenberg@iki.fi>
--
-- Copyright (c) 2013 cisco Systems, Inc.
--
-- Created: Wed Mar 13 09:38:57 2013 mstenber
-- Last modified: Mon Sep 30 13:33:12 2013 mstenber
-- Edit time: 21 min
--
-- This is used to indicate the pm.lua state to external parties. Two
-- notifications are currently supported:
-- 'pd' indicates there is PD lease received on interfaces
-- 'global' indicates global address has been assigned to an
-- interfaces (ospf-lap)
require 'pm_handler'
require 'mst'
LED_SCRIPT='/usr/share/hnet/led_handler.sh'
module(..., package.seeall)
local _pmh = pm_handler.pm_handler_with_pa
pm_led = _pmh:new_subclass{class='pm_led'}
function pm_led:init()
_pmh.init(self)
self.states = {}
self.enabled = true
end
function pm_led:set_state(ledname, value)
local old = self.states[ledname]
if old == value
then
return
end
self.states[ledname] = value
self:apply_state(ledname, value)
end
function pm_led:apply_state(ledname, value)
self:d('applying led state', ledname, value)
if not self.enabled
then
self:d('not enabled, skipping led update')
return
end
local s =
string.format('%s %s %s', LED_SCRIPT, ledname, value and '1' or 0)
self.shell(s)
end
function pm_led:have_pd_prefix_in_skv()
-- this is a hack; but it can remain a hack too..
self:d('have_pd_prefix_in_skv')
-- loop through skv, looking at stuff with prefix
for k, v in pairs(self._pm.skv:get_combined_state())
do
--self:d('key is', k)
if string.find(k, '^' .. elsa_pa.PD_SKVPREFIX)
then
self:d('considering', k)
for i, v in ipairs(v)
do
if v.prefix
then
self:d('found prefix!', v)
return true
end
end
end
end
return false
end
function pm_led:skv_changed(k, v)
if string.find(k, '^' .. elsa_pa.PD_SKVPREFIX)
then
for i, v in ipairs(v)
do
if v.prefix
then
self:queue()
end
end
end
end
function pm_led:have_global_ipv6()
for i, v in ipairs(self.usp:get_ipv6())
do
-- for the time being, we're happy with ULAs too if they're desired
-- (XXX - should this be the case?)
return true
end
return false
end
function pm_led:run()
local found = self:have_pd_prefix_in_skv()
self:set_state('pd', found)
local found = self:have_global_ipv6()
self:set_state('global', found)
end
| Java |
# -*- coding: utf-8 -*-
import random
from operator import attrgetter
import pytest
from cfme import test_requirements
from cfme.cloud.provider import CloudProvider
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.cloud.provider.gce import GCEProvider
from cfme.cloud.provider.openstack import OpenStackProvider
from cfme.common.provider import BaseProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.virtualcenter import VMwareProvider
from cfme.utils import conf
from cfme.utils.blockers import BZ
from cfme.utils.log import logger
from cfme.utils.wait import wait_for
from cfme.fixtures.provider import setup_or_skip
pytestmark = [
pytest.mark.tier(1),
test_requirements.c_and_u,
pytest.mark.provider(
[VMwareProvider, RHEVMProvider, EC2Provider, OpenStackProvider, AzureProvider, GCEProvider],
required_fields=[(['cap_and_util', 'capandu_vm'], 'cu-24x7')], scope="module")
]
@pytest.fixture(scope="module")
def clean_setup_provider(request, provider):
BaseProvider.clear_providers()
setup_or_skip(request, provider)
yield
BaseProvider.clear_providers()
def vm_count(appliance, metrics_tbl, mgmt_system_id):
return bool(appliance.db.client.session.query(metrics_tbl).filter(
metrics_tbl.parent_ems_id == mgmt_system_id).filter(
metrics_tbl.resource_type == "VmOrTemplate").count()
)
def host_count(appliance, metrics_tbl, mgmt_system_id):
return bool(appliance.db.client.session.query(metrics_tbl).filter(
metrics_tbl.parent_ems_id == mgmt_system_id).filter(
metrics_tbl.resource_type == "Host").count()
)
@pytest.fixture(scope="module")
def metrics_collection(appliance, clean_setup_provider, provider, enable_candu):
"""Check the db is gathering collection data for the given provider.
Metadata:
test_flag: metrics_collection
"""
metrics_tbl = appliance.db.client['metrics']
mgmt_systems_tbl = appliance.db.client['ext_management_systems']
logger.info("Fetching provider ID for %s", provider.key)
mgmt_system_id = appliance.db.client.session.query(mgmt_systems_tbl).filter(
mgmt_systems_tbl.name == conf.cfme_data.get('management_systems', {})[provider.key]['name']
).first().id
logger.info("ID fetched; testing metrics collection now")
# vms for both infa and cloud provider
wait_for(
vm_count, [appliance, metrics_tbl, mgmt_system_id],
delay=20,
timeout=1500,
fail_condition=False,
message="wait for VMs")
# host only for infa
if provider.category == "infra":
wait_for(
vm_count, [appliance, metrics_tbl, mgmt_system_id],
delay=20,
timeout=1500,
fail_condition=False,
message="wait for hosts.")
def get_host_name(provider):
cfme_host = random.choice(provider.data["hosts"])
return cfme_host.name
def query_metric_db(appliance, provider, metric, vm_name=None, host_name=None):
metrics_tbl = appliance.db.client['metrics']
ems = appliance.db.client['ext_management_systems']
if vm_name is None:
if host_name is not None:
object_name = host_name
elif vm_name is not None:
object_name = vm_name
with appliance.db.client.transaction:
provs = (
appliance.db.client.session.query(metrics_tbl.id)
.join(ems, metrics_tbl.parent_ems_id == ems.id)
.filter(metrics_tbl.resource_name == object_name,
ems.name == provider.name)
)
return appliance.db.client.session.query(metrics_tbl).filter(
metrics_tbl.id.in_(provs.subquery()))
@pytest.mark.rhv2
# Tests to check that specific metrics are being collected
@pytest.mark.meta(
blockers=[BZ(1511099, forced_streams=["5.8", "upstream"],
unblock=lambda provider: not provider.one_of(GCEProvider))]
)
def test_raw_metric_vm_cpu(metrics_collection, appliance, provider):
vm_name = provider.data['cap_and_util']['capandu_vm']
if provider.category == "infra":
query = query_metric_db(appliance, provider, 'cpu_usagemhz_rate_average',
vm_name)
average_rate = attrgetter('cpu_usagemhz_rate_average')
elif provider.category == "cloud":
query = query_metric_db(appliance, provider, 'cpu_usage_rate_average',
vm_name)
average_rate = attrgetter('cpu_usage_rate_average')
for record in query:
if average_rate(record) is not None:
assert average_rate(record) > 0, 'Zero VM CPU Usage'
break
@pytest.mark.rhv2
@pytest.mark.uncollectif(
lambda provider: provider.one_of(EC2Provider) or provider.one_of(GCEProvider))
def test_raw_metric_vm_memory(metrics_collection, appliance, provider):
vm_name = provider.data['cap_and_util']['capandu_vm']
if provider.type == 'azure':
query = query_metric_db(appliance, provider, 'mem_usage_absolute_average',
vm_name)
average_rate = attrgetter('mem_usage_absolute_average')
else:
query = query_metric_db(appliance, provider, 'derived_memory_used',
vm_name)
average_rate = attrgetter('derived_memory_used')
for record in query:
if average_rate(record) is not None:
assert average_rate(record) > 0, 'Zero VM Memory Usage'
break
@pytest.mark.rhv2
@pytest.mark.meta(
blockers=[BZ(1408963, forced_streams=["5.8", "upstream"],
unblock=lambda provider: not provider.one_of(RHEVMProvider))]
)
@pytest.mark.meta(
blockers=[BZ(1511099, forced_streams=["5.8", "upstream"],
unblock=lambda provider: not provider.one_of(GCEProvider))]
)
def test_raw_metric_vm_network(metrics_collection, appliance, provider):
vm_name = provider.data['cap_and_util']['capandu_vm']
query = query_metric_db(appliance, provider, 'net_usage_rate_average',
vm_name)
for record in query:
if record.net_usage_rate_average is not None:
assert record.net_usage_rate_average > 0, 'Zero VM Network IO'
break
@pytest.mark.rhv2
@pytest.mark.uncollectif(
lambda provider: provider.one_of(EC2Provider))
@pytest.mark.meta(
blockers=[BZ(1511099, forced_streams=["5.8", "upstream"],
unblock=lambda provider: not provider.one_of(GCEProvider))]
)
def test_raw_metric_vm_disk(metrics_collection, appliance, provider):
vm_name = provider.data['cap_and_util']['capandu_vm']
query = query_metric_db(appliance, provider, 'disk_usage_rate_average',
vm_name)
for record in query:
if record.disk_usage_rate_average is not None:
assert record.disk_usage_rate_average > 0, 'Zero VM Disk IO'
break
@pytest.mark.rhv2
@pytest.mark.uncollectif(
lambda provider: provider.one_of(CloudProvider))
def test_raw_metric_host_cpu(metrics_collection, appliance, provider):
host_name = get_host_name(provider)
query = query_metric_db(appliance, provider, 'cpu_usagemhz_rate_average',
host_name)
for record in query:
if record.cpu_usagemhz_rate_average is not None:
assert record.cpu_usagemhz_rate_average > 0, 'Zero Host CPU Usage'
break
@pytest.mark.rhv2
@pytest.mark.uncollectif(
lambda provider: provider.one_of(CloudProvider))
def test_raw_metric_host_memory(metrics_collection, appliance, provider):
host_name = get_host_name(provider)
query = query_metric_db(appliance, provider, 'derived_memory_used',
host_name)
for record in query:
if record.derived_memory_used is not None:
assert record.derived_memory_used > 0, 'Zero Host Memory Usage'
break
@pytest.mark.rhv2
@pytest.mark.uncollectif(
lambda provider: provider.one_of(CloudProvider))
def test_raw_metric_host_network(metrics_collection, appliance, provider):
host_name = get_host_name(provider)
query = query_metric_db(appliance, provider, 'net_usage_rate_average',
host_name)
for record in query:
if record.net_usage_rate_average is not None:
assert record.net_usage_rate_average > 0, 'Zero Host Network IO'
break
@pytest.mark.rhv2
@pytest.mark.uncollectif(
lambda provider: provider.one_of(CloudProvider))
@pytest.mark.meta(
blockers=[BZ(1424589, forced_streams=["5.8", "5.9", "upstream"],
unblock=lambda provider: not provider.one_of(RHEVMProvider))]
)
def test_raw_metric_host_disk(metrics_collection, appliance, provider):
host_name = get_host_name(provider)
query = query_metric_db(appliance, provider, 'disk_usage_rate_average',
host_name)
for record in query:
if record.disk_usage_rate_average is not None:
assert record.disk_usage_rate_average > 0, 'Zero Host Disk IO'
break
| Java |
#nav-drop {
margin-left: 50px; }
#navbar > li {
display: inline;
float: left;
margin-left: 30px; }
#navbar > ul > li > a {
color: #fff;
text-shadow: 0 0 2px rgba(0, 0, 0, 0.4); }
#navbar > li > a:hover {
background: none; }
#navbar {
margin-top: 105px;
background: none;
border: none;
box-shadow: none; }
#navbar .active > a {
background: none; }
#navbar > li a.dropdown-toggle {
background: none; }
#navbar > li > ul.dropdown-menu {
border-top: 2px solid #3e3433;
margin-top: 15px; }
/************ bootstrap navigation -->
/*
Navbar "hovernav" dropdown menu - this works only for screen sizes larger than phones.
The Bootstrap CSS is unchanged.
*/
nav a {
text-decoration: none; }
nav > ul > li {
float: left;
margin-left: 30px; }
.navbar-nav > li {
margin-left: 40px; }
#navbar .navbar-default .navbar-nav > li > a {
color: #fff; }
#nav-1 li a {
color: #fff; }
#navbar a {
text-transform: capitalize; }
/******** dropdown ****************/
#menu-bootstrap_menu li a {
color: #fff;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.7);
font-family: 'Merriweather', serif; }
#menu-bootstrap_menu > li > ul > li {
color: #000;
border-bottom: 1px solid #3e3433; }
#menu-bootstrap_menu > li > ul > li > a {
color: #000; }
#menu-bootstrap_menu > li > ul > li:last-child {
border: none; }
#menu-bootstrap_menu > li > ul {
border-top: 3px solid #3e3433;
opacity: 0.8; }
#dropdown {
border-top: 3px solid #3e3433;
opacity: 0.8; }
#dropdown li {
border-bottom: 1px solid #3e3433; }
#dropdown li:last-child {
border: none; }
#dropdown li a {
color: #3e3433; }
#navbar .navbar-nav > .open > a, #navbar .navbar-nav > .open > a:hover, #navbar .navbar-nav > .open > a:focus {
background: none; }
@media all and (max-width: 1200px) {
#menu-bootstrap_menu li {
margin-left: 10px; }
#menu-bootstrap_menu li:last-child {
display: none; } }
@media all and (max-width: 767px) {
#menu-bootstrap_menu {
background: #372d2b;
width: 440px;
margin-left: 130px;
z-index: 1;
position: relative;
}
#collapse {
margin-top: -38px;
border: none;
}
}
@media all and (max-width:480px){
#top_text span {
display:none;
}
}
.navbar-toggle {
border: none; }
#menu-bootstrap_menu > li > ul > li > a {
color: #fff; } }
/**
* contact css
*/
#contact_heading h2 {
font-family: 'Merriweather', serif;
text-shadow: 0 0 2px rgba(0, 0, 0, 0.7);
border-bottom: 1px dotted #372d2b; }
#required {
content: '*';
color: red; }
#contact_page {
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
width: 1100px;
margin: 0 auto
}
#contact_page_h2 {
font-family: 'Merriweather', serif;
text-shadow: 0 0 2px rgba(0, 0, 0, 0.7); }
.widget_wysija_cont .wysija-submit {
margin-left: 100px;
margin-bottom: 20px; }
#model-content {
color: #382e2c; }
#navigation {
margin-top: 40px; }
body {
color: #fff; }
a {
color: #372d2b; }
#header {
background: url("../images/header.png");
height: 180px; }
.top_header {
background-color: #313030;
height: 32px; }
#top_text {
color: #fff;
line-height: 30px; }
#top_text a {
color: #fff; }
#logo {
margin-top: -102px; }
#reservation {
background-color: #c24818;
padding: 5px 15px 5px 15px;
margin-top: 10px;
border:none;
color:#fff;
}
#wine-menu {
background-color: #c24818;
padding: 5px 15px 5px 15px;
border:none;
color:#fff;
}
#reservation a {
color: #fff;
text-decoration: none; }
#reservation:hover {
background-color: #953712; }
/************** start footer **************/
#bottom_footer {
background-color: #f3f3f3;
padding-top: 20px;
width: 100%;
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
padding-bottom: 50px;
border-top: 1px solid #eef;
margin-top: 10px; }
.bottom_footer_h2 {
color: #693523;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.7);
font-family: 'Merriweather', serif; }
#bottom_footer_1 ul {
margin-left: 10px;
font-family: 'Merriweather', serif; }
#bottom_footer_1 ul li a {
color: #a8a8a8; }
#bottom_footer_1 ul li a:hover {
_text-decoration: none;
color: #693523; }
#bottom_footer_0 {
margin-top: 30px;
padding-left: 30px; }
#bottom_footer_address img {
float: left; }
#bottom_footer_address_1 {
padding-top: 20px; }
/********* media query *********/
@media all and (max-width: 990px) {
#bottom_footer_address img {
display: none; } }
@media all and (max-width: 768px) {
#nav-1 > li {
margin-left: 10px; } }
/********* social media *******/
#facebook {
color: #3b5998; }
#twitter {
color: #4099FF; }
#google-plus {
color: #D34836; }
#google-plus:hover {
color: #712319;
text-decoration: none; }
#twitter:hover {
color: #0065d9;
text-decoration: none; }
#facebook:hover {
color: #1e2e4f;
text-decoration: none; }
#close {
margin-top: -30px;
font-size: 30px;
color: #000; }
/********** footer **************/
#main-content {
height: 400px; }
#our-partner img {
display: inline;
float: left;
margin-right: 20px;
padding: 10px 0; }
#last_bottom_footer {
background: #362c2a;
height: 30px; }
#restaurants_footer {
background: #f9f2ea;
border: 1px solid #eef;
box-shadow: 0 2px 9px; }
#restaurant_content {
color: #000; }
.restaurant_h2 {
color: #693523;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.7);
font-family: 'Merriweather', serif; }
#restaurant_img {
margin-left: 5px; }
/**************** gallery **************/
#thumbs_60_1 {
border: 1px solid #eef;
padding-left:20px;
padding-top:10px;
}
.photospace .slideshow-container {
margin-left:10px;
}
#menu-bootstrap_menu>li>ul>li>a {
color:#000;
}
/*************** menu items *********************/
.menu_items {
font-weight: bold;
float:left;
padding-left: 5px;
}
.menu_price {
font-weight: bold;
float:right;
display: block;
}
.menu_description {
font-style: italic;
font-variant: normal;
display: block;
padding-left:10px;
}
#menu-sidebar {
background:linear-gradient(to bottom, #c24818 0%,#c24818 100%);
background:-webkit-linear-gradient(to bottom, #c24818 0%,#c24818 100%);
background:-moz-linear-gradient(to bottom, #c24818 0%,#c24818 100%);
background:-o-linear-gradient(to bottom, #c24818 0%,#c24818 100%);
border-radius: 5px;
padding:10px;
margin-top:40px;
}
#menu-sidebar>ul>li>a {
color:#fff;
text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
padding-top:12px;
font-size:16px;
}
#menu-sidebar>ul>li {
border-bottom: 1px solid #eef;
}
#menu-sidebar>ul>li:last-child {
border:none;
}
#copyright {
line-height: 30px;
color:#fff;
font-size:14px;
}
b {
color:#c24818;
text-shadow:0 0 1px rgba(0,0,0,0.5);
} | Java |
/* _______ __ __ __ ______ __ __ _______ __ __
* / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
* / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
* / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
* / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
* /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
* \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
*
* Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
*
*
* Per Larsson a.k.a finalman
* Olof Naessén a.k.a jansem/yakslem
*
* Visit: http://guichan.sourceforge.net
*
* License: (BSD)
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name of Guichan nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef GCN_CONTRIB_ALLEGROTRUETYPEFONT_HPP
#define GCN_CONTRIB_ALLEGROTRUETYPEFONT_HPP
#include "guichan/font.hpp"
#include "guichan/platform.hpp"
namespace gcn
{
namespace contrib
{
struct GLYPH_FACE;
struct GLYPH_REND;
struct GLYPH_KEEP;
class Graphics;
/**
* True type font support using Allegro and GlyphKeeper.
*
* Note: GlyphKeeper must be compiled for allegro (define
* GLYPH_TARGET=GLYPH_TARGET_ALLEGRO) and must be
* initialized before using this class.
*
* There's only basic functionality implemented here, so
* you can add more and advanced functionality by deriving
* from this class.
*
* @author Tobias Scheuer.
*/
class GCN_EXTENSION_DECLSPEC AllegroGlyphKeeperFont : public Font
{
public:
/**
* Constructor.
*
* @param filename the filename of the True Type Font.
* @param size the size the font should be in.
*/
AllegroGlyphKeeperFont(const std::string& filename, int size);
/**
* Constructor.
*
* @param filename the filename of the True Type Font.
* @param width the width the font should be in.
* @param height the height the font should be in.
*/
AllegroGlyphKeeperFont(const std::string& filename, int width, int height);
/**
* Destructor.
*/
~AllegroGlyphKeeperFont();
// Inherited from Font
virtual int getWidth(const std::string& text) const;
virtual int getHeight() const;
virtual void drawString(Graphics* graphics, const std::string& text, int x, int y);
protected:
void load(const std::string& filename, int w, int h);
GLYPH_FACE* mFace;
GLYPH_REND* mRend;
GLYPH_KEEP* mKeeper;
};
}
}
#endif
| Java |
/*
* resolve.c - resolve names and tags into specific devices
*
* Copyright (C) 2001, 2003 Theodore Ts'o.
* Copyright (C) 2001 Andreas Dilger
*
* %Begin-Header%
* This file may be redistributed under the terms of the
* GNU Lesser General Public License.
* %End-Header%
*/
#include <stdio.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "blkidP.h"
#include "probe.h"
/*
* Find a tagname (e.g. LABEL or UUID) on a specific device.
*/
char *blkid_get_tag_value(blkid_cache cache, const char *tagname,
const char *devname)
{
blkid_tag found;
blkid_dev dev;
blkid_cache c = cache;
char *ret = NULL;
DBG(DEBUG_RESOLVE, printf("looking for %s on %s\n", tagname, devname));
if (!devname)
return NULL;
if (!cache) {
if (blkid_get_cache(&c, NULL) < 0)
return NULL;
}
if ((dev = blkid_get_dev(c, devname, BLKID_DEV_NORMAL)) &&
(found = blkid_find_tag_dev(dev, tagname)))
ret = blkid_strdup(found->bit_val);
if (!cache)
blkid_put_cache(c);
return ret;
}
/*
* Locate a device name from a token (NAME=value string), or (name, value)
* pair. In the case of a token, value is ignored. If the "token" is not
* of the form "NAME=value" and there is no value given, then it is assumed
* to be the actual devname and a copy is returned.
*/
char *blkid_get_devname(blkid_cache cache, const char *token,
const char *value)
{
blkid_dev dev;
blkid_cache c = cache;
char *t = 0, *v = 0;
char *ret = NULL;
if (!token)
return NULL;
if (!cache) {
if (blkid_get_cache(&c, NULL) < 0)
return NULL;
}
DBG(DEBUG_RESOLVE,
printf("looking for %s%s%s %s\n", token, value ? "=" : "",
value ? value : "", cache ? "in cache" : "from disk"));
if (!value) {
if (!strchr(token, '='))
return blkid_strdup(token);
blkid_parse_tag_string(token, &t, &v);
if (!t || !v)
goto errout;
token = t;
value = v;
}
dev = blkid_find_dev_with_tag(c, token, value);
if (!dev)
goto errout;
ret = blkid_strdup(blkid_dev_devname(dev));
errout:
if (t)
free(t);
if (v)
free(v);
if (!cache) {
blkid_put_cache(c);
}
return (ret);
}
#ifdef TEST_PROGRAM
int main(int argc, char **argv)
{
char *value;
blkid_cache cache;
blkid_debug_mask = DEBUG_ALL;
if (argc != 2 && argc != 3) {
fprintf(stderr, "Usage:\t%s tagname=value\n"
"\t%s tagname devname\n"
"Find which device holds a given token or\n"
"Find what the value of a tag is in a device\n",
argv[0], argv[0]);
exit(1);
}
if (blkid_get_cache(&cache, bb_dev_null) < 0) {
fprintf(stderr, "Couldn't get blkid cache\n");
exit(1);
}
if (argv[2]) {
value = blkid_get_tag_value(cache, argv[1], argv[2]);
printf("%s has tag %s=%s\n", argv[2], argv[1],
value ? value : "<missing>");
} else {
value = blkid_get_devname(cache, argv[1], NULL);
printf("%s has tag %s\n", value ? value : "<none>", argv[1]);
}
blkid_put_cache(cache);
return value ? 0 : 1;
}
#endif
| Java |
(function() {
tinymce.PluginManager.requireLangPack('kotofey_shortcodes');
tinymce.create('tinymce.plugins.kotofey_shortcodes', {
init : function(ed, url) {
ed.addCommand('mcekotofey_shortcodes', function() {
ed.windowManager.open({
file : url + '/interface.php',
width : 290 + ed.getLang('kotofey_shortcodes.delta_width', 0),
height : 150 + ed.getLang('kotofey_shortcodes.delta_height', 0),
inline : 1
}, {
plugin_url : url
});
});
ed.addButton('kotofey_shortcodes', {
title : 'Click to add a shortcode',
cmd : 'mcekotofey_shortcodes',
image : url + '/shortcode_button.png'
});
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('kotofey_shortcodes', n.nodeName == 'IMG');
});
},
createControl : function(n, cm) {
return null;
},
getInfo : function() {
return {
longname : 'kotofey_shortcodes',
author : 'kotofey',
authorurl : 'http://themeforest.net/user/kotofey',
infourl : 'http://themeforest.net/user/kotofey',
version : "1.0"
};
}
});
tinymce.PluginManager.add('kotofey_shortcodes', tinymce.plugins.kotofey_shortcodes);
})();
| Java |
/*
* libata-scsi.c - helper library for ATA
*
* Maintained by: Jeff Garzik <jgarzik@pobox.com>
* Please ALWAYS copy linux-ide@vger.kernel.org
* on emails.
*
* Copyright 2003-2004 Red Hat, Inc. All rights reserved.
* Copyright 2003-2004 Jeff Garzik
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
* libata documentation is available via 'make {ps|pdf}docs',
* as Documentation/DocBook/libata.*
*
* Hardware documentation available from
* - http://www.t10.org/
* - http://www.t13.org/
*
*/
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/blkdev.h>
#include <linux/spinlock.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_eh.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_transport.h>
#include <linux/libata.h>
#include <linux/hdreg.h>
#include <linux/uaccess.h>
#include <linux/suspend.h>
#include <asm/unaligned.h>
#include "libata.h"
#define SECTOR_SIZE 512
#define ATA_SCSI_RBUF_SIZE 4096
static DEFINE_SPINLOCK(ata_scsi_rbuf_lock);
static u8 ata_scsi_rbuf[ATA_SCSI_RBUF_SIZE];
typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc);
static struct ata_device *__ata_scsi_find_dev(struct ata_port *ap,
const struct scsi_device *scsidev);
static struct ata_device *ata_scsi_find_dev(struct ata_port *ap,
const struct scsi_device *scsidev);
static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
unsigned int id, unsigned int lun);
#define RW_RECOVERY_MPAGE 0x1
#define RW_RECOVERY_MPAGE_LEN 12
#define CACHE_MPAGE 0x8
#define CACHE_MPAGE_LEN 20
#define CONTROL_MPAGE 0xa
#define CONTROL_MPAGE_LEN 12
#define ALL_MPAGES 0x3f
#define ALL_SUB_MPAGES 0xff
static const u8 def_rw_recovery_mpage[RW_RECOVERY_MPAGE_LEN] = {
RW_RECOVERY_MPAGE,
RW_RECOVERY_MPAGE_LEN - 2,
(1 << 7), /* AWRE */
0, /* read retry count */
0, 0, 0, 0,
0, /* write retry count */
0, 0, 0
};
static const u8 def_cache_mpage[CACHE_MPAGE_LEN] = {
CACHE_MPAGE,
CACHE_MPAGE_LEN - 2,
0, /* contains WCE, needs to be 0 for logic */
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, /* contains DRA, needs to be 0 for logic */
0, 0, 0, 0, 0, 0, 0
};
static const u8 def_control_mpage[CONTROL_MPAGE_LEN] = {
CONTROL_MPAGE,
CONTROL_MPAGE_LEN - 2,
2, /* DSENSE=0, GLTSD=1 */
0, /* [QAM+QERR may be 1, see 05-359r1] */
0, 0, 0, 0, 0xff, 0xff,
0, 30 /* extended self test time, see 05-359r1 */
};
/*
* libata transport template. libata doesn't do real transport stuff.
* It just needs the eh_timed_out hook.
*/
static struct scsi_transport_template ata_scsi_transport_template = {
.eh_strategy_handler = ata_scsi_error,
.eh_timed_out = ata_scsi_timed_out,
.user_scan = ata_scsi_user_scan,
};
static const struct {
enum link_pm value;
const char *name;
} link_pm_policy[] = {
{ NOT_AVAILABLE, "max_performance" },
{ MIN_POWER, "min_power" },
{ MAX_PERFORMANCE, "max_performance" },
{ MEDIUM_POWER, "medium_power" },
};
static const char *ata_scsi_lpm_get(enum link_pm policy)
{
int i;
for (i = 0; i < ARRAY_SIZE(link_pm_policy); i++)
if (link_pm_policy[i].value == policy)
return link_pm_policy[i].name;
return NULL;
}
static ssize_t ata_scsi_lpm_put(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ata_port *ap = ata_shost_to_port(shost);
enum link_pm policy = 0;
int i;
/*
* we are skipping array location 0 on purpose - this
* is because a value of NOT_AVAILABLE is displayed
* to the user as max_performance, but when the user
* writes "max_performance", they actually want the
* value to match MAX_PERFORMANCE.
*/
for (i = 1; i < ARRAY_SIZE(link_pm_policy); i++) {
const int len = strlen(link_pm_policy[i].name);
if (strncmp(link_pm_policy[i].name, buf, len) == 0) {
policy = link_pm_policy[i].value;
break;
}
}
if (!policy)
return -EINVAL;
ata_lpm_schedule(ap, policy);
return count;
}
static ssize_t
ata_scsi_lpm_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ata_port *ap = ata_shost_to_port(shost);
const char *policy =
ata_scsi_lpm_get(ap->pm_policy);
if (!policy)
return -EINVAL;
return snprintf(buf, 23, "%s\n", policy);
}
DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
ata_scsi_lpm_show, ata_scsi_lpm_put);
EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);
static ssize_t ata_scsi_park_show(struct device *device,
struct device_attribute *attr, char *buf)
{
struct scsi_device *sdev = to_scsi_device(device);
struct ata_port *ap;
struct ata_link *link;
struct ata_device *dev;
unsigned long flags, now;
unsigned int uninitialized_var(msecs);
int rc = 0;
ap = ata_shost_to_port(sdev->host);
spin_lock_irqsave(ap->lock, flags);
dev = ata_scsi_find_dev(ap, sdev);
if (!dev) {
rc = -ENODEV;
goto unlock;
}
if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
rc = -EOPNOTSUPP;
goto unlock;
}
link = dev->link;
now = jiffies;
if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS &&
link->eh_context.unloaded_mask & (1 << dev->devno) &&
time_after(dev->unpark_deadline, now))
msecs = jiffies_to_msecs(dev->unpark_deadline - now);
else
msecs = 0;
unlock:
spin_unlock_irq(ap->lock);
return rc ? rc : snprintf(buf, 20, "%u\n", msecs);
}
static ssize_t ata_scsi_park_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t len)
{
struct scsi_device *sdev = to_scsi_device(device);
struct ata_port *ap;
struct ata_device *dev;
long int input;
unsigned long flags;
int rc;
rc = strict_strtol(buf, 10, &input);
if (rc || input < -2)
return -EINVAL;
if (input > ATA_TMOUT_MAX_PARK) {
rc = -EOVERFLOW;
input = ATA_TMOUT_MAX_PARK;
}
ap = ata_shost_to_port(sdev->host);
spin_lock_irqsave(ap->lock, flags);
dev = ata_scsi_find_dev(ap, sdev);
if (unlikely(!dev)) {
rc = -ENODEV;
goto unlock;
}
if (dev->class != ATA_DEV_ATA) {
rc = -EOPNOTSUPP;
goto unlock;
}
if (input >= 0) {
if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
rc = -EOPNOTSUPP;
goto unlock;
}
dev->unpark_deadline = ata_deadline(jiffies, input);
dev->link->eh_info.dev_action[dev->devno] |= ATA_EH_PARK;
ata_port_schedule_eh(ap);
complete(&ap->park_req_pending);
} else {
switch (input) {
case -1:
dev->flags &= ~ATA_DFLAG_NO_UNLOAD;
break;
case -2:
dev->flags |= ATA_DFLAG_NO_UNLOAD;
break;
}
}
unlock:
spin_unlock_irqrestore(ap->lock, flags);
return rc ? rc : len;
}
DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
ata_scsi_park_show, ata_scsi_park_store);
EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
{
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq);
}
static ssize_t
ata_scsi_em_message_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ata_port *ap = ata_shost_to_port(shost);
if (ap->ops->em_store && (ap->flags & ATA_FLAG_EM))
return ap->ops->em_store(ap, buf, count);
return -EINVAL;
}
static ssize_t
ata_scsi_em_message_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ata_port *ap = ata_shost_to_port(shost);
if (ap->ops->em_show && (ap->flags & ATA_FLAG_EM))
return ap->ops->em_show(ap, buf);
return -EINVAL;
}
DEVICE_ATTR(em_message, S_IRUGO | S_IWUSR,
ata_scsi_em_message_show, ata_scsi_em_message_store);
EXPORT_SYMBOL_GPL(dev_attr_em_message);
static ssize_t
ata_scsi_em_message_type_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct ata_port *ap = ata_shost_to_port(shost);
return snprintf(buf, 23, "%d\n", ap->em_message_type);
}
DEVICE_ATTR(em_message_type, S_IRUGO,
ata_scsi_em_message_type_show, NULL);
EXPORT_SYMBOL_GPL(dev_attr_em_message_type);
static ssize_t
ata_scsi_activity_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct scsi_device *sdev = to_scsi_device(dev);
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *atadev = ata_scsi_find_dev(ap, sdev);
if (ap->ops->sw_activity_show && (ap->flags & ATA_FLAG_SW_ACTIVITY))
return ap->ops->sw_activity_show(atadev, buf);
return -EINVAL;
}
static ssize_t
ata_scsi_activity_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct scsi_device *sdev = to_scsi_device(dev);
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *atadev = ata_scsi_find_dev(ap, sdev);
enum sw_activity val;
int rc;
if (ap->ops->sw_activity_store && (ap->flags & ATA_FLAG_SW_ACTIVITY)) {
val = simple_strtoul(buf, NULL, 0);
switch (val) {
case OFF: case BLINK_ON: case BLINK_OFF:
rc = ap->ops->sw_activity_store(atadev, val);
if (!rc)
return count;
else
return rc;
}
}
return -EINVAL;
}
DEVICE_ATTR(sw_activity, S_IWUSR | S_IRUGO, ata_scsi_activity_show,
ata_scsi_activity_store);
EXPORT_SYMBOL_GPL(dev_attr_sw_activity);
struct device_attribute *ata_common_sdev_attrs[] = {
&dev_attr_unload_heads,
NULL
};
EXPORT_SYMBOL_GPL(ata_common_sdev_attrs);
static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *))
{
ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, 0x24, 0x0);
/* "Invalid field in cbd" */
done(cmd);
}
/**
* ata_std_bios_param - generic bios head/sector/cylinder calculator used by sd.
* @sdev: SCSI device for which BIOS geometry is to be determined
* @bdev: block device associated with @sdev
* @capacity: capacity of SCSI device
* @geom: location to which geometry will be output
*
* Generic bios head/sector/cylinder calculator
* used by sd. Most BIOSes nowadays expect a XXX/255/16 (CHS)
* mapping. Some situations may arise where the disk is not
* bootable if this is not used.
*
* LOCKING:
* Defined by the SCSI layer. We don't really care.
*
* RETURNS:
* Zero.
*/
int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int geom[])
{
geom[0] = 255;
geom[1] = 63;
sector_div(capacity, 255*63);
geom[2] = capacity;
return 0;
}
/**
* ata_scsi_unlock_native_capacity - unlock native capacity
* @sdev: SCSI device to adjust device capacity for
*
* This function is called if a partition on @sdev extends beyond
* the end of the device. It requests EH to unlock HPA.
*
* LOCKING:
* Defined by the SCSI layer. Might sleep.
*/
void ata_scsi_unlock_native_capacity(struct scsi_device *sdev)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev;
unsigned long flags;
spin_lock_irqsave(ap->lock, flags);
dev = ata_scsi_find_dev(ap, sdev);
if (dev && dev->n_sectors < dev->n_native_sectors) {
dev->flags |= ATA_DFLAG_UNLOCK_HPA;
dev->link->eh_info.action |= ATA_EH_RESET;
ata_port_schedule_eh(ap);
}
spin_unlock_irqrestore(ap->lock, flags);
ata_port_wait_eh(ap);
}
void ata_scsi_reconfig(struct scsi_device *sdev)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev;
dev = ata_scsi_find_dev(ap, sdev);
if (!dev)
return;
ata_dev_read_id(dev, &dev->class, 0, dev->id);
dev->pio_mask = UINT_MAX;
dev->mwdma_mask = UINT_MAX;
dev->udma_mask = UINT_MAX;
ata_dev_configure(dev);
ata_set_mode(&ap->link, &dev);
}
EXPORT_SYMBOL(ata_scsi_reconfig);
/**
* ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl
* @ap: target port
* @sdev: SCSI device to get identify data for
* @arg: User buffer area for identify data
*
* LOCKING:
* Defined by the SCSI layer. We don't really care.
*
* RETURNS:
* Zero on success, negative errno on error.
*/
static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
void __user *arg)
{
struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
u16 __user *dst = arg;
char buf[40];
if (!dev)
return -ENOMSG;
if (copy_to_user(dst, dev->id, ATA_ID_WORDS * sizeof(u16)))
return -EFAULT;
ata_id_string(dev->id, buf, ATA_ID_PROD, ATA_ID_PROD_LEN);
if (copy_to_user(dst + ATA_ID_PROD, buf, ATA_ID_PROD_LEN))
return -EFAULT;
ata_id_string(dev->id, buf, ATA_ID_FW_REV, ATA_ID_FW_REV_LEN);
if (copy_to_user(dst + ATA_ID_FW_REV, buf, ATA_ID_FW_REV_LEN))
return -EFAULT;
ata_id_string(dev->id, buf, ATA_ID_SERNO, ATA_ID_SERNO_LEN);
if (copy_to_user(dst + ATA_ID_SERNO, buf, ATA_ID_SERNO_LEN))
return -EFAULT;
return 0;
}
/**
* ata_cmd_ioctl - Handler for HDIO_DRIVE_CMD ioctl
* @scsidev: Device to which we are issuing command
* @arg: User provided data for issuing command
*
* LOCKING:
* Defined by the SCSI layer. We don't really care.
*
* RETURNS:
* Zero on success, negative errno on error.
*/
int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg)
{
int rc = 0;
u8 scsi_cmd[MAX_COMMAND_SIZE];
u8 args[4], *argbuf = NULL, *sensebuf = NULL;
int argsize = 0;
enum dma_data_direction data_dir;
int cmd_result;
if (arg == NULL)
return -EINVAL;
if (copy_from_user(args, arg, sizeof(args)))
return -EFAULT;
sensebuf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO);
if (!sensebuf)
return -ENOMEM;
memset(scsi_cmd, 0, sizeof(scsi_cmd));
if (args[3]) {
argsize = SECTOR_SIZE * args[3];
argbuf = kmalloc(argsize, GFP_KERNEL);
if (argbuf == NULL) {
rc = -ENOMEM;
goto error;
}
scsi_cmd[1] = (4 << 1); /* PIO Data-in */
scsi_cmd[2] = 0x0e; /* no off.line or cc, read from dev,
block count in sector count field */
data_dir = DMA_FROM_DEVICE;
} else {
scsi_cmd[1] = (3 << 1); /* Non-data */
scsi_cmd[2] = 0x20; /* cc but no off.line or data xfer */
data_dir = DMA_NONE;
}
scsi_cmd[0] = ATA_16;
scsi_cmd[4] = args[2];
if (args[0] == ATA_CMD_SMART) { /* hack -- ide driver does this too */
scsi_cmd[6] = args[3];
scsi_cmd[8] = args[1];
scsi_cmd[10] = 0x4f;
scsi_cmd[12] = 0xc2;
} else {
scsi_cmd[6] = args[1];
}
scsi_cmd[14] = args[0];
/* Good values for timeout and retries? Values below
from scsi_ioctl_send_command() for default case... */
cmd_result = scsi_execute(scsidev, scsi_cmd, data_dir, argbuf, argsize,
sensebuf, (10*HZ), 5, 0, NULL);
if (driver_byte(cmd_result) == DRIVER_SENSE) {/* sense data available */
u8 *desc = sensebuf + 8;
cmd_result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
/* If we set cc then ATA pass-through will cause a
* check condition even if no error. Filter that. */
if (cmd_result & SAM_STAT_CHECK_CONDITION) {
struct scsi_sense_hdr sshdr;
scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE,
&sshdr);
if (sshdr.sense_key == 0 &&
sshdr.asc == 0 && sshdr.ascq == 0)
cmd_result &= ~SAM_STAT_CHECK_CONDITION;
}
/* Send userspace a few ATA registers (same as drivers/ide) */
if (sensebuf[0] == 0x72 && /* format is "descriptor" */
desc[0] == 0x09) { /* code is "ATA Descriptor" */
args[0] = desc[13]; /* status */
args[1] = desc[3]; /* error */
args[2] = desc[5]; /* sector count (0:7) */
if (copy_to_user(arg, args, sizeof(args)))
rc = -EFAULT;
}
}
if (cmd_result) {
rc = -EIO;
goto error;
}
if ((argbuf)
&& copy_to_user(arg + sizeof(args), argbuf, argsize))
rc = -EFAULT;
error:
kfree(sensebuf);
kfree(argbuf);
return rc;
}
/**
* ata_task_ioctl - Handler for HDIO_DRIVE_TASK ioctl
* @scsidev: Device to which we are issuing command
* @arg: User provided data for issuing command
*
* LOCKING:
* Defined by the SCSI layer. We don't really care.
*
* RETURNS:
* Zero on success, negative errno on error.
*/
int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
{
int rc = 0;
u8 scsi_cmd[MAX_COMMAND_SIZE];
u8 args[7], *sensebuf = NULL;
int cmd_result;
if (arg == NULL)
return -EINVAL;
if (copy_from_user(args, arg, sizeof(args)))
return -EFAULT;
sensebuf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO);
if (!sensebuf)
return -ENOMEM;
memset(scsi_cmd, 0, sizeof(scsi_cmd));
scsi_cmd[0] = ATA_16;
scsi_cmd[1] = (3 << 1); /* Non-data */
scsi_cmd[2] = 0x20; /* cc but no off.line or data xfer */
scsi_cmd[4] = args[1];
scsi_cmd[6] = args[2];
scsi_cmd[8] = args[3];
scsi_cmd[10] = args[4];
scsi_cmd[12] = args[5];
scsi_cmd[13] = args[6] & 0x4f;
scsi_cmd[14] = args[0];
/* Good values for timeout and retries? Values below
from scsi_ioctl_send_command() for default case... */
cmd_result = scsi_execute(scsidev, scsi_cmd, DMA_NONE, NULL, 0,
sensebuf, (10*HZ), 5, 0, NULL);
if (driver_byte(cmd_result) == DRIVER_SENSE) {/* sense data available */
u8 *desc = sensebuf + 8;
cmd_result &= ~(0xFF<<24); /* DRIVER_SENSE is not an error */
/* If we set cc then ATA pass-through will cause a
* check condition even if no error. Filter that. */
if (cmd_result & SAM_STAT_CHECK_CONDITION) {
struct scsi_sense_hdr sshdr;
scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE,
&sshdr);
if (sshdr.sense_key == 0 &&
sshdr.asc == 0 && sshdr.ascq == 0)
cmd_result &= ~SAM_STAT_CHECK_CONDITION;
}
/* Send userspace ATA registers */
if (sensebuf[0] == 0x72 && /* format is "descriptor" */
desc[0] == 0x09) {/* code is "ATA Descriptor" */
args[0] = desc[13]; /* status */
args[1] = desc[3]; /* error */
args[2] = desc[5]; /* sector count (0:7) */
args[3] = desc[7]; /* lbal */
args[4] = desc[9]; /* lbam */
args[5] = desc[11]; /* lbah */
args[6] = desc[12]; /* select */
if (copy_to_user(arg, args, sizeof(args)))
rc = -EFAULT;
}
}
if (cmd_result) {
rc = -EIO;
goto error;
}
error:
kfree(sensebuf);
return rc;
}
static int ata_ioc32(struct ata_port *ap)
{
if (ap->flags & ATA_FLAG_PIO_DMA)
return 1;
if (ap->pflags & ATA_PFLAG_PIO32)
return 1;
return 0;
}
int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev,
int cmd, void __user *arg)
{
int val = -EINVAL, rc = -EINVAL;
unsigned long flags;
switch (cmd) {
case ATA_IOC_GET_IO32:
spin_lock_irqsave(ap->lock, flags);
val = ata_ioc32(ap);
spin_unlock_irqrestore(ap->lock, flags);
if (copy_to_user(arg, &val, 1))
return -EFAULT;
return 0;
case ATA_IOC_SET_IO32:
val = (unsigned long) arg;
rc = 0;
spin_lock_irqsave(ap->lock, flags);
if (ap->pflags & ATA_PFLAG_PIO32CHANGE) {
if (val)
ap->pflags |= ATA_PFLAG_PIO32;
else
ap->pflags &= ~ATA_PFLAG_PIO32;
} else {
if (val != ata_ioc32(ap))
rc = -EINVAL;
}
spin_unlock_irqrestore(ap->lock, flags);
return rc;
case HDIO_GET_IDENTITY:
return ata_get_identity(ap, scsidev, arg);
case HDIO_DRIVE_CMD:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
return ata_cmd_ioctl(scsidev, arg);
case HDIO_DRIVE_TASK:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
return ata_task_ioctl(scsidev, arg);
default:
rc = -ENOTTY;
break;
}
return rc;
}
EXPORT_SYMBOL_GPL(ata_sas_scsi_ioctl);
int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
{
return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host),
scsidev, cmd, arg);
}
EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
/**
* ata_scsi_qc_new - acquire new ata_queued_cmd reference
* @dev: ATA device to which the new command is attached
* @cmd: SCSI command that originated this ATA command
* @done: SCSI command completion function
*
* Obtain a reference to an unused ata_queued_cmd structure,
* which is the basic libata structure representing a single
* ATA command sent to the hardware.
*
* If a command was available, fill in the SCSI-specific
* portions of the structure with information on the
* current command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Command allocated, or %NULL if none available.
*/
static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *))
{
struct ata_queued_cmd *qc;
qc = ata_qc_new_init(dev);
if (qc) {
qc->scsicmd = cmd;
qc->scsidone = done;
qc->sg = scsi_sglist(cmd);
qc->n_elem = scsi_sg_count(cmd);
} else {
cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
done(cmd);
}
return qc;
}
static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *scmd = qc->scsicmd;
qc->extrabytes = scmd->request->extra_len;
qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes;
}
/**
* ata_dump_status - user friendly display of error info
* @id: id of the port in question
* @tf: ptr to filled out taskfile
*
* Decode and dump the ATA error/status registers for the user so
* that they have some idea what really happened at the non
* make-believe layer.
*
* LOCKING:
* inherited from caller
*/
static void ata_dump_status(unsigned id, struct ata_taskfile *tf)
{
u8 stat = tf->command, err = tf->feature;
printk(KERN_WARNING "ata%u: status=0x%02x { ", id, stat);
if (stat & ATA_BUSY) {
printk("Busy }\n"); /* Data is not valid in this case */
} else {
if (stat & 0x40) printk("DriveReady ");
if (stat & 0x20) printk("DeviceFault ");
if (stat & 0x10) printk("SeekComplete ");
if (stat & 0x08) printk("DataRequest ");
if (stat & 0x04) printk("CorrectedError ");
if (stat & 0x02) printk("Index ");
if (stat & 0x01) printk("Error ");
printk("}\n");
if (err) {
printk(KERN_WARNING "ata%u: error=0x%02x { ", id, err);
if (err & 0x04) printk("DriveStatusError ");
if (err & 0x80) {
if (err & 0x04) printk("BadCRC ");
else printk("Sector ");
}
if (err & 0x40) printk("UncorrectableError ");
if (err & 0x10) printk("SectorIdNotFound ");
if (err & 0x02) printk("TrackZeroNotFound ");
if (err & 0x01) printk("AddrMarkNotFound ");
printk("}\n");
}
}
}
/**
* ata_to_sense_error - convert ATA error to SCSI error
* @id: ATA device number
* @drv_stat: value contained in ATA status register
* @drv_err: value contained in ATA error register
* @sk: the sense key we'll fill out
* @asc: the additional sense code we'll fill out
* @ascq: the additional sense code qualifier we'll fill out
* @verbose: be verbose
*
* Converts an ATA error into a SCSI error. Fill out pointers to
* SK, ASC, and ASCQ bytes for later use in fixed or descriptor
* format sense blocks.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk,
u8 *asc, u8 *ascq, int verbose)
{
int i;
/* Based on the 3ware driver translation table */
static const unsigned char sense_table[][4] = {
/* BBD|ECC|ID|MAR */
{0xd1, ABORTED_COMMAND, 0x00, 0x00}, // Device busy Aborted command
/* BBD|ECC|ID */
{0xd0, ABORTED_COMMAND, 0x00, 0x00}, // Device busy Aborted command
/* ECC|MC|MARK */
{0x61, HARDWARE_ERROR, 0x00, 0x00}, // Device fault Hardware error
/* ICRC|ABRT */ /* NB: ICRC & !ABRT is BBD */
{0x84, ABORTED_COMMAND, 0x47, 0x00}, // Data CRC error SCSI parity error
/* MC|ID|ABRT|TRK0|MARK */
{0x37, NOT_READY, 0x04, 0x00}, // Unit offline Not ready
/* MCR|MARK */
{0x09, NOT_READY, 0x04, 0x00}, // Unrecovered disk error Not ready
/* Bad address mark */
{0x01, MEDIUM_ERROR, 0x13, 0x00}, // Address mark not found Address mark not found for data field
/* TRK0 */
{0x02, HARDWARE_ERROR, 0x00, 0x00}, // Track 0 not found Hardware error
/* Abort & !ICRC */
{0x04, ABORTED_COMMAND, 0x00, 0x00}, // Aborted command Aborted command
/* Media change request */
{0x08, NOT_READY, 0x04, 0x00}, // Media change request FIXME: faking offline
/* SRV */
{0x10, ABORTED_COMMAND, 0x14, 0x00}, // ID not found Recorded entity not found
/* Media change */
{0x08, NOT_READY, 0x04, 0x00}, // Media change FIXME: faking offline
/* ECC */
{0x40, MEDIUM_ERROR, 0x11, 0x04}, // Uncorrectable ECC error Unrecovered read error
/* BBD - block marked bad */
{0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error
{0xFF, 0xFF, 0xFF, 0xFF}, // END mark
};
static const unsigned char stat_table[][4] = {
/* Must be first because BUSY means no other bits valid */
{0x80, ABORTED_COMMAND, 0x47, 0x00}, // Busy, fake parity for now
{0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault
{0x08, ABORTED_COMMAND, 0x47, 0x00}, // Timed out in xfer, fake parity for now
{0x04, RECOVERED_ERROR, 0x11, 0x00}, // Recovered ECC error Medium error, recovered
{0xFF, 0xFF, 0xFF, 0xFF}, // END mark
};
/*
* Is this an error we can process/parse
*/
if (drv_stat & ATA_BUSY) {
drv_err = 0; /* Ignore the err bits, they're invalid */
}
if (drv_err) {
/* Look for drv_err */
for (i = 0; sense_table[i][0] != 0xFF; i++) {
/* Look for best matches first */
if ((sense_table[i][0] & drv_err) ==
sense_table[i][0]) {
*sk = sense_table[i][1];
*asc = sense_table[i][2];
*ascq = sense_table[i][3];
goto translate_done;
}
}
/* No immediate match */
if (verbose)
printk(KERN_WARNING "ata%u: no sense translation for "
"error 0x%02x\n", id, drv_err);
}
/* Fall back to interpreting status bits */
for (i = 0; stat_table[i][0] != 0xFF; i++) {
if (stat_table[i][0] & drv_stat) {
*sk = stat_table[i][1];
*asc = stat_table[i][2];
*ascq = stat_table[i][3];
goto translate_done;
}
}
/* No error? Undecoded? */
if (verbose)
printk(KERN_WARNING "ata%u: no sense translation for "
"status: 0x%02x\n", id, drv_stat);
/* We need a sensible error return here, which is tricky, and one
that won't cause people to do things like return a disk wrongly */
*sk = ABORTED_COMMAND;
*asc = 0x00;
*ascq = 0x00;
translate_done:
if (verbose)
printk(KERN_ERR "ata%u: translated ATA stat/err 0x%02x/%02x "
"to SCSI SK/ASC/ASCQ 0x%x/%02x/%02x\n",
id, drv_stat, drv_err, *sk, *asc, *ascq);
return;
}
/*
* ata_gen_passthru_sense - Generate check condition sense block.
* @qc: Command that completed.
*
* This function is specific to the ATA descriptor format sense
* block specified for the ATA pass through commands. Regardless
* of whether the command errored or not, return a sense
* block. Copy all controller registers into the sense
* block. Clear sense key, ASC & ASCQ if there is no error.
*
* LOCKING:
* None.
*/
static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->result_tf;
unsigned char *sb = cmd->sense_buffer;
unsigned char *desc = sb + 8;
int verbose = qc->ap->ops->error_handler == NULL;
memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
/*
* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
*/
if (qc->err_mask ||
tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose);
sb[1] &= 0x0f;
}
/*
* Sense data is current and format is descriptor.
*/
sb[0] = 0x72;
desc[0] = 0x09;
/* set length of additional sense data */
sb[7] = 14;
desc[1] = 12;
/*
* Copy registers into sense buffer.
*/
desc[2] = 0x00;
desc[3] = tf->feature; /* == error reg */
desc[5] = tf->nsect;
desc[7] = tf->lbal;
desc[9] = tf->lbam;
desc[11] = tf->lbah;
desc[12] = tf->device;
desc[13] = tf->command; /* == status reg */
/*
* Fill in Extend bit, and the high order bytes
* if applicable.
*/
if (tf->flags & ATA_TFLAG_LBA48) {
desc[2] |= 0x01;
desc[4] = tf->hob_nsect;
desc[6] = tf->hob_lbal;
desc[8] = tf->hob_lbam;
desc[10] = tf->hob_lbah;
}
}
/**
* ata_gen_ata_sense - generate a SCSI fixed sense block
* @qc: Command that we are erroring out
*
* Generate sense block for a failed ATA command @qc. Descriptor
* format is used to accomodate LBA48 block address.
*
* LOCKING:
* None.
*/
static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
{
struct ata_device *dev = qc->dev;
struct scsi_cmnd *cmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->result_tf;
unsigned char *sb = cmd->sense_buffer;
unsigned char *desc = sb + 8;
int verbose = qc->ap->ops->error_handler == NULL;
u64 block;
memset(sb, 0, SCSI_SENSE_BUFFERSIZE);
cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
/* sense data is current and format is descriptor */
sb[0] = 0x72;
/* Use ata_to_sense_error() to map status register bits
* onto sense key, asc & ascq.
*/
if (qc->err_mask ||
tf->command & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) {
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose);
sb[1] &= 0x0f;
}
block = ata_tf_read_block(&qc->result_tf, dev);
/* information sense data descriptor */
sb[7] = 12;
desc[0] = 0x00;
desc[1] = 10;
desc[2] |= 0x80; /* valid */
desc[6] = block >> 40;
desc[7] = block >> 32;
desc[8] = block >> 24;
desc[9] = block >> 16;
desc[10] = block >> 8;
desc[11] = block;
}
static void ata_scsi_sdev_config(struct scsi_device *sdev)
{
sdev->use_10_for_rw = 1;
sdev->use_10_for_ms = 1;
/* Schedule policy is determined by ->qc_defer() callback and
* it needs to see every deferred qc. Set dev_blocked to 1 to
* prevent SCSI midlayer from automatically deferring
* requests.
*/
sdev->max_device_blocked = 1;
}
/**
* atapi_drain_needed - Check whether data transfer may overflow
* @rq: request to be checked
*
* ATAPI commands which transfer variable length data to host
* might overflow due to application error or hardare bug. This
* function checks whether overflow should be drained and ignored
* for @request.
*
* LOCKING:
* None.
*
* RETURNS:
* 1 if ; otherwise, 0.
*/
static int atapi_drain_needed(struct request *rq)
{
if (likely(!blk_pc_request(rq)))
return 0;
if (!blk_rq_bytes(rq) || (rq->cmd_flags & REQ_RW))
return 0;
return atapi_cmd_type(rq->cmd[0]) == ATAPI_MISC;
}
static int ata_scsi_dev_config(struct scsi_device *sdev,
struct ata_device *dev)
{
if (!ata_id_has_unload(dev->id))
dev->flags |= ATA_DFLAG_NO_UNLOAD;
/* configure max sectors */
blk_queue_max_hw_sectors(sdev->request_queue, dev->max_sectors);
sdev->sector_size = ATA_SECT_SIZE;
if (dev->class == ATA_DEV_ATAPI) {
struct request_queue *q = sdev->request_queue;
void *buf;
/* set DMA padding */
blk_queue_update_dma_pad(sdev->request_queue,
ATA_DMA_PAD_SZ - 1);
/* configure draining */
buf = kmalloc(ATAPI_MAX_DRAIN, q->bounce_gfp | GFP_KERNEL);
if (!buf) {
ata_dev_printk(dev, KERN_ERR,
"drain buffer allocation failed\n");
return -ENOMEM;
}
blk_queue_dma_drain(q, atapi_drain_needed, buf, ATAPI_MAX_DRAIN);
} else {
sdev->manage_start_stop = 1;
}
/*
* ata_pio_sectors() expects buffer for each sector to not cross
* page boundary. Enforce it by requiring buffers to be sector
* aligned, which works iff sector_size is not larger than
* PAGE_SIZE. ATAPI devices also need the alignment as
* IDENTIFY_PACKET is executed as ATA_PROT_PIO.
*/
if (sdev->sector_size > PAGE_SIZE)
ata_dev_printk(dev, KERN_WARNING,
"sector_size=%u > PAGE_SIZE, PIO may malfunction\n",
sdev->sector_size);
blk_queue_update_dma_alignment(sdev->request_queue,
sdev->sector_size - 1);
if (dev->flags & ATA_DFLAG_AN)
set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
if (dev->flags & ATA_DFLAG_NCQ) {
int depth;
depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
depth = min(ATA_MAX_QUEUE - 1, depth);
scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
}
return 0;
}
/**
* ata_scsi_slave_config - Set SCSI device attributes
* @sdev: SCSI device to examine
*
* This is called before we actually start reading
* and writing to the device, to configure certain
* SCSI mid-layer behaviors.
*
* LOCKING:
* Defined by SCSI layer. We don't really care.
*/
int ata_scsi_slave_config(struct scsi_device *sdev)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
int rc = 0;
ata_scsi_sdev_config(sdev);
if (dev)
rc = ata_scsi_dev_config(sdev, dev);
return rc;
}
/**
* ata_scsi_slave_destroy - SCSI device is about to be destroyed
* @sdev: SCSI device to be destroyed
*
* @sdev is about to be destroyed for hot/warm unplugging. If
* this unplugging was initiated by libata as indicated by NULL
* dev->sdev, this function doesn't have to do anything.
* Otherwise, SCSI layer initiated warm-unplug is in progress.
* Clear dev->sdev, schedule the device for ATA detach and invoke
* EH.
*
* LOCKING:
* Defined by SCSI layer. We don't really care.
*/
void ata_scsi_slave_destroy(struct scsi_device *sdev)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct request_queue *q = sdev->request_queue;
unsigned long flags;
struct ata_device *dev;
if (!ap->ops->error_handler)
return;
spin_lock_irqsave(ap->lock, flags);
dev = __ata_scsi_find_dev(ap, sdev);
if (dev && dev->sdev) {
/* SCSI device already in CANCEL state, no need to offline it */
dev->sdev = NULL;
dev->flags |= ATA_DFLAG_DETACH;
ata_port_schedule_eh(ap);
}
spin_unlock_irqrestore(ap->lock, flags);
kfree(q->dma_drain_buffer);
q->dma_drain_buffer = NULL;
q->dma_drain_size = 0;
}
/**
* ata_scsi_change_queue_depth - SCSI callback for queue depth config
* @sdev: SCSI device to configure queue depth for
* @queue_depth: new queue depth
* @reason: calling context
*
* This is libata standard hostt->change_queue_depth callback.
* SCSI will call into this callback when user tries to set queue
* depth via sysfs.
*
* LOCKING:
* SCSI layer (we don't care)
*
* RETURNS:
* Newly configured queue depth.
*/
int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth,
int reason)
{
struct ata_port *ap = ata_shost_to_port(sdev->host);
struct ata_device *dev;
unsigned long flags;
if (reason != SCSI_QDEPTH_DEFAULT)
return -EOPNOTSUPP;
if (queue_depth < 1 || queue_depth == sdev->queue_depth)
return sdev->queue_depth;
dev = ata_scsi_find_dev(ap, sdev);
if (!dev || !ata_dev_enabled(dev))
return sdev->queue_depth;
/* NCQ enabled? */
spin_lock_irqsave(ap->lock, flags);
dev->flags &= ~ATA_DFLAG_NCQ_OFF;
if (queue_depth == 1 || !ata_ncq_enabled(dev)) {
dev->flags |= ATA_DFLAG_NCQ_OFF;
queue_depth = 1;
}
spin_unlock_irqrestore(ap->lock, flags);
/* limit and apply queue depth */
queue_depth = min(queue_depth, sdev->host->can_queue);
queue_depth = min(queue_depth, ata_id_queue_depth(dev->id));
queue_depth = min(queue_depth, ATA_MAX_QUEUE - 1);
if (sdev->queue_depth == queue_depth)
return -EINVAL;
scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, queue_depth);
return queue_depth;
}
/**
* ata_scsi_start_stop_xlat - Translate SCSI START STOP UNIT command
* @qc: Storage for translated ATA taskfile
*
* Sets up an ATA taskfile to issue STANDBY (to stop) or READ VERIFY
* (to start). Perhaps these commands should be preceded by
* CHECK POWER MODE to see what power mode the device is already in.
* [See SAT revision 5 at www.t10.org]
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, non-zero on error.
*/
static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->tf;
const u8 *cdb = scmd->cmnd;
if (scmd->cmd_len < 5)
goto invalid_fld;
tf->flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
tf->protocol = ATA_PROT_NODATA;
if (cdb[1] & 0x1) {
; /* ignore IMMED bit, violates sat-r05 */
}
if (cdb[4] & 0x2)
goto invalid_fld; /* LOEJ bit set not supported */
if (((cdb[4] >> 4) & 0xf) != 0)
goto invalid_fld; /* power conditions not supported */
if (cdb[4] & 0x1) {
tf->nsect = 1; /* 1 sector, lba=0 */
if (qc->dev->flags & ATA_DFLAG_LBA) {
tf->flags |= ATA_TFLAG_LBA;
tf->lbah = 0x0;
tf->lbam = 0x0;
tf->lbal = 0x0;
tf->device |= ATA_LBA;
} else {
/* CHS */
tf->lbal = 0x1; /* sect */
tf->lbam = 0x0; /* cyl low */
tf->lbah = 0x0; /* cyl high */
}
tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
} else {
/* Some odd clown BIOSen issue spindown on power off (ACPI S4
* or S5) causing some drives to spin up and down again.
*/
if ((qc->ap->flags & ATA_FLAG_NO_POWEROFF_SPINDOWN) &&
system_state == SYSTEM_POWER_OFF)
goto skip;
if ((qc->ap->flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) &&
system_entering_hibernation())
goto skip;
/* Issue ATA STANDBY IMMEDIATE command */
tf->command = ATA_CMD_STANDBYNOW1;
}
/*
* Standby and Idle condition timers could be implemented but that
* would require libata to implement the Power condition mode page
* and allow the user to change it. Changing mode pages requires
* MODE SELECT to be implemented.
*/
return 0;
invalid_fld:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0);
/* "Invalid field in cbd" */
return 1;
skip:
scmd->result = SAM_STAT_GOOD;
return 1;
}
/**
* ata_scsi_flush_xlat - Translate SCSI SYNCHRONIZE CACHE command
* @qc: Storage for translated ATA taskfile
*
* Sets up an ATA taskfile to issue FLUSH CACHE or
* FLUSH CACHE EXT.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, non-zero on error.
*/
static unsigned int ata_scsi_flush_xlat(struct ata_queued_cmd *qc)
{
struct ata_taskfile *tf = &qc->tf;
tf->flags |= ATA_TFLAG_DEVICE;
tf->protocol = ATA_PROT_NODATA;
if (qc->dev->flags & ATA_DFLAG_FLUSH_EXT)
tf->command = ATA_CMD_FLUSH_EXT;
else
tf->command = ATA_CMD_FLUSH;
/* flush is critical for IO integrity, consider it an IO command */
qc->flags |= ATA_QCFLAG_IO;
return 0;
}
/**
* scsi_6_lba_len - Get LBA and transfer length
* @cdb: SCSI command to translate
*
* Calculate LBA and transfer length for 6-byte commands.
*
* RETURNS:
* @plba: the LBA
* @plen: the transfer length
*/
static void scsi_6_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
u64 lba = 0;
u32 len;
VPRINTK("six-byte command\n");
lba |= ((u64)(cdb[1] & 0x1f)) << 16;
lba |= ((u64)cdb[2]) << 8;
lba |= ((u64)cdb[3]);
len = cdb[4];
*plba = lba;
*plen = len;
}
/**
* scsi_10_lba_len - Get LBA and transfer length
* @cdb: SCSI command to translate
*
* Calculate LBA and transfer length for 10-byte commands.
*
* RETURNS:
* @plba: the LBA
* @plen: the transfer length
*/
static void scsi_10_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
u64 lba = 0;
u32 len = 0;
VPRINTK("ten-byte command\n");
lba |= ((u64)cdb[2]) << 24;
lba |= ((u64)cdb[3]) << 16;
lba |= ((u64)cdb[4]) << 8;
lba |= ((u64)cdb[5]);
len |= ((u32)cdb[7]) << 8;
len |= ((u32)cdb[8]);
*plba = lba;
*plen = len;
}
/**
* scsi_16_lba_len - Get LBA and transfer length
* @cdb: SCSI command to translate
*
* Calculate LBA and transfer length for 16-byte commands.
*
* RETURNS:
* @plba: the LBA
* @plen: the transfer length
*/
static void scsi_16_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{
u64 lba = 0;
u32 len = 0;
VPRINTK("sixteen-byte command\n");
lba |= ((u64)cdb[2]) << 56;
lba |= ((u64)cdb[3]) << 48;
lba |= ((u64)cdb[4]) << 40;
lba |= ((u64)cdb[5]) << 32;
lba |= ((u64)cdb[6]) << 24;
lba |= ((u64)cdb[7]) << 16;
lba |= ((u64)cdb[8]) << 8;
lba |= ((u64)cdb[9]);
len |= ((u32)cdb[10]) << 24;
len |= ((u32)cdb[11]) << 16;
len |= ((u32)cdb[12]) << 8;
len |= ((u32)cdb[13]);
*plba = lba;
*plen = len;
}
/**
* ata_scsi_verify_xlat - Translate SCSI VERIFY command into an ATA one
* @qc: Storage for translated ATA taskfile
*
* Converts SCSI VERIFY command to an ATA READ VERIFY command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, non-zero on error.
*/
static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_taskfile *tf = &qc->tf;
struct ata_device *dev = qc->dev;
u64 dev_sectors = qc->dev->n_sectors;
const u8 *cdb = scmd->cmnd;
u64 block;
u32 n_block;
tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
tf->protocol = ATA_PROT_NODATA;
if (cdb[0] == VERIFY) {
if (scmd->cmd_len < 10)
goto invalid_fld;
scsi_10_lba_len(cdb, &block, &n_block);
} else if (cdb[0] == VERIFY_16) {
if (scmd->cmd_len < 16)
goto invalid_fld;
scsi_16_lba_len(cdb, &block, &n_block);
} else
goto invalid_fld;
if (!n_block)
goto nothing_to_do;
if (block >= dev_sectors)
goto out_of_range;
if ((block + n_block) > dev_sectors)
goto out_of_range;
if (dev->flags & ATA_DFLAG_LBA) {
tf->flags |= ATA_TFLAG_LBA;
if (lba_28_ok(block, n_block)) {
/* use LBA28 */
tf->command = ATA_CMD_VERIFY;
tf->device |= (block >> 24) & 0xf;
} else if (lba_48_ok(block, n_block)) {
if (!(dev->flags & ATA_DFLAG_LBA48))
goto out_of_range;
/* use LBA48 */
tf->flags |= ATA_TFLAG_LBA48;
tf->command = ATA_CMD_VERIFY_EXT;
tf->hob_nsect = (n_block >> 8) & 0xff;
tf->hob_lbah = (block >> 40) & 0xff;
tf->hob_lbam = (block >> 32) & 0xff;
tf->hob_lbal = (block >> 24) & 0xff;
} else
/* request too large even for LBA48 */
goto out_of_range;
tf->nsect = n_block & 0xff;
tf->lbah = (block >> 16) & 0xff;
tf->lbam = (block >> 8) & 0xff;
tf->lbal = block & 0xff;
tf->device |= ATA_LBA;
} else {
/* CHS */
u32 sect, head, cyl, track;
if (!lba_28_ok(block, n_block))
goto out_of_range;
/* Convert LBA to CHS */
track = (u32)block / dev->sectors;
cyl = track / dev->heads;
head = track % dev->heads;
sect = (u32)block % dev->sectors + 1;
DPRINTK("block %u track %u cyl %u head %u sect %u\n",
(u32)block, track, cyl, head, sect);
/* Check whether the converted CHS can fit.
Cylinder: 0-65535
Head: 0-15
Sector: 1-255*/
if ((cyl >> 16) || (head >> 4) || (sect >> 8) || (!sect))
goto out_of_range;
tf->command = ATA_CMD_VERIFY;
tf->nsect = n_block & 0xff; /* Sector count 0 means 256 sectors */
tf->lbal = sect;
tf->lbam = cyl;
tf->lbah = cyl >> 8;
tf->device |= head;
}
return 0;
invalid_fld:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0);
/* "Invalid field in cbd" */
return 1;
out_of_range:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x21, 0x0);
/* "Logical Block Address out of range" */
return 1;
nothing_to_do:
scmd->result = SAM_STAT_GOOD;
return 1;
}
/**
* ata_scsi_rw_xlat - Translate SCSI r/w command into an ATA one
* @qc: Storage for translated ATA taskfile
*
* Converts any of six SCSI read/write commands into the
* ATA counterpart, including starting sector (LBA),
* sector count, and taking into account the device's LBA48
* support.
*
* Commands %READ_6, %READ_10, %READ_16, %WRITE_6, %WRITE_10, and
* %WRITE_16 are currently supported.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, non-zero on error.
*/
static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *scmd = qc->scsicmd;
const u8 *cdb = scmd->cmnd;
unsigned int tf_flags = 0;
u64 block;
u32 n_block;
int rc;
if (cdb[0] == WRITE_10 || cdb[0] == WRITE_6 || cdb[0] == WRITE_16)
tf_flags |= ATA_TFLAG_WRITE;
/* Calculate the SCSI LBA, transfer length and FUA. */
switch (cdb[0]) {
case READ_10:
case WRITE_10:
if (unlikely(scmd->cmd_len < 10))
goto invalid_fld;
scsi_10_lba_len(cdb, &block, &n_block);
if (unlikely(cdb[1] & (1 << 3)))
tf_flags |= ATA_TFLAG_FUA;
break;
case READ_6:
case WRITE_6:
if (unlikely(scmd->cmd_len < 6))
goto invalid_fld;
scsi_6_lba_len(cdb, &block, &n_block);
/* for 6-byte r/w commands, transfer length 0
* means 256 blocks of data, not 0 block.
*/
if (!n_block)
n_block = 256;
break;
case READ_16:
case WRITE_16:
if (unlikely(scmd->cmd_len < 16))
goto invalid_fld;
scsi_16_lba_len(cdb, &block, &n_block);
if (unlikely(cdb[1] & (1 << 3)))
tf_flags |= ATA_TFLAG_FUA;
break;
default:
DPRINTK("no-byte command\n");
goto invalid_fld;
}
/* Check and compose ATA command */
if (!n_block)
/* For 10-byte and 16-byte SCSI R/W commands, transfer
* length 0 means transfer 0 block of data.
* However, for ATA R/W commands, sector count 0 means
* 256 or 65536 sectors, not 0 sectors as in SCSI.
*
* WARNING: one or two older ATA drives treat 0 as 0...
*/
goto nothing_to_do;
qc->flags |= ATA_QCFLAG_IO;
qc->nbytes = n_block * ATA_SECT_SIZE;
rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags,
qc->tag);
if (likely(rc == 0))
return 0;
if (rc == -ERANGE)
goto out_of_range;
/* treat all other errors as -EINVAL, fall through */
invalid_fld:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x0);
/* "Invalid field in cbd" */
return 1;
out_of_range:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x21, 0x0);
/* "Logical Block Address out of range" */
return 1;
nothing_to_do:
scmd->result = SAM_STAT_GOOD;
return 1;
}
static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct scsi_cmnd *cmd = qc->scsicmd;
u8 *cdb = cmd->cmnd;
int need_sense = (qc->err_mask != 0);
/* For ATA pass thru (SAT) commands, generate a sense block if
* user mandated it or if there's an error. Note that if we
* generate because the user forced us to, a check condition
* is generated and the ATA register values are returned
* whether the command completed successfully or not. If there
* was no error, SK, ASC and ASCQ will all be zero.
*/
if (((cdb[0] == ATA_16) || (cdb[0] == ATA_12)) &&
((cdb[2] & 0x20) || need_sense)) {
ata_gen_passthru_sense(qc);
} else {
if (!need_sense) {
cmd->result = SAM_STAT_GOOD;
} else {
/* TODO: decide which descriptor format to use
* for 48b LBA devices and call that here
* instead of the fixed desc, which is only
* good for smaller LBA (and maybe CHS?)
* devices.
*/
ata_gen_ata_sense(qc);
}
}
if (need_sense && !ap->ops->error_handler)
ata_dump_status(ap->print_id, &qc->result_tf);
qc->scsidone(cmd);
ata_qc_free(qc);
}
/**
* ata_scsi_translate - Translate then issue SCSI command to ATA device
* @dev: ATA device to which the command is addressed
* @cmd: SCSI command to execute
* @done: SCSI command completion function
* @xlat_func: Actor which translates @cmd to an ATA taskfile
*
* Our ->queuecommand() function has decided that the SCSI
* command issued can be directly translated into an ATA
* command, rather than handled internally.
*
* This function sets up an ata_queued_cmd structure for the
* SCSI command, and sends that ata_queued_cmd to the hardware.
*
* The xlat_func argument (actor) returns 0 if ready to execute
* ATA command, else 1 to finish translation. If 1 is returned
* then cmd->result (and possibly cmd->sense_buffer) are assumed
* to be set reflecting an error condition or clean (early)
* termination.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* 0 on success, SCSI_ML_QUEUE_DEVICE_BUSY if the command
* needs to be deferred.
*/
static int ata_scsi_translate(struct ata_device *dev, struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
ata_xlat_func_t xlat_func)
{
struct ata_port *ap = dev->link->ap;
struct ata_queued_cmd *qc;
int rc;
VPRINTK("ENTER\n");
qc = ata_scsi_qc_new(dev, cmd, done);
if (!qc)
goto err_mem;
/* data is present; dma-map it */
if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
cmd->sc_data_direction == DMA_TO_DEVICE) {
if (unlikely(scsi_bufflen(cmd) < 1)) {
ata_dev_printk(dev, KERN_WARNING,
"WARNING: zero len r/w req\n");
goto err_did;
}
ata_sg_init(qc, scsi_sglist(cmd), scsi_sg_count(cmd));
qc->dma_dir = cmd->sc_data_direction;
}
qc->complete_fn = ata_scsi_qc_complete;
if (xlat_func(qc))
goto early_finish;
if (ap->ops->qc_defer) {
if ((rc = ap->ops->qc_defer(qc)))
goto defer;
}
/* select device, send command to hardware */
ata_qc_issue(qc);
VPRINTK("EXIT\n");
return 0;
early_finish:
ata_qc_free(qc);
qc->scsidone(cmd);
DPRINTK("EXIT - early finish (good or error)\n");
return 0;
err_did:
ata_qc_free(qc);
cmd->result = (DID_ERROR << 16);
qc->scsidone(cmd);
err_mem:
DPRINTK("EXIT - internal\n");
return 0;
defer:
ata_qc_free(qc);
DPRINTK("EXIT - defer\n");
if (rc == ATA_DEFER_LINK)
return SCSI_MLQUEUE_DEVICE_BUSY;
else
return SCSI_MLQUEUE_HOST_BUSY;
}
/**
* ata_scsi_rbuf_get - Map response buffer.
* @cmd: SCSI command containing buffer to be mapped.
* @flags: unsigned long variable to store irq enable status
* @copy_in: copy in from user buffer
*
* Prepare buffer for simulated SCSI commands.
*
* LOCKING:
* spin_lock_irqsave(ata_scsi_rbuf_lock) on success
*
* RETURNS:
* Pointer to response buffer.
*/
static void *ata_scsi_rbuf_get(struct scsi_cmnd *cmd, bool copy_in,
unsigned long *flags)
{
spin_lock_irqsave(&ata_scsi_rbuf_lock, *flags);
memset(ata_scsi_rbuf, 0, ATA_SCSI_RBUF_SIZE);
if (copy_in)
sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd),
ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE);
return ata_scsi_rbuf;
}
/**
* ata_scsi_rbuf_put - Unmap response buffer.
* @cmd: SCSI command containing buffer to be unmapped.
* @copy_out: copy out result
* @flags: @flags passed to ata_scsi_rbuf_get()
*
* Returns rbuf buffer. The result is copied to @cmd's buffer if
* @copy_back is true.
*
* LOCKING:
* Unlocks ata_scsi_rbuf_lock.
*/
static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, bool copy_out,
unsigned long *flags)
{
if (copy_out)
sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd),
ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE);
spin_unlock_irqrestore(&ata_scsi_rbuf_lock, *flags);
}
/**
* ata_scsi_rbuf_fill - wrapper for SCSI command simulators
* @args: device IDENTIFY data / SCSI command of interest.
* @actor: Callback hook for desired SCSI command simulator
*
* Takes care of the hard work of simulating a SCSI command...
* Mapping the response buffer, calling the command's handler,
* and handling the handler's return value. This return value
* indicates whether the handler wishes the SCSI command to be
* completed successfully (0), or not (in which case cmd->result
* and sense buffer are assumed to be set).
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
unsigned int (*actor)(struct ata_scsi_args *args, u8 *rbuf))
{
u8 *rbuf;
unsigned int rc;
struct scsi_cmnd *cmd = args->cmd;
unsigned long flags;
rbuf = ata_scsi_rbuf_get(cmd, false, &flags);
rc = actor(args, rbuf);
ata_scsi_rbuf_put(cmd, rc == 0, &flags);
if (rc == 0)
cmd->result = SAM_STAT_GOOD;
args->done(cmd);
}
/**
* ata_scsiop_inq_std - Simulate INQUIRY command
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Returns standard device identification data associated
* with non-VPD INQUIRY command output.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
{
const u8 versions[] = {
0x60, /* SAM-3 (no version claimed) */
0x03,
0x20, /* SBC-2 (no version claimed) */
0x02,
0x60 /* SPC-3 (no version claimed) */
};
u8 hdr[] = {
TYPE_DISK,
0,
0x5, /* claim SPC-3 version compatibility */
2,
95 - 4
};
VPRINTK("ENTER\n");
/* set scsi removeable (RMB) bit per ata bit */
if (ata_id_removeable(args->id))
hdr[1] |= (1 << 7);
memcpy(rbuf, hdr, sizeof(hdr));
memcpy(&rbuf[8], "ATA ", 8);
ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
if (rbuf[32] == 0 || rbuf[32] == ' ')
memcpy(&rbuf[32], "n/a ", 4);
memcpy(rbuf + 59, versions, sizeof(versions));
return 0;
}
/**
* ata_scsiop_inq_00 - Simulate INQUIRY VPD page 0, list of pages
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Returns list of inquiry VPD pages available.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf)
{
const u8 pages[] = {
0x00, /* page 0x00, this page */
0x80, /* page 0x80, unit serial no page */
0x83, /* page 0x83, device ident page */
0x89, /* page 0x89, ata info page */
0xb0, /* page 0xb0, block limits page */
0xb1, /* page 0xb1, block device characteristics page */
};
rbuf[3] = sizeof(pages); /* number of supported VPD pages */
memcpy(rbuf + 4, pages, sizeof(pages));
return 0;
}
/**
* ata_scsiop_inq_80 - Simulate INQUIRY VPD page 80, device serial number
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Returns ATA device serial number.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf)
{
const u8 hdr[] = {
0,
0x80, /* this page code */
0,
ATA_ID_SERNO_LEN, /* page len */
};
memcpy(rbuf, hdr, sizeof(hdr));
ata_id_string(args->id, (unsigned char *) &rbuf[4],
ATA_ID_SERNO, ATA_ID_SERNO_LEN);
return 0;
}
/**
* ata_scsiop_inq_83 - Simulate INQUIRY VPD page 83, device identity
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Yields two logical unit device identification designators:
* - vendor specific ASCII containing the ATA serial number
* - SAT defined "t10 vendor id based" containing ASCII vendor
* name ("ATA "), model and serial numbers.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf)
{
const int sat_model_serial_desc_len = 68;
int num;
rbuf[1] = 0x83; /* this page code */
num = 4;
/* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
rbuf[num + 0] = 2;
rbuf[num + 3] = ATA_ID_SERNO_LEN;
num += 4;
ata_id_string(args->id, (unsigned char *) rbuf + num,
ATA_ID_SERNO, ATA_ID_SERNO_LEN);
num += ATA_ID_SERNO_LEN;
/* SAT defined lu model and serial numbers descriptor */
/* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
rbuf[num + 0] = 2;
rbuf[num + 1] = 1;
rbuf[num + 3] = sat_model_serial_desc_len;
num += 4;
memcpy(rbuf + num, "ATA ", 8);
num += 8;
ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD,
ATA_ID_PROD_LEN);
num += ATA_ID_PROD_LEN;
ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO,
ATA_ID_SERNO_LEN);
num += ATA_ID_SERNO_LEN;
rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */
return 0;
}
/**
* ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Yields SAT-specified ATA VPD page.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
{
struct ata_taskfile tf;
memset(&tf, 0, sizeof(tf));
rbuf[1] = 0x89; /* our page code */
rbuf[2] = (0x238 >> 8); /* page size fixed at 238h */
rbuf[3] = (0x238 & 0xff);
memcpy(&rbuf[8], "linux ", 8);
memcpy(&rbuf[16], "libata ", 16);
memcpy(&rbuf[32], DRV_VERSION, 4);
ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
/* we don't store the ATA device signature, so we fake it */
tf.command = ATA_DRDY; /* really, this is Status reg */
tf.lbal = 0x1;
tf.nsect = 0x1;
ata_tf_to_fis(&tf, 0, 1, &rbuf[36]); /* TODO: PMP? */
rbuf[36] = 0x34; /* force D2H Reg FIS (34h) */
rbuf[56] = ATA_CMD_ID_ATA;
memcpy(&rbuf[60], &args->id[0], 512);
return 0;
}
static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf)
{
u32 min_io_sectors;
rbuf[1] = 0xb0;
rbuf[3] = 0x3c; /* required VPD size with unmap support */
/*
* Optimal transfer length granularity.
*
* This is always one physical block, but for disks with a smaller
* logical than physical sector size we need to figure out what the
* latter is.
*/
if (ata_id_has_large_logical_sectors(args->id))
min_io_sectors = ata_id_logical_per_physical_sectors(args->id);
else
min_io_sectors = 1;
put_unaligned_be16(min_io_sectors, &rbuf[6]);
/*
* Optimal unmap granularity.
*
* The ATA spec doesn't even know about a granularity or alignment
* for the TRIM command. We can leave away most of the unmap related
* VPD page entries, but we have specifify a granularity to signal
* that we support some form of unmap - in thise case via WRITE SAME
* with the unmap bit set.
*/
if (ata_id_has_trim(args->id)) {
put_unaligned_be32(65535 * 512 / 8, &rbuf[20]);
put_unaligned_be32(1, &rbuf[28]);
}
return 0;
}
static unsigned int ata_scsiop_inq_b1(struct ata_scsi_args *args, u8 *rbuf)
{
int form_factor = ata_id_form_factor(args->id);
int media_rotation_rate = ata_id_rotation_rate(args->id);
rbuf[1] = 0xb1;
rbuf[3] = 0x3c;
rbuf[4] = media_rotation_rate >> 8;
rbuf[5] = media_rotation_rate;
rbuf[7] = form_factor;
return 0;
}
/**
* ata_scsiop_noop - Command handler that simply returns success.
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* No operation. Simply returns success to caller, to indicate
* that the caller should successfully complete this SCSI command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf)
{
VPRINTK("ENTER\n");
return 0;
}
/**
* ata_msense_caching - Simulate MODE SENSE caching info page
* @id: device IDENTIFY data
* @buf: output buffer
*
* Generate a caching info page, which conditionally indicates
* write caching to the SCSI layer, depending on device
* capabilities.
*
* LOCKING:
* None.
*/
static unsigned int ata_msense_caching(u16 *id, u8 *buf)
{
memcpy(buf, def_cache_mpage, sizeof(def_cache_mpage));
if (ata_id_wcache_enabled(id))
buf[2] |= (1 << 2); /* write cache enable */
if (!ata_id_rahead_enabled(id))
buf[12] |= (1 << 5); /* disable read ahead */
return sizeof(def_cache_mpage);
}
/**
* ata_msense_ctl_mode - Simulate MODE SENSE control mode page
* @buf: output buffer
*
* Generate a generic MODE SENSE control mode page.
*
* LOCKING:
* None.
*/
static unsigned int ata_msense_ctl_mode(u8 *buf)
{
memcpy(buf, def_control_mpage, sizeof(def_control_mpage));
return sizeof(def_control_mpage);
}
/**
* ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page
* @buf: output buffer
*
* Generate a generic MODE SENSE r/w error recovery page.
*
* LOCKING:
* None.
*/
static unsigned int ata_msense_rw_recovery(u8 *buf)
{
memcpy(buf, def_rw_recovery_mpage, sizeof(def_rw_recovery_mpage));
return sizeof(def_rw_recovery_mpage);
}
/*
* We can turn this into a real blacklist if it's needed, for now just
* blacklist any Maxtor BANC1G10 revision firmware
*/
static int ata_dev_supports_fua(u16 *id)
{
unsigned char model[ATA_ID_PROD_LEN + 1], fw[ATA_ID_FW_REV_LEN + 1];
if (!libata_fua)
return 0;
if (!ata_id_has_fua(id))
return 0;
ata_id_c_string(id, model, ATA_ID_PROD, sizeof(model));
ata_id_c_string(id, fw, ATA_ID_FW_REV, sizeof(fw));
if (strcmp(model, "Maxtor"))
return 1;
if (strcmp(fw, "BANC1G10"))
return 1;
return 0; /* blacklisted */
}
/**
* ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Simulate MODE SENSE commands. Assume this is invoked for direct
* access devices (e.g. disks) only. There should be no block
* descriptor for other device types.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf)
{
struct ata_device *dev = args->dev;
u8 *scsicmd = args->cmd->cmnd, *p = rbuf;
const u8 sat_blk_desc[] = {
0, 0, 0, 0, /* number of blocks: sat unspecified */
0,
0, 0x2, 0x0 /* block length: 512 bytes */
};
u8 pg, spg;
unsigned int ebd, page_control, six_byte;
u8 dpofua;
VPRINTK("ENTER\n");
six_byte = (scsicmd[0] == MODE_SENSE);
ebd = !(scsicmd[1] & 0x8); /* dbd bit inverted == edb */
/*
* LLBA bit in msense(10) ignored (compliant)
*/
page_control = scsicmd[2] >> 6;
switch (page_control) {
case 0: /* current */
break; /* supported */
case 3: /* saved */
goto saving_not_supp;
case 1: /* changeable */
case 2: /* defaults */
default:
goto invalid_fld;
}
if (six_byte)
p += 4 + (ebd ? 8 : 0);
else
p += 8 + (ebd ? 8 : 0);
pg = scsicmd[2] & 0x3f;
spg = scsicmd[3];
/*
* No mode subpages supported (yet) but asking for _all_
* subpages may be valid
*/
if (spg && (spg != ALL_SUB_MPAGES))
goto invalid_fld;
switch(pg) {
case RW_RECOVERY_MPAGE:
p += ata_msense_rw_recovery(p);
break;
case CACHE_MPAGE:
p += ata_msense_caching(args->id, p);
break;
case CONTROL_MPAGE:
p += ata_msense_ctl_mode(p);
break;
case ALL_MPAGES:
p += ata_msense_rw_recovery(p);
p += ata_msense_caching(args->id, p);
p += ata_msense_ctl_mode(p);
break;
default: /* invalid page code */
goto invalid_fld;
}
dpofua = 0;
if (ata_dev_supports_fua(args->id) && (dev->flags & ATA_DFLAG_LBA48) &&
(!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count))
dpofua = 1 << 4;
if (six_byte) {
rbuf[0] = p - rbuf - 1;
rbuf[2] |= dpofua;
if (ebd) {
rbuf[3] = sizeof(sat_blk_desc);
memcpy(rbuf + 4, sat_blk_desc, sizeof(sat_blk_desc));
}
} else {
unsigned int output_len = p - rbuf - 2;
rbuf[0] = output_len >> 8;
rbuf[1] = output_len;
rbuf[3] |= dpofua;
if (ebd) {
rbuf[7] = sizeof(sat_blk_desc);
memcpy(rbuf + 8, sat_blk_desc, sizeof(sat_blk_desc));
}
}
return 0;
invalid_fld:
ata_scsi_set_sense(args->cmd, ILLEGAL_REQUEST, 0x24, 0x0);
/* "Invalid field in cbd" */
return 1;
saving_not_supp:
ata_scsi_set_sense(args->cmd, ILLEGAL_REQUEST, 0x39, 0x0);
/* "Saving parameters not supported" */
return 1;
}
/**
* ata_scsiop_read_cap - Simulate READ CAPACITY[ 16] commands
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Simulate READ CAPACITY commands.
*
* LOCKING:
* None.
*/
static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf)
{
struct ata_device *dev = args->dev;
u64 last_lba = dev->n_sectors - 1; /* LBA of the last block */
u8 log_per_phys = 0;
u16 lowest_aligned = 0;
u16 word_106 = dev->id[106];
u16 word_209 = dev->id[209];
if ((word_106 & 0xc000) == 0x4000) {
/* Number and offset of logical sectors per physical sector */
if (word_106 & (1 << 13))
log_per_phys = word_106 & 0xf;
if ((word_209 & 0xc000) == 0x4000) {
u16 first = dev->id[209] & 0x3fff;
if (first > 0)
lowest_aligned = (1 << log_per_phys) - first;
}
}
VPRINTK("ENTER\n");
if (args->cmd->cmnd[0] == READ_CAPACITY) {
if (last_lba >= 0xffffffffULL)
last_lba = 0xffffffff;
/* sector count, 32-bit */
rbuf[0] = last_lba >> (8 * 3);
rbuf[1] = last_lba >> (8 * 2);
rbuf[2] = last_lba >> (8 * 1);
rbuf[3] = last_lba;
/* sector size */
rbuf[6] = ATA_SECT_SIZE >> 8;
rbuf[7] = ATA_SECT_SIZE & 0xff;
} else {
/* sector count, 64-bit */
rbuf[0] = last_lba >> (8 * 7);
rbuf[1] = last_lba >> (8 * 6);
rbuf[2] = last_lba >> (8 * 5);
rbuf[3] = last_lba >> (8 * 4);
rbuf[4] = last_lba >> (8 * 3);
rbuf[5] = last_lba >> (8 * 2);
rbuf[6] = last_lba >> (8 * 1);
rbuf[7] = last_lba;
/* sector size */
rbuf[10] = ATA_SECT_SIZE >> 8;
rbuf[11] = ATA_SECT_SIZE & 0xff;
rbuf[12] = 0;
rbuf[13] = log_per_phys;
rbuf[14] = (lowest_aligned >> 8) & 0x3f;
rbuf[15] = lowest_aligned;
if (ata_id_has_trim(args->id)) {
rbuf[14] |= 0x80; /* TPE */
if (ata_id_has_zero_after_trim(args->id))
rbuf[14] |= 0x40; /* TPRZ */
}
}
return 0;
}
/**
* ata_scsiop_report_luns - Simulate REPORT LUNS command
* @args: device IDENTIFY data / SCSI command of interest.
* @rbuf: Response buffer, to which simulated SCSI cmd output is sent.
*
* Simulate REPORT LUNS command.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
static unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf)
{
VPRINTK("ENTER\n");
rbuf[3] = 8; /* just one lun, LUN 0, size 8 bytes */
return 0;
}
static void atapi_sense_complete(struct ata_queued_cmd *qc)
{
if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) {
/* FIXME: not quite right; we don't want the
* translation of taskfile registers into
* a sense descriptors, since that's only
* correct for ATA, not ATAPI
*/
ata_gen_passthru_sense(qc);
}
qc->scsidone(qc->scsicmd);
ata_qc_free(qc);
}
/* is it pointless to prefer PIO for "safety reasons"? */
static inline int ata_pio_use_silly(struct ata_port *ap)
{
return (ap->flags & ATA_FLAG_PIO_DMA);
}
static void atapi_request_sense(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
struct scsi_cmnd *cmd = qc->scsicmd;
DPRINTK("ATAPI request sense\n");
/* FIXME: is this needed? */
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
#ifdef CONFIG_ATA_SFF
if (ap->ops->sff_tf_read)
ap->ops->sff_tf_read(ap, &qc->tf);
#endif
/* fill these in, for the case where they are -not- overwritten */
cmd->sense_buffer[0] = 0x70;
cmd->sense_buffer[2] = qc->tf.feature >> 4;
ata_qc_reinit(qc);
/* setup sg table and init transfer direction */
sg_init_one(&qc->sgent, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE);
ata_sg_init(qc, &qc->sgent, 1);
qc->dma_dir = DMA_FROM_DEVICE;
memset(&qc->cdb, 0, qc->dev->cdb_len);
qc->cdb[0] = REQUEST_SENSE;
qc->cdb[4] = SCSI_SENSE_BUFFERSIZE;
qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
qc->tf.command = ATA_CMD_PACKET;
if (ata_pio_use_silly(ap)) {
qc->tf.protocol = ATAPI_PROT_DMA;
qc->tf.feature |= ATAPI_PKT_DMA;
} else {
qc->tf.protocol = ATAPI_PROT_PIO;
qc->tf.lbam = SCSI_SENSE_BUFFERSIZE;
qc->tf.lbah = 0;
}
qc->nbytes = SCSI_SENSE_BUFFERSIZE;
qc->complete_fn = atapi_sense_complete;
ata_qc_issue(qc);
DPRINTK("EXIT\n");
}
static void atapi_qc_complete(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *cmd = qc->scsicmd;
unsigned int err_mask = qc->err_mask;
VPRINTK("ENTER, err_mask 0x%X\n", err_mask);
/* handle completion from new EH */
if (unlikely(qc->ap->ops->error_handler &&
(err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID))) {
if (!(qc->flags & ATA_QCFLAG_SENSE_VALID)) {
/* FIXME: not quite right; we don't want the
* translation of taskfile registers into a
* sense descriptors, since that's only
* correct for ATA, not ATAPI
*/
ata_gen_passthru_sense(qc);
}
/* SCSI EH automatically locks door if sdev->locked is
* set. Sometimes door lock request continues to
* fail, for example, when no media is present. This
* creates a loop - SCSI EH issues door lock which
* fails and gets invoked again to acquire sense data
* for the failed command.
*
* If door lock fails, always clear sdev->locked to
* avoid this infinite loop.
*
* This may happen before SCSI scan is complete. Make
* sure qc->dev->sdev isn't NULL before dereferencing.
*/
if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
qc->dev->sdev->locked = 0;
qc->scsicmd->result = SAM_STAT_CHECK_CONDITION;
qc->scsidone(cmd);
ata_qc_free(qc);
return;
}
/* successful completion or old EH failure path */
if (unlikely(err_mask & AC_ERR_DEV)) {
cmd->result = SAM_STAT_CHECK_CONDITION;
atapi_request_sense(qc);
return;
} else if (unlikely(err_mask)) {
/* FIXME: not quite right; we don't want the
* translation of taskfile registers into
* a sense descriptors, since that's only
* correct for ATA, not ATAPI
*/
ata_gen_passthru_sense(qc);
} else {
u8 *scsicmd = cmd->cmnd;
if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) {
unsigned long flags;
u8 *buf;
buf = ata_scsi_rbuf_get(cmd, true, &flags);
/* ATAPI devices typically report zero for their SCSI version,
* and sometimes deviate from the spec WRT response data
* format. If SCSI version is reported as zero like normal,
* then we make the following fixups: 1) Fake MMC-5 version,
* to indicate to the Linux scsi midlayer this is a modern
* device. 2) Ensure response data format / ATAPI information
* are always correct.
*/
if (buf[2] == 0) {
buf[2] = 0x5;
buf[3] = 0x32;
}
ata_scsi_rbuf_put(cmd, true, &flags);
}
cmd->result = SAM_STAT_GOOD;
}
qc->scsidone(cmd);
ata_qc_free(qc);
}
/**
* atapi_xlat - Initialize PACKET taskfile
* @qc: command structure to be initialized
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Zero on success, non-zero on failure.
*/
static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
{
struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_device *dev = qc->dev;
int nodata = (scmd->sc_data_direction == DMA_NONE);
int using_pio = !nodata && (dev->flags & ATA_DFLAG_PIO);
unsigned int nbytes;
memset(qc->cdb, 0, dev->cdb_len);
memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len);
qc->complete_fn = atapi_qc_complete;
qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
if (scmd->sc_data_direction == DMA_TO_DEVICE) {
qc->tf.flags |= ATA_TFLAG_WRITE;
DPRINTK("direction: write\n");
}
qc->tf.command = ATA_CMD_PACKET;
ata_qc_set_pc_nbytes(qc);
/* check whether ATAPI DMA is safe */
if (!nodata && !using_pio && atapi_check_dma(qc))
using_pio = 1;
/* Some controller variants snoop this value for Packet
* transfers to do state machine and FIFO management. Thus we
* want to set it properly, and for DMA where it is
* effectively meaningless.
*/
nbytes = min(ata_qc_raw_nbytes(qc), (unsigned int)63 * 1024);
/* Most ATAPI devices which honor transfer chunk size don't
* behave according to the spec when odd chunk size which
* matches the transfer length is specified. If the number of
* bytes to transfer is 2n+1. According to the spec, what
* should happen is to indicate that 2n+1 is going to be
* transferred and transfer 2n+2 bytes where the last byte is
* padding.
*
* In practice, this doesn't happen. ATAPI devices first
* indicate and transfer 2n bytes and then indicate and
* transfer 2 bytes where the last byte is padding.
*
* This inconsistency confuses several controllers which
* perform PIO using DMA such as Intel AHCIs and sil3124/32.
* These controllers use actual number of transferred bytes to
* update DMA poitner and transfer of 4n+2 bytes make those
* controller push DMA pointer by 4n+4 bytes because SATA data
* FISes are aligned to 4 bytes. This causes data corruption
* and buffer overrun.
*
* Always setting nbytes to even number solves this problem
* because then ATAPI devices don't have to split data at 2n
* boundaries.
*/
if (nbytes & 0x1)
nbytes++;
qc->tf.lbam = (nbytes & 0xFF);
qc->tf.lbah = (nbytes >> 8);
if (nodata)
qc->tf.protocol = ATAPI_PROT_NODATA;
else if (using_pio)
qc->tf.protocol = ATAPI_PROT_PIO;
else {
/* DMA data xfer */
qc->tf.protocol = ATAPI_PROT_DMA;
qc->tf.feature |= ATAPI_PKT_DMA;
if ((dev->flags & ATA_DFLAG_DMADIR) &&
(scmd->sc_data_direction != DMA_TO_DEVICE))
/* some SATA bridges need us to indicate data xfer direction */
qc->tf.feature |= ATAPI_DMADIR;
}
/* FIXME: We need to translate 0x05 READ_BLOCK_LIMITS to a MODE_SENSE
as ATAPI tape drives don't get this right otherwise */
return 0;
}
static struct ata_device *ata_find_dev(struct ata_port *ap, int devno)
{
if (!sata_pmp_attached(ap)) {
if (likely(devno < ata_link_max_devices(&ap->link)))
return &ap->link.device[devno];
} else {
if (likely(devno < ap->nr_pmp_links))
return &ap->pmp_link[devno].device[0];
}
return NULL;
}
static struct ata_device *__ata_scsi_find_dev(struct ata_port *ap,
const struct scsi_device *scsidev)
{
int devno;
/* skip commands not addressed to targets we simulate */
if (!sata_pmp_attached(ap)) {
if (unlikely(scsidev->channel || scsidev->lun))
return NULL;
devno = scsidev->id;
} else {
if (unlikely(scsidev->id || scsidev->lun))
return NULL;
devno = scsidev->channel;
}
return ata_find_dev(ap, devno);
}
/**
* ata_scsi_find_dev - lookup ata_device from scsi_cmnd
* @ap: ATA port to which the device is attached
* @scsidev: SCSI device from which we derive the ATA device
*
* Given various information provided in struct scsi_cmnd,
* map that onto an ATA bus, and using that mapping
* determine which ata_device is associated with the
* SCSI command to be sent.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* Associated ATA device, or %NULL if not found.
*/
static struct ata_device *
ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev)
{
struct ata_device *dev = __ata_scsi_find_dev(ap, scsidev);
if (unlikely(!dev || !ata_dev_enabled(dev)))
return NULL;
return dev;
}
/*
* ata_scsi_map_proto - Map pass-thru protocol value to taskfile value.
* @byte1: Byte 1 from pass-thru CDB.
*
* RETURNS:
* ATA_PROT_UNKNOWN if mapping failed/unimplemented, protocol otherwise.
*/
static u8
ata_scsi_map_proto(u8 byte1)
{
switch((byte1 & 0x1e) >> 1) {
case 3: /* Non-data */
return ATA_PROT_NODATA;
case 6: /* DMA */
case 10: /* UDMA Data-in */
case 11: /* UDMA Data-Out */
return ATA_PROT_DMA;
case 4: /* PIO Data-in */
case 5: /* PIO Data-out */
return ATA_PROT_PIO;
case 0: /* Hard Reset */
case 1: /* SRST */
case 8: /* Device Diagnostic */
case 9: /* Device Reset */
case 7: /* DMA Queued */
case 12: /* FPDMA */
case 15: /* Return Response Info */
default: /* Reserved */
break;
}
return ATA_PROT_UNKNOWN;
}
/**
* ata_scsi_pass_thru - convert ATA pass-thru CDB to taskfile
* @qc: command structure to be initialized
*
* Handles either 12 or 16-byte versions of the CDB.
*
* RETURNS:
* Zero on success, non-zero on failure.
*/
static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
{
struct ata_taskfile *tf = &(qc->tf);
struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_device *dev = qc->dev;
const u8 *cdb = scmd->cmnd;
if ((tf->protocol = ata_scsi_map_proto(cdb[1])) == ATA_PROT_UNKNOWN)
goto invalid_fld;
/*
* 12 and 16 byte CDBs use different offsets to
* provide the various register values.
*/
if (cdb[0] == ATA_16) {
/*
* 16-byte CDB - may contain extended commands.
*
* If that is the case, copy the upper byte register values.
*/
if (cdb[1] & 0x01) {
tf->hob_feature = cdb[3];
tf->hob_nsect = cdb[5];
tf->hob_lbal = cdb[7];
tf->hob_lbam = cdb[9];
tf->hob_lbah = cdb[11];
tf->flags |= ATA_TFLAG_LBA48;
} else
tf->flags &= ~ATA_TFLAG_LBA48;
/*
* Always copy low byte, device and command registers.
*/
tf->feature = cdb[4];
tf->nsect = cdb[6];
tf->lbal = cdb[8];
tf->lbam = cdb[10];
tf->lbah = cdb[12];
tf->device = cdb[13];
tf->command = cdb[14];
} else {
/*
* 12-byte CDB - incapable of extended commands.
*/
tf->flags &= ~ATA_TFLAG_LBA48;
tf->feature = cdb[3];
tf->nsect = cdb[4];
tf->lbal = cdb[5];
tf->lbam = cdb[6];
tf->lbah = cdb[7];
tf->device = cdb[8];
tf->command = cdb[9];
}
/* enforce correct master/slave bit */
tf->device = dev->devno ?
tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
/* READ/WRITE LONG use a non-standard sect_size */
qc->sect_size = ATA_SECT_SIZE;
switch (tf->command) {
case ATA_CMD_READ_LONG:
case ATA_CMD_READ_LONG_ONCE:
case ATA_CMD_WRITE_LONG:
case ATA_CMD_WRITE_LONG_ONCE:
if (tf->protocol != ATA_PROT_PIO || tf->nsect != 1)
goto invalid_fld;
qc->sect_size = scsi_bufflen(scmd);
}
/*
* Set flags so that all registers will be written, pass on
* write indication (used for PIO/DMA setup), result TF is
* copied back and we don't whine too much about its failure.
*/
tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
if (scmd->sc_data_direction == DMA_TO_DEVICE)
tf->flags |= ATA_TFLAG_WRITE;
qc->flags |= ATA_QCFLAG_RESULT_TF | ATA_QCFLAG_QUIET;
/*
* Set transfer length.
*
* TODO: find out if we need to do more here to
* cover scatter/gather case.
*/
ata_qc_set_pc_nbytes(qc);
/* We may not issue DMA commands if no DMA mode is set */
if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0)
goto invalid_fld;
/* sanity check for pio multi commands */
if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf))
goto invalid_fld;
if (is_multi_taskfile(tf)) {
unsigned int multi_count = 1 << (cdb[1] >> 5);
/* compare the passed through multi_count
* with the cached multi_count of libata
*/
if (multi_count != dev->multi_count)
ata_dev_printk(dev, KERN_WARNING,
"invalid multi_count %u ignored\n",
multi_count);
}
/*
* Filter SET_FEATURES - XFER MODE command -- otherwise,
* SET_FEATURES - XFER MODE must be preceded/succeeded
* by an update to hardware-specific registers for each
* controller (i.e. the reason for ->set_piomode(),
* ->set_dmamode(), and ->post_set_mode() hooks).
*/
if (tf->command == ATA_CMD_SET_FEATURES &&
tf->feature == SETFEATURES_XFER)
goto invalid_fld;
/*
* Filter TPM commands by default. These provide an
* essentially uncontrolled encrypted "back door" between
* applications and the disk. Set libata.allow_tpm=1 if you
* have a real reason for wanting to use them. This ensures
* that installed software cannot easily mess stuff up without
* user intent. DVR type users will probably ship with this enabled
* for movie content management.
*
* Note that for ATA8 we can issue a DCS change and DCS freeze lock
* for this and should do in future but that it is not sufficient as
* DCS is an optional feature set. Thus we also do the software filter
* so that we comply with the TC consortium stated goal that the user
* can turn off TC features of their system.
*/
if (tf->command >= 0x5C && tf->command <= 0x5F && !libata_allow_tpm)
goto invalid_fld;
return 0;
invalid_fld:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x00);
/* "Invalid field in cdb" */
return 1;
}
static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
{
struct ata_taskfile *tf = &qc->tf;
struct scsi_cmnd *scmd = qc->scsicmd;
struct ata_device *dev = qc->dev;
const u8 *cdb = scmd->cmnd;
u64 block;
u32 n_block;
u32 size;
void *buf;
/* we may not issue DMA commands if no DMA mode is set */
if (unlikely(!dev->dma_mode))
goto invalid_fld;
if (unlikely(scmd->cmd_len < 16))
goto invalid_fld;
scsi_16_lba_len(cdb, &block, &n_block);
/* for now we only support WRITE SAME with the unmap bit set */
if (unlikely(!(cdb[1] & 0x8)))
goto invalid_fld;
/*
* WRITE SAME always has a sector sized buffer as payload, this
* should never be a multiple entry S/G list.
*/
if (!scsi_sg_count(scmd))
goto invalid_fld;
buf = page_address(sg_page(scsi_sglist(scmd)));
size = ata_set_lba_range_entries(buf, 512, block, n_block);
tf->protocol = ATA_PROT_DMA;
tf->hob_feature = 0;
tf->feature = ATA_DSM_TRIM;
tf->hob_nsect = (size / 512) >> 8;
tf->nsect = size / 512;
tf->command = ATA_CMD_DSM;
tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48 |
ATA_TFLAG_WRITE;
ata_qc_set_pc_nbytes(qc);
return 0;
invalid_fld:
ata_scsi_set_sense(scmd, ILLEGAL_REQUEST, 0x24, 0x00);
/* "Invalid field in cdb" */
return 1;
}
/**
* ata_get_xlat_func - check if SCSI to ATA translation is possible
* @dev: ATA device
* @cmd: SCSI command opcode to consider
*
* Look up the SCSI command given, and determine whether the
* SCSI command is to be translated or simulated.
*
* RETURNS:
* Pointer to translation function if possible, %NULL if not.
*/
static inline ata_xlat_func_t ata_get_xlat_func(struct ata_device *dev, u8 cmd)
{
switch (cmd) {
case READ_6:
case READ_10:
case READ_16:
case WRITE_6:
case WRITE_10:
case WRITE_16:
return ata_scsi_rw_xlat;
case WRITE_SAME_16:
return ata_scsi_write_same_xlat;
case SYNCHRONIZE_CACHE:
if (ata_try_flush_cache(dev))
return ata_scsi_flush_xlat;
break;
case VERIFY:
case VERIFY_16:
return ata_scsi_verify_xlat;
case ATA_12:
case ATA_16:
return ata_scsi_pass_thru;
case START_STOP:
return ata_scsi_start_stop_xlat;
}
return NULL;
}
/**
* ata_scsi_dump_cdb - dump SCSI command contents to dmesg
* @ap: ATA port to which the command was being sent
* @cmd: SCSI command to dump
*
* Prints the contents of a SCSI command via printk().
*/
static inline void ata_scsi_dump_cdb(struct ata_port *ap,
struct scsi_cmnd *cmd)
{
#ifdef ATA_DEBUG
struct scsi_device *scsidev = cmd->device;
u8 *scsicmd = cmd->cmnd;
DPRINTK("CDB (%u:%d,%d,%d) %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
ap->print_id,
scsidev->channel, scsidev->id, scsidev->lun,
scsicmd[0], scsicmd[1], scsicmd[2], scsicmd[3],
scsicmd[4], scsicmd[5], scsicmd[6], scsicmd[7],
scsicmd[8]);
#endif
}
static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
void (*done)(struct scsi_cmnd *),
struct ata_device *dev)
{
u8 scsi_op = scmd->cmnd[0];
ata_xlat_func_t xlat_func;
int rc = 0;
if (dev->class == ATA_DEV_ATA) {
if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len))
goto bad_cdb_len;
xlat_func = ata_get_xlat_func(dev, scsi_op);
} else {
if (unlikely(!scmd->cmd_len))
goto bad_cdb_len;
xlat_func = NULL;
if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
/* relay SCSI command to ATAPI device */
int len = COMMAND_SIZE(scsi_op);
if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
goto bad_cdb_len;
xlat_func = atapi_xlat;
} else {
/* ATA_16 passthru, treat as an ATA command */
if (unlikely(scmd->cmd_len > 16))
goto bad_cdb_len;
xlat_func = ata_get_xlat_func(dev, scsi_op);
}
}
if (xlat_func)
rc = ata_scsi_translate(dev, scmd, done, xlat_func);
else
ata_scsi_simulate(dev, scmd, done);
return rc;
bad_cdb_len:
DPRINTK("bad CDB len=%u, scsi_op=0x%02x, max=%u\n",
scmd->cmd_len, scsi_op, dev->cdb_len);
scmd->result = DID_ERROR << 16;
done(scmd);
return 0;
}
/**
* ata_scsi_queuecmd - Issue SCSI cdb to libata-managed device
* @cmd: SCSI command to be sent
* @done: Completion function, called when command is complete
*
* In some cases, this function translates SCSI commands into
* ATA taskfiles, and queues the taskfiles to be sent to
* hardware. In other cases, this function simulates a
* SCSI device by evaluating and responding to certain
* SCSI commands. This creates the overall effect of
* ATA and ATAPI devices appearing as SCSI devices.
*
* LOCKING:
* Releases scsi-layer-held lock, and obtains host lock.
*
* RETURNS:
* Return value from __ata_scsi_queuecmd() if @cmd can be queued,
* 0 otherwise.
*/
int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
{
struct ata_port *ap;
struct ata_device *dev;
struct scsi_device *scsidev = cmd->device;
struct Scsi_Host *shost = scsidev->host;
int rc = 0;
ap = ata_shost_to_port(shost);
spin_unlock(shost->host_lock);
spin_lock(ap->lock);
ata_scsi_dump_cdb(ap, cmd);
dev = ata_scsi_find_dev(ap, scsidev);
if (likely(dev))
rc = __ata_scsi_queuecmd(cmd, done, dev);
else {
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
}
spin_unlock(ap->lock);
spin_lock(shost->host_lock);
return rc;
}
/**
* ata_scsi_simulate - simulate SCSI command on ATA device
* @dev: the target device
* @cmd: SCSI command being sent to device.
* @done: SCSI command completion function.
*
* Interprets and directly executes a select list of SCSI commands
* that can be handled internally.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *))
{
struct ata_scsi_args args;
const u8 *scsicmd = cmd->cmnd;
u8 tmp8;
args.dev = dev;
args.id = dev->id;
args.cmd = cmd;
args.done = done;
switch(scsicmd[0]) {
/* TODO: worth improving? */
case FORMAT_UNIT:
ata_scsi_invalid_field(cmd, done);
break;
case INQUIRY:
if (scsicmd[1] & 2) /* is CmdDt set? */
ata_scsi_invalid_field(cmd, done);
else if ((scsicmd[1] & 1) == 0) /* is EVPD clear? */
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_std);
else switch (scsicmd[2]) {
case 0x00:
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_00);
break;
case 0x80:
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_80);
break;
case 0x83:
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_83);
break;
case 0x89:
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_89);
break;
case 0xb0:
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b0);
break;
case 0xb1:
ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b1);
break;
default:
ata_scsi_invalid_field(cmd, done);
break;
}
break;
case MODE_SENSE:
case MODE_SENSE_10:
ata_scsi_rbuf_fill(&args, ata_scsiop_mode_sense);
break;
case MODE_SELECT: /* unconditionally return */
case MODE_SELECT_10: /* bad-field-in-cdb */
ata_scsi_invalid_field(cmd, done);
break;
case READ_CAPACITY:
ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap);
break;
case SERVICE_ACTION_IN:
if ((scsicmd[1] & 0x1f) == SAI_READ_CAPACITY_16)
ata_scsi_rbuf_fill(&args, ata_scsiop_read_cap);
else
ata_scsi_invalid_field(cmd, done);
break;
case REPORT_LUNS:
ata_scsi_rbuf_fill(&args, ata_scsiop_report_luns);
break;
case REQUEST_SENSE:
ata_scsi_set_sense(cmd, 0, 0, 0);
cmd->result = (DRIVER_SENSE << 24);
done(cmd);
break;
/* if we reach this, then writeback caching is disabled,
* turning this into a no-op.
*/
case SYNCHRONIZE_CACHE:
/* fall through */
/* no-op's, complete with success */
case REZERO_UNIT:
case SEEK_6:
case SEEK_10:
case TEST_UNIT_READY:
ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
break;
case SEND_DIAGNOSTIC:
tmp8 = scsicmd[1] & ~(1 << 3);
if ((tmp8 == 0x4) && (!scsicmd[3]) && (!scsicmd[4]))
ata_scsi_rbuf_fill(&args, ata_scsiop_noop);
else
ata_scsi_invalid_field(cmd, done);
break;
/* all other commands */
default:
ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, 0x20, 0x0);
/* "Invalid command operation code" */
done(cmd);
break;
}
}
int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht)
{
int i, rc;
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
struct Scsi_Host *shost;
rc = -ENOMEM;
shost = scsi_host_alloc(sht, sizeof(struct ata_port *));
if (!shost)
goto err_alloc;
*(struct ata_port **)&shost->hostdata[0] = ap;
ap->scsi_host = shost;
shost->transportt = &ata_scsi_transport_template;
shost->unique_id = ap->print_id;
shost->max_id = 16;
shost->max_lun = 1;
shost->max_channel = 1;
shost->max_cmd_len = 16;
/* Schedule policy is determined by ->qc_defer()
* callback and it needs to see every deferred qc.
* Set host_blocked to 1 to prevent SCSI midlayer from
* automatically deferring requests.
*/
shost->max_host_blocked = 1;
rc = scsi_add_host(ap->scsi_host, ap->host->dev);
if (rc)
goto err_add;
}
return 0;
err_add:
scsi_host_put(host->ports[i]->scsi_host);
err_alloc:
while (--i >= 0) {
struct Scsi_Host *shost = host->ports[i]->scsi_host;
scsi_remove_host(shost);
scsi_host_put(shost);
}
return rc;
}
void ata_scsi_scan_host(struct ata_port *ap, int sync)
{
int tries = 5;
struct ata_device *last_failed_dev = NULL;
struct ata_link *link;
struct ata_device *dev;
repeat:
ata_for_each_link(link, ap, EDGE) {
ata_for_each_dev(dev, link, ENABLED) {
struct scsi_device *sdev;
int channel = 0, id = 0;
if (dev->sdev)
continue;
if (ata_is_host_link(link))
id = dev->devno;
else
channel = link->pmp;
sdev = __scsi_add_device(ap->scsi_host, channel, id, 0,
NULL);
if (!IS_ERR(sdev)) {
dev->sdev = sdev;
scsi_device_put(sdev);
}
}
}
/* If we scanned while EH was in progress or allocation
* failure occurred, scan would have failed silently. Check
* whether all devices are attached.
*/
ata_for_each_link(link, ap, EDGE) {
ata_for_each_dev(dev, link, ENABLED) {
if (!dev->sdev)
goto exit_loop;
}
}
exit_loop:
if (!link)
return;
/* we're missing some SCSI devices */
if (sync) {
/* If caller requested synchrnous scan && we've made
* any progress, sleep briefly and repeat.
*/
if (dev != last_failed_dev) {
msleep(100);
last_failed_dev = dev;
goto repeat;
}
/* We might be failing to detect boot device, give it
* a few more chances.
*/
if (--tries) {
msleep(100);
goto repeat;
}
ata_port_printk(ap, KERN_ERR, "WARNING: synchronous SCSI scan "
"failed without making any progress,\n"
" switching to async\n");
}
queue_delayed_work(ata_aux_wq, &ap->hotplug_task,
round_jiffies_relative(HZ));
}
/**
* ata_scsi_offline_dev - offline attached SCSI device
* @dev: ATA device to offline attached SCSI device for
*
* This function is called from ata_eh_hotplug() and responsible
* for taking the SCSI device attached to @dev offline. This
* function is called with host lock which protects dev->sdev
* against clearing.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*
* RETURNS:
* 1 if attached SCSI device exists, 0 otherwise.
*/
int ata_scsi_offline_dev(struct ata_device *dev)
{
if (dev->sdev) {
scsi_device_set_state(dev->sdev, SDEV_OFFLINE);
return 1;
}
return 0;
}
/**
* ata_scsi_remove_dev - remove attached SCSI device
* @dev: ATA device to remove attached SCSI device for
*
* This function is called from ata_eh_scsi_hotplug() and
* responsible for removing the SCSI device attached to @dev.
*
* LOCKING:
* Kernel thread context (may sleep).
*/
static void ata_scsi_remove_dev(struct ata_device *dev)
{
struct ata_port *ap = dev->link->ap;
struct scsi_device *sdev;
unsigned long flags;
/* Alas, we need to grab scan_mutex to ensure SCSI device
* state doesn't change underneath us and thus
* scsi_device_get() always succeeds. The mutex locking can
* be removed if there is __scsi_device_get() interface which
* increments reference counts regardless of device state.
*/
mutex_lock(&ap->scsi_host->scan_mutex);
spin_lock_irqsave(ap->lock, flags);
/* clearing dev->sdev is protected by host lock */
sdev = dev->sdev;
dev->sdev = NULL;
if (sdev) {
/* If user initiated unplug races with us, sdev can go
* away underneath us after the host lock and
* scan_mutex are released. Hold onto it.
*/
if (scsi_device_get(sdev) == 0) {
/* The following ensures the attached sdev is
* offline on return from ata_scsi_offline_dev()
* regardless it wins or loses the race
* against this function.
*/
scsi_device_set_state(sdev, SDEV_OFFLINE);
} else {
WARN_ON(1);
sdev = NULL;
}
}
spin_unlock_irqrestore(ap->lock, flags);
mutex_unlock(&ap->scsi_host->scan_mutex);
if (sdev) {
ata_dev_printk(dev, KERN_INFO, "detaching (SCSI %s)\n",
dev_name(&sdev->sdev_gendev));
scsi_remove_device(sdev);
scsi_device_put(sdev);
}
}
static void ata_scsi_handle_link_detach(struct ata_link *link)
{
struct ata_port *ap = link->ap;
struct ata_device *dev;
ata_for_each_dev(dev, link, ALL) {
unsigned long flags;
if (!(dev->flags & ATA_DFLAG_DETACHED))
continue;
spin_lock_irqsave(ap->lock, flags);
dev->flags &= ~ATA_DFLAG_DETACHED;
spin_unlock_irqrestore(ap->lock, flags);
ata_scsi_remove_dev(dev);
}
}
/**
* ata_scsi_media_change_notify - send media change event
* @dev: Pointer to the disk device with media change event
*
* Tell the block layer to send a media change notification
* event.
*
* LOCKING:
* spin_lock_irqsave(host lock)
*/
void ata_scsi_media_change_notify(struct ata_device *dev)
{
if (dev->sdev)
sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE,
GFP_ATOMIC);
}
/**
* ata_scsi_hotplug - SCSI part of hotplug
* @work: Pointer to ATA port to perform SCSI hotplug on
*
* Perform SCSI part of hotplug. It's executed from a separate
* workqueue after EH completes. This is necessary because SCSI
* hot plugging requires working EH and hot unplugging is
* synchronized with hot plugging with a mutex.
*
* LOCKING:
* Kernel thread context (may sleep).
*/
void ata_scsi_hotplug(struct work_struct *work)
{
struct ata_port *ap =
container_of(work, struct ata_port, hotplug_task.work);
int i;
if (ap->pflags & ATA_PFLAG_UNLOADING) {
DPRINTK("ENTER/EXIT - unloading\n");
return;
}
DPRINTK("ENTER\n");
/* Unplug detached devices. We cannot use link iterator here
* because PMP links have to be scanned even if PMP is
* currently not attached. Iterate manually.
*/
ata_scsi_handle_link_detach(&ap->link);
if (ap->pmp_link)
for (i = 0; i < SATA_PMP_MAX_PORTS; i++)
ata_scsi_handle_link_detach(&ap->pmp_link[i]);
/* scan for new ones */
ata_scsi_scan_host(ap, 0);
DPRINTK("EXIT\n");
}
/**
* ata_scsi_user_scan - indication for user-initiated bus scan
* @shost: SCSI host to scan
* @channel: Channel to scan
* @id: ID to scan
* @lun: LUN to scan
*
* This function is called when user explicitly requests bus
* scan. Set probe pending flag and invoke EH.
*
* LOCKING:
* SCSI layer (we don't care)
*
* RETURNS:
* Zero.
*/
static int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
unsigned int id, unsigned int lun)
{
struct ata_port *ap = ata_shost_to_port(shost);
unsigned long flags;
int devno, rc = 0;
if (!ap->ops->error_handler)
return -EOPNOTSUPP;
if (lun != SCAN_WILD_CARD && lun)
return -EINVAL;
if (!sata_pmp_attached(ap)) {
if (channel != SCAN_WILD_CARD && channel)
return -EINVAL;
devno = id;
} else {
if (id != SCAN_WILD_CARD && id)
return -EINVAL;
devno = channel;
}
spin_lock_irqsave(ap->lock, flags);
if (devno == SCAN_WILD_CARD) {
struct ata_link *link;
ata_for_each_link(link, ap, EDGE) {
struct ata_eh_info *ehi = &link->eh_info;
ehi->probe_mask |= ATA_ALL_DEVICES;
ehi->action |= ATA_EH_RESET;
}
} else {
struct ata_device *dev = ata_find_dev(ap, devno);
if (dev) {
struct ata_eh_info *ehi = &dev->link->eh_info;
ehi->probe_mask |= 1 << dev->devno;
ehi->action |= ATA_EH_RESET;
} else
rc = -EINVAL;
}
if (rc == 0) {
ata_port_schedule_eh(ap);
spin_unlock_irqrestore(ap->lock, flags);
ata_port_wait_eh(ap);
} else
spin_unlock_irqrestore(ap->lock, flags);
return rc;
}
/**
* ata_scsi_dev_rescan - initiate scsi_rescan_device()
* @work: Pointer to ATA port to perform scsi_rescan_device()
*
* After ATA pass thru (SAT) commands are executed successfully,
* libata need to propagate the changes to SCSI layer. This
* function must be executed from ata_aux_wq such that sdev
* attach/detach don't race with rescan.
*
* LOCKING:
* Kernel thread context (may sleep).
*/
void ata_scsi_dev_rescan(struct work_struct *work)
{
struct ata_port *ap =
container_of(work, struct ata_port, scsi_rescan_task);
struct ata_link *link;
struct ata_device *dev;
unsigned long flags;
spin_lock_irqsave(ap->lock, flags);
ata_for_each_link(link, ap, EDGE) {
ata_for_each_dev(dev, link, ENABLED) {
struct scsi_device *sdev = dev->sdev;
if (!sdev)
continue;
if (scsi_device_get(sdev))
continue;
spin_unlock_irqrestore(ap->lock, flags);
scsi_rescan_device(&(sdev->sdev_gendev));
scsi_device_put(sdev);
spin_lock_irqsave(ap->lock, flags);
}
}
spin_unlock_irqrestore(ap->lock, flags);
}
/**
* ata_sas_port_alloc - Allocate port for a SAS attached SATA device
* @host: ATA host container for all SAS ports
* @port_info: Information from low-level host driver
* @shost: SCSI host that the scsi device is attached to
*
* LOCKING:
* PCI/etc. bus probe sem.
*
* RETURNS:
* ata_port pointer on success / NULL on failure.
*/
struct ata_port *ata_sas_port_alloc(struct ata_host *host,
struct ata_port_info *port_info,
struct Scsi_Host *shost)
{
struct ata_port *ap;
ap = ata_port_alloc(host);
if (!ap)
return NULL;
ap->port_no = 0;
ap->lock = shost->host_lock;
ap->pio_mask = port_info->pio_mask;
ap->mwdma_mask = port_info->mwdma_mask;
ap->udma_mask = port_info->udma_mask;
ap->flags |= port_info->flags;
ap->ops = port_info->port_ops;
ap->cbl = ATA_CBL_SATA;
return ap;
}
EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
/**
* ata_sas_port_start - Set port up for dma.
* @ap: Port to initialize
*
* Called just after data structures for each port are
* initialized.
*
* May be used as the port_start() entry in ata_port_operations.
*
* LOCKING:
* Inherited from caller.
*/
int ata_sas_port_start(struct ata_port *ap)
{
return 0;
}
EXPORT_SYMBOL_GPL(ata_sas_port_start);
/**
* ata_port_stop - Undo ata_sas_port_start()
* @ap: Port to shut down
*
* May be used as the port_stop() entry in ata_port_operations.
*
* LOCKING:
* Inherited from caller.
*/
void ata_sas_port_stop(struct ata_port *ap)
{
}
EXPORT_SYMBOL_GPL(ata_sas_port_stop);
/**
* ata_sas_port_init - Initialize a SATA device
* @ap: SATA port to initialize
*
* LOCKING:
* PCI/etc. bus probe sem.
*
* RETURNS:
* Zero on success, non-zero on error.
*/
int ata_sas_port_init(struct ata_port *ap)
{
int rc = ap->ops->port_start(ap);
if (!rc) {
ap->print_id = ata_print_id++;
rc = ata_bus_probe(ap);
}
return rc;
}
EXPORT_SYMBOL_GPL(ata_sas_port_init);
/**
* ata_sas_port_destroy - Destroy a SATA port allocated by ata_sas_port_alloc
* @ap: SATA port to destroy
*
*/
void ata_sas_port_destroy(struct ata_port *ap)
{
if (ap->ops->port_stop)
ap->ops->port_stop(ap);
kfree(ap);
}
EXPORT_SYMBOL_GPL(ata_sas_port_destroy);
/**
* ata_sas_slave_configure - Default slave_config routine for libata devices
* @sdev: SCSI device to configure
* @ap: ATA port to which SCSI device is attached
*
* RETURNS:
* Zero.
*/
int ata_sas_slave_configure(struct scsi_device *sdev, struct ata_port *ap)
{
ata_scsi_sdev_config(sdev);
ata_scsi_dev_config(sdev, ap->link.device);
return 0;
}
EXPORT_SYMBOL_GPL(ata_sas_slave_configure);
/**
* ata_sas_queuecmd - Issue SCSI cdb to libata-managed device
* @cmd: SCSI command to be sent
* @done: Completion function, called when command is complete
* @ap: ATA port to which the command is being sent
*
* RETURNS:
* Return value from __ata_scsi_queuecmd() if @cmd can be queued,
* 0 otherwise.
*/
int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
struct ata_port *ap)
{
int rc = 0;
ata_scsi_dump_cdb(ap, cmd);
if (likely(ata_dev_enabled(ap->link.device)))
rc = __ata_scsi_queuecmd(cmd, done, ap->link.device);
else {
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
}
return rc;
}
EXPORT_SYMBOL_GPL(ata_sas_queuecmd);
| Java |
/* gameplaySP
*
* Copyright (C) 2006 Exophase <exophase@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "common.h"
#include "font.h"
#ifdef PSP_BUILD
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspgu.h>
#include <psppower.h>
#include <psprtc.h>
static float *screen_vertex = (float *)0x441FC100;
static u32 *ge_cmd = (u32 *)0x441FC000;
static u16 *psp_gu_vram_base = (u16 *)(0x44000000);
static u32 *ge_cmd_ptr = (u32 *)0x441FC000;
static u32 gecbid;
static u32 video_direct = 0;
static u32 __attribute__((aligned(16))) display_list[32];
#define GBA_SCREEN_WIDTH 240
#define GBA_SCREEN_HEIGHT 160
#define PSP_SCREEN_WIDTH 480
#define PSP_SCREEN_HEIGHT 272
#define PSP_LINE_SIZE 512
#define PSP_ALL_BUTTON_MASK 0xFFFF
#define GE_CMD_FBP 0x9C
#define GE_CMD_FBW 0x9D
#define GE_CMD_TBP0 0xA0
#define GE_CMD_TBW0 0xA8
#define GE_CMD_TSIZE0 0xB8
#define GE_CMD_TFLUSH 0xCB
#define GE_CMD_CLEAR 0xD3
#define GE_CMD_VTYPE 0x12
#define GE_CMD_BASE 0x10
#define GE_CMD_VADDR 0x01
#define GE_CMD_IADDR 0x02
#define GE_CMD_PRIM 0x04
#define GE_CMD_FINISH 0x0F
#define GE_CMD_SIGNAL 0x0C
#define GE_CMD_NOP 0x00
#define GE_CMD(cmd, operand) \
*ge_cmd_ptr = (((GE_CMD_##cmd) << 24) | (operand)); \
ge_cmd_ptr++ \
static u16 *screen_texture = (u16 *)(0x4000000 + (512 * 272 * 2));
static u16 *current_screen_texture = (u16 *)(0x4000000 + (512 * 272 * 2));
static u16 *screen_pixels = (u16 *)(0x4000000 + (512 * 272 * 2));
static u32 screen_pitch = 240;
static void Ge_Finish_Callback(int id, void *arg)
{
}
#define get_screen_pixels() \
screen_pixels \
#define get_screen_pitch() \
screen_pitch \
#else
SDL_Surface *screen;
const u32 video_scale = 1;
#define get_screen_pixels() \
((u16 *)screen->pixels) \
#define get_screen_pitch() \
(screen->pitch / 2) \
#endif
void render_scanline_conditional_tile(u32 start, u32 end, u16 *scanline,
u32 enable_flags, u32 dispcnt, u32 bldcnt, tile_layer_render_struct
*layer_renderers);
void render_scanline_conditional_bitmap(u32 start, u32 end, u16 *scanline,
u32 enable_flags, u32 dispcnt, u32 bldcnt, bitmap_layer_render_struct
*layer_renderers);
#define no_op \
// This old version is not necessary if the palette is either being converted
// transparently or the ABGR 1555 format is being used natively. The direct
// version (without conversion) is much faster.
#define tile_lookup_palette_full(palette, source) \
current_pixel = palette[source]; \
convert_palette(current_pixel) \
#define tile_lookup_palette(palette, source) \
current_pixel = palette[source]; \
#define tile_expand_base_normal(index) \
tile_lookup_palette(palette, current_pixel); \
dest_ptr[index] = current_pixel \
#define tile_expand_transparent_normal(index) \
tile_expand_base_normal(index) \
#define tile_expand_copy(index) \
dest_ptr[index] = copy_ptr[index] \
#define advance_dest_ptr_base(delta) \
dest_ptr += delta \
#define advance_dest_ptr_transparent(delta) \
advance_dest_ptr_base(delta) \
#define advance_dest_ptr_copy(delta) \
advance_dest_ptr_base(delta); \
copy_ptr += delta \
#define color_combine_mask_a(layer) \
((io_registers[REG_BLDCNT] >> layer) & 0x01) \
// For color blending operations, will create a mask that has in bit
// 10 if the layer is target B, and bit 9 if the layer is target A.
#define color_combine_mask(layer) \
(color_combine_mask_a(layer) | \
((io_registers[REG_BLDCNT] >> (layer + 7)) & 0x02)) << 9 \
// For alpha blending renderers, draw the palette index (9bpp) and
// layer bits rather than the raw RGB. For the base this should write to
// the 32bit location directly.
#define tile_expand_base_alpha(index) \
dest_ptr[index] = current_pixel | pixel_combine \
#define tile_expand_base_bg(index) \
dest_ptr[index] = bg_combine \
// For layered (transparent) writes this should shift the "stack" and write
// to the bottom. This will preserve the topmost pixel and the most recent
// one.
#define tile_expand_transparent_alpha(index) \
dest_ptr[index] = (dest_ptr[index] << 16) | current_pixel | pixel_combine \
// OBJ should only shift if the top isn't already OBJ
#define tile_expand_transparent_alpha_obj(index) \
dest = dest_ptr[index]; \
if(dest & 0x00000100) \
{ \
dest_ptr[index] = (dest & 0xFFFF0000) | current_pixel | pixel_combine; \
} \
else \
{ \
dest_ptr[index] = (dest << 16) | current_pixel | pixel_combine; \
} \
// For color effects that don't need to preserve the previous layer.
// The color32 version should be used with 32bit wide dest_ptr so as to be
// compatible with alpha combine on top of it.
#define tile_expand_base_color16(index) \
dest_ptr[index] = current_pixel | pixel_combine \
#define tile_expand_transparent_color16(index) \
tile_expand_base_color16(index) \
#define tile_expand_base_color32(index) \
tile_expand_base_color16(index) \
#define tile_expand_transparent_color32(index) \
tile_expand_base_color16(index) \
// Operations for isolation 8bpp pixels within 32bpp pixel blocks.
#define tile_8bpp_pixel_op_mask(op_param) \
current_pixel = current_pixels & 0xFF \
#define tile_8bpp_pixel_op_shift_mask(shift) \
current_pixel = (current_pixels >> shift) & 0xFF \
#define tile_8bpp_pixel_op_shift(shift) \
current_pixel = current_pixels >> shift \
#define tile_8bpp_pixel_op_none(shift) \
// Base should always draw raw in 8bpp mode; color 0 will be drawn where
// color 0 is.
#define tile_8bpp_draw_base_normal(index) \
tile_expand_base_normal(index) \
#define tile_8bpp_draw_base_alpha(index) \
if(current_pixel) \
{ \
tile_expand_base_alpha(index); \
} \
else \
{ \
tile_expand_base_bg(index); \
} \
#define tile_8bpp_draw_base_color16(index) \
tile_8bpp_draw_base_alpha(index) \
#define tile_8bpp_draw_base_color32(index) \
tile_8bpp_draw_base_alpha(index) \
#define tile_8bpp_draw_base(index, op, op_param, alpha_op) \
tile_8bpp_pixel_op_##op(op_param); \
tile_8bpp_draw_base_##alpha_op(index) \
// Transparent (layered) writes should only replace what is there if the
// pixel is not transparent (zero)
#define tile_8bpp_draw_transparent(index, op, op_param, alpha_op) \
tile_8bpp_pixel_op_##op(op_param); \
if(current_pixel) \
{ \
tile_expand_transparent_##alpha_op(index); \
} \
#define tile_8bpp_draw_copy(index, op, op_param, alpha_op) \
tile_8bpp_pixel_op_##op(op_param); \
if(current_pixel) \
{ \
tile_expand_copy(index); \
} \
// Get the current tile from the map in 8bpp mode
#define get_tile_8bpp() \
current_tile = *map_ptr; \
tile_ptr = tile_base + ((current_tile & 0x3FF) * 64) \
// Draw half of a tile in 8bpp mode, for base renderer
#define tile_8bpp_draw_four_noflip(index, combine_op, alpha_op) \
tile_8bpp_draw_##combine_op(index + 0, mask, 0, alpha_op); \
tile_8bpp_draw_##combine_op(index + 1, shift_mask, 8, alpha_op); \
tile_8bpp_draw_##combine_op(index + 2, shift_mask, 16, alpha_op); \
tile_8bpp_draw_##combine_op(index + 3, shift, 24, alpha_op) \
// Like the above, but draws the half-tile horizontally flipped
#define tile_8bpp_draw_four_flip(index, combine_op, alpha_op) \
tile_8bpp_draw_##combine_op(index + 3, mask, 0, alpha_op); \
tile_8bpp_draw_##combine_op(index + 2, shift_mask, 8, alpha_op); \
tile_8bpp_draw_##combine_op(index + 1, shift_mask, 16, alpha_op); \
tile_8bpp_draw_##combine_op(index + 0, shift, 24, alpha_op) \
#define tile_8bpp_draw_four_base(index, alpha_op, flip_op) \
tile_8bpp_draw_four_##flip_op(index, base, alpha_op) \
// Draw half of a tile in 8bpp mode, for transparent renderer; as an
// optimization the entire thing is checked against zero (in transparent
// capable renders it is more likely for the pixels to be transparent than
// opaque)
#define tile_8bpp_draw_four_transparent(index, alpha_op, flip_op) \
if(current_pixels != 0) \
{ \
tile_8bpp_draw_four_##flip_op(index, transparent, alpha_op); \
} \
#define tile_8bpp_draw_four_copy(index, alpha_op, flip_op) \
if(current_pixels != 0) \
{ \
tile_8bpp_draw_four_##flip_op(index, copy, alpha_op); \
} \
// Helper macro for drawing 8bpp tiles clipped against the edge of the screen
#define partial_tile_8bpp(combine_op, alpha_op) \
for(i = 0; i < partial_tile_run; i++) \
{ \
tile_8bpp_draw_##combine_op(0, mask, 0, alpha_op); \
current_pixels >>= 8; \
advance_dest_ptr_##combine_op(1); \
} \
// Draws 8bpp tiles clipped against the left side of the screen,
// partial_tile_offset indicates how much clipped in it is, partial_tile_run
// indicates how much it should draw.
#define partial_tile_right_noflip_8bpp(combine_op, alpha_op) \
if(partial_tile_offset >= 4) \
{ \
current_pixels = *((u32 *)(tile_ptr + 4)) >> \
((partial_tile_offset - 4) * 8); \
partial_tile_8bpp(combine_op, alpha_op); \
} \
else \
{ \
partial_tile_run -= 4; \
current_pixels = *((u32 *)tile_ptr) >> (partial_tile_offset * 8); \
partial_tile_8bpp(combine_op, alpha_op); \
current_pixels = *((u32 *)(tile_ptr + 4)); \
tile_8bpp_draw_four_##combine_op(0, alpha_op, noflip); \
advance_dest_ptr_##combine_op(4); \
} \
// Draws 8bpp tiles clipped against both the left and right side of the
// screen, IE, runs of less than 8 - partial_tile_offset.
#define partial_tile_mid_noflip_8bpp(combine_op, alpha_op) \
if(partial_tile_offset >= 4) \
{ \
current_pixels = *((u32 *)(tile_ptr + 4)) >> \
((partial_tile_offset - 4) * 8); \
partial_tile_8bpp(combine_op, alpha_op); \
} \
else \
{ \
current_pixels = *((u32 *)tile_ptr) >> (partial_tile_offset * 8); \
if((partial_tile_offset + partial_tile_run) > 4) \
{ \
u32 old_run = partial_tile_run; \
partial_tile_run = 4 - partial_tile_offset; \
partial_tile_8bpp(combine_op, alpha_op); \
partial_tile_run = old_run - partial_tile_run; \
current_pixels = *((u32 *)(tile_ptr + 4)); \
partial_tile_8bpp(combine_op, alpha_op); \
} \
else \
{ \
partial_tile_8bpp(combine_op, alpha_op); \
} \
} \
// Draws 8bpp tiles clipped against the right side of the screen,
// partial_tile_run indicates how much there is to draw.
#define partial_tile_left_noflip_8bpp(combine_op, alpha_op) \
if(partial_tile_run >= 4) \
{ \
current_pixels = *((u32 *)tile_ptr); \
tile_8bpp_draw_four_##combine_op(0, alpha_op, noflip); \
advance_dest_ptr_##combine_op(4); \
tile_ptr += 4; \
partial_tile_run -= 4; \
} \
\
current_pixels = *((u32 *)(tile_ptr)); \
partial_tile_8bpp(combine_op, alpha_op) \
// Draws a non-clipped (complete) 8bpp tile.
#define tile_noflip_8bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr); \
tile_8bpp_draw_four_##combine_op(0, alpha_op, noflip); \
current_pixels = *((u32 *)(tile_ptr + 4)); \
tile_8bpp_draw_four_##combine_op(4, alpha_op, noflip) \
// Like the above versions but draws flipped tiles.
#define partial_tile_flip_8bpp(combine_op, alpha_op) \
for(i = 0; i < partial_tile_run; i++) \
{ \
tile_8bpp_draw_##combine_op(0, shift, 24, alpha_op); \
current_pixels <<= 8; \
advance_dest_ptr_##combine_op(1); \
} \
#define partial_tile_right_flip_8bpp(combine_op, alpha_op) \
if(partial_tile_offset >= 4) \
{ \
current_pixels = *((u32 *)tile_ptr) << ((partial_tile_offset - 4) * 8); \
partial_tile_flip_8bpp(combine_op, alpha_op); \
} \
else \
{ \
partial_tile_run -= 4; \
current_pixels = *((u32 *)(tile_ptr + 4)) << \
((partial_tile_offset - 4) * 8); \
partial_tile_flip_8bpp(combine_op, alpha_op); \
current_pixels = *((u32 *)tile_ptr); \
tile_8bpp_draw_four_##combine_op(0, alpha_op, flip); \
advance_dest_ptr_##combine_op(4); \
} \
#define partial_tile_mid_flip_8bpp(combine_op, alpha_op) \
if(partial_tile_offset >= 4) \
{ \
current_pixels = *((u32 *)tile_ptr) << ((partial_tile_offset - 4) * 8); \
partial_tile_flip_8bpp(combine_op, alpha_op); \
} \
else \
{ \
current_pixels = *((u32 *)(tile_ptr + 4)) << \
((partial_tile_offset - 4) * 8); \
\
if((partial_tile_offset + partial_tile_run) > 4) \
{ \
u32 old_run = partial_tile_run; \
partial_tile_run = 4 - partial_tile_offset; \
partial_tile_flip_8bpp(combine_op, alpha_op); \
partial_tile_run = old_run - partial_tile_run; \
current_pixels = *((u32 *)(tile_ptr)); \
partial_tile_flip_8bpp(combine_op, alpha_op); \
} \
else \
{ \
partial_tile_flip_8bpp(combine_op, alpha_op); \
} \
} \
#define partial_tile_left_flip_8bpp(combine_op, alpha_op) \
if(partial_tile_run >= 4) \
{ \
current_pixels = *((u32 *)(tile_ptr + 4)); \
tile_8bpp_draw_four_##combine_op(0, alpha_op, flip); \
advance_dest_ptr_##combine_op(4); \
tile_ptr -= 4; \
partial_tile_run -= 4; \
} \
\
current_pixels = *((u32 *)(tile_ptr + 4)); \
partial_tile_flip_8bpp(combine_op, alpha_op) \
#define tile_flip_8bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)(tile_ptr + 4)); \
tile_8bpp_draw_four_##combine_op(0, alpha_op, flip); \
current_pixels = *((u32 *)tile_ptr); \
tile_8bpp_draw_four_##combine_op(4, alpha_op, flip) \
// Operations for isolating 4bpp tiles in a 32bit block
#define tile_4bpp_pixel_op_mask(op_param) \
current_pixel = current_pixels & 0x0F \
#define tile_4bpp_pixel_op_shift_mask(shift) \
current_pixel = (current_pixels >> shift) & 0x0F \
#define tile_4bpp_pixel_op_shift(shift) \
current_pixel = current_pixels >> shift \
#define tile_4bpp_pixel_op_none(op_param) \
// Draws a single 4bpp pixel as base, normal renderer; checks to see if the
// pixel is zero because if so the current palette should not be applied.
// These ifs can be replaced with a lookup table, may or may not be superior
// this way, should be benchmarked. The lookup table would be from 0-255
// identity map except for multiples of 16, which would map to 0.
#define tile_4bpp_draw_base_normal(index) \
if(current_pixel) \
{ \
current_pixel |= current_palette; \
tile_expand_base_normal(index); \
} \
else \
{ \
tile_expand_base_normal(index); \
} \
#define tile_4bpp_draw_base_alpha(index) \
if(current_pixel) \
{ \
current_pixel |= current_palette; \
tile_expand_base_alpha(index); \
} \
else \
{ \
tile_expand_base_bg(index); \
} \
#define tile_4bpp_draw_base_color16(index) \
tile_4bpp_draw_base_alpha(index) \
#define tile_4bpp_draw_base_color32(index) \
tile_4bpp_draw_base_alpha(index) \
#define tile_4bpp_draw_base(index, op, op_param, alpha_op) \
tile_4bpp_pixel_op_##op(op_param); \
tile_4bpp_draw_base_##alpha_op(index) \
// Draws a single 4bpp pixel as layered, if not transparent.
#define tile_4bpp_draw_transparent(index, op, op_param, alpha_op) \
tile_4bpp_pixel_op_##op(op_param); \
if(current_pixel) \
{ \
current_pixel |= current_palette; \
tile_expand_transparent_##alpha_op(index); \
} \
#define tile_4bpp_draw_copy(index, op, op_param, alpha_op) \
tile_4bpp_pixel_op_##op(op_param); \
if(current_pixel) \
{ \
current_pixel |= current_palette; \
tile_expand_copy(index); \
} \
// Draws eight background pixels in transparent mode, for alpha or normal
// renderers.
#define tile_4bpp_draw_eight_base_zero(value) \
dest_ptr[0] = value; \
dest_ptr[1] = value; \
dest_ptr[2] = value; \
dest_ptr[3] = value; \
dest_ptr[4] = value; \
dest_ptr[5] = value; \
dest_ptr[6] = value; \
dest_ptr[7] = value \
// Draws eight background pixels for the alpha renderer, basically color zero
// with the background flag high.
#define tile_4bpp_draw_eight_base_zero_alpha() \
tile_4bpp_draw_eight_base_zero(bg_combine) \
#define tile_4bpp_draw_eight_base_zero_color16() \
tile_4bpp_draw_eight_base_zero_alpha() \
#define tile_4bpp_draw_eight_base_zero_color32() \
tile_4bpp_draw_eight_base_zero_alpha() \
// Draws eight background pixels for the normal renderer, just a bunch of
// zeros.
#define tile_4bpp_draw_eight_base_zero_normal() \
current_pixel = palette[0]; \
tile_4bpp_draw_eight_base_zero(current_pixel) \
// Draws eight 4bpp pixels.
#define tile_4bpp_draw_eight_noflip(combine_op, alpha_op) \
tile_4bpp_draw_##combine_op(0, mask, 0, alpha_op); \
tile_4bpp_draw_##combine_op(1, shift_mask, 4, alpha_op); \
tile_4bpp_draw_##combine_op(2, shift_mask, 8, alpha_op); \
tile_4bpp_draw_##combine_op(3, shift_mask, 12, alpha_op); \
tile_4bpp_draw_##combine_op(4, shift_mask, 16, alpha_op); \
tile_4bpp_draw_##combine_op(5, shift_mask, 20, alpha_op); \
tile_4bpp_draw_##combine_op(6, shift_mask, 24, alpha_op); \
tile_4bpp_draw_##combine_op(7, shift, 28, alpha_op) \
// Draws eight 4bpp pixels in reverse order (for hflip).
#define tile_4bpp_draw_eight_flip(combine_op, alpha_op) \
tile_4bpp_draw_##combine_op(7, mask, 0, alpha_op); \
tile_4bpp_draw_##combine_op(6, shift_mask, 4, alpha_op); \
tile_4bpp_draw_##combine_op(5, shift_mask, 8, alpha_op); \
tile_4bpp_draw_##combine_op(4, shift_mask, 12, alpha_op); \
tile_4bpp_draw_##combine_op(3, shift_mask, 16, alpha_op); \
tile_4bpp_draw_##combine_op(2, shift_mask, 20, alpha_op); \
tile_4bpp_draw_##combine_op(1, shift_mask, 24, alpha_op); \
tile_4bpp_draw_##combine_op(0, shift, 28, alpha_op) \
// Draws eight 4bpp pixels in base mode, checks if all are zero, if so draws
// the appropriate background pixels.
#define tile_4bpp_draw_eight_base(alpha_op, flip_op) \
if(current_pixels != 0) \
{ \
tile_4bpp_draw_eight_##flip_op(base, alpha_op); \
} \
else \
{ \
tile_4bpp_draw_eight_base_zero_##alpha_op(); \
} \
// Draws eight 4bpp pixels in transparent (layered) mode, checks if all are
// zero and if so draws nothing.
#define tile_4bpp_draw_eight_transparent(alpha_op, flip_op) \
if(current_pixels != 0) \
{ \
tile_4bpp_draw_eight_##flip_op(transparent, alpha_op); \
} \
#define tile_4bpp_draw_eight_copy(alpha_op, flip_op) \
if(current_pixels != 0) \
{ \
tile_4bpp_draw_eight_##flip_op(copy, alpha_op); \
} \
// Gets the current tile in 4bpp mode, also getting the current palette and
// the pixel block.
#define get_tile_4bpp() \
current_tile = *map_ptr; \
current_palette = (current_tile >> 12) << 4; \
tile_ptr = tile_base + ((current_tile & 0x3FF) * 32); \
// Helper macro for drawing clipped 4bpp tiles.
#define partial_tile_4bpp(combine_op, alpha_op) \
for(i = 0; i < partial_tile_run; i++) \
{ \
tile_4bpp_draw_##combine_op(0, mask, 0, alpha_op); \
current_pixels >>= 4; \
advance_dest_ptr_##combine_op(1); \
} \
// Draws a 4bpp tile clipped against the left edge of the screen.
// partial_tile_offset is how far in it's clipped, partial_tile_run is
// how many to draw.
#define partial_tile_right_noflip_4bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr) >> (partial_tile_offset * 4); \
partial_tile_4bpp(combine_op, alpha_op) \
// Draws a 4bpp tile clipped against both edges of the screen, same as right.
#define partial_tile_mid_noflip_4bpp(combine_op, alpha_op) \
partial_tile_right_noflip_4bpp(combine_op, alpha_op) \
// Draws a 4bpp tile clipped against the right edge of the screen.
// partial_tile_offset is how many to draw.
#define partial_tile_left_noflip_4bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr); \
partial_tile_4bpp(combine_op, alpha_op) \
// Draws a complete 4bpp tile row (not clipped)
#define tile_noflip_4bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr); \
tile_4bpp_draw_eight_##combine_op(alpha_op, noflip) \
// Like the above, but draws flipped tiles.
#define partial_tile_flip_4bpp(combine_op, alpha_op) \
for(i = 0; i < partial_tile_run; i++) \
{ \
tile_4bpp_draw_##combine_op(0, shift, 28, alpha_op); \
current_pixels <<= 4; \
advance_dest_ptr_##combine_op(1); \
} \
#define partial_tile_right_flip_4bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr) << (partial_tile_offset * 4); \
partial_tile_flip_4bpp(combine_op, alpha_op) \
#define partial_tile_mid_flip_4bpp(combine_op, alpha_op) \
partial_tile_right_flip_4bpp(combine_op, alpha_op) \
#define partial_tile_left_flip_4bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr); \
partial_tile_flip_4bpp(combine_op, alpha_op) \
#define tile_flip_4bpp(combine_op, alpha_op) \
current_pixels = *((u32 *)tile_ptr); \
tile_4bpp_draw_eight_##combine_op(alpha_op, flip) \
// Draws a single (partial or complete) tile from the tilemap, flipping
// as necessary.
#define single_tile_map(tile_type, combine_op, color_depth, alpha_op) \
get_tile_##color_depth(); \
if(current_tile & 0x800) \
tile_ptr += vertical_pixel_flip; \
\
if(current_tile & 0x400) \
{ \
tile_type##_flip_##color_depth(combine_op, alpha_op); \
} \
else \
{ \
tile_type##_noflip_##color_depth(combine_op, alpha_op); \
} \
// Draws multiple sequential tiles from the tilemap, hflips and vflips as
// necessary.
#define multiple_tile_map(combine_op, color_depth, alpha_op) \
for(i = 0; i < tile_run; i++) \
{ \
single_tile_map(tile, combine_op, color_depth, alpha_op); \
advance_dest_ptr_##combine_op(8); \
map_ptr++; \
} \
// Draws a partial tile from a tilemap clipped against the left edge of the
// screen.
#define partial_tile_right_map(combine_op, color_depth, alpha_op) \
single_tile_map(partial_tile_right, combine_op, color_depth, alpha_op); \
map_ptr++ \
// Draws a partial tile from a tilemap clipped against both edges of the
// screen.
#define partial_tile_mid_map(combine_op, color_depth, alpha_op) \
single_tile_map(partial_tile_mid, combine_op, color_depth, alpha_op) \
// Draws a partial tile from a tilemap clipped against the right edge of the
// screen.
#define partial_tile_left_map(combine_op, color_depth, alpha_op) \
single_tile_map(partial_tile_left, combine_op, color_depth, alpha_op) \
// Advances a non-flipped 4bpp obj to the next tile.
#define obj_advance_noflip_4bpp() \
tile_ptr += 32 \
// Advances a non-flipped 8bpp obj to the next tile.
#define obj_advance_noflip_8bpp() \
tile_ptr += 64 \
// Advances a flipped 4bpp obj to the next tile.
#define obj_advance_flip_4bpp() \
tile_ptr -= 32 \
// Advances a flipped 8bpp obj to the next tile.
#define obj_advance_flip_8bpp() \
tile_ptr -= 64 \
// Draws multiple sequential tiles from an obj, flip_op determines if it should
// be flipped or not (set to flip or noflip)
#define multiple_tile_obj(combine_op, color_depth, alpha_op, flip_op) \
for(i = 0; i < tile_run; i++) \
{ \
tile_##flip_op##_##color_depth(combine_op, alpha_op); \
obj_advance_##flip_op##_##color_depth(); \
advance_dest_ptr_##combine_op(8); \
} \
// Draws an obj's tile clipped against the left side of the screen
#define partial_tile_right_obj(combine_op, color_depth, alpha_op, flip_op) \
partial_tile_right_##flip_op##_##color_depth(combine_op, alpha_op); \
obj_advance_##flip_op##_##color_depth() \
// Draws an obj's tile clipped against both sides of the screen
#define partial_tile_mid_obj(combine_op, color_depth, alpha_op, flip_op) \
partial_tile_mid_##flip_op##_##color_depth(combine_op, alpha_op) \
// Draws an obj's tile clipped against the right side of the screen
#define partial_tile_left_obj(combine_op, color_depth, alpha_op, flip_op) \
partial_tile_left_##flip_op##_##color_depth(combine_op, alpha_op) \
// Extra variables specific for 8bpp/4bpp tile renderers.
#define tile_extra_variables_8bpp() \
#define tile_extra_variables_4bpp() \
u32 current_palette \
// Byte lengths of complete tiles and tile rows in 4bpp and 8bpp.
#define tile_width_4bpp 4
#define tile_size_4bpp 32
#define tile_width_8bpp 8
#define tile_size_8bpp 64
// Render a single scanline of text tiles
#define tile_render(color_depth, combine_op, alpha_op) \
{ \
u32 vertical_pixel_offset = (vertical_offset % 8) * \
tile_width_##color_depth; \
u32 vertical_pixel_flip = \
((tile_size_##color_depth - tile_width_##color_depth) - \
vertical_pixel_offset) - vertical_pixel_offset; \
tile_extra_variables_##color_depth(); \
u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)) + \
vertical_pixel_offset; \
u32 pixel_run = 256 - (horizontal_offset % 256); \
u32 current_tile; \
\
map_base += ((vertical_offset % 256) / 8) * 32; \
partial_tile_offset = (horizontal_offset % 8); \
\
if(pixel_run >= end) \
{ \
if(partial_tile_offset) \
{ \
partial_tile_run = 8 - partial_tile_offset; \
if(end < partial_tile_run) \
{ \
partial_tile_run = end; \
partial_tile_mid_map(combine_op, color_depth, alpha_op); \
return; \
} \
else \
{ \
end -= partial_tile_run; \
partial_tile_right_map(combine_op, color_depth, alpha_op); \
} \
} \
\
tile_run = end / 8; \
multiple_tile_map(combine_op, color_depth, alpha_op); \
\
partial_tile_run = end % 8; \
\
if(partial_tile_run) \
{ \
partial_tile_left_map(combine_op, color_depth, alpha_op); \
} \
} \
else \
{ \
if(partial_tile_offset) \
{ \
partial_tile_run = 8 - partial_tile_offset; \
partial_tile_right_map(combine_op, color_depth, alpha_op); \
} \
\
tile_run = (pixel_run - partial_tile_run) / 8; \
multiple_tile_map(combine_op, color_depth, alpha_op); \
map_ptr = second_ptr; \
end -= pixel_run; \
tile_run = end / 8; \
multiple_tile_map(combine_op, color_depth, alpha_op); \
\
partial_tile_run = end % 8; \
if(partial_tile_run) \
{ \
partial_tile_left_map(combine_op, color_depth, alpha_op); \
} \
} \
} \
#define render_scanline_dest_normal u16
#define render_scanline_dest_alpha u32
#define render_scanline_dest_alpha_obj u32
#define render_scanline_dest_color16 u16
#define render_scanline_dest_color32 u32
#define render_scanline_dest_partial_alpha u32
#define render_scanline_dest_copy_tile u16
#define render_scanline_dest_copy_bitmap u16
// If rendering a scanline that is not a target A then there's no point in
// keeping what's underneath it because it can't blend with it.
#define render_scanline_skip_alpha(bg_type, combine_op) \
if((pixel_combine & 0x00000200) == 0) \
{ \
render_scanline_##bg_type##_##combine_op##_color32(layer, \
start, end, scanline); \
return; \
} \
#define render_scanline_extra_variables_base_normal(bg_type) \
#define render_scanline_extra_variables_transparent_normal(bg_type) \
#define render_scanline_extra_variables_base_alpha(bg_type) \
u32 bg_combine = color_combine_mask(5); \
u32 pixel_combine = color_combine_mask(layer) | (bg_combine << 16); \
render_scanline_skip_alpha(bg_type, base) \
#define render_scanline_extra_variables_base_color() \
u32 bg_combine = color_combine_mask(5); \
u32 pixel_combine = color_combine_mask(layer) \
#define render_scanline_extra_variables_transparent_alpha(bg_type) \
u32 pixel_combine = color_combine_mask(layer); \
render_scanline_skip_alpha(bg_type, transparent) \
#define render_scanline_extra_variables_transparent_color() \
u32 pixel_combine = color_combine_mask(layer) \
#define render_scanline_extra_variables_base_color16(bg_type) \
render_scanline_extra_variables_base_color() \
#define render_scanline_extra_variables_transparent_color16(bg_type) \
render_scanline_extra_variables_transparent_color() \
#define render_scanline_extra_variables_base_color32(bg_type) \
render_scanline_extra_variables_base_color() \
#define render_scanline_extra_variables_transparent_color32(bg_type) \
render_scanline_extra_variables_transparent_color() \
// Map widths and heights
u32 map_widths[] = { 256, 512, 256, 512 };
u32 map_heights[] = { 256, 256, 512, 512 };
// Build text scanline rendering functions.
#define render_scanline_text_builder(combine_op, alpha_op) \
void render_scanline_text_##combine_op##_##alpha_op(u32 layer, \
u32 start, u32 end, void *scanline) \
{ \
render_scanline_extra_variables_##combine_op##_##alpha_op(text); \
u32 bg_control = io_registers[REG_BG0CNT + layer]; \
u32 map_size = (bg_control >> 14) & 0x03; \
u32 map_width = map_widths[map_size]; \
u32 map_height = map_heights[map_size]; \
u32 horizontal_offset = \
(io_registers[REG_BG0HOFS + (layer * 2)] + start) % 512; \
u32 vertical_offset = (io_registers[REG_VCOUNT] + \
io_registers[REG_BG0VOFS + (layer * 2)]) % 512; \
u32 current_pixel; \
u32 current_pixels; \
u32 partial_tile_run = 0; \
u32 partial_tile_offset; \
u32 tile_run; \
u16 *palette = palette_ram_converted; \
u32 i; \
render_scanline_dest_##alpha_op *dest_ptr = \
((render_scanline_dest_##alpha_op *)scanline) + start; \
\
u16 *map_base = (u16 *)(vram + ((bg_control >> 8) & 0x1F) * (1024 * 2)); \
u16 *map_ptr, *second_ptr; \
u8 *tile_ptr; \
\
end -= start; \
\
if((map_size & 0x02) && (vertical_offset >= 256)) \
{ \
map_base += ((map_width / 8) * 32) + \
(((vertical_offset - 256) / 8) * 32); \
} \
else \
{ \
map_base += (((vertical_offset % 256) / 8) * 32); \
} \
\
if(map_size & 0x01) \
{ \
if(horizontal_offset >= 256) \
{ \
horizontal_offset -= 256; \
map_ptr = map_base + (32 * 32) + (horizontal_offset / 8); \
second_ptr = map_base; \
} \
else \
{ \
map_ptr = map_base + (horizontal_offset / 8); \
second_ptr = map_base + (32 * 32); \
} \
} \
else \
{ \
horizontal_offset %= 256; \
map_ptr = map_base + (horizontal_offset / 8); \
second_ptr = map_base; \
} \
\
if(bg_control & 0x80) \
{ \
tile_render(8bpp, combine_op, alpha_op); \
} \
else \
{ \
tile_render(4bpp, combine_op, alpha_op); \
} \
} \
render_scanline_text_builder(base, normal);
render_scanline_text_builder(transparent, normal);
render_scanline_text_builder(base, color16);
render_scanline_text_builder(transparent, color16);
render_scanline_text_builder(base, color32);
render_scanline_text_builder(transparent, color32);
render_scanline_text_builder(base, alpha);
render_scanline_text_builder(transparent, alpha);
s32 affine_reference_x[2];
s32 affine_reference_y[2];
#define affine_render_bg_pixel_normal() \
current_pixel = palette_ram_converted[0] \
#define affine_render_bg_pixel_alpha() \
current_pixel = bg_combine \
#define affine_render_bg_pixel_color16() \
affine_render_bg_pixel_alpha() \
#define affine_render_bg_pixel_color32() \
affine_render_bg_pixel_alpha() \
#define affine_render_bg_pixel_base(alpha_op) \
affine_render_bg_pixel_##alpha_op() \
#define affine_render_bg_pixel_transparent(alpha_op) \
#define affine_render_bg_pixel_copy(alpha_op) \
#define affine_render_bg_base(alpha_op) \
dest_ptr[0] = current_pixel
#define affine_render_bg_transparent(alpha_op) \
#define affine_render_bg_copy(alpha_op) \
#define affine_render_bg_remainder_base(alpha_op) \
affine_render_bg_pixel_##alpha_op(); \
for(; i < end; i++) \
{ \
affine_render_bg_base(alpha_op); \
advance_dest_ptr_base(1); \
} \
#define affine_render_bg_remainder_transparent(alpha_op) \
#define affine_render_bg_remainder_copy(alpha_op) \
#define affine_render_next(combine_op) \
source_x += dx; \
source_y += dy; \
advance_dest_ptr_##combine_op(1) \
#define affine_render_scale_offset() \
tile_base += ((pixel_y % 8) * 8); \
map_base += (pixel_y / 8) << map_pitch \
#define affine_render_scale_pixel(combine_op, alpha_op) \
map_offset = (pixel_x / 8); \
if(map_offset != last_map_offset) \
{ \
tile_ptr = tile_base + (map_base[map_offset] * 64); \
last_map_offset = map_offset; \
} \
tile_ptr = tile_base + (map_base[(pixel_x / 8)] * 64); \
current_pixel = tile_ptr[(pixel_x % 8)]; \
tile_8bpp_draw_##combine_op(0, none, 0, alpha_op); \
affine_render_next(combine_op) \
#define affine_render_scale(combine_op, alpha_op) \
{ \
pixel_y = source_y >> 8; \
u32 i = 0; \
affine_render_bg_pixel_##combine_op(alpha_op); \
if((u32)pixel_y < (u32)width_height) \
{ \
affine_render_scale_offset(); \
for(; i < end; i++) \
{ \
pixel_x = source_x >> 8; \
\
if((u32)pixel_x < (u32)width_height) \
{ \
break; \
} \
\
affine_render_bg_##combine_op(alpha_op); \
affine_render_next(combine_op); \
} \
\
for(; i < end; i++) \
{ \
pixel_x = source_x >> 8; \
\
if((u32)pixel_x >= (u32)width_height) \
break; \
\
affine_render_scale_pixel(combine_op, alpha_op); \
} \
} \
affine_render_bg_remainder_##combine_op(alpha_op); \
} \
#define affine_render_scale_wrap(combine_op, alpha_op) \
{ \
u32 wrap_mask = width_height - 1; \
pixel_y = (source_y >> 8) & wrap_mask; \
if((u32)pixel_y < (u32)width_height) \
{ \
affine_render_scale_offset(); \
for(i = 0; i < end; i++) \
{ \
pixel_x = (source_x >> 8) & wrap_mask; \
affine_render_scale_pixel(combine_op, alpha_op); \
} \
} \
} \
#define affine_render_rotate_pixel(combine_op, alpha_op) \
map_offset = (pixel_x / 8) + ((pixel_y / 8) << map_pitch); \
if(map_offset != last_map_offset) \
{ \
tile_ptr = tile_base + (map_base[map_offset] * 64); \
last_map_offset = map_offset; \
} \
\
current_pixel = tile_ptr[(pixel_x % 8) + ((pixel_y % 8) * 8)]; \
tile_8bpp_draw_##combine_op(0, none, 0, alpha_op); \
affine_render_next(combine_op) \
#define affine_render_rotate(combine_op, alpha_op) \
{ \
affine_render_bg_pixel_##combine_op(alpha_op); \
for(i = 0; i < end; i++) \
{ \
pixel_x = source_x >> 8; \
pixel_y = source_y >> 8; \
\
if(((u32)pixel_x < (u32)width_height) && \
((u32)pixel_y < (u32)width_height)) \
{ \
break; \
} \
affine_render_bg_##combine_op(alpha_op); \
affine_render_next(combine_op); \
} \
\
for(; i < end; i++) \
{ \
pixel_x = source_x >> 8; \
pixel_y = source_y >> 8; \
\
if(((u32)pixel_x >= (u32)width_height) || \
((u32)pixel_y >= (u32)width_height)) \
{ \
affine_render_bg_remainder_##combine_op(alpha_op); \
break; \
} \
\
affine_render_rotate_pixel(combine_op, alpha_op); \
} \
} \
#define affine_render_rotate_wrap(combine_op, alpha_op) \
{ \
u32 wrap_mask = width_height - 1; \
for(i = 0; i < end; i++) \
{ \
pixel_x = (source_x >> 8) & wrap_mask; \
pixel_y = (source_y >> 8) & wrap_mask; \
\
affine_render_rotate_pixel(combine_op, alpha_op); \
} \
} \
// Build affine background renderers.
#define render_scanline_affine_builder(combine_op, alpha_op) \
void render_scanline_affine_##combine_op##_##alpha_op(u32 layer, \
u32 start, u32 end, void *scanline) \
{ \
render_scanline_extra_variables_##combine_op##_##alpha_op(affine); \
u32 bg_control = io_registers[REG_BG0CNT + layer]; \
u32 current_pixel; \
s32 source_x, source_y; \
u32 vcount = io_registers[REG_VCOUNT]; \
u32 pixel_x, pixel_y; \
u32 layer_offset = (layer - 2) * 8; \
s32 dx, dy; \
u32 map_size = (bg_control >> 14) & 0x03; \
u32 width_height = 1 << (7 + map_size); \
u32 map_pitch = map_size + 4; \
u8 *map_base = vram + (((bg_control >> 8) & 0x1F) * (1024 * 2)); \
u8 *tile_base = vram + (((bg_control >> 2) & 0x03) * (1024 * 16)); \
u8 *tile_ptr; \
u16 *palette = palette_ram_converted; \
u32 map_offset, last_map_offset = (u32)-1; \
u32 i; \
render_scanline_dest_##alpha_op *dest_ptr = \
((render_scanline_dest_##alpha_op *)scanline) + start; \
\
dx = (s16)io_registers[REG_BG2PA + layer_offset]; \
dy = (s16)io_registers[REG_BG2PC + layer_offset]; \
source_x = affine_reference_x[layer - 2] + (start * dx); \
source_y = affine_reference_y[layer - 2] + (start * dy); \
\
end -= start; \
\
switch(((bg_control >> 12) & 0x02) | (dy != 0)) \
{ \
case 0x00: \
affine_render_scale(combine_op, alpha_op); \
break; \
\
case 0x01: \
affine_render_rotate(combine_op, alpha_op); \
break; \
\
case 0x02: \
affine_render_scale_wrap(combine_op, alpha_op); \
break; \
\
case 0x03: \
affine_render_rotate_wrap(combine_op, alpha_op); \
break; \
} \
} \
render_scanline_affine_builder(base, normal);
render_scanline_affine_builder(transparent, normal);
render_scanline_affine_builder(base, color16);
render_scanline_affine_builder(transparent, color16);
render_scanline_affine_builder(base, color32);
render_scanline_affine_builder(transparent, color32);
render_scanline_affine_builder(base, alpha);
render_scanline_affine_builder(transparent, alpha);
#define bitmap_render_pixel_mode3(alpha_op) \
convert_palette(current_pixel); \
*dest_ptr = current_pixel \
#define bitmap_render_pixel_mode4(alpha_op) \
tile_expand_base_##alpha_op(0) \
#define bitmap_render_pixel_mode5(alpha_op) \
bitmap_render_pixel_mode3(alpha_op) \
#define bitmap_render_scale(type, alpha_op, width, height) \
pixel_y = (source_y >> 8); \
if((u32)pixel_y < (u32)height) \
{ \
pixel_x = (source_x >> 8); \
src_ptr += (pixel_y * width); \
if(dx == 0x100) \
{ \
if(pixel_x < 0) \
{ \
end += pixel_x; \
dest_ptr -= pixel_x; \
pixel_x = 0; \
} \
else \
\
if(pixel_x > 0) \
{ \
src_ptr += pixel_x; \
} \
\
if((pixel_x + end) >= width) \
end = (width - pixel_x); \
\
for(i = 0; (s32)i < (s32)end; i++) \
{ \
current_pixel = *src_ptr; \
bitmap_render_pixel_##type(alpha_op); \
src_ptr++; \
dest_ptr++; \
} \
} \
else \
{ \
if((u32)(source_y >> 8) < (u32)height) \
{ \
for(i = 0; i < end; i++) \
{ \
pixel_x = (source_x >> 8); \
\
if((u32)pixel_x < (u32)width) \
break; \
\
source_x += dx; \
dest_ptr++; \
} \
\
for(; i < end; i++) \
{ \
pixel_x = (source_x >> 8); \
\
if((u32)pixel_x >= (u32)width) \
break; \
\
current_pixel = src_ptr[pixel_x]; \
bitmap_render_pixel_##type(alpha_op); \
\
source_x += dx; \
dest_ptr++; \
} \
} \
} \
} \
#define bitmap_render_rotate(type, alpha_op, width, height) \
for(i = 0; i < end; i++) \
{ \
pixel_x = source_x >> 8; \
pixel_y = source_y >> 8; \
\
if(((u32)pixel_x < (u32)width) && ((u32)pixel_y < (u32)height)) \
break; \
\
source_x += dx; \
source_y += dy; \
dest_ptr++; \
} \
\
for(; i < end; i++) \
{ \
pixel_x = (source_x >> 8); \
pixel_y = (source_y >> 8); \
\
if(((u32)pixel_x >= (u32)width) || ((u32)pixel_y >= (u32)height)) \
break; \
\
current_pixel = src_ptr[pixel_x + (pixel_y * width)]; \
bitmap_render_pixel_##type(alpha_op); \
\
source_x += dx; \
source_y += dy; \
dest_ptr++; \
} \
#define render_scanline_vram_setup_mode3() \
u16 *src_ptr = (u16 *)vram \
#define render_scanline_vram_setup_mode4() \
u16 *palette = palette_ram_converted; \
u8 *src_ptr; \
if(io_registers[REG_DISPCNT] & 0x10) \
src_ptr = vram + 0xA000; \
else \
src_ptr = vram \
#define render_scanline_vram_setup_mode5() \
u16 *src_ptr; \
if(io_registers[REG_DISPCNT] & 0x10) \
src_ptr = (u16 *)(vram + 0xA000); \
else \
src_ptr = (u16 *)vram \
// Build bitmap scanline rendering functions.
#define render_scanline_bitmap_builder(type, alpha_op, width, height) \
void render_scanline_bitmap_##type##_##alpha_op(u32 start, u32 end, \
void *scanline) \
{ \
u32 bg_control = io_registers[REG_BG2CNT]; \
u32 current_pixel; \
s32 source_x, source_y; \
u32 vcount = io_registers[REG_VCOUNT]; \
s32 pixel_x, pixel_y; \
\
s32 dx = (s16)io_registers[REG_BG2PA]; \
s32 dy = (s16)io_registers[REG_BG2PC]; \
\
u32 i; \
\
render_scanline_dest_##alpha_op *dest_ptr = \
((render_scanline_dest_##alpha_op *)scanline) + start; \
render_scanline_vram_setup_##type(); \
\
end -= start; \
\
source_x = affine_reference_x[0] + (start * dx); \
source_y = affine_reference_y[0] + (start * dy); \
\
if(dy == 0) \
{ \
bitmap_render_scale(type, alpha_op, width, height); \
} \
else \
{ \
bitmap_render_rotate(type, alpha_op, width, height); \
} \
} \
render_scanline_bitmap_builder(mode3, normal, 240, 160);
render_scanline_bitmap_builder(mode4, normal, 240, 160);
render_scanline_bitmap_builder(mode5, normal, 160, 128);
// Fill in the renderers for a layer based on the mode type,
#define tile_layer_render_functions(type) \
{ \
render_scanline_##type##_base_normal, \
render_scanline_##type##_transparent_normal, \
render_scanline_##type##_base_alpha, \
render_scanline_##type##_transparent_alpha, \
render_scanline_##type##_base_color16, \
render_scanline_##type##_transparent_color16, \
render_scanline_##type##_base_color32, \
render_scanline_##type##_transparent_color32 \
} \
// Use if a layer is unsupported for that mode.
#define tile_layer_render_null() \
{ \
NULL, NULL, NULL, NULL \
} \
#define bitmap_layer_render_functions(type) \
{ \
render_scanline_bitmap_##type##_normal \
} \
// Structs containing functions to render the layers for each mode, for
// each render type.
tile_layer_render_struct tile_mode_renderers[3][4] =
{
{
tile_layer_render_functions(text), tile_layer_render_functions(text),
tile_layer_render_functions(text), tile_layer_render_functions(text)
},
{
tile_layer_render_functions(text), tile_layer_render_functions(text),
tile_layer_render_functions(affine), tile_layer_render_functions(text)
},
{
tile_layer_render_functions(text), tile_layer_render_functions(text),
tile_layer_render_functions(affine), tile_layer_render_functions(affine)
}
};
bitmap_layer_render_struct bitmap_mode_renderers[3] =
{
bitmap_layer_render_functions(mode3),
bitmap_layer_render_functions(mode4),
bitmap_layer_render_functions(mode5)
};
#define render_scanline_layer_functions_tile() \
tile_layer_render_struct *layer_renderers = \
tile_mode_renderers[dispcnt & 0x07] \
#define render_scanline_layer_functions_bitmap() \
bitmap_layer_render_struct *layer_renderers = \
bitmap_mode_renderers + ((dispcnt & 0x07) - 3) \
// Adjust a flipped obj's starting position
#define obj_tile_offset_noflip(color_depth) \
#define obj_tile_offset_flip(color_depth) \
+ (tile_size_##color_depth * ((obj_width - 8) / 8)) \
// Adjust the obj's starting point if it goes too far off the left edge of \
// the screen. \
#define obj_tile_right_offset_noflip(color_depth) \
tile_ptr += (partial_tile_offset / 8) * tile_size_##color_depth \
#define obj_tile_right_offset_flip(color_depth) \
tile_ptr -= (partial_tile_offset / 8) * tile_size_##color_depth \
// Get the current row offset into an obj in 1D map space
#define obj_tile_offset_1D(color_depth, flip_op) \
tile_ptr = tile_base + ((obj_attribute_2 & 0x3FF) * 32) \
+ ((vertical_offset / 8) * (obj_width / 8) * tile_size_##color_depth) \
+ ((vertical_offset % 8) * tile_width_##color_depth) \
obj_tile_offset_##flip_op(color_depth) \
// Get the current row offset into an obj in 2D map space
#define obj_tile_offset_2D(color_depth, flip_op) \
tile_ptr = tile_base + ((obj_attribute_2 & 0x3FF) * 32) \
+ ((vertical_offset / 8) * 1024) \
+ ((vertical_offset % 8) * tile_width_##color_depth) \
obj_tile_offset_##flip_op(color_depth) \
// Get the palette for 4bpp obj.
#define obj_get_palette_4bpp() \
current_palette = (obj_attribute_2 >> 8) & 0xF0 \
#define obj_get_palette_8bpp() \
// Render the current row of an obj.
#define obj_render(combine_op, color_depth, alpha_op, map_space, flip_op) \
{ \
obj_get_palette_##color_depth(); \
obj_tile_offset_##map_space(color_depth, flip_op); \
\
if(obj_x < (s32)start) \
{ \
dest_ptr = scanline + start; \
pixel_run = obj_width - (start - obj_x); \
if((s32)pixel_run > 0) \
{ \
if((obj_x + obj_width) >= end) \
{ \
pixel_run = end - start; \
partial_tile_offset = start - obj_x; \
obj_tile_right_offset_##flip_op(color_depth); \
partial_tile_offset %= 8; \
\
if(partial_tile_offset) \
{ \
partial_tile_run = 8 - partial_tile_offset; \
if((s32)pixel_run < (s32)partial_tile_run) \
{ \
if((s32)pixel_run > 0) \
{ \
partial_tile_run = pixel_run; \
partial_tile_mid_obj(combine_op, color_depth, alpha_op, \
flip_op); \
} \
continue; \
} \
else \
{ \
pixel_run -= partial_tile_run; \
partial_tile_right_obj(combine_op, color_depth, alpha_op, \
flip_op); \
} \
} \
tile_run = pixel_run / 8; \
multiple_tile_obj(combine_op, color_depth, alpha_op, flip_op); \
partial_tile_run = pixel_run % 8; \
if(partial_tile_run) \
{ \
partial_tile_left_obj(combine_op, color_depth, alpha_op, \
flip_op); \
} \
} \
else \
{ \
partial_tile_offset = start - obj_x; \
obj_tile_right_offset_##flip_op(color_depth); \
partial_tile_offset %= 8; \
if(partial_tile_offset) \
{ \
partial_tile_run = 8 - partial_tile_offset; \
partial_tile_right_obj(combine_op, color_depth, alpha_op, \
flip_op); \
} \
tile_run = pixel_run / 8; \
multiple_tile_obj(combine_op, color_depth, alpha_op, flip_op); \
} \
} \
} \
else \
\
if((obj_x + obj_width) >= end) \
{ \
pixel_run = end - obj_x; \
if((s32)pixel_run > 0) \
{ \
dest_ptr = scanline + obj_x; \
tile_run = pixel_run / 8; \
multiple_tile_obj(combine_op, color_depth, alpha_op, flip_op); \
partial_tile_run = pixel_run % 8; \
if(partial_tile_run) \
{ \
partial_tile_left_obj(combine_op, color_depth, alpha_op, flip_op); \
} \
} \
} \
else \
{ \
dest_ptr = scanline + obj_x; \
tile_run = obj_width / 8; \
multiple_tile_obj(combine_op, color_depth, alpha_op, flip_op); \
} \
} \
#define obj_scale_offset_1D(color_depth) \
tile_ptr = tile_base + ((obj_attribute_2 & 0x3FF) * 32) \
+ ((vertical_offset / 8) * (max_x / 8) * tile_size_##color_depth) \
+ ((vertical_offset % 8) * tile_width_##color_depth) \
// Get the current row offset into an obj in 2D map space
#define obj_scale_offset_2D(color_depth) \
tile_ptr = tile_base + ((obj_attribute_2 & 0x3FF) * 32) \
+ ((vertical_offset / 8) * 1024) \
+ ((vertical_offset % 8) * tile_width_##color_depth) \
#define obj_render_scale_pixel_4bpp(combine_op, alpha_op) \
if(tile_x & 0x01) \
{ \
current_pixel = tile_ptr[tile_map_offset + ((tile_x >> 1) & 0x03)] >> 4; \
} \
else \
{ \
current_pixel = \
tile_ptr[tile_map_offset + ((tile_x >> 1) & 0x03)] & 0x0F; \
} \
\
tile_4bpp_draw_##combine_op(0, none, 0, alpha_op) \
#define obj_render_scale_pixel_8bpp(combine_op, alpha_op) \
current_pixel = tile_ptr[tile_map_offset + (tile_x & 0x07)]; \
tile_8bpp_draw_##combine_op(0, none, 0, alpha_op); \
#define obj_render_scale(combine_op, color_depth, alpha_op, map_space) \
{ \
u32 vertical_offset; \
source_y += (y_delta * dmy); \
vertical_offset = (source_y >> 8); \
if((u32)vertical_offset < (u32)max_y) \
{ \
obj_scale_offset_##map_space(color_depth); \
source_x += (y_delta * dmx) - (middle_x * dx); \
\
for(i = 0; i < obj_width; i++) \
{ \
tile_x = (source_x >> 8); \
\
if((u32)tile_x < (u32)max_x) \
break; \
\
source_x += dx; \
advance_dest_ptr_##combine_op(1); \
} \
\
for(; i < obj_width; i++) \
{ \
tile_x = (source_x >> 8); \
\
if((u32)tile_x >= (u32)max_x) \
break; \
\
tile_map_offset = (tile_x >> 3) * tile_size_##color_depth; \
obj_render_scale_pixel_##color_depth(combine_op, alpha_op); \
\
source_x += dx; \
advance_dest_ptr_##combine_op(1); \
} \
} \
} \
#define obj_rotate_offset_1D(color_depth) \
obj_tile_pitch = (max_x / 8) * tile_size_##color_depth \
#define obj_rotate_offset_2D(color_depth) \
obj_tile_pitch = 1024 \
#define obj_render_rotate_pixel_4bpp(combine_op, alpha_op) \
if(tile_x & 0x01) \
{ \
current_pixel = tile_ptr[tile_map_offset + \
((tile_x >> 1) & 0x03) + ((tile_y & 0x07) * obj_pitch)] >> 4; \
} \
else \
{ \
current_pixel = tile_ptr[tile_map_offset + \
((tile_x >> 1) & 0x03) + ((tile_y & 0x07) * obj_pitch)] & 0x0F; \
} \
\
tile_4bpp_draw_##combine_op(0, none, 0, alpha_op) \
#define obj_render_rotate_pixel_8bpp(combine_op, alpha_op) \
current_pixel = tile_ptr[tile_map_offset + \
(tile_x & 0x07) + ((tile_y & 0x07) * obj_pitch)]; \
\
tile_8bpp_draw_##combine_op(0, none, 0, alpha_op) \
#define obj_render_rotate(combine_op, color_depth, alpha_op, map_space) \
{ \
tile_ptr = tile_base + ((obj_attribute_2 & 0x3FF) * 32); \
obj_rotate_offset_##map_space(color_depth); \
\
source_x += (y_delta * dmx) - (middle_x * dx); \
source_y += (y_delta * dmy) - (middle_x * dy); \
\
for(i = 0; i < obj_width; i++) \
{ \
tile_x = (source_x >> 8); \
tile_y = (source_y >> 8); \
\
if(((u32)tile_x < (u32)max_x) && ((u32)tile_y < (u32)max_y)) \
break; \
\
source_x += dx; \
source_y += dy; \
advance_dest_ptr_##combine_op(1); \
} \
\
for(; i < obj_width; i++) \
{ \
tile_x = (source_x >> 8); \
tile_y = (source_y >> 8); \
\
if(((u32)tile_x >= (u32)max_x) || ((u32)tile_y >= (u32)max_y)) \
break; \
\
tile_map_offset = ((tile_x >> 3) * tile_size_##color_depth) + \
((tile_y >> 3) * obj_tile_pitch); \
obj_render_rotate_pixel_##color_depth(combine_op, alpha_op); \
\
source_x += dx; \
source_y += dy; \
advance_dest_ptr_##combine_op(1); \
} \
} \
// Render the current row of an affine transformed OBJ.
#define obj_render_affine(combine_op, color_depth, alpha_op, map_space) \
{ \
s16 *params = oam_ram + (((obj_attribute_1 >> 9) & 0x1F) * 16); \
s32 dx = params[3]; \
s32 dmx = params[7]; \
s32 dy = params[11]; \
s32 dmy = params[15]; \
s32 source_x, source_y; \
s32 tile_x, tile_y; \
u32 tile_offset; \
u32 tile_map_offset; \
s32 middle_x; \
s32 middle_y; \
s32 max_x = obj_width; \
s32 max_y = obj_height; \
s32 y_delta; \
u32 obj_pitch = tile_width_##color_depth; \
u32 obj_tile_pitch; \
\
middle_x = (obj_width / 2); \
middle_y = (obj_height / 2); \
\
source_x = (middle_x << 8); \
source_y = (middle_y << 8); \
\
\
if(obj_attribute_0 & 0x200) \
{ \
obj_width *= 2; \
obj_height *= 2; \
middle_x *= 2; \
middle_y *= 2; \
} \
\
if((s32)obj_x < (s32)start) \
{ \
u32 x_delta = start - obj_x; \
middle_x -= x_delta; \
obj_width -= x_delta; \
obj_x = start; \
\
if((s32)obj_width <= 0) \
continue; \
} \
\
if((s32)(obj_x + obj_width) >= (s32)end) \
{ \
obj_width = end - obj_x; \
\
if((s32)obj_width <= 0) \
continue; \
} \
dest_ptr = scanline + obj_x; \
\
y_delta = vcount - (obj_y + middle_y); \
\
obj_get_palette_##color_depth(); \
\
if(dy == 0) \
{ \
obj_render_scale(combine_op, color_depth, alpha_op, map_space); \
} \
else \
{ \
obj_render_rotate(combine_op, color_depth, alpha_op, map_space); \
} \
} \
u32 obj_width_table[] = { 8, 16, 32, 64, 16, 32, 32, 64, 8, 8, 16, 32 };
u32 obj_height_table[] = { 8, 16, 32, 64, 8, 8, 16, 32, 16, 32, 32, 64 };
u8 obj_priority_list[5][160][128];
u32 obj_priority_count[5][160];
u32 obj_alpha_count[160];
// Build obj rendering functions
#define render_scanline_obj_extra_variables_normal(map_space) \
#define render_scanline_obj_extra_variables_color() \
u32 dest; \
u32 pixel_combine = color_combine_mask(4) | (1 << 8) \
#define render_scanline_obj_extra_variables_alpha_obj(map_space) \
render_scanline_obj_extra_variables_color(); \
if((pixel_combine & 0x00000200) == 0) \
{ \
render_scanline_obj_color32_##map_space(priority, start, end, scanline); \
return; \
} \
#define render_scanline_obj_extra_variables_color16(map_space) \
render_scanline_obj_extra_variables_color() \
#define render_scanline_obj_extra_variables_color32(map_space) \
render_scanline_obj_extra_variables_color() \
#define render_scanline_obj_extra_variables_partial_alpha(map_space) \
render_scanline_obj_extra_variables_color(); \
u32 base_pixel_combine = pixel_combine \
#define render_scanline_obj_extra_variables_copy(type) \
u32 bldcnt = io_registers[REG_BLDCNT]; \
u32 dispcnt = io_registers[REG_DISPCNT]; \
u32 obj_enable = io_registers[REG_WINOUT] >> 8; \
render_scanline_layer_functions_##type(); \
u32 copy_start, copy_end; \
u16 copy_buffer[240]; \
u16 *copy_ptr \
#define render_scanline_obj_extra_variables_copy_tile(map_space) \
render_scanline_obj_extra_variables_copy(tile) \
#define render_scanline_obj_extra_variables_copy_bitmap(map_space) \
render_scanline_obj_extra_variables_copy(bitmap) \
#define render_scanline_obj_main(combine_op, alpha_op, map_space) \
if(obj_attribute_0 & 0x100) \
{ \
if((obj_attribute_0 >> 13) & 0x01) \
{ \
obj_render_affine(combine_op, 8bpp, alpha_op, map_space); \
} \
else \
{ \
obj_render_affine(combine_op, 4bpp, alpha_op, map_space); \
} \
} \
else \
{ \
vertical_offset = vcount - obj_y; \
\
if((obj_attribute_1 >> 13) & 0x01) \
vertical_offset = obj_height - vertical_offset - 1; \
\
switch(((obj_attribute_0 >> 12) & 0x02) | \
((obj_attribute_1 >> 12) & 0x01)) \
{ \
case 0x0: \
obj_render(combine_op, 4bpp, alpha_op, map_space, noflip); \
break; \
\
case 0x1: \
obj_render(combine_op, 4bpp, alpha_op, map_space, flip); \
break; \
\
case 0x2: \
obj_render(combine_op, 8bpp, alpha_op, map_space, noflip); \
break; \
\
case 0x3: \
obj_render(combine_op, 8bpp, alpha_op, map_space, flip); \
break; \
} \
} \
#define render_scanline_obj_no_partial_alpha(combine_op, alpha_op, map_space) \
render_scanline_obj_main(combine_op, alpha_op, map_space) \
#define render_scanline_obj_partial_alpha(combine_op, alpha_op, map_space) \
if((obj_attribute_0 >> 10) & 0x03) \
{ \
pixel_combine = 0x00000300; \
render_scanline_obj_main(combine_op, alpha_obj, map_space); \
} \
else \
{ \
pixel_combine = base_pixel_combine; \
render_scanline_obj_main(combine_op, color32, map_space); \
} \
#define render_scanline_obj_prologue_transparent(alpha_op) \
#define render_scanline_obj_prologue_copy_body(type) \
copy_start = obj_x; \
if(obj_attribute_0 & 0x200) \
copy_end = obj_x + (obj_width * 2); \
else \
copy_end = obj_x + obj_width; \
\
if(copy_start < start) \
copy_start = start; \
if(copy_end > end) \
copy_end = end; \
\
if((copy_start < end) && (copy_end > start)) \
{ \
render_scanline_conditional_##type(copy_start, copy_end, copy_buffer, \
obj_enable, dispcnt, bldcnt, layer_renderers); \
copy_ptr = copy_buffer + copy_start; \
} \
else \
{ \
continue; \
} \
#define render_scanline_obj_prologue_copy_tile() \
render_scanline_obj_prologue_copy_body(tile) \
#define render_scanline_obj_prologue_copy_bitmap() \
render_scanline_obj_prologue_copy_body(bitmap) \
#define render_scanline_obj_prologue_copy(alpha_op) \
render_scanline_obj_prologue_##alpha_op() \
#define render_scanline_obj_builder(combine_op, alpha_op, map_space, \
partial_alpha_op) \
void render_scanline_obj_##alpha_op##_##map_space(u32 priority, \
u32 start, u32 end, render_scanline_dest_##alpha_op *scanline) \
{ \
render_scanline_obj_extra_variables_##alpha_op(map_space); \
s32 obj_num, i; \
s32 obj_x, obj_y; \
s32 obj_size; \
s32 obj_width, obj_height; \
u32 obj_attribute_0, obj_attribute_1, obj_attribute_2; \
s32 vcount = io_registers[REG_VCOUNT]; \
u32 tile_run; \
u32 current_pixels; \
u32 current_pixel; \
u32 current_palette; \
u32 vertical_offset; \
u32 partial_tile_run, partial_tile_offset; \
u32 pixel_run; \
u16 *oam_ptr; \
u16 *palette = palette_ram_converted + 256; \
render_scanline_dest_##alpha_op *dest_ptr; \
u8 *tile_base = vram + 0x10000; \
u8 *tile_ptr; \
u32 obj_count = obj_priority_count[priority][vcount]; \
u8 *obj_list = obj_priority_list[priority][vcount]; \
\
for(obj_num = 0; obj_num < obj_count; obj_num++) \
{ \
oam_ptr = oam_ram + (obj_list[obj_num] * 4); \
obj_attribute_0 = oam_ptr[0]; \
obj_attribute_1 = oam_ptr[1]; \
obj_attribute_2 = oam_ptr[2]; \
obj_size = ((obj_attribute_0 >> 12) & 0x0C) | (obj_attribute_1 >> 14); \
\
obj_x = (s32)(obj_attribute_1 << 23) >> 23; \
obj_width = obj_width_table[obj_size]; \
\
render_scanline_obj_prologue_##combine_op(alpha_op); \
\
obj_y = obj_attribute_0 & 0xFF; \
\
if(obj_y > 160) \
obj_y -= 256; \
\
obj_height = obj_height_table[obj_size]; \
render_scanline_obj_##partial_alpha_op(combine_op, alpha_op, map_space); \
} \
} \
render_scanline_obj_builder(transparent, normal, 1D, no_partial_alpha);
render_scanline_obj_builder(transparent, normal, 2D, no_partial_alpha);
render_scanline_obj_builder(transparent, color16, 1D, no_partial_alpha);
render_scanline_obj_builder(transparent, color16, 2D, no_partial_alpha);
render_scanline_obj_builder(transparent, color32, 1D, no_partial_alpha);
render_scanline_obj_builder(transparent, color32, 2D, no_partial_alpha);
render_scanline_obj_builder(transparent, alpha_obj, 1D, no_partial_alpha);
render_scanline_obj_builder(transparent, alpha_obj, 2D, no_partial_alpha);
render_scanline_obj_builder(transparent, partial_alpha, 1D, partial_alpha);
render_scanline_obj_builder(transparent, partial_alpha, 2D, partial_alpha);
render_scanline_obj_builder(copy, copy_tile, 1D, no_partial_alpha);
render_scanline_obj_builder(copy, copy_tile, 2D, no_partial_alpha);
render_scanline_obj_builder(copy, copy_bitmap, 1D, no_partial_alpha);
render_scanline_obj_builder(copy, copy_bitmap, 2D, no_partial_alpha);
void order_obj(u32 video_mode)
{
s32 obj_num, priority, row;
s32 obj_x, obj_y;
s32 obj_size, obj_mode;
s32 obj_width, obj_height;
u32 obj_priority;
u32 obj_attribute_0, obj_attribute_1, obj_attribute_2;
s32 vcount = io_registers[REG_VCOUNT];
u32 partial_tile_run, partial_tile_offset;
u32 pixel_run;
u32 current_count;
u16 *oam_ptr = oam_ram + 508;
u16 *palette = palette_ram_converted + 256;
u16 *dest_ptr;
u8 *tile_base = vram + 0x10000;
u8 *tile_ptr;
for(priority = 0; priority < 5; priority++)
{
for(row = 0; row < 160; row++)
{
obj_priority_count[priority][row] = 0;
}
}
for(row = 0; row < 160; row++)
{
obj_alpha_count[row] = 0;
}
for(obj_num = 127; obj_num >= 0; obj_num--, oam_ptr -= 4)
{
obj_attribute_0 = oam_ptr[0];
obj_attribute_2 = oam_ptr[2];
obj_size = obj_attribute_0 & 0xC000;
obj_priority = (obj_attribute_2 >> 10) & 0x03;
obj_mode = (obj_attribute_0 >> 10) & 0x03;
if(((obj_attribute_0 & 0x0300) != 0x0200) && (obj_size != 0xC000) &&
(obj_mode != 3) && ((video_mode < 3) ||
((obj_attribute_2 & 0x3FF) >= 512)))
{
obj_y = obj_attribute_0 & 0xFF;
if(obj_y > 160)
obj_y -= 256;
obj_attribute_1 = oam_ptr[1];
obj_size = ((obj_size >> 12) & 0x0C) | (obj_attribute_1 >> 14);
obj_height = obj_height_table[obj_size];
obj_width = obj_width_table[obj_size];
if(obj_attribute_0 & 0x200)
{
obj_height *= 2;
obj_width *= 2;
}
if(((obj_y + obj_height) > 0) && (obj_y < 160))
{
obj_x = (s32)(obj_attribute_1 << 23) >> 23;
if(((obj_x + obj_width) > 0) && (obj_x < 240))
{
if(obj_y < 0)
{
obj_height += obj_y;
obj_y = 0;
}
if((obj_y + obj_height) >= 160)
{
obj_height = 160 - obj_y;
}
if(obj_mode == 1)
{
for(row = obj_y; row < obj_y + obj_height; row++)
{
current_count = obj_priority_count[obj_priority][row];
obj_priority_list[obj_priority][row][current_count] = obj_num;
obj_priority_count[obj_priority][row] = current_count + 1;
obj_alpha_count[row]++;
}
}
else
{
if(obj_mode == 2)
{
obj_priority = 4;
}
for(row = obj_y; row < obj_y + obj_height; row++)
{
current_count = obj_priority_count[obj_priority][row];
obj_priority_list[obj_priority][row][current_count] = obj_num;
obj_priority_count[obj_priority][row] = current_count + 1;
}
}
}
}
}
}
}
u32 layer_order[16];
u32 layer_count;
u32 order_layers(u32 layer_flags)
{
s32 priority, layer_number;
layer_count = 0;
for(priority = 3; priority >= 0; priority--)
{
for(layer_number = 3; layer_number >= 0; layer_number--)
{
if(((layer_flags >> layer_number) & 1) &&
((io_registers[REG_BG0CNT + layer_number] & 0x03) == priority))
{
layer_order[layer_count] = layer_number;
layer_count++;
}
}
if((obj_priority_count[priority][io_registers[REG_VCOUNT]] > 0)
&& (layer_flags & 0x10))
{
layer_order[layer_count] = priority | 0x04;
layer_count++;
}
}
}
#define fill_line(_start, _end) \
u32 i; \
\
for(i = _start; i < _end; i++) \
{ \
dest_ptr[i] = color; \
} \
#define fill_line_color_normal() \
color = palette_ram_converted[color] \
#define fill_line_color_alpha() \
#define fill_line_color_color16() \
#define fill_line_color_color32() \
#define fill_line_builder(type) \
void fill_line_##type(u16 color, render_scanline_dest_##type *dest_ptr, \
u32 start, u32 end) \
{ \
fill_line_color_##type(); \
fill_line(start, end); \
} \
fill_line_builder(normal);
fill_line_builder(alpha);
fill_line_builder(color16);
fill_line_builder(color32);
// Alpha blend two pixels (pixel_top and pixel_bottom).
#define blend_pixel() \
pixel_bottom = palette_ram_converted[(pixel_pair >> 16) & 0x1FF]; \
pixel_bottom = (pixel_bottom | (pixel_bottom << 16)) & 0x07E0F81F; \
pixel_top = ((pixel_top * blend_a) + (pixel_bottom * blend_b)) >> 4; \
// Alpha blend two pixels, allowing for saturation (individual channels > 31).
// The operation is optimized towards saturation not occuring.
#define blend_saturate_pixel() \
pixel_bottom = palette_ram_converted[(pixel_pair >> 16) & 0x1FF]; \
pixel_bottom = (pixel_bottom | (pixel_bottom << 16)) & 0x07E0F81F; \
pixel_top = ((pixel_top * blend_a) + (pixel_bottom * blend_b)) >> 4; \
if(pixel_top & 0x08010020) \
{ \
if(pixel_top & 0x08000000) \
pixel_top |= 0x07E00000; \
\
if(pixel_top & 0x00010000) \
pixel_top |= 0x0000F800; \
\
if(pixel_top & 0x00000020) \
pixel_top |= 0x0000001F; \
} \
#define brighten_pixel() \
pixel_top = upper + ((pixel_top * blend) >> 4); \
#define darken_pixel() \
pixel_top = (pixel_top * blend) >> 4; \
#define effect_condition_alpha \
((pixel_pair & 0x04000200) == 0x04000200) \
#define effect_condition_fade(pixel_source) \
((pixel_source & 0x00000200) == 0x00000200) \
#define expand_pixel_no_dest(expand_type, pixel_source) \
pixel_top = (pixel_top | (pixel_top << 16)) & 0x07E0F81F; \
expand_type##_pixel(); \
pixel_top &= 0x07E0F81F; \
pixel_top = (pixel_top >> 16) | pixel_top \
#define expand_pixel(expand_type, pixel_source) \
pixel_top = palette_ram_converted[pixel_source & 0x1FF]; \
expand_pixel_no_dest(expand_type, pixel_source); \
*screen_dest_ptr = pixel_top \
#define expand_loop(expand_type, effect_condition, pixel_source) \
screen_src_ptr += start; \
screen_dest_ptr += start; \
\
end -= start; \
\
for(i = 0; i < end; i++) \
{ \
pixel_source = *screen_src_ptr; \
if(effect_condition) \
{ \
expand_pixel(expand_type, pixel_source); \
} \
else \
{ \
*screen_dest_ptr = \
palette_ram_converted[pixel_source & 0x1FF]; \
} \
\
screen_src_ptr++; \
screen_dest_ptr++; \
} \
#define expand_loop_partial_alpha(alpha_expand, expand_type) \
screen_src_ptr += start; \
screen_dest_ptr += start; \
\
end -= start; \
\
for(i = 0; i < end; i++) \
{ \
pixel_pair = *screen_src_ptr; \
if(effect_condition_fade(pixel_pair)) \
{ \
if(effect_condition_alpha) \
{ \
expand_pixel(alpha_expand, pixel_pair); \
} \
else \
{ \
expand_pixel(expand_type, pixel_pair); \
} \
} \
else \
{ \
*screen_dest_ptr = \
palette_ram_converted[pixel_pair & 0x1FF]; \
} \
\
screen_src_ptr++; \
screen_dest_ptr++; \
} \
#define expand_partial_alpha(expand_type) \
if((blend_a + blend_b) > 16) \
{ \
expand_loop_partial_alpha(blend_saturate, expand_type); \
} \
else \
{ \
expand_loop_partial_alpha(blend, expand_type); \
} \
// Blend top two pixels of scanline with each other.
void expand_blend(u32 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
u32 pixel_pair;
u32 pixel_top, pixel_bottom;
u32 bldalpha = io_registers[REG_BLDALPHA];
u32 blend_a = bldalpha & 0x1F;
u32 blend_b = (bldalpha >> 8) & 0x1F;
u32 i;
if(blend_a > 16)
blend_a = 16;
if(blend_b > 16)
blend_b = 16;
// The individual colors can saturate over 31, this should be taken
// care of in an alternate pass as it incurs a huge additional speedhit.
if((blend_a + blend_b) > 16)
{
expand_loop(blend_saturate, effect_condition_alpha, pixel_pair);
}
else
{
expand_loop(blend, effect_condition_alpha, pixel_pair);
}
}
// Blend scanline with white.
void expand_darken(u16 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
u32 pixel_top;
s32 blend = 16 - (io_registers[REG_BLDY] & 0x1F);
u32 i;
if(blend < 0)
blend = 0;
expand_loop(darken, effect_condition_fade(pixel_top), pixel_top);
}
// Blend scanline with black.
void expand_brighten(u16 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
u32 pixel_top;
u32 blend = io_registers[REG_BLDY] & 0x1F;
u32 upper;
u32 i;
if(blend > 16)
blend = 16;
upper = ((0x07E0F81F * blend) >> 4) & 0x07E0F81F;
blend = 16 - blend;
expand_loop(brighten, effect_condition_fade(pixel_top), pixel_top);
}
// Expand scanline such that if both top and bottom pass it's alpha,
// if only top passes it's as specified, and if neither pass it's normal.
void expand_darken_partial_alpha(u32 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
s32 blend = 16 - (io_registers[REG_BLDY] & 0x1F);
u32 pixel_pair;
u32 pixel_top, pixel_bottom;
u32 bldalpha = io_registers[REG_BLDALPHA];
u32 blend_a = bldalpha & 0x1F;
u32 blend_b = (bldalpha >> 8) & 0x1F;
u32 i;
if(blend < 0)
blend = 0;
if(blend_a > 16)
blend_a = 16;
if(blend_b > 16)
blend_b = 16;
expand_partial_alpha(darken);
}
void expand_brighten_partial_alpha(u32 *screen_src_ptr, u16 *screen_dest_ptr,
u32 start, u32 end)
{
s32 blend = io_registers[REG_BLDY] & 0x1F;
u32 pixel_pair;
u32 pixel_top, pixel_bottom;
u32 bldalpha = io_registers[REG_BLDALPHA];
u32 blend_a = bldalpha & 0x1F;
u32 blend_b = (bldalpha >> 8) & 0x1F;
u32 upper;
u32 i;
if(blend > 16)
blend = 16;
upper = ((0x07E0F81F * blend) >> 4) & 0x07E0F81F;
blend = 16 - blend;
if(blend_a > 16)
blend_a = 16;
if(blend_b > 16)
blend_b = 16;
expand_partial_alpha(brighten);
}
// Render an OBJ layer from start to end, depending on the type (1D or 2D)
// stored in dispcnt.
#define render_obj_layer(type, dest, _start, _end) \
current_layer &= ~0x04; \
if(dispcnt & 0x40) \
render_scanline_obj_##type##_1D(current_layer, _start, _end, dest); \
else \
render_scanline_obj_##type##_2D(current_layer, _start, _end, dest) \
// Render a target all the way with the background color as taken from the
// palette.
#define fill_line_bg(type, dest, _start, _end) \
fill_line_##type(0, dest, _start, _end) \
// Render all layers as they appear in the layer order.
#define render_layers(tile_alpha, obj_alpha, dest) \
{ \
current_layer = layer_order[0]; \
if(current_layer & 0x04) \
{ \
/* If the first one is OBJ render the background then render it. */ \
fill_line_bg(tile_alpha, dest, 0, 240); \
render_obj_layer(obj_alpha, dest, 0, 240); \
} \
else \
{ \
/* Otherwise render a base layer. */ \
layer_renderers[current_layer].tile_alpha##_render_base(current_layer, \
0, 240, dest); \
} \
\
/* Render the rest of the layers. */ \
for(layer_order_pos = 1; layer_order_pos < layer_count; layer_order_pos++) \
{ \
current_layer = layer_order[layer_order_pos]; \
if(current_layer & 0x04) \
{ \
render_obj_layer(obj_alpha, dest, 0, 240); \
} \
else \
{ \
layer_renderers[current_layer]. \
tile_alpha##_render_transparent(current_layer, 0, 240, dest); \
} \
} \
} \
#define render_condition_alpha \
(((io_registers[REG_BLDALPHA] & 0x1F1F) != 0x001F) && \
((io_registers[REG_BLDCNT] & 0x3F) != 0) && \
((io_registers[REG_BLDCNT] & 0x3F00) != 0)) \
#define render_condition_fade \
(((io_registers[REG_BLDY] & 0x1F) != 0) && \
((io_registers[REG_BLDCNT] & 0x3F) != 0)) \
#define render_layers_color_effect(renderer, layer_condition, \
alpha_condition, fade_condition, _start, _end) \
{ \
if(layer_condition) \
{ \
if(obj_alpha_count[io_registers[REG_VCOUNT]] > 0) \
{ \
/* Render based on special effects mode. */ \
u32 screen_buffer[240]; \
switch((bldcnt >> 6) & 0x03) \
{ \
/* Alpha blend */ \
case 0x01: \
{ \
if(alpha_condition) \
{ \
renderer(alpha, alpha_obj, screen_buffer); \
expand_blend(screen_buffer, scanline, _start, _end); \
return; \
} \
break; \
} \
\
/* Fade to white */ \
case 0x02: \
{ \
if(fade_condition) \
{ \
renderer(color32, partial_alpha, screen_buffer); \
expand_brighten_partial_alpha(screen_buffer, scanline, \
_start, _end); \
return; \
} \
break; \
} \
\
/* Fade to black */ \
case 0x03: \
{ \
if(fade_condition) \
{ \
renderer(color32, partial_alpha, screen_buffer); \
expand_darken_partial_alpha(screen_buffer, scanline, \
_start, _end); \
return; \
} \
break; \
} \
} \
\
renderer(color32, partial_alpha, screen_buffer); \
expand_blend(screen_buffer, scanline, _start, _end); \
} \
else \
{ \
/* Render based on special effects mode. */ \
switch((bldcnt >> 6) & 0x03) \
{ \
/* Alpha blend */ \
case 0x01: \
{ \
if(alpha_condition) \
{ \
u32 screen_buffer[240]; \
renderer(alpha, alpha_obj, screen_buffer); \
expand_blend(screen_buffer, scanline, _start, _end); \
return; \
} \
break; \
} \
\
/* Fade to white */ \
case 0x02: \
{ \
if(fade_condition) \
{ \
renderer(color16, color16, scanline); \
expand_brighten(scanline, scanline, _start, _end); \
return; \
} \
break; \
} \
\
/* Fade to black */ \
case 0x03: \
{ \
if(fade_condition) \
{ \
renderer(color16, color16, scanline); \
expand_darken(scanline, scanline, _start, _end); \
return; \
} \
break; \
} \
} \
\
renderer(normal, normal, scanline); \
} \
} \
else \
{ \
u32 pixel_top = palette_ram_converted[0]; \
switch((bldcnt >> 6) & 0x03) \
{ \
/* Fade to white */ \
case 0x02: \
{ \
if(color_combine_mask_a(5)) \
{ \
u32 blend = io_registers[REG_BLDY] & 0x1F; \
u32 upper; \
\
if(blend > 16) \
blend = 16; \
\
upper = ((0x07E0F81F * blend) >> 4) & 0x07E0F81F; \
blend = 16 - blend; \
\
expand_pixel_no_dest(brighten, pixel_top); \
} \
break; \
} \
\
/* Fade to black */ \
case 0x03: \
{ \
if(color_combine_mask_a(5)) \
{ \
s32 blend = 16 - (io_registers[REG_BLDY] & 0x1F); \
\
if(blend < 0) \
blend = 0; \
\
expand_pixel_no_dest(darken, pixel_top); \
} \
break; \
} \
} \
fill_line_color16(pixel_top, scanline, _start, _end); \
} \
} \
// Renders an entire scanline from 0 to 240, based on current color mode.
void render_scanline_tile(u16 *scanline, u32 dispcnt)
{
u32 current_layer;
u32 layer_order_pos;
u32 bldcnt = io_registers[REG_BLDCNT];
render_scanline_layer_functions_tile();
render_layers_color_effect(render_layers, layer_count,
render_condition_alpha, render_condition_fade, 0, 240);
}
void render_scanline_bitmap(u16 *scanline, u32 dispcnt)
{
u32 bldcnt = io_registers[REG_BLDCNT];
render_scanline_layer_functions_bitmap();
u32 current_layer;
u32 layer_order_pos;
fill_line_bg(normal, scanline, 0, 240);
for(layer_order_pos = 0; layer_order_pos < layer_count; layer_order_pos++)
{
current_layer = layer_order[layer_order_pos];
if(current_layer & 0x04)
{
render_obj_layer(normal, scanline, 0, 240);
}
else
{
layer_renderers->normal_render(0, 240, scanline);
}
}
}
// Render layers from start to end based on if they're allowed in the
// enable flags.
#define render_layers_conditional(tile_alpha, obj_alpha, dest) \
{ \
__label__ skip; \
current_layer = layer_order[layer_order_pos]; \
/* If OBJ aren't enabled skip to the first non-OBJ layer */ \
if(!(enable_flags & 0x10)) \
{ \
while((current_layer & 0x04) || !((1 << current_layer) & enable_flags)) \
{ \
layer_order_pos++; \
current_layer = layer_order[layer_order_pos]; \
\
/* Oops, ran out of layers, render the background. */ \
if(layer_order_pos == layer_count) \
{ \
fill_line_bg(tile_alpha, dest, start, end); \
goto skip; \
} \
} \
\
/* Render the first valid layer */ \
layer_renderers[current_layer].tile_alpha##_render_base(current_layer, \
start, end, dest); \
\
layer_order_pos++; \
\
/* Render the rest of the layers if active, skipping OBJ ones. */ \
for(; layer_order_pos < layer_count; layer_order_pos++) \
{ \
current_layer = layer_order[layer_order_pos]; \
if(!(current_layer & 0x04) && ((1 << current_layer) & enable_flags)) \
{ \
layer_renderers[current_layer]. \
tile_alpha##_render_transparent(current_layer, start, end, dest); \
} \
} \
} \
else \
{ \
/* Find the first active layer, skip all of the inactive ones */ \
while(!((current_layer & 0x04) || ((1 << current_layer) & enable_flags))) \
{ \
layer_order_pos++; \
current_layer = layer_order[layer_order_pos]; \
\
/* Oops, ran out of layers, render the background. */ \
if(layer_order_pos == layer_count) \
{ \
fill_line_bg(tile_alpha, dest, start, end); \
goto skip; \
} \
} \
\
if(current_layer & 0x04) \
{ \
/* If the first one is OBJ render the background then render it. */ \
fill_line_bg(tile_alpha, dest, start, end); \
render_obj_layer(obj_alpha, dest, start, end); \
} \
else \
{ \
/* Otherwise render a base layer. */ \
layer_renderers[current_layer]. \
tile_alpha##_render_base(current_layer, start, end, dest); \
} \
\
layer_order_pos++; \
\
/* Render the rest of the layers. */ \
for(; layer_order_pos < layer_count; layer_order_pos++) \
{ \
current_layer = layer_order[layer_order_pos]; \
if(current_layer & 0x04) \
{ \
render_obj_layer(obj_alpha, dest, start, end); \
} \
else \
{ \
if(enable_flags & (1 << current_layer)) \
{ \
layer_renderers[current_layer]. \
tile_alpha##_render_transparent(current_layer, start, end, dest); \
} \
} \
} \
} \
\
skip: \
; \
} \
// Render all of the BG and OBJ in a tiled scanline from start to end ONLY if
// enable_flag allows that layer/OBJ. Also conditionally render color effects.
void render_scanline_conditional_tile(u32 start, u32 end, u16 *scanline,
u32 enable_flags, u32 dispcnt, u32 bldcnt, tile_layer_render_struct
*layer_renderers)
{
u32 current_layer;
u32 layer_order_pos = 0;
render_layers_color_effect(render_layers_conditional,
(layer_count && (enable_flags & 0x1F)),
((enable_flags & 0x20) && render_condition_alpha),
((enable_flags & 0x20) && render_condition_fade), start, end);
}
// Render the BG and OBJ in a bitmap scanline from start to end ONLY if
// enable_flag allows that layer/OBJ. Also conditionally render color effects.
void render_scanline_conditional_bitmap(u32 start, u32 end, u16 *scanline,
u32 enable_flags, u32 dispcnt, u32 bldcnt, bitmap_layer_render_struct
*layer_renderers)
{
u32 current_layer;
u32 layer_order_pos;
fill_line_bg(normal, scanline, start, end);
for(layer_order_pos = 0; layer_order_pos < layer_count; layer_order_pos++)
{
current_layer = layer_order[layer_order_pos];
if(current_layer & 0x04)
{
if(enable_flags & 0x10)
{
render_obj_layer(normal, scanline, start, end);
}
}
else
{
if(enable_flags & 0x04)
layer_renderers->normal_render(start, end, scanline);
}
}
}
#define window_x_coords(window_number) \
window_##window_number##_x1 = \
io_registers[REG_WIN##window_number##H] >> 8; \
window_##window_number##_x2 = \
io_registers[REG_WIN##window_number##H] & 0xFF; \
window_##window_number##_enable = \
(winin >> (window_number * 8)) & 0x3F; \
\
if(window_##window_number##_x1 > 240) \
window_##window_number##_x1 = 240; \
\
if(window_##window_number##_x2 > 240) \
window_##window_number##_x2 = 240 \
#define window_coords(window_number) \
u32 window_##window_number##_x1, window_##window_number##_x2; \
u32 window_##window_number##_y1, window_##window_number##_y2; \
u32 window_##window_number##_enable; \
window_##window_number##_y1 = \
io_registers[REG_WIN##window_number##V] >> 8; \
window_##window_number##_y2 = \
io_registers[REG_WIN##window_number##V] & 0xFF; \
\
if(window_##window_number##_y1 > window_##window_number##_y2) \
{ \
if((((vcount <= window_##window_number##_y2) || \
(vcount > window_##window_number##_y1)) || \
(window_##window_number##_y2 > 227)) && \
(window_##window_number##_y1 <= 227)) \
{ \
window_x_coords(window_number); \
} \
else \
{ \
window_##window_number##_x1 = 240; \
window_##window_number##_x2 = 240; \
} \
} \
else \
{ \
if((((vcount >= window_##window_number##_y1) && \
(vcount < window_##window_number##_y2)) || \
(window_##window_number##_y2 > 227)) && \
(window_##window_number##_y1 <= 227)) \
{ \
window_x_coords(window_number); \
} \
else \
{ \
window_##window_number##_x1 = 240; \
window_##window_number##_x2 = 240; \
} \
} \
#define render_window_segment(type, start, end, window_type) \
if(start != end) \
{ \
render_scanline_conditional_##type(start, end, scanline, \
window_##window_type##_enable, dispcnt, bldcnt, layer_renderers); \
} \
#define render_window_segment_unequal(type, start, end, window_type) \
render_scanline_conditional_##type(start, end, scanline, \
window_##window_type##_enable, dispcnt, bldcnt, layer_renderers) \
#define render_window_segment_clip(type, clip_start, clip_end, start, end, \
window_type) \
{ \
if(start != end) \
{ \
if(start < clip_start) \
{ \
if(end > clip_start) \
{ \
if(end > clip_end) \
{ \
render_window_segment_unequal(type, clip_start, clip_end, \
window_type); \
} \
else \
{ \
render_window_segment_unequal(type, clip_start, end, window_type); \
} \
} \
} \
else \
\
if(end > clip_end) \
{ \
if(start < clip_end) \
render_window_segment_unequal(type, start, clip_end, window_type); \
} \
else \
{ \
render_window_segment_unequal(type, start, end, window_type); \
} \
} \
} \
#define render_window_clip_1(type, start, end) \
if(window_1_x1 != 240) \
{ \
if(window_1_x1 > window_1_x2) \
{ \
render_window_segment_clip(type, start, end, 0, window_1_x2, 1); \
render_window_segment_clip(type, start, end, window_1_x2, window_1_x1, \
out); \
render_window_segment_clip(type, start, end, window_1_x1, 240, 1); \
} \
else \
{ \
render_window_segment_clip(type, start, end, 0, window_1_x1, out); \
render_window_segment_clip(type, start, end, window_1_x1, window_1_x2, \
1); \
render_window_segment_clip(type, start, end, window_1_x2, 240, out); \
} \
} \
else \
{ \
render_window_segment(type, start, end, out); \
} \
#define render_window_clip_obj(type, start, end); \
render_window_segment(type, start, end, out); \
if(dispcnt & 0x40) \
render_scanline_obj_copy_##type##_1D(4, start, end, scanline); \
else \
render_scanline_obj_copy_##type##_2D(4, start, end, scanline) \
#define render_window_segment_clip_obj(type, clip_start, clip_end, start, \
end) \
{ \
if(start != end) \
{ \
if(start < clip_start) \
{ \
if(end > clip_start) \
{ \
if(end > clip_end) \
{ \
render_window_clip_obj(type, clip_start, clip_end); \
} \
else \
{ \
render_window_clip_obj(type, clip_start, end); \
} \
} \
} \
else \
\
if(end > clip_end) \
{ \
if(start < clip_end) \
{ \
render_window_clip_obj(type, start, clip_end); \
} \
} \
else \
{ \
render_window_clip_obj(type, start, end); \
} \
} \
} \
#define render_window_clip_1_obj(type, start, end) \
if(window_1_x1 != 240) \
{ \
if(window_1_x1 > window_1_x2) \
{ \
render_window_segment_clip(type, start, end, 0, window_1_x2, 1); \
render_window_segment_clip_obj(type, start, end, window_1_x2, \
window_1_x1); \
render_window_segment_clip(type, start, end, window_1_x1, 240, 1); \
} \
else \
{ \
render_window_segment_clip_obj(type, start, end, 0, window_1_x1); \
render_window_segment_clip(type, start, end, window_1_x1, window_1_x2, \
1); \
render_window_segment_clip_obj(type, start, end, window_1_x2, 240); \
} \
} \
else \
{ \
render_window_clip_obj(type, start, end); \
} \
#define render_window_single(type, window_number) \
u32 winin = io_registers[REG_WININ]; \
window_coords(window_number); \
if(window_##window_number##_x1 > window_##window_number##_x2) \
{ \
render_window_segment(type, 0, window_##window_number##_x2, \
window_number); \
render_window_segment(type, window_##window_number##_x2, \
window_##window_number##_x1, out); \
render_window_segment(type, window_##window_number##_x1, 240, \
window_number); \
} \
else \
{ \
render_window_segment(type, 0, window_##window_number##_x1, out); \
render_window_segment(type, window_##window_number##_x1, \
window_##window_number##_x2, window_number); \
render_window_segment(type, window_##window_number##_x2, 240, out); \
} \
#define render_window_multi(type, front, back) \
if(window_##front##_x1 > window_##front##_x2) \
{ \
render_window_segment(type, 0, window_##front##_x2, front); \
render_window_clip_##back(type, window_##front##_x2, \
window_##front##_x1); \
render_window_segment(type, window_##front##_x1, 240, front); \
} \
else \
{ \
render_window_clip_##back(type, 0, window_##front##_x1); \
render_window_segment(type, window_##front##_x1, window_##front##_x2, \
front); \
render_window_clip_##back(type, window_##front##_x2, 240); \
} \
#define render_scanline_window_builder(type) \
void render_scanline_window_##type(u16 *scanline, u32 dispcnt) \
{ \
u32 vcount = io_registers[REG_VCOUNT]; \
u32 winout = io_registers[REG_WINOUT]; \
u32 bldcnt = io_registers[REG_BLDCNT]; \
u32 window_out_enable = winout & 0x3F; \
\
render_scanline_layer_functions_##type(); \
\
switch(dispcnt >> 13) \
{ \
/* Just window 0 */ \
case 0x01: \
{ \
render_window_single(type, 0); \
break; \
} \
\
/* Just window 1 */ \
case 0x02: \
{ \
render_window_single(type, 1); \
break; \
} \
\
/* Windows 1 and 2 */ \
case 0x03: \
{ \
u32 winin = io_registers[REG_WININ]; \
window_coords(0); \
window_coords(1); \
render_window_multi(type, 0, 1); \
break; \
} \
\
/* Just OBJ windows */ \
case 0x04: \
{ \
u32 window_obj_enable = winout >> 8; \
render_window_clip_obj(type, 0, 240); \
break; \
} \
\
/* Window 0 and OBJ window */ \
case 0x05: \
{ \
u32 window_obj_enable = winout >> 8; \
u32 winin = io_registers[REG_WININ]; \
window_coords(0); \
render_window_multi(type, 0, obj); \
break; \
} \
\
/* Window 1 and OBJ window */ \
case 0x06: \
{ \
u32 window_obj_enable = winout >> 8; \
u32 winin = io_registers[REG_WININ]; \
window_coords(1); \
render_window_multi(type, 1, obj); \
break; \
} \
\
/* Window 0, 1, and OBJ window */ \
case 0x07: \
{ \
u32 window_obj_enable = winout >> 8; \
u32 winin = io_registers[REG_WININ]; \
window_coords(0); \
window_coords(1); \
render_window_multi(type, 0, 1_obj); \
break; \
} \
} \
} \
render_scanline_window_builder(tile);
render_scanline_window_builder(bitmap);
u32 active_layers[6] = { 0x1F, 0x17, 0x1C, 0x14, 0x14, 0x14 };
u32 small_resolution_width = 240;
u32 small_resolution_height = 160;
u32 resolution_width, resolution_height;
void update_scanline()
{
u32 pitch = get_screen_pitch();
u32 dispcnt = io_registers[REG_DISPCNT];
u32 display_flags = (dispcnt >> 8) & 0x1F;
u32 vcount = io_registers[REG_VCOUNT];
u16 *screen_offset = get_screen_pixels() + (vcount * pitch);
u32 video_mode = dispcnt & 0x07;
u32 current_layer;
// If OAM has been modified since the last scanline has been updated then
// reorder and reprofile the OBJ lists.
if(oam_update)
{
order_obj(video_mode);
oam_update = 0;
}
order_layers((dispcnt >> 8) & active_layers[video_mode]);
if(skip_next_frame)
return;
// If the screen is in in forced blank draw pure white.
if(dispcnt & 0x80)
{
fill_line_color16(0xFFFF, screen_offset, 0, 240);
}
else
{
if(video_mode < 3)
{
if(dispcnt >> 13)
{
render_scanline_window_tile(screen_offset, dispcnt);
}
else
{
render_scanline_tile(screen_offset, dispcnt);
}
}
else
{
if(dispcnt >> 13)
render_scanline_window_bitmap(screen_offset, dispcnt);
else
render_scanline_bitmap(screen_offset, dispcnt);
}
}
affine_reference_x[0] += (s16)io_registers[REG_BG2PB];
affine_reference_y[0] += (s16)io_registers[REG_BG2PD];
affine_reference_x[1] += (s16)io_registers[REG_BG3PB];
affine_reference_y[1] += (s16)io_registers[REG_BG3PD];
}
#ifdef PSP_BUILD
u32 screen_flip = 0;
void flip_screen()
{
if(video_direct == 0)
{
u32 *old_ge_cmd_ptr = ge_cmd_ptr;
sceKernelDcacheWritebackAll();
// Render the current screen
ge_cmd_ptr = ge_cmd + 2;
GE_CMD(TBP0, ((u32)screen_pixels & 0x00FFFFFF));
GE_CMD(TBW0, (((u32)screen_pixels & 0xFF000000) >> 8) |
GBA_SCREEN_WIDTH);
ge_cmd_ptr = old_ge_cmd_ptr;
sceGeListEnQueue(ge_cmd, ge_cmd_ptr, gecbid, NULL);
// Flip to the next screen
screen_flip ^= 1;
if(screen_flip)
screen_pixels = screen_texture + (240 * 160 * 2);
else
screen_pixels = screen_texture;
}
}
#else
#define integer_scale_copy_2() \
current_scanline_ptr[x2] = current_pixel; \
current_scanline_ptr[x2 - 1] = current_pixel; \
x2 -= 2 \
#define integer_scale_copy_3() \
current_scanline_ptr[x2] = current_pixel; \
current_scanline_ptr[x2 - 1] = current_pixel; \
current_scanline_ptr[x2 - 2] = current_pixel; \
x2 -= 3 \
#define integer_scale_copy_4() \
current_scanline_ptr[x2] = current_pixel; \
current_scanline_ptr[x2 - 1] = current_pixel; \
current_scanline_ptr[x2 - 2] = current_pixel; \
current_scanline_ptr[x2 - 3] = current_pixel; \
x2 -= 4 \
#define integer_scale_horizontal(scale_factor) \
for(y = 0; y < 160; y++) \
{ \
for(x = 239, x2 = (240 * video_scale) - 1; x >= 0; x--) \
{ \
current_pixel = current_scanline_ptr[x]; \
integer_scale_copy_##scale_factor(); \
current_scanline_ptr[x2] = current_scanline_ptr[x]; \
current_scanline_ptr[x2 - 1] = current_scanline_ptr[x]; \
current_scanline_ptr[x2 - 2] = current_scanline_ptr[x]; \
} \
current_scanline_ptr += pitch; \
} \
void flip_screen()
{
if((video_scale != 1) && (current_scale != unscaled))
{
s32 x, y;
s32 x2, y2;
u16 *screen_ptr = get_screen_pixels();
u16 *current_scanline_ptr = screen_ptr;
u32 pitch = get_screen_pitch();
u16 current_pixel;
u32 i;
switch(video_scale)
{
case 2:
integer_scale_horizontal(2);
break;
case 3:
integer_scale_horizontal(3);
break;
default:
case 4:
integer_scale_horizontal(4);
break;
}
for(y = 159, y2 = (160 * video_scale) - 1; y >= 0; y--)
{
for(i = 0; i < video_scale; i++)
{
memcpy(screen_ptr + (y2 * pitch),
screen_ptr + (y * pitch), 480 * video_scale);
y2--;
}
}
}
SDL_Flip(screen);
}
#endif
u32 frame_to_render;
void update_screen()
{
if(!skip_next_frame)
flip_screen();
}
#ifdef PSP_BUILD
void init_video()
{
sceDisplaySetMode(0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
sceDisplayWaitVblankStart();
sceDisplaySetFrameBuf((void*)psp_gu_vram_base, PSP_LINE_SIZE,
PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
sceGuInit();
sceGuStart(GU_DIRECT, display_list);
sceGuDrawBuffer(GU_PSM_5650, (void*)0, PSP_LINE_SIZE);
sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT,
(void*)0, PSP_LINE_SIZE);
sceGuClear(GU_COLOR_BUFFER_BIT);
sceGuOffset(2048 - (PSP_SCREEN_WIDTH / 2), 2048 - (PSP_SCREEN_HEIGHT / 2));
sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
sceGuScissor(0, 0, PSP_SCREEN_WIDTH + 1, PSP_SCREEN_HEIGHT + 1);
sceGuEnable(GU_SCISSOR_TEST);
sceGuTexMode(GU_PSM_5650, 0, 0, GU_FALSE);
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
sceGuTexFilter(GU_LINEAR, GU_LINEAR);
sceGuEnable(GU_TEXTURE_2D);
sceGuFrontFace(GU_CW);
sceGuDisable(GU_BLEND);
sceGuFinish();
sceGuSync(0, 0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
PspGeCallbackData gecb;
gecb.signal_func = NULL;
gecb.signal_arg = NULL;
gecb.finish_func = Ge_Finish_Callback;
gecb.finish_arg = NULL;
gecbid = sceGeSetCallback(&gecb);
screen_vertex[0] = 0 + 0.5;
screen_vertex[1] = 0 + 0.5;
screen_vertex[2] = 0 + 0.5;
screen_vertex[3] = 0 + 0.5;
screen_vertex[4] = 0;
screen_vertex[5] = GBA_SCREEN_WIDTH - 0.5;
screen_vertex[6] = GBA_SCREEN_HEIGHT - 0.5;
screen_vertex[7] = PSP_SCREEN_WIDTH - 0.5;
screen_vertex[8] = PSP_SCREEN_HEIGHT - 0.5;
screen_vertex[9] = 0;
// Set framebuffer to PSP VRAM
GE_CMD(FBP, ((u32)psp_gu_vram_base & 0x00FFFFFF));
GE_CMD(FBW, (((u32)psp_gu_vram_base & 0xFF000000) >> 8) | PSP_LINE_SIZE);
// Set texture 0 to the screen texture
GE_CMD(TBP0, ((u32)screen_texture & 0x00FFFFFF));
GE_CMD(TBW0, (((u32)screen_texture & 0xFF000000) >> 8) | GBA_SCREEN_WIDTH);
// Set the texture size to 256 by 256 (2^8 by 2^8)
GE_CMD(TSIZE0, (8 << 8) | 8);
// Flush the texture cache
GE_CMD(TFLUSH, 0);
// Use 2D coordinates, no indeces, no weights, 32bit float positions,
// 32bit float texture coordinates
GE_CMD(VTYPE, (1 << 23) | (0 << 11) | (0 << 9) |
(3 << 7) | (0 << 5) | (0 << 2) | 3);
// Set the base of the index list pointer to 0
GE_CMD(BASE, 0);
// Set the rest of index list pointer to 0 (not being used)
GE_CMD(IADDR, 0);
// Set the base of the screen vertex list pointer
GE_CMD(BASE, ((u32)screen_vertex & 0xFF000000) >> 8);
// Set the rest of the screen vertex list pointer
GE_CMD(VADDR, ((u32)screen_vertex & 0x00FFFFFF));
// Primitive kick: render sprite (primitive 6), 2 vertices
GE_CMD(PRIM, (6 << 16) | 2);
// Done with commands
GE_CMD(FINISH, 0);
// Raise signal interrupt
GE_CMD(SIGNAL, 0);
GE_CMD(NOP, 0);
GE_CMD(NOP, 0);
}
#else
void init_video()
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE);
screen = SDL_SetVideoMode(240 * video_scale, 160 * video_scale, 16, 0);
SDL_ShowCursor(0);
}
#endif
video_scale_type screen_scale = scaled_aspect;
video_scale_type current_scale = scaled_aspect;
video_filter_type screen_filter = filter_bilinear;
#ifdef PSP_BUILD
void video_resolution_large()
{
if(video_direct != 1)
{
video_direct = 1;
screen_pixels = psp_gu_vram_base;
screen_pitch = 512;
sceGuStart(GU_DIRECT, display_list);
sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT,
(void*)0, PSP_LINE_SIZE);
sceGuFinish();
}
}
void set_gba_resolution(video_scale_type scale)
{
u32 filter_linear = 0;
screen_scale = scale;
switch(scale)
{
case unscaled:
screen_vertex[2] = 120 + 0.5;
screen_vertex[3] = 56 + 0.5;
screen_vertex[7] = GBA_SCREEN_WIDTH + 120 - 0.5;
screen_vertex[8] = GBA_SCREEN_HEIGHT + 56 - 0.5;
break;
case scaled_aspect:
screen_vertex[2] = 36 + 0.5;
screen_vertex[3] = 0 + 0.5;
screen_vertex[7] = 408 + 36 - 0.5;
screen_vertex[8] = PSP_SCREEN_HEIGHT - 0.5;
break;
case fullscreen:
screen_vertex[2] = 0;
screen_vertex[3] = 0;
screen_vertex[7] = PSP_SCREEN_WIDTH;
screen_vertex[8] = PSP_SCREEN_HEIGHT;
break;
}
sceGuStart(GU_DIRECT, display_list);
if(screen_filter == filter_bilinear)
sceGuTexFilter(GU_LINEAR, GU_LINEAR);
else
sceGuTexFilter(GU_NEAREST, GU_NEAREST);
sceGuFinish();
sceGuSync(0, 0);
clear_screen(0x0000);
}
void video_resolution_small()
{
if(video_direct != 0)
{
set_gba_resolution(screen_scale);
video_direct = 0;
screen_pixels = screen_texture;
screen_flip = 0;
screen_pitch = 240;
sceGuStart(GU_DIRECT, display_list);
sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT,
(void*)0, PSP_LINE_SIZE);
sceGuFinish();
}
}
void clear_screen(u16 color)
{
u32 i;
u16 *src_ptr = get_screen_pixels();
sceGuSync(0, 0);
for(i = 0; i < (512 * 272); i++, src_ptr++)
{
*src_ptr = color;
}
// I don't know why this doesn't work.
/* color = (((color & 0x1F) * 255 / 31) << 0) |
((((color >> 5) & 0x3F) * 255 / 63) << 8) |
((((color >> 11) & 0x1F) * 255 / 31) << 16) | (0xFF << 24);
sceGuStart(GU_DIRECT, display_list);
sceGuDrawBuffer(GU_PSM_5650, (void*)0, PSP_LINE_SIZE);
//sceGuDispBuffer(PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT,
// (void*)0, PSP_LINE_SIZE);
sceGuClearColor(color);
sceGuClear(GU_COLOR_BUFFER_BIT);
sceGuFinish();
sceGuSync(0, 0); */
}
#else
void video_resolution_large()
{
if(current_scale != unscaled)
{
current_scale = unscaled;
screen = SDL_SetVideoMode(480, 272, 16, 0);
resolution_width = 480;
resolution_height = 272;
}
}
void video_resolution_small()
{
if(current_scale != screen_scale)
{
current_scale = screen_scale;
screen = SDL_SetVideoMode(small_resolution_width * video_scale,
small_resolution_height * video_scale, 16, 0);
resolution_width = small_resolution_width;
resolution_height = small_resolution_height;
}
}
void set_gba_resolution(video_scale_type scale)
{
if(screen_scale != scale)
{
screen_scale = scale;
switch(scale)
{
case unscaled:
case scaled_aspect:
case fullscreen:
small_resolution_width = 240 * video_scale;
small_resolution_height = 160 * video_scale;
break;
}
}
}
void clear_screen(u16 color)
{
u16 *dest_ptr = get_screen_pixels();
u32 line_skip = get_screen_pitch() - screen->w;
u32 x, y;
for(y = 0; y < screen->h; y++)
{
for(x = 0; x < screen->w; x++, dest_ptr++)
{
*dest_ptr = color;
}
dest_ptr += line_skip;
}
}
#endif
u16 *copy_screen()
{
u16 *copy = malloc(240 * 160 * 2);
memcpy(copy, get_screen_pixels(), 240 * 160 * 2);
return copy;
}
void blit_to_screen(u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y)
{
u32 pitch = get_screen_pitch();
u16 *dest_ptr = get_screen_pixels() + dest_x + (dest_y * pitch);
u16 *src_ptr = src;
u32 line_skip = pitch - w;
u32 x, y;
for(y = 0; y < h; y++)
{
for(x = 0; x < w; x++, src_ptr++, dest_ptr++)
{
*dest_ptr = *src_ptr;
}
dest_ptr += line_skip;
}
}
void print_string_ext(const char *str, u16 fg_color, u16 bg_color,
u32 x, u32 y, void *_dest_ptr, u32 pitch, u32 pad)
{
u16 *dest_ptr = (u16 *)_dest_ptr + (y * pitch) + x;
u8 current_char = str[0];
u32 current_row;
u32 glyph_offset;
u32 i = 0, i2, i3;
u32 str_index = 1;
u32 current_x = x;
while(current_char)
{
if(current_char == '\n')
{
y += FONT_HEIGHT;
current_x = x;
dest_ptr = get_screen_pixels() + (y * pitch) + x;
}
else
{
glyph_offset = _font_offset[current_char];
current_x += FONT_WIDTH;
for(i2 = 0; i2 < FONT_HEIGHT; i2++, glyph_offset++)
{
current_row = _font_bits[glyph_offset];
for(i3 = 0; i3 < FONT_WIDTH; i3++)
{
if((current_row >> (15 - i3)) & 0x01)
*dest_ptr = fg_color;
else
*dest_ptr = bg_color;
dest_ptr++;
}
dest_ptr += (pitch - FONT_WIDTH);
}
dest_ptr = dest_ptr - (pitch * FONT_HEIGHT) + FONT_WIDTH;
}
i++;
current_char = str[str_index];
if((i < pad) && (current_char == 0))
{
current_char = ' ';
}
else
{
str_index++;
}
if(current_x >= 480)
break;
}
}
void print_string(const char *str, u16 fg_color, u16 bg_color,
u32 x, u32 y)
{
print_string_ext(str, fg_color, bg_color, x, y, get_screen_pixels(),
get_screen_pitch(), 0);
}
void print_string_pad(const char *str, u16 fg_color, u16 bg_color,
u32 x, u32 y, u32 pad)
{
print_string_ext(str, fg_color, bg_color, x, y, get_screen_pixels(),
get_screen_pitch(), pad);
}
#define video_savestate_builder(type) \
void video_##type##_savestate(file_tag_type savestate_file) \
{ \
file_##type##_array(savestate_file, affine_reference_x); \
file_##type##_array(savestate_file, affine_reference_y); \
} \
video_savestate_builder(read);
video_savestate_builder(write_mem);
| Java |
#ifndef __ASM_ARM_IRQ_H
#define __ASM_ARM_IRQ_H
#include <mach/irqs.h>
#ifndef irq_canonicalize
#define irq_canonicalize(i) (i)
#endif
#ifndef NR_IRQS
#define NR_IRQS 128
#endif
/*
* Use this value to indicate lack of interrupt
* capability
*/
#ifndef NO_IRQ
#define NO_IRQ ((unsigned int)(-1))
#endif
/*
* Migration helpers
*/
#define __IRQT_FALEDGE IRQ_TYPE_EDGE_FALLING
#define __IRQT_RISEDGE IRQ_TYPE_EDGE_RISING
#define __IRQT_LOWLVL IRQ_TYPE_LEVEL_LOW
#define __IRQT_HIGHLVL IRQ_TYPE_LEVEL_HIGH
#define IRQT_NOEDGE (0)
#define IRQT_RISING (__IRQT_RISEDGE)
#define IRQT_FALLING (__IRQT_FALEDGE)
#define IRQT_BOTHEDGE (__IRQT_RISEDGE|__IRQT_FALEDGE)
#define IRQT_LOW (__IRQT_LOWLVL)
#define IRQT_HIGH (__IRQT_HIGHLVL)
#define IRQT_PROBE IRQ_TYPE_PROBE
#ifndef __ASSEMBLY__
struct irqaction;
extern void migrate_irqs(void);
extern void asm_do_IRQ(unsigned int, struct pt_regs *);
void init_IRQ(void);
#endif
#endif
| Java |
package com.lj.learning.dao;
// THIS CODE IS GENERATED BY greenDAO, EDIT ONLY INSIDE THE "KEEP"-SECTIONS
// KEEP INCLUDES - put your custom includes here
// KEEP INCLUDES END
/**
* Entity mapped to table "SHEET".
*/
public class Sheet implements java.io.Serializable {
private Long id;
/** Not-null value. */
/**
* 表格页签名称
*/
private String sheetname;
/** Not-null value. */
/**
* 数据库表名称
*/
private String databasename;
// KEEP FIELDS - put your custom fields here
// KEEP FIELDS END
public Sheet() {
}
public Sheet(Long id) {
this.id = id;
}
public Sheet(Long id, String sheetname, String databasename) {
this.id = id;
this.sheetname = sheetname;
this.databasename = databasename;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/** Not-null value. */
public String getSheetname() {
return sheetname;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setSheetname(String sheetname) {
this.sheetname = sheetname;
}
/** Not-null value. */
public String getDatabasename() {
return databasename;
}
/** Not-null value; ensure this value is available before it is saved to the database. */
public void setDatabasename(String databasename) {
this.databasename = databasename;
}
// KEEP METHODS - put your custom methods here
// KEEP METHODS END
}
| Java |
Beans - Atom Snippet Plugin
====================
This package adds support for Beans related snippets in the Atom editor.
* [Issues](https://github.com/ThemeButler/beans-snippets-for-atom/issues)
## Current snippets available:
* [Add Attribute](#add-attribute)
* [Remove Attribute](#remove-attribute)
* [Replace Attribute](#replace-attribute)
* [Remove Markup](#remove-markup)
* [Remove Action](#remove-action)
* [Modify Action](#modify-action)
* [Set Layout](#set-layout)
* [Load Document](#load-document)
* [Enqueue UIkit Components](#enqueue-uikit)
* [Dequeue UIkit Components](#dequeue-uikit)
* [Show UIkit Components](#show-uikit)
* [Add Markup](#load-document)
* [Register Widget Area](#register-widgetarea)
* [Output Widget Area](#output-widgetarea)
* [Register & Output Widgetarea](#new-widgetarea)
* [Adjust Grid](#adjust-grid)
<h2 id="add-attribute">Add Attribute</h2>
Add an attribute on any element with a markup-id.
**Shortcut:** beans_add_attribute
**Output:**
<pre>beans_add_attribute( 'markup_id', 'attribute_type', 'attribute' );</pre>
#### Examples:
<pre>beans_add_attribute( 'beans_primary_nav', 'class', 'tm-nav' );</pre>
This example adds the _tm-nav_ class.
<pre>beans_remove_attribute( 'beans_header', 'data-uk-sticky' );</pre>
This example adds an empty _data_uk_sticky_ attribute, which is used by the UIkit Sticky component.
<h2 id="remove-attribute">Remove Attribute</h2>
Remove an attribute on any element with a markup-id. Can be used to remove a specific attribute value (like a class) or the attribute itself. See below for an example.
**Shortcut:** beans_remove_attribute
**Output:**
<pre>beans_remove_attribute( 'markup_id', 'attribute_type', 'attribute' );</pre>
#### Examples:
<pre>beans_remove_attribute( 'beans_primary_nav', 'class', 'uk-float-right' );</pre>
This example removes the _uk-float-right_ class, while leaving the rest of the classes intact.
<pre>beans_remove_attribute( 'beans_primary_nav', 'class' );</pre>
This example removes the entire class=" " attribute, along with any assigned classes.
**Original:**
<pre><nav class="tm-nav uk-float-right"></pre>
**Remove attribute value:**
<pre><nav class="tm-nav"></pre>
**Remove attribute:**
<pre><nav></pre>
<h2 id="replace-attribute">Replace Attribute</h2>
Replace an attribute on any element with a markup-id. Can be used to replace a specific attribute value (like a class) or the attribute itself. See below examples.
**Shortcut:** beans_replace_attribute
**Output:**
<pre>beans_replace_attribute( 'markup_id', 'attribute_type', 'old_attribute', 'new_attribute' );</pre>
#### Examples:
**Original:**
<pre><nav class="tm-nav uk-float-right"></pre>
**Replace attribute value:**
<pre>beans_replace_attribute( 'beans_primary_nav', 'class', 'uk-float-right', 'uk-float-left' );</pre>
<pre><nav class="uk-left"></pre>
<h2 id="add-attribute">Modify Action</h2>
Modify the placement of elements controlled by Beans.
**Shortcut:** _beans-modify-action_
<h2 id="set-layout">Set Layout</h2>
Set the content / sidebar layout dynamically for a specific layout. Generally used in your page templates.
**Shortcut:** _beans-set-layout_
<h2 id="load-document">Load Document</h2>
Loads the Beans document. This is needed in the page templates, usually at the bottom.
**Shortcut:** _beans-load-doc_
<h2 id="enqueue-uikit">Enqueue UIkit Components</h2>
Enqueue any of the Core or Add-on components available in UIkit.
**Shortcut:** _beans-enqueue-uikit_
<h2 id="dequeue-uikit">Dequeue UIkit Components</h2>
Dequeue any of the Core or Add-on components that are not needed. Use the _beans-show-uikit_ to see which components are being loaded.
**Shortcut:** _beans-dequeue-uikit_
<h2 id="show-uikit">Show Loaded UIkit Components</h2>
Outputs a list of all the UIkit components and styles that are being loaded.
**Shortcut:** _beans-show-uikit_
<h2 id="add-markup">Add Markup</h2>
Output custom markup using any of Beans dynamic placement hooks.
**Shortcut:** _beans-add-markup_
<h2 id="register-widgetarea">Register Widget Area</h2>
Register a custom widget-area in WordPress.
**Shortcut:** _beans-register-widgetarea_
<h2 id="output-widgetarea">Output Widget Area</h2>
Output a widget-area in your theme, using any of Beans dynamic placement hooks.
**Shortcut:** _beans-output-widgetarea_
<h2 id="new-widgetarea">Register & Output Widget Area</h2>
Register a new widget-area and output it using any of Beans dynamic placement hooks.
**Shortcut:** _beans-new-widgetarea_
<h2 id="adjust-grid">Adjust Grid</h2>
Modify Beans default layout grid (ie, the sidebars and content) width and placement.
**Shortcut:** _beans-new-widgetarea_
| Java |
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_
#define NET_HTTP_HTTP_AUTH_HANDLER_FACTORY_H_
#pragma once
#include <map>
#include <string>
#include <vector>
#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
#include "net/http/http_auth.h"
#include "net/http/url_security_manager.h"
class GURL;
namespace net {
class BoundNetLog;
class HostResolver;
class HttpAuthHandler;
class HttpAuthHandlerRegistryFactory;
class NET_EXPORT HttpAuthHandlerFactory {
public:
enum CreateReason {
CREATE_CHALLENGE,
CREATE_PREEMPTIVE,
};
HttpAuthHandlerFactory() : url_security_manager_(NULL) {}
virtual ~HttpAuthHandlerFactory() {}
void set_url_security_manager(URLSecurityManager* url_security_manager) {
url_security_manager_ = url_security_manager;
}
URLSecurityManager* url_security_manager() {
return url_security_manager_;
}
virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge,
HttpAuth::Target target,
const GURL& origin,
CreateReason create_reason,
int digest_nonce_count,
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler) = 0;
int CreateAuthHandlerFromString(const std::string& challenge,
HttpAuth::Target target,
const GURL& origin,
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler);
int CreatePreemptiveAuthHandlerFromString(
const std::string& challenge,
HttpAuth::Target target,
const GURL& origin,
int digest_nonce_count,
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler);
static HttpAuthHandlerRegistryFactory* CreateDefault(HostResolver* resolver);
private:
URLSecurityManager* url_security_manager_;
DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerFactory);
};
class NET_EXPORT HttpAuthHandlerRegistryFactory
: public HttpAuthHandlerFactory {
public:
HttpAuthHandlerRegistryFactory();
virtual ~HttpAuthHandlerRegistryFactory();
void SetURLSecurityManager(const std::string& scheme,
URLSecurityManager* url_security_manager);
void RegisterSchemeFactory(const std::string& scheme,
HttpAuthHandlerFactory* factory);
HttpAuthHandlerFactory* GetSchemeFactory(const std::string& scheme) const;
static HttpAuthHandlerRegistryFactory* Create(
const std::vector<std::string>& supported_schemes,
URLSecurityManager* security_manager,
HostResolver* host_resolver,
const std::string& gssapi_library_name,
bool negotiate_disable_cname_lookup,
bool negotiate_enable_port);
virtual int CreateAuthHandler(HttpAuth::ChallengeTokenizer* challenge,
HttpAuth::Target target,
const GURL& origin,
CreateReason reason,
int digest_nonce_count,
const BoundNetLog& net_log,
scoped_ptr<HttpAuthHandler>* handler);
private:
typedef std::map<std::string, HttpAuthHandlerFactory*> FactoryMap;
FactoryMap factory_map_;
DISALLOW_COPY_AND_ASSIGN(HttpAuthHandlerRegistryFactory);
};
}
#endif
| Java |
object-diff
===========
A tool for comparing java objects
| Java |
/* Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef MDP4_H
#define MDP4_H
extern struct mdp_dma_data dma2_data;
extern struct mdp_dma_data dma_s_data;
extern struct mdp_dma_data dma_e_data;
extern struct mdp_dma_data dma_wb_data;
extern unsigned int mdp_hist_frame_cnt;
extern struct completion mdp_hist_comp;
extern boolean mdp_is_in_isr;
extern uint32 mdp_intr_mask;
extern spinlock_t mdp_spin_lock;
extern struct mdp4_statistic mdp4_stat;
extern uint32 mdp4_extn_disp;
extern char *mmss_cc_base; /* mutimedia sub system clock control */
extern spinlock_t dsi_clk_lock;
extern u32 mdp_max_clk;
#if defined(CONFIG_MDP_RUNTIME_BANDWIDTH)
extern u64 mdp_max_bw;
#define MDP4_BW_AB_FACTOR (115) /* 1.15 */
#define MDP4_BW_IB_FACTOR (125) /* 1.25 */
#define MDP_BUS_SCALE_AB_STEP (0x4000000)
#endif
#define MDP4_OVERLAYPROC0_BASE 0x10000
#define MDP4_OVERLAYPROC1_BASE 0x18000
#define MDP4_OVERLAYPROC2_BASE 0x88000
#define MDP4_VIDEO_BASE 0x20000
#define MDP4_VIDEO_OFF 0x10000
#define MDP4_VIDEO_CSC_OFF 0x4000
#define MDP4_RGB_BASE 0x40000
#define MDP4_RGB_OFF 0x10000
/* chip select controller */
#define CS_CONTROLLER_0 0x0707ffff
#define CS_CONTROLLER_1 0x03073f3f
#if defined (CONFIG_ARCH_MSM8930)
#define CSC_RESTORE
#define CMAP_RESTORE
#endif
#ifdef CMAP_RESTORE
extern unsigned char cmap_lut_changed;
#endif
#ifdef CSC_RESTORE
extern bool csc_dmap_changed;
extern struct mdp_csc_cfg_data csc_cfg_backup_matrix;
#endif
#if defined(CONFIG_MDP_RUNTIME_BANDWIDTH)
#else
enum {
OVERLAY_PERF_LEVEL1 = 1,
OVERLAY_PERF_LEVEL2,
OVERLAY_PERF_LEVEL3,
OVERLAY_PERF_LEVEL4
};
#endif
typedef int (*cmd_fxn_t)(struct platform_device *pdev);
enum { /* display */
PRIMARY_INTF_SEL,
SECONDARY_INTF_SEL,
EXTERNAL_INTF_SEL
};
enum {
LCDC_RGB_INTF, /* 0 */
DTV_INTF = LCDC_RGB_INTF, /* 0 */
MDDI_LCDC_INTF, /* 1 */
MDDI_INTF, /* 2 */
EBI2_INTF, /* 3 */
TV_INTF = EBI2_INTF, /* 3 */
DSI_VIDEO_INTF,
DSI_CMD_INTF
};
enum {
MDDI_PRIMARY_SET,
MDDI_SECONDARY_SET,
MDDI_EXTERNAL_SET
};
enum {
EBI2_LCD0,
EBI2_LCD1
};
#define MDP4_3D_NONE 0
#define MDP4_3D_SIDE_BY_SIDE 1
#define MDP4_3D_TOP_DOWN 2
#define MDP4_PANEL_MDDI BIT(0)
#define MDP4_PANEL_LCDC BIT(1)
#define MDP4_PANEL_DTV BIT(2)
#define MDP4_PANEL_ATV BIT(3)
#define MDP4_PANEL_DSI_VIDEO BIT(4)
#define MDP4_PANEL_DSI_CMD BIT(5)
#define MDP4_PANEL_WRITEBACK BIT(6)
enum {
OVERLAY_MODE_NONE,
OVERLAY_MODE_BLT
};
enum {
OVERLAY_REFRESH_ON_DEMAND,
OVERLAY_REFRESH_VSYNC,
OVERLAY_REFRESH_VSYNC_HALF,
OVERLAY_REFRESH_VSYNC_QUARTER
};
enum {
OVERLAY_FRAMEBUF,
OVERLAY_DIRECTOUT
};
/* system interrupts */
/*note histogram interrupts defined in mdp.h*/
#define INTR_OVERLAY0_DONE BIT(0)
#define INTR_OVERLAY1_DONE BIT(1)
#define INTR_DMA_S_DONE BIT(2)
#define INTR_DMA_E_DONE BIT(3)
#define INTR_DMA_P_DONE BIT(4)
#define INTR_PRIMARY_VSYNC BIT(7)
#define INTR_PRIMARY_INTF_UDERRUN BIT(8)
#define INTR_EXTERNAL_VSYNC BIT(9)
#define INTR_EXTERNAL_INTF_UDERRUN BIT(10)
#define INTR_PRIMARY_RDPTR BIT(11) /* read pointer */
#define INTR_OVERLAY2_DONE BIT(30)
#ifdef CONFIG_FB_MSM_OVERLAY
#define MDP4_ANY_INTR_MASK (0)
#else
#define MDP4_ANY_INTR_MASK (INTR_DMA_P_DONE)
#endif
enum {
OVERLAY_PIPE_VG1, /* video/graphic */
OVERLAY_PIPE_VG2,
OVERLAY_PIPE_RGB1,
OVERLAY_PIPE_RGB2,
OVERLAY_PIPE_RGB3,
OVERLAY_PIPE_VG3,
OVERLAY_PIPE_VG4,
OVERLAY_PIPE_MAX
};
enum {
OVERLAY_TYPE_RGB,
OVERLAY_TYPE_VIDEO,
OVERLAY_TYPE_BF
};
enum {
MDP4_MIXER0,
MDP4_MIXER1,
MDP4_MIXER2,
MDP4_MIXER_MAX
};
enum {
OVERLAY_PLANE_INTERLEAVED,
OVERLAY_PLANE_PLANAR,
OVERLAY_PLANE_PSEUDO_PLANAR
};
enum {
MDP4_MIXER_STAGE_UNUNSED, /* pipe not used */
MDP4_MIXER_STAGE_BASE,
MDP4_MIXER_STAGE0, /* zorder 0 */
MDP4_MIXER_STAGE1, /* zorder 1 */
MDP4_MIXER_STAGE2, /* zorder 2 */
MDP4_MIXER_STAGE3, /* zorder 3 */
MDP4_MIXER_STAGE_MAX
};
enum {
MDP4_FRAME_FORMAT_LINEAR,
MDP4_FRAME_FORMAT_ARGB_TILE,
MDP4_FRAME_FORMAT_VIDEO_SUPERTILE
};
enum {
MDP4_CHROMA_RGB,
MDP4_CHROMA_H2V1,
MDP4_CHROMA_H1V2,
MDP4_CHROMA_420
};
#define CSC_MAX_BLOCKS 6
#define MDP4_BLEND_BG_TRANSP_EN BIT(9)
#define MDP4_BLEND_FG_TRANSP_EN BIT(8)
#define MDP4_BLEND_BG_MOD_ALPHA BIT(7)
#define MDP4_BLEND_BG_INV_ALPHA BIT(6)
#define MDP4_BLEND_BG_ALPHA_FG_CONST (0 << 4)
#define MDP4_BLEND_BG_ALPHA_BG_CONST (1 << 4)
#define MDP4_BLEND_BG_ALPHA_FG_PIXEL (2 << 4)
#define MDP4_BLEND_BG_ALPHA_BG_PIXEL (3 << 4)
#define MDP4_BLEND_FG_MOD_ALPHA BIT(3)
#define MDP4_BLEND_FG_INV_ALPHA BIT(2)
#define MDP4_BLEND_FG_ALPHA_FG_CONST (0 << 0)
#define MDP4_BLEND_FG_ALPHA_BG_CONST (1 << 0)
#define MDP4_BLEND_FG_ALPHA_FG_PIXEL (2 << 0)
#define MDP4_BLEND_FG_ALPHA_BG_PIXEL (3 << 0)
#define MDP4_FORMAT_SOLID_FILL BIT(22)
#define MDP4_FORMAT_UNPACK_ALIGN_MSB BIT(18)
#define MDP4_FORMAT_UNPACK_TIGHT BIT(17)
#define MDP4_FORMAT_90_ROTATED BIT(12)
#define MDP4_FORMAT_ALPHA_ENABLE BIT(8)
#define MDP4_OP_DEINT_ODD_REF BIT(19)
#define MDP4_OP_DEINT_EN BIT(18)
#define MDP4_OP_IGC_LUT_EN BIT(16)
#define MDP4_OP_DITHER_EN BIT(15)
#define MDP4_OP_FLIP_UD BIT(14)
#define MDP4_OP_FLIP_LR BIT(13)
#define MDP4_OP_CSC_EN BIT(11)
#define MDP4_OP_DST_DATA_YCBCR BIT(10)
#define MDP4_OP_SRC_DATA_YCBCR BIT(9)
#define MDP4_OP_SCALEY_FIR (0 << 4)
#define MDP4_OP_SCALEY_MN_PHASE (1 << 4)
#define MDP4_OP_SCALEY_PIXEL_RPT (2 << 4)
#define MDP4_OP_SCALEX_FIR (0 << 2)
#define MDP4_OP_SCALEX_MN_PHASE (1 << 2)
#define MDP4_OP_SCALEX_PIXEL_RPT (2 << 2)
#define MDP4_OP_SCALE_RGB_ENHANCED (1 << 4)
#define MDP4_OP_SCALE_RGB_PIXEL_RPT (0 << 3)
#define MDP4_OP_SCALE_RGB_BILINEAR (1 << 3)
#define MDP4_OP_SCALE_ALPHA_PIXEL_RPT (0 << 2)
#define MDP4_OP_SCALE_ALPHA_BILINEAR (1 << 2)
#define MDP4_OP_SCALEY_EN BIT(1)
#define MDP4_OP_SCALEX_EN BIT(0)
#define MDP4_REV40_UP_SCALING_MAX (8)
#define MDP4_REV41_OR_LATER_UP_SCALING_MAX (20)
#define MDP4_PIPE_PER_MIXER 2
#define MDP4_MAX_PLANE 4
#define VSYNC_PERIOD 16
#if defined(CONFIG_MDP_RUNTIME_BANDWIDTH)
#ifdef BLT_RGB565
#define BLT_BPP 2
#else
#define BLT_BPP 3
#endif
#endif
struct mdp4_hsic_regs {
int32_t params[NUM_HSIC_PARAM];
int32_t conv_matrix[3][3];
int32_t pre_limit[6];
int32_t post_limit[6];
int32_t pre_bias[3];
int32_t post_bias[3];
int32_t dirty;
};
struct mdp4_iommu_pipe_info {
struct ion_handle *ihdl[MDP4_MAX_PLANE];
struct ion_handle *prev_ihdl[MDP4_MAX_PLANE];
u8 mark_unmap;
};
#define IOMMU_FREE_LIST_MAX 32
struct iommu_free_list {
int total;
int fndx;
struct ion_handle *ihdl[IOMMU_FREE_LIST_MAX];
};
struct blend_cfg {
u32 op;
u32 bg_alpha;
u32 fg_alpha;
u32 co3_sel;
u32 transp_low0;
u32 transp_low1;
u32 transp_high0;
u32 transp_high1;
int solidfill;
struct mdp4_overlay_pipe *solidfill_pipe;
};
struct mdp4_overlay_pipe {
uint32 pipe_used;
uint32 pipe_type; /* rgb, video/graphic */
uint32 pipe_num;
uint32 pipe_ndx;
uint32 pipe_share;
uint32 mixer_num; /* which mixer used */
uint32 mixer_stage; /* which stage of mixer used */
uint32 src_format;
uint32 src_width; /* source img width */
uint32 src_height; /* source img height */
uint32 is_3d;
uint32 src_width_3d; /* source img width */
uint32 src_height_3d; /* source img height */
uint32 src_w; /* roi */
uint32 src_h; /* roi */
uint32 src_x; /* roi */
uint32 src_y; /* roi */
uint32 dst_w; /* roi */
uint32 dst_h; /* roi */
uint32 dst_x; /* roi */
uint32 dst_y; /* roi */
uint32 flags;
uint32 op_mode;
uint32 transp;
uint32 blend_op;
uint32 phasex_step;
uint32 phasey_step;
uint32 alpha;
uint32 is_fg; /* control alpha & color key */
uint32 srcp0_addr; /* interleave, luma */
uint32 srcp0_ystride;
struct file *srcp0_file;
int put0_need;
uint32 srcp1_addr; /* pseudoplanar, chroma plane */
uint32 srcp1_ystride;
struct file *srcp1_file;
int put1_need;
uint32 srcp2_addr; /* planar color 2*/
uint32 srcp2_ystride;
struct file *srcp2_file;
int put2_need;
uint32 srcp3_addr; /* alpha/color 3 */
uint32 srcp3_ystride;
uint32 fetch_plane;
uint32 frame_format; /* video */
uint32 chroma_site; /* video */
uint32 chroma_sample; /* video */
uint32 solid_fill;
uint32 vc1_reduce; /* video */
uint32 unpack_align_msb;/* 0 to LSB, 1 to MSB */
uint32 unpack_tight;/* 0 for loose, 1 for tight */
uint32 unpack_count;/* 0 = 1 component, 1 = 2 component ... */
uint32 rotated_90; /* has been rotated 90 degree */
uint32 bpp; /* byte per pixel */
uint32 alpha_enable;/* source has alpha */
/*
* number of bits for source component,
* 0 = 1 bit, 1 = 2 bits, 2 = 6 bits, 3 = 8 bits
*/
uint32 a_bit; /* component 3, alpha */
uint32 r_bit; /* component 2, R_Cr */
uint32 b_bit; /* component 1, B_Cb */
uint32 g_bit; /* component 0, G_lumz */
/*
* unpack pattern
* A = C3, R = C2, B = C1, G = C0
*/
uint32 element3; /* 0 = C0, 1 = C1, 2 = C2, 3 = C3 */
uint32 element2; /* 0 = C0, 1 = C1, 2 = C2, 3 = C3 */
uint32 element1; /* 0 = C0, 1 = C1, 2 = C2, 3 = C3 */
uint32 element0; /* 0 = C0, 1 = C1, 2 = C2, 3 = C3 */
ulong ov_blt_addr; /* blt mode addr */
ulong dma_blt_addr; /* blt mode addr */
ulong blt_base;
ulong blt_offset;
uint32 blt_cnt;
uint32 blt_changed;
uint32 ov_cnt;
uint32 dmap_cnt;
uint32 dmae_cnt;
uint32 blt_end; /* used by mddi only */
uint32 blt_ov_koff;
uint32 blt_ov_done;
uint32 blt_dmap_koff;
uint32 blt_dmap_done;
uint32 req_clk;
#if defined(CONFIG_MDP_RUNTIME_BANDWIDTH)
uint64 bw_ab_quota;
uint64 bw_ib_quota;
#else
uint32 req_bw;
#endif
uint32 luma_align_size;
struct mdp_overlay_pp_params pp_cfg;
struct mdp_overlay req_data;
struct completion comp;
struct completion dmas_comp;
struct mdp4_iommu_pipe_info iommu;
/* [START] force FLIP_MODE for INVERSE PANEL - hoseok.kim@lge.com */
#if defined(CONFIG_MACH_LGE_FX3_VZW) || defined(CONFIG_MACH_LGE_FX3Q_TMUS)
uint32 ext_flag;
struct msm_fb_data_type *mfd;
#endif
/* [END] force FLIP_MODE for INVERSE PANEL - hoseok.kim@lge.com */
};
struct mdp4_statistic {
ulong intr_tot;
ulong intr_dma_p;
ulong intr_dma_s;
ulong intr_dma_e;
ulong intr_overlay0;
ulong intr_overlay1;
ulong intr_overlay2;
ulong intr_vsync_p; /* Primary interface */
ulong intr_underrun_p; /* Primary interface */
ulong intr_vsync_e; /* external interface */
ulong intr_underrun_e; /* external interface */
ulong intr_histogram;
ulong intr_rdptr;
ulong dsi_mdp_start;
ulong dsi_clk_on;
ulong dsi_clk_off;
ulong intr_dsi;
ulong intr_dsi_mdp;
ulong intr_dsi_cmd;
ulong intr_dsi_err;
ulong kickoff_ov0;
ulong kickoff_ov1;
ulong kickoff_ov2;
ulong kickoff_dmap;
ulong kickoff_dmae;
ulong kickoff_dmas;
ulong blt_dsi_cmd; /* blt */
ulong blt_dsi_video; /* blt */
ulong blt_lcdc; /* blt */
ulong blt_dtv; /* blt */
ulong blt_mddi; /* blt */
ulong overlay_set[MDP4_MIXER_MAX];
ulong overlay_unset[MDP4_MIXER_MAX];
ulong overlay_play[MDP4_MIXER_MAX];
ulong overlay_commit[MDP4_MIXER_MAX];
ulong pipe[OVERLAY_PIPE_MAX];
ulong wait4vsync0;
ulong wait4vsync1;
ulong iommu_map;
ulong iommu_unmap;
ulong iommu_drop;
ulong dsi_clkoff;
ulong err_mixer;
ulong err_zorder;
ulong err_size;
ulong err_scale;
ulong err_format;
ulong err_stage;
ulong err_play;
ulong err_underflow;
};
struct vsync_update {
int update_cnt; /* pipes to be updated */
struct completion vsync_comp;
struct mdp4_overlay_pipe plist[OVERLAY_PIPE_MAX];
};
struct mdp4_overlay_pipe *mdp4_overlay_ndx2pipe(int ndx);
void mdp4_sw_reset(unsigned long bits);
void mdp4_display_intf_sel(int output, unsigned long intf);
void mdp4_overlay_cfg(int layer, int blt_mode, int refresh, int direct_out);
void mdp4_ebi2_lcd_setup(int lcd, unsigned long base, int ystride);
void mdp4_mddi_setup(int which, unsigned long id);
unsigned long mdp4_display_status(void);
void mdp4_enable_clk_irq(void);
void mdp4_disable_clk_irq(void);
void mdp4_dma_p_update(struct msm_fb_data_type *mfd);
void mdp4_dma_s_update(struct msm_fb_data_type *mfd);
void mdp_pipe_ctrl(MDP_BLOCK_TYPE block, MDP_BLOCK_POWER_STATE state,
boolean isr);
void mdp4_pipe_kickoff(uint32 pipe, struct msm_fb_data_type *mfd);
int mdp4_lcdc_on(struct platform_device *pdev);
int mdp4_lcdc_off(struct platform_device *pdev);
void mdp4_lcdc_update(struct msm_fb_data_type *mfd);
void mdp4_intr_clear_set(ulong clear, ulong set);
void mdp4_dma_p_cfg(void);
unsigned is_mdp4_hw_reset(void);
void mdp4_overlay_cfg_init(void);
void mdp4_hw_init(void);
void mdp4_isr_read(int);
void mdp4_clear_lcdc(void);
void mdp4_mixer_blend_init(int mixer_num);
void mdp4_vg_qseed_init(int vg_num);
void mdp4_vg_csc_update(struct mdp_csc *p);
irqreturn_t mdp4_isr(int irq, void *ptr);
void mdp4_overlay_format_to_pipe(uint32 format, struct mdp4_overlay_pipe *pipe);
uint32 mdp4_overlay_format(struct mdp4_overlay_pipe *pipe);
uint32 mdp4_overlay_unpack_pattern(struct mdp4_overlay_pipe *pipe);
uint32 mdp4_overlay_op_mode(struct mdp4_overlay_pipe *pipe);
void mdp4_lcdc_base_swap(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_lcdc_overlay(struct msm_fb_data_type *mfd);
#ifdef CONFIG_FB_MSM_DTV
void mdp4_overlay_dtv_start(void);
void mdp4_overlay_dtv_ov_done_push(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_dtv_wait_for_ov(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
int mdp4_overlay_dtv_set(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
int mdp4_overlay_dtv_unset(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_dmae_done_dtv(void);
void mdp4_dtv_wait4vsync(int cndx, long long *vtime);
void mdp4_dtv_vsync_ctrl(struct fb_info *info, int enable);
void mdp4_dtv_base_swap(int cndx, struct mdp4_overlay_pipe *pipe);
#else
static inline void mdp4_overlay_dtv_start(void)
{
/* empty */
}
static inline void mdp4_overlay_dtv_ov_done_push(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe)
{
/* empty */
}
static inline void mdp4_overlay_dtv_wait_for_ov(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe)
{
/* empty */
}
static inline int mdp4_overlay_dtv_set(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe)
{
return 0;
}
static inline int mdp4_overlay_dtv_unset(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe)
{
return 0;
}
static inline void mdp4_dmae_done_dtv(void)
{
/* empty */
}
static inline void mdp4_dtv_wait4vsync(int cndx, long long *vtime)
{
/* empty */
}
static inline void mdp4_dtv_vsync_ctrl(struct fb_info *info, int enable)
{
/* empty */
}
static inline void mdp4_dtv_overlay_blt_start(struct msm_fb_data_type *mfd)
{
return;
}
static inline void mdp4_dtv_overlay_blt_stop(struct msm_fb_data_type *mfd)
{
return;
}
static inline void mdp4_dtv_base_swap(struct mdp4_overlay_pipe *pipe)
{
/* empty */
}
#endif /* CONFIG_FB_MSM_DTV */
void mdp4_dtv_set_black_screen(void);
int mdp4_overlay_dtv_set(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
int mdp4_overlay_dtv_unset(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_dtv_overlay(struct msm_fb_data_type *mfd);
int mdp4_dtv_on(struct platform_device *pdev);
int mdp4_dtv_off(struct platform_device *pdev);
void mdp4_atv_overlay(struct msm_fb_data_type *mfd);
int mdp4_atv_on(struct platform_device *pdev);
int mdp4_atv_off(struct platform_device *pdev);
void mdp4_dsi_video_fxn_register(cmd_fxn_t fxn);
void mdp4_dsi_video_overlay(struct msm_fb_data_type *mfd);
void mdp4_lcdc_vsync_ctrl(struct fb_info *info, int enable);
void mdp4_overlay0_done_dsi_video(int cndx);
void mdp4_overlay0_done_dsi_cmd(int cndx);
void mdp4_primary_rdptr(void);
void mdp4_dsi_cmd_overlay(struct msm_fb_data_type *mfd);
int mdp4_lcdc_pipe_commit(int cndx, int wait);
int mdp4_dtv_pipe_commit(int cndx, int wait);
int mdp4_dsi_cmd_update_cnt(int cndx);
void mdp4_dsi_rdptr_init(int cndx);
void mdp4_dsi_vsync_init(int cndx);
void mdp4_lcdc_vsync_init(int cndx);
void mdp4_dtv_vsync_init(int cndx);
ssize_t mdp4_dsi_cmd_show_event(struct device *dev,
struct device_attribute *attr, char *buf);
ssize_t mdp4_dsi_video_show_event(struct device *dev,
struct device_attribute *attr, char *buf);
ssize_t mdp4_lcdc_show_event(struct device *dev,
struct device_attribute *attr, char *buf);
ssize_t mdp4_dtv_show_event(struct device *dev,
struct device_attribute *attr, char *buf);
void mdp4_overlay_dsi_state_set(int state);
int mdp4_overlay_dsi_state_get(void);
void mdp4_overlay_rgb_setup(struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_reg_flush(struct mdp4_overlay_pipe *pipe, int all);
void mdp4_mixer_blend_setup(int mixer);
void mdp4_mixer_blend_cfg(int);
struct mdp4_overlay_pipe *mdp4_overlay_stage_pipe(int mixer, int stage);
void mdp4_mixer_stage_up(struct mdp4_overlay_pipe *pipe, int commit);
void mdp4_mixer_stage_down(struct mdp4_overlay_pipe *pipe, int commit);
void mdp4_mixer_pipe_cleanup(int mixer);
int mdp4_mixer_stage_can_run(struct mdp4_overlay_pipe *pipe);
void mdp4_overlayproc_cfg(struct mdp4_overlay_pipe *pipe);
void mdp4_mddi_overlay(struct msm_fb_data_type *mfd);
int mdp4_overlay_format2type(uint32 format);
int mdp4_overlay_format2pipe(struct mdp4_overlay_pipe *pipe);
int mdp4_overlay_get(struct fb_info *info, struct mdp_overlay *req);
int mdp4_overlay_set(struct fb_info *info, struct mdp_overlay *req);
int mdp4_overlay_wait4vsync(struct fb_info *info, long long *vtime);
int mdp4_overlay_vsync_ctrl(struct fb_info *info, int enable);
int mdp4_overlay_unset(struct fb_info *info, int ndx);
int mdp4_overlay_unset_mixer(int mixer);
int mdp4_overlay_play_wait(struct fb_info *info,
struct msmfb_overlay_data *req);
int mdp4_overlay_play(struct fb_info *info, struct msmfb_overlay_data *req);
int mdp4_overlay_commit(struct fb_info *info);
struct mdp4_overlay_pipe *mdp4_overlay_pipe_alloc(int ptype, int mixer);
void mdp4_overlay_dma_commit(int mixer);
void mdp4_overlay_vsync_commit(struct mdp4_overlay_pipe *pipe);
void mdp4_mixer_stage_commit(int mixer);
void mdp4_dsi_cmd_do_update(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_lcdc_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_dtv_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_pipe_free(struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_dmap_cfg(struct msm_fb_data_type *mfd, int lcdc);
void mdp4_overlay_dmap_xy(struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_dmae_cfg(struct msm_fb_data_type *mfd, int atv);
void mdp4_overlay_dmae_xy(struct mdp4_overlay_pipe *pipe);
int mdp4_overlay_pipe_staged(struct mdp4_overlay_pipe *pipe);
void mdp4_lcdc_primary_vsyn(void);
void mdp4_overlay0_done_lcdc(int cndx);
void mdp4_overlay0_done_mddi(struct mdp_dma_data *dma);
void mdp4_dma_p_done_mddi(struct mdp_dma_data *dma);
void mdp4_dmap_done_dsi_cmd(int cndx);
void mdp4_dmap_done_dsi_video(int cndx);
void mdp4_dmap_done_lcdc(int cndx);
void mdp4_overlay1_done_dtv(void);
void mdp4_overlay1_done_atv(void);
void mdp4_primary_vsync_lcdc(void);
void mdp4_external_vsync_dtv(void);
void mdp4_lcdc_wait4vsync(int cndx, long long *vtime);
void mdp4_overlay_lcdc_vsync_push(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_mddi_overlay_dmas_restore(void);
#ifndef CONFIG_FB_MSM_MIPI_DSI
void mdp4_mddi_dma_busy_wait(struct msm_fb_data_type *mfd);
void mdp4_mddi_overlay_restore(void);
#else
static inline void mdp4_mddi_kickoff_video(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe)
{
/* empty */
}
static inline void mdp4_mddi_dma_busy_wait(struct msm_fb_data_type *mfd)
{
/* empty */
}
static inline void mdp4_mddi_blt_dmap_busy_wait(struct msm_fb_data_type *mfd)
{
/* empty */
}
static inline void mdp4_mddi_overlay_restore(void)
{
/* empty */
}
static inline void mdp4_mddi_overlay_blt_start(struct msm_fb_data_type *mfd)
{
/*empty*/
}
static inline void mdp4_mddi_overlay_blt_stop(struct msm_fb_data_type *mfd)
{
/*empty*/
}
static inline void mdp4_mddi_overlay_blt_offset(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req)
{
/* empty */
}
static inline void mdp4_mddi_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req)
{
/* empty*/
}
#endif
void mdp4_mddi_overlay_kickoff(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_rgb_igc_lut_setup(int num);
void mdp4_vg_igc_lut_setup(int num);
void mdp4_mixer_gc_lut_setup(int mixer_num);
void mdp4_fetch_cfg(uint32 clk);
uint32 mdp4_rgb_igc_lut_cvt(uint32 ndx);
void mdp4_vg_qseed_init(int);
int mdp4_overlay_blt(struct fb_info *info, struct msmfb_overlay_blt *req);
#ifdef CONFIG_FB_MSM_MIPI_DSI
void mdp4_dsi_cmd_blt_start(struct msm_fb_data_type *mfd);
void mdp4_dsi_cmd_blt_stop(struct msm_fb_data_type *mfd);
void mdp4_dsi_video_blt_start(struct msm_fb_data_type *mfd);
void mdp4_dsi_video_blt_stop(struct msm_fb_data_type *mfd);
void mdp4_dsi_cmd_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
void mdp4_dsi_video_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
void mdp4_dsi_video_base_swap(int cndx, struct mdp4_overlay_pipe *pipe);
#ifdef CONFIG_FB_MSM_MDP40
static inline void mdp3_dsi_cmd_dma_busy_wait(struct msm_fb_data_type *mfd)
{
/* empty */
}
#endif
#else /* CONFIG_FB_MSM_MIPI_DSI */
int mdp4_mddi_overlay_blt_offset(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
void mdp4_mddi_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
int mdp4_mddi_overlay_blt_start(struct msm_fb_data_type *mfd);
int mdp4_mddi_overlay_blt_stop(struct msm_fb_data_type *mfd);
void mdp4_mddi_blt_dmap_busy_wait(struct msm_fb_data_type *mfd);
static inline int mdp4_dsi_overlay_blt_start(struct msm_fb_data_type *mfd)
{
return -ENODEV;
}
static inline int mdp4_dsi_overlay_blt_stop(struct msm_fb_data_type *mfd)
{
return -ENODEV;
}
static inline void mdp4_dsi_video_blt_start(struct msm_fb_data_type *mfd)
{
}
static inline void mdp4_dsi_video_blt_stop(struct msm_fb_data_type *mfd)
{
}
static inline void mdp4_dsi_overlay_blt(
struct msm_fb_data_type *mfd, struct msmfb_overlay_blt *req)
{
}
static inline int mdp4_dsi_overlay_blt_offset(
struct msm_fb_data_type *mfd, struct msmfb_overlay_blt *req)
{
return -ENODEV;
}
static inline void mdp4_dsi_video_overlay_blt(
struct msm_fb_data_type *mfd, struct msmfb_overlay_blt *req)
{
}
static inline void mdp4_dsi_cmd_overlay_blt(
struct msm_fb_data_type *mfd, struct msmfb_overlay_blt *req)
{
}
static inline void mdp4_dsi_video_base_swap(int cndx,
struct mdp4_overlay_pipe *pipe)
{
/* empty */
}
static inline void mdp4_dsi_cmd_blt_start(struct msm_fb_data_type *mfd)
{
}
static inline void mdp4_dsi_cmd_blt_stop(struct msm_fb_data_type *mfd)
{
}
#endif /* CONFIG_FB_MSM_MIPI_DSI */
void mdp4_lcdc_overlay_blt(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
int mdp4_lcdc_overlay_blt_offset(struct msm_fb_data_type *mfd,
struct msmfb_overlay_blt *req);
void mdp4_lcdc_overlay_blt_start(struct msm_fb_data_type *mfd);
void mdp4_lcdc_overlay_blt_stop(struct msm_fb_data_type *mfd);
void mdp4_dtv_overlay_blt_start(struct msm_fb_data_type *mfd);
void mdp4_dtv_overlay_blt_stop(struct msm_fb_data_type *mfd);
void mdp4_overlay_panel_mode(int mixer_num, uint32 mode);
void mdp4_overlay_panel_mode_unset(int mixer_num, uint32 mode);
int mdp4_overlay_mixer_play(int mixer_num);
uint32 mdp4_overlay_panel_list(void);
void mdp4_lcdc_overlay_kickoff(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_mddi_kickoff_video(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_mddi_read_ptr_intr(void);
void mdp4_dsi_cmd_dma_busy_check(void);
#ifdef CONFIG_FB_MSM_MIPI_DSI
void mdp_dsi_cmd_overlay_suspend(struct msm_fb_data_type *mfd);
int mdp4_dsi_cmd_on(struct platform_device *pdev);
int mdp4_dsi_cmd_off(struct platform_device *pdev);
int mdp4_dsi_video_off(struct platform_device *pdev);
int mdp4_dsi_video_on(struct platform_device *pdev);
void mdp4_primary_vsync_dsi_video(void);
void mdp4_dsi_cmd_base_swap(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_dsi_cmd_wait4vsync(int cndx, long long *vtime);
void mdp4_dsi_video_wait4vsync(int cndx, long long *vtime);
void mdp4_dsi_cmd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_dsi_video_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
int mdp4_dsi_video_pipe_commit(int cndx, int wait);
int mdp4_dsi_cmd_pipe_commit(int cndx, int wait);
void mdp4_dsi_cmd_vsync_ctrl(struct fb_info *info, int enable);
void mdp4_dsi_video_vsync_ctrl(struct fb_info *info, int enable);
#ifdef CONFIG_FB_MSM_MDP303
static inline void mdp4_dsi_cmd_del_timer(void)
{
/* empty */
}
#else /* CONFIG_FB_MSM_MIPI_DSI */
void mdp4_dsi_cmd_del_timer(void);
#endif
#else /* CONFIG_FB_MSM_MIPI_DSI */
static inline int mdp4_dsi_cmd_on(struct platform_device *pdev)
{
return 0;
}
static inline int mdp4_dsi_cmd_off(struct platform_device *pdev)
{
return 0;
}
static inline int mdp4_dsi_video_on(struct platform_device *pdev)
{
return 0;
}
static inline int mdp4_dsi_video_off(struct platform_device *pdev)
{
return 0;
}
static inline void mdp4_primary_vsync_dsi_video(void)
{
}
static inline void mdp4_dsi_cmd_base_swap(int cndx,
struct mdp4_overlay_pipe *pipe)
{
}
static inline void mdp4_dsi_cmd_wait4vsync(int cndx, long long *vtime)
{
}
static inline void mdp4_dsi_video_wait4vsync(int cndx, long long *vtime)
{
}
static inline void mdp4_dsi_cmd_pipe_queue(int cndx,
struct mdp4_overlay_pipe *pipe)
{
}
static inline void mdp4_dsi_video_pipe_queue(int cndx,
struct mdp4_overlay_pipe *pipe)
{
}
static inline int mdp4_dsi_video_pipe_commit(int cndx, int wait)
{
return 0;
}
static inline int mdp4_dsi_cmd_pipe_commit(int cndx, int wait)
{
return 0;
}
static inline void mdp4_dsi_cmd_vsync_ctrl(struct fb_info *info,
int enable)
{
}
static inline void mdp4_dsi_video_vsync_ctrl(struct fb_info *info,
int enable)
{
}
static inline void mdp4_overlay_dsi_video_start(void)
{
/* empty */
}
#ifdef CONFIG_FB_MSM_MDP40
static inline void mdp_dsi_cmd_overlay_suspend(struct msm_fb_data_type *mfd)
{
/* empty */
}
#endif
#endif /* CONFIG_FB_MSM_MIPI_DSI */
void mdp4_dsi_cmd_kickoff_ui(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_dsi_cmd_kickoff_video(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_dsi_cmd_overlay_kickoff(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
void mdp4_overlay_panel_3d(int mixer_num, uint32 panel_3d);
int mdp4_overlay_3d_sbys(struct fb_info *info, struct msmfb_overlay_3d *req);
void mdp4_dsi_cmd_3d_sbys(struct msm_fb_data_type *mfd,
struct msmfb_overlay_3d *r3d);
void mdp4_dsi_video_3d_sbys(struct msm_fb_data_type *mfd,
struct msmfb_overlay_3d *r3d);
int mdp4_mixer_info(int mixer_num, struct mdp_mixer_info *info);
void mdp_dmap_vsync_set(int enable);
int mdp_dmap_vsync_get(void);
void mdp_hw_cursor_done(void);
void mdp_hw_cursor_init(void);
int mdp4_mddi_overlay_cursor(struct fb_info *info, struct fb_cursor *cursor);
int mdp_ppp_blit(struct fb_info *info, struct mdp_blit_req *req);
void mdp4_overlay_resource_release(void);
uint32_t mdp4_ss_table_value(int8_t param, int8_t index);
void mdp4_overlay_borderfill_stage_down(struct mdp4_overlay_pipe *pipe);
#ifdef CONFIG_FB_MSM_MDP303
static inline int mdp4_overlay_borderfill_supported(void)
{
return 0;
}
#else
int mdp4_overlay_borderfill_supported(void);
#endif
int mdp4_overlay_writeback_on(struct platform_device *pdev);
int mdp4_overlay_writeback_off(struct platform_device *pdev);
void mdp4_writeback_overlay(struct msm_fb_data_type *mfd);
void mdp4_overlay2_done_wfd(struct mdp_dma_data *dma);
int mdp4_writeback_start(struct fb_info *info);
int mdp4_writeback_stop(struct fb_info *info);
int mdp4_writeback_dequeue_buffer(struct fb_info *info,
struct msmfb_data *data);
int mdp4_writeback_queue_buffer(struct fb_info *info,
struct msmfb_data *data);
void mdp4_writeback_dma_stop(struct msm_fb_data_type *mfd);
int mdp4_writeback_init(struct fb_info *info);
int mdp4_writeback_terminate(struct fb_info *info);
uint32_t mdp_block2base(uint32_t block);
int mdp_hist_lut_config(struct mdp_hist_lut_data *data);
void mdp4_hsic_update(struct mdp4_overlay_pipe *pipe);
int mdp4_csc_config(struct mdp_csc_cfg_data *config);
void mdp4_csc_write(struct mdp_csc_cfg *data, uint32_t base);
int mdp4_csc_enable(struct mdp_csc_cfg_data *config);
int mdp4_pcc_cfg(struct mdp_pcc_cfg_data *cfg_ptr);
int mdp4_argc_cfg(struct mdp_pgc_lut_data *pgc_ptr);
int mdp4_qseed_cfg(struct mdp_qseed_cfg_data *cfg);
int mdp4_qseed_access_cfg(struct mdp_qseed_cfg *cfg, uint32_t base);
u32 mdp4_allocate_writeback_buf(struct msm_fb_data_type *mfd, u32 mix_num);
void mdp4_init_writeback_buf(struct msm_fb_data_type *mfd, u32 mix_num);
void mdp4_free_writeback_buf(struct msm_fb_data_type *mfd, u32 mix_num);
int mdp4_igc_lut_config(struct mdp_igc_lut_data *cfg);
void mdp4_overlay_iommu_pipe_free(int ndx, int all);
void mdp4_overlay_iommu_free_list(int mixer, struct ion_handle *ihdl);
void mdp4_overlay_iommu_unmap_freelist(int mixer);
void mdp4_overlay_iommu_vsync_cnt(void);
void mdp4_iommu_unmap(struct mdp4_overlay_pipe *pipe);
void mdp4_iommu_attach(void);
int mdp4_v4l2_overlay_set(struct fb_info *info, struct mdp_overlay *req,
struct mdp4_overlay_pipe **ppipe);
void mdp4_v4l2_overlay_clear(struct mdp4_overlay_pipe *pipe);
int mdp4_v4l2_overlay_play(struct fb_info *info, struct mdp4_overlay_pipe *pipe,
unsigned long srcp0_addr, unsigned long srcp1_addr,
unsigned long srcp2_addr);
#if defined(CONFIG_MDP_RUNTIME_BANDWIDTH)
int mdp4_overlay_mdp_pipe_req(struct mdp4_overlay_pipe *pipe,
struct msm_fb_data_type *mfd);
int mdp4_calc_blt_mdp_bw(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *pipe);
#else
int mdp4_overlay_mdp_pipe_req(struct mdp4_overlay_pipe *pipe,
struct msm_fb_data_type *mfd);
#endif
int mdp4_overlay_mdp_perf_req(struct msm_fb_data_type *mfd,
struct mdp4_overlay_pipe *plist);
void mdp4_overlay_mdp_perf_upd(struct msm_fb_data_type *mfd, int flag);
int mdp4_update_base_blend(struct msm_fb_data_type *mfd,
struct mdp_blend_cfg *mdp_blend_cfg);
u32 mdp4_get_mixer_num(u32 panel_type);
#ifndef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
static inline void mdp4_wfd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe)
{
/* empty */
}
static inline void mdp4_wfd_init(int cndx)
{
/* empty */
}
static inline int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd,
int cndx, int wait)
{
return 0;
}
#else
void mdp4_wfd_pipe_queue(int cndx, struct mdp4_overlay_pipe *pipe);
void mdp4_wfd_init(int cndx);
int mdp4_wfd_pipe_commit(struct msm_fb_data_type *mfd, int cndx, int wait);
#endif
#endif /* MDP_H */
| Java |
package Net::Gopher::Response;
=head1 NAME
Net::Gopher::Response - Class encapsulating Gopher responses
=head1 SYNOPSIS
use Net::Gopher;
...
my $response = $ng->request($request);
if ($response->is_success) {
if ($response->is_menu) {
# you can use as_menu() to parse Gopher menus:
my @items = $response->as_menu;
foreach my $item (@items) {
print join("::",
$item->{'type'}, $item->{'display'},
$item->{'selector'}, $item->{'host'},
$item->{'port'}, $item->{'gopher_plus'}
), "\n";
}
}
if ($response->is_blocks) {
# when issuing item attribute information requests, use
# item_blocks() to retrieve Net::Gopher::Response::Blocks
# objects, which you can call methods like as_info() and
# as_admin() on to parse the block values:
my %info = $response->item_blocks('INFO')->as_info;
print join("::",
$info{'type'}, $info{'display'},
$info{'selector'}, $info{'host'},
$info{'port'}, $info{'gopher_plus'}
), "\n";
my %admin = $response->item_blocks('ADMIN')->as_admin;
print "Maintained by $admin{'Admin'}[0] ",
"who can be emailed at $admin{'Admin'}[1]\n";
}
} else {
print $response->error;
}
...
=head1 DESCRIPTION
The L<Net::Gopher|Net::Gopher> C<request()>, C<gopher()>, C<gopher_plus()>,
C<item()>, and C<directory()> methods all return B<Net::Gopher::Response>
objects. These objects encapsulate responses from Gopher and Gopher+ servers.
In Gopher, a response is just a series of bytes terminated by a period on a
line by itself. In Gopher+, a response consists of a status line (the first
line), of which the first character is the status (success or failure; + or -),
followed by a newline (CRLF) and the content of the response. This class
contains methods to help you manipulate both Gopher as well as Gopher+
responses.
=head1 METHODS
The following methods are available:
=cut
use 5.005;
use strict;
use warnings;
use Carp;
use Net::Gopher::Utility qw(
check_params
$CRLF $NEWLINE %GOPHER_ITEM_TYPES %GOPHER_PLUS_ITEM_TYPES
);
use base qw(Net::Gopher::Response::Blocks);
sub new
{
my $invo = shift;
my $class = ref $invo || $invo;
my ($error, $request, $response, $status_line, $status, $content) =
check_params(
[
'Error', 'Request', 'Response',
'StatusLine', 'Status', 'Content'
], @_
);
my $self = {
# any error that occurred while sending the request or while
# receiving the response:
error => $error,
# the Net::Gopher::Request object:
request => $request,
# the entire response--every single byte:
response => $response,
# the first line of the response including the newline (only
# in Gopher+):
status_line => $status_line,
# the status code (+ or -) (only in Gopher+):
status => $status,
# content of the response:
content => $content,
# if this was a Gopher+ item/directory attribute information
# request, then this will be used to store the parsed
# information blocks:
blocks => undef
};
bless($self, $class);
# remove the socket class name from error messages (IO::Socket
# puts them in):
if (defined $self->error)
{
$self->{'error'} =~ s/IO::Socket::INET:\s//g;
}
return $self;
}
#==============================================================================#
=head2 status_line()
For a Gopher+ request, this method will return the status line (the first line)
of the response, including the newline character. For a Gopher request, this
will return undef.
=cut
sub status_line { return shift->{'status_line'} }
#==============================================================================#
=head2 status()
For a Gopher+ request, this method will return the status (the first character
of the status line) of the response, either a "+" or a "-" indicating success
or failure. For a Gopher request, this will return undef.
=cut
sub status { return shift->{'status'} }
#==============================================================================#
=head2 content()
Both C<content()> and C<as_string()> can be used to retrieve the strings
containing the server's response. With C<content()>, however, if the item
requested was text, then escaped periods are unescaped (i.e., '..' at the start
of a line becomes '.'). Also if the response was terminated by a period on a
line by itself but it isn't a text file or menu, then the period on a line by
itself will be removed from the content (though you can still check to see if
it was period terminated using the
L<is_terminated()|Net::Gopher::Response/is_terminated()> method). This is
because if you were requesting an image or some other non-text file, odds are
you don't want the newline and period at the end the content. And finally if
the item was text, then line endings are converted from CRLF and CR to LF. This
is done so you can use '\n', '.', etc., in patterns (please read
C<perldoc -f binmode> (it's short)).
In Gopher+, besides the modifications listed above, C<content()> does not
include the status line (first line) of the response (since the status line
isn't content), only everything after it.
=cut
sub content { return shift->{'content'} }
#==============================================================================#
=head2 as_string()
For both Gopher as well as Gopher+ requests, if the request was successful,
then this method will return the entire unmodified response, every single byte,
from the server. This includes the status line in Gopher+.
=cut
sub as_string { return shift->{'response'} }
#==============================================================================#
=head2 as_menu()
If you got a Gopher menu as your response from the server, then you can use
this method to parse it and return its values. When called, this method will
parse the content returned by C<content()> and return either an array (in list
context) or a reference to an array (in scalar context) containing references
to hashes as its elements. Each hash contains the data for one menu item and
has the following key=value pairs:
type = The item type (e.g., 0, 1, I, g, etc.);
display = The display string (e.g., "A file you should download");
selector = The selector string (e.g., /foo/bar);
host = The hostname (e.g., gopher.host.com);
port = The port number (e.g., 70);
gopher_plus = The Gopher+ character (e.g., +, !, ?, etc.);
Only items that list some type of resource that can be downloaded will be added
to the list; meaning that inline text ('i' item type) is skipped.
=cut
sub as_menu
{
my $self = shift;
# get the content, minus the period on a line by itself:
(my $content = $self->content) =~ s/\n\.\n?$//;
my @menu;
MENU: foreach my $item (split(/\n/, $content))
{
# get the item type and display string, selector, host, port,
# and Gopher+ string:
my ($type_and_display, $selector, $host, $port, $gopher_plus) =
split(/\t/, $item);
# separate the item type and the item description:
my ($type, $display) = $type_and_display =~ /^(.)(.*)/;
# skip it if it's inline text:
next if ($type eq 'i');
foreach ($type, $display, $selector, $host, $port)
{
unless (defined $_)
{
carp "Couldn't parse menu item";
last MENU;
}
}
push(@menu, {
type => $type,
display => $display,
selector => $selector,
host => $host,
port => $port,
gopher_plus => $gopher_plus
}
);
}
return (wantarray) ? @menu : \@menu;
}
#==============================================================================#
sub request { return shift->{'request'} };
#==============================================================================#
=head2 item_blocks([@block_names])
C<item_blocks()>, C<directory_blocks()>, and C<as_blocks()> allow you to parse
information blocks. Each of these methods returns one or more information
blocks in the form of L<Net::Gopher::Response::Blocks|BLOCK METHODS> objects.
This method is a more simple alternative to the C<directory_blocks()> method.
Use this method when you make item attribute information requests (!) and
use C<directory_blocks()> when you make directory attribute information
requests ($).
This method can be used to retrieve item information block values by specifying
the block name or block names as arguments. When specifying names, remember
that leading '+' and trailing ':' are stripped from block names, so rather
than asking for '+INFO:', you should ask for just plain 'INFO'. If you don't
supply any block names, then this method will return a list containing every
block name for the item:
# Net::Gopher::Response::Blocks object for the INFO block:
my $info = $response->item_blocks('INFO');
# print the block value:
print $info->content;
# the name of every block:
my @block_names = $response->item_blocks;
Please note that with this method, with the C<directory_blocks()> method, and
with the C<as_blocks()> method, the blocks in the server's response are only
parsed once, the first time you call any one of these methods, and stored in
the response object, so multiple calls to any of these three methods will not
result in performance degradation.
=cut
sub item_blocks
{
my $self = shift;
my @block_names = @_;
$self->_parse_blocks() unless (defined $self->{'blocks'});
if (@block_names)
{
return @{ $self->{'blocks'}[0] }{@block_names};
}
else
{
return sort keys %{ $self->{'blocks'}[0] };
}
}
#==============================================================================#
=head2 directory_blocks([\%item | $item] [, @block_names])
C<item_blocks()>, C<directory_blocks()>, and C<as_blocks()> allow you to parse
information blocks. Each of these methods returns one or more information
blocks in the form of L<Net::Gopher::Response::Blocks|BLOCK METHODS> objects.
If the request was a Gopher+ directory attribute information request, then you
can use method to get attribute information blocks for any of the items in the
server's response. This method works like the C<item_blocks()> method,
allowing you to specify the block values you want; however, with this method
you must also specify which item you want the block values from. This is done
using a hash ref as the first argument in which you specify certain attributes
about the item, then this method will go searching each item's INFO block to
see if it matches, and when the method finds the first matching item, it
returns the block values you specified, for that item.
The hash can contain any of the following key=value pairs:
N = The item must be the n'th item in the response.
Type = The item must be of this type.
Display = The item must have this display string.
Selector = The item must have this selector string.
Host = The item must be on this host.
Port = The item must be at this port.
GopherPlus = The item must have this Gopher+ string.
So to get the VIEWS and ADMIN B<Net::Gopher::Response::Bocks> objects for the
item with the selector of /welcome, you'd do this:
my ($views, $admin) = $response->directory_blocks(
{Selector => '/welcome'}, 'VIEWS', 'ADMIN'
);
Or use even more options for more accuracy:
my $views = $response->directory_blocks(
{
N => 7,
Selector => '/welcome',
Host => 'gopher.somehost.com',
Port => '70',
}, 'VIEWS'
);
Which means the VIEWS B<Net::Gopher::Response::Blocks> object for the 7th item
in the response, which must have a selector string of /welcome, on
gopher.somehost.com at port 70.
If you only want to specify the item by number, you can forgo the hash ref
altogether. To get the ADMIN block object for the second item, you can just do
this:
my $admin = $response->directory_blocks(2, 'ADMIN');
To get the names of all of the information blocks for a single item, don't
specify any block names, only a parameters hash or item number:
my @block_names = $response->directory_blocks(
{
Type => 1,
Selector => '/stuff',
Host => 'gopher.somehost.com',
Port => 70
}
);
Or:
# the names of all of the blocks for the fourth item:
my @block_names = $response->directory_blocks(4);
To get the total number of items, don't specify a parameters hash/item number
or block names:
my $num_items = $response->directory_blocks;
Please note that with this method, with the C<directory_blocks()> method, and
with the C<as_blocks()> method, the blocks in the server's response are only
parsed once, the first time you call any one of these methods, and stored in
the response object, so multiple calls to any of these three methods will not
result in performance degradation.
=cut
sub directory_blocks
{
my $self = shift;
my $from_item = shift;
my @block_names = @_;
$self->_parse_blocks() unless (defined $self->{'blocks'});
if (defined $from_item and ref $from_item)
{
my %match;
if (ref $from_item eq 'ARRAY')
{
%match = @$from_item;
}
else
{
%match = %$from_item;
}
my ($n,$type,$display,$selector,$host,$port,$gopher_plus) =
check_params(
[
'N', 'Type', 'Display', 'Selector',
'Host', 'Port', 'GopherPlus'
], %match
);
# a reference to hash contaiing the block names and values
# for the item the user specified:
my $matching_item;
# the items to search:
my @items = (defined $n)
? $self->{'blocks'}[$n - 1]
: @{ $self->{'blocks'} };
my %template = (
type => $type,
display => $display,
selector => $selector,
host => $host,
port => $port,
gopher_plus => $gopher_plus
);
# now search the items looking for the one that matches:
foreach my $item (@items)
{
# get the item's INFO block:
my %info = $item->{'INFO'}->as_info;
my $matches = 1;
foreach my $key (keys %template)
{
next unless (defined $template{$key});
# check the value against the template:
if (ref $template{$key} eq 'Regexp')
{
unless ($info{$key} =~ $template{$key})
{
$matches = 0;
last;
}
}
else
{
unless ($info{$key} eq $template{$key})
{
$matches = 0;
last;
}
}
}
if ($matches)
{
$matching_item = $item;
last;
}
}
return unless ($matching_item);
if (@block_names)
{
return @{$matching_item}{@block_names};
}
else
{
return sort keys %$matching_item;
}
}
elsif (defined $from_item)
{
my $i = $from_item - 1;
if (@block_names)
{
# hash slice to lookup and return all of the block
# values the user wanted from this item:
return @{ $self->{'blocks'}[$i] }{@block_names};
}
else
{
return sort keys %{ $self->{'blocks'}[$i] };
}
}
else
{
# return the total number of items:
return scalar @{ $self->{'blocks'} };
}
}
#==============================================================================#
=head2 as_blocks()
C<item_blocks()>, C<directory_blocks()>, and C<as_blocks()> allow you to parse
information blocks. Each of these methods returns one or more information
blocks in the form of L<Net::Gopher::Response::Blocks|BLOCK METHODS> objects.
This method can be used to directly get all of the information blocks at once.
If you made a directory attribute information request, then the blocks are
stored in an array, where each element of the array is reference to a hash
containing block names and block values for a single item. In list context this
method will return the array and in scalar context it will return a reference
to the array:
my @items = $response->as_blocks;
# INFO block for the second item:
my %info = $items[1]{'INFO'}->as_info;
print "$info{'display'} ($info{'host'}:$info{'port'}$info{'selector'})\n";
If you made an item attribute information request, then the block
names and values for the single item are stored in a hash, and the hash is
returned in list context, and a reference to the hash is returned in scalar
context:
my %blocks = $response->as_blocks;
# ADMIN block for the only item:
my %admin = $blocks{'ADMIN'}->as_admin;
print "Run by $admin{'Admin'}[0] ($admin{'Admin'}[1]).\n";
Please note that with this method, with the C<directory_blocks()> method, and
with the C<as_blocks()> method, the blocks in the server's response are only
parsed once, the first time you call any one of these methods, and stored in
the response object, so multiple calls to any of these three methods will not
result in performance degradation.
=cut
sub as_blocks
{
my $self = shift;
$self->_parse_blocks() unless (defined $self->{'blocks'});
my @items;
foreach my $item (@{ $self->{'blocks'} })
{
push(@items, { %$item });
}
if (@items == 1)
{
return wantarray ? %{ $items[0] } : $items[0];
}
else
{
return wantarray ? @items : \@items;
}
}
#==============================================================================#
=head2 is_success()
This method will return true if the request was successful, false otherwise.
First, whether it's a Gopher or Gopher+ request, it won't be "successful" if
any network errors occurred. Beyond that, in Gopher+, for a request to be a
"success" means that the status code returned by the server indicated success
(a code of +). In plain old Gopher, success is rather loosely defined.
Basically, since Gopher has no built-in uniform error handling, as long as
some response was received from the server (even "An error has occurred" or
"The item you requested does not exist"), this method will return true. For
more accuracy with Gopher requests you can use the C<is_terminated()> method.
If C<is_success()> returns false, meaning an error has occurred, then you can
obtain the error message by calling the C<error()> method on the
B<Net::Gopher::Response> object.
=cut
sub is_success
{
my $self = shift;
if (defined $self->status)
{
if ($self->status eq '+')
{
return 1;
}
else
{
return;
}
}
elsif (defined $self->error)
{
return;
}
else
{
return 1;
}
}
#==============================================================================#
=head2 is_error()
This method will return true if the request was unsuccessful; false otherwise.
Success and failure are the same as described above
(see L<is_success()|Net::Gopher::Response/is_success()>).
=cut
sub is_error
{
my $self = shift;
if (defined $self->status)
{
if ($self->status eq '-')
{
return 1;
}
else
{
return;
}
}
elsif (defined $self->error)
{
return 1;
}
else
{
return;
}
}
#==============================================================================#
=head2 is_blocks()
This method will return true if the response contains item attribute
information blocks; false otherwise.
=cut
sub is_blocks
{
my $self = shift;
my $block = qr/\+\S+ \s .*?/sx;
if ($self->content =~ /^$block (?: \n$block)*$/sx)
{
return 1;
}
else
{
return;
}
}
#==============================================================================#
=head2 is_gopher_plus()
This method will return true if the response was a Gopher+ style response with
a status line, status, etc.
=cut
sub is_gopher_plus
{
my $self = shift;
if ($self->status_line)
{
return 1;
}
else
{
return;
}
}
#==============================================================================#
=head2 is_menu()
This method will return true if the response is a Gopher menu that can be
parsed with as_menu(); false otherwise.
=cut
sub is_menu
{
my $self = shift;
my $field = qr/[^\t\012\015]*?/;
my $item = qr/$field\t$field\t$field\t$field (?:\t[\+\!\?\$])?/x;
if ($self->content =~ /^ $item (?:\n $item)* (?:\n\.\n?|\n)? $/x)
{
return 1;
}
else
{
return;
}
}
#==============================================================================#
=head2 is_terminated()
This returns true if the response was terminated by a period on a line by
itself; false otherwise.
=cut
sub is_terminated
{
my $self = shift;
my $error = shift;
# Since as_string() returns the unmodified response, it will always
# have the period on a line by itself in it; but that also means the
# line endings weren't converted to LF, so we can't use \n to match the
# period on a line by itself:
if ($self->as_string =~ /$NEWLINE\.$NEWLINE?$/)
{
return 1;
}
else
{
return;
}
}
sub is_text
{
my $self = shift;
return unless ($self->is_success);
if ($self->is_gopher_plus)
{
if ($self->request->item_type eq '0'
or $self->request->item_type eq '1'
or (defined $self->request->representation
and $self->request->representation =~
/^(text\/.*|
Directory\/.*|
application\/gopher\+?\-menu)/ix))
{
return 1;
}
else
{
return;
}
}
else
{
if ($self->request->item_type eq '0'
or $self->request->item_type eq '1')
{
return 1;
}
else
{
return;
}
}
}
#==============================================================================#
=head2 error()
This method returns the error message of the last error to occur or undef if no
error has occurred.
=cut
sub error { return shift->{'error'} }
################################################################################
#
# Method
# _convert_newlines()
#
# Purpose
# This method is used to conver all CRLF and CR line endings in
# the response content with LF so the '\n', '.', '\s', etc. meta
# symbols will work in pattern matches (see <perldoc -f binmode>
# for more).
#
# Parameters
# None.
#
sub _convert_newlines
{
my $self = shift;
# replace CRLF and CR with LF:
$self->{'content'} =~ s/\015\012/\012/g;
$self->{'content'} =~ s/\015/\012/g;
}
################################################################################
#
# Method
# _clean_period_termination()
#
# Purpose
# For responses that are terminated by periods on lines by
# themselves, this method will remove from the response content
# everything on after the period on a line by itself, unescape
# escaped periods, and--for non-text items--remove the period on
# a line by itself too.
#
# Parameters
# None.
#
sub _clean_period_termination
{
my $self = shift;
# For items terminated by periods on lines by themselves, lines that
# only contain periods are escaped by adding another period. Those
# lines must be unescaped:
$self->{'content'} =~ s/($NEWLINE)\.\.($NEWLINE)/$1.$2/g;
# remove anything after the period on a line by itself:
$self->{'content'} =~ s/($NEWLINE\.$NEWLINE?).*/$1/s;
# if there's a status, then the response was a Gopher+ request, item
# attribute information request, or a directory attribute information
# request:
my $type = $self->request->item_type;
unless ($self->is_text)
{
if ($self->is_gopher_plus)
{
if (exists $GOPHER_PLUS_ITEM_TYPES{$type})
{
# remove the period on a line by itself in the
# response content for this non-text response:
$self->{'content'} =~ s/$NEWLINE\.$NEWLINE?//;
}
}
else
{
if (exists $GOPHER_ITEM_TYPES{$type})
{
# remove the period on a line by itself in the
# response content for this non-text response:
$self->{'content'} =~ s/$NEWLINE\.$NEWLINE?//;
}
}
}
}
################################################################################
#
# Method
# _parse_blocks()
#
# Purpose
# This method parses the information blocks in $self->{'content'}
# and stores them in $self->{'blocks'}, where
# $self->{'blocks'} is a reference to an array and each
# element in the array is reference to a hash containing the
# block names and block values for a single item.
#
# Parameters
# None.
#
sub _parse_blocks
{
my $self = shift;
# $self->{'blocks'} will contain a reference to an array that
# will have hashrefs as its elements. Each hash will contain the item
# attribute information block names and block values for a single item.
# For Gopher+ '!' requests, the $self->{'blocks'} array will only
# contain one element (for the single item's blocks). But for
# Gopher+ '$' requests, since $ retrieves item attribute information
# blocks for every item in a directory, the array will contain multiple
# elements:
$self->{'blocks'} = [];
# remove all leading whitespace and the leading + for the first block
# name:
(my $content = $self->content) =~ s/^\s*\+//;
# this will store the block names and block values for each item, one
# at a time:
my %blocks;
foreach my $name_and_value (split(/\n\+/, $content))
{
# get the space separated name and value:
my ($name, $value) = $name_and_value =~ /(\S+)\s(.*)/s;
# block names are usually postfixed with colons:
$name =~ s/:$//;
# if the current item already has a block by this name, then
# this block belongs to the next item, so save this item's
# hash and start a new one:
if (exists $blocks{$name})
{
# we need to save a reference to a hash containing
# %blocks names and values, but not %blocks itself
# because we're going to empty it to make room
# for this item:
push(@{ $self->{'blocks'} }, { %blocks });
%blocks = ();
}
$blocks{$name} = new Net::Gopher::Response::Blocks (
BlockName => $name,
BlockValue => $value
);
}
# add the last item's attribute information blocks to the list:
push(@{ $self->{'blocks'} }, { %blocks });
}
1;
__END__
=head1 BLOCK METHODS
The C<item_blocks()>, C<directory_blocks()>, and C<as_blocks()> methods all
return one or more information blocks in the form of
B<Net::Gopher::Response::Blocks> objects. Here are all of the methods you can
call on these objects:
=head2 content()
This method will return the content of the block value, with the leading space
at the beginning of each line removed.
=head2 as_string()
This method will return the unmodified block value, with leading spaces still
intact.
=head2 as_admin()
ADMIN blocks contain attributes detailing information about a particular item
including who the administrator of it is and when it was last modified. ADMIN
blocks have at least two attributes: I<Admin> and I<Mod-Date>, though they can
(and often do) contain many more.
The I<Admin> attribute contains the name of the administrator and his or her
email address (e.g., "John Doe <jdoe@notreal.email>"). I<Mod-Date> contains a
timestamp for when the item was last modified.
Like C<as_attributes()>, this method will parse these attributes and return a
hash (in list context) or a reference to a hash (in scalar context) containing
the attribute names and values. Unlike C<as_attributes()>, this method parses
the individual I<Admin> and I<Mod-Date> attributes values and stores them as
arrays (each described below).
For the I<Admin> attribute, this method will extract the administrator name and
email from the Admin attribute value and create a two element array with them:
my %admin = $response->item_blocks('ADMIN')->as_admin;
my ($name, $email) = @{ $admin{'Admin'} };
print "Run by $name ($email).n";
For the I<Mod-Date> attribute, this method will extract the timestamp convert
it into an array containing values in the same format as those returned by
Perl's C<localtime()> function corresponding with the timestamp (to find out
exactly what the array will contain, see C<perldoc -f localtime>):
my %admin = $response->item_blocks('ADMIN')->as_admin;
my ($name, $email) = @{ $admin{'Admin'} }
print "This box is maintained by $name ($email).";
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
@{ $admin{'Mod-Date'} };
As mentioned above, in addition to I<Admin> and I<Mod-Date>, the hash may
contain other attributes including I<Abstract>, I<Version>, I<Org>, I<Loc> and
others--all of which are stored as in the hash as plain text, not as arrays.
Note that this method is inherited by B<Net::Gopher::Response>. You can call
this method directly on a B<Net::Gopher::Response> object, in which case
this method will call C<$response-E<gt>item_blocks('ADMIN')> and use that.
Thus, this:
my %admin = $response->as_admin;
is the same as this:
my %admin = $response->item_blocks('ADMIN')->as_admin;
=head2 as_ask()
ASK blocks contain a form to be filled out by the user, with ASK queries on
lines by themselves consisting of query type, followed by the question and any
default values separated by tabs (e.g., "Ask: Some question?\tdefault
answer 1\tdefault answer 2", "Choose: A question?choice 1\tchoice 2\tchoice3").
This method parses the ASK block and will return an array (in list context) or
a reference to an array (in scalar context) containing hash refs of each query
in the order they appeared, with each hash having the following key=value
pairs:
type = The type of query (e.g, Ask, AskP, Select, Choose, etc.).
question = The question.
defaults = A reference to an array containing the default answers.
Note that this method is inherited by B<Net::Gopher::Response>. You can call
this method directly on a B<Net::Gopher::Response> object, in which case
this method will call C<$response-E<gt>item_blocks('ASK')> and use that.
Thus, this:
my @ask = $response->as_ask;
is the same as this:
my @ask = $response->item_blocks('ASK')->as_ask;
=head2 as_info()
INFO blocks contain tab delimited item information like that which you'd find
in a Gopher menu.
This method parses INFO blocks and returns a hash (in list context) or a
reference to a hash (in scalar context) containing the information from the
tab delimited fields in the same format as described above
(see L<as_menu()|Net::Gopher::Response/as_menu()>):
my %info = $response->item_blocks('INFO')->as_info;
Note that this method is inherited by B<Net::Gopher::Response>. You can call
this method directly on a B<Net::Gopher::Response> object, in which case
this method will call C<$response-E<gt>item_blocks('INFO')> and use that.
Thus, this:
my %info = $response->as_info;
is the same as this:
my %info = $response->item_blocks('INFO')->as_info;
=head2 as_views()
VIEWS blocks contain a list of available formats for a particular item.
This method parses VIEWS blocks and returns an array (in list context) or a
reference to an array (in scalar context) containing each view in the form of a
reference to hash with the following key=value pairs:
type = The MIME type (e.g., text/plain, application/gopher+-menu, etc.).
language = The ISO 639 language code (e.g., En_US).
size = The size in bytes.
Note that this method will convert the <> size format used in Gopher+ to
an integer; the total size in bytes (e.g., <80> becomes 80, <40K> becomes
40000, <.4K> becomes 400, <400B> becomes 400, etc.):
my @views = $response->item_blocks('VIEWS')->as_views;
foreach my $view (@views) {
print "$view->{'type'} ($view->{'size'} bytes) ($type->{'language'})\n";
...
my $another_response = $ng->request(
Gopher => {
Host => $host,
Selector => $selector,
Representation => $view->{'type'}
}
);
...
}
Note that this method is inherited by B<Net::Gopher::Response>. You can call
this method directly on a B<Net::Gopher::Response> object, in which case
this method will call C<$response-E<gt>item_blocks('VIEWS')> and use that.
Thus, this:
my @views = $response->as_views;
is the same as this:
my @views = $response->item_blocks('VIEWS')->as_views;
=head2 as_attributes()
If the block value contains a series of C<Name: value> attributes on lines by
themselves, then you can use this method to parse them. This method will
return a hash (in list context) or a reference to a hash (in scalar context)
containing the attribute names and values.
=head2 is_attributes()
This method checks to see if the block value can be successfully parsed by
C<as_attributes()>. If the value contains a series of C<Name: value> attributes,
then this method will return true; false otherwise.
=head1 BUGS
If you encounter bugs, you can alert me of them by emailing me at
<william_g_davis at users dot sourceforge dot net> or, if you have PerlMonks
account, you can go to perlmonks.org and /msg me (William G. Davis).
=head1 SEE ALSO
Net::Gopher, Net::Gopher::Request
=head1 COPYRIGHT
Copyright 2003, William G. Davis.
This code is free software released under the GNU General Public License, the
full terms of which can be found in the "COPYING" file that came with the
distribution of the module.
=cut
| Java |
<?php
/**
* This houses all the code to integrate with X
*/
class Cornerstone_Integration_X_Theme {
/**
* Theme integrations should provide a stylesheet function returning the stylesheet name
* This will be matched with get_stylesheet() to determine if the integration will load
*/
public static function stylesheet() {
return 'x';
}
/**
* Theme integrations are loaded on the after_theme_setup hook
*/
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
add_action( 'cornerstone_load_preview', array( $this, 'load_preview' ) );
add_filter( 'cornerstone_config_common_default-settings', array( $this, 'addDefaultSettings' ) );
// Don't enqueue native styles
add_filter( 'cornerstone_enqueue_styles', '__return_false' );
add_filter( 'cornerstone_inline_styles', '__return_false' );
// Don't load the Customizer
add_filter( 'cornerstone_use_customizer', '__return_false' );
// Enable X specific settings pane items
add_filter( 'x_settings_pane', '__return_true' );
// Declare support for page builder features
add_filter( 'cornerstone_looks_like_support', '__return_true' );
// Shortcode generator tweaks
add_action('cornerstone_generator_preview_before', array( $this, 'shortcodeGeneratorPreviewBefore' ), -9999 );
add_filter('cornerstone_generator_map', array( $this, 'shortcodeGeneratorDemoURL' ) );
// Alias legacy shortcode names.
add_action('cornerstone_shortcodes_loaded', array( $this, 'aliasShortcodes' ) );
add_filter('cornerstone_scrolltop_selector', array( $this, 'scrollTopSelector' ) );
add_filter('cs_recent_posts_post_types', array( $this, 'recentPostTypes' ) );
// Use Audio and Video shortcodes for X native players.
add_filter( 'wp_audio_shortcode_library', 'x_wp_native_audio_shortcode_library' );
add_filter( 'wp_audio_shortcode', 'x_wp_native_audio_shortcode' );
add_filter( 'wp_audio_shortcode_class', 'x_wp_native_audio_shortcode_class' );
add_filter( 'wp_video_shortcode_library', 'x_wp_native_video_shortcode_library' );
add_filter( 'wp_video_shortcode', 'x_wp_native_video_shortcode' );
add_filter( 'wp_video_shortcode_class', 'x_wp_native_video_shortcode_class' );
}
public function init() {
// Add Logic for additional contact methods if not overridden in a child theme
if ( ! function_exists( 'x_modify_contact_methods' ) )
add_filter( 'user_contactmethods', array( $this, 'modifyContactMethods' ) );
add_action( 'admin_menu', array( $this, 'optionsPage' ) );
// Remove empty p and br HTML elements for legacy pages not using Cornerstone sections
add_filter( 'the_content', 'cs_noemptyp' );
// Enqueue Legacy font classes
$settings = CS()->settings();
if ( isset( $settings['enable_legacy_font_classes'] ) && $settings['enable_legacy_font_classes'] ) {
add_filter( 'cornerstone_legacy_font_classes', '__return_true' );
}
}
public function aliasShortcodes() {
//
// Alias [social] to [icon] for backwards compatability.
//
cs_alias_shortcode( 'social', 'x_icon', false );
//
// Alias deprecated shortcode names.
//
// Mk2
cs_alias_shortcode( array( 'alert', 'x_alert' ), 'cs_alert' );
cs_alias_shortcode( array( 'x_text' ), 'cs_text' );
cs_alias_shortcode( array( 'icon_list', 'x_icon_list' ), 'cs_icon_list' );
cs_alias_shortcode( array( 'icon_list_item', 'x_icon_list_item' ), 'cs_icon_list_item' );
// Mk1
cs_alias_shortcode( 'accordion', 'x_accordion', false );
cs_alias_shortcode( 'accordion_item', 'x_accordion_item', false );
cs_alias_shortcode( 'author', 'x_author', false );
cs_alias_shortcode( 'block_grid', 'x_block_grid', false );
cs_alias_shortcode( 'block_grid_item', 'x_block_grid_item', false );
cs_alias_shortcode( 'blockquote', 'x_blockquote', false );
cs_alias_shortcode( 'button', 'x_button', false );
cs_alias_shortcode( 'callout', 'x_callout', false );
cs_alias_shortcode( 'clear', 'x_clear', false );
cs_alias_shortcode( 'code', 'x_code', false );
cs_alias_shortcode( 'column', 'x_column', false );
cs_alias_shortcode( 'columnize', 'x_columnize', false );
cs_alias_shortcode( 'container', 'x_container', false );
cs_alias_shortcode( 'content_band', 'x_content_band', false );
cs_alias_shortcode( 'counter', 'x_counter', false );
cs_alias_shortcode( 'custom_headline', 'x_custom_headline', false );
cs_alias_shortcode( 'dropcap', 'x_dropcap', false );
cs_alias_shortcode( 'extra', 'x_extra', false );
cs_alias_shortcode( 'feature_headline', 'x_feature_headline', false );
cs_alias_shortcode( 'gap', 'x_gap', false );
cs_alias_shortcode( 'google_map', 'x_google_map', false );
cs_alias_shortcode( 'google_map_marker', 'x_google_map_marker', false );
cs_alias_shortcode( 'highlight', 'x_highlight', false );
cs_alias_shortcode( 'icon', 'x_icon', false );
cs_alias_shortcode( 'image', 'x_image', false );
cs_alias_shortcode( 'lightbox', 'x_lightbox', false );
cs_alias_shortcode( 'line', 'x_line', false );
cs_alias_shortcode( 'map', 'x_map', false );
cs_alias_shortcode( 'pricing_table', 'x_pricing_table', false );
cs_alias_shortcode( 'pricing_table_column', 'x_pricing_table_column', false );
cs_alias_shortcode( 'promo', 'x_promo', false );
cs_alias_shortcode( 'prompt', 'x_prompt', false );
cs_alias_shortcode( 'protect', 'x_protect', false );
cs_alias_shortcode( 'pullquote', 'x_pullquote', false );
cs_alias_shortcode( 'raw_output', 'x_raw_output', false );
cs_alias_shortcode( 'recent_posts', 'x_recent_posts', false );
cs_alias_shortcode( 'responsive_text', 'x_responsive_text', false );
cs_alias_shortcode( 'search', 'x_search', false );
cs_alias_shortcode( 'share', 'x_share', false );
cs_alias_shortcode( 'skill_bar', 'x_skill_bar', false );
cs_alias_shortcode( 'slider', 'x_slider', false );
cs_alias_shortcode( 'slide', 'x_slide', false );
cs_alias_shortcode( 'tab_nav', 'x_tab_nav', false );
cs_alias_shortcode( 'tab_nav_item', 'x_tab_nav_item', false );
cs_alias_shortcode( 'tabs', 'x_tabs', false );
cs_alias_shortcode( 'tab', 'x_tab', false );
cs_alias_shortcode( 'toc', 'x_toc', false );
cs_alias_shortcode( 'toc_item', 'x_toc_item', false );
cs_alias_shortcode( 'visibility', 'x_visibility', false );
}
public function recentPostTypes( $types ) {
$types['portfolio'] = 'x-portfolio';
return $types;
}
public function scrollTopSelector() {
return '.x-navbar-fixed-top';
}
public function modifyContactMethods( $user_contactmethods ) {
if ( isset( $user_contactmethods['yim'] ) )
unset( $user_contactmethods['yim'] );
if ( isset( $user_contactmethods['aim'] ) )
unset( $user_contactmethods['aim'] );
if ( isset( $user_contactmethods['jabber'] ) )
unset( $user_contactmethods['jabber'] );
$user_contactmethods['facebook'] = __( 'Facebook Profile', csl18n() );
$user_contactmethods['twitter'] = __( 'Twitter Profile', csl18n() );
$user_contactmethods['googleplus'] = __( 'Google+ Profile', csl18n() );
return $user_contactmethods;
}
public function shortcodeGeneratorPreviewBefore() {
remove_all_actions( 'cornerstone_generator_preview_before' );
$list_stacks = array(
'integrity' => __( 'Integrity', csl18n() ),
'renew' => __( 'Renew', csl18n() ),
'icon' => __( 'Icon', csl18n() ),
'ethos' => __( 'Ethos', csl18n() )
);
$stack = $this->x_get_stack();
$stack_name = ( isset( $list_stacks[ $stack ] ) ) ? $list_stacks[ $stack ] : 'X';
printf(
__('You're using %s. Click the button below to check out a live example of this shortcode when using this Stack.', csl18n() ),
'<strong>' . $stack_name . '</strong>'
);
}
public function shortcodeGeneratorDemoURL( $attributes ) {
if ( isset($attributes['demo']) )
$attributes['demo'] = str_replace( 'integrity', $this->x_get_stack(), $attributes['demo'] );
return $attributes;
}
public function x_get_stack() {
// Some plugins abort the theme loading process in certain contexts.
// This provide a safe fallback for x_get_stack calls
if ( function_exists( 'x_get_stack' ) )
return x_get_stack();
return apply_filters( 'x_option_x_stack', get_option( 'x_stack', 'integrity' ) );
}
public function addDefaultSettings( $settings ) {
$settings['enable_legacy_font_classes'] = get_option( 'x_pre_v4', false );
return $settings;
}
/**
* Swap out the Design and Product Validation Metaboxes on the Options page
*/
public function optionsPage() {
remove_action( 'cornerstone_options_mb_validation', array( CS()->component( 'Admin' ), 'renderValidationMB' ) );
add_action( 'cornerstone_options_mb_settings', array( $this, 'legacyFontClasses' ) );
add_action( 'cornerstone_options_mb_validation', array( $this, 'renderValidationMB' ) );
add_filter( 'cornerstone_config_admin_info-items', array( $this, 'removeInfoItems' ) );
}
/**
*
*/
public function legacyFontClasses() {
?>
<tr>
<th>
<label for="cornerstone-fields-enable_legacy_font_classes">
<strong><?php _e( 'Enable Legacy Font Classes', csl18n() ); ?></strong>
<span><?php _e( 'Check to enable legacy font classes.', csl18n() ); ?></span>
</label>
</th>
<td>
<fieldset>
<?php echo CS()->component( 'Admin' )->settings->renderField( 'enable_legacy_font_classes', array( 'type' => 'checkbox', 'value' => '1', 'label' => __( 'Enable', csl18n() ) ) ) ?>
</fieldset>
</td>
</tr>
<?php
}
/**
* Output custom Product Validation Metabox
*/
public function renderValidationMB() { ?>
<?php if ( x_is_validated() ) : ?>
<p class="cs-validated"><strong>Congrats! X is active and validated</strong>. Because of this you don't need to validate Cornerstone and automatic updates are up and running.</p>
<?php else : ?>
<p class="cs-not-validated"><strong>Uh oh! It looks like X isn't validated</strong>. Cornerstone validates through X, which enables automatic updates. Head over to the product validation page to get that setup.<br><a href="<?php echo x_addons_get_link_product_validation(); ?>">Validate</a></p>
<?php endif;
}
public function removeInfoItems( $info_items ) {
unset( $info_items['api-key'] );
unset( $info_items['design-options'] );
$info_items['enable-legacy-font-classes' ] = array(
'title' => __( 'Enable Legacy Font Classes', csl18n() ),
'content' => __( 'X no longer provides the <strong>.x-icon*</strong> classes. This was done for performance reasons. If you need these classes, you can enable them again with this setting.', csl18n() )
);
return $info_items;
}
public function load_preview() {
if ( defined( 'X_VIDEO_LOCK_VERSION' ) )
remove_action( 'wp_footer', 'x_video_lock_output' );
}
}
// Native shortcode alterations.
// =============================================================================
// [audio]
// =============================================================================
//
// 1. Library.
// 2. Output.
// 3. Class.
//
function x_wp_native_audio_shortcode_library() { // 1
wp_enqueue_script( 'mediaelement' );
return false;
}
function x_wp_native_audio_shortcode( $html ) { // 2
return '<div class="x-audio player" data-x-element="x_mejs">' . $html . '</div>';
}
function x_wp_native_audio_shortcode_class() { // 3
return 'x-mejs x-wp-audio-shortcode advanced-controls';
}
// [video]
// =============================================================================
//
// 1. Library.
// 2. Output.
// 3. Class.
//
function x_wp_native_video_shortcode_library() { // 1
wp_enqueue_script( 'mediaelement' );
return false;
}
function x_wp_native_video_shortcode( $output ) { // 2
return '<div class="x-video player" data-x-element="x_mejs">' . preg_replace('/<div(.*?)>/', '<div class="x-video-inner">', $output ) . '</div>';
}
function x_wp_native_video_shortcode_class() { // 3
return 'x-mejs x-wp-video-shortcode advanced-controls';
}
| Java |
/*
* $Id: hppcl.h,v 1.5 2008-07-27 03:22:41 haley Exp $
*/
/************************************************************************
* *
* Copyright (C) 2000 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
* The use of this Software is governed by a License Agreement. *
* *
************************************************************************/
#ifndef _hppcl_
#define _hppcl_
#define HPPCL_RESET "E"
#define HPPCL_PORTRAIT "&l0O"
#define HPPCL_LANDSCAPE "&l1O"
#define HPPCL_ENCODING ""
#define HPPCL_START "1A"
#define HPPCL_END "B"
#define HPPCL_EJECT "&l0H"
#define HPPCL_POSITION "%dx%dY"
#define HPPCL_TRANSFER "%dW"
#define HPPCL_RESOLUTION "%dR"
#ifdef DEAD
#define HPPCL_PAPER_WIDTH 8.5
#define HPPCL_PAPER_HEIGHT 11.0
#endif
#define HPPCL_PAPER_WIDTH 8.0
#define HPPCL_PAPER_HEIGHT 10.0
#define HPPCL_MAX_RES 300 /* default resolution 300dpi */
typedef struct HPPCL_Info {
int do_compress;
int orientation;
int dpi;
char *trans_data;
int row_size;
int image_size;
int start_x;
int start_y;
} HPPCL_Info;
#endif /* _hppcl_ */
| Java |
/* $Id$ */
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* The main() function
*/
/*
* Copyright (C) 2006-2009 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifdef VBOX_WITH_PRECOMPILED_HEADERS
#include "precomp.h"
#ifdef Q_WS_MAC
# include "UICocoaApplication.h"
#endif /* Q_WS_MAC */
#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
#include "VBoxGlobal.h"
#include "UIMessageCenter.h"
#include "UISelectorWindow.h"
#include "VBoxUtils.h"
#ifdef Q_WS_MAC
# include "UICocoaApplication.h"
#endif
#ifdef Q_WS_X11
#include <QFontDatabase>
#include <iprt/env.h>
#endif
#include <QCleanlooksStyle>
#include <QPlastiqueStyle>
#include <QMessageBox>
#include <QLocale>
#include <QTranslator>
#ifdef Q_WS_X11
# include <X11/Xlib.h>
#endif
#include <iprt/buildconfig.h>
#include <iprt/err.h>
#include <iprt/initterm.h>
#include <iprt/process.h>
#include <iprt/stream.h>
#include <VBox/err.h>
#include <VBox/version.h>
#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
#ifdef VBOX_WITH_HARDENING
# include <VBox/sup.h>
#endif
#ifdef RT_OS_LINUX
# include <unistd.h>
#endif
#include <cstdio>
/* XXX Temporarily. Don't rely on the user to hack the Makefile himself! */
QString g_QStrHintLinuxNoMemory = QApplication::tr(
"This error means that the kernel driver was either not able to "
"allocate enough memory or that some mapping operation failed."
);
QString g_QStrHintLinuxNoDriver = QApplication::tr(
"The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or "
"there is a permission problem with /dev/vboxdrv. Please reinstall the kernel "
"module by executing<br/><br/>"
" <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>"
"as root. If it is available in your distribution, you should install the "
"DKMS package first. This package keeps track of Linux kernel changes and "
"recompiles the vboxdrv kernel module if necessary."
);
QString g_QStrHintOtherWrongDriverVersion = QApplication::tr(
"The VirtualBox kernel modules do not match this version of "
"VirtualBox. The installation of VirtualBox was apparently not "
"successful. Please try completely uninstalling and reinstalling "
"VirtualBox."
);
QString g_QStrHintLinuxWrongDriverVersion = QApplication::tr(
"The VirtualBox kernel modules do not match this version of "
"VirtualBox. The installation of VirtualBox was apparently not "
"successful. Executing<br/><br/>"
" <font color=blue>'/etc/init.d/vboxdrv setup'</font><br/><br/>"
"may correct this. Make sure that you do not mix the "
"OSE version and the PUEL version of VirtualBox."
);
QString g_QStrHintOtherNoDriver = QApplication::tr(
"Make sure the kernel module has been loaded successfully."
);
/* I hope this isn't (C), (TM) or (R) Microsoft support ;-) */
QString g_QStrHintReinstall = QApplication::tr(
"Please try reinstalling VirtualBox."
);
#if defined(DEBUG) && defined(Q_WS_X11) && defined(RT_OS_LINUX)
#include <signal.h>
#include <execinfo.h>
/* get REG_EIP from ucontext.h */
#ifndef __USE_GNU
#define __USE_GNU
#endif
#include <ucontext.h>
#ifdef RT_ARCH_AMD64
# define REG_PC REG_RIP
#else
# define REG_PC REG_EIP
#endif
/**
* the signal handler that prints out a backtrace of the call stack.
* the code is taken from http://www.linuxjournal.com/article/6391.
*/
void bt_sighandler (int sig, siginfo_t *info, void *secret) {
void *trace[16];
char **messages = (char **)NULL;
int i, trace_size = 0;
ucontext_t *uc = (ucontext_t *)secret;
/* Do something useful with siginfo_t */
if (sig == SIGSEGV)
Log (("GUI: Got signal %d, faulty address is %p, from %p\n",
sig, info->si_addr, uc->uc_mcontext.gregs[REG_PC]));
else
Log (("GUI: Got signal %d\n", sig));
trace_size = backtrace (trace, 16);
/* overwrite sigaction with caller's address */
trace[1] = (void *) uc->uc_mcontext.gregs [REG_PC];
messages = backtrace_symbols (trace, trace_size);
/* skip first stack frame (points here) */
Log (("GUI: [bt] Execution path:\n"));
for (i = 1; i < trace_size; ++i)
Log (("GUI: [bt] %s\n", messages[i]));
exit (0);
}
#endif /* DEBUG && X11 && LINUX*/
#if defined(RT_OS_DARWIN)
# include <dlfcn.h>
# include <sys/mman.h>
# include <iprt/asm.h>
# include <iprt/system.h>
/** Really ugly hack to shut up a silly check in AppKit. */
static void ShutUpAppKit(void)
{
/* Check for Snow Leopard or higher */
char szInfo[64];
int rc = RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, szInfo, sizeof(szInfo));
if ( RT_SUCCESS (rc)
&& szInfo[0] == '1') /* higher than 1x.x.x */
{
/*
* Find issetguid() and make it always return 0 by modifying the code.
*/
void *addr = dlsym(RTLD_DEFAULT, "issetugid");
int rc = mprotect((void *)((uintptr_t)addr & ~(uintptr_t)0xfff), 0x2000, PROT_WRITE|PROT_READ|PROT_EXEC);
if (!rc)
ASMAtomicWriteU32((volatile uint32_t *)addr, 0xccc3c031); /* xor eax, eax; ret; int3 */
}
}
#endif /* DARWIN */
static void QtMessageOutput (QtMsgType type, const char *msg)
{
#ifndef Q_WS_X11
NOREF(msg);
#endif
switch (type)
{
case QtDebugMsg:
Log (("Qt DEBUG: %s\n", msg));
break;
case QtWarningMsg:
Log (("Qt WARNING: %s\n", msg));
#ifdef Q_WS_X11
/* Needed for instance for the message ``cannot connect to X server'' */
RTStrmPrintf(g_pStdErr, "Qt WARNING: %s\n", msg);
#endif
break;
case QtCriticalMsg:
Log (("Qt CRITICAL: %s\n", msg));
#ifdef Q_WS_X11
/* Needed for instance for the message ``cannot connect to X server'' */
RTStrmPrintf(g_pStdErr, "Qt CRITICAL: %s\n", msg);
#endif
break;
case QtFatalMsg:
Log (("Qt FATAL: %s\n", msg));
#ifdef Q_WS_X11
RTStrmPrintf(g_pStdErr, "Qt FATAL: %s\n", msg);
#endif
}
}
/**
* Show all available command line parameters.
*/
static void showHelp()
{
QString mode = "", dflt = "";
#ifdef VBOX_GUI_USE_SDL
mode += "sdl";
#endif
#ifdef VBOX_GUI_USE_QIMAGE
if (!mode.isEmpty())
mode += "|";
mode += "image";
#endif
#ifdef VBOX_GUI_USE_DDRAW
if (!mode.isEmpty())
mode += "|";
mode += "ddraw";
#endif
#ifdef VBOX_GUI_USE_QUARTZ2D
if (!mode.isEmpty())
mode += "|";
mode += "quartz2d";
#endif
#if defined (Q_WS_MAC) && defined (VBOX_GUI_USE_QUARTZ2D)
dflt = "quartz2d";
#elif (defined (Q_WS_WIN32) || defined (Q_WS_PM)) && defined (VBOX_GUI_USE_QIMAGE)
dflt = "image";
#elif defined (Q_WS_X11) && defined (VBOX_GUI_USE_SDL)
dflt = "sdl";
#else
dflt = "image";
#endif
RTPrintf(VBOX_PRODUCT " Manager %s\n"
"(C) 2005-" VBOX_C_YEAR " " VBOX_VENDOR "\n"
"All rights reserved.\n"
"\n"
"Usage:\n"
" --startvm <vmname|UUID> start a VM by specifying its UUID or name\n"
" --seamless switch to seamless mode during startup\n"
" --fullscreen switch to fullscreen mode during startup\n"
" --rmode %-18s select different render mode (default is %s)\n"
" --no-startvm-errormsgbox do not show a message box for VM start errors\n"
# ifdef VBOX_GUI_WITH_PIDFILE
" --pidfile <file> create a pidfile file when a VM is up and running\n"
# endif
# ifdef VBOX_WITH_DEBUGGER_GUI
" --dbg enable the GUI debug menu\n"
" --debug like --dbg and show debug windows at VM startup\n"
" --debug-command-line like --dbg and show command line window at VM startup\n"
" --debug-statistics like --dbg and show statistics window at VM startup\n"
" --no-debug disable the GUI debug menu and debug windows\n"
" --start-paused start the VM in the paused state\n"
" --start-running start the VM running (for overriding --debug*)\n"
"\n"
# endif
"Expert options:\n"
" --disable-patm disable code patching (ignored by AMD-V/VT-x)\n"
" --disable-csam disable code scanning (ignored by AMD-V/VT-x)\n"
" --recompile-supervisor recompiled execution of supervisor code (*)\n"
" --recompile-user recompiled execution of user code (*)\n"
" --recompile-all recompiled execution of all code, with disabled\n"
" code patching and scanning\n"
" (*) For AMD-V/VT-x setups the effect is --recompile-all.\n"
"\n"
# ifdef VBOX_WITH_DEBUGGER_GUI
"The following environment (and extra data) variables are evaluated:\n"
" VBOX_GUI_DBG_ENABLED (GUI/Dbg/Enabled)\n"
" enable the GUI debug menu if set\n"
" VBOX_GUI_DBG_AUTO_SHOW (GUI/Dbg/AutoShow)\n"
" show debug windows at VM startup\n"
" VBOX_GUI_NO_DEBUGGER disable the GUI debug menu and debug windows\n"
# endif
"\n",
RTBldCfgVersion(),
mode.toLatin1().constData(),
dflt.toLatin1().constData());
/** @todo Show this as a dialog on windows. */
}
extern "C" DECLEXPORT(int) TrustedMain (int argc, char **argv, char ** /*envp*/)
{
LogFlowFuncEnter();
# if defined(RT_OS_DARWIN)
ShutUpAppKit();
# endif
for (int i=0; i<argc; i++)
if ( !strcmp(argv[i], "-h")
|| !strcmp(argv[i], "-?")
|| !strcmp(argv[i], "-help")
|| !strcmp(argv[i], "--help"))
{
showHelp();
return 0;
}
#if defined(DEBUG) && defined(Q_WS_X11) && defined(RT_OS_LINUX)
/* install our signal handler to backtrace the call stack */
struct sigaction sa;
sa.sa_sigaction = bt_sighandler;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO;
sigaction (SIGSEGV, &sa, NULL);
sigaction (SIGBUS, &sa, NULL);
sigaction (SIGUSR1, &sa, NULL);
#endif
#ifdef QT_MAC_USE_COCOA
/* Instantiate our NSApplication derivative before QApplication
* forces NSApplication to be instantiated. */
UICocoaApplication::instance();
#endif
qInstallMsgHandler (QtMessageOutput);
int rc = 1; /* failure */
/* scope the QApplication variable */
{
#ifdef Q_WS_X11
/* Qt has a complex algorithm for selecting the right visual which
* doesn't always seem to work. So we naively choose a visual - the
* default one - ourselves and pass that to Qt. This means that we
* also have to open the display ourselves.
* We check the Qt parameter list and handle Qt's -display argument
* ourselves, since we open the display connection. We also check the
* to see if the user has passed Qt's -visual parameter, and if so we
* assume that the user wants Qt to handle visual selection after all,
* and don't supply a visual. */
char *pszDisplay = NULL;
bool useDefaultVisual = true;
for (int i = 0; i < argc; ++i)
{
if (!::strcmp(argv[i], "-display") && (i + 1 < argc))
/* What if it isn't? Rely on QApplication to complain? */
{
pszDisplay = argv[i + 1];
++i;
}
else if (!::strcmp(argv[i], "-visual"))
useDefaultVisual = false;
}
Display *pDisplay = XOpenDisplay(pszDisplay);
if (!pDisplay)
{
RTPrintf(pszDisplay ? "Failed to open the X11 display \"%s\"!\n"
: "Failed to open the X11 display!\n",
pszDisplay);
return 0;
}
Visual *pVisual = useDefaultVisual
? DefaultVisual(pDisplay, DefaultScreen(pDisplay))
: NULL;
/* Now create the application object */
QApplication a (pDisplay, argc, argv, (Qt::HANDLE) pVisual);
#else /* Q_WS_X11 */
QApplication a (argc, argv);
#endif /* Q_WS_X11 */
/* Qt4.3 version has the QProcess bug which freezing the application
* for 30 seconds. This bug is internally used at initialization of
* Cleanlooks style. So we have to change this style to another one.
* See http://trolltech.com/developer/task-tracker/index_html?id=179200&method=entry
* for details. */
if (VBoxGlobal::qtRTVersionString().startsWith ("4.3") &&
qobject_cast <QCleanlooksStyle*> (QApplication::style()))
QApplication::setStyle (new QPlastiqueStyle);
#ifdef Q_OS_SOLARIS
/* Use plastique look 'n feel for Solaris instead of the default motif (Qt 4.7.x) */
QApplication::setStyle (new QPlastiqueStyle);
#endif
#ifdef Q_WS_X11
/* This patch is not used for now on Solaris & OpenSolaris because
* there is no anti-aliasing enabled by default, Qt4 to be rebuilt. */
#ifndef Q_OS_SOLARIS
/* Cause Qt4 has the conflict with fontconfig application as a result
* sometimes substituting some fonts with non scaleable-anti-aliased
* bitmap font we are reseting substitutes for the current application
* font family if it is non scaleable-anti-aliased. */
QFontDatabase fontDataBase;
QString currentFamily (QApplication::font().family());
bool isCurrentScaleable = fontDataBase.isScalable (currentFamily);
/*
LogFlowFunc (("Font: Current family is '%s'. It is %s.\n",
currentFamily.toLatin1().constData(),
isCurrentScaleable ? "scalable" : "not scalable"));
QStringList subFamilies (QFont::substitutes (currentFamily));
foreach (QString sub, subFamilies)
{
bool isSubScalable = fontDataBase.isScalable (sub);
LogFlowFunc (("Font: Substitute family is '%s'. It is %s.\n",
sub.toLatin1().constData(),
isSubScalable ? "scalable" : "not scalable"));
}
*/
QString subFamily (QFont::substitute (currentFamily));
bool isSubScaleable = fontDataBase.isScalable (subFamily);
if (isCurrentScaleable && !isSubScaleable)
QFont::removeSubstitution (currentFamily);
#endif /* Q_OS_SOLARIS */
#endif
#ifdef Q_WS_WIN
/* Drag in the sound drivers and DLLs early to get rid of the delay taking
* place when the main menu bar (or any action from that menu bar) is
* activated for the first time. This delay is especially annoying if it
* happens when the VM is executing in real mode (which gives 100% CPU
* load and slows down the load process that happens on the main GUI
* thread to several seconds). */
PlaySound (NULL, NULL, 0);
#endif
#ifdef Q_WS_MAC
::darwinDisableIconsInMenus();
#endif /* Q_WS_MAC */
#ifdef Q_WS_X11
/* version check (major.minor are sensitive, fix number is ignored) */
if (VBoxGlobal::qtRTVersion() < (VBoxGlobal::qtCTVersion() & 0xFFFF00))
{
QString msg =
QApplication::tr ("Executable <b>%1</b> requires Qt %2.x, found Qt %3.")
.arg (qAppName())
.arg (VBoxGlobal::qtCTVersionString().section ('.', 0, 1))
.arg (VBoxGlobal::qtRTVersionString());
QMessageBox::critical (
0, QApplication::tr ("Incompatible Qt Library Error"),
msg, QMessageBox::Abort, 0);
qFatal ("%s", msg.toAscii().constData());
}
#endif
/* load a translation based on the current locale */
VBoxGlobal::loadLanguage();
do
{
if (!vboxGlobal().isValid())
break;
if (vboxGlobal().processArgs())
return 0;
msgCenter().checkForMountedWrongUSB();
VBoxGlobalSettings settings = vboxGlobal().settings();
/* Process known keys */
bool noSelector = settings.isFeatureActive ("noSelector");
if (vboxGlobal().isVMConsoleProcess())
{
#ifdef VBOX_GUI_WITH_SYSTRAY
if (vboxGlobal().trayIconInstall())
{
/* Nothing to do here yet. */
}
#endif
if (vboxGlobal().startMachine (vboxGlobal().managedVMUuid()))
{
vboxGlobal().setMainWindow (vboxGlobal().vmWindow());
rc = a.exec();
}
}
else if (noSelector)
{
msgCenter().cannotRunInSelectorMode();
}
else
{
#ifdef VBOX_BLEEDING_EDGE
msgCenter().showBEBWarning();
#else
# ifndef DEBUG
/* Check for BETA version */
QString vboxVersion (vboxGlobal().virtualBox().GetVersion());
if (vboxVersion.contains ("BETA"))
{
/* Allow to prevent this message */
QString str = vboxGlobal().virtualBox().
GetExtraData(GUI_PreventBetaWarning);
if (str != vboxVersion)
msgCenter().showBETAWarning();
}
# endif
#endif
vboxGlobal().setMainWindow (&vboxGlobal().selectorWnd());
#ifdef VBOX_GUI_WITH_SYSTRAY
if (vboxGlobal().trayIconInstall())
{
/* Nothing to do here yet. */
}
if (false == vboxGlobal().isTrayMenu())
{
#endif
vboxGlobal().selectorWnd().show();
#ifdef VBOX_WITH_REGISTRATION_REQUEST
vboxGlobal().showRegistrationDialog (false /* aForce */);
#endif
#ifdef VBOX_GUI_WITH_SYSTRAY
}
do
{
#endif
rc = a.exec();
#ifdef VBOX_GUI_WITH_SYSTRAY
} while (vboxGlobal().isTrayMenu());
#endif
}
}
while (0);
}
LogFlowFunc (("rc=%d\n", rc));
LogFlowFuncLeave();
return rc;
}
#ifndef VBOX_WITH_HARDENING
int main (int argc, char **argv, char **envp)
{
/* Initialize VBox Runtime. Initialize the SUPLib as well only if we
* are really about to start a VM. Don't do this if we are only starting
* the selector window. */
bool fInitSUPLib = false;
for (int i = 1; i < argc; i++)
{
/* NOTE: the check here must match the corresponding check for the
* options to start a VM in hardenedmain.cpp and VBoxGlobal.cpp exactly,
* otherwise there will be weird error messages. */
if ( !::strcmp(argv[i], "--startvm")
|| !::strcmp(argv[i], "-startvm"))
{
fInitSUPLib = true;
break;
}
}
int rc = RTR3InitExe(argc, &argv, fInitSUPLib ? RTR3INIT_FLAGS_SUPLIB : 0);
if (RT_FAILURE(rc))
{
QApplication a (argc, &argv[0]);
#ifdef Q_OS_SOLARIS
/* Use plastique look 'n feel for Solaris instead of the default motif (Qt 4.7.x) */
QApplication::setStyle (new QPlastiqueStyle);
#endif
QString msgTitle = QApplication::tr ("VirtualBox - Runtime Error");
QString msgText = "<html>";
switch (rc)
{
case VERR_VM_DRIVER_NOT_INSTALLED:
case VERR_VM_DRIVER_LOAD_ERROR:
msgText += QApplication::tr (
"<b>Cannot access the kernel driver!</b><br/><br/>");
# ifdef RT_OS_LINUX
msgText += g_QStrHintLinuxNoDriver;
# else
msgText += g_QStrHintOtherNoDriver;
# endif
break;
# ifdef RT_OS_LINUX
case VERR_NO_MEMORY:
msgText += g_QStrHintLinuxNoMemory;
break;
# endif
case VERR_VM_DRIVER_NOT_ACCESSIBLE:
msgText += QApplication::tr ("Kernel driver not accessible");
break;
case VERR_VM_DRIVER_VERSION_MISMATCH:
# ifdef RT_OS_LINUX
msgText += g_QStrHintLinuxWrongDriverVersion;
# else
msgText += g_QStrHintOtherWrongDriverVersion;
# endif
break;
default:
msgText += QApplication::tr (
"Unknown error %2 during initialization of the Runtime"
).arg (rc);
break;
}
msgText += "</html>";
QMessageBox::critical (
0, /* parent */
msgTitle,
msgText,
QMessageBox::Abort, /* button0 */
0); /* button1 */
return 1;
}
return TrustedMain (argc, argv, envp);
}
#else /* VBOX_WITH_HARDENING */
/**
* Hardened main failed, report the error without any unnecessary fuzz.
*
* @remarks Do not call IPRT here unless really required, it might not be
* initialized.
*/
extern "C" DECLEXPORT(void) TrustedError (const char *pszWhere, SUPINITOP enmWhat, int rc, const char *pszMsgFmt, va_list va)
{
# if defined(RT_OS_DARWIN)
ShutUpAppKit();
# endif
/*
* Init the Qt application object. This is a bit hackish as we
* don't have the argument vector handy.
*/
int argc = 0;
char *argv[2] = { NULL, NULL };
QApplication a (argc, &argv[0]);
/*
* Compose and show the error message.
*/
QString msgTitle = QApplication::tr ("VirtualBox - Error In %1").arg (pszWhere);
char msgBuf[1024];
vsprintf (msgBuf, pszMsgFmt, va);
QString msgText = QApplication::tr (
"<html><b>%1 (rc=%2)</b><br/><br/>").arg (msgBuf).arg (rc);
switch (enmWhat)
{
case kSupInitOp_Driver:
# ifdef RT_OS_LINUX
msgText += g_QStrHintLinuxNoDriver;
# else
msgText += g_QStrHintOtherNoDriver;
# endif
break;
# ifdef RT_OS_LINUX
case kSupInitOp_IPRT:
if (rc == VERR_NO_MEMORY)
msgText += g_QStrHintLinuxNoMemory;
else
# endif
if (rc == VERR_VM_DRIVER_VERSION_MISMATCH)
# ifdef RT_OS_LINUX
msgText += g_QStrHintLinuxWrongDriverVersion;
# else
msgText += g_QStrHintOtherWrongDriverVersion;
# endif
else
msgText += g_QStrHintReinstall;
break;
case kSupInitOp_Integrity:
case kSupInitOp_RootCheck:
msgText += g_QStrHintReinstall;
break;
default:
/* no hints here */
break;
}
msgText += "</html>";
# ifdef RT_OS_LINUX
sleep(2);
# endif
QMessageBox::critical (
0, /* parent */
msgTitle, /* title */
msgText, /* text */
QMessageBox::Abort, /* button0 */
0); /* button1 */
qFatal ("%s", msgText.toAscii().constData());
}
#endif /* VBOX_WITH_HARDENING */
| Java |
<?php
// no direct access
defined('_JEXEC') or die('Restricted access'); ?>
<div class="jbBoxTopLeft"><div class="jbBoxTopRight"><div class="jbBoxTop">
<div class="jbTextHeader"><?php echo JText::_('COM_JOOBB_BOARDLEGEND'); ?></div>
</div></div></div>
<div class="jbBoxOuter"><div class="jbBoxInner">
<div class="jbLeft jbMargin10"><?php
$iconsBoard = $this->joobbIconSet->getIconsByGroup('iconBoard');
for ($i = 0, $n = count($iconsBoard); $i < $n; $i++) :
$icon = $iconsBoard[$i]; ?>
<div class="jbLeft jbPaddingRight20" style="text-align: center;">
<img src="<?php echo $icon->fileName; ?>" alt="<?php echo $icon->title; ?>" />
<div style="text-align: center;"><?php echo $icon->title; ?></div>
</div><?php
endfor; ?>
</div>
<br clear="all" />
</div></div>
<div class="jbBoxBottomLeft"><div class="jbBoxBottomRight"><div class="jbBoxBottom"></div></div></div>
<div class="jbMarginBottom10"></div> | Java |
<HTML
><HEAD
><TITLE
>Audio</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_JoystickClose"
HREF="sdljoystickclose.html"><LINK
REL="NEXT"
TITLE="SDL_AudioSpec"
HREF="sdlaudiospec.html"><META
NAME="KEYWORD"
CONTENT="audio"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="sdljoystickclose.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlaudiospec.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="AUDIO"
></A
>Chapter 10. Audio</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlaudiospec.html"
>SDL_AudioSpec</A
> -- Audio Specification Structure</DT
><DT
><A
HREF="sdlopenaudio.html"
>SDL_OpenAudio</A
> -- Opens the audio device with the desired parameters.</DT
><DT
><A
HREF="sdlpauseaudio.html"
>SDL_PauseAudio</A
> -- Pauses and unpauses the audio callback processing</DT
><DT
><A
HREF="sdlgetaudiostatus.html"
>SDL_GetAudioStatus</A
> -- Get the current audio state</DT
><DT
><A
HREF="sdlloadwav.html"
>SDL_LoadWAV</A
> -- Load a WAVE file</DT
><DT
><A
HREF="sdlfreewav.html"
>SDL_FreeWAV</A
> -- Frees previously opened WAV data</DT
><DT
><A
HREF="sdlaudiocvt.html"
>SDL_AudioCVT</A
> -- Audio Conversion Structure</DT
><DT
><A
HREF="sdlbuildaudiocvt.html"
>SDL_BuildAudioCVT</A
> -- Initializes a SDL_AudioCVT structure for conversion</DT
><DT
><A
HREF="sdlconvertaudio.html"
>SDL_ConvertAudio</A
> -- Convert audio data to a desired audio format.</DT
><DT
><A
HREF="sdlmixaudio.html"
>SDL_MixAudio</A
> -- Mix audio data</DT
><DT
><A
HREF="sdllockaudio.html"
>SDL_LockAudio</A
> -- Lock out the callback function</DT
><DT
><A
HREF="sdlunlockaudio.html"
>SDL_UnlockAudio</A
> -- Unlock the callback function</DT
><DT
><A
HREF="sdlcloseaudio.html"
>SDL_CloseAudio</A
> -- Shuts down audio processing and closes the audio device.</DT
></DL
></DIV
><P
>Sound on the computer is translated from waves that you hear into a series of
values, or samples, each representing the amplitude of the wave. When these
samples are sent in a stream to a sound card, an approximation of the original
wave can be recreated. The more bits used to represent the amplitude, and the
greater frequency these samples are gathered, the closer the approximated
sound is to the original, and the better the quality of sound.</P
><P
>This library supports both 8 and 16 bit signed and unsigned sound samples,
at frequencies ranging from 11025 Hz to 44100 Hz, depending on the
underlying hardware. If the hardware doesn't support the desired audio
format or frequency, it can be emulated if desired (See
<A
HREF="sdlopenaudio.html"
><TT
CLASS="FUNCTION"
>SDL_OpenAudio()</TT
></A
>)</P
><P
>A commonly supported audio format is 16 bits per sample at 22050 Hz.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdljoystickclose.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlaudiospec.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_JoystickClose</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_AudioSpec</TD
></TR
></TABLE
></DIV
></BODY
></HTML
> | Java |
<nav>
<ul>
<li><a href="">Usuaris</a></li>
</ul>
</nav> | Java |
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifndef LMP_FORCE_H
#define LMP_FORCE_H
#include "pointers.h"
#include <map>
#include <string>
namespace LAMMPS_NS {
class Force : protected Pointers {
public:
double boltz; // Boltzmann constant (eng/degree-K)
double hplanck; // Planck's constant (energy-time)
double mvv2e; // conversion of mv^2 to energy
double ftm2v; // conversion of ft/m to velocity
double mv2d; // conversion of mass/volume to density
double nktv2p; // conversion of NkT/V to pressure
double qqr2e; // conversion of q^2/r to energy
double qe2f; // conversion of qE to force
double vxmu2f; // conversion of vx dynamic-visc to force
double xxt2kmu; // conversion of xx/t to kinematic-visc
double dielectric; // dielectric constant
double qqrd2e; // q^2/r to energy w/ dielectric constant
double e_mass; // electron mass
double hhmrr2e; // conversion of (hbar)^2/(mr^2) to energy
double mvh2r; // conversion of mv/hbar to distance
// hbar = h/(2*pi)
double angstrom; // 1 angstrom in native units
double femtosecond; // 1 femtosecond in native units
double qelectron; // 1 electron charge abs() in native units
int newton,newton_pair,newton_bond; // Newton's 3rd law settings
class Pair *pair;
char *pair_style;
typedef Pair *(*PairCreator)(LAMMPS *);
std::map<std::string,PairCreator> *pair_map;
class Bond *bond;
char *bond_style;
class Angle *angle;
char *angle_style;
class Dihedral *dihedral;
char *dihedral_style;
class Improper *improper;
char *improper_style;
class KSpace *kspace;
char *kspace_style;
// index [0] is not used in these arrays
double special_lj[4]; // 1-2, 1-3, 1-4 prefactors for LJ
double special_coul[4]; // 1-2, 1-3, 1-4 prefactors for Coulombics
int special_angle; // 0 if defined angles are ignored
// 1 if only weight 1,3 atoms if in an angle
int special_dihedral; // 0 if defined dihedrals are ignored
// 1 if only weight 1,4 atoms if in a dihedral
int special_extra; // extra space for added bonds
Force(class LAMMPS *);
~Force();
void init();
void create_pair(const char *, const char *suffix = NULL);
class Pair *new_pair(const char *, const char *, int &);
class Pair *pair_match(const char *, int);
void create_bond(const char *, const char *suffix = NULL);
class Bond *new_bond(const char *, const char *, int &);
class Bond *bond_match(const char *);
void create_angle(const char *, const char *suffix = NULL);
class Angle *new_angle(const char *, const char *, int &);
void create_dihedral(const char *, const char *suffix = NULL);
class Dihedral *new_dihedral(const char *, const char *, int &);
void create_improper(const char *, const char *suffix = NULL);
class Improper *new_improper(const char *, const char *, int &);
void create_kspace(int, char **, const char *suffix = NULL);
class KSpace *new_kspace(int, char **, const char *, int &);
class KSpace *kspace_match(const char *, int);
void set_special(int, char **);
void bounds(char *, int, int &, int &, int nmin=1);
void boundsbig(char *, bigint, bigint &, bigint &, bigint nmin=1);
double numeric(const char *, int, char *);
int inumeric(const char *, int, char *);
bigint bnumeric(const char *, int, char *);
bigint memory_usage();
private:
template <typename T> static Pair *pair_creator(LAMMPS *);
};
}
#endif
/* ERROR/WARNING messages:
E: Invalid pair style
The choice of pair style is unknown.
E: Invalid bond style
The choice of bond style is unknown.
E: Invalid angle style
The choice of angle style is unknown.
E: Invalid dihedral style
The choice of dihedral style is unknown.
E: Invalid improper style
The choice of improper style is unknown.
E: Invalid kspace style
The choice of kspace style is unknown.
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Numeric index is out of bounds
A command with an argument that specifies an integer or range of
integers is using a value that is less than 1 or greater than the
maximum allowed limit.
*/
| Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.