aphakia/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
aphakia/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
aphakia/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
aphakia/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
aphakia/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
aphakia/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
aphakia/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
aphakia/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
aphakia/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
aphakia/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
aphakia/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
aphakia/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
aphakia/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
aphakia/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
aphakia/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
aphakia/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
aphakia/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
aphakia/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
aphakia/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
aphakia/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
aphakia/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
aphakia/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
aphakia/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
aphakia/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
aphakia/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
aphakia/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
aphakia/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
aphakia/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
aphakia/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
aphakia/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
aphakia/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
aphakia/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
aphakia/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
aphakia/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
aphakia/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
aphakia/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
aphakia/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
aphakia/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
aphakia/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
aphakia/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
ascian/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
ascian/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
ascian/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
ascian/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
ascian/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
ascian/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
ascian/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
ascian/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
ascian/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
ascian/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
ascian/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
ascian/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
ascian/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
ascian/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
ascian/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
ascian/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
ascian/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
ascian/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
ascian/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
ascian/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
ascian/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
ascian/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
ascian/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
ascian/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
ascian/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
ascian/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
ascian/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
ascian/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
ascian/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
ascian/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
ascian/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
ascian/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
ascian/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
ascian/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
ascian/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
ascian/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
ascian/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
ascian/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
ascian/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
ascian/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
ascian/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
ascian/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
bolognese/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
bolognese/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
bolognese/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
bolognese/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
bolognese/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
bolognese/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
bolognese/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
bolognese/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
bolognese/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
bolognese/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
bolognese/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
bolognese/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
bolognese/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
bolognese/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
bolognese/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
bolognese/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
bolognese/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
bolognese/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
bolognese/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
bolognese/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
bolognese/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
bolognese/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
bolognese/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
bolognese/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
bolognese/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
bolognese/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
bolognese/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
bolognese/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
bolognese/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
bolognese/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
bolognese/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
bolognese/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
bolognese/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
bolognese/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
bolognese/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
bolognese/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
bolognese/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
bolognese/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
bolognese/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
bolognese/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
breeze/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
breeze/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
breeze/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
breeze/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
breeze/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
breeze/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
breeze/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
breeze/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
breeze/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
breeze/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
breeze/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
breeze/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
breeze/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
breeze/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
breeze/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
breeze/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
breeze/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
breeze/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
breeze/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
breeze/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
breeze/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
breeze/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
breeze/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
breeze/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
breeze/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
breeze/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
breeze/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
breeze/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
breeze/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
breeze/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
breeze/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
breeze/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
breeze/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
breeze/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
breeze/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
breeze/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
breeze/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
breeze/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
breeze/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
breeze/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
breeze/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
breeze/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
celemin/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
celemin/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
celemin/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
celemin/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
celemin/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
celemin/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
celemin/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
celemin/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
celemin/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
celemin/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
celemin/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
celemin/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
celemin/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
celemin/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
celemin/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
celemin/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
celemin/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
celemin/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
celemin/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
celemin/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
celemin/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
celemin/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
celemin/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
celemin/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
celemin/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
celemin/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
celemin/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
celemin/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
celemin/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
celemin/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
celemin/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
celemin/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
celemin/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
celemin/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
celemin/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
celemin/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
celemin/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
celemin/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
celemin/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
celemin/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
celemin/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
celemin/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
coquilla/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
coquilla/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
coquilla/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
coquilla/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
coquilla/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
coquilla/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
coquilla/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
coquilla/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
coquilla/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
coquilla/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
coquilla/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
coquilla/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
coquilla/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
coquilla/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
coquilla/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
coquilla/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
coquilla/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
coquilla/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
coquilla/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
coquilla/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
coquilla/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
coquilla/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
coquilla/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
coquilla/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
coquilla/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
coquilla/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
coquilla/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
coquilla/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
coquilla/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
coquilla/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
coquilla/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
coquilla/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
coquilla/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
coquilla/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
coquilla/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
coquilla/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
coquilla/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
coquilla/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
coquilla/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
coquilla/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
filasse/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
filasse/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
filasse/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
filasse/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
filasse/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
filasse/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
filasse/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
filasse/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
filasse/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
filasse/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
filasse/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
filasse/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
filasse/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
filasse/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
filasse/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
filasse/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
filasse/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
filasse/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
filasse/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
filasse/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
filasse/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
filasse/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
filasse/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
filasse/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
filasse/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
filasse/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
filasse/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
filasse/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
filasse/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
filasse/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
filasse/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
filasse/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
filasse/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
filasse/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
filasse/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
filasse/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
filasse/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
filasse/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
filasse/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
filasse/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
filasse/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
filasse/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
gradable/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
gradable/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
gradable/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
gradable/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
gradable/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
gradable/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
gradable/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
gradable/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
gradable/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
gradable/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
gradable/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
gradable/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
gradable/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
gradable/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
gradable/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
gradable/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
gradable/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
gradable/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
gradable/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
gradable/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
gradable/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
gradable/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
gradable/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
gradable/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
gradable/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
gradable/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
gradable/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
gradable/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
gradable/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
gradable/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
gradable/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
gradable/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
gradable/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
gradable/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
gradable/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
gradable/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
gradable/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
gradable/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
gradable/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
gradable/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
gradable/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
gradable/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
harbinger/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
harbinger/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
harbinger/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
harbinger/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
harbinger/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
harbinger/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
harbinger/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
harbinger/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
harbinger/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
harbinger/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
harbinger/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
harbinger/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
harbinger/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
harbinger/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
harbinger/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
harbinger/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
harbinger/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
harbinger/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
harbinger/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
harbinger/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
harbinger/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
harbinger/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
harbinger/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
harbinger/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
harbinger/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
harbinger/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
harbinger/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
harbinger/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
harbinger/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
harbinger/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
harbinger/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
harbinger/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
harbinger/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
harbinger/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
harbinger/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
harbinger/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
harbinger/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
harbinger/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
harbinger/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
harbinger/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
kashima/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
kashima/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
kashima/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
kashima/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
kashima/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
kashima/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
kashima/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
kashima/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
kashima/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
kashima/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
kashima/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
kashima/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
kashima/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
kashima/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
kashima/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
kashima/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
kashima/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
kashima/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
kashima/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
kashima/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
kashima/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
kashima/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
kashima/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
kashima/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
kashima/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
kashima/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
kashima/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
kashima/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
kashima/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
kashima/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
kashima/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
kashima/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
kashima/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
kashima/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
kashima/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
kashima/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
kashima/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
kashima/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
kashima/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
kashima/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
kashima/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
kashima/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
knockdown/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
knockdown/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
knockdown/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
knockdown/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
knockdown/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
knockdown/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
knockdown/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
knockdown/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
knockdown/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
knockdown/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
knockdown/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
knockdown/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
knockdown/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
knockdown/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
knockdown/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
knockdown/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
knockdown/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
knockdown/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
knockdown/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
knockdown/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
knockdown/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
knockdown/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
knockdown/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
knockdown/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
knockdown/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
knockdown/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
knockdown/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
knockdown/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
knockdown/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
knockdown/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
knockdown/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
knockdown/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
knockdown/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
knockdown/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
knockdown/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
knockdown/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
knockdown/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
knockdown/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
knockdown/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
knockdown/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
manful/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
manful/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
manful/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
manful/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
manful/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
manful/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
manful/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
manful/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
manful/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
manful/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
manful/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
manful/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
manful/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
manful/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
manful/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
manful/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
manful/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
manful/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
manful/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
manful/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
manful/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
manful/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
manful/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
manful/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
manful/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
manful/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
manful/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
manful/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
manful/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
manful/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
manful/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
manful/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
manful/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
manful/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
manful/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
manful/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
manful/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
manful/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
manful/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
manful/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
manful/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
manful/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
maximal/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
maximal/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
maximal/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
maximal/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
maximal/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
maximal/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
maximal/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
maximal/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
maximal/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
maximal/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
maximal/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
maximal/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
maximal/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
maximal/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
maximal/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
maximal/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
maximal/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
maximal/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
maximal/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
maximal/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
maximal/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
maximal/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
maximal/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
maximal/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
maximal/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
maximal/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
maximal/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
maximal/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
maximal/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
maximal/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
maximal/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
maximal/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
maximal/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
maximal/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
maximal/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
maximal/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
maximal/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
maximal/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
maximal/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
maximal/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
maximal/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
maximal/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
periclase/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
periclase/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
periclase/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
periclase/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
periclase/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
periclase/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
periclase/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
periclase/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
periclase/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
periclase/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
periclase/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
periclase/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
periclase/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
periclase/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
periclase/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
periclase/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
periclase/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
periclase/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
periclase/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
periclase/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
periclase/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
periclase/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
periclase/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
periclase/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
periclase/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
periclase/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
periclase/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
periclase/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
periclase/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
periclase/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
periclase/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
periclase/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
periclase/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
periclase/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
periclase/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
periclase/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
periclase/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
periclase/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
periclase/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
periclase/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
periclase/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
periclase/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
poesis/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
poesis/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
poesis/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
poesis/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
poesis/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
poesis/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
poesis/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
poesis/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
poesis/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
poesis/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
poesis/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
poesis/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
poesis/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
poesis/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
poesis/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
poesis/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
poesis/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
poesis/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
poesis/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
poesis/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
poesis/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
poesis/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
poesis/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
poesis/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
poesis/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
poesis/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
poesis/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
poesis/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
poesis/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
poesis/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
poesis/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
poesis/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
poesis/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
poesis/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
poesis/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
poesis/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
poesis/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
poesis/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
poesis/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
poesis/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
poesis/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
poesis/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
proton/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
proton/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
proton/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
proton/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
proton/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
proton/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
proton/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
proton/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
proton/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
proton/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
proton/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
proton/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
proton/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
proton/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
proton/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
proton/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
proton/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
proton/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
proton/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
proton/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
proton/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
proton/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
proton/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
proton/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
proton/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
proton/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
proton/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
proton/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
proton/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
proton/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
proton/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
proton/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
proton/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
proton/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
proton/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
proton/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
proton/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
proton/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
proton/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
proton/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
proton/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
proton/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
recedence/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
recedence/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
recedence/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
recedence/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
recedence/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
recedence/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
recedence/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
recedence/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
recedence/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
recedence/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
recedence/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
recedence/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
recedence/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
recedence/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
recedence/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
recedence/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
recedence/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
recedence/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
recedence/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
recedence/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
recedence/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
recedence/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
recedence/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
recedence/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
recedence/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
recedence/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
recedence/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
recedence/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
recedence/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
recedence/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
recedence/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
recedence/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
recedence/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
recedence/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
recedence/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
recedence/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
recedence/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
recedence/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
recedence/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
recedence/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
recedence/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
recedence/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
scram/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
scram/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
scram/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
scram/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
scram/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
scram/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
scram/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
scram/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
scram/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
scram/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
scram/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
scram/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
scram/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
scram/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
scram/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
scram/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
scram/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
scram/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
scram/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
scram/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
scram/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
scram/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
scram/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
scram/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
scram/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
scram/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
scram/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
scram/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
scram/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
scram/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
scram/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
scram/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
scram/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
scram/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
scram/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
scram/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
scram/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
scram/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
scram/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
scram/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
scram/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
scram/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
server/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
server/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
server/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
server/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
server/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
server/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
server/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
server/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
server/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
server/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
server/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
server/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
server/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
server/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
server/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
server/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
server/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
server/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
server/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
server/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
server/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
server/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
server/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
server/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
server/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
server/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
server/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
server/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
server/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
server/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
server/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
server/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
server/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
server/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
server/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
server/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
server/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
server/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
server/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
server/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
server/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
server/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
shrubbish/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
shrubbish/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
shrubbish/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
shrubbish/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
shrubbish/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
shrubbish/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
shrubbish/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
shrubbish/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
shrubbish/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
shrubbish/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
shrubbish/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
shrubbish/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
shrubbish/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
shrubbish/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
shrubbish/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
shrubbish/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
shrubbish/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
shrubbish/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
shrubbish/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
shrubbish/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
shrubbish/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
shrubbish/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
shrubbish/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
shrubbish/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
shrubbish/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
shrubbish/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
shrubbish/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
shrubbish/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
shrubbish/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
shrubbish/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
shrubbish/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
shrubbish/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
shrubbish/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
shrubbish/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
shrubbish/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
shrubbish/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
shrubbish/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
shrubbish/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
sultam/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
sultam/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
sultam/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
sultam/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
sultam/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
sultam/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
sultam/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
sultam/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
sultam/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
sultam/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
sultam/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
sultam/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
sultam/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
sultam/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
sultam/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
sultam/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
sultam/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
sultam/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
sultam/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
sultam/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
sultam/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
sultam/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
sultam/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
sultam/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
sultam/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
sultam/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
sultam/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
sultam/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
sultam/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
sultam/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
sultam/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
sultam/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
sultam/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
sultam/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
sultam/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
sultam/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
sultam/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
sultam/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
sultam/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
sultam/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
sultam/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
sultam/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
virtuoso/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
virtuoso/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
virtuoso/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
virtuoso/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
virtuoso/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
virtuoso/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
virtuoso/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
virtuoso/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
virtuoso/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
virtuoso/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
virtuoso/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
virtuoso/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
virtuoso/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
virtuoso/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
virtuoso/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
virtuoso/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
virtuoso/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
virtuoso/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
virtuoso/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
virtuoso/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
virtuoso/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
virtuoso/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
virtuoso/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
virtuoso/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
virtuoso/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
virtuoso/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
virtuoso/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
virtuoso/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
virtuoso/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
virtuoso/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
virtuoso/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
virtuoso/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
virtuoso/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
virtuoso/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
virtuoso/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
virtuoso/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
virtuoso/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
virtuoso/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
wherrit/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
wherrit/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
wherrit/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wherrit/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wherrit/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
wherrit/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
wherrit/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
wherrit/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
wherrit/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
wherrit/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
wherrit/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wherrit/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
wherrit/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
wherrit/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
wherrit/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
wherrit/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
wherrit/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
wherrit/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
wherrit/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
wherrit/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
wherrit/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
wherrit/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
wherrit/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
wherrit/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
wherrit/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
wherrit/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
wherrit/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wherrit/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wherrit/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
wherrit/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
wherrit/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
wherrit/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
wherrit/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
wherrit/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
wherrit/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
wherrit/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
wherrit/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
wherrit/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
wherrit/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
wherrit/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
winsome/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
winsome/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
winsome/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
winsome/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
winsome/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
winsome/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
winsome/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
winsome/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
winsome/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
winsome/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
winsome/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
winsome/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
winsome/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
winsome/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
winsome/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
winsome/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
winsome/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
winsome/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
winsome/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
winsome/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
winsome/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
winsome/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
winsome/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
winsome/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
winsome/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
winsome/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
winsome/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
winsome/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
winsome/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
winsome/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
winsome/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
winsome/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
winsome/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
winsome/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
winsome/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
winsome/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
winsome/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
winsome/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
winsome/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
winsome/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
winsome/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
winsome/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
wirelike/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
wirelike/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/shared/Cryptography/ARC4.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "ARC4.h"
23 #include <openssl/sha.h>
24 
25 ARC4::ARC4(uint8 len)
26 {
27     EVP_CIPHER_CTX_init(&m_ctx);
28     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
29     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
30 }
31 
32 ARC4::ARC4(uint8 *seed, uint8 len)
33 {
34     EVP_CIPHER_CTX_init(&m_ctx);
35     EVP_EncryptInit_ex(&m_ctx, EVP_rc4(), NULLNULLNULL);
36     EVP_CIPHER_CTX_set_key_length(&m_ctx, len);
37     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
38 }
39 
40 ARC4::~ARC4()
41 {
42     EVP_CIPHER_CTX_cleanup(&m_ctx);
43 }
44 
45 void ARC4::Init(uint8 *seed)
46 {
47     EVP_EncryptInit_ex(&m_ctx, NULLNULL, seed, NULL);
48 }
49 
50 void ARC4::UpdateData(int len, uint8 *data)
51 {
52     int outlen = 0;
53     EVP_EncryptUpdate(&m_ctx, data, &outlen, data, len);
54     EVP_EncryptFinal_ex(&m_ctx, data, &outlen);
55 }
wirelike/dark
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wirelike/light
https://github.com/torvalds/linux/tree/master/drivers/media/rc/keymaps/rc-kworld-315u.c
 1 /* kworld-315u.h - Keytable for kworld_315u Remote Controller
 2  *
 3  * keymap imported from ir-keymaps.c
 4  *
 5  * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
 6  *
 7  * This program is free software; you can redistribute it and/or modify
 8  * it under the terms of the GNU General Public License as published by
 9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #include <media/rc-map.h>
14 
15 /* Kworld 315U
16  */
17 
18 static struct rc_map_table kworld_315u[] = {
19     { 0x6143, KEY_POWER },
20     { 0x6101, KEY_VIDEO },      /* source */
21     { 0x610b, KEY_ZOOM },
22     { 0x6103, KEY_POWER2 },     /* shutdown */
23 
24     { 0x6104, KEY_1 },
25     { 0x6108, KEY_2 },
26     { 0x6102, KEY_3 },
27     { 0x6109, KEY_CHANNELUP },
28 
29     { 0x610f, KEY_4 },
30     { 0x6105, KEY_5 },
31     { 0x6106, KEY_6 },
32     { 0x6107, KEY_CHANNELDOWN },
33 
34     { 0x610c, KEY_7 },
35     { 0x610d, KEY_8 },
36     { 0x610a, KEY_9 },
37     { 0x610e, KEY_VOLUMEUP },
38 
39     { 0x6110, KEY_LAST },
40     { 0x6111, KEY_0 },
41     { 0x6112, KEY_ENTER },
42     { 0x6113, KEY_VOLUMEDOWN },
43 
44     { 0x6114, KEY_RECORD },
45     { 0x6115, KEY_STOP },
46     { 0x6116, KEY_PLAY },
47     { 0x6117, KEY_MUTE },
48 
49     { 0x6118, KEY_UP },
50     { 0x6119, KEY_DOWN },
51     { 0x611a, KEY_LEFT },
52     { 0x611b, KEY_RIGHT },
53 
54     { 0x611c, KEY_RED },
55     { 0x611d, KEY_GREEN },
56     { 0x611e, KEY_YELLOW },
57     { 0x611f, KEY_BLUE },
58 };
59 
60 static struct rc_map_list kworld_315u_map = {
61     .map = {
62         .scan    = kworld_315u,
63         .size    = ARRAY_SIZE(kworld_315u),
64         .rc_type = RC_TYPE_NEC,
65         .name    = RC_MAP_KWORLD_315U,
66     }
67 };
68 
69 static int __init init_rc_map_kworld_315u(void)
70 {
71     return rc_map_register(&kworld_315u_map);
72 }
73 
74 static void __exit exit_rc_map_kworld_315u(void)
75 {
76     rc_map_unregister(&kworld_315u_map);
77 }
78 
79 module_init(init_rc_map_kworld_315u)
80 module_exit(exit_rc_map_kworld_315u)
81 
82 MODULE_LICENSE("GPL");
83 MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
wirelike/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
wirelike/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/NHSpecificTest/NH1289/Fixture.cs
 1 <feff>using System;^M
 2 using System.Collections.Generic;^M
 3 using System.Text;^M
 4 using Iesi.Collections.Generic;^M
 5 using NUnit.Framework;^M
 6 ^M
 7 namespace NHibernate.Test.NHSpecificTest.NH1289^M
 8 {^M
 9     [TestFixture,Ignore]^M
10     public class Fixture:BugTestCase^M
11     {^M
12         protected override void OnSetUp()^M
13         {^M
14             using(var ses=OpenSession())^M
15             using(var tran=ses.BeginTransaction())^M
16             {^M
17                 var purchaseOrder = new Cons_PurchaseOrder^M
18                                         {^M
19                                             PurchaseItems = new HashedSet<PurchaseItem>(),^M
20                                         };^M
21                 var product = new Cons_Product^M
22                                 {^M
23                                     ProductName = "abc",^M
24                                     Units = 5,^M
25                                     Price = "123",^M
26                                     Description = "desc",^M
27                                     ImageName = "abc"^M
28                                 };^M
29 ^M
30 ^M
31                 var purchaseItem = new Cons_PurchaseItem^M
32                                     {^M
33                                         Product = product,^M
34                                         PurchaseOrder = purchaseOrder^M
35                                     };^M
36                 purchaseOrder.PurchaseItems.Add(purchaseItem);^M
37                 ses.Save(product);^M
38                 ses.Save(purchaseOrder);^M
39                 ses.Save(purchaseItem);^M
40 ^M
41                 tran.Commit();^M
42             }^M
43                 ^M
44             ^M
45         }^M
46         protected override void OnTearDown()^M
47         {^M
48             using (var ses = OpenSession())^M
49             using (var tran = ses.BeginTransaction())^M
50             {^M
51                 ses.Delete("from Cons_PurchaseOrder");^M
52                 ses.Delete("from Cons_PurchaseItem");^M
53                 ses.Delete("from Cons_Product");^M
54                 tran.Commit();^M
55             }^M
56         }^M
57 ^M
58         [Test]^M
59         public void ManyToOne_gets_implicit_polymorphism_correctly()^M
60         {^M
61             using (var ses = OpenSession())^M
62             using (var tran = ses.BeginTransaction())^M
63             {^M
64                 var purchaseItem = ses.Get<PurchaseItem>(1);^M
65                 Assert.That(purchaseItem, Is.AssignableFrom(typeof(Cons_PurchaseItem)));^M
66                 Assert.That(purchaseItem.Product, Is.AssignableFrom(typeof(Cons_Product)));^M
67                 tran.Commit();^M
68             }^M
69         }^M
70     }^M
71 }^M
wirelike/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
wirelike/light
https://github.com/mirrors/linux-2.6/tree/master/arch/mips/include/asm/mach-loongson/cpu-feature-overrides.h
 1 /*
 2  * This file is subject to the terms and conditions of the GNU General Public
 3  * License.  See the file "COPYING" in the main directory of this archive
 4  * for more details.
 5  *
 6  * Copyright (C) 2009 Wu Zhangjin <wuzhangjin@gmail.com>
 7  * Copyright (C) 2009 Philippe Vachon <philippe@cowpig.ca>
 8  * Copyright (C) 2009 Zhang Le <r0bertz@gentoo.org>
 9  *
10  * reference: /proc/cpuinfo,
11  *  arch/mips/kernel/cpu-probe.c(cpu_probe_legacy),
12  *  arch/mips/kernel/proc.c(show_cpuinfo),
13  *      loongson2f user manual.
14  */
15 
16 #ifndef __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
17 #define __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H
18 
19 #define cpu_dcache_line_size()  32
20 #define cpu_icache_line_size()  32
21 #define cpu_scache_line_size()  32
22 
23 
24 #define cpu_has_32fpr       1
25 #define cpu_has_3k_cache    0
26 #define cpu_has_4k_cache    1
27 #define cpu_has_4kex        1
28 #define cpu_has_64bits      1
29 #define cpu_has_cache_cdex_p    0
30 #define cpu_has_cache_cdex_s    0
31 #define cpu_has_counter     1
32 #define cpu_has_dc_aliases  (PAGE_SIZE < 0x4000)
33 #define cpu_has_divec       0
34 #define cpu_has_dsp     0
35 #define cpu_has_ejtag       0
36 #define cpu_has_fpu     1
37 #define cpu_has_ic_fills_f_dc   0
38 #define cpu_has_inclusive_pcaches   1
39 #define cpu_has_llsc        1
40 #define cpu_has_mcheck      0
41 #define cpu_has_mdmx        0
42 #define cpu_has_mips16      0
43 #define cpu_has_mips32r1    0
44 #define cpu_has_mips32r2    0
45 #define cpu_has_mips3d      0
46 #define cpu_has_mips64r1    0
47 #define cpu_has_mips64r2    0
48 #define cpu_has_mipsmt      0
49 #define cpu_has_prefetch    0
50 #define cpu_has_smartmips   0
51 #define cpu_has_tlb     1
52 #define cpu_has_tx39_cache  0
53 #define cpu_has_userlocal   0
54 #define cpu_has_vce     0
55 #define cpu_has_veic        0
56 #define cpu_has_vint        0
57 #define cpu_has_vtag_icache 0
58 #define cpu_has_watch       1
59 
60 #endif /* __ASM_MACH_LOONGSON_CPU_FEATURE_OVERRIDES_H */
wirelike/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
wirelike/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/package.lisp
 1 (defpackage :postmodern
 2   (:use #-postmodern-use-mop :common-lisp
 3         #+postmodern-use-mop :closer-common-lisp
 4         :s-sql :cl-postgres)
 5   (:nicknames :pomo)
 6 
 7   #+postmodern-use-mop
 8   (:export
 9    #:dao-class #:dao-exists-p #:dao-keys #:query-dao #:select-dao #:get-dao
10    #:with-column-writers
11    #:insert-dao #:update-dao #:save-dao #:save-dao/transaction #:delete-dao #:make-dao
12    #:define-dao-finalization
13    #:dao-table-name #:dao-table-definition
14    #:\!dao-def #:*ignore-unknown-columns*)
15    
16   (:export 
17    #:connect #:disconnect #:reconnect
18    #:call-with-connection #:with-connection
19    #:*database* #:connected-p #:database-connection
20    #:connect-toplevel #:disconnect-toplevel
21    #:clear-connection-pool #:*max-pool-size* #:*default-use-ssl*
22    #:query #:execute #:doquery
23    #:prepare #:defprepared #:defprepared-with-names
24    #:sequence-next #:list-sequences #:sequence-exists-p
25    #:list-tables #:table-exists-p #:table-description
26    #:list-views #:view-exists-p
27    #:with-transaction #:commit-transaction #:abort-transaction
28    #:with-savepoint #:rollback-savepoint #:release-savepoint
29    #:db-null #:coalesce
30 
31    #:deftable #:*table-name* #:*table-symbol*
32    #:create-table #:create-all-tables #:create-package-tables
33    #:\!index #:\!unique-index #:\!foreign #:\!unique
34 
35    ;; Reduced S-SQL interface
36    #:sql #:sql-compile
37    #:smallint #:bigint #:numeric #:real #:double-precision
38    #:bytea #:text #:varchar
39    #:*escape-sql-names-p* #:sql-escape-string #:sql-escape #:register-sql-operators
40    #:sql-error
41 
42    ;; Condition type from cl-postgres
43    #:database-error #:database-error-message #:database-error-code
44    #:database-error-detail #:database-error-query #:database-error-cause
45    #:database-connection-error))
46 
47 (in-package :postmodern)
wirelike/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wirelike/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
wirelike/light
https://github.com/erlang/otp/tree/master/lib/gs/doc/src/examples/ex7.erl
 1 -module(ex7).
 2 -copyright('Copyright (c) 1991-97 Ericsson Telecom AB').
 3 -vsn('$Revision: /main/release/2 $ ').
 4 
 5 -export([mk_window/0]).
 6 
 7 mk_window() ->
 8     S= gs:start(),
 9     Win= gs:create(window,S,[{motion,true},{map,true}]),
10     gs:config(Win,[{configure,true},{keypress,true}]),
11     gs:config(Win,[{buttonpress,true}]),
12     gs:config(Win,[{buttonrelease,true}]),
13     event_loop(Win).
14 
15 event_loop(Win->      
16     receive
17         {gs,Win,motion,Data,[X,Y | Rest]} ->
18             %% mouse moved to position X Y
19             io:format("mouse moved to X:~w  Y:~w~n",[X,Y]);
20         {gs,Win,configure,Data,[W,H | Rest]} ->
21             %% window was resized by user
22             io:format("window resized W:~w  H:~w~n",[W,H]);
23         {gs,Win,buttonpress,Data,[1,X,Y | Rest]} -> 
24             %% button 1 was pressed at location X Y
25             io:format("button 1 pressed X:~w  Y:~w~n",[X,Y]);
26         {gs,Win,buttonrelease,Data,[_,X,Y | Rest]} ->
27             %% Any button (1-3) was released over X Y
28             io:format("Any button released X:~w  Y:~w~n",[X,Y]);
29         {gs,Win,keypress,Data,[a | Rest]} -> 
30             %% key `a' was pressed in window
31             io:format("key a was pressed in window~n");
32         {gs,Win,keypress,Data,[_,65,1 | Rest]} ->
33             %% Key shift-a
34             io:format("shift-a was pressed in window~n");
35         {gs,Win,keypress,Data,[c,_,_,1 | Rest]} ->
36             %% CTRL_C pressed
37             io:format("CTRL_C was pressed in window~n");
38         {gs,Win,keypress,Data['Return' | Rest]} ->
39             %% Return key pressed
40             io:format("Return key was pressed in window~n")
41         end,
42     event_loop(Win).
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
wirelike/light
https://github.com/erlang/otp/tree/master/lib/compiler/src/beam_disasm.hrl
 1 %% -*- erlang-indent-level: 4 -*-
 2 %%
 3 %% %CopyrightBegin%
 4 %% 
 5 %% Copyright Ericsson AB 2007-2009. All Rights Reserved.
 6 %% 
 7 %% The contents of this file are subject to the Erlang Public License,
 8 %% Version 1.1, (the "License"); you may not use this file except in
 9 %% compliance with the License. You should have received a copy of the
10 %% Erlang Public License along with this software. If not, it can be
11 %% retrieved online at http://www.erlang.org/.
12 %% 
13 %% Software distributed under the License is distributed on an "AS IS"
14 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15 %% the License for the specific language governing rights and limitations
16 %% under the License.
17 %% 
18 %% %CopyrightEnd%
19 %%
20 %% Purpose: Exposes type definitions used also in other parts of
21 %%      the system (e.g. in the translation from Beam to Icode).
22 
23 %%
24 %% XXX: THE FOLLOWING TYPE DECLARATION DOES NOT BELONG HERE...
25 %%
26 -type beam_instr() :: 'bs_init_writable' | 'fclearerror' | 'if_end'
27                     | 'remove_message' | 'return' | 'send' | 'timeout'
28                     | tuple().  %% XXX: Very underspecified - FIX THIS
29 
30 %%-----------------------------------------------------------------------
31 %% Record definitions
32 %%-----------------------------------------------------------------------
33 
34 -record(function{name      :: atom(),
35        arity     :: byte(),
36        entry,    %% unused ??
37        code = [] :: [beam_instr()]}).
38 
39 -record(beam_file{module               :: module(),
40         labeled_exports = [] :: [beam_lib:labeled_entry()],
41         attributes      = [] :: [beam_lib:attrib_entry()],
42         compile_info    = [] :: [beam_lib:compinfo_entry()],
43         code            = [] :: [#function{}]}).
wirelike/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
wirelike/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/UI/Vte.hs
 1 module Yi.UI.Vte (start) where
 2 
 3 import Prelude ()
 4 import Yi.Prelude
 5 
 6 import Graphics.UI.Gtk
 7 import Graphics.UI.Gtk.Vte.Vte
 8 import System.Environment
 9 import System.Environment.Executable
10 import System.Glib
11 
12 import Yi.Config
13 import Yi.Style
14 import qualified Yi.UI.Common as Common
15 
16 start :: UIBoot
17 start cfg ch outCh editor =
18     catchGError (initUI cfg ch outCh editor) (\(GError _dom _code msg) -> fail msg)
19 
20 initUI :: UIBoot
21 initUI cfg _ch _outCh _editor = do
22     discard unsafeInitGUIForThreadedRTS
23     setApplicationName "Yi"
24 
25     -- Setup window
26     win <- windowNew
27     discard $ win `onDestroy` mainQuit
28 
29     -- Setup vte
30     exe  <- getExecutablePath
31     term <- terminalNew
32     discard $ Graphics.UI.Gtk.on term childExited $ end False
33 
34     -- Set default colors
35     terminalSetColors term
36         (getBaseAttrColor foreground black cfg)
37         (getBaseAttrColor background brightwhite cfg)
38         (Color 0 0 0)
39         0
40 
41     -- Start running Yi
42     args <- getArgs
43     discard $ terminalForkCommand term
44         (Just exe) (Just $ exe : args ++ ["-fvty"]) Nothing Nothing False False False
45 
46     discard $ set win [ containerChild := term ]
47     widgetShowAll win
48 
49     return $ Common.dummyUI
50       { Common.main = main
51       , Common.end  = end
52       }
53 
54 main :: IO ()
55 main = mainGUI
56 
57 end :: Bool -> IO ()
58 end = const mainQuit
59 
60 getBaseAttrColor :: (Attributes -> Yi.Style.Color) -> Yi.Style.Color
61                  -> Config -> Graphics.UI.Gtk.Color
62 getBaseAttrColor p d cfg = mkCol $
63     case p $ baseAttributes $ configStyle $ configUI cfg of
64       Default -> d
65       c -> c
66 
67 mkCol :: Yi.Style.Color -> Graphics.UI.Gtk.Color
68 mkCol Default     = Color 0 0 0
69 mkCol (RGB x y z) = Color (fromIntegral x * 256)
70                           (fromIntegral y * 256)
71                           (fromIntegral z * 256)
wirelike/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
wirelike/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/event/entity/CreeperPowerEvent.java
 1 package org.bukkit.event.entity;
 2 
 3 import org.bukkit.entity.Entity;
 4 import org.bukkit.event.Cancellable;
 5 
 6 /**
 7  * Called when a Creeper is struck by lightning.
 8  *<p />
 9  * If a Creeper Power event is cancelled, the Creeper will not be powered.
10  */
11 public class CreeperPowerEvent extends EntityEvent implements Cancellable {
12 
13     private boolean canceled;
14     private Entity creeper;
15     private PowerCause cause;
16     private Entity bolt;
17 
18     public CreeperPowerEvent(Entity creeper, Entity bolt, PowerCause cause) {
19         super(Type.CREEPER_POWER, creeper);
20         this.creeper = creeper;
21         this.bolt = bolt;
22         this.cause = cause;
23     }
24 
25     public CreeperPowerEvent(Entity creeper, PowerCause cause) {
26         super(Type.CREEPER_POWER, creeper);
27         this.creeper = creeper;
28         this.cause = cause;
29         this.bolt = null;
30     }
31 
32     public boolean isCancelled() {
33         return canceled;
34     }
35 
36     public void setCancelled(boolean cancel) {
37         canceled = cancel;
38     }
39 
40     /**
41      * Gets the lightning bolt which is striking the Creeper.
42      *
43      * @return The Entity for the lightning bolt which is striking the Creeper
44      */
45     public Entity getLightning() {
46         return bolt;
47     }
48 
49     /**
50      * Gets the cause of the creeper being (un)powered.
51      *
52      * @return A PowerCause value detailing the cause of change in power.
53      */
54     public PowerCause getCause() {
55         return cause;
56     }
57 
58     /**
59      * An enum to specify the cause of the change in power
60      */
61     public enum PowerCause {
62 
63         /**
64          * Power change caused by a lightning bolt
65          * Powered state: true
66          */
67         LIGHTNING,
68         /**
69          * Power change caused by something else (probably a plugin)
70          * Powered state: true
71          */
72         SET_ON,
73         /**
74          * Power change caused by something else (probably a plugin)
75          * Powered state: false
76          */
77         SET_OFF
78     }
79 }
wirelike/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
wirelike/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/lazy-load.js
 1 // Copyright 2008 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Test unusual way of accessing Date.
29 var date0 = new this["Date"](1111);
30 assertEquals(1111, date0.getTime());
31 
32 // Check that regexp literals use original RegExp (non-ECMA-262).
33 RegExp = 42;
34 var re = /test/;
wirelike/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
wirelike/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/BodyFSM/OpDemo/bodyApproach.lua
 1 module(..., package.seeall);
 2 
 3 require('Body')
 4 require('wcm')
 5 require('walk')
 6 require('vector')
 7 
 8 t0 = 0;
 9 timeout = 10.0;
10 
11 -- maximum walk velocity
12 maxStep = 0.025;
13 
14 -- ball detection timeout
15 tLost = 3.0;
16 
17 -- kick threshold
18 xKick = 0.16;
19 xTarget = 0.14;
20 yKickMin = 0.01;
21 yKickMax = 0.05;
22 yTarget0 = 0.04;
23 
24 -- maximum ball distance threshold
25 rFar = 0.45;
26 
27 function entry()
28   print("Body FSM:".._NAME.." entry");
29   t0 = Body.get_time();
30   ball = wcm.get_ball();
31   yTarget= sign(ball.y) * yTarget0;
32 end
33 
34 function update()
35   local t = Body.get_time();
36 
37   -- get ball position
38   ball = wcm.get_ball();
39   ballR = math.sqrt(ball.x^2 + ball.y^2);
40 
41   -- calculate walk velocity based on ball position
42   vStep = vector.new({0,0,0});
43   vStep[1] = .6*(ball.x - xTarget);
44   vStep[2] = .75*(ball.y - yTarget);
45   scale = math.min(maxStep/math.sqrt(vStep[1]^2+vStep[2]^2), 1);
46   vStep = scale*vStep;
47 
48   ballA = math.atan2(ball.y - math.max(math.min(ball.y, 0.05), -0.05),
49             ball.x+0.10);
50   vStep[3] = 0.5*ballA;
51   walk.set_velocity(vStep[1],vStep[2],vStep[3]);
52 
53 
54   if (t - ball.t > tLost) then
55     return "ballLost";
56   end
57   if (t - t0 > timeout) then
58     return "timeout";
59   end
60   if (ballR > rFar) then
61     return "ballFar";
62   end
63 
64   if ((ball.x < xKick) and (math.abs(ball.y) < yKickMax) and
65       (math.abs(ball.y) > yKickMin)) then
66     return "kick";
67   end
68   if (t - t0 > 1.0 and Body.get_sensor_button()[1] > 0then
69     return "button";
70   end
71 end
72 
73 function exit()
74 end
75 
76 function sign(x)
77   if (x > 0then return 1;
78   elseif (x < 0then return -1;
79   else return 0;
80   end
81 end
wirelike/dark
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
wirelike/light
https://github.com/facebook/three20/tree/master/src/extThree20JSON/Vendors/YAJL/NSBundle+YAJL.m
 1 //
 2 //  NSBundle+YAJL.m
 3 //  YAJL
 4 //
 5 //  Created by Gabriel Handford on 7/23/09.
 6 //  Copyright 2009. All rights reserved.
 7 //
 8 //  Permission is hereby granted, free of charge, to any person
 9 //  obtaining a copy of this software and associated documentation
10 //  files (the "Software"), to deal in the Software without
11 //  restriction, including without limitation the rights to use,
12 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
13 //  copies of the Software, and to permit persons to whom the
14 //  Software is furnished to do so, subject to the following
15 //  conditions:
16 //
17 //  The above copyright notice and this permission notice shall be
18 //  included in all copies or substantial portions of the Software.
19 //
20 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 //  OTHER DEALINGS IN THE SOFTWARE.
28 //
29 
30 #import "extThree20JSON/NSBundle+YAJL.h"
31 #import "extThree20JSON/NSObject+YAJL.h"
32 #import "extThree20JSON/private/GHNSBundle+Utils.h"
33 
34 // Core
35 #import "Three20Core/TTCorePreprocessorMacros.h"
36 
37 TT_FIX_CATEGORY_BUG(NSBundle_YAJL)
38 
39 @implementation NSBundle(YAJL)
40 
41 (id)yajl_JSONFromResource:(NSString *)resource {
42   NSError *error = nil;
43   id JSONValue = [self yajl_JSONFromResource:resource options:YAJLParserOptionsNone error:&error];
44   if (error) [NSException raise:YAJLParserException format:[error localizedDescription], nil];
45   return JSONValue;
46 }
47 
48 (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error {
49   return [[self yajl_gh_loadStringDataFromResource:resource] yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
50 }
51 
52 @end
wirelike/dark
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
wirelike/light
https://github.com/gimenete/iOS-boilerplate/tree/master/IOSBoilerplate/BaseViewController.h
 1 //
 2 //  BaseViewController.h
 3 //
 4 //  Copyright (c) 2011 Alberto Gimeno Brieba
 5 //  
 6 //  Permission is hereby granted, free of charge, to any person
 7 //  obtaining a copy of this software and associated documentation
 8 //  files (the "Software"), to deal in the Software without
 9 //  restriction, including without limitation the rights to use,
10 //  copy, modify, merge, publish, distribute, sublicense, and/or sell
11 //  copies of the Software, and to permit persons to whom the
12 //  Software is furnished to do so, subject to the following
13 //  conditions:
14 //  
15 //  The above copyright notice and this permission notice shall be
16 //  included in all copies or substantial portions of the Software.
17 //  
18 //  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 //  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 //  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 //  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 //  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 //  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 //  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 //  OTHER DEALINGS IN THE SOFTWARE.
26 //  
27 
28 
29 #import <UIKit/UIKit.h>
30 #import "ASIHTTPRequest.h"
31 #import "ASIFormDataRequest.h"
32 
33 @interface BaseViewController : UIViewController {
34   
35   NSMutableArray* requests;
36   
37 }
38 
39 (ASIHTTPRequest*) requestWithURL:(NSString*) s;
40 (ASIFormDataRequest*) formRequestWithURL:(NSString*) s;
41 (void) addRequest:(ASIHTTPRequest*)request;
42 (void) clearFinishedRequests;
43 (void) cancelRequests;
44 
45 (void) refreshCellsWithImage:(UIImage*)image fromURL:(NSURL*)url inTable:(UITableView*)tableView;
46 
47 @end
wirelike/dark
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wirelike/light
https://github.com/mirrors/perl/tree/master/Porting/checkansi.pl
  1 #!/usr/bin/perl -w
  2 use strict;
  3 use warnings;
  4 use 5.010;
  5 use File::Find;
  6 use IO::File;
  7 use Getopt::Long;
  8 use Pod::Usage;
  9 
 10 my %limits = (
 11   c90 => {
 12            'logical-source-line-length' => 509,
 13          },
 14   c99 => {
 15            'logical-source-line-length' => 4095,
 16          },
 17 );
 18 
 19 my %opt = (
 20   std => 'c99',
 21 );
 22 
 23 GetOptions(\%optqw( logical-source-line-length=i std=s ))
 24   && @ARGV && exists $limits{$opt{std}}
 25     or pod2usage(2);
 26 
 27 for my $k (keys %{$limits{$opt{std}}}) {
 28   $opt{$k} //= $limits{$opt{std}}{$k};
 29 }
 30 
 31 {
 32   my $num = 1;
 33 
 34   sub report
 35   {
 36     my $msg = shift;
 37     my $info = join ''@_;
 38 
 39     if ($info) {
 40       $info =~ s/\R+$//;
 41       $info =~ s/^/   #|\t/mg;
 42       $info = "\n$info\n\n";
 43     }
 44 
 45     warn sprintf "[%d] %s(%d): %s\n%s",
 46          $num++, $File::Find::name$.$msg$info;
 47   }
 48 }
 49 
 50 find(sub {
 51   /\.([ch]|xs)$/ or return;
 52 
 53   my $fh = IO::File->new($_or die "$_$!\n";
 54   my $ll = '';
 55 
 56   while (defined(my $line = <$fh>)) {
 57     report("trailing whitespace after backslash"$line)
 58         if $line =~ /\\[[:blank:]]+$/;
 59 
 60     $ll .= $line;
 61 
 62     unless ($ll =~ /\\$/) {
 63       if (length $ll > $opt{'logical-source-line-length'}) {
 64         report(sprintf("logical source line too long (%d > %d)",
 65                        length $ll$opt{'logical-source-line-length'}), $ll);
 66       }
 67       $ll = '';
 68     }
 69   }
 70 }, @ARGV);
 71 
 72 __END__
 73 
 74 =head1 NAME
 75 
 76 checkansi.pl - Check source code for ANSI-C violations
 77 
 78 =head1 SYNOPSIS
 79 
 80 checkansi.pl [B<--std>=c90|c99]
 81 [B<--logical-source-line-length>=I<num>]
 82 <path> ...
 83 
 84 =head1 DESCRIPTION
 85 
 86 B<checkansi.pl> searches 
 87 
 88 =head1 OPTIONS
 89 
 90 =over 4
 91 
 92 =item B<--std>=c90|c99
 93 
 94 Choose the ANSI/ISO standard against which shall be checked.
 95 Defaults to C<c99>.
 96 
 97 =item B<--logical-source-line-length>=I<number>
 98 
 99 Maximum length of a logical source line. Overrides the default
100 given by the chosen standard.
101 
102 =back
103 
104 =head1 COPYRIGHT
105 
106 Copyright 2007 by Marcus Holland-Moritz <mhx@cpan.org>.
107 
108 This program is free software; you may redistribute it
109 and/or modify it under the same terms as Perl itself.
110 
111 =cut
wirelike/dark
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
wirelike/light
https://github.com/zendframework/zf2/tree/master/library/Zend/Markup/Renderer/Markup.php
 1 <?php
 2 /**
 3  * Zend Framework
 4  *
 5  * LICENSE
 6  *
 7  * This source file is subject to the new BSD license that is bundled
 8  * with this package in the file LICENSE.txt.
 9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Markup
17  * @subpackage Renderer_Markup
18  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
20  */
21 
22 /**
23  * @namespace
24  */
25 namespace Zend\Markup\Renderer;
26 
27 use Zend\Markup\Token,
28     Zend\Filter\Filter;
29 
30 /**
31  * Interface for a markup
32  *
33  * @uses       \Zend\Markup\Renderer\AbstractRenderer
34  * @category   Zend
35  * @package    Zend_Markup
36  * @subpackage Renderer_Markup
37  * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
38  * @license    http://framework.zend.com/license/new-bsd    ; New BSD License
39  */
40 interface Markup extends Filter
41 {
42 
43     /**
44      * Set the encoding on this markup
45      *
46      * @param string $encoding
47      *
48      * @return \Zend\Markup\Renderer\Markup
49      */
50     public function setEncoding($encoding = 'UTF-8');
51 
52     /**
53      * Set the renderer on this markup
54      *
55      * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
56      *
57      * @return \Zend\Markup\Renderer\Markup
58      */
59     public function setRenderer(AbstractRenderer $renderer);
60 
61     /**
62      * Invoke the markup
63      *
64      * @param \Zend\Markup\Token $token
65      * @param string $text
66      *
67      * @return string
68      */
69     public function __invoke(Token $token$text);
70 }
wirelike/dark
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
wirelike/light
https://github.com/playframework/play/tree/master/framework/pym/play/commands/help.py
 1 # Display help
 2 
 3 import sys, os
 4 
 5 COMMANDS = ['help']
 6 
 7 HELP = {
 8     'help''Display help on a specific command'
 9 }
10 
11 def execute(**kargs):
12     command = kargs.get("command")
13     app = kargs.get("app")
14     args = kargs.get("args")
15     play_env = kargs.get("env")
16     cmdloader = kargs.get("cmdloader")
17 
18     if len(sys.argv) == 3:
19         cmd = sys.argv[2]
20         help_file = os.path.join(play_env["basedir"], 'documentation''commands''cmd-%s.txt' % cmd)
21         if os.path.exists(help_file):
22             print open(help_file, 'r').read()
23         else:
24             print '~ Oops, command \'%s\' not found. Try just \'play help\' to list all commands.' % cmd
25             print '~'
26             sys.exit(-1)
27     else:
28         main_help(cmdloader.commands, play_env)
29 
30 def main_help(commands, play_env):
31     modules_commands = []
32     print "~ For all commands, if the application is not specified, the current directory is used"
33     print "~ Use 'play help cmd' to get more help on a specific command"
34     print "~"
35     print "~ Core commands:"
36     print "~ ~~~~~~~~~~~~~~"
37     for cmd in sorted(commands):
38         if not isCore(commands[cmd], play_env):
39             modules_commands.append(cmd)
40             continue
41         if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
42             print "~ " + cmd + (' ' * (16 - len(cmd))) + commands[cmd].HELP[cmd]
43     if len(modules_commands) > 0:
44         print "~"
45         print "~ Modules commands:"
46         print "~ ~~~~~~~~~~~~~~~~~"
47         for cmd in modules_commands:
48             if 'HELP' in dir(commands[cmd]) and cmd in commands[cmd].HELP:
49                 print "~ " + cmd + (' ' * (20 - len(cmd))) + commands[cmd].HELP[cmd]
50     print "~"
51     print "~ Also refer to documentation at http://www.playframework.org/documentation"
52     print "~"
53 
54 def isCore(mod, play_env):
55     return mod.__file__.find(play_env["basedir"]) == 0
wirelike/dark
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
wirelike/light
https://github.com/mxcl/homebrew/tree/master/Library/Formula/clisp.rb
 1 require 'formula'
 2 
 3 class Clisp < Formula
 4   url 'http://ftpmirror.gnu.org/clisp/release/2.49/clisp-2.49.tar.bz2'
 5   homepage 'http://clisp.cons.org/'
 6   md5 '1962b99d5e530390ec3829236d168649'
 7 
 8   depends_on 'libiconv'
 9   depends_on 'libsigsegv'
10   depends_on 'readline'
11 
12   skip_clean :all # otherwise abort trap
13 
14   fails_with_llvm "Fails during configure with LLVM GCC from XCode 4 on Snow Leopard"
15 
16   def install
17     ENV.j1 # This build isn't parallel safe.
18 
19     # Clisp requires to select word size explicitly this way,
20     # set it in CFLAGS won't work.
21     ENV['CC'] = "#{ENV.cc} -m#{MacOS.prefer_64_bit? ? 64 : 32}"
22 
23     system "./configure""--prefix=#{prefix}",
24                           "--with-readline=yes"
25 
26     cd "src" do
27       # Multiple -O options will be in the generated Makefile,
28       # make Homebrew's the last such option so it's effective.
29       inreplace "Makefile" do |s|
30         cf = s.get_make_var("CFLAGS")
31         cf.gsub! ENV['CFLAGS'], ''
32         cf += ' '+ENV['CFLAGS']
33         s.change_make_var! 'CFLAGS', cf
34       end
35 
36       # The ulimit must be set, otherwise `make` will fail and tell you to do so
37       system "ulimit -s 16384 && make"
38 
39       if MacOS.lion?
40         opoo "`make check` fails on Lion, so we are skipping it."
41         puts "But it probably means there will be other issues too."
42         puts "Please take them upstream to the clisp project itself."
43       else
44         # Considering the complexity of this package, a self-check is highly recommended.
45         system "make check"
46       end
47 
48       system "make install"
49     end
50   end
51 
52   def test
53     system "#{bin}/clisp --version"
54   end
55 end
wirelike/dark
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
wirelike/light
https://github.com/n8han/Unfiltered/tree/master/scalate/src/main/scala/scalate.scala
 1 package unfiltered.scalate
 2 
 3 import org.fusesource.scalate.{
 4   TemplateEngine, Binding, DefaultRenderContext, RenderContext}
 5 import unfiltered.request.{Path,HttpRequest}
 6 import unfiltered.response.{ResponseWriter}
 7 import java.io.{File,Writer,PrintWriter}
 8 
 9 object Scalate {
10   /** Constructs a ResponseWriter for Scalate templates.
11    *  Note that any parameter in the second, implicit set
12    *  can be overriden by specifying an implicit value of the
13    *  expected type in a pariticular scope. */
14   def apply[A, B](request: HttpRequest[A],
15                   template: String,
16                   attributes:(String,Any)*)
17   ( implicit
18     engine: TemplateEngine = defaultEngine,
19     contextBuilder: ToRenderContext = defaultRenderContext,
20     bindings: List[Binding] = Nil,
21     additionalAttributes: Seq[(String, Any)] = Nil
22   ) = new ResponseWriter {
23     def write(writer: Writer) {
24       val printWriter = new PrintWriter(writer)
25       try {
26         val scalateTemplate = engine.load(template, bindings)
27         val context = contextBuilder(Path(request), printWriter, engine)
28         (additionalAttributes ++ attributes) foreach {
29           case (k,v) => context.attributes(k) = v
30         }
31         engine.layout(scalateTemplate, context)
32       } catch {
33         case e if engine.isDevelopmentMode =>
34           printWriter.println("Exception: " + e.getMessage)
35           e.getStackTrace.foreach(printWriter.println)
36         case e => throw e
37       }
38     }
39   }
40 
41   /* Function to construct a RenderContext. */
42   type ToRenderContext =
43     (String, PrintWriter, TemplateEngine) => RenderContext
44 
45   private val defaultTemplateDirs = 
46     new File("src/main/resources/templates") :: Nil
47   private val defaultEngine = new TemplateEngine(defaultTemplateDirs)
48   private val defaultRenderContext: ToRenderContext =
49     (path, writer, engine) =>
50       new DefaultRenderContext(path, engine, writer)
51 }
wirelike/dark
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
wirelike/light
https://github.com/higepon/mosh/tree/master/tests/mecab.scm
 1 (import (rnrs)
 2         (mosh test)
 3         (mosh control)
 4         (mosh ffi)
 5         (mecab))
 6 
 7 (let1 m (mecab-new2 "")
 8   (test-false (pointer-null? m))
 9   (let* ([text (string->utf8 "僕はお腹がすいた")]
10          [len (bytevector-length text)])
11     (test-equal "僕\t名詞,代名詞,一般,*,*,*,僕,ボク,ボク\nは\t助詞,係助詞,*,*,*,*,は,ハ,ワ\nお腹\t名詞,一般,*,*,*,*,お腹,オナカ,オナカ\nが\t助詞,格助詞,一般,*,*,*,が,ガ,ガ\nすい\t動詞,自立,*,*,五段・カ行イ音便,連用タ接続,すく,スイ,スイ\nた\t助動詞,*,*,*,特殊・タ,基本形,た,タ,タ\nEOS\n"
12                 (mecab-sparse-tostr2 m text len))
13     (let loop ([node (mecab-sparse-tonode2 m text len)]
14                [surface* '()]
15                [feature* '()])
16       (cond
17        [(pointer-null? node)
18         (test-equal '("" "僕" "は" "お腹" "が" "すい" "た" "") (reverse surface*))
19         (test-equal '(("BOS/EOS" #f #f #f #f #f #f #f #f)
20                       ("名詞" "代名詞" "一般" #f #f #f "僕" "ボク" "ボク")
21                       ("助詞" "係助詞" #f #f #f #f "は" "ハ" "ワ")
22                       ("名詞" "一般" #f #f #f #f "お腹" "オナカ" "オナカ")
23                       ("助詞" "格助詞" "一般" #f #f #f "が" "ガ" "ガ")
24                       ("動詞" "自立" #f #f "五段・カ行イ音便" "連用タ接続" "すく" "スイ" "スイ")
25                       ("助動詞" #f #f #f "特殊・タ" "基本形" "た" "タ" "タ")
26                       ("BOS/EOS" #f #f #f #f #f #f #f #f))
27                     (reverse feature*))]
28        [else
29         (loop (mecab-node-next node)
30               (cons (mecab-node-surface node) surface*)
31               (cons (mecab-node-feature node) feature*))]))
32     (test-equal '("僕" "は" "お腹" "が" "すい" "た") (mecab-node-surface* (mecab-sparse-tonode2 m text len)))
33     (mecab-destroy m)))
34 
35 (test-results)
wirelike/dark
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))
wirelike/light
https://github.com/dyoo/moby-scheme/tree/master/sandbox/old-src/test/sample-moby-programs/reflex-scene.ss
 1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
 2 ;; about the language level of this file in a form that our tools can easily process.
 3 #reader(lib "htdp-beginner-reader.ss" "lang")((modname reflex-scene) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
 4 
 5 (define react-time 50)
 6 (define wait-time 500)
 7 (define blink-time 10)
 8 
 9 (define-struct world (time-remaining score))
10 
11 (define init-world (make-world 0 0))
12 
13 (define (key-handler world key)
14   (if (key=? key 'up)
15       (if (<= (world-time-remaining world) react-time)
16           ; got it!
17           (make-world (+ react-time (random wait-time)) (+ (world-score world) 1))
18           ; too early!
19           (make-world (+ react-time (random wait-time)) (- (world-score world) 1)))
20       world))
21 
22 (define (tick-handler world)
23   (if (<= (world-time-remaining world) 0)
24       ; missed it!
25       (make-world (+ react-time (random wait-time)) (world-score world))
26       ; counting
27       (make-world (- (world-time-remaining world) 1) (world-score world))))
28 
29 (define (background world)
30   (if (and (<= (world-time-remaining world) react-time)
31                   (> (world-time-remaining world) (- react-time blink-time)))
32              (rectangle 100 100 'solid 'red)
33              (rectangle 100 100 'solid 'gray)))
34 
35 (define (score world)
36   (text (number->string (world-score world)) 12 'black))
37 
38 (define (redraw world)
39   (place-image (score world) 0 0
40                (place-image (background world) 0 0
41                             (empty-scene 400 300))))
42 
43 ;; RUN PROGRAM
44 (big-bang 400 300 init-world
45           (on-tick 0.01 tick-handler)
46           (on-key key-handler)
47           (on-redraw redraw))